babylon.guiEditor.max.js 1.6 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("babylonjs-gui"), require("babylonjs"));
  4. else if(typeof define === 'function' && define.amd)
  5. define("babylonjs-gui-editor", ["babylonjs-gui", "babylonjs"], factory);
  6. else if(typeof exports === 'object')
  7. exports["babylonjs-gui-editor"] = factory(require("babylonjs-gui"), require("babylonjs"));
  8. else
  9. root["GUIEDITOR"] = factory(root["BABYLON"]["GUI"], root["BABYLON"]);
  10. })((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_babylonjs_gui_2D_controls_button__, __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_observable__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./legacy/legacy.ts");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./components/log/log.scss":
  99. /*!**************************************************************************************************************************************************************************!*\
  100. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/css-loader/dist/cjs.js!C:/Microsoft/Babylon/Babylon.js/node_modules/sass-loader/dist/cjs.js!./components/log/log.scss ***!
  101. \**************************************************************************************************************************************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. // Imports
  105. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ "../../node_modules/css-loader/dist/runtime/api.js");
  106. exports = ___CSS_LOADER_API_IMPORT___(false);
  107. // Module
  108. exports.push([module.i, "#log-console {\n background: #333333;\n height: 120px;\n box-sizing: border-box;\n margin: 0;\n padding: 10px;\n width: 100%;\n overflow: hidden;\n overflow-y: auto; }\n #log-console .log {\n color: white;\n font-size: 14px;\n font-family: 'Courier New', Courier, monospace; }\n #log-console .log.error {\n color: red; }\n", ""]);
  109. // Exports
  110. module.exports = exports;
  111. /***/ }),
  112. /***/ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./components/nodeList/guiList.scss":
  113. /*!***********************************************************************************************************************************************************************************!*\
  114. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/css-loader/dist/cjs.js!C:/Microsoft/Babylon/Babylon.js/node_modules/sass-loader/dist/cjs.js!./components/nodeList/guiList.scss ***!
  115. \***********************************************************************************************************************************************************************************/
  116. /*! no static exports found */
  117. /***/ (function(module, exports, __webpack_require__) {
  118. // Imports
  119. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ "../../node_modules/css-loader/dist/runtime/api.js");
  120. exports = ___CSS_LOADER_API_IMPORT___(false);
  121. // Module
  122. exports.push([module.i, "#guiList {\n background: #333333;\n height: 100%;\n margin: 0;\n padding: 0;\n display: grid;\n width: 100%;\n overflow: hidden; }\n #guiList .panes {\n overflow: hidden; }\n #guiList .panes .pane {\n color: white;\n overflow: hidden;\n height: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n #guiList .panes .pane .filter {\n display: flex;\n align-items: stretch; }\n #guiList .panes .pane .filter input {\n width: 100%;\n margin: 10px 10px 5px 10px;\n display: block;\n border: none;\n padding: 0;\n border-bottom: solid 1px #337ab7;\n background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 96%, #337ab7 4%);\n background-position: -1000px 0;\n background-size: 1000px 100%;\n background-repeat: no-repeat;\n color: white; }\n #guiList .panes .pane .filter input:focus {\n box-shadow: none;\n outline: none;\n background-position: 0 0; }\n #guiList .panes .pane .filter input::placeholder {\n color: gray; }\n #guiList .panes .pane .list-container {\n overflow-x: hidden;\n overflow-y: auto;\n height: calc(100% - 32px); }\n #guiList .panes .pane .list-container .underline {\n border-bottom: 0.5px solid rgba(255, 255, 255, 0.5); }\n #guiList .panes .pane .list-container .draggableLine {\n height: 30px;\n display: grid;\n align-items: center;\n justify-items: stretch;\n background: #222222;\n cursor: grab;\n text-align: center;\n margin: 0;\n box-sizing: border-box; }\n #guiList .panes .pane .list-container .draggableLine:hover {\n background: #337ab7;\n color: white; }\n #guiList .panes .pane .list-container .nonDraggableLine {\n height: 30px;\n display: grid;\n align-items: center;\n justify-items: stretch;\n background: #222222;\n text-align: center;\n margin: 0;\n box-sizing: border-box; }\n #guiList .panes .pane .list-container .withButton {\n height: 30px;\n position: relative; }\n #guiList .panes .pane .list-container .withButton .icon {\n position: absolute;\n right: 4px;\n top: 5px; }\n #guiList .panes .pane .list-container .withButton .icon:hover {\n cursor: pointer; }\n #guiList .panes .pane .list-container .withButton .icon .img {\n height: 17px;\n width: 17px; }\n #guiList .panes .pane .list-container .withButton .buttonLine {\n height: 30px;\n display: grid;\n align-items: center;\n justify-items: stretch;\n padding-bottom: 5px;\n position: absolute;\n right: 0px;\n top: 2px; }\n #guiList .panes .pane .list-container .withButton .buttonLine input[type=\"file\"] {\n display: none; }\n #guiList .panes .pane .list-container .withButton .buttonLine .file-upload {\n background: transparent;\n border: transparent;\n padding: 15px 200px;\n opacity: 0.9;\n cursor: pointer;\n text-align: center; }\n #guiList .panes .pane .list-container .withButton .buttonLine .file-upload:hover {\n opacity: 1.0; }\n #guiList .panes .pane .list-container .withButton .buttonLine .file-upload:active {\n transform: scale(0.98);\n transform-origin: 0.5 0.5; }\n #guiList .panes .pane .list-container .withButton .buttonLine button {\n background: transparent;\n border: transparent;\n margin: 5px 10px 5px 10px;\n color: white;\n padding: 4px 5px;\n opacity: 0.9; }\n #guiList .panes .pane .list-container .withButton .buttonLine button:hover {\n opacity: 0.0; }\n #guiList .panes .pane .list-container .withButton .buttonLine button:active {\n background: transparent; }\n #guiList .panes .pane .list-container .withButton .buttonLine button:focus {\n border: transparent;\n outline: 0px; }\n #guiList .panes .pane .list-container .paneContainer {\n margin-top: 3px;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 100%; }\n #guiList .panes .pane .list-container .paneContainer .paneContainer-content {\n grid-row: 1;\n grid-column: 1; }\n #guiList .panes .pane .list-container .paneContainer .paneContainer-content .header {\n display: grid;\n grid-template-columns: 1fr auto;\n background: #555555;\n height: 30px;\n padding-right: 5px;\n cursor: pointer; }\n #guiList .panes .pane .list-container .paneContainer .paneContainer-content .header .title {\n border-left: 3px solid transparent;\n padding-left: 5px;\n grid-column: 1;\n display: flex;\n align-items: center; }\n #guiList .panes .pane .list-container .paneContainer .paneContainer-content .header .collapse {\n grid-column: 2;\n display: flex;\n align-items: center;\n justify-items: center;\n transform-origin: center; }\n #guiList .panes .pane .list-container .paneContainer .paneContainer-content .header .collapse.closed {\n transform: rotate(180deg); }\n #guiList .panes .pane .list-container .paneContainer .paneContainer-content .paneList > div:not(:last-child) {\n border-bottom: 1px solid rgba(255, 255, 255, 0.3); }\n", ""]);
  123. // Exports
  124. module.exports = exports;
  125. /***/ }),
  126. /***/ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./components/propertyTab/propertyTab.scss":
  127. /*!******************************************************************************************************************************************************************************************!*\
  128. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/css-loader/dist/cjs.js!C:/Microsoft/Babylon/Babylon.js/node_modules/sass-loader/dist/cjs.js!./components/propertyTab/propertyTab.scss ***!
  129. \******************************************************************************************************************************************************************************************/
  130. /*! no static exports found */
  131. /***/ (function(module, exports, __webpack_require__) {
  132. // Imports
  133. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ "../../node_modules/css-loader/dist/runtime/api.js");
  134. exports = ___CSS_LOADER_API_IMPORT___(false);
  135. // Module
  136. exports.push([module.i, "#propertyTab {\n color: white;\n background: #333333; }\n #propertyTab #header {\n height: 30px;\n font-size: 16px;\n color: white;\n background: #222222;\n grid-row: 1;\n text-align: center;\n display: grid;\n grid-template-columns: 30px 1fr;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n #propertyTab #header #logo {\n position: relative;\n grid-column: 1;\n width: 24px;\n height: 24px;\n left: 0;\n display: flex;\n align-self: center;\n justify-self: center; }\n #propertyTab #header #title {\n grid-column: 2;\n display: grid;\n align-items: center;\n text-align: center; }\n #propertyTab .range {\n -webkit-appearance: none;\n width: 120px;\n height: 6px;\n background: #d3d3d3;\n border-radius: 5px;\n outline: none;\n opacity: 0.7;\n -webkit-transition: .2s;\n transition: opacity .2s; }\n #propertyTab .range:hover {\n opacity: 1; }\n #propertyTab .range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n background: #337ab7;\n cursor: pointer; }\n #propertyTab .range::-moz-range-thumb {\n width: 14px;\n height: 14px;\n border-radius: 50%;\n background: #337ab7;\n cursor: pointer; }\n #propertyTab input[type=\"color\"] {\n -webkit-appearance: none;\n border: 1px solid rgba(255, 255, 255, 0.5);\n padding: 0;\n width: 30px;\n height: 20px; }\n #propertyTab input[type=\"color\"]::-webkit-color-swatch-wrapper {\n padding: 0; }\n #propertyTab input[type=\"color\"]::-webkit-color-swatch {\n border: none; }\n #propertyTab .sliderLine {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 1fr 40px; }\n #propertyTab .sliderLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .sliderLine .slider {\n grid-column: 3;\n grid-row: 1;\n margin-right: 5px;\n width: 90%;\n display: flex;\n align-items: center; }\n #propertyTab .sliderLine .floatLine {\n padding-left: 5px; }\n #propertyTab .sliderLine .floatLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .sliderLine .floatLine .short {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .sliderLine .floatLine .short input {\n width: 27px; }\n #propertyTab .sliderLine .floatLine .short input::-webkit-outer-spin-button,\n #propertyTab .sliderLine .floatLine .short input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0; }\n #propertyTab .sliderLine .floatLine .short input[type=number] {\n -moz-appearance: textfield; }\n #propertyTab .textInputLine {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr 120px auto; }\n #propertyTab .textInputLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .textInputLine .value {\n display: flex;\n align-items: center;\n grid-column: 2; }\n #propertyTab .textInputLine .value input {\n width: calc(100% - 5px); }\n #propertyTab .textInputArea {\n padding-left: 5px;\n height: 100%;\n display: grid;\n grid-template-columns: 1fr 120px; }\n #propertyTab .textInputArea .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .textInputArea .value {\n display: flex;\n align-items: center;\n grid-column: 2; }\n #propertyTab .textInputArea .value textarea {\n width: calc(150% - 5px);\n margin-left: -50%;\n height: 40px; }\n #propertyTab .paneContainer {\n margin-top: 3px;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 100%; }\n #propertyTab .paneContainer .paneList {\n border-left: 3px solid transparent; }\n #propertyTab .paneContainer:hover .paneList {\n border-left: 3px solid rgba(51, 122, 183, 0.8); }\n #propertyTab .paneContainer:hover .paneContainer-content .header .title {\n border-left: 3px solid #337ab7; }\n #propertyTab .paneContainer .paneContainer-highlight-border {\n grid-row: 1;\n grid-column: 1;\n opacity: 1;\n border: 3px solid red;\n transition: opacity 250ms;\n pointer-events: none; }\n #propertyTab .paneContainer .paneContainer-highlight-border.transparent {\n opacity: 0; }\n #propertyTab .paneContainer .paneContainer-content {\n grid-row: 1;\n grid-column: 1; }\n #propertyTab .paneContainer .paneContainer-content .header {\n display: grid;\n grid-template-columns: 1fr auto;\n background: #555555;\n height: 30px;\n padding-right: 5px;\n cursor: pointer; }\n #propertyTab .paneContainer .paneContainer-content .header .title {\n border-left: 3px solid transparent;\n padding-left: 5px;\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .paneContainer .paneContainer-content .header .collapse {\n grid-column: 2;\n display: flex;\n align-items: center;\n justify-items: center;\n transform-origin: center; }\n #propertyTab .paneContainer .paneContainer-content .header .collapse.closed {\n transform: rotate(180deg); }\n #propertyTab .paneContainer .paneContainer-content .paneList > div:not(:last-child) {\n border-bottom: 0.5px solid rgba(255, 255, 255, 0.1); }\n #propertyTab .paneContainer .paneContainer-content .fragment > div:not(:last-child) {\n border-bottom: 0.5px solid rgba(255, 255, 255, 0.1); }\n #propertyTab .color-picker {\n height: calc(100% - 8px);\n margin: 4px;\n width: calc(100% - 8px); }\n #propertyTab .color-picker .color-rect {\n height: calc(100% - 4px);\n border: 2px white solid;\n cursor: pointer;\n min-height: 18px; }\n #propertyTab .color-picker .color-picker-cover {\n position: fixed;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px; }\n #propertyTab .color-picker .color-picker-float {\n z-index: 2;\n position: absolute; }\n #propertyTab .gradient-step {\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 20px 30px 40px auto 20px 30px;\n padding-top: 5px;\n padding-left: 5px;\n padding-bottom: 5px; }\n #propertyTab .gradient-step .step {\n grid-row: 1;\n grid-column: 1; }\n #propertyTab .gradient-step .color {\n grid-row: 1;\n grid-column: 2;\n cursor: pointer; }\n #propertyTab .gradient-step .step-value {\n margin-left: 5px;\n grid-row: 1;\n grid-column: 3;\n text-align: right;\n margin-right: 5px; }\n #propertyTab .gradient-step .step-slider {\n grid-row: 1;\n grid-column: 4;\n display: grid;\n justify-content: stretch;\n align-content: center;\n margin-right: -5px;\n padding-left: 12px; }\n #propertyTab .gradient-step .step-slider input {\n width: 90%; }\n #propertyTab .gradient-step .gradient-copy {\n grid-row: 1;\n grid-column: 5;\n display: grid;\n align-content: center;\n justify-content: center; }\n #propertyTab .gradient-step .gradient-copy .img {\n height: 20px;\n width: 20px; }\n #propertyTab .gradient-step .gradient-copy .img:hover {\n cursor: pointer; }\n #propertyTab .gradient-step .gradient-delete {\n grid-row: 1;\n grid-column: 6;\n display: grid;\n align-content: center;\n justify-content: center; }\n #propertyTab .gradient-step .gradient-delete .img {\n height: 20px;\n width: 20px; }\n #propertyTab .gradient-step .gradient-delete .img:hover {\n cursor: pointer; }\n #propertyTab .floatLine {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr 120px; }\n #propertyTab .floatLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .floatLine .value {\n grid-column: 2;\n display: flex;\n align-items: center; }\n #propertyTab .floatLine .value input {\n width: 110px; }\n #propertyTab .floatLine .short {\n grid-column: 2;\n display: flex;\n align-items: center; }\n #propertyTab .floatLine .short input {\n width: 27px; }\n #propertyTab .floatLine .short input::-webkit-outer-spin-button,\n #propertyTab .floatLine .short input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0; }\n #propertyTab .floatLine .short input[type=number] {\n -moz-appearance: textfield; }\n #propertyTab .vector3Line {\n padding-left: 5px;\n display: grid; }\n #propertyTab .vector3Line .firstLine {\n display: grid;\n grid-template-columns: 1fr auto 20px;\n height: 30px; }\n #propertyTab .vector3Line .firstLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .vector3Line .firstLine .vector {\n grid-column: 2;\n display: flex;\n align-items: center;\n text-align: right;\n opacity: 0.8; }\n #propertyTab .vector3Line .firstLine .expand {\n grid-column: 3;\n display: grid;\n align-items: center;\n justify-items: center;\n cursor: pointer; }\n #propertyTab .vector3Line .secondLine {\n display: grid;\n padding-right: 5px;\n border-left: 1px solid #337ab7; }\n #propertyTab .vector3Line .secondLine .no-right-margin {\n margin-right: 0; }\n #propertyTab .vector3Line .secondLine .numeric {\n display: grid;\n grid-template-columns: 1fr auto; }\n #propertyTab .vector3Line .secondLine .numeric-label {\n text-align: right;\n grid-column: 1;\n display: flex;\n align-items: center;\n justify-self: right;\n margin-right: 10px; }\n #propertyTab .vector3Line .secondLine .numeric-value {\n width: 120px;\n grid-column: 2;\n display: flex;\n align-items: center;\n border: 1px solid #337ab7; }\n #propertyTab .buttonLine {\n height: 30px;\n display: grid;\n align-items: center;\n justify-items: stretch;\n padding-bottom: 5px; }\n #propertyTab .buttonLine input[type=\"file\"] {\n display: none; }\n #propertyTab .buttonLine .file-upload {\n background: #222222;\n border: 1px solid #337ab7;\n margin: 5px 10px;\n color: white;\n padding: 4px 5px;\n padding-top: 0px;\n opacity: 0.9;\n cursor: pointer;\n text-align: center; }\n #propertyTab .buttonLine .file-upload:hover {\n opacity: 1.0; }\n #propertyTab .buttonLine .file-upload:active {\n transform: scale(0.98);\n transform-origin: 0.5 0.5; }\n #propertyTab .buttonLine button {\n background: #222222;\n border: 1px solid #337ab7;\n margin: 5px 10px 5px 10px;\n color: white;\n padding: 4px 5px;\n opacity: 0.9; }\n #propertyTab .buttonLine button:hover {\n opacity: 1.0; }\n #propertyTab .buttonLine button:active {\n background: #282828; }\n #propertyTab .buttonLine button:focus {\n border: 1px solid #337ab7;\n outline: 0px; }\n #propertyTab .numeric {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr 120px auto; }\n #propertyTab .numeric .numeric-label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .numeric .number {\n display: flex;\n align-items: center;\n grid-column: 2;\n height: 10px; }\n #propertyTab .numeric .number .input {\n width: calc(100% - 5px);\n height: 10px; }\n #propertyTab .checkBoxLine {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr auto; }\n #propertyTab .checkBoxLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .checkBoxLine .checkBox {\n grid-column: 2;\n display: flex;\n align-items: center; }\n #propertyTab .checkBoxLine .checkBox .lbl {\n position: relative;\n display: block;\n height: 14px;\n width: 34px;\n margin-right: 5px;\n background: #898989;\n border-radius: 100px;\n cursor: pointer;\n transition: all 0.3s ease; }\n #propertyTab .checkBoxLine .checkBox .lbl:after {\n position: absolute;\n left: 3px;\n top: 2px;\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.05);\n content: '';\n transition: all 0.15s ease; }\n #propertyTab .checkBoxLine .checkBox .lbl:active:after {\n transform: scale(1.15, 0.85); }\n #propertyTab .checkBoxLine .checkBox .cbx:checked ~ label {\n background: #337ab7; }\n #propertyTab .checkBoxLine .checkBox .cbx:checked ~ label:after {\n left: 20px;\n background: #164975; }\n #propertyTab .checkBoxLine .checkBox .cbx:checked ~ label.disabled {\n background: #164975;\n cursor: pointer; }\n #propertyTab .checkBoxLine .checkBox .cbx:checked ~ label.disabled:after {\n left: 20px;\n background: #555555;\n cursor: pointer; }\n #propertyTab .checkBoxLine .checkBox .cbx ~ label.disabled {\n background: #555555;\n cursor: pointer; }\n #propertyTab .checkBoxLine .checkBox .hidden {\n display: none; }\n #propertyTab .listLine {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr auto; }\n #propertyTab .listLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .listLine .options {\n grid-column: 2;\n display: flex;\n align-items: center;\n margin-right: 5px; }\n #propertyTab .listLine .options select {\n width: 115px; }\n #propertyTab .color3Line {\n padding-left: 5px;\n display: grid; }\n #propertyTab .color3Line .firstLine {\n height: 30px;\n display: grid;\n grid-template-columns: 1fr auto 20px 20px; }\n #propertyTab .color3Line .firstLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .color3Line .firstLine .color3 {\n grid-column: 2;\n width: 50px;\n display: flex;\n align-items: center; }\n #propertyTab .color3Line .firstLine .color3 input {\n margin-right: 5px; }\n #propertyTab .color3Line .firstLine .copy {\n grid-column: 3;\n display: grid;\n align-items: center;\n justify-items: center;\n cursor: pointer; }\n #propertyTab .color3Line .firstLine .copy img {\n height: 100%;\n width: 20px; }\n #propertyTab .color3Line .firstLine .expand {\n grid-column: 4;\n display: grid;\n align-items: center;\n justify-items: center;\n cursor: pointer; }\n #propertyTab .color3Line .firstLine .expand img {\n height: 100%;\n width: 20px; }\n #propertyTab .color3Line .secondLine {\n display: grid;\n padding-right: 5px;\n border-left: 1px solid #337ab7; }\n #propertyTab .color3Line .secondLine .numeric {\n display: grid;\n grid-template-columns: 1fr auto; }\n #propertyTab .color3Line .secondLine .numeric-label {\n text-align: right;\n grid-column: 1;\n display: flex;\n align-items: center;\n justify-self: right;\n margin-right: 10px; }\n #propertyTab .color3Line .secondLine .numeric-value {\n width: 120px;\n grid-column: 2;\n display: flex;\n align-items: center;\n border: 1px solid #337ab7; }\n #propertyTab .textLine {\n padding-left: 5px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr auto; }\n #propertyTab .textLine .label {\n grid-column: 1;\n display: flex;\n align-items: center; }\n #propertyTab .textLine .link-value {\n grid-column: 2;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n text-align: end;\n opacity: 0.8;\n margin: 5px;\n margin-top: 6px;\n max-width: 140px;\n text-decoration: underline;\n cursor: pointer; }\n #propertyTab .textLine .value {\n grid-column: 2;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n text-align: end;\n opacity: 0.8;\n margin: 5px;\n margin-top: 6px;\n max-width: 200px;\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text; }\n #propertyTab .textLine .value.check {\n color: green; }\n #propertyTab .textLine .value.uncheck {\n color: red; }\n", ""]);
  137. // Exports
  138. module.exports = exports;
  139. /***/ }),
  140. /***/ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./diagram/graphCanvas.scss":
  141. /*!***************************************************************************************************************************************************************************!*\
  142. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/css-loader/dist/cjs.js!C:/Microsoft/Babylon/Babylon.js/node_modules/sass-loader/dist/cjs.js!./diagram/graphCanvas.scss ***!
  143. \***************************************************************************************************************************************************************************/
  144. /*! no static exports found */
  145. /***/ (function(module, exports, __webpack_require__) {
  146. // Imports
  147. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ "../../node_modules/css-loader/dist/runtime/api.js");
  148. exports = ___CSS_LOADER_API_IMPORT___(false);
  149. // Module
  150. exports.push([module.i, "#graph-canvas {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n font: 14px \"acumin-pro\";\n user-select: none;\n overflow: hidden;\n cursor: move;\n background-image: linear-gradient(to right, #4F4E4F 1px, transparent 1px), linear-gradient(to bottom, #4F4E4F 1px, transparent 1px); }\n #graph-canvas #selection-container {\n pointer-events: none; }\n #graph-canvas #selection-container .selection-box {\n z-index: 10;\n position: absolute;\n background: rgba(72, 72, 196, 0.5);\n border: blue solid 2px; }\n #graph-canvas .port {\n border-radius: 20px;\n width: 20px;\n height: 20px;\n align-self: center; }\n #graph-canvas .port .img {\n width: 100%; }\n #graph-canvas .port img.selected {\n box-shadow: 0 0 0 2px;\n border-radius: 50%; }\n #graph-canvas .port:hover, #graph-canvas .port.selected {\n filter: brightness(2); }\n #graph-canvas .portLine {\n height: 24px;\n display: grid;\n grid-template-rows: 100%; }\n #graph-canvas .port-label {\n align-items: center; }\n #graph-canvas .inputsContainer {\n grid-row: 1;\n grid-column: 1; }\n #graph-canvas .inputsContainer .portLine {\n grid-template-columns: 12px calc(100% - 15px); }\n #graph-canvas .inputsContainer .portLine .port-label {\n grid-row: 1;\n grid-column: 2; }\n #graph-canvas .inputsContainer .portLine .port {\n grid-row: 1;\n grid-column: 1;\n transform: translateX(-12px); }\n #graph-canvas .outputsContainer {\n grid-row: 1;\n grid-column: 2; }\n #graph-canvas .outputsContainer .portLine {\n grid-template-columns: calc(100% - 10px) 12px; }\n #graph-canvas .outputsContainer .portLine .port-label {\n grid-row: 1;\n grid-column: 1;\n text-align: right; }\n #graph-canvas .outputsContainer .portLine .port {\n grid-row: 1;\n grid-column: 2;\n transform: translateX(2px); }\n #graph-canvas #graph-container {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n transform-origin: left top;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 100%; }\n #graph-canvas #graph-container #frame-container {\n overflow: visible;\n grid-row: 1;\n grid-column: 1;\n position: relative;\n width: 100%;\n height: 100%; }\n #graph-canvas #graph-container .frame-box {\n position: absolute;\n background: rgba(72, 72, 72, 0.7);\n display: grid;\n grid-template-rows: 40px calc(100% - 40px);\n grid-template-columns: 100%;\n box-sizing: border-box; }\n #graph-canvas #graph-container .frame-box.collapsed {\n height: auto !important;\n width: 200px !important;\n z-index: 3; }\n #graph-canvas #graph-container .frame-box.collapsed .frame-box-header {\n font-size: 16px;\n grid-template-columns: calc(100% - 37px) 30px 7px; }\n #graph-canvas #graph-container .frame-box.collapsed .frame-box-header .frame-box-header-collapse {\n margin-top: -2px; }\n #graph-canvas #graph-container .frame-box.collapsed .frame-box-header .frame-box-header-close {\n display: none; }\n #graph-canvas #graph-container .frame-box.collapsed .frame-comments.has-comments .frame-comment-span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden; }\n #graph-canvas #graph-container .frame-box .frame-box-border {\n grid-row: 1 / span 2;\n grid-column: 1;\n width: 100%;\n height: 100%;\n border: transparent solid 4px;\n pointer-events: none;\n box-sizing: border-box; }\n #graph-canvas #graph-container .frame-box .frame-box-header {\n grid-row: 1;\n grid-column: 1;\n background: #484848;\n color: white;\n font-size: 24px;\n text-align: center;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: calc(100% - 74px) 30px 7px 30px 7px;\n align-content: center;\n overflow: hidden; }\n #graph-canvas #graph-container .frame-box .frame-box-header .frame-box-header-button {\n cursor: pointer;\n align-self: center;\n transform-origin: 50% 50%;\n transform: scale(1);\n stroke: transparent;\n fill: white;\n display: grid; }\n #graph-canvas #graph-container .frame-box .frame-box-header .frame-box-header-button.down {\n transform: scale(0.9); }\n #graph-canvas #graph-container .frame-box .frame-box-header .frame-box-header-collapse {\n grid-column: 2;\n grid-row: 1; }\n #graph-canvas #graph-container .frame-box .frame-box-header .frame-box-header-close {\n grid-column: 4;\n grid-row: 1; }\n #graph-canvas #graph-container .frame-box .frame-box-header .frame-box-header-title {\n grid-column: 1;\n grid-row: 1;\n display: grid;\n height: 100%;\n width: 100%;\n align-self: stretch;\n align-items: center;\n margin-top: -2px; }\n #graph-canvas #graph-container .frame-box .port-container {\n margin-top: 6px;\n margin-bottom: 6px;\n margin-left: 4px;\n margin-right: 4px;\n color: white;\n grid-row: 2;\n grid-column: 1;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 50% 50%;\n z-index: 2; }\n #graph-canvas #graph-container .frame-box .frame-comments.has-comments {\n display: grid;\n grid-row: 2;\n grid-column: 1;\n padding: 0 10px;\n font-style: italic;\n word-wrap: break-word; }\n #graph-canvas #graph-container .frame-box.selected .frame-box-border {\n border-color: white; }\n #graph-canvas #graph-container .frame-box .right-handle {\n grid-area: 1 / 2 / 3 / 2;\n width: 4px;\n background-color: transparent;\n cursor: ew-resize; }\n #graph-canvas #graph-container .frame-box .right-handle::after {\n content: \"\";\n width: 8px;\n position: absolute;\n top: 0;\n bottom: 0;\n margin-left: -4px;\n cursor: ew-resize; }\n #graph-canvas #graph-container .frame-box .right-handle.collapsed {\n cursor: pointer; }\n #graph-canvas #graph-container .frame-box .top-right-corner-handle {\n background-color: transparent;\n height: 4px;\n z-index: 21;\n cursor: ne-resize;\n width: 4px;\n margin-left: -6px; }\n #graph-canvas #graph-container .frame-box .top-right-corner-handle::after {\n background-color: transparent;\n cursor: ne-resize;\n margin-left: unset;\n top: -4px;\n height: 10px;\n width: 10px; }\n #graph-canvas #graph-container .frame-box .bottom-right-corner-handle {\n background-color: transparent;\n height: 0px;\n z-index: 21;\n cursor: nw-resize;\n grid-area: 4 / 2 / 4 / 2;\n margin-left: -2px; }\n #graph-canvas #graph-container .frame-box .bottom-right-corner-handle::after {\n background-color: transparent;\n height: 10px;\n cursor: nw-resize;\n top: unset;\n bottom: -4px;\n width: 10px; }\n #graph-canvas #graph-container .frame-box .left-handle {\n grid-area: 1 / 1 / 3 / 1;\n width: 4px;\n background-color: transparent;\n cursor: ew-resize; }\n #graph-canvas #graph-container .frame-box .left-handle::before {\n content: \"\";\n width: 8px;\n position: absolute;\n top: 0;\n bottom: 0;\n margin-left: -4px; }\n #graph-canvas #graph-container .frame-box .top-left-corner-handle {\n background-color: transparent;\n height: 4px;\n z-index: 21;\n cursor: nw-resize;\n width: 4px;\n margin-left: -4px; }\n #graph-canvas #graph-container .frame-box .top-left-corner-handle::before {\n background-color: transparent;\n cursor: nw-resize;\n margin-left: unset;\n top: -4px;\n height: 10px;\n width: 10px; }\n #graph-canvas #graph-container .frame-box .bottom-left-corner-handle {\n background-color: transparent;\n height: 0px;\n z-index: 21;\n cursor: sw-resize;\n grid-area: 4 / 1 / 4 / 1; }\n #graph-canvas #graph-container .frame-box .bottom-left-corner-handle::before {\n background-color: transparent;\n height: 10px;\n cursor: sw-resize;\n top: unset;\n bottom: -4px;\n width: 10px; }\n #graph-canvas #graph-container .frame-box .top-handle {\n grid-area: 1 / 1 / 1 / 1;\n background-color: transparent;\n height: 4px;\n cursor: ns-resize; }\n #graph-canvas #graph-container .frame-box .top-handle::before {\n content: \"\";\n width: 100%;\n position: absolute;\n top: -4px;\n bottom: 100%;\n right: 0;\n left: 0;\n margin-bottom: -8px;\n cursor: ns-resize;\n height: 8px; }\n #graph-canvas #graph-container .frame-box .bottom-handle {\n grid-area: 3 / 1 / 3 / 1;\n background-color: transparent;\n height: 4px;\n cursor: ns-resize; }\n #graph-canvas #graph-container .frame-box .bottom-handle::after {\n content: \"\";\n width: 100%;\n position: absolute;\n top: 100%;\n bottom: 0;\n right: 0;\n left: 0;\n margin-top: -8px;\n cursor: ns-resize;\n height: 12px; }\n #graph-canvas #graph-container .frame-box.collapsed .top-handle, #graph-canvas #graph-container .frame-box.collapsed .top-right-corner-handle, #graph-canvas #graph-container .frame-box.collapsed .right-handle, #graph-canvas #graph-container .frame-box.collapsed .bottom-right-corner-handle, #graph-canvas #graph-container .frame-box.collapsed .bottom-handle, #graph-canvas #graph-container .frame-box.collapsed .bottom-left-corner-handle, #graph-canvas #graph-container .frame-box.collapsed .left-handle, #graph-canvas #graph-container .frame-box.collapsed .top-left-corner-handle {\n cursor: default; }\n #graph-canvas #graph-container .frame-box.collapsed .right-handle::after, #graph-canvas #graph-container .frame-box.collapsed .bottom-handle::after, #graph-canvas #graph-container .frame-box.collapsed .top-right-corner-handle::after, #graph-canvas #graph-container .frame-box.collapsed .bottom-right-corner-handle::after {\n cursor: default; }\n #graph-canvas #graph-container .frame-box.collapsed .left-handle::before, #graph-canvas #graph-container .frame-box.collapsed .top-handle::before, #graph-canvas #graph-container .frame-box.collapsed .top-left-corner-handle::before, #graph-canvas #graph-container .frame-box.collapsed .bottom-left-corner-handle::before {\n cursor: default; }\n #graph-canvas #graph-container #graph-svg-container {\n grid-row: 1;\n grid-column: 1;\n position: relative;\n width: 100%;\n height: 100%;\n overflow: visible;\n pointer-events: none;\n z-index: 2; }\n #graph-canvas #graph-container #graph-svg-container .link {\n stroke-width: 4px; }\n #graph-canvas #graph-container #graph-svg-container .link.selected {\n stroke: white !important;\n stroke-dasharray: 10, 2; }\n #graph-canvas #graph-container #graph-svg-container .link.hidden {\n display: none; }\n #graph-canvas #graph-container #graph-svg-container .selection-link {\n pointer-events: all;\n stroke-width: 16px;\n opacity: 0;\n transition: opacity 75ms;\n stroke: transparent;\n cursor: pointer; }\n #graph-canvas #graph-container #graph-svg-container .selection-link.hidden {\n display: none; }\n #graph-canvas #graph-container #graph-svg-container .selection-link:hover, #graph-canvas #graph-container #graph-svg-container .selection-link.selected {\n stroke: white !important;\n opacity: 0.4; }\n #graph-canvas #graph-container #graph-canvas-container {\n grid-row: 1;\n grid-column: 1;\n position: relative;\n width: 100%;\n height: 100%; }\n #graph-canvas #graph-container #graph-canvas-container .visual {\n z-index: 4;\n width: 200px;\n position: absolute;\n left: 0;\n top: 0;\n background: gray;\n border: 4px solid black;\n border-radius: 12px;\n display: grid;\n grid-template-rows: 30px auto;\n grid-template-columns: 100%;\n color: white; }\n #graph-canvas #graph-container #graph-canvas-container .visual.hidden {\n display: none; }\n #graph-canvas #graph-container #graph-canvas-container .visual .comments {\n position: absolute;\n top: -50px;\n width: 200px;\n height: 45px;\n overflow: hidden;\n font-style: italic;\n opacity: 0.8;\n display: grid;\n align-items: flex-end;\n pointer-events: none; }\n #graph-canvas #graph-container #graph-canvas-container .visual .selection-border {\n grid-row: 1 / span 3;\n grid-column: 1;\n margin: -4px;\n transition: border-color 100ms;\n border: 4px solid black;\n border-radius: 12px; }\n #graph-canvas #graph-container #graph-canvas-container .visual.selected .selection-border {\n border-color: white; }\n #graph-canvas #graph-container #graph-canvas-container .visual .header {\n grid-row: 1;\n grid-column: 1;\n border: 4px solid black;\n border-top-right-radius: 7px;\n border-top-left-radius: 7px;\n font-size: 16px;\n text-align: center;\n margin-top: -1px;\n margin-left: -1px;\n margin-right: -1px;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n background: black;\n color: white; }\n #graph-canvas #graph-container #graph-canvas-container .visual .header.constant {\n border-color: #464348;\n background: #464348; }\n #graph-canvas #graph-container #graph-canvas-container .visual .header.inspector {\n border-color: #66491b;\n background: #66491b; }\n #graph-canvas #graph-container #graph-canvas-container .visual .connections {\n grid-row: 2;\n grid-column: 1;\n display: grid;\n grid-template-columns: 50% 50%; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content {\n min-height: 20px;\n grid-row: 3;\n grid-column: 1; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.input-block {\n grid-row: 2;\n min-height: 34px;\n text-align: center;\n font-size: 18px;\n font-weight: bold;\n margin: 0 10px 5px;\n display: grid;\n align-content: center; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.input-block.small-font {\n font-size: 17px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.output-block {\n min-height: 0px;\n height: 5px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.clamp-block {\n grid-row: 2;\n height: 34px;\n text-align: center;\n font-size: 18px;\n font-weight: bold;\n margin: 0 10px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.gradient-block {\n grid-row: 2;\n height: 34px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.texture-block {\n grid-row: 3;\n height: 140px;\n width: 140px;\n overflow: hidden;\n border-bottom-left-radius: 7px;\n border: black 4px solid;\n border-left: 0px;\n border-bottom: 0px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.texture-block img {\n width: 100%;\n height: 100%;\n pointer-events: none; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.texture-block img.empty {\n display: none; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.regular-texture-block {\n margin-top: -115px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.remap-block {\n height: 34px;\n text-align: center;\n font-size: 18px;\n font-weight: bold;\n margin: 0 10px; }\n #graph-canvas #graph-container #graph-canvas-container .visual .content.trigonometry-block {\n grid-row: 2;\n height: 34px;\n text-align: center;\n font-size: 18px;\n font-weight: bold;\n margin: 0 10px; }\n", ""]);
  151. // Exports
  152. module.exports = exports;
  153. /***/ }),
  154. /***/ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss":
  155. /*!************************************************************************************************************************************************************!*\
  156. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/css-loader/dist/cjs.js!C:/Microsoft/Babylon/Babylon.js/node_modules/sass-loader/dist/cjs.js!./main.scss ***!
  157. \************************************************************************************************************************************************************/
  158. /*! no static exports found */
  159. /***/ (function(module, exports, __webpack_require__) {
  160. // Imports
  161. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/api.js */ "../../node_modules/css-loader/dist/runtime/api.js");
  162. exports = ___CSS_LOADER_API_IMPORT___(false);
  163. // Module
  164. exports.push([module.i, "#gui-editor-workbench-root {\n display: grid;\n grid-template-rows: calc(100% - 120px) 120px;\n height: 100%;\n width: 100%;\n background: #464646;\n font: 14px \"acumin-pro\"; }\n\n.wait-screen {\n display: grid;\n justify-content: center;\n align-content: center;\n height: 100%;\n width: 100%;\n background: #464646;\n opacity: 0.95;\n color: white;\n font: 24px \"acumin-pro\";\n position: absolute;\n top: 0;\n left: 0; }\n .wait-screen.hidden {\n visibility: hidden; }\n\n#nodeList {\n grid-row: 1 / span 2;\n grid-column: 1; }\n\n#leftGrab {\n grid-row: 1 / span 2;\n grid-column: 2;\n cursor: ew-resize; }\n\n#rightGrab {\n grid-row: 1 / span 2;\n grid-column: 4;\n cursor: ew-resize; }\n\n.diagram-container {\n grid-row: 1;\n grid-column: 3;\n background: #5f5b60;\n width: 100%;\n height: 100%; }\n .diagram-container .diagram {\n display: none;\n width: 100%;\n height: 100%; }\n\n.right-panel {\n grid-row: 1 / span 2;\n grid-column: 5;\n display: grid;\n grid-template-rows: 1fr 40px auto 40px;\n grid-template-columns: 100%;\n height: 100%;\n overflow-y: auto; }\n .right-panel #propertyTab {\n grid-row: 1;\n grid-column: 1; }\n .right-panel .button {\n display: grid;\n justify-content: center;\n align-content: center;\n height: auto;\n width: calc(100% / 7);\n cursor: pointer; }\n .right-panel .button:hover {\n background: #337ab7;\n color: white;\n opacity: 0.8; }\n .right-panel .button.selected {\n background: #337ab7;\n color: white; }\n .right-panel .button.align {\n justify-content: stretch;\n text-align: center; }\n .right-panel #preview-mesh-bar {\n grid-row: 2;\n grid-column: 1;\n display: grid;\n grid-template-columns: auto 1fr 40px 40px 40px;\n align-items: center;\n font-size: 18px;\n background-color: #555555; }\n .right-panel #preview-mesh-bar #file-picker {\n display: none; }\n .right-panel #preview-mesh-bar .listLine {\n grid-column: 1;\n height: 40px;\n display: grid;\n grid-template-columns: 0px 1fr; }\n .right-panel #preview-mesh-bar .listLine .label {\n grid-column: 1;\n display: flex;\n align-items: center;\n font-size: 14px; }\n .right-panel #preview-mesh-bar .listLine .options {\n grid-column: 2;\n display: flex;\n align-items: center;\n margin-left: 5px; }\n .right-panel #preview-mesh-bar .listLine .options select {\n width: 115px; }\n .right-panel #preview-mesh-bar .button {\n color: #ffffff;\n width: 40px;\n height: 40px;\n transform-origin: 50% 50%; }\n .right-panel #preview-mesh-bar .button:active {\n transform: scale(0.9); }\n .right-panel #preview-mesh-bar .button:hover {\n background: #3f3461; }\n .right-panel #preview-mesh-bar .button.selected {\n background: #9379e6; }\n .right-panel #preview-mesh-bar .button img {\n height: 40px;\n width: 100%; }\n .right-panel #preview-mesh-bar #play-button {\n grid-column: 3; }\n .right-panel #preview-mesh-bar #color-picker-button {\n grid-column: 4;\n display: grid;\n grid-template-columns: 100%;\n grid-template-rows: 100%; }\n .right-panel #preview-mesh-bar #color-picker-button img {\n height: 40px;\n width: 30px; }\n .right-panel #preview-mesh-bar #color-picker-button #color-picker-image {\n padding-left: 5px;\n padding-bottom: 38px; }\n .right-panel #preview-mesh-bar #color-picker-button #color-picker {\n transform: scale(0);\n grid-column: 1;\n grid-row: 1; }\n .right-panel #preview-mesh-bar #color-picker-button #color-picker-label {\n width: 100%;\n background: transparent;\n cursor: pointer; }\n .right-panel #preview-mesh-bar #preview-new-window {\n grid-column: 5; }\n .right-panel #preview-mesh-bar select {\n background-color: #a3a3a3;\n color: #333333; }\n .right-panel #preview-config-bar {\n grid-row: 4;\n grid-column: 1;\n display: grid;\n grid-template-columns: 40px 40px 40px 1fr 40px 40px;\n color: white;\n align-items: center;\n font-size: 18px; }\n .right-panel #preview-config-bar .button {\n width: 40px;\n grid-row: 1;\n height: 40px;\n transform-origin: 50% 50%; }\n .right-panel #preview-config-bar .button:hover {\n background: #3f3461; }\n .right-panel #preview-config-bar .button.selected {\n background: #9379e6; }\n .right-panel #preview-config-bar .button:active {\n transform: scale(0.9); }\n .right-panel #preview-config-bar .button img {\n height: auto;\n width: 100%; }\n .right-panel #preview-config-bar .button.back-face {\n grid-column: 6; }\n .right-panel #preview-config-bar .button.depth-pass {\n grid-column: 5 / 6; }\n .right-panel #preview-config-bar .button.hemispheric-light {\n grid-column: 3 / 4; }\n .right-panel #preview-config-bar .button.direction-light-1 {\n grid-column: 2 / 3; }\n .right-panel #preview-config-bar .button.direction-light-0 {\n grid-column: 1 / 2; }\n .right-panel #preview {\n border-top: 1px solid #555555;\n grid-row: 3;\n grid-column: 1;\n width: 100%;\n display: grid;\n outline: 0 !important;\n user-select: none; }\n .right-panel #preview #preview-canvas {\n width: 100%;\n height: 100%;\n outline: 0 !important;\n grid-row: 1;\n grid-column: 1; }\n .right-panel #preview .waitPanel {\n width: 100%;\n height: 100%;\n grid-row: 1;\n grid-column: 1;\n color: white;\n font-size: 18px;\n align-content: center;\n justify-content: center;\n background: rgba(20, 20, 20, 0.95);\n z-index: 10;\n display: grid;\n transition: opacity 250ms; }\n .right-panel #preview .waitPanel.hidden {\n opacity: 0;\n pointer-events: none; }\n\n.blocker {\n visibility: hidden;\n position: absolute;\n width: calc(100% - 40px);\n height: 100%;\n top: 0;\n left: 0;\n background: rgba(20, 20, 20, 0.95);\n font-family: \"acumin-pro\";\n color: white;\n font-size: 24px;\n display: grid;\n align-content: center;\n justify-content: center;\n user-select: none;\n padding: 20px;\n text-align: center; }\n\n#log-console {\n grid-row: 2;\n grid-column: 3; }\n\n.dialog-container {\n position: absolute;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.6);\n display: grid;\n font-family: \"acumin-pro\";\n top: 0; }\n .dialog-container .dialog {\n align-self: center;\n justify-self: center;\n min-height: 140px;\n max-width: 400px;\n border-radius: 10px;\n background: white;\n display: grid;\n grid-template-columns: 100%;\n grid-template-rows: calc(100% - 50px) 50px; }\n .dialog-container .dialog .dialog-message {\n grid-row: 1;\n grid-column: 1;\n margin-top: 20px;\n padding: 10px;\n font-size: 18px;\n color: black; }\n .dialog-container .dialog .dialog-buttons {\n grid-row: 2;\n grid-column: 1;\n display: grid;\n grid-template-rows: 100%;\n grid-template-columns: 100%;\n color: white; }\n .dialog-container .dialog .dialog-buttons .dialog-button-ok {\n cursor: pointer;\n justify-self: center;\n background: green;\n min-width: 80px;\n justify-content: center;\n display: grid;\n align-content: center;\n align-self: center;\n height: 35px;\n border-radius: 10px; }\n .dialog-container .dialog .dialog-buttons .dialog-button-ok:hover {\n opacity: 0.8; }\n .dialog-container .dialog .dialog-buttons .dialog-button-ok.error {\n background: red; }\n", ""]);
  165. // Exports
  166. module.exports = exports;
  167. /***/ }),
  168. /***/ "../../node_modules/css-loader/dist/runtime/api.js":
  169. /*!***********************************************************************************!*\
  170. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/css-loader/dist/runtime/api.js ***!
  171. \***********************************************************************************/
  172. /*! no static exports found */
  173. /***/ (function(module, exports, __webpack_require__) {
  174. "use strict";
  175. /*
  176. MIT License http://www.opensource.org/licenses/mit-license.php
  177. Author Tobias Koppers @sokra
  178. */
  179. // css base code, injected by the css-loader
  180. // eslint-disable-next-line func-names
  181. module.exports = function (useSourceMap) {
  182. var list = []; // return the list of modules as css string
  183. list.toString = function toString() {
  184. return this.map(function (item) {
  185. var content = cssWithMappingToString(item, useSourceMap);
  186. if (item[2]) {
  187. return "@media ".concat(item[2], " {").concat(content, "}");
  188. }
  189. return content;
  190. }).join('');
  191. }; // import a list of modules into the list
  192. // eslint-disable-next-line func-names
  193. list.i = function (modules, mediaQuery, dedupe) {
  194. if (typeof modules === 'string') {
  195. // eslint-disable-next-line no-param-reassign
  196. modules = [[null, modules, '']];
  197. }
  198. var alreadyImportedModules = {};
  199. if (dedupe) {
  200. for (var i = 0; i < this.length; i++) {
  201. // eslint-disable-next-line prefer-destructuring
  202. var id = this[i][0];
  203. if (id != null) {
  204. alreadyImportedModules[id] = true;
  205. }
  206. }
  207. }
  208. for (var _i = 0; _i < modules.length; _i++) {
  209. var item = [].concat(modules[_i]);
  210. if (dedupe && alreadyImportedModules[item[0]]) {
  211. // eslint-disable-next-line no-continue
  212. continue;
  213. }
  214. if (mediaQuery) {
  215. if (!item[2]) {
  216. item[2] = mediaQuery;
  217. } else {
  218. item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
  219. }
  220. }
  221. list.push(item);
  222. }
  223. };
  224. return list;
  225. };
  226. function cssWithMappingToString(item, useSourceMap) {
  227. var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
  228. var cssMapping = item[3];
  229. if (!cssMapping) {
  230. return content;
  231. }
  232. if (useSourceMap && typeof btoa === 'function') {
  233. var sourceMapping = toComment(cssMapping);
  234. var sourceURLs = cssMapping.sources.map(function (source) {
  235. return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
  236. });
  237. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  238. }
  239. return [content].join('\n');
  240. } // Adapted from convert-source-map (MIT)
  241. function toComment(sourceMap) {
  242. // eslint-disable-next-line no-undef
  243. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  244. var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
  245. return "/*# ".concat(data, " */");
  246. }
  247. /***/ }),
  248. /***/ "../../node_modules/dagre/index.js":
  249. /*!*******************************************************************!*\
  250. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/index.js ***!
  251. \*******************************************************************/
  252. /*! no static exports found */
  253. /***/ (function(module, exports, __webpack_require__) {
  254. /*
  255. Copyright (c) 2012-2014 Chris Pettitt
  256. Permission is hereby granted, free of charge, to any person obtaining a copy
  257. of this software and associated documentation files (the "Software"), to deal
  258. in the Software without restriction, including without limitation the rights
  259. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  260. copies of the Software, and to permit persons to whom the Software is
  261. furnished to do so, subject to the following conditions:
  262. The above copyright notice and this permission notice shall be included in
  263. all copies or substantial portions of the Software.
  264. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  265. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  266. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  267. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  268. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  269. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  270. THE SOFTWARE.
  271. */
  272. module.exports = {
  273. graphlib: __webpack_require__(/*! ./lib/graphlib */ "../../node_modules/dagre/lib/graphlib.js"),
  274. layout: __webpack_require__(/*! ./lib/layout */ "../../node_modules/dagre/lib/layout.js"),
  275. debug: __webpack_require__(/*! ./lib/debug */ "../../node_modules/dagre/lib/debug.js"),
  276. util: {
  277. time: __webpack_require__(/*! ./lib/util */ "../../node_modules/dagre/lib/util.js").time,
  278. notime: __webpack_require__(/*! ./lib/util */ "../../node_modules/dagre/lib/util.js").notime
  279. },
  280. version: __webpack_require__(/*! ./lib/version */ "../../node_modules/dagre/lib/version.js")
  281. };
  282. /***/ }),
  283. /***/ "../../node_modules/dagre/lib/acyclic.js":
  284. /*!*************************************************************************!*\
  285. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/acyclic.js ***!
  286. \*************************************************************************/
  287. /*! no static exports found */
  288. /***/ (function(module, exports, __webpack_require__) {
  289. "use strict";
  290. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  291. var greedyFAS = __webpack_require__(/*! ./greedy-fas */ "../../node_modules/dagre/lib/greedy-fas.js");
  292. module.exports = {
  293. run: run,
  294. undo: undo
  295. };
  296. function run(g) {
  297. var fas = (g.graph().acyclicer === "greedy"
  298. ? greedyFAS(g, weightFn(g))
  299. : dfsFAS(g));
  300. _.forEach(fas, function(e) {
  301. var label = g.edge(e);
  302. g.removeEdge(e);
  303. label.forwardName = e.name;
  304. label.reversed = true;
  305. g.setEdge(e.w, e.v, label, _.uniqueId("rev"));
  306. });
  307. function weightFn(g) {
  308. return function(e) {
  309. return g.edge(e).weight;
  310. };
  311. }
  312. }
  313. function dfsFAS(g) {
  314. var fas = [];
  315. var stack = {};
  316. var visited = {};
  317. function dfs(v) {
  318. if (_.has(visited, v)) {
  319. return;
  320. }
  321. visited[v] = true;
  322. stack[v] = true;
  323. _.forEach(g.outEdges(v), function(e) {
  324. if (_.has(stack, e.w)) {
  325. fas.push(e);
  326. } else {
  327. dfs(e.w);
  328. }
  329. });
  330. delete stack[v];
  331. }
  332. _.forEach(g.nodes(), dfs);
  333. return fas;
  334. }
  335. function undo(g) {
  336. _.forEach(g.edges(), function(e) {
  337. var label = g.edge(e);
  338. if (label.reversed) {
  339. g.removeEdge(e);
  340. var forwardName = label.forwardName;
  341. delete label.reversed;
  342. delete label.forwardName;
  343. g.setEdge(e.w, e.v, label, forwardName);
  344. }
  345. });
  346. }
  347. /***/ }),
  348. /***/ "../../node_modules/dagre/lib/add-border-segments.js":
  349. /*!*************************************************************************************!*\
  350. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/add-border-segments.js ***!
  351. \*************************************************************************************/
  352. /*! no static exports found */
  353. /***/ (function(module, exports, __webpack_require__) {
  354. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  355. var util = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js");
  356. module.exports = addBorderSegments;
  357. function addBorderSegments(g) {
  358. function dfs(v) {
  359. var children = g.children(v);
  360. var node = g.node(v);
  361. if (children.length) {
  362. _.forEach(children, dfs);
  363. }
  364. if (_.has(node, "minRank")) {
  365. node.borderLeft = [];
  366. node.borderRight = [];
  367. for (var rank = node.minRank, maxRank = node.maxRank + 1;
  368. rank < maxRank;
  369. ++rank) {
  370. addBorderNode(g, "borderLeft", "_bl", v, node, rank);
  371. addBorderNode(g, "borderRight", "_br", v, node, rank);
  372. }
  373. }
  374. }
  375. _.forEach(g.children(), dfs);
  376. }
  377. function addBorderNode(g, prop, prefix, sg, sgNode, rank) {
  378. var label = { width: 0, height: 0, rank: rank, borderType: prop };
  379. var prev = sgNode[prop][rank - 1];
  380. var curr = util.addDummyNode(g, "border", label, prefix);
  381. sgNode[prop][rank] = curr;
  382. g.setParent(curr, sg);
  383. if (prev) {
  384. g.setEdge(prev, curr, { weight: 1 });
  385. }
  386. }
  387. /***/ }),
  388. /***/ "../../node_modules/dagre/lib/coordinate-system.js":
  389. /*!***********************************************************************************!*\
  390. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/coordinate-system.js ***!
  391. \***********************************************************************************/
  392. /*! no static exports found */
  393. /***/ (function(module, exports, __webpack_require__) {
  394. "use strict";
  395. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  396. module.exports = {
  397. adjust: adjust,
  398. undo: undo
  399. };
  400. function adjust(g) {
  401. var rankDir = g.graph().rankdir.toLowerCase();
  402. if (rankDir === "lr" || rankDir === "rl") {
  403. swapWidthHeight(g);
  404. }
  405. }
  406. function undo(g) {
  407. var rankDir = g.graph().rankdir.toLowerCase();
  408. if (rankDir === "bt" || rankDir === "rl") {
  409. reverseY(g);
  410. }
  411. if (rankDir === "lr" || rankDir === "rl") {
  412. swapXY(g);
  413. swapWidthHeight(g);
  414. }
  415. }
  416. function swapWidthHeight(g) {
  417. _.forEach(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); });
  418. _.forEach(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); });
  419. }
  420. function swapWidthHeightOne(attrs) {
  421. var w = attrs.width;
  422. attrs.width = attrs.height;
  423. attrs.height = w;
  424. }
  425. function reverseY(g) {
  426. _.forEach(g.nodes(), function(v) { reverseYOne(g.node(v)); });
  427. _.forEach(g.edges(), function(e) {
  428. var edge = g.edge(e);
  429. _.forEach(edge.points, reverseYOne);
  430. if (_.has(edge, "y")) {
  431. reverseYOne(edge);
  432. }
  433. });
  434. }
  435. function reverseYOne(attrs) {
  436. attrs.y = -attrs.y;
  437. }
  438. function swapXY(g) {
  439. _.forEach(g.nodes(), function(v) { swapXYOne(g.node(v)); });
  440. _.forEach(g.edges(), function(e) {
  441. var edge = g.edge(e);
  442. _.forEach(edge.points, swapXYOne);
  443. if (_.has(edge, "x")) {
  444. swapXYOne(edge);
  445. }
  446. });
  447. }
  448. function swapXYOne(attrs) {
  449. var x = attrs.x;
  450. attrs.x = attrs.y;
  451. attrs.y = x;
  452. }
  453. /***/ }),
  454. /***/ "../../node_modules/dagre/lib/data/list.js":
  455. /*!***************************************************************************!*\
  456. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/data/list.js ***!
  457. \***************************************************************************/
  458. /*! no static exports found */
  459. /***/ (function(module, exports) {
  460. /*
  461. * Simple doubly linked list implementation derived from Cormen, et al.,
  462. * "Introduction to Algorithms".
  463. */
  464. module.exports = List;
  465. function List() {
  466. var sentinel = {};
  467. sentinel._next = sentinel._prev = sentinel;
  468. this._sentinel = sentinel;
  469. }
  470. List.prototype.dequeue = function() {
  471. var sentinel = this._sentinel;
  472. var entry = sentinel._prev;
  473. if (entry !== sentinel) {
  474. unlink(entry);
  475. return entry;
  476. }
  477. };
  478. List.prototype.enqueue = function(entry) {
  479. var sentinel = this._sentinel;
  480. if (entry._prev && entry._next) {
  481. unlink(entry);
  482. }
  483. entry._next = sentinel._next;
  484. sentinel._next._prev = entry;
  485. sentinel._next = entry;
  486. entry._prev = sentinel;
  487. };
  488. List.prototype.toString = function() {
  489. var strs = [];
  490. var sentinel = this._sentinel;
  491. var curr = sentinel._prev;
  492. while (curr !== sentinel) {
  493. strs.push(JSON.stringify(curr, filterOutLinks));
  494. curr = curr._prev;
  495. }
  496. return "[" + strs.join(", ") + "]";
  497. };
  498. function unlink(entry) {
  499. entry._prev._next = entry._next;
  500. entry._next._prev = entry._prev;
  501. delete entry._next;
  502. delete entry._prev;
  503. }
  504. function filterOutLinks(k, v) {
  505. if (k !== "_next" && k !== "_prev") {
  506. return v;
  507. }
  508. }
  509. /***/ }),
  510. /***/ "../../node_modules/dagre/lib/debug.js":
  511. /*!***********************************************************************!*\
  512. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/debug.js ***!
  513. \***********************************************************************/
  514. /*! no static exports found */
  515. /***/ (function(module, exports, __webpack_require__) {
  516. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  517. var util = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js");
  518. var Graph = __webpack_require__(/*! ./graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  519. module.exports = {
  520. debugOrdering: debugOrdering
  521. };
  522. /* istanbul ignore next */
  523. function debugOrdering(g) {
  524. var layerMatrix = util.buildLayerMatrix(g);
  525. var h = new Graph({ compound: true, multigraph: true }).setGraph({});
  526. _.forEach(g.nodes(), function(v) {
  527. h.setNode(v, { label: v });
  528. h.setParent(v, "layer" + g.node(v).rank);
  529. });
  530. _.forEach(g.edges(), function(e) {
  531. h.setEdge(e.v, e.w, {}, e.name);
  532. });
  533. _.forEach(layerMatrix, function(layer, i) {
  534. var layerV = "layer" + i;
  535. h.setNode(layerV, { rank: "same" });
  536. _.reduce(layer, function(u, v) {
  537. h.setEdge(u, v, { style: "invis" });
  538. return v;
  539. });
  540. });
  541. return h;
  542. }
  543. /***/ }),
  544. /***/ "../../node_modules/dagre/lib/graphlib.js":
  545. /*!**************************************************************************!*\
  546. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/graphlib.js ***!
  547. \**************************************************************************/
  548. /*! no static exports found */
  549. /***/ (function(module, exports, __webpack_require__) {
  550. /* global window */
  551. var graphlib;
  552. if (true) {
  553. try {
  554. graphlib = __webpack_require__(/*! graphlib */ "../../node_modules/graphlib/index.js");
  555. } catch (e) {
  556. // continue regardless of error
  557. }
  558. }
  559. if (!graphlib) {
  560. graphlib = window.graphlib;
  561. }
  562. module.exports = graphlib;
  563. /***/ }),
  564. /***/ "../../node_modules/dagre/lib/greedy-fas.js":
  565. /*!****************************************************************************!*\
  566. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/greedy-fas.js ***!
  567. \****************************************************************************/
  568. /*! no static exports found */
  569. /***/ (function(module, exports, __webpack_require__) {
  570. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  571. var Graph = __webpack_require__(/*! ./graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  572. var List = __webpack_require__(/*! ./data/list */ "../../node_modules/dagre/lib/data/list.js");
  573. /*
  574. * A greedy heuristic for finding a feedback arc set for a graph. A feedback
  575. * arc set is a set of edges that can be removed to make a graph acyclic.
  576. * The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, "A fast and
  577. * effective heuristic for the feedback arc set problem." This implementation
  578. * adjusts that from the paper to allow for weighted edges.
  579. */
  580. module.exports = greedyFAS;
  581. var DEFAULT_WEIGHT_FN = _.constant(1);
  582. function greedyFAS(g, weightFn) {
  583. if (g.nodeCount() <= 1) {
  584. return [];
  585. }
  586. var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);
  587. var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);
  588. // Expand multi-edges
  589. return _.flatten(_.map(results, function(e) {
  590. return g.outEdges(e.v, e.w);
  591. }), true);
  592. }
  593. function doGreedyFAS(g, buckets, zeroIdx) {
  594. var results = [];
  595. var sources = buckets[buckets.length - 1];
  596. var sinks = buckets[0];
  597. var entry;
  598. while (g.nodeCount()) {
  599. while ((entry = sinks.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }
  600. while ((entry = sources.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }
  601. if (g.nodeCount()) {
  602. for (var i = buckets.length - 2; i > 0; --i) {
  603. entry = buckets[i].dequeue();
  604. if (entry) {
  605. results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));
  606. break;
  607. }
  608. }
  609. }
  610. }
  611. return results;
  612. }
  613. function removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {
  614. var results = collectPredecessors ? [] : undefined;
  615. _.forEach(g.inEdges(entry.v), function(edge) {
  616. var weight = g.edge(edge);
  617. var uEntry = g.node(edge.v);
  618. if (collectPredecessors) {
  619. results.push({ v: edge.v, w: edge.w });
  620. }
  621. uEntry.out -= weight;
  622. assignBucket(buckets, zeroIdx, uEntry);
  623. });
  624. _.forEach(g.outEdges(entry.v), function(edge) {
  625. var weight = g.edge(edge);
  626. var w = edge.w;
  627. var wEntry = g.node(w);
  628. wEntry["in"] -= weight;
  629. assignBucket(buckets, zeroIdx, wEntry);
  630. });
  631. g.removeNode(entry.v);
  632. return results;
  633. }
  634. function buildState(g, weightFn) {
  635. var fasGraph = new Graph();
  636. var maxIn = 0;
  637. var maxOut = 0;
  638. _.forEach(g.nodes(), function(v) {
  639. fasGraph.setNode(v, { v: v, "in": 0, out: 0 });
  640. });
  641. // Aggregate weights on nodes, but also sum the weights across multi-edges
  642. // into a single edge for the fasGraph.
  643. _.forEach(g.edges(), function(e) {
  644. var prevWeight = fasGraph.edge(e.v, e.w) || 0;
  645. var weight = weightFn(e);
  646. var edgeWeight = prevWeight + weight;
  647. fasGraph.setEdge(e.v, e.w, edgeWeight);
  648. maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight);
  649. maxIn = Math.max(maxIn, fasGraph.node(e.w)["in"] += weight);
  650. });
  651. var buckets = _.range(maxOut + maxIn + 3).map(function() { return new List(); });
  652. var zeroIdx = maxIn + 1;
  653. _.forEach(fasGraph.nodes(), function(v) {
  654. assignBucket(buckets, zeroIdx, fasGraph.node(v));
  655. });
  656. return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx };
  657. }
  658. function assignBucket(buckets, zeroIdx, entry) {
  659. if (!entry.out) {
  660. buckets[0].enqueue(entry);
  661. } else if (!entry["in"]) {
  662. buckets[buckets.length - 1].enqueue(entry);
  663. } else {
  664. buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry);
  665. }
  666. }
  667. /***/ }),
  668. /***/ "../../node_modules/dagre/lib/layout.js":
  669. /*!************************************************************************!*\
  670. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/layout.js ***!
  671. \************************************************************************/
  672. /*! no static exports found */
  673. /***/ (function(module, exports, __webpack_require__) {
  674. "use strict";
  675. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  676. var acyclic = __webpack_require__(/*! ./acyclic */ "../../node_modules/dagre/lib/acyclic.js");
  677. var normalize = __webpack_require__(/*! ./normalize */ "../../node_modules/dagre/lib/normalize.js");
  678. var rank = __webpack_require__(/*! ./rank */ "../../node_modules/dagre/lib/rank/index.js");
  679. var normalizeRanks = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js").normalizeRanks;
  680. var parentDummyChains = __webpack_require__(/*! ./parent-dummy-chains */ "../../node_modules/dagre/lib/parent-dummy-chains.js");
  681. var removeEmptyRanks = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js").removeEmptyRanks;
  682. var nestingGraph = __webpack_require__(/*! ./nesting-graph */ "../../node_modules/dagre/lib/nesting-graph.js");
  683. var addBorderSegments = __webpack_require__(/*! ./add-border-segments */ "../../node_modules/dagre/lib/add-border-segments.js");
  684. var coordinateSystem = __webpack_require__(/*! ./coordinate-system */ "../../node_modules/dagre/lib/coordinate-system.js");
  685. var order = __webpack_require__(/*! ./order */ "../../node_modules/dagre/lib/order/index.js");
  686. var position = __webpack_require__(/*! ./position */ "../../node_modules/dagre/lib/position/index.js");
  687. var util = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js");
  688. var Graph = __webpack_require__(/*! ./graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  689. module.exports = layout;
  690. function layout(g, opts) {
  691. var time = opts && opts.debugTiming ? util.time : util.notime;
  692. time("layout", function() {
  693. var layoutGraph =
  694. time(" buildLayoutGraph", function() { return buildLayoutGraph(g); });
  695. time(" runLayout", function() { runLayout(layoutGraph, time); });
  696. time(" updateInputGraph", function() { updateInputGraph(g, layoutGraph); });
  697. });
  698. }
  699. function runLayout(g, time) {
  700. time(" makeSpaceForEdgeLabels", function() { makeSpaceForEdgeLabels(g); });
  701. time(" removeSelfEdges", function() { removeSelfEdges(g); });
  702. time(" acyclic", function() { acyclic.run(g); });
  703. time(" nestingGraph.run", function() { nestingGraph.run(g); });
  704. time(" rank", function() { rank(util.asNonCompoundGraph(g)); });
  705. time(" injectEdgeLabelProxies", function() { injectEdgeLabelProxies(g); });
  706. time(" removeEmptyRanks", function() { removeEmptyRanks(g); });
  707. time(" nestingGraph.cleanup", function() { nestingGraph.cleanup(g); });
  708. time(" normalizeRanks", function() { normalizeRanks(g); });
  709. time(" assignRankMinMax", function() { assignRankMinMax(g); });
  710. time(" removeEdgeLabelProxies", function() { removeEdgeLabelProxies(g); });
  711. time(" normalize.run", function() { normalize.run(g); });
  712. time(" parentDummyChains", function() { parentDummyChains(g); });
  713. time(" addBorderSegments", function() { addBorderSegments(g); });
  714. time(" order", function() { order(g); });
  715. time(" insertSelfEdges", function() { insertSelfEdges(g); });
  716. time(" adjustCoordinateSystem", function() { coordinateSystem.adjust(g); });
  717. time(" position", function() { position(g); });
  718. time(" positionSelfEdges", function() { positionSelfEdges(g); });
  719. time(" removeBorderNodes", function() { removeBorderNodes(g); });
  720. time(" normalize.undo", function() { normalize.undo(g); });
  721. time(" fixupEdgeLabelCoords", function() { fixupEdgeLabelCoords(g); });
  722. time(" undoCoordinateSystem", function() { coordinateSystem.undo(g); });
  723. time(" translateGraph", function() { translateGraph(g); });
  724. time(" assignNodeIntersects", function() { assignNodeIntersects(g); });
  725. time(" reversePoints", function() { reversePointsForReversedEdges(g); });
  726. time(" acyclic.undo", function() { acyclic.undo(g); });
  727. }
  728. /*
  729. * Copies final layout information from the layout graph back to the input
  730. * graph. This process only copies whitelisted attributes from the layout graph
  731. * to the input graph, so it serves as a good place to determine what
  732. * attributes can influence layout.
  733. */
  734. function updateInputGraph(inputGraph, layoutGraph) {
  735. _.forEach(inputGraph.nodes(), function(v) {
  736. var inputLabel = inputGraph.node(v);
  737. var layoutLabel = layoutGraph.node(v);
  738. if (inputLabel) {
  739. inputLabel.x = layoutLabel.x;
  740. inputLabel.y = layoutLabel.y;
  741. if (layoutGraph.children(v).length) {
  742. inputLabel.width = layoutLabel.width;
  743. inputLabel.height = layoutLabel.height;
  744. }
  745. }
  746. });
  747. _.forEach(inputGraph.edges(), function(e) {
  748. var inputLabel = inputGraph.edge(e);
  749. var layoutLabel = layoutGraph.edge(e);
  750. inputLabel.points = layoutLabel.points;
  751. if (_.has(layoutLabel, "x")) {
  752. inputLabel.x = layoutLabel.x;
  753. inputLabel.y = layoutLabel.y;
  754. }
  755. });
  756. inputGraph.graph().width = layoutGraph.graph().width;
  757. inputGraph.graph().height = layoutGraph.graph().height;
  758. }
  759. var graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"];
  760. var graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" };
  761. var graphAttrs = ["acyclicer", "ranker", "rankdir", "align"];
  762. var nodeNumAttrs = ["width", "height"];
  763. var nodeDefaults = { width: 0, height: 0 };
  764. var edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"];
  765. var edgeDefaults = {
  766. minlen: 1, weight: 1, width: 0, height: 0,
  767. labeloffset: 10, labelpos: "r"
  768. };
  769. var edgeAttrs = ["labelpos"];
  770. /*
  771. * Constructs a new graph from the input graph, which can be used for layout.
  772. * This process copies only whitelisted attributes from the input graph to the
  773. * layout graph. Thus this function serves as a good place to determine what
  774. * attributes can influence layout.
  775. */
  776. function buildLayoutGraph(inputGraph) {
  777. var g = new Graph({ multigraph: true, compound: true });
  778. var graph = canonicalize(inputGraph.graph());
  779. g.setGraph(_.merge({},
  780. graphDefaults,
  781. selectNumberAttrs(graph, graphNumAttrs),
  782. _.pick(graph, graphAttrs)));
  783. _.forEach(inputGraph.nodes(), function(v) {
  784. var node = canonicalize(inputGraph.node(v));
  785. g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));
  786. g.setParent(v, inputGraph.parent(v));
  787. });
  788. _.forEach(inputGraph.edges(), function(e) {
  789. var edge = canonicalize(inputGraph.edge(e));
  790. g.setEdge(e, _.merge({},
  791. edgeDefaults,
  792. selectNumberAttrs(edge, edgeNumAttrs),
  793. _.pick(edge, edgeAttrs)));
  794. });
  795. return g;
  796. }
  797. /*
  798. * This idea comes from the Gansner paper: to account for edge labels in our
  799. * layout we split each rank in half by doubling minlen and halving ranksep.
  800. * Then we can place labels at these mid-points between nodes.
  801. *
  802. * We also add some minimal padding to the width to push the label for the edge
  803. * away from the edge itself a bit.
  804. */
  805. function makeSpaceForEdgeLabels(g) {
  806. var graph = g.graph();
  807. graph.ranksep /= 2;
  808. _.forEach(g.edges(), function(e) {
  809. var edge = g.edge(e);
  810. edge.minlen *= 2;
  811. if (edge.labelpos.toLowerCase() !== "c") {
  812. if (graph.rankdir === "TB" || graph.rankdir === "BT") {
  813. edge.width += edge.labeloffset;
  814. } else {
  815. edge.height += edge.labeloffset;
  816. }
  817. }
  818. });
  819. }
  820. /*
  821. * Creates temporary dummy nodes that capture the rank in which each edge's
  822. * label is going to, if it has one of non-zero width and height. We do this
  823. * so that we can safely remove empty ranks while preserving balance for the
  824. * label's position.
  825. */
  826. function injectEdgeLabelProxies(g) {
  827. _.forEach(g.edges(), function(e) {
  828. var edge = g.edge(e);
  829. if (edge.width && edge.height) {
  830. var v = g.node(e.v);
  831. var w = g.node(e.w);
  832. var label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e };
  833. util.addDummyNode(g, "edge-proxy", label, "_ep");
  834. }
  835. });
  836. }
  837. function assignRankMinMax(g) {
  838. var maxRank = 0;
  839. _.forEach(g.nodes(), function(v) {
  840. var node = g.node(v);
  841. if (node.borderTop) {
  842. node.minRank = g.node(node.borderTop).rank;
  843. node.maxRank = g.node(node.borderBottom).rank;
  844. maxRank = _.max(maxRank, node.maxRank);
  845. }
  846. });
  847. g.graph().maxRank = maxRank;
  848. }
  849. function removeEdgeLabelProxies(g) {
  850. _.forEach(g.nodes(), function(v) {
  851. var node = g.node(v);
  852. if (node.dummy === "edge-proxy") {
  853. g.edge(node.e).labelRank = node.rank;
  854. g.removeNode(v);
  855. }
  856. });
  857. }
  858. function translateGraph(g) {
  859. var minX = Number.POSITIVE_INFINITY;
  860. var maxX = 0;
  861. var minY = Number.POSITIVE_INFINITY;
  862. var maxY = 0;
  863. var graphLabel = g.graph();
  864. var marginX = graphLabel.marginx || 0;
  865. var marginY = graphLabel.marginy || 0;
  866. function getExtremes(attrs) {
  867. var x = attrs.x;
  868. var y = attrs.y;
  869. var w = attrs.width;
  870. var h = attrs.height;
  871. minX = Math.min(minX, x - w / 2);
  872. maxX = Math.max(maxX, x + w / 2);
  873. minY = Math.min(minY, y - h / 2);
  874. maxY = Math.max(maxY, y + h / 2);
  875. }
  876. _.forEach(g.nodes(), function(v) { getExtremes(g.node(v)); });
  877. _.forEach(g.edges(), function(e) {
  878. var edge = g.edge(e);
  879. if (_.has(edge, "x")) {
  880. getExtremes(edge);
  881. }
  882. });
  883. minX -= marginX;
  884. minY -= marginY;
  885. _.forEach(g.nodes(), function(v) {
  886. var node = g.node(v);
  887. node.x -= minX;
  888. node.y -= minY;
  889. });
  890. _.forEach(g.edges(), function(e) {
  891. var edge = g.edge(e);
  892. _.forEach(edge.points, function(p) {
  893. p.x -= minX;
  894. p.y -= minY;
  895. });
  896. if (_.has(edge, "x")) { edge.x -= minX; }
  897. if (_.has(edge, "y")) { edge.y -= minY; }
  898. });
  899. graphLabel.width = maxX - minX + marginX;
  900. graphLabel.height = maxY - minY + marginY;
  901. }
  902. function assignNodeIntersects(g) {
  903. _.forEach(g.edges(), function(e) {
  904. var edge = g.edge(e);
  905. var nodeV = g.node(e.v);
  906. var nodeW = g.node(e.w);
  907. var p1, p2;
  908. if (!edge.points) {
  909. edge.points = [];
  910. p1 = nodeW;
  911. p2 = nodeV;
  912. } else {
  913. p1 = edge.points[0];
  914. p2 = edge.points[edge.points.length - 1];
  915. }
  916. edge.points.unshift(util.intersectRect(nodeV, p1));
  917. edge.points.push(util.intersectRect(nodeW, p2));
  918. });
  919. }
  920. function fixupEdgeLabelCoords(g) {
  921. _.forEach(g.edges(), function(e) {
  922. var edge = g.edge(e);
  923. if (_.has(edge, "x")) {
  924. if (edge.labelpos === "l" || edge.labelpos === "r") {
  925. edge.width -= edge.labeloffset;
  926. }
  927. switch (edge.labelpos) {
  928. case "l": edge.x -= edge.width / 2 + edge.labeloffset; break;
  929. case "r": edge.x += edge.width / 2 + edge.labeloffset; break;
  930. }
  931. }
  932. });
  933. }
  934. function reversePointsForReversedEdges(g) {
  935. _.forEach(g.edges(), function(e) {
  936. var edge = g.edge(e);
  937. if (edge.reversed) {
  938. edge.points.reverse();
  939. }
  940. });
  941. }
  942. function removeBorderNodes(g) {
  943. _.forEach(g.nodes(), function(v) {
  944. if (g.children(v).length) {
  945. var node = g.node(v);
  946. var t = g.node(node.borderTop);
  947. var b = g.node(node.borderBottom);
  948. var l = g.node(_.last(node.borderLeft));
  949. var r = g.node(_.last(node.borderRight));
  950. node.width = Math.abs(r.x - l.x);
  951. node.height = Math.abs(b.y - t.y);
  952. node.x = l.x + node.width / 2;
  953. node.y = t.y + node.height / 2;
  954. }
  955. });
  956. _.forEach(g.nodes(), function(v) {
  957. if (g.node(v).dummy === "border") {
  958. g.removeNode(v);
  959. }
  960. });
  961. }
  962. function removeSelfEdges(g) {
  963. _.forEach(g.edges(), function(e) {
  964. if (e.v === e.w) {
  965. var node = g.node(e.v);
  966. if (!node.selfEdges) {
  967. node.selfEdges = [];
  968. }
  969. node.selfEdges.push({ e: e, label: g.edge(e) });
  970. g.removeEdge(e);
  971. }
  972. });
  973. }
  974. function insertSelfEdges(g) {
  975. var layers = util.buildLayerMatrix(g);
  976. _.forEach(layers, function(layer) {
  977. var orderShift = 0;
  978. _.forEach(layer, function(v, i) {
  979. var node = g.node(v);
  980. node.order = i + orderShift;
  981. _.forEach(node.selfEdges, function(selfEdge) {
  982. util.addDummyNode(g, "selfedge", {
  983. width: selfEdge.label.width,
  984. height: selfEdge.label.height,
  985. rank: node.rank,
  986. order: i + (++orderShift),
  987. e: selfEdge.e,
  988. label: selfEdge.label
  989. }, "_se");
  990. });
  991. delete node.selfEdges;
  992. });
  993. });
  994. }
  995. function positionSelfEdges(g) {
  996. _.forEach(g.nodes(), function(v) {
  997. var node = g.node(v);
  998. if (node.dummy === "selfedge") {
  999. var selfNode = g.node(node.e.v);
  1000. var x = selfNode.x + selfNode.width / 2;
  1001. var y = selfNode.y;
  1002. var dx = node.x - x;
  1003. var dy = selfNode.height / 2;
  1004. g.setEdge(node.e, node.label);
  1005. g.removeNode(v);
  1006. node.label.points = [
  1007. { x: x + 2 * dx / 3, y: y - dy },
  1008. { x: x + 5 * dx / 6, y: y - dy },
  1009. { x: x + dx , y: y },
  1010. { x: x + 5 * dx / 6, y: y + dy },
  1011. { x: x + 2 * dx / 3, y: y + dy }
  1012. ];
  1013. node.label.x = node.x;
  1014. node.label.y = node.y;
  1015. }
  1016. });
  1017. }
  1018. function selectNumberAttrs(obj, attrs) {
  1019. return _.mapValues(_.pick(obj, attrs), Number);
  1020. }
  1021. function canonicalize(attrs) {
  1022. var newAttrs = {};
  1023. _.forEach(attrs, function(v, k) {
  1024. newAttrs[k.toLowerCase()] = v;
  1025. });
  1026. return newAttrs;
  1027. }
  1028. /***/ }),
  1029. /***/ "../../node_modules/dagre/lib/lodash.js":
  1030. /*!************************************************************************!*\
  1031. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/lodash.js ***!
  1032. \************************************************************************/
  1033. /*! no static exports found */
  1034. /***/ (function(module, exports, __webpack_require__) {
  1035. /* global window */
  1036. var lodash;
  1037. if (true) {
  1038. try {
  1039. lodash = {
  1040. cloneDeep: __webpack_require__(/*! lodash/cloneDeep */ "../../node_modules/lodash/cloneDeep.js"),
  1041. constant: __webpack_require__(/*! lodash/constant */ "../../node_modules/lodash/constant.js"),
  1042. defaults: __webpack_require__(/*! lodash/defaults */ "../../node_modules/lodash/defaults.js"),
  1043. each: __webpack_require__(/*! lodash/each */ "../../node_modules/lodash/each.js"),
  1044. filter: __webpack_require__(/*! lodash/filter */ "../../node_modules/lodash/filter.js"),
  1045. find: __webpack_require__(/*! lodash/find */ "../../node_modules/lodash/find.js"),
  1046. flatten: __webpack_require__(/*! lodash/flatten */ "../../node_modules/lodash/flatten.js"),
  1047. forEach: __webpack_require__(/*! lodash/forEach */ "../../node_modules/lodash/forEach.js"),
  1048. forIn: __webpack_require__(/*! lodash/forIn */ "../../node_modules/lodash/forIn.js"),
  1049. has: __webpack_require__(/*! lodash/has */ "../../node_modules/lodash/has.js"),
  1050. isUndefined: __webpack_require__(/*! lodash/isUndefined */ "../../node_modules/lodash/isUndefined.js"),
  1051. last: __webpack_require__(/*! lodash/last */ "../../node_modules/lodash/last.js"),
  1052. map: __webpack_require__(/*! lodash/map */ "../../node_modules/lodash/map.js"),
  1053. mapValues: __webpack_require__(/*! lodash/mapValues */ "../../node_modules/lodash/mapValues.js"),
  1054. max: __webpack_require__(/*! lodash/max */ "../../node_modules/lodash/max.js"),
  1055. merge: __webpack_require__(/*! lodash/merge */ "../../node_modules/lodash/merge.js"),
  1056. min: __webpack_require__(/*! lodash/min */ "../../node_modules/lodash/min.js"),
  1057. minBy: __webpack_require__(/*! lodash/minBy */ "../../node_modules/lodash/minBy.js"),
  1058. now: __webpack_require__(/*! lodash/now */ "../../node_modules/lodash/now.js"),
  1059. pick: __webpack_require__(/*! lodash/pick */ "../../node_modules/lodash/pick.js"),
  1060. range: __webpack_require__(/*! lodash/range */ "../../node_modules/lodash/range.js"),
  1061. reduce: __webpack_require__(/*! lodash/reduce */ "../../node_modules/lodash/reduce.js"),
  1062. sortBy: __webpack_require__(/*! lodash/sortBy */ "../../node_modules/lodash/sortBy.js"),
  1063. uniqueId: __webpack_require__(/*! lodash/uniqueId */ "../../node_modules/lodash/uniqueId.js"),
  1064. values: __webpack_require__(/*! lodash/values */ "../../node_modules/lodash/values.js"),
  1065. zipObject: __webpack_require__(/*! lodash/zipObject */ "../../node_modules/lodash/zipObject.js"),
  1066. };
  1067. } catch (e) {
  1068. // continue regardless of error
  1069. }
  1070. }
  1071. if (!lodash) {
  1072. lodash = window._;
  1073. }
  1074. module.exports = lodash;
  1075. /***/ }),
  1076. /***/ "../../node_modules/dagre/lib/nesting-graph.js":
  1077. /*!*******************************************************************************!*\
  1078. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/nesting-graph.js ***!
  1079. \*******************************************************************************/
  1080. /*! no static exports found */
  1081. /***/ (function(module, exports, __webpack_require__) {
  1082. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  1083. var util = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js");
  1084. module.exports = {
  1085. run: run,
  1086. cleanup: cleanup
  1087. };
  1088. /*
  1089. * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs,
  1090. * adds appropriate edges to ensure that all cluster nodes are placed between
  1091. * these boundries, and ensures that the graph is connected.
  1092. *
  1093. * In addition we ensure, through the use of the minlen property, that nodes
  1094. * and subgraph border nodes to not end up on the same rank.
  1095. *
  1096. * Preconditions:
  1097. *
  1098. * 1. Input graph is a DAG
  1099. * 2. Nodes in the input graph has a minlen attribute
  1100. *
  1101. * Postconditions:
  1102. *
  1103. * 1. Input graph is connected.
  1104. * 2. Dummy nodes are added for the tops and bottoms of subgraphs.
  1105. * 3. The minlen attribute for nodes is adjusted to ensure nodes do not
  1106. * get placed on the same rank as subgraph border nodes.
  1107. *
  1108. * The nesting graph idea comes from Sander, "Layout of Compound Directed
  1109. * Graphs."
  1110. */
  1111. function run(g) {
  1112. var root = util.addDummyNode(g, "root", {}, "_root");
  1113. var depths = treeDepths(g);
  1114. var height = _.max(_.values(depths)) - 1; // Note: depths is an Object not an array
  1115. var nodeSep = 2 * height + 1;
  1116. g.graph().nestingRoot = root;
  1117. // Multiply minlen by nodeSep to align nodes on non-border ranks.
  1118. _.forEach(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; });
  1119. // Calculate a weight that is sufficient to keep subgraphs vertically compact
  1120. var weight = sumWeights(g) + 1;
  1121. // Create border nodes and link them up
  1122. _.forEach(g.children(), function(child) {
  1123. dfs(g, root, nodeSep, weight, height, depths, child);
  1124. });
  1125. // Save the multiplier for node layers for later removal of empty border
  1126. // layers.
  1127. g.graph().nodeRankFactor = nodeSep;
  1128. }
  1129. function dfs(g, root, nodeSep, weight, height, depths, v) {
  1130. var children = g.children(v);
  1131. if (!children.length) {
  1132. if (v !== root) {
  1133. g.setEdge(root, v, { weight: 0, minlen: nodeSep });
  1134. }
  1135. return;
  1136. }
  1137. var top = util.addBorderNode(g, "_bt");
  1138. var bottom = util.addBorderNode(g, "_bb");
  1139. var label = g.node(v);
  1140. g.setParent(top, v);
  1141. label.borderTop = top;
  1142. g.setParent(bottom, v);
  1143. label.borderBottom = bottom;
  1144. _.forEach(children, function(child) {
  1145. dfs(g, root, nodeSep, weight, height, depths, child);
  1146. var childNode = g.node(child);
  1147. var childTop = childNode.borderTop ? childNode.borderTop : child;
  1148. var childBottom = childNode.borderBottom ? childNode.borderBottom : child;
  1149. var thisWeight = childNode.borderTop ? weight : 2 * weight;
  1150. var minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;
  1151. g.setEdge(top, childTop, {
  1152. weight: thisWeight,
  1153. minlen: minlen,
  1154. nestingEdge: true
  1155. });
  1156. g.setEdge(childBottom, bottom, {
  1157. weight: thisWeight,
  1158. minlen: minlen,
  1159. nestingEdge: true
  1160. });
  1161. });
  1162. if (!g.parent(v)) {
  1163. g.setEdge(root, top, { weight: 0, minlen: height + depths[v] });
  1164. }
  1165. }
  1166. function treeDepths(g) {
  1167. var depths = {};
  1168. function dfs(v, depth) {
  1169. var children = g.children(v);
  1170. if (children && children.length) {
  1171. _.forEach(children, function(child) {
  1172. dfs(child, depth + 1);
  1173. });
  1174. }
  1175. depths[v] = depth;
  1176. }
  1177. _.forEach(g.children(), function(v) { dfs(v, 1); });
  1178. return depths;
  1179. }
  1180. function sumWeights(g) {
  1181. return _.reduce(g.edges(), function(acc, e) {
  1182. return acc + g.edge(e).weight;
  1183. }, 0);
  1184. }
  1185. function cleanup(g) {
  1186. var graphLabel = g.graph();
  1187. g.removeNode(graphLabel.nestingRoot);
  1188. delete graphLabel.nestingRoot;
  1189. _.forEach(g.edges(), function(e) {
  1190. var edge = g.edge(e);
  1191. if (edge.nestingEdge) {
  1192. g.removeEdge(e);
  1193. }
  1194. });
  1195. }
  1196. /***/ }),
  1197. /***/ "../../node_modules/dagre/lib/normalize.js":
  1198. /*!***************************************************************************!*\
  1199. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/normalize.js ***!
  1200. \***************************************************************************/
  1201. /*! no static exports found */
  1202. /***/ (function(module, exports, __webpack_require__) {
  1203. "use strict";
  1204. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  1205. var util = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/util.js");
  1206. module.exports = {
  1207. run: run,
  1208. undo: undo
  1209. };
  1210. /*
  1211. * Breaks any long edges in the graph into short segments that span 1 layer
  1212. * each. This operation is undoable with the denormalize function.
  1213. *
  1214. * Pre-conditions:
  1215. *
  1216. * 1. The input graph is a DAG.
  1217. * 2. Each node in the graph has a "rank" property.
  1218. *
  1219. * Post-condition:
  1220. *
  1221. * 1. All edges in the graph have a length of 1.
  1222. * 2. Dummy nodes are added where edges have been split into segments.
  1223. * 3. The graph is augmented with a "dummyChains" attribute which contains
  1224. * the first dummy in each chain of dummy nodes produced.
  1225. */
  1226. function run(g) {
  1227. g.graph().dummyChains = [];
  1228. _.forEach(g.edges(), function(edge) { normalizeEdge(g, edge); });
  1229. }
  1230. function normalizeEdge(g, e) {
  1231. var v = e.v;
  1232. var vRank = g.node(v).rank;
  1233. var w = e.w;
  1234. var wRank = g.node(w).rank;
  1235. var name = e.name;
  1236. var edgeLabel = g.edge(e);
  1237. var labelRank = edgeLabel.labelRank;
  1238. if (wRank === vRank + 1) return;
  1239. g.removeEdge(e);
  1240. var dummy, attrs, i;
  1241. for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {
  1242. edgeLabel.points = [];
  1243. attrs = {
  1244. width: 0, height: 0,
  1245. edgeLabel: edgeLabel, edgeObj: e,
  1246. rank: vRank
  1247. };
  1248. dummy = util.addDummyNode(g, "edge", attrs, "_d");
  1249. if (vRank === labelRank) {
  1250. attrs.width = edgeLabel.width;
  1251. attrs.height = edgeLabel.height;
  1252. attrs.dummy = "edge-label";
  1253. attrs.labelpos = edgeLabel.labelpos;
  1254. }
  1255. g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);
  1256. if (i === 0) {
  1257. g.graph().dummyChains.push(dummy);
  1258. }
  1259. v = dummy;
  1260. }
  1261. g.setEdge(v, w, { weight: edgeLabel.weight }, name);
  1262. }
  1263. function undo(g) {
  1264. _.forEach(g.graph().dummyChains, function(v) {
  1265. var node = g.node(v);
  1266. var origLabel = node.edgeLabel;
  1267. var w;
  1268. g.setEdge(node.edgeObj, origLabel);
  1269. while (node.dummy) {
  1270. w = g.successors(v)[0];
  1271. g.removeNode(v);
  1272. origLabel.points.push({ x: node.x, y: node.y });
  1273. if (node.dummy === "edge-label") {
  1274. origLabel.x = node.x;
  1275. origLabel.y = node.y;
  1276. origLabel.width = node.width;
  1277. origLabel.height = node.height;
  1278. }
  1279. v = w;
  1280. node = g.node(v);
  1281. }
  1282. });
  1283. }
  1284. /***/ }),
  1285. /***/ "../../node_modules/dagre/lib/order/add-subgraph-constraints.js":
  1286. /*!************************************************************************************************!*\
  1287. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/add-subgraph-constraints.js ***!
  1288. \************************************************************************************************/
  1289. /*! no static exports found */
  1290. /***/ (function(module, exports, __webpack_require__) {
  1291. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1292. module.exports = addSubgraphConstraints;
  1293. function addSubgraphConstraints(g, cg, vs) {
  1294. var prev = {},
  1295. rootPrev;
  1296. _.forEach(vs, function(v) {
  1297. var child = g.parent(v),
  1298. parent,
  1299. prevChild;
  1300. while (child) {
  1301. parent = g.parent(child);
  1302. if (parent) {
  1303. prevChild = prev[parent];
  1304. prev[parent] = child;
  1305. } else {
  1306. prevChild = rootPrev;
  1307. rootPrev = child;
  1308. }
  1309. if (prevChild && prevChild !== child) {
  1310. cg.setEdge(prevChild, child);
  1311. return;
  1312. }
  1313. child = parent;
  1314. }
  1315. });
  1316. /*
  1317. function dfs(v) {
  1318. var children = v ? g.children(v) : g.children();
  1319. if (children.length) {
  1320. var min = Number.POSITIVE_INFINITY,
  1321. subgraphs = [];
  1322. _.each(children, function(child) {
  1323. var childMin = dfs(child);
  1324. if (g.children(child).length) {
  1325. subgraphs.push({ v: child, order: childMin });
  1326. }
  1327. min = Math.min(min, childMin);
  1328. });
  1329. _.reduce(_.sortBy(subgraphs, "order"), function(prev, curr) {
  1330. cg.setEdge(prev.v, curr.v);
  1331. return curr;
  1332. });
  1333. return min;
  1334. }
  1335. return g.node(v).order;
  1336. }
  1337. dfs(undefined);
  1338. */
  1339. }
  1340. /***/ }),
  1341. /***/ "../../node_modules/dagre/lib/order/barycenter.js":
  1342. /*!**********************************************************************************!*\
  1343. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/barycenter.js ***!
  1344. \**********************************************************************************/
  1345. /*! no static exports found */
  1346. /***/ (function(module, exports, __webpack_require__) {
  1347. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1348. module.exports = barycenter;
  1349. function barycenter(g, movable) {
  1350. return _.map(movable, function(v) {
  1351. var inV = g.inEdges(v);
  1352. if (!inV.length) {
  1353. return { v: v };
  1354. } else {
  1355. var result = _.reduce(inV, function(acc, e) {
  1356. var edge = g.edge(e),
  1357. nodeU = g.node(e.v);
  1358. return {
  1359. sum: acc.sum + (edge.weight * nodeU.order),
  1360. weight: acc.weight + edge.weight
  1361. };
  1362. }, { sum: 0, weight: 0 });
  1363. return {
  1364. v: v,
  1365. barycenter: result.sum / result.weight,
  1366. weight: result.weight
  1367. };
  1368. }
  1369. });
  1370. }
  1371. /***/ }),
  1372. /***/ "../../node_modules/dagre/lib/order/build-layer-graph.js":
  1373. /*!*****************************************************************************************!*\
  1374. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/build-layer-graph.js ***!
  1375. \*****************************************************************************************/
  1376. /*! no static exports found */
  1377. /***/ (function(module, exports, __webpack_require__) {
  1378. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1379. var Graph = __webpack_require__(/*! ../graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  1380. module.exports = buildLayerGraph;
  1381. /*
  1382. * Constructs a graph that can be used to sort a layer of nodes. The graph will
  1383. * contain all base and subgraph nodes from the request layer in their original
  1384. * hierarchy and any edges that are incident on these nodes and are of the type
  1385. * requested by the "relationship" parameter.
  1386. *
  1387. * Nodes from the requested rank that do not have parents are assigned a root
  1388. * node in the output graph, which is set in the root graph attribute. This
  1389. * makes it easy to walk the hierarchy of movable nodes during ordering.
  1390. *
  1391. * Pre-conditions:
  1392. *
  1393. * 1. Input graph is a DAG
  1394. * 2. Base nodes in the input graph have a rank attribute
  1395. * 3. Subgraph nodes in the input graph has minRank and maxRank attributes
  1396. * 4. Edges have an assigned weight
  1397. *
  1398. * Post-conditions:
  1399. *
  1400. * 1. Output graph has all nodes in the movable rank with preserved
  1401. * hierarchy.
  1402. * 2. Root nodes in the movable layer are made children of the node
  1403. * indicated by the root attribute of the graph.
  1404. * 3. Non-movable nodes incident on movable nodes, selected by the
  1405. * relationship parameter, are included in the graph (without hierarchy).
  1406. * 4. Edges incident on movable nodes, selected by the relationship
  1407. * parameter, are added to the output graph.
  1408. * 5. The weights for copied edges are aggregated as need, since the output
  1409. * graph is not a multi-graph.
  1410. */
  1411. function buildLayerGraph(g, rank, relationship) {
  1412. var root = createRootNode(g),
  1413. result = new Graph({ compound: true }).setGraph({ root: root })
  1414. .setDefaultNodeLabel(function(v) { return g.node(v); });
  1415. _.forEach(g.nodes(), function(v) {
  1416. var node = g.node(v),
  1417. parent = g.parent(v);
  1418. if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) {
  1419. result.setNode(v);
  1420. result.setParent(v, parent || root);
  1421. // This assumes we have only short edges!
  1422. _.forEach(g[relationship](v), function(e) {
  1423. var u = e.v === v ? e.w : e.v,
  1424. edge = result.edge(u, v),
  1425. weight = !_.isUndefined(edge) ? edge.weight : 0;
  1426. result.setEdge(u, v, { weight: g.edge(e).weight + weight });
  1427. });
  1428. if (_.has(node, "minRank")) {
  1429. result.setNode(v, {
  1430. borderLeft: node.borderLeft[rank],
  1431. borderRight: node.borderRight[rank]
  1432. });
  1433. }
  1434. }
  1435. });
  1436. return result;
  1437. }
  1438. function createRootNode(g) {
  1439. var v;
  1440. while (g.hasNode((v = _.uniqueId("_root"))));
  1441. return v;
  1442. }
  1443. /***/ }),
  1444. /***/ "../../node_modules/dagre/lib/order/cross-count.js":
  1445. /*!***********************************************************************************!*\
  1446. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/cross-count.js ***!
  1447. \***********************************************************************************/
  1448. /*! no static exports found */
  1449. /***/ (function(module, exports, __webpack_require__) {
  1450. "use strict";
  1451. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1452. module.exports = crossCount;
  1453. /*
  1454. * A function that takes a layering (an array of layers, each with an array of
  1455. * ordererd nodes) and a graph and returns a weighted crossing count.
  1456. *
  1457. * Pre-conditions:
  1458. *
  1459. * 1. Input graph must be simple (not a multigraph), directed, and include
  1460. * only simple edges.
  1461. * 2. Edges in the input graph must have assigned weights.
  1462. *
  1463. * Post-conditions:
  1464. *
  1465. * 1. The graph and layering matrix are left unchanged.
  1466. *
  1467. * This algorithm is derived from Barth, et al., "Bilayer Cross Counting."
  1468. */
  1469. function crossCount(g, layering) {
  1470. var cc = 0;
  1471. for (var i = 1; i < layering.length; ++i) {
  1472. cc += twoLayerCrossCount(g, layering[i-1], layering[i]);
  1473. }
  1474. return cc;
  1475. }
  1476. function twoLayerCrossCount(g, northLayer, southLayer) {
  1477. // Sort all of the edges between the north and south layers by their position
  1478. // in the north layer and then the south. Map these edges to the position of
  1479. // their head in the south layer.
  1480. var southPos = _.zipObject(southLayer,
  1481. _.map(southLayer, function (v, i) { return i; }));
  1482. var southEntries = _.flatten(_.map(northLayer, function(v) {
  1483. return _.sortBy(_.map(g.outEdges(v), function(e) {
  1484. return { pos: southPos[e.w], weight: g.edge(e).weight };
  1485. }), "pos");
  1486. }), true);
  1487. // Build the accumulator tree
  1488. var firstIndex = 1;
  1489. while (firstIndex < southLayer.length) firstIndex <<= 1;
  1490. var treeSize = 2 * firstIndex - 1;
  1491. firstIndex -= 1;
  1492. var tree = _.map(new Array(treeSize), function() { return 0; });
  1493. // Calculate the weighted crossings
  1494. var cc = 0;
  1495. _.forEach(southEntries.forEach(function(entry) {
  1496. var index = entry.pos + firstIndex;
  1497. tree[index] += entry.weight;
  1498. var weightSum = 0;
  1499. while (index > 0) {
  1500. if (index % 2) {
  1501. weightSum += tree[index + 1];
  1502. }
  1503. index = (index - 1) >> 1;
  1504. tree[index] += entry.weight;
  1505. }
  1506. cc += entry.weight * weightSum;
  1507. }));
  1508. return cc;
  1509. }
  1510. /***/ }),
  1511. /***/ "../../node_modules/dagre/lib/order/index.js":
  1512. /*!*****************************************************************************!*\
  1513. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/index.js ***!
  1514. \*****************************************************************************/
  1515. /*! no static exports found */
  1516. /***/ (function(module, exports, __webpack_require__) {
  1517. "use strict";
  1518. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1519. var initOrder = __webpack_require__(/*! ./init-order */ "../../node_modules/dagre/lib/order/init-order.js");
  1520. var crossCount = __webpack_require__(/*! ./cross-count */ "../../node_modules/dagre/lib/order/cross-count.js");
  1521. var sortSubgraph = __webpack_require__(/*! ./sort-subgraph */ "../../node_modules/dagre/lib/order/sort-subgraph.js");
  1522. var buildLayerGraph = __webpack_require__(/*! ./build-layer-graph */ "../../node_modules/dagre/lib/order/build-layer-graph.js");
  1523. var addSubgraphConstraints = __webpack_require__(/*! ./add-subgraph-constraints */ "../../node_modules/dagre/lib/order/add-subgraph-constraints.js");
  1524. var Graph = __webpack_require__(/*! ../graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  1525. var util = __webpack_require__(/*! ../util */ "../../node_modules/dagre/lib/util.js");
  1526. module.exports = order;
  1527. /*
  1528. * Applies heuristics to minimize edge crossings in the graph and sets the best
  1529. * order solution as an order attribute on each node.
  1530. *
  1531. * Pre-conditions:
  1532. *
  1533. * 1. Graph must be DAG
  1534. * 2. Graph nodes must be objects with a "rank" attribute
  1535. * 3. Graph edges must have the "weight" attribute
  1536. *
  1537. * Post-conditions:
  1538. *
  1539. * 1. Graph nodes will have an "order" attribute based on the results of the
  1540. * algorithm.
  1541. */
  1542. function order(g) {
  1543. var maxRank = util.maxRank(g),
  1544. downLayerGraphs = buildLayerGraphs(g, _.range(1, maxRank + 1), "inEdges"),
  1545. upLayerGraphs = buildLayerGraphs(g, _.range(maxRank - 1, -1, -1), "outEdges");
  1546. var layering = initOrder(g);
  1547. assignOrder(g, layering);
  1548. var bestCC = Number.POSITIVE_INFINITY,
  1549. best;
  1550. for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {
  1551. sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);
  1552. layering = util.buildLayerMatrix(g);
  1553. var cc = crossCount(g, layering);
  1554. if (cc < bestCC) {
  1555. lastBest = 0;
  1556. best = _.cloneDeep(layering);
  1557. bestCC = cc;
  1558. }
  1559. }
  1560. assignOrder(g, best);
  1561. }
  1562. function buildLayerGraphs(g, ranks, relationship) {
  1563. return _.map(ranks, function(rank) {
  1564. return buildLayerGraph(g, rank, relationship);
  1565. });
  1566. }
  1567. function sweepLayerGraphs(layerGraphs, biasRight) {
  1568. var cg = new Graph();
  1569. _.forEach(layerGraphs, function(lg) {
  1570. var root = lg.graph().root;
  1571. var sorted = sortSubgraph(lg, root, cg, biasRight);
  1572. _.forEach(sorted.vs, function(v, i) {
  1573. lg.node(v).order = i;
  1574. });
  1575. addSubgraphConstraints(lg, cg, sorted.vs);
  1576. });
  1577. }
  1578. function assignOrder(g, layering) {
  1579. _.forEach(layering, function(layer) {
  1580. _.forEach(layer, function(v, i) {
  1581. g.node(v).order = i;
  1582. });
  1583. });
  1584. }
  1585. /***/ }),
  1586. /***/ "../../node_modules/dagre/lib/order/init-order.js":
  1587. /*!**********************************************************************************!*\
  1588. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/init-order.js ***!
  1589. \**********************************************************************************/
  1590. /*! no static exports found */
  1591. /***/ (function(module, exports, __webpack_require__) {
  1592. "use strict";
  1593. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1594. module.exports = initOrder;
  1595. /*
  1596. * Assigns an initial order value for each node by performing a DFS search
  1597. * starting from nodes in the first rank. Nodes are assigned an order in their
  1598. * rank as they are first visited.
  1599. *
  1600. * This approach comes from Gansner, et al., "A Technique for Drawing Directed
  1601. * Graphs."
  1602. *
  1603. * Returns a layering matrix with an array per layer and each layer sorted by
  1604. * the order of its nodes.
  1605. */
  1606. function initOrder(g) {
  1607. var visited = {};
  1608. var simpleNodes = _.filter(g.nodes(), function(v) {
  1609. return !g.children(v).length;
  1610. });
  1611. var maxRank = _.max(_.map(simpleNodes, function(v) { return g.node(v).rank; }));
  1612. var layers = _.map(_.range(maxRank + 1), function() { return []; });
  1613. function dfs(v) {
  1614. if (_.has(visited, v)) return;
  1615. visited[v] = true;
  1616. var node = g.node(v);
  1617. layers[node.rank].push(v);
  1618. _.forEach(g.successors(v), dfs);
  1619. }
  1620. var orderedVs = _.sortBy(simpleNodes, function(v) { return g.node(v).rank; });
  1621. _.forEach(orderedVs, dfs);
  1622. return layers;
  1623. }
  1624. /***/ }),
  1625. /***/ "../../node_modules/dagre/lib/order/resolve-conflicts.js":
  1626. /*!*****************************************************************************************!*\
  1627. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/resolve-conflicts.js ***!
  1628. \*****************************************************************************************/
  1629. /*! no static exports found */
  1630. /***/ (function(module, exports, __webpack_require__) {
  1631. "use strict";
  1632. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1633. module.exports = resolveConflicts;
  1634. /*
  1635. * Given a list of entries of the form {v, barycenter, weight} and a
  1636. * constraint graph this function will resolve any conflicts between the
  1637. * constraint graph and the barycenters for the entries. If the barycenters for
  1638. * an entry would violate a constraint in the constraint graph then we coalesce
  1639. * the nodes in the conflict into a new node that respects the contraint and
  1640. * aggregates barycenter and weight information.
  1641. *
  1642. * This implementation is based on the description in Forster, "A Fast and
  1643. * Simple Hueristic for Constrained Two-Level Crossing Reduction," thought it
  1644. * differs in some specific details.
  1645. *
  1646. * Pre-conditions:
  1647. *
  1648. * 1. Each entry has the form {v, barycenter, weight}, or if the node has
  1649. * no barycenter, then {v}.
  1650. *
  1651. * Returns:
  1652. *
  1653. * A new list of entries of the form {vs, i, barycenter, weight}. The list
  1654. * `vs` may either be a singleton or it may be an aggregation of nodes
  1655. * ordered such that they do not violate constraints from the constraint
  1656. * graph. The property `i` is the lowest original index of any of the
  1657. * elements in `vs`.
  1658. */
  1659. function resolveConflicts(entries, cg) {
  1660. var mappedEntries = {};
  1661. _.forEach(entries, function(entry, i) {
  1662. var tmp = mappedEntries[entry.v] = {
  1663. indegree: 0,
  1664. "in": [],
  1665. out: [],
  1666. vs: [entry.v],
  1667. i: i
  1668. };
  1669. if (!_.isUndefined(entry.barycenter)) {
  1670. tmp.barycenter = entry.barycenter;
  1671. tmp.weight = entry.weight;
  1672. }
  1673. });
  1674. _.forEach(cg.edges(), function(e) {
  1675. var entryV = mappedEntries[e.v];
  1676. var entryW = mappedEntries[e.w];
  1677. if (!_.isUndefined(entryV) && !_.isUndefined(entryW)) {
  1678. entryW.indegree++;
  1679. entryV.out.push(mappedEntries[e.w]);
  1680. }
  1681. });
  1682. var sourceSet = _.filter(mappedEntries, function(entry) {
  1683. return !entry.indegree;
  1684. });
  1685. return doResolveConflicts(sourceSet);
  1686. }
  1687. function doResolveConflicts(sourceSet) {
  1688. var entries = [];
  1689. function handleIn(vEntry) {
  1690. return function(uEntry) {
  1691. if (uEntry.merged) {
  1692. return;
  1693. }
  1694. if (_.isUndefined(uEntry.barycenter) ||
  1695. _.isUndefined(vEntry.barycenter) ||
  1696. uEntry.barycenter >= vEntry.barycenter) {
  1697. mergeEntries(vEntry, uEntry);
  1698. }
  1699. };
  1700. }
  1701. function handleOut(vEntry) {
  1702. return function(wEntry) {
  1703. wEntry["in"].push(vEntry);
  1704. if (--wEntry.indegree === 0) {
  1705. sourceSet.push(wEntry);
  1706. }
  1707. };
  1708. }
  1709. while (sourceSet.length) {
  1710. var entry = sourceSet.pop();
  1711. entries.push(entry);
  1712. _.forEach(entry["in"].reverse(), handleIn(entry));
  1713. _.forEach(entry.out, handleOut(entry));
  1714. }
  1715. return _.map(_.filter(entries, function(entry) { return !entry.merged; }),
  1716. function(entry) {
  1717. return _.pick(entry, ["vs", "i", "barycenter", "weight"]);
  1718. });
  1719. }
  1720. function mergeEntries(target, source) {
  1721. var sum = 0;
  1722. var weight = 0;
  1723. if (target.weight) {
  1724. sum += target.barycenter * target.weight;
  1725. weight += target.weight;
  1726. }
  1727. if (source.weight) {
  1728. sum += source.barycenter * source.weight;
  1729. weight += source.weight;
  1730. }
  1731. target.vs = source.vs.concat(target.vs);
  1732. target.barycenter = sum / weight;
  1733. target.weight = weight;
  1734. target.i = Math.min(source.i, target.i);
  1735. source.merged = true;
  1736. }
  1737. /***/ }),
  1738. /***/ "../../node_modules/dagre/lib/order/sort-subgraph.js":
  1739. /*!*************************************************************************************!*\
  1740. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/sort-subgraph.js ***!
  1741. \*************************************************************************************/
  1742. /*! no static exports found */
  1743. /***/ (function(module, exports, __webpack_require__) {
  1744. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1745. var barycenter = __webpack_require__(/*! ./barycenter */ "../../node_modules/dagre/lib/order/barycenter.js");
  1746. var resolveConflicts = __webpack_require__(/*! ./resolve-conflicts */ "../../node_modules/dagre/lib/order/resolve-conflicts.js");
  1747. var sort = __webpack_require__(/*! ./sort */ "../../node_modules/dagre/lib/order/sort.js");
  1748. module.exports = sortSubgraph;
  1749. function sortSubgraph(g, v, cg, biasRight) {
  1750. var movable = g.children(v);
  1751. var node = g.node(v);
  1752. var bl = node ? node.borderLeft : undefined;
  1753. var br = node ? node.borderRight: undefined;
  1754. var subgraphs = {};
  1755. if (bl) {
  1756. movable = _.filter(movable, function(w) {
  1757. return w !== bl && w !== br;
  1758. });
  1759. }
  1760. var barycenters = barycenter(g, movable);
  1761. _.forEach(barycenters, function(entry) {
  1762. if (g.children(entry.v).length) {
  1763. var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);
  1764. subgraphs[entry.v] = subgraphResult;
  1765. if (_.has(subgraphResult, "barycenter")) {
  1766. mergeBarycenters(entry, subgraphResult);
  1767. }
  1768. }
  1769. });
  1770. var entries = resolveConflicts(barycenters, cg);
  1771. expandSubgraphs(entries, subgraphs);
  1772. var result = sort(entries, biasRight);
  1773. if (bl) {
  1774. result.vs = _.flatten([bl, result.vs, br], true);
  1775. if (g.predecessors(bl).length) {
  1776. var blPred = g.node(g.predecessors(bl)[0]),
  1777. brPred = g.node(g.predecessors(br)[0]);
  1778. if (!_.has(result, "barycenter")) {
  1779. result.barycenter = 0;
  1780. result.weight = 0;
  1781. }
  1782. result.barycenter = (result.barycenter * result.weight +
  1783. blPred.order + brPred.order) / (result.weight + 2);
  1784. result.weight += 2;
  1785. }
  1786. }
  1787. return result;
  1788. }
  1789. function expandSubgraphs(entries, subgraphs) {
  1790. _.forEach(entries, function(entry) {
  1791. entry.vs = _.flatten(entry.vs.map(function(v) {
  1792. if (subgraphs[v]) {
  1793. return subgraphs[v].vs;
  1794. }
  1795. return v;
  1796. }), true);
  1797. });
  1798. }
  1799. function mergeBarycenters(target, other) {
  1800. if (!_.isUndefined(target.barycenter)) {
  1801. target.barycenter = (target.barycenter * target.weight +
  1802. other.barycenter * other.weight) /
  1803. (target.weight + other.weight);
  1804. target.weight += other.weight;
  1805. } else {
  1806. target.barycenter = other.barycenter;
  1807. target.weight = other.weight;
  1808. }
  1809. }
  1810. /***/ }),
  1811. /***/ "../../node_modules/dagre/lib/order/sort.js":
  1812. /*!****************************************************************************!*\
  1813. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/order/sort.js ***!
  1814. \****************************************************************************/
  1815. /*! no static exports found */
  1816. /***/ (function(module, exports, __webpack_require__) {
  1817. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1818. var util = __webpack_require__(/*! ../util */ "../../node_modules/dagre/lib/util.js");
  1819. module.exports = sort;
  1820. function sort(entries, biasRight) {
  1821. var parts = util.partition(entries, function(entry) {
  1822. return _.has(entry, "barycenter");
  1823. });
  1824. var sortable = parts.lhs,
  1825. unsortable = _.sortBy(parts.rhs, function(entry) { return -entry.i; }),
  1826. vs = [],
  1827. sum = 0,
  1828. weight = 0,
  1829. vsIndex = 0;
  1830. sortable.sort(compareWithBias(!!biasRight));
  1831. vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
  1832. _.forEach(sortable, function (entry) {
  1833. vsIndex += entry.vs.length;
  1834. vs.push(entry.vs);
  1835. sum += entry.barycenter * entry.weight;
  1836. weight += entry.weight;
  1837. vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
  1838. });
  1839. var result = { vs: _.flatten(vs, true) };
  1840. if (weight) {
  1841. result.barycenter = sum / weight;
  1842. result.weight = weight;
  1843. }
  1844. return result;
  1845. }
  1846. function consumeUnsortable(vs, unsortable, index) {
  1847. var last;
  1848. while (unsortable.length && (last = _.last(unsortable)).i <= index) {
  1849. unsortable.pop();
  1850. vs.push(last.vs);
  1851. index++;
  1852. }
  1853. return index;
  1854. }
  1855. function compareWithBias(bias) {
  1856. return function(entryV, entryW) {
  1857. if (entryV.barycenter < entryW.barycenter) {
  1858. return -1;
  1859. } else if (entryV.barycenter > entryW.barycenter) {
  1860. return 1;
  1861. }
  1862. return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;
  1863. };
  1864. }
  1865. /***/ }),
  1866. /***/ "../../node_modules/dagre/lib/parent-dummy-chains.js":
  1867. /*!*************************************************************************************!*\
  1868. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/parent-dummy-chains.js ***!
  1869. \*************************************************************************************/
  1870. /*! no static exports found */
  1871. /***/ (function(module, exports, __webpack_require__) {
  1872. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  1873. module.exports = parentDummyChains;
  1874. function parentDummyChains(g) {
  1875. var postorderNums = postorder(g);
  1876. _.forEach(g.graph().dummyChains, function(v) {
  1877. var node = g.node(v);
  1878. var edgeObj = node.edgeObj;
  1879. var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w);
  1880. var path = pathData.path;
  1881. var lca = pathData.lca;
  1882. var pathIdx = 0;
  1883. var pathV = path[pathIdx];
  1884. var ascending = true;
  1885. while (v !== edgeObj.w) {
  1886. node = g.node(v);
  1887. if (ascending) {
  1888. while ((pathV = path[pathIdx]) !== lca &&
  1889. g.node(pathV).maxRank < node.rank) {
  1890. pathIdx++;
  1891. }
  1892. if (pathV === lca) {
  1893. ascending = false;
  1894. }
  1895. }
  1896. if (!ascending) {
  1897. while (pathIdx < path.length - 1 &&
  1898. g.node(pathV = path[pathIdx + 1]).minRank <= node.rank) {
  1899. pathIdx++;
  1900. }
  1901. pathV = path[pathIdx];
  1902. }
  1903. g.setParent(v, pathV);
  1904. v = g.successors(v)[0];
  1905. }
  1906. });
  1907. }
  1908. // Find a path from v to w through the lowest common ancestor (LCA). Return the
  1909. // full path and the LCA.
  1910. function findPath(g, postorderNums, v, w) {
  1911. var vPath = [];
  1912. var wPath = [];
  1913. var low = Math.min(postorderNums[v].low, postorderNums[w].low);
  1914. var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim);
  1915. var parent;
  1916. var lca;
  1917. // Traverse up from v to find the LCA
  1918. parent = v;
  1919. do {
  1920. parent = g.parent(parent);
  1921. vPath.push(parent);
  1922. } while (parent &&
  1923. (postorderNums[parent].low > low || lim > postorderNums[parent].lim));
  1924. lca = parent;
  1925. // Traverse from w to LCA
  1926. parent = w;
  1927. while ((parent = g.parent(parent)) !== lca) {
  1928. wPath.push(parent);
  1929. }
  1930. return { path: vPath.concat(wPath.reverse()), lca: lca };
  1931. }
  1932. function postorder(g) {
  1933. var result = {};
  1934. var lim = 0;
  1935. function dfs(v) {
  1936. var low = lim;
  1937. _.forEach(g.children(v), dfs);
  1938. result[v] = { low: low, lim: lim++ };
  1939. }
  1940. _.forEach(g.children(), dfs);
  1941. return result;
  1942. }
  1943. /***/ }),
  1944. /***/ "../../node_modules/dagre/lib/position/bk.js":
  1945. /*!*****************************************************************************!*\
  1946. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/position/bk.js ***!
  1947. \*****************************************************************************/
  1948. /*! no static exports found */
  1949. /***/ (function(module, exports, __webpack_require__) {
  1950. "use strict";
  1951. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  1952. var Graph = __webpack_require__(/*! ../graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  1953. var util = __webpack_require__(/*! ../util */ "../../node_modules/dagre/lib/util.js");
  1954. /*
  1955. * This module provides coordinate assignment based on Brandes and Köpf, "Fast
  1956. * and Simple Horizontal Coordinate Assignment."
  1957. */
  1958. module.exports = {
  1959. positionX: positionX,
  1960. findType1Conflicts: findType1Conflicts,
  1961. findType2Conflicts: findType2Conflicts,
  1962. addConflict: addConflict,
  1963. hasConflict: hasConflict,
  1964. verticalAlignment: verticalAlignment,
  1965. horizontalCompaction: horizontalCompaction,
  1966. alignCoordinates: alignCoordinates,
  1967. findSmallestWidthAlignment: findSmallestWidthAlignment,
  1968. balance: balance
  1969. };
  1970. /*
  1971. * Marks all edges in the graph with a type-1 conflict with the "type1Conflict"
  1972. * property. A type-1 conflict is one where a non-inner segment crosses an
  1973. * inner segment. An inner segment is an edge with both incident nodes marked
  1974. * with the "dummy" property.
  1975. *
  1976. * This algorithm scans layer by layer, starting with the second, for type-1
  1977. * conflicts between the current layer and the previous layer. For each layer
  1978. * it scans the nodes from left to right until it reaches one that is incident
  1979. * on an inner segment. It then scans predecessors to determine if they have
  1980. * edges that cross that inner segment. At the end a final scan is done for all
  1981. * nodes on the current rank to see if they cross the last visited inner
  1982. * segment.
  1983. *
  1984. * This algorithm (safely) assumes that a dummy node will only be incident on a
  1985. * single node in the layers being scanned.
  1986. */
  1987. function findType1Conflicts(g, layering) {
  1988. var conflicts = {};
  1989. function visitLayer(prevLayer, layer) {
  1990. var
  1991. // last visited node in the previous layer that is incident on an inner
  1992. // segment.
  1993. k0 = 0,
  1994. // Tracks the last node in this layer scanned for crossings with a type-1
  1995. // segment.
  1996. scanPos = 0,
  1997. prevLayerLength = prevLayer.length,
  1998. lastNode = _.last(layer);
  1999. _.forEach(layer, function(v, i) {
  2000. var w = findOtherInnerSegmentNode(g, v),
  2001. k1 = w ? g.node(w).order : prevLayerLength;
  2002. if (w || v === lastNode) {
  2003. _.forEach(layer.slice(scanPos, i +1), function(scanNode) {
  2004. _.forEach(g.predecessors(scanNode), function(u) {
  2005. var uLabel = g.node(u),
  2006. uPos = uLabel.order;
  2007. if ((uPos < k0 || k1 < uPos) &&
  2008. !(uLabel.dummy && g.node(scanNode).dummy)) {
  2009. addConflict(conflicts, u, scanNode);
  2010. }
  2011. });
  2012. });
  2013. scanPos = i + 1;
  2014. k0 = k1;
  2015. }
  2016. });
  2017. return layer;
  2018. }
  2019. _.reduce(layering, visitLayer);
  2020. return conflicts;
  2021. }
  2022. function findType2Conflicts(g, layering) {
  2023. var conflicts = {};
  2024. function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {
  2025. var v;
  2026. _.forEach(_.range(southPos, southEnd), function(i) {
  2027. v = south[i];
  2028. if (g.node(v).dummy) {
  2029. _.forEach(g.predecessors(v), function(u) {
  2030. var uNode = g.node(u);
  2031. if (uNode.dummy &&
  2032. (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {
  2033. addConflict(conflicts, u, v);
  2034. }
  2035. });
  2036. }
  2037. });
  2038. }
  2039. function visitLayer(north, south) {
  2040. var prevNorthPos = -1,
  2041. nextNorthPos,
  2042. southPos = 0;
  2043. _.forEach(south, function(v, southLookahead) {
  2044. if (g.node(v).dummy === "border") {
  2045. var predecessors = g.predecessors(v);
  2046. if (predecessors.length) {
  2047. nextNorthPos = g.node(predecessors[0]).order;
  2048. scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);
  2049. southPos = southLookahead;
  2050. prevNorthPos = nextNorthPos;
  2051. }
  2052. }
  2053. scan(south, southPos, south.length, nextNorthPos, north.length);
  2054. });
  2055. return south;
  2056. }
  2057. _.reduce(layering, visitLayer);
  2058. return conflicts;
  2059. }
  2060. function findOtherInnerSegmentNode(g, v) {
  2061. if (g.node(v).dummy) {
  2062. return _.find(g.predecessors(v), function(u) {
  2063. return g.node(u).dummy;
  2064. });
  2065. }
  2066. }
  2067. function addConflict(conflicts, v, w) {
  2068. if (v > w) {
  2069. var tmp = v;
  2070. v = w;
  2071. w = tmp;
  2072. }
  2073. var conflictsV = conflicts[v];
  2074. if (!conflictsV) {
  2075. conflicts[v] = conflictsV = {};
  2076. }
  2077. conflictsV[w] = true;
  2078. }
  2079. function hasConflict(conflicts, v, w) {
  2080. if (v > w) {
  2081. var tmp = v;
  2082. v = w;
  2083. w = tmp;
  2084. }
  2085. return _.has(conflicts[v], w);
  2086. }
  2087. /*
  2088. * Try to align nodes into vertical "blocks" where possible. This algorithm
  2089. * attempts to align a node with one of its median neighbors. If the edge
  2090. * connecting a neighbor is a type-1 conflict then we ignore that possibility.
  2091. * If a previous node has already formed a block with a node after the node
  2092. * we're trying to form a block with, we also ignore that possibility - our
  2093. * blocks would be split in that scenario.
  2094. */
  2095. function verticalAlignment(g, layering, conflicts, neighborFn) {
  2096. var root = {},
  2097. align = {},
  2098. pos = {};
  2099. // We cache the position here based on the layering because the graph and
  2100. // layering may be out of sync. The layering matrix is manipulated to
  2101. // generate different extreme alignments.
  2102. _.forEach(layering, function(layer) {
  2103. _.forEach(layer, function(v, order) {
  2104. root[v] = v;
  2105. align[v] = v;
  2106. pos[v] = order;
  2107. });
  2108. });
  2109. _.forEach(layering, function(layer) {
  2110. var prevIdx = -1;
  2111. _.forEach(layer, function(v) {
  2112. var ws = neighborFn(v);
  2113. if (ws.length) {
  2114. ws = _.sortBy(ws, function(w) { return pos[w]; });
  2115. var mp = (ws.length - 1) / 2;
  2116. for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {
  2117. var w = ws[i];
  2118. if (align[v] === v &&
  2119. prevIdx < pos[w] &&
  2120. !hasConflict(conflicts, v, w)) {
  2121. align[w] = v;
  2122. align[v] = root[v] = root[w];
  2123. prevIdx = pos[w];
  2124. }
  2125. }
  2126. }
  2127. });
  2128. });
  2129. return { root: root, align: align };
  2130. }
  2131. function horizontalCompaction(g, layering, root, align, reverseSep) {
  2132. // This portion of the algorithm differs from BK due to a number of problems.
  2133. // Instead of their algorithm we construct a new block graph and do two
  2134. // sweeps. The first sweep places blocks with the smallest possible
  2135. // coordinates. The second sweep removes unused space by moving blocks to the
  2136. // greatest coordinates without violating separation.
  2137. var xs = {},
  2138. blockG = buildBlockGraph(g, layering, root, reverseSep),
  2139. borderType = reverseSep ? "borderLeft" : "borderRight";
  2140. function iterate(setXsFunc, nextNodesFunc) {
  2141. var stack = blockG.nodes();
  2142. var elem = stack.pop();
  2143. var visited = {};
  2144. while (elem) {
  2145. if (visited[elem]) {
  2146. setXsFunc(elem);
  2147. } else {
  2148. visited[elem] = true;
  2149. stack.push(elem);
  2150. stack = stack.concat(nextNodesFunc(elem));
  2151. }
  2152. elem = stack.pop();
  2153. }
  2154. }
  2155. // First pass, assign smallest coordinates
  2156. function pass1(elem) {
  2157. xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) {
  2158. return Math.max(acc, xs[e.v] + blockG.edge(e));
  2159. }, 0);
  2160. }
  2161. // Second pass, assign greatest coordinates
  2162. function pass2(elem) {
  2163. var min = blockG.outEdges(elem).reduce(function(acc, e) {
  2164. return Math.min(acc, xs[e.w] - blockG.edge(e));
  2165. }, Number.POSITIVE_INFINITY);
  2166. var node = g.node(elem);
  2167. if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {
  2168. xs[elem] = Math.max(xs[elem], min);
  2169. }
  2170. }
  2171. iterate(pass1, blockG.predecessors.bind(blockG));
  2172. iterate(pass2, blockG.successors.bind(blockG));
  2173. // Assign x coordinates to all nodes
  2174. _.forEach(align, function(v) {
  2175. xs[v] = xs[root[v]];
  2176. });
  2177. return xs;
  2178. }
  2179. function buildBlockGraph(g, layering, root, reverseSep) {
  2180. var blockGraph = new Graph(),
  2181. graphLabel = g.graph(),
  2182. sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
  2183. _.forEach(layering, function(layer) {
  2184. var u;
  2185. _.forEach(layer, function(v) {
  2186. var vRoot = root[v];
  2187. blockGraph.setNode(vRoot);
  2188. if (u) {
  2189. var uRoot = root[u],
  2190. prevMax = blockGraph.edge(uRoot, vRoot);
  2191. blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));
  2192. }
  2193. u = v;
  2194. });
  2195. });
  2196. return blockGraph;
  2197. }
  2198. /*
  2199. * Returns the alignment that has the smallest width of the given alignments.
  2200. */
  2201. function findSmallestWidthAlignment(g, xss) {
  2202. return _.minBy(_.values(xss), function (xs) {
  2203. var max = Number.NEGATIVE_INFINITY;
  2204. var min = Number.POSITIVE_INFINITY;
  2205. _.forIn(xs, function (x, v) {
  2206. var halfWidth = width(g, v) / 2;
  2207. max = Math.max(x + halfWidth, max);
  2208. min = Math.min(x - halfWidth, min);
  2209. });
  2210. return max - min;
  2211. });
  2212. }
  2213. /*
  2214. * Align the coordinates of each of the layout alignments such that
  2215. * left-biased alignments have their minimum coordinate at the same point as
  2216. * the minimum coordinate of the smallest width alignment and right-biased
  2217. * alignments have their maximum coordinate at the same point as the maximum
  2218. * coordinate of the smallest width alignment.
  2219. */
  2220. function alignCoordinates(xss, alignTo) {
  2221. var alignToVals = _.values(alignTo),
  2222. alignToMin = _.min(alignToVals),
  2223. alignToMax = _.max(alignToVals);
  2224. _.forEach(["u", "d"], function(vert) {
  2225. _.forEach(["l", "r"], function(horiz) {
  2226. var alignment = vert + horiz,
  2227. xs = xss[alignment],
  2228. delta;
  2229. if (xs === alignTo) return;
  2230. var xsVals = _.values(xs);
  2231. delta = horiz === "l" ? alignToMin - _.min(xsVals) : alignToMax - _.max(xsVals);
  2232. if (delta) {
  2233. xss[alignment] = _.mapValues(xs, function(x) { return x + delta; });
  2234. }
  2235. });
  2236. });
  2237. }
  2238. function balance(xss, align) {
  2239. return _.mapValues(xss.ul, function(ignore, v) {
  2240. if (align) {
  2241. return xss[align.toLowerCase()][v];
  2242. } else {
  2243. var xs = _.sortBy(_.map(xss, v));
  2244. return (xs[1] + xs[2]) / 2;
  2245. }
  2246. });
  2247. }
  2248. function positionX(g) {
  2249. var layering = util.buildLayerMatrix(g);
  2250. var conflicts = _.merge(
  2251. findType1Conflicts(g, layering),
  2252. findType2Conflicts(g, layering));
  2253. var xss = {};
  2254. var adjustedLayering;
  2255. _.forEach(["u", "d"], function(vert) {
  2256. adjustedLayering = vert === "u" ? layering : _.values(layering).reverse();
  2257. _.forEach(["l", "r"], function(horiz) {
  2258. if (horiz === "r") {
  2259. adjustedLayering = _.map(adjustedLayering, function(inner) {
  2260. return _.values(inner).reverse();
  2261. });
  2262. }
  2263. var neighborFn = (vert === "u" ? g.predecessors : g.successors).bind(g);
  2264. var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);
  2265. var xs = horizontalCompaction(g, adjustedLayering,
  2266. align.root, align.align, horiz === "r");
  2267. if (horiz === "r") {
  2268. xs = _.mapValues(xs, function(x) { return -x; });
  2269. }
  2270. xss[vert + horiz] = xs;
  2271. });
  2272. });
  2273. var smallestWidth = findSmallestWidthAlignment(g, xss);
  2274. alignCoordinates(xss, smallestWidth);
  2275. return balance(xss, g.graph().align);
  2276. }
  2277. function sep(nodeSep, edgeSep, reverseSep) {
  2278. return function(g, v, w) {
  2279. var vLabel = g.node(v);
  2280. var wLabel = g.node(w);
  2281. var sum = 0;
  2282. var delta;
  2283. sum += vLabel.width / 2;
  2284. if (_.has(vLabel, "labelpos")) {
  2285. switch (vLabel.labelpos.toLowerCase()) {
  2286. case "l": delta = -vLabel.width / 2; break;
  2287. case "r": delta = vLabel.width / 2; break;
  2288. }
  2289. }
  2290. if (delta) {
  2291. sum += reverseSep ? delta : -delta;
  2292. }
  2293. delta = 0;
  2294. sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;
  2295. sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;
  2296. sum += wLabel.width / 2;
  2297. if (_.has(wLabel, "labelpos")) {
  2298. switch (wLabel.labelpos.toLowerCase()) {
  2299. case "l": delta = wLabel.width / 2; break;
  2300. case "r": delta = -wLabel.width / 2; break;
  2301. }
  2302. }
  2303. if (delta) {
  2304. sum += reverseSep ? delta : -delta;
  2305. }
  2306. delta = 0;
  2307. return sum;
  2308. };
  2309. }
  2310. function width(g, v) {
  2311. return g.node(v).width;
  2312. }
  2313. /***/ }),
  2314. /***/ "../../node_modules/dagre/lib/position/index.js":
  2315. /*!********************************************************************************!*\
  2316. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/position/index.js ***!
  2317. \********************************************************************************/
  2318. /*! no static exports found */
  2319. /***/ (function(module, exports, __webpack_require__) {
  2320. "use strict";
  2321. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  2322. var util = __webpack_require__(/*! ../util */ "../../node_modules/dagre/lib/util.js");
  2323. var positionX = __webpack_require__(/*! ./bk */ "../../node_modules/dagre/lib/position/bk.js").positionX;
  2324. module.exports = position;
  2325. function position(g) {
  2326. g = util.asNonCompoundGraph(g);
  2327. positionY(g);
  2328. _.forEach(positionX(g), function(x, v) {
  2329. g.node(v).x = x;
  2330. });
  2331. }
  2332. function positionY(g) {
  2333. var layering = util.buildLayerMatrix(g);
  2334. var rankSep = g.graph().ranksep;
  2335. var prevY = 0;
  2336. _.forEach(layering, function(layer) {
  2337. var maxHeight = _.max(_.map(layer, function(v) { return g.node(v).height; }));
  2338. _.forEach(layer, function(v) {
  2339. g.node(v).y = prevY + maxHeight / 2;
  2340. });
  2341. prevY += maxHeight + rankSep;
  2342. });
  2343. }
  2344. /***/ }),
  2345. /***/ "../../node_modules/dagre/lib/rank/feasible-tree.js":
  2346. /*!************************************************************************************!*\
  2347. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/rank/feasible-tree.js ***!
  2348. \************************************************************************************/
  2349. /*! no static exports found */
  2350. /***/ (function(module, exports, __webpack_require__) {
  2351. "use strict";
  2352. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  2353. var Graph = __webpack_require__(/*! ../graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  2354. var slack = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/rank/util.js").slack;
  2355. module.exports = feasibleTree;
  2356. /*
  2357. * Constructs a spanning tree with tight edges and adjusted the input node's
  2358. * ranks to achieve this. A tight edge is one that is has a length that matches
  2359. * its "minlen" attribute.
  2360. *
  2361. * The basic structure for this function is derived from Gansner, et al., "A
  2362. * Technique for Drawing Directed Graphs."
  2363. *
  2364. * Pre-conditions:
  2365. *
  2366. * 1. Graph must be a DAG.
  2367. * 2. Graph must be connected.
  2368. * 3. Graph must have at least one node.
  2369. * 5. Graph nodes must have been previously assigned a "rank" property that
  2370. * respects the "minlen" property of incident edges.
  2371. * 6. Graph edges must have a "minlen" property.
  2372. *
  2373. * Post-conditions:
  2374. *
  2375. * - Graph nodes will have their rank adjusted to ensure that all edges are
  2376. * tight.
  2377. *
  2378. * Returns a tree (undirected graph) that is constructed using only "tight"
  2379. * edges.
  2380. */
  2381. function feasibleTree(g) {
  2382. var t = new Graph({ directed: false });
  2383. // Choose arbitrary node from which to start our tree
  2384. var start = g.nodes()[0];
  2385. var size = g.nodeCount();
  2386. t.setNode(start, {});
  2387. var edge, delta;
  2388. while (tightTree(t, g) < size) {
  2389. edge = findMinSlackEdge(t, g);
  2390. delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);
  2391. shiftRanks(t, g, delta);
  2392. }
  2393. return t;
  2394. }
  2395. /*
  2396. * Finds a maximal tree of tight edges and returns the number of nodes in the
  2397. * tree.
  2398. */
  2399. function tightTree(t, g) {
  2400. function dfs(v) {
  2401. _.forEach(g.nodeEdges(v), function(e) {
  2402. var edgeV = e.v,
  2403. w = (v === edgeV) ? e.w : edgeV;
  2404. if (!t.hasNode(w) && !slack(g, e)) {
  2405. t.setNode(w, {});
  2406. t.setEdge(v, w, {});
  2407. dfs(w);
  2408. }
  2409. });
  2410. }
  2411. _.forEach(t.nodes(), dfs);
  2412. return t.nodeCount();
  2413. }
  2414. /*
  2415. * Finds the edge with the smallest slack that is incident on tree and returns
  2416. * it.
  2417. */
  2418. function findMinSlackEdge(t, g) {
  2419. return _.minBy(g.edges(), function(e) {
  2420. if (t.hasNode(e.v) !== t.hasNode(e.w)) {
  2421. return slack(g, e);
  2422. }
  2423. });
  2424. }
  2425. function shiftRanks(t, g, delta) {
  2426. _.forEach(t.nodes(), function(v) {
  2427. g.node(v).rank += delta;
  2428. });
  2429. }
  2430. /***/ }),
  2431. /***/ "../../node_modules/dagre/lib/rank/index.js":
  2432. /*!****************************************************************************!*\
  2433. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/rank/index.js ***!
  2434. \****************************************************************************/
  2435. /*! no static exports found */
  2436. /***/ (function(module, exports, __webpack_require__) {
  2437. "use strict";
  2438. var rankUtil = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/rank/util.js");
  2439. var longestPath = rankUtil.longestPath;
  2440. var feasibleTree = __webpack_require__(/*! ./feasible-tree */ "../../node_modules/dagre/lib/rank/feasible-tree.js");
  2441. var networkSimplex = __webpack_require__(/*! ./network-simplex */ "../../node_modules/dagre/lib/rank/network-simplex.js");
  2442. module.exports = rank;
  2443. /*
  2444. * Assigns a rank to each node in the input graph that respects the "minlen"
  2445. * constraint specified on edges between nodes.
  2446. *
  2447. * This basic structure is derived from Gansner, et al., "A Technique for
  2448. * Drawing Directed Graphs."
  2449. *
  2450. * Pre-conditions:
  2451. *
  2452. * 1. Graph must be a connected DAG
  2453. * 2. Graph nodes must be objects
  2454. * 3. Graph edges must have "weight" and "minlen" attributes
  2455. *
  2456. * Post-conditions:
  2457. *
  2458. * 1. Graph nodes will have a "rank" attribute based on the results of the
  2459. * algorithm. Ranks can start at any index (including negative), we'll
  2460. * fix them up later.
  2461. */
  2462. function rank(g) {
  2463. switch(g.graph().ranker) {
  2464. case "network-simplex": networkSimplexRanker(g); break;
  2465. case "tight-tree": tightTreeRanker(g); break;
  2466. case "longest-path": longestPathRanker(g); break;
  2467. default: networkSimplexRanker(g);
  2468. }
  2469. }
  2470. // A fast and simple ranker, but results are far from optimal.
  2471. var longestPathRanker = longestPath;
  2472. function tightTreeRanker(g) {
  2473. longestPath(g);
  2474. feasibleTree(g);
  2475. }
  2476. function networkSimplexRanker(g) {
  2477. networkSimplex(g);
  2478. }
  2479. /***/ }),
  2480. /***/ "../../node_modules/dagre/lib/rank/network-simplex.js":
  2481. /*!**************************************************************************************!*\
  2482. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/rank/network-simplex.js ***!
  2483. \**************************************************************************************/
  2484. /*! no static exports found */
  2485. /***/ (function(module, exports, __webpack_require__) {
  2486. "use strict";
  2487. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  2488. var feasibleTree = __webpack_require__(/*! ./feasible-tree */ "../../node_modules/dagre/lib/rank/feasible-tree.js");
  2489. var slack = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/rank/util.js").slack;
  2490. var initRank = __webpack_require__(/*! ./util */ "../../node_modules/dagre/lib/rank/util.js").longestPath;
  2491. var preorder = __webpack_require__(/*! ../graphlib */ "../../node_modules/dagre/lib/graphlib.js").alg.preorder;
  2492. var postorder = __webpack_require__(/*! ../graphlib */ "../../node_modules/dagre/lib/graphlib.js").alg.postorder;
  2493. var simplify = __webpack_require__(/*! ../util */ "../../node_modules/dagre/lib/util.js").simplify;
  2494. module.exports = networkSimplex;
  2495. // Expose some internals for testing purposes
  2496. networkSimplex.initLowLimValues = initLowLimValues;
  2497. networkSimplex.initCutValues = initCutValues;
  2498. networkSimplex.calcCutValue = calcCutValue;
  2499. networkSimplex.leaveEdge = leaveEdge;
  2500. networkSimplex.enterEdge = enterEdge;
  2501. networkSimplex.exchangeEdges = exchangeEdges;
  2502. /*
  2503. * The network simplex algorithm assigns ranks to each node in the input graph
  2504. * and iteratively improves the ranking to reduce the length of edges.
  2505. *
  2506. * Preconditions:
  2507. *
  2508. * 1. The input graph must be a DAG.
  2509. * 2. All nodes in the graph must have an object value.
  2510. * 3. All edges in the graph must have "minlen" and "weight" attributes.
  2511. *
  2512. * Postconditions:
  2513. *
  2514. * 1. All nodes in the graph will have an assigned "rank" attribute that has
  2515. * been optimized by the network simplex algorithm. Ranks start at 0.
  2516. *
  2517. *
  2518. * A rough sketch of the algorithm is as follows:
  2519. *
  2520. * 1. Assign initial ranks to each node. We use the longest path algorithm,
  2521. * which assigns ranks to the lowest position possible. In general this
  2522. * leads to very wide bottom ranks and unnecessarily long edges.
  2523. * 2. Construct a feasible tight tree. A tight tree is one such that all
  2524. * edges in the tree have no slack (difference between length of edge
  2525. * and minlen for the edge). This by itself greatly improves the assigned
  2526. * rankings by shorting edges.
  2527. * 3. Iteratively find edges that have negative cut values. Generally a
  2528. * negative cut value indicates that the edge could be removed and a new
  2529. * tree edge could be added to produce a more compact graph.
  2530. *
  2531. * Much of the algorithms here are derived from Gansner, et al., "A Technique
  2532. * for Drawing Directed Graphs." The structure of the file roughly follows the
  2533. * structure of the overall algorithm.
  2534. */
  2535. function networkSimplex(g) {
  2536. g = simplify(g);
  2537. initRank(g);
  2538. var t = feasibleTree(g);
  2539. initLowLimValues(t);
  2540. initCutValues(t, g);
  2541. var e, f;
  2542. while ((e = leaveEdge(t))) {
  2543. f = enterEdge(t, g, e);
  2544. exchangeEdges(t, g, e, f);
  2545. }
  2546. }
  2547. /*
  2548. * Initializes cut values for all edges in the tree.
  2549. */
  2550. function initCutValues(t, g) {
  2551. var vs = postorder(t, t.nodes());
  2552. vs = vs.slice(0, vs.length - 1);
  2553. _.forEach(vs, function(v) {
  2554. assignCutValue(t, g, v);
  2555. });
  2556. }
  2557. function assignCutValue(t, g, child) {
  2558. var childLab = t.node(child);
  2559. var parent = childLab.parent;
  2560. t.edge(child, parent).cutvalue = calcCutValue(t, g, child);
  2561. }
  2562. /*
  2563. * Given the tight tree, its graph, and a child in the graph calculate and
  2564. * return the cut value for the edge between the child and its parent.
  2565. */
  2566. function calcCutValue(t, g, child) {
  2567. var childLab = t.node(child);
  2568. var parent = childLab.parent;
  2569. // True if the child is on the tail end of the edge in the directed graph
  2570. var childIsTail = true;
  2571. // The graph's view of the tree edge we're inspecting
  2572. var graphEdge = g.edge(child, parent);
  2573. // The accumulated cut value for the edge between this node and its parent
  2574. var cutValue = 0;
  2575. if (!graphEdge) {
  2576. childIsTail = false;
  2577. graphEdge = g.edge(parent, child);
  2578. }
  2579. cutValue = graphEdge.weight;
  2580. _.forEach(g.nodeEdges(child), function(e) {
  2581. var isOutEdge = e.v === child,
  2582. other = isOutEdge ? e.w : e.v;
  2583. if (other !== parent) {
  2584. var pointsToHead = isOutEdge === childIsTail,
  2585. otherWeight = g.edge(e).weight;
  2586. cutValue += pointsToHead ? otherWeight : -otherWeight;
  2587. if (isTreeEdge(t, child, other)) {
  2588. var otherCutValue = t.edge(child, other).cutvalue;
  2589. cutValue += pointsToHead ? -otherCutValue : otherCutValue;
  2590. }
  2591. }
  2592. });
  2593. return cutValue;
  2594. }
  2595. function initLowLimValues(tree, root) {
  2596. if (arguments.length < 2) {
  2597. root = tree.nodes()[0];
  2598. }
  2599. dfsAssignLowLim(tree, {}, 1, root);
  2600. }
  2601. function dfsAssignLowLim(tree, visited, nextLim, v, parent) {
  2602. var low = nextLim;
  2603. var label = tree.node(v);
  2604. visited[v] = true;
  2605. _.forEach(tree.neighbors(v), function(w) {
  2606. if (!_.has(visited, w)) {
  2607. nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);
  2608. }
  2609. });
  2610. label.low = low;
  2611. label.lim = nextLim++;
  2612. if (parent) {
  2613. label.parent = parent;
  2614. } else {
  2615. // TODO should be able to remove this when we incrementally update low lim
  2616. delete label.parent;
  2617. }
  2618. return nextLim;
  2619. }
  2620. function leaveEdge(tree) {
  2621. return _.find(tree.edges(), function(e) {
  2622. return tree.edge(e).cutvalue < 0;
  2623. });
  2624. }
  2625. function enterEdge(t, g, edge) {
  2626. var v = edge.v;
  2627. var w = edge.w;
  2628. // For the rest of this function we assume that v is the tail and w is the
  2629. // head, so if we don't have this edge in the graph we should flip it to
  2630. // match the correct orientation.
  2631. if (!g.hasEdge(v, w)) {
  2632. v = edge.w;
  2633. w = edge.v;
  2634. }
  2635. var vLabel = t.node(v);
  2636. var wLabel = t.node(w);
  2637. var tailLabel = vLabel;
  2638. var flip = false;
  2639. // If the root is in the tail of the edge then we need to flip the logic that
  2640. // checks for the head and tail nodes in the candidates function below.
  2641. if (vLabel.lim > wLabel.lim) {
  2642. tailLabel = wLabel;
  2643. flip = true;
  2644. }
  2645. var candidates = _.filter(g.edges(), function(edge) {
  2646. return flip === isDescendant(t, t.node(edge.v), tailLabel) &&
  2647. flip !== isDescendant(t, t.node(edge.w), tailLabel);
  2648. });
  2649. return _.minBy(candidates, function(edge) { return slack(g, edge); });
  2650. }
  2651. function exchangeEdges(t, g, e, f) {
  2652. var v = e.v;
  2653. var w = e.w;
  2654. t.removeEdge(v, w);
  2655. t.setEdge(f.v, f.w, {});
  2656. initLowLimValues(t);
  2657. initCutValues(t, g);
  2658. updateRanks(t, g);
  2659. }
  2660. function updateRanks(t, g) {
  2661. var root = _.find(t.nodes(), function(v) { return !g.node(v).parent; });
  2662. var vs = preorder(t, root);
  2663. vs = vs.slice(1);
  2664. _.forEach(vs, function(v) {
  2665. var parent = t.node(v).parent,
  2666. edge = g.edge(v, parent),
  2667. flipped = false;
  2668. if (!edge) {
  2669. edge = g.edge(parent, v);
  2670. flipped = true;
  2671. }
  2672. g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);
  2673. });
  2674. }
  2675. /*
  2676. * Returns true if the edge is in the tree.
  2677. */
  2678. function isTreeEdge(tree, u, v) {
  2679. return tree.hasEdge(u, v);
  2680. }
  2681. /*
  2682. * Returns true if the specified node is descendant of the root node per the
  2683. * assigned low and lim attributes in the tree.
  2684. */
  2685. function isDescendant(tree, vLabel, rootLabel) {
  2686. return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
  2687. }
  2688. /***/ }),
  2689. /***/ "../../node_modules/dagre/lib/rank/util.js":
  2690. /*!***************************************************************************!*\
  2691. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/rank/util.js ***!
  2692. \***************************************************************************/
  2693. /*! no static exports found */
  2694. /***/ (function(module, exports, __webpack_require__) {
  2695. "use strict";
  2696. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/dagre/lib/lodash.js");
  2697. module.exports = {
  2698. longestPath: longestPath,
  2699. slack: slack
  2700. };
  2701. /*
  2702. * Initializes ranks for the input graph using the longest path algorithm. This
  2703. * algorithm scales well and is fast in practice, it yields rather poor
  2704. * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom
  2705. * ranks wide and leaving edges longer than necessary. However, due to its
  2706. * speed, this algorithm is good for getting an initial ranking that can be fed
  2707. * into other algorithms.
  2708. *
  2709. * This algorithm does not normalize layers because it will be used by other
  2710. * algorithms in most cases. If using this algorithm directly, be sure to
  2711. * run normalize at the end.
  2712. *
  2713. * Pre-conditions:
  2714. *
  2715. * 1. Input graph is a DAG.
  2716. * 2. Input graph node labels can be assigned properties.
  2717. *
  2718. * Post-conditions:
  2719. *
  2720. * 1. Each node will be assign an (unnormalized) "rank" property.
  2721. */
  2722. function longestPath(g) {
  2723. var visited = {};
  2724. function dfs(v) {
  2725. var label = g.node(v);
  2726. if (_.has(visited, v)) {
  2727. return label.rank;
  2728. }
  2729. visited[v] = true;
  2730. var rank = _.min(_.map(g.outEdges(v), function(e) {
  2731. return dfs(e.w) - g.edge(e).minlen;
  2732. }));
  2733. if (rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
  2734. rank === undefined || // return value of _.map([]) for Lodash 4
  2735. rank === null) { // return value of _.map([null])
  2736. rank = 0;
  2737. }
  2738. return (label.rank = rank);
  2739. }
  2740. _.forEach(g.sources(), dfs);
  2741. }
  2742. /*
  2743. * Returns the amount of slack for the given edge. The slack is defined as the
  2744. * difference between the length of the edge and its minimum length.
  2745. */
  2746. function slack(g, e) {
  2747. return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;
  2748. }
  2749. /***/ }),
  2750. /***/ "../../node_modules/dagre/lib/util.js":
  2751. /*!**********************************************************************!*\
  2752. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/util.js ***!
  2753. \**********************************************************************/
  2754. /*! no static exports found */
  2755. /***/ (function(module, exports, __webpack_require__) {
  2756. "use strict";
  2757. /* eslint "no-console": off */
  2758. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/dagre/lib/lodash.js");
  2759. var Graph = __webpack_require__(/*! ./graphlib */ "../../node_modules/dagre/lib/graphlib.js").Graph;
  2760. module.exports = {
  2761. addDummyNode: addDummyNode,
  2762. simplify: simplify,
  2763. asNonCompoundGraph: asNonCompoundGraph,
  2764. successorWeights: successorWeights,
  2765. predecessorWeights: predecessorWeights,
  2766. intersectRect: intersectRect,
  2767. buildLayerMatrix: buildLayerMatrix,
  2768. normalizeRanks: normalizeRanks,
  2769. removeEmptyRanks: removeEmptyRanks,
  2770. addBorderNode: addBorderNode,
  2771. maxRank: maxRank,
  2772. partition: partition,
  2773. time: time,
  2774. notime: notime
  2775. };
  2776. /*
  2777. * Adds a dummy node to the graph and return v.
  2778. */
  2779. function addDummyNode(g, type, attrs, name) {
  2780. var v;
  2781. do {
  2782. v = _.uniqueId(name);
  2783. } while (g.hasNode(v));
  2784. attrs.dummy = type;
  2785. g.setNode(v, attrs);
  2786. return v;
  2787. }
  2788. /*
  2789. * Returns a new graph with only simple edges. Handles aggregation of data
  2790. * associated with multi-edges.
  2791. */
  2792. function simplify(g) {
  2793. var simplified = new Graph().setGraph(g.graph());
  2794. _.forEach(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); });
  2795. _.forEach(g.edges(), function(e) {
  2796. var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 };
  2797. var label = g.edge(e);
  2798. simplified.setEdge(e.v, e.w, {
  2799. weight: simpleLabel.weight + label.weight,
  2800. minlen: Math.max(simpleLabel.minlen, label.minlen)
  2801. });
  2802. });
  2803. return simplified;
  2804. }
  2805. function asNonCompoundGraph(g) {
  2806. var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());
  2807. _.forEach(g.nodes(), function(v) {
  2808. if (!g.children(v).length) {
  2809. simplified.setNode(v, g.node(v));
  2810. }
  2811. });
  2812. _.forEach(g.edges(), function(e) {
  2813. simplified.setEdge(e, g.edge(e));
  2814. });
  2815. return simplified;
  2816. }
  2817. function successorWeights(g) {
  2818. var weightMap = _.map(g.nodes(), function(v) {
  2819. var sucs = {};
  2820. _.forEach(g.outEdges(v), function(e) {
  2821. sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;
  2822. });
  2823. return sucs;
  2824. });
  2825. return _.zipObject(g.nodes(), weightMap);
  2826. }
  2827. function predecessorWeights(g) {
  2828. var weightMap = _.map(g.nodes(), function(v) {
  2829. var preds = {};
  2830. _.forEach(g.inEdges(v), function(e) {
  2831. preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;
  2832. });
  2833. return preds;
  2834. });
  2835. return _.zipObject(g.nodes(), weightMap);
  2836. }
  2837. /*
  2838. * Finds where a line starting at point ({x, y}) would intersect a rectangle
  2839. * ({x, y, width, height}) if it were pointing at the rectangle's center.
  2840. */
  2841. function intersectRect(rect, point) {
  2842. var x = rect.x;
  2843. var y = rect.y;
  2844. // Rectangle intersection algorithm from:
  2845. // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
  2846. var dx = point.x - x;
  2847. var dy = point.y - y;
  2848. var w = rect.width / 2;
  2849. var h = rect.height / 2;
  2850. if (!dx && !dy) {
  2851. throw new Error("Not possible to find intersection inside of the rectangle");
  2852. }
  2853. var sx, sy;
  2854. if (Math.abs(dy) * w > Math.abs(dx) * h) {
  2855. // Intersection is top or bottom of rect.
  2856. if (dy < 0) {
  2857. h = -h;
  2858. }
  2859. sx = h * dx / dy;
  2860. sy = h;
  2861. } else {
  2862. // Intersection is left or right of rect.
  2863. if (dx < 0) {
  2864. w = -w;
  2865. }
  2866. sx = w;
  2867. sy = w * dy / dx;
  2868. }
  2869. return { x: x + sx, y: y + sy };
  2870. }
  2871. /*
  2872. * Given a DAG with each node assigned "rank" and "order" properties, this
  2873. * function will produce a matrix with the ids of each node.
  2874. */
  2875. function buildLayerMatrix(g) {
  2876. var layering = _.map(_.range(maxRank(g) + 1), function() { return []; });
  2877. _.forEach(g.nodes(), function(v) {
  2878. var node = g.node(v);
  2879. var rank = node.rank;
  2880. if (!_.isUndefined(rank)) {
  2881. layering[rank][node.order] = v;
  2882. }
  2883. });
  2884. return layering;
  2885. }
  2886. /*
  2887. * Adjusts the ranks for all nodes in the graph such that all nodes v have
  2888. * rank(v) >= 0 and at least one node w has rank(w) = 0.
  2889. */
  2890. function normalizeRanks(g) {
  2891. var min = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
  2892. _.forEach(g.nodes(), function(v) {
  2893. var node = g.node(v);
  2894. if (_.has(node, "rank")) {
  2895. node.rank -= min;
  2896. }
  2897. });
  2898. }
  2899. function removeEmptyRanks(g) {
  2900. // Ranks may not start at 0, so we need to offset them
  2901. var offset = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
  2902. var layers = [];
  2903. _.forEach(g.nodes(), function(v) {
  2904. var rank = g.node(v).rank - offset;
  2905. if (!layers[rank]) {
  2906. layers[rank] = [];
  2907. }
  2908. layers[rank].push(v);
  2909. });
  2910. var delta = 0;
  2911. var nodeRankFactor = g.graph().nodeRankFactor;
  2912. _.forEach(layers, function(vs, i) {
  2913. if (_.isUndefined(vs) && i % nodeRankFactor !== 0) {
  2914. --delta;
  2915. } else if (delta) {
  2916. _.forEach(vs, function(v) { g.node(v).rank += delta; });
  2917. }
  2918. });
  2919. }
  2920. function addBorderNode(g, prefix, rank, order) {
  2921. var node = {
  2922. width: 0,
  2923. height: 0
  2924. };
  2925. if (arguments.length >= 4) {
  2926. node.rank = rank;
  2927. node.order = order;
  2928. }
  2929. return addDummyNode(g, "border", node, prefix);
  2930. }
  2931. function maxRank(g) {
  2932. return _.max(_.map(g.nodes(), function(v) {
  2933. var rank = g.node(v).rank;
  2934. if (!_.isUndefined(rank)) {
  2935. return rank;
  2936. }
  2937. }));
  2938. }
  2939. /*
  2940. * Partition a collection into two groups: `lhs` and `rhs`. If the supplied
  2941. * function returns true for an entry it goes into `lhs`. Otherwise it goes
  2942. * into `rhs.
  2943. */
  2944. function partition(collection, fn) {
  2945. var result = { lhs: [], rhs: [] };
  2946. _.forEach(collection, function(value) {
  2947. if (fn(value)) {
  2948. result.lhs.push(value);
  2949. } else {
  2950. result.rhs.push(value);
  2951. }
  2952. });
  2953. return result;
  2954. }
  2955. /*
  2956. * Returns a new function that wraps `fn` with a timer. The wrapper logs the
  2957. * time it takes to execute the function.
  2958. */
  2959. function time(name, fn) {
  2960. var start = _.now();
  2961. try {
  2962. return fn();
  2963. } finally {
  2964. console.log(name + " time: " + (_.now() - start) + "ms");
  2965. }
  2966. }
  2967. function notime(name, fn) {
  2968. return fn();
  2969. }
  2970. /***/ }),
  2971. /***/ "../../node_modules/dagre/lib/version.js":
  2972. /*!*************************************************************************!*\
  2973. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/dagre/lib/version.js ***!
  2974. \*************************************************************************/
  2975. /*! no static exports found */
  2976. /***/ (function(module, exports) {
  2977. module.exports = "0.8.5";
  2978. /***/ }),
  2979. /***/ "../../node_modules/graphlib/index.js":
  2980. /*!**********************************************************************!*\
  2981. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/index.js ***!
  2982. \**********************************************************************/
  2983. /*! no static exports found */
  2984. /***/ (function(module, exports, __webpack_require__) {
  2985. /**
  2986. * Copyright (c) 2014, Chris Pettitt
  2987. * All rights reserved.
  2988. *
  2989. * Redistribution and use in source and binary forms, with or without
  2990. * modification, are permitted provided that the following conditions are met:
  2991. *
  2992. * 1. Redistributions of source code must retain the above copyright notice, this
  2993. * list of conditions and the following disclaimer.
  2994. *
  2995. * 2. Redistributions in binary form must reproduce the above copyright notice,
  2996. * this list of conditions and the following disclaimer in the documentation
  2997. * and/or other materials provided with the distribution.
  2998. *
  2999. * 3. Neither the name of the copyright holder nor the names of its contributors
  3000. * may be used to endorse or promote products derived from this software without
  3001. * specific prior written permission.
  3002. *
  3003. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  3004. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  3005. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  3006. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  3007. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3008. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  3009. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  3010. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  3011. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  3012. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3013. */
  3014. var lib = __webpack_require__(/*! ./lib */ "../../node_modules/graphlib/lib/index.js");
  3015. module.exports = {
  3016. Graph: lib.Graph,
  3017. json: __webpack_require__(/*! ./lib/json */ "../../node_modules/graphlib/lib/json.js"),
  3018. alg: __webpack_require__(/*! ./lib/alg */ "../../node_modules/graphlib/lib/alg/index.js"),
  3019. version: lib.version
  3020. };
  3021. /***/ }),
  3022. /***/ "../../node_modules/graphlib/lib/alg/components.js":
  3023. /*!***********************************************************************************!*\
  3024. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/components.js ***!
  3025. \***********************************************************************************/
  3026. /*! no static exports found */
  3027. /***/ (function(module, exports, __webpack_require__) {
  3028. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3029. module.exports = components;
  3030. function components(g) {
  3031. var visited = {};
  3032. var cmpts = [];
  3033. var cmpt;
  3034. function dfs(v) {
  3035. if (_.has(visited, v)) return;
  3036. visited[v] = true;
  3037. cmpt.push(v);
  3038. _.each(g.successors(v), dfs);
  3039. _.each(g.predecessors(v), dfs);
  3040. }
  3041. _.each(g.nodes(), function(v) {
  3042. cmpt = [];
  3043. dfs(v);
  3044. if (cmpt.length) {
  3045. cmpts.push(cmpt);
  3046. }
  3047. });
  3048. return cmpts;
  3049. }
  3050. /***/ }),
  3051. /***/ "../../node_modules/graphlib/lib/alg/dfs.js":
  3052. /*!****************************************************************************!*\
  3053. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/dfs.js ***!
  3054. \****************************************************************************/
  3055. /*! no static exports found */
  3056. /***/ (function(module, exports, __webpack_require__) {
  3057. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3058. module.exports = dfs;
  3059. /*
  3060. * A helper that preforms a pre- or post-order traversal on the input graph
  3061. * and returns the nodes in the order they were visited. If the graph is
  3062. * undirected then this algorithm will navigate using neighbors. If the graph
  3063. * is directed then this algorithm will navigate using successors.
  3064. *
  3065. * Order must be one of "pre" or "post".
  3066. */
  3067. function dfs(g, vs, order) {
  3068. if (!_.isArray(vs)) {
  3069. vs = [vs];
  3070. }
  3071. var navigation = (g.isDirected() ? g.successors : g.neighbors).bind(g);
  3072. var acc = [];
  3073. var visited = {};
  3074. _.each(vs, function(v) {
  3075. if (!g.hasNode(v)) {
  3076. throw new Error("Graph does not have node: " + v);
  3077. }
  3078. doDfs(g, v, order === "post", visited, navigation, acc);
  3079. });
  3080. return acc;
  3081. }
  3082. function doDfs(g, v, postorder, visited, navigation, acc) {
  3083. if (!_.has(visited, v)) {
  3084. visited[v] = true;
  3085. if (!postorder) { acc.push(v); }
  3086. _.each(navigation(v), function(w) {
  3087. doDfs(g, w, postorder, visited, navigation, acc);
  3088. });
  3089. if (postorder) { acc.push(v); }
  3090. }
  3091. }
  3092. /***/ }),
  3093. /***/ "../../node_modules/graphlib/lib/alg/dijkstra-all.js":
  3094. /*!*************************************************************************************!*\
  3095. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/dijkstra-all.js ***!
  3096. \*************************************************************************************/
  3097. /*! no static exports found */
  3098. /***/ (function(module, exports, __webpack_require__) {
  3099. var dijkstra = __webpack_require__(/*! ./dijkstra */ "../../node_modules/graphlib/lib/alg/dijkstra.js");
  3100. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3101. module.exports = dijkstraAll;
  3102. function dijkstraAll(g, weightFunc, edgeFunc) {
  3103. return _.transform(g.nodes(), function(acc, v) {
  3104. acc[v] = dijkstra(g, v, weightFunc, edgeFunc);
  3105. }, {});
  3106. }
  3107. /***/ }),
  3108. /***/ "../../node_modules/graphlib/lib/alg/dijkstra.js":
  3109. /*!*********************************************************************************!*\
  3110. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/dijkstra.js ***!
  3111. \*********************************************************************************/
  3112. /*! no static exports found */
  3113. /***/ (function(module, exports, __webpack_require__) {
  3114. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3115. var PriorityQueue = __webpack_require__(/*! ../data/priority-queue */ "../../node_modules/graphlib/lib/data/priority-queue.js");
  3116. module.exports = dijkstra;
  3117. var DEFAULT_WEIGHT_FUNC = _.constant(1);
  3118. function dijkstra(g, source, weightFn, edgeFn) {
  3119. return runDijkstra(g, String(source),
  3120. weightFn || DEFAULT_WEIGHT_FUNC,
  3121. edgeFn || function(v) { return g.outEdges(v); });
  3122. }
  3123. function runDijkstra(g, source, weightFn, edgeFn) {
  3124. var results = {};
  3125. var pq = new PriorityQueue();
  3126. var v, vEntry;
  3127. var updateNeighbors = function(edge) {
  3128. var w = edge.v !== v ? edge.v : edge.w;
  3129. var wEntry = results[w];
  3130. var weight = weightFn(edge);
  3131. var distance = vEntry.distance + weight;
  3132. if (weight < 0) {
  3133. throw new Error("dijkstra does not allow negative edge weights. " +
  3134. "Bad edge: " + edge + " Weight: " + weight);
  3135. }
  3136. if (distance < wEntry.distance) {
  3137. wEntry.distance = distance;
  3138. wEntry.predecessor = v;
  3139. pq.decrease(w, distance);
  3140. }
  3141. };
  3142. g.nodes().forEach(function(v) {
  3143. var distance = v === source ? 0 : Number.POSITIVE_INFINITY;
  3144. results[v] = { distance: distance };
  3145. pq.add(v, distance);
  3146. });
  3147. while (pq.size() > 0) {
  3148. v = pq.removeMin();
  3149. vEntry = results[v];
  3150. if (vEntry.distance === Number.POSITIVE_INFINITY) {
  3151. break;
  3152. }
  3153. edgeFn(v).forEach(updateNeighbors);
  3154. }
  3155. return results;
  3156. }
  3157. /***/ }),
  3158. /***/ "../../node_modules/graphlib/lib/alg/find-cycles.js":
  3159. /*!************************************************************************************!*\
  3160. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/find-cycles.js ***!
  3161. \************************************************************************************/
  3162. /*! no static exports found */
  3163. /***/ (function(module, exports, __webpack_require__) {
  3164. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3165. var tarjan = __webpack_require__(/*! ./tarjan */ "../../node_modules/graphlib/lib/alg/tarjan.js");
  3166. module.exports = findCycles;
  3167. function findCycles(g) {
  3168. return _.filter(tarjan(g), function(cmpt) {
  3169. return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));
  3170. });
  3171. }
  3172. /***/ }),
  3173. /***/ "../../node_modules/graphlib/lib/alg/floyd-warshall.js":
  3174. /*!***************************************************************************************!*\
  3175. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/floyd-warshall.js ***!
  3176. \***************************************************************************************/
  3177. /*! no static exports found */
  3178. /***/ (function(module, exports, __webpack_require__) {
  3179. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3180. module.exports = floydWarshall;
  3181. var DEFAULT_WEIGHT_FUNC = _.constant(1);
  3182. function floydWarshall(g, weightFn, edgeFn) {
  3183. return runFloydWarshall(g,
  3184. weightFn || DEFAULT_WEIGHT_FUNC,
  3185. edgeFn || function(v) { return g.outEdges(v); });
  3186. }
  3187. function runFloydWarshall(g, weightFn, edgeFn) {
  3188. var results = {};
  3189. var nodes = g.nodes();
  3190. nodes.forEach(function(v) {
  3191. results[v] = {};
  3192. results[v][v] = { distance: 0 };
  3193. nodes.forEach(function(w) {
  3194. if (v !== w) {
  3195. results[v][w] = { distance: Number.POSITIVE_INFINITY };
  3196. }
  3197. });
  3198. edgeFn(v).forEach(function(edge) {
  3199. var w = edge.v === v ? edge.w : edge.v;
  3200. var d = weightFn(edge);
  3201. results[v][w] = { distance: d, predecessor: v };
  3202. });
  3203. });
  3204. nodes.forEach(function(k) {
  3205. var rowK = results[k];
  3206. nodes.forEach(function(i) {
  3207. var rowI = results[i];
  3208. nodes.forEach(function(j) {
  3209. var ik = rowI[k];
  3210. var kj = rowK[j];
  3211. var ij = rowI[j];
  3212. var altDistance = ik.distance + kj.distance;
  3213. if (altDistance < ij.distance) {
  3214. ij.distance = altDistance;
  3215. ij.predecessor = kj.predecessor;
  3216. }
  3217. });
  3218. });
  3219. });
  3220. return results;
  3221. }
  3222. /***/ }),
  3223. /***/ "../../node_modules/graphlib/lib/alg/index.js":
  3224. /*!******************************************************************************!*\
  3225. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/index.js ***!
  3226. \******************************************************************************/
  3227. /*! no static exports found */
  3228. /***/ (function(module, exports, __webpack_require__) {
  3229. module.exports = {
  3230. components: __webpack_require__(/*! ./components */ "../../node_modules/graphlib/lib/alg/components.js"),
  3231. dijkstra: __webpack_require__(/*! ./dijkstra */ "../../node_modules/graphlib/lib/alg/dijkstra.js"),
  3232. dijkstraAll: __webpack_require__(/*! ./dijkstra-all */ "../../node_modules/graphlib/lib/alg/dijkstra-all.js"),
  3233. findCycles: __webpack_require__(/*! ./find-cycles */ "../../node_modules/graphlib/lib/alg/find-cycles.js"),
  3234. floydWarshall: __webpack_require__(/*! ./floyd-warshall */ "../../node_modules/graphlib/lib/alg/floyd-warshall.js"),
  3235. isAcyclic: __webpack_require__(/*! ./is-acyclic */ "../../node_modules/graphlib/lib/alg/is-acyclic.js"),
  3236. postorder: __webpack_require__(/*! ./postorder */ "../../node_modules/graphlib/lib/alg/postorder.js"),
  3237. preorder: __webpack_require__(/*! ./preorder */ "../../node_modules/graphlib/lib/alg/preorder.js"),
  3238. prim: __webpack_require__(/*! ./prim */ "../../node_modules/graphlib/lib/alg/prim.js"),
  3239. tarjan: __webpack_require__(/*! ./tarjan */ "../../node_modules/graphlib/lib/alg/tarjan.js"),
  3240. topsort: __webpack_require__(/*! ./topsort */ "../../node_modules/graphlib/lib/alg/topsort.js")
  3241. };
  3242. /***/ }),
  3243. /***/ "../../node_modules/graphlib/lib/alg/is-acyclic.js":
  3244. /*!***********************************************************************************!*\
  3245. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/is-acyclic.js ***!
  3246. \***********************************************************************************/
  3247. /*! no static exports found */
  3248. /***/ (function(module, exports, __webpack_require__) {
  3249. var topsort = __webpack_require__(/*! ./topsort */ "../../node_modules/graphlib/lib/alg/topsort.js");
  3250. module.exports = isAcyclic;
  3251. function isAcyclic(g) {
  3252. try {
  3253. topsort(g);
  3254. } catch (e) {
  3255. if (e instanceof topsort.CycleException) {
  3256. return false;
  3257. }
  3258. throw e;
  3259. }
  3260. return true;
  3261. }
  3262. /***/ }),
  3263. /***/ "../../node_modules/graphlib/lib/alg/postorder.js":
  3264. /*!**********************************************************************************!*\
  3265. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/postorder.js ***!
  3266. \**********************************************************************************/
  3267. /*! no static exports found */
  3268. /***/ (function(module, exports, __webpack_require__) {
  3269. var dfs = __webpack_require__(/*! ./dfs */ "../../node_modules/graphlib/lib/alg/dfs.js");
  3270. module.exports = postorder;
  3271. function postorder(g, vs) {
  3272. return dfs(g, vs, "post");
  3273. }
  3274. /***/ }),
  3275. /***/ "../../node_modules/graphlib/lib/alg/preorder.js":
  3276. /*!*********************************************************************************!*\
  3277. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/preorder.js ***!
  3278. \*********************************************************************************/
  3279. /*! no static exports found */
  3280. /***/ (function(module, exports, __webpack_require__) {
  3281. var dfs = __webpack_require__(/*! ./dfs */ "../../node_modules/graphlib/lib/alg/dfs.js");
  3282. module.exports = preorder;
  3283. function preorder(g, vs) {
  3284. return dfs(g, vs, "pre");
  3285. }
  3286. /***/ }),
  3287. /***/ "../../node_modules/graphlib/lib/alg/prim.js":
  3288. /*!*****************************************************************************!*\
  3289. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/prim.js ***!
  3290. \*****************************************************************************/
  3291. /*! no static exports found */
  3292. /***/ (function(module, exports, __webpack_require__) {
  3293. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3294. var Graph = __webpack_require__(/*! ../graph */ "../../node_modules/graphlib/lib/graph.js");
  3295. var PriorityQueue = __webpack_require__(/*! ../data/priority-queue */ "../../node_modules/graphlib/lib/data/priority-queue.js");
  3296. module.exports = prim;
  3297. function prim(g, weightFunc) {
  3298. var result = new Graph();
  3299. var parents = {};
  3300. var pq = new PriorityQueue();
  3301. var v;
  3302. function updateNeighbors(edge) {
  3303. var w = edge.v === v ? edge.w : edge.v;
  3304. var pri = pq.priority(w);
  3305. if (pri !== undefined) {
  3306. var edgeWeight = weightFunc(edge);
  3307. if (edgeWeight < pri) {
  3308. parents[w] = v;
  3309. pq.decrease(w, edgeWeight);
  3310. }
  3311. }
  3312. }
  3313. if (g.nodeCount() === 0) {
  3314. return result;
  3315. }
  3316. _.each(g.nodes(), function(v) {
  3317. pq.add(v, Number.POSITIVE_INFINITY);
  3318. result.setNode(v);
  3319. });
  3320. // Start from an arbitrary node
  3321. pq.decrease(g.nodes()[0], 0);
  3322. var init = false;
  3323. while (pq.size() > 0) {
  3324. v = pq.removeMin();
  3325. if (_.has(parents, v)) {
  3326. result.setEdge(v, parents[v]);
  3327. } else if (init) {
  3328. throw new Error("Input graph is not connected: " + g);
  3329. } else {
  3330. init = true;
  3331. }
  3332. g.nodeEdges(v).forEach(updateNeighbors);
  3333. }
  3334. return result;
  3335. }
  3336. /***/ }),
  3337. /***/ "../../node_modules/graphlib/lib/alg/tarjan.js":
  3338. /*!*******************************************************************************!*\
  3339. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/tarjan.js ***!
  3340. \*******************************************************************************/
  3341. /*! no static exports found */
  3342. /***/ (function(module, exports, __webpack_require__) {
  3343. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3344. module.exports = tarjan;
  3345. function tarjan(g) {
  3346. var index = 0;
  3347. var stack = [];
  3348. var visited = {}; // node id -> { onStack, lowlink, index }
  3349. var results = [];
  3350. function dfs(v) {
  3351. var entry = visited[v] = {
  3352. onStack: true,
  3353. lowlink: index,
  3354. index: index++
  3355. };
  3356. stack.push(v);
  3357. g.successors(v).forEach(function(w) {
  3358. if (!_.has(visited, w)) {
  3359. dfs(w);
  3360. entry.lowlink = Math.min(entry.lowlink, visited[w].lowlink);
  3361. } else if (visited[w].onStack) {
  3362. entry.lowlink = Math.min(entry.lowlink, visited[w].index);
  3363. }
  3364. });
  3365. if (entry.lowlink === entry.index) {
  3366. var cmpt = [];
  3367. var w;
  3368. do {
  3369. w = stack.pop();
  3370. visited[w].onStack = false;
  3371. cmpt.push(w);
  3372. } while (v !== w);
  3373. results.push(cmpt);
  3374. }
  3375. }
  3376. g.nodes().forEach(function(v) {
  3377. if (!_.has(visited, v)) {
  3378. dfs(v);
  3379. }
  3380. });
  3381. return results;
  3382. }
  3383. /***/ }),
  3384. /***/ "../../node_modules/graphlib/lib/alg/topsort.js":
  3385. /*!********************************************************************************!*\
  3386. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/alg/topsort.js ***!
  3387. \********************************************************************************/
  3388. /*! no static exports found */
  3389. /***/ (function(module, exports, __webpack_require__) {
  3390. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3391. module.exports = topsort;
  3392. topsort.CycleException = CycleException;
  3393. function topsort(g) {
  3394. var visited = {};
  3395. var stack = {};
  3396. var results = [];
  3397. function visit(node) {
  3398. if (_.has(stack, node)) {
  3399. throw new CycleException();
  3400. }
  3401. if (!_.has(visited, node)) {
  3402. stack[node] = true;
  3403. visited[node] = true;
  3404. _.each(g.predecessors(node), visit);
  3405. delete stack[node];
  3406. results.push(node);
  3407. }
  3408. }
  3409. _.each(g.sinks(), visit);
  3410. if (_.size(visited) !== g.nodeCount()) {
  3411. throw new CycleException();
  3412. }
  3413. return results;
  3414. }
  3415. function CycleException() {}
  3416. CycleException.prototype = new Error(); // must be an instance of Error to pass testing
  3417. /***/ }),
  3418. /***/ "../../node_modules/graphlib/lib/data/priority-queue.js":
  3419. /*!****************************************************************************************!*\
  3420. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/data/priority-queue.js ***!
  3421. \****************************************************************************************/
  3422. /*! no static exports found */
  3423. /***/ (function(module, exports, __webpack_require__) {
  3424. var _ = __webpack_require__(/*! ../lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3425. module.exports = PriorityQueue;
  3426. /**
  3427. * A min-priority queue data structure. This algorithm is derived from Cormen,
  3428. * et al., "Introduction to Algorithms". The basic idea of a min-priority
  3429. * queue is that you can efficiently (in O(1) time) get the smallest key in
  3430. * the queue. Adding and removing elements takes O(log n) time. A key can
  3431. * have its priority decreased in O(log n) time.
  3432. */
  3433. function PriorityQueue() {
  3434. this._arr = [];
  3435. this._keyIndices = {};
  3436. }
  3437. /**
  3438. * Returns the number of elements in the queue. Takes `O(1)` time.
  3439. */
  3440. PriorityQueue.prototype.size = function() {
  3441. return this._arr.length;
  3442. };
  3443. /**
  3444. * Returns the keys that are in the queue. Takes `O(n)` time.
  3445. */
  3446. PriorityQueue.prototype.keys = function() {
  3447. return this._arr.map(function(x) { return x.key; });
  3448. };
  3449. /**
  3450. * Returns `true` if **key** is in the queue and `false` if not.
  3451. */
  3452. PriorityQueue.prototype.has = function(key) {
  3453. return _.has(this._keyIndices, key);
  3454. };
  3455. /**
  3456. * Returns the priority for **key**. If **key** is not present in the queue
  3457. * then this function returns `undefined`. Takes `O(1)` time.
  3458. *
  3459. * @param {Object} key
  3460. */
  3461. PriorityQueue.prototype.priority = function(key) {
  3462. var index = this._keyIndices[key];
  3463. if (index !== undefined) {
  3464. return this._arr[index].priority;
  3465. }
  3466. };
  3467. /**
  3468. * Returns the key for the minimum element in this queue. If the queue is
  3469. * empty this function throws an Error. Takes `O(1)` time.
  3470. */
  3471. PriorityQueue.prototype.min = function() {
  3472. if (this.size() === 0) {
  3473. throw new Error("Queue underflow");
  3474. }
  3475. return this._arr[0].key;
  3476. };
  3477. /**
  3478. * Inserts a new key into the priority queue. If the key already exists in
  3479. * the queue this function returns `false`; otherwise it will return `true`.
  3480. * Takes `O(n)` time.
  3481. *
  3482. * @param {Object} key the key to add
  3483. * @param {Number} priority the initial priority for the key
  3484. */
  3485. PriorityQueue.prototype.add = function(key, priority) {
  3486. var keyIndices = this._keyIndices;
  3487. key = String(key);
  3488. if (!_.has(keyIndices, key)) {
  3489. var arr = this._arr;
  3490. var index = arr.length;
  3491. keyIndices[key] = index;
  3492. arr.push({key: key, priority: priority});
  3493. this._decrease(index);
  3494. return true;
  3495. }
  3496. return false;
  3497. };
  3498. /**
  3499. * Removes and returns the smallest key in the queue. Takes `O(log n)` time.
  3500. */
  3501. PriorityQueue.prototype.removeMin = function() {
  3502. this._swap(0, this._arr.length - 1);
  3503. var min = this._arr.pop();
  3504. delete this._keyIndices[min.key];
  3505. this._heapify(0);
  3506. return min.key;
  3507. };
  3508. /**
  3509. * Decreases the priority for **key** to **priority**. If the new priority is
  3510. * greater than the previous priority, this function will throw an Error.
  3511. *
  3512. * @param {Object} key the key for which to raise priority
  3513. * @param {Number} priority the new priority for the key
  3514. */
  3515. PriorityQueue.prototype.decrease = function(key, priority) {
  3516. var index = this._keyIndices[key];
  3517. if (priority > this._arr[index].priority) {
  3518. throw new Error("New priority is greater than current priority. " +
  3519. "Key: " + key + " Old: " + this._arr[index].priority + " New: " + priority);
  3520. }
  3521. this._arr[index].priority = priority;
  3522. this._decrease(index);
  3523. };
  3524. PriorityQueue.prototype._heapify = function(i) {
  3525. var arr = this._arr;
  3526. var l = 2 * i;
  3527. var r = l + 1;
  3528. var largest = i;
  3529. if (l < arr.length) {
  3530. largest = arr[l].priority < arr[largest].priority ? l : largest;
  3531. if (r < arr.length) {
  3532. largest = arr[r].priority < arr[largest].priority ? r : largest;
  3533. }
  3534. if (largest !== i) {
  3535. this._swap(i, largest);
  3536. this._heapify(largest);
  3537. }
  3538. }
  3539. };
  3540. PriorityQueue.prototype._decrease = function(index) {
  3541. var arr = this._arr;
  3542. var priority = arr[index].priority;
  3543. var parent;
  3544. while (index !== 0) {
  3545. parent = index >> 1;
  3546. if (arr[parent].priority < priority) {
  3547. break;
  3548. }
  3549. this._swap(index, parent);
  3550. index = parent;
  3551. }
  3552. };
  3553. PriorityQueue.prototype._swap = function(i, j) {
  3554. var arr = this._arr;
  3555. var keyIndices = this._keyIndices;
  3556. var origArrI = arr[i];
  3557. var origArrJ = arr[j];
  3558. arr[i] = origArrJ;
  3559. arr[j] = origArrI;
  3560. keyIndices[origArrJ.key] = i;
  3561. keyIndices[origArrI.key] = j;
  3562. };
  3563. /***/ }),
  3564. /***/ "../../node_modules/graphlib/lib/graph.js":
  3565. /*!**************************************************************************!*\
  3566. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/graph.js ***!
  3567. \**************************************************************************/
  3568. /*! no static exports found */
  3569. /***/ (function(module, exports, __webpack_require__) {
  3570. "use strict";
  3571. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/graphlib/lib/lodash.js");
  3572. module.exports = Graph;
  3573. var DEFAULT_EDGE_NAME = "\x00";
  3574. var GRAPH_NODE = "\x00";
  3575. var EDGE_KEY_DELIM = "\x01";
  3576. // Implementation notes:
  3577. //
  3578. // * Node id query functions should return string ids for the nodes
  3579. // * Edge id query functions should return an "edgeObj", edge object, that is
  3580. // composed of enough information to uniquely identify an edge: {v, w, name}.
  3581. // * Internally we use an "edgeId", a stringified form of the edgeObj, to
  3582. // reference edges. This is because we need a performant way to look these
  3583. // edges up and, object properties, which have string keys, are the closest
  3584. // we're going to get to a performant hashtable in JavaScript.
  3585. function Graph(opts) {
  3586. this._isDirected = _.has(opts, "directed") ? opts.directed : true;
  3587. this._isMultigraph = _.has(opts, "multigraph") ? opts.multigraph : false;
  3588. this._isCompound = _.has(opts, "compound") ? opts.compound : false;
  3589. // Label for the graph itself
  3590. this._label = undefined;
  3591. // Defaults to be set when creating a new node
  3592. this._defaultNodeLabelFn = _.constant(undefined);
  3593. // Defaults to be set when creating a new edge
  3594. this._defaultEdgeLabelFn = _.constant(undefined);
  3595. // v -> label
  3596. this._nodes = {};
  3597. if (this._isCompound) {
  3598. // v -> parent
  3599. this._parent = {};
  3600. // v -> children
  3601. this._children = {};
  3602. this._children[GRAPH_NODE] = {};
  3603. }
  3604. // v -> edgeObj
  3605. this._in = {};
  3606. // u -> v -> Number
  3607. this._preds = {};
  3608. // v -> edgeObj
  3609. this._out = {};
  3610. // v -> w -> Number
  3611. this._sucs = {};
  3612. // e -> edgeObj
  3613. this._edgeObjs = {};
  3614. // e -> label
  3615. this._edgeLabels = {};
  3616. }
  3617. /* Number of nodes in the graph. Should only be changed by the implementation. */
  3618. Graph.prototype._nodeCount = 0;
  3619. /* Number of edges in the graph. Should only be changed by the implementation. */
  3620. Graph.prototype._edgeCount = 0;
  3621. /* === Graph functions ========= */
  3622. Graph.prototype.isDirected = function() {
  3623. return this._isDirected;
  3624. };
  3625. Graph.prototype.isMultigraph = function() {
  3626. return this._isMultigraph;
  3627. };
  3628. Graph.prototype.isCompound = function() {
  3629. return this._isCompound;
  3630. };
  3631. Graph.prototype.setGraph = function(label) {
  3632. this._label = label;
  3633. return this;
  3634. };
  3635. Graph.prototype.graph = function() {
  3636. return this._label;
  3637. };
  3638. /* === Node functions ========== */
  3639. Graph.prototype.setDefaultNodeLabel = function(newDefault) {
  3640. if (!_.isFunction(newDefault)) {
  3641. newDefault = _.constant(newDefault);
  3642. }
  3643. this._defaultNodeLabelFn = newDefault;
  3644. return this;
  3645. };
  3646. Graph.prototype.nodeCount = function() {
  3647. return this._nodeCount;
  3648. };
  3649. Graph.prototype.nodes = function() {
  3650. return _.keys(this._nodes);
  3651. };
  3652. Graph.prototype.sources = function() {
  3653. var self = this;
  3654. return _.filter(this.nodes(), function(v) {
  3655. return _.isEmpty(self._in[v]);
  3656. });
  3657. };
  3658. Graph.prototype.sinks = function() {
  3659. var self = this;
  3660. return _.filter(this.nodes(), function(v) {
  3661. return _.isEmpty(self._out[v]);
  3662. });
  3663. };
  3664. Graph.prototype.setNodes = function(vs, value) {
  3665. var args = arguments;
  3666. var self = this;
  3667. _.each(vs, function(v) {
  3668. if (args.length > 1) {
  3669. self.setNode(v, value);
  3670. } else {
  3671. self.setNode(v);
  3672. }
  3673. });
  3674. return this;
  3675. };
  3676. Graph.prototype.setNode = function(v, value) {
  3677. if (_.has(this._nodes, v)) {
  3678. if (arguments.length > 1) {
  3679. this._nodes[v] = value;
  3680. }
  3681. return this;
  3682. }
  3683. this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
  3684. if (this._isCompound) {
  3685. this._parent[v] = GRAPH_NODE;
  3686. this._children[v] = {};
  3687. this._children[GRAPH_NODE][v] = true;
  3688. }
  3689. this._in[v] = {};
  3690. this._preds[v] = {};
  3691. this._out[v] = {};
  3692. this._sucs[v] = {};
  3693. ++this._nodeCount;
  3694. return this;
  3695. };
  3696. Graph.prototype.node = function(v) {
  3697. return this._nodes[v];
  3698. };
  3699. Graph.prototype.hasNode = function(v) {
  3700. return _.has(this._nodes, v);
  3701. };
  3702. Graph.prototype.removeNode = function(v) {
  3703. var self = this;
  3704. if (_.has(this._nodes, v)) {
  3705. var removeEdge = function(e) { self.removeEdge(self._edgeObjs[e]); };
  3706. delete this._nodes[v];
  3707. if (this._isCompound) {
  3708. this._removeFromParentsChildList(v);
  3709. delete this._parent[v];
  3710. _.each(this.children(v), function(child) {
  3711. self.setParent(child);
  3712. });
  3713. delete this._children[v];
  3714. }
  3715. _.each(_.keys(this._in[v]), removeEdge);
  3716. delete this._in[v];
  3717. delete this._preds[v];
  3718. _.each(_.keys(this._out[v]), removeEdge);
  3719. delete this._out[v];
  3720. delete this._sucs[v];
  3721. --this._nodeCount;
  3722. }
  3723. return this;
  3724. };
  3725. Graph.prototype.setParent = function(v, parent) {
  3726. if (!this._isCompound) {
  3727. throw new Error("Cannot set parent in a non-compound graph");
  3728. }
  3729. if (_.isUndefined(parent)) {
  3730. parent = GRAPH_NODE;
  3731. } else {
  3732. // Coerce parent to string
  3733. parent += "";
  3734. for (var ancestor = parent;
  3735. !_.isUndefined(ancestor);
  3736. ancestor = this.parent(ancestor)) {
  3737. if (ancestor === v) {
  3738. throw new Error("Setting " + parent+ " as parent of " + v +
  3739. " would create a cycle");
  3740. }
  3741. }
  3742. this.setNode(parent);
  3743. }
  3744. this.setNode(v);
  3745. this._removeFromParentsChildList(v);
  3746. this._parent[v] = parent;
  3747. this._children[parent][v] = true;
  3748. return this;
  3749. };
  3750. Graph.prototype._removeFromParentsChildList = function(v) {
  3751. delete this._children[this._parent[v]][v];
  3752. };
  3753. Graph.prototype.parent = function(v) {
  3754. if (this._isCompound) {
  3755. var parent = this._parent[v];
  3756. if (parent !== GRAPH_NODE) {
  3757. return parent;
  3758. }
  3759. }
  3760. };
  3761. Graph.prototype.children = function(v) {
  3762. if (_.isUndefined(v)) {
  3763. v = GRAPH_NODE;
  3764. }
  3765. if (this._isCompound) {
  3766. var children = this._children[v];
  3767. if (children) {
  3768. return _.keys(children);
  3769. }
  3770. } else if (v === GRAPH_NODE) {
  3771. return this.nodes();
  3772. } else if (this.hasNode(v)) {
  3773. return [];
  3774. }
  3775. };
  3776. Graph.prototype.predecessors = function(v) {
  3777. var predsV = this._preds[v];
  3778. if (predsV) {
  3779. return _.keys(predsV);
  3780. }
  3781. };
  3782. Graph.prototype.successors = function(v) {
  3783. var sucsV = this._sucs[v];
  3784. if (sucsV) {
  3785. return _.keys(sucsV);
  3786. }
  3787. };
  3788. Graph.prototype.neighbors = function(v) {
  3789. var preds = this.predecessors(v);
  3790. if (preds) {
  3791. return _.union(preds, this.successors(v));
  3792. }
  3793. };
  3794. Graph.prototype.isLeaf = function (v) {
  3795. var neighbors;
  3796. if (this.isDirected()) {
  3797. neighbors = this.successors(v);
  3798. } else {
  3799. neighbors = this.neighbors(v);
  3800. }
  3801. return neighbors.length === 0;
  3802. };
  3803. Graph.prototype.filterNodes = function(filter) {
  3804. var copy = new this.constructor({
  3805. directed: this._isDirected,
  3806. multigraph: this._isMultigraph,
  3807. compound: this._isCompound
  3808. });
  3809. copy.setGraph(this.graph());
  3810. var self = this;
  3811. _.each(this._nodes, function(value, v) {
  3812. if (filter(v)) {
  3813. copy.setNode(v, value);
  3814. }
  3815. });
  3816. _.each(this._edgeObjs, function(e) {
  3817. if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
  3818. copy.setEdge(e, self.edge(e));
  3819. }
  3820. });
  3821. var parents = {};
  3822. function findParent(v) {
  3823. var parent = self.parent(v);
  3824. if (parent === undefined || copy.hasNode(parent)) {
  3825. parents[v] = parent;
  3826. return parent;
  3827. } else if (parent in parents) {
  3828. return parents[parent];
  3829. } else {
  3830. return findParent(parent);
  3831. }
  3832. }
  3833. if (this._isCompound) {
  3834. _.each(copy.nodes(), function(v) {
  3835. copy.setParent(v, findParent(v));
  3836. });
  3837. }
  3838. return copy;
  3839. };
  3840. /* === Edge functions ========== */
  3841. Graph.prototype.setDefaultEdgeLabel = function(newDefault) {
  3842. if (!_.isFunction(newDefault)) {
  3843. newDefault = _.constant(newDefault);
  3844. }
  3845. this._defaultEdgeLabelFn = newDefault;
  3846. return this;
  3847. };
  3848. Graph.prototype.edgeCount = function() {
  3849. return this._edgeCount;
  3850. };
  3851. Graph.prototype.edges = function() {
  3852. return _.values(this._edgeObjs);
  3853. };
  3854. Graph.prototype.setPath = function(vs, value) {
  3855. var self = this;
  3856. var args = arguments;
  3857. _.reduce(vs, function(v, w) {
  3858. if (args.length > 1) {
  3859. self.setEdge(v, w, value);
  3860. } else {
  3861. self.setEdge(v, w);
  3862. }
  3863. return w;
  3864. });
  3865. return this;
  3866. };
  3867. /*
  3868. * setEdge(v, w, [value, [name]])
  3869. * setEdge({ v, w, [name] }, [value])
  3870. */
  3871. Graph.prototype.setEdge = function() {
  3872. var v, w, name, value;
  3873. var valueSpecified = false;
  3874. var arg0 = arguments[0];
  3875. if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) {
  3876. v = arg0.v;
  3877. w = arg0.w;
  3878. name = arg0.name;
  3879. if (arguments.length === 2) {
  3880. value = arguments[1];
  3881. valueSpecified = true;
  3882. }
  3883. } else {
  3884. v = arg0;
  3885. w = arguments[1];
  3886. name = arguments[3];
  3887. if (arguments.length > 2) {
  3888. value = arguments[2];
  3889. valueSpecified = true;
  3890. }
  3891. }
  3892. v = "" + v;
  3893. w = "" + w;
  3894. if (!_.isUndefined(name)) {
  3895. name = "" + name;
  3896. }
  3897. var e = edgeArgsToId(this._isDirected, v, w, name);
  3898. if (_.has(this._edgeLabels, e)) {
  3899. if (valueSpecified) {
  3900. this._edgeLabels[e] = value;
  3901. }
  3902. return this;
  3903. }
  3904. if (!_.isUndefined(name) && !this._isMultigraph) {
  3905. throw new Error("Cannot set a named edge when isMultigraph = false");
  3906. }
  3907. // It didn't exist, so we need to create it.
  3908. // First ensure the nodes exist.
  3909. this.setNode(v);
  3910. this.setNode(w);
  3911. this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
  3912. var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
  3913. // Ensure we add undirected edges in a consistent way.
  3914. v = edgeObj.v;
  3915. w = edgeObj.w;
  3916. Object.freeze(edgeObj);
  3917. this._edgeObjs[e] = edgeObj;
  3918. incrementOrInitEntry(this._preds[w], v);
  3919. incrementOrInitEntry(this._sucs[v], w);
  3920. this._in[w][e] = edgeObj;
  3921. this._out[v][e] = edgeObj;
  3922. this._edgeCount++;
  3923. return this;
  3924. };
  3925. Graph.prototype.edge = function(v, w, name) {
  3926. var e = (arguments.length === 1
  3927. ? edgeObjToId(this._isDirected, arguments[0])
  3928. : edgeArgsToId(this._isDirected, v, w, name));
  3929. return this._edgeLabels[e];
  3930. };
  3931. Graph.prototype.hasEdge = function(v, w, name) {
  3932. var e = (arguments.length === 1
  3933. ? edgeObjToId(this._isDirected, arguments[0])
  3934. : edgeArgsToId(this._isDirected, v, w, name));
  3935. return _.has(this._edgeLabels, e);
  3936. };
  3937. Graph.prototype.removeEdge = function(v, w, name) {
  3938. var e = (arguments.length === 1
  3939. ? edgeObjToId(this._isDirected, arguments[0])
  3940. : edgeArgsToId(this._isDirected, v, w, name));
  3941. var edge = this._edgeObjs[e];
  3942. if (edge) {
  3943. v = edge.v;
  3944. w = edge.w;
  3945. delete this._edgeLabels[e];
  3946. delete this._edgeObjs[e];
  3947. decrementOrRemoveEntry(this._preds[w], v);
  3948. decrementOrRemoveEntry(this._sucs[v], w);
  3949. delete this._in[w][e];
  3950. delete this._out[v][e];
  3951. this._edgeCount--;
  3952. }
  3953. return this;
  3954. };
  3955. Graph.prototype.inEdges = function(v, u) {
  3956. var inV = this._in[v];
  3957. if (inV) {
  3958. var edges = _.values(inV);
  3959. if (!u) {
  3960. return edges;
  3961. }
  3962. return _.filter(edges, function(edge) { return edge.v === u; });
  3963. }
  3964. };
  3965. Graph.prototype.outEdges = function(v, w) {
  3966. var outV = this._out[v];
  3967. if (outV) {
  3968. var edges = _.values(outV);
  3969. if (!w) {
  3970. return edges;
  3971. }
  3972. return _.filter(edges, function(edge) { return edge.w === w; });
  3973. }
  3974. };
  3975. Graph.prototype.nodeEdges = function(v, w) {
  3976. var inEdges = this.inEdges(v, w);
  3977. if (inEdges) {
  3978. return inEdges.concat(this.outEdges(v, w));
  3979. }
  3980. };
  3981. function incrementOrInitEntry(map, k) {
  3982. if (map[k]) {
  3983. map[k]++;
  3984. } else {
  3985. map[k] = 1;
  3986. }
  3987. }
  3988. function decrementOrRemoveEntry(map, k) {
  3989. if (!--map[k]) { delete map[k]; }
  3990. }
  3991. function edgeArgsToId(isDirected, v_, w_, name) {
  3992. var v = "" + v_;
  3993. var w = "" + w_;
  3994. if (!isDirected && v > w) {
  3995. var tmp = v;
  3996. v = w;
  3997. w = tmp;
  3998. }
  3999. return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM +
  4000. (_.isUndefined(name) ? DEFAULT_EDGE_NAME : name);
  4001. }
  4002. function edgeArgsToObj(isDirected, v_, w_, name) {
  4003. var v = "" + v_;
  4004. var w = "" + w_;
  4005. if (!isDirected && v > w) {
  4006. var tmp = v;
  4007. v = w;
  4008. w = tmp;
  4009. }
  4010. var edgeObj = { v: v, w: w };
  4011. if (name) {
  4012. edgeObj.name = name;
  4013. }
  4014. return edgeObj;
  4015. }
  4016. function edgeObjToId(isDirected, edgeObj) {
  4017. return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
  4018. }
  4019. /***/ }),
  4020. /***/ "../../node_modules/graphlib/lib/index.js":
  4021. /*!**************************************************************************!*\
  4022. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/index.js ***!
  4023. \**************************************************************************/
  4024. /*! no static exports found */
  4025. /***/ (function(module, exports, __webpack_require__) {
  4026. // Includes only the "core" of graphlib
  4027. module.exports = {
  4028. Graph: __webpack_require__(/*! ./graph */ "../../node_modules/graphlib/lib/graph.js"),
  4029. version: __webpack_require__(/*! ./version */ "../../node_modules/graphlib/lib/version.js")
  4030. };
  4031. /***/ }),
  4032. /***/ "../../node_modules/graphlib/lib/json.js":
  4033. /*!*************************************************************************!*\
  4034. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/json.js ***!
  4035. \*************************************************************************/
  4036. /*! no static exports found */
  4037. /***/ (function(module, exports, __webpack_require__) {
  4038. var _ = __webpack_require__(/*! ./lodash */ "../../node_modules/graphlib/lib/lodash.js");
  4039. var Graph = __webpack_require__(/*! ./graph */ "../../node_modules/graphlib/lib/graph.js");
  4040. module.exports = {
  4041. write: write,
  4042. read: read
  4043. };
  4044. function write(g) {
  4045. var json = {
  4046. options: {
  4047. directed: g.isDirected(),
  4048. multigraph: g.isMultigraph(),
  4049. compound: g.isCompound()
  4050. },
  4051. nodes: writeNodes(g),
  4052. edges: writeEdges(g)
  4053. };
  4054. if (!_.isUndefined(g.graph())) {
  4055. json.value = _.clone(g.graph());
  4056. }
  4057. return json;
  4058. }
  4059. function writeNodes(g) {
  4060. return _.map(g.nodes(), function(v) {
  4061. var nodeValue = g.node(v);
  4062. var parent = g.parent(v);
  4063. var node = { v: v };
  4064. if (!_.isUndefined(nodeValue)) {
  4065. node.value = nodeValue;
  4066. }
  4067. if (!_.isUndefined(parent)) {
  4068. node.parent = parent;
  4069. }
  4070. return node;
  4071. });
  4072. }
  4073. function writeEdges(g) {
  4074. return _.map(g.edges(), function(e) {
  4075. var edgeValue = g.edge(e);
  4076. var edge = { v: e.v, w: e.w };
  4077. if (!_.isUndefined(e.name)) {
  4078. edge.name = e.name;
  4079. }
  4080. if (!_.isUndefined(edgeValue)) {
  4081. edge.value = edgeValue;
  4082. }
  4083. return edge;
  4084. });
  4085. }
  4086. function read(json) {
  4087. var g = new Graph(json.options).setGraph(json.value);
  4088. _.each(json.nodes, function(entry) {
  4089. g.setNode(entry.v, entry.value);
  4090. if (entry.parent) {
  4091. g.setParent(entry.v, entry.parent);
  4092. }
  4093. });
  4094. _.each(json.edges, function(entry) {
  4095. g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);
  4096. });
  4097. return g;
  4098. }
  4099. /***/ }),
  4100. /***/ "../../node_modules/graphlib/lib/lodash.js":
  4101. /*!***************************************************************************!*\
  4102. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/lodash.js ***!
  4103. \***************************************************************************/
  4104. /*! no static exports found */
  4105. /***/ (function(module, exports, __webpack_require__) {
  4106. /* global window */
  4107. var lodash;
  4108. if (true) {
  4109. try {
  4110. lodash = {
  4111. clone: __webpack_require__(/*! lodash/clone */ "../../node_modules/lodash/clone.js"),
  4112. constant: __webpack_require__(/*! lodash/constant */ "../../node_modules/lodash/constant.js"),
  4113. each: __webpack_require__(/*! lodash/each */ "../../node_modules/lodash/each.js"),
  4114. filter: __webpack_require__(/*! lodash/filter */ "../../node_modules/lodash/filter.js"),
  4115. has: __webpack_require__(/*! lodash/has */ "../../node_modules/lodash/has.js"),
  4116. isArray: __webpack_require__(/*! lodash/isArray */ "../../node_modules/lodash/isArray.js"),
  4117. isEmpty: __webpack_require__(/*! lodash/isEmpty */ "../../node_modules/lodash/isEmpty.js"),
  4118. isFunction: __webpack_require__(/*! lodash/isFunction */ "../../node_modules/lodash/isFunction.js"),
  4119. isUndefined: __webpack_require__(/*! lodash/isUndefined */ "../../node_modules/lodash/isUndefined.js"),
  4120. keys: __webpack_require__(/*! lodash/keys */ "../../node_modules/lodash/keys.js"),
  4121. map: __webpack_require__(/*! lodash/map */ "../../node_modules/lodash/map.js"),
  4122. reduce: __webpack_require__(/*! lodash/reduce */ "../../node_modules/lodash/reduce.js"),
  4123. size: __webpack_require__(/*! lodash/size */ "../../node_modules/lodash/size.js"),
  4124. transform: __webpack_require__(/*! lodash/transform */ "../../node_modules/lodash/transform.js"),
  4125. union: __webpack_require__(/*! lodash/union */ "../../node_modules/lodash/union.js"),
  4126. values: __webpack_require__(/*! lodash/values */ "../../node_modules/lodash/values.js")
  4127. };
  4128. } catch (e) {
  4129. // continue regardless of error
  4130. }
  4131. }
  4132. if (!lodash) {
  4133. lodash = window._;
  4134. }
  4135. module.exports = lodash;
  4136. /***/ }),
  4137. /***/ "../../node_modules/graphlib/lib/version.js":
  4138. /*!****************************************************************************!*\
  4139. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/graphlib/lib/version.js ***!
  4140. \****************************************************************************/
  4141. /*! no static exports found */
  4142. /***/ (function(module, exports) {
  4143. module.exports = '2.1.8';
  4144. /***/ }),
  4145. /***/ "../../node_modules/lodash/_DataView.js":
  4146. /*!************************************************************************!*\
  4147. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_DataView.js ***!
  4148. \************************************************************************/
  4149. /*! no static exports found */
  4150. /***/ (function(module, exports, __webpack_require__) {
  4151. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
  4152. root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4153. /* Built-in method references that are verified to be native. */
  4154. var DataView = getNative(root, 'DataView');
  4155. module.exports = DataView;
  4156. /***/ }),
  4157. /***/ "../../node_modules/lodash/_Hash.js":
  4158. /*!********************************************************************!*\
  4159. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Hash.js ***!
  4160. \********************************************************************/
  4161. /*! no static exports found */
  4162. /***/ (function(module, exports, __webpack_require__) {
  4163. var hashClear = __webpack_require__(/*! ./_hashClear */ "../../node_modules/lodash/_hashClear.js"),
  4164. hashDelete = __webpack_require__(/*! ./_hashDelete */ "../../node_modules/lodash/_hashDelete.js"),
  4165. hashGet = __webpack_require__(/*! ./_hashGet */ "../../node_modules/lodash/_hashGet.js"),
  4166. hashHas = __webpack_require__(/*! ./_hashHas */ "../../node_modules/lodash/_hashHas.js"),
  4167. hashSet = __webpack_require__(/*! ./_hashSet */ "../../node_modules/lodash/_hashSet.js");
  4168. /**
  4169. * Creates a hash object.
  4170. *
  4171. * @private
  4172. * @constructor
  4173. * @param {Array} [entries] The key-value pairs to cache.
  4174. */
  4175. function Hash(entries) {
  4176. var index = -1,
  4177. length = entries == null ? 0 : entries.length;
  4178. this.clear();
  4179. while (++index < length) {
  4180. var entry = entries[index];
  4181. this.set(entry[0], entry[1]);
  4182. }
  4183. }
  4184. // Add methods to `Hash`.
  4185. Hash.prototype.clear = hashClear;
  4186. Hash.prototype['delete'] = hashDelete;
  4187. Hash.prototype.get = hashGet;
  4188. Hash.prototype.has = hashHas;
  4189. Hash.prototype.set = hashSet;
  4190. module.exports = Hash;
  4191. /***/ }),
  4192. /***/ "../../node_modules/lodash/_ListCache.js":
  4193. /*!*************************************************************************!*\
  4194. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_ListCache.js ***!
  4195. \*************************************************************************/
  4196. /*! no static exports found */
  4197. /***/ (function(module, exports, __webpack_require__) {
  4198. var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../node_modules/lodash/_listCacheClear.js"),
  4199. listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../node_modules/lodash/_listCacheDelete.js"),
  4200. listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../node_modules/lodash/_listCacheGet.js"),
  4201. listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../node_modules/lodash/_listCacheHas.js"),
  4202. listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../node_modules/lodash/_listCacheSet.js");
  4203. /**
  4204. * Creates an list cache object.
  4205. *
  4206. * @private
  4207. * @constructor
  4208. * @param {Array} [entries] The key-value pairs to cache.
  4209. */
  4210. function ListCache(entries) {
  4211. var index = -1,
  4212. length = entries == null ? 0 : entries.length;
  4213. this.clear();
  4214. while (++index < length) {
  4215. var entry = entries[index];
  4216. this.set(entry[0], entry[1]);
  4217. }
  4218. }
  4219. // Add methods to `ListCache`.
  4220. ListCache.prototype.clear = listCacheClear;
  4221. ListCache.prototype['delete'] = listCacheDelete;
  4222. ListCache.prototype.get = listCacheGet;
  4223. ListCache.prototype.has = listCacheHas;
  4224. ListCache.prototype.set = listCacheSet;
  4225. module.exports = ListCache;
  4226. /***/ }),
  4227. /***/ "../../node_modules/lodash/_Map.js":
  4228. /*!*******************************************************************!*\
  4229. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Map.js ***!
  4230. \*******************************************************************/
  4231. /*! no static exports found */
  4232. /***/ (function(module, exports, __webpack_require__) {
  4233. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
  4234. root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4235. /* Built-in method references that are verified to be native. */
  4236. var Map = getNative(root, 'Map');
  4237. module.exports = Map;
  4238. /***/ }),
  4239. /***/ "../../node_modules/lodash/_MapCache.js":
  4240. /*!************************************************************************!*\
  4241. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_MapCache.js ***!
  4242. \************************************************************************/
  4243. /*! no static exports found */
  4244. /***/ (function(module, exports, __webpack_require__) {
  4245. var mapCacheClear = __webpack_require__(/*! ./_mapCacheClear */ "../../node_modules/lodash/_mapCacheClear.js"),
  4246. mapCacheDelete = __webpack_require__(/*! ./_mapCacheDelete */ "../../node_modules/lodash/_mapCacheDelete.js"),
  4247. mapCacheGet = __webpack_require__(/*! ./_mapCacheGet */ "../../node_modules/lodash/_mapCacheGet.js"),
  4248. mapCacheHas = __webpack_require__(/*! ./_mapCacheHas */ "../../node_modules/lodash/_mapCacheHas.js"),
  4249. mapCacheSet = __webpack_require__(/*! ./_mapCacheSet */ "../../node_modules/lodash/_mapCacheSet.js");
  4250. /**
  4251. * Creates a map cache object to store key-value pairs.
  4252. *
  4253. * @private
  4254. * @constructor
  4255. * @param {Array} [entries] The key-value pairs to cache.
  4256. */
  4257. function MapCache(entries) {
  4258. var index = -1,
  4259. length = entries == null ? 0 : entries.length;
  4260. this.clear();
  4261. while (++index < length) {
  4262. var entry = entries[index];
  4263. this.set(entry[0], entry[1]);
  4264. }
  4265. }
  4266. // Add methods to `MapCache`.
  4267. MapCache.prototype.clear = mapCacheClear;
  4268. MapCache.prototype['delete'] = mapCacheDelete;
  4269. MapCache.prototype.get = mapCacheGet;
  4270. MapCache.prototype.has = mapCacheHas;
  4271. MapCache.prototype.set = mapCacheSet;
  4272. module.exports = MapCache;
  4273. /***/ }),
  4274. /***/ "../../node_modules/lodash/_Promise.js":
  4275. /*!***********************************************************************!*\
  4276. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Promise.js ***!
  4277. \***********************************************************************/
  4278. /*! no static exports found */
  4279. /***/ (function(module, exports, __webpack_require__) {
  4280. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
  4281. root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4282. /* Built-in method references that are verified to be native. */
  4283. var Promise = getNative(root, 'Promise');
  4284. module.exports = Promise;
  4285. /***/ }),
  4286. /***/ "../../node_modules/lodash/_Set.js":
  4287. /*!*******************************************************************!*\
  4288. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Set.js ***!
  4289. \*******************************************************************/
  4290. /*! no static exports found */
  4291. /***/ (function(module, exports, __webpack_require__) {
  4292. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
  4293. root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4294. /* Built-in method references that are verified to be native. */
  4295. var Set = getNative(root, 'Set');
  4296. module.exports = Set;
  4297. /***/ }),
  4298. /***/ "../../node_modules/lodash/_SetCache.js":
  4299. /*!************************************************************************!*\
  4300. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_SetCache.js ***!
  4301. \************************************************************************/
  4302. /*! no static exports found */
  4303. /***/ (function(module, exports, __webpack_require__) {
  4304. var MapCache = __webpack_require__(/*! ./_MapCache */ "../../node_modules/lodash/_MapCache.js"),
  4305. setCacheAdd = __webpack_require__(/*! ./_setCacheAdd */ "../../node_modules/lodash/_setCacheAdd.js"),
  4306. setCacheHas = __webpack_require__(/*! ./_setCacheHas */ "../../node_modules/lodash/_setCacheHas.js");
  4307. /**
  4308. *
  4309. * Creates an array cache object to store unique values.
  4310. *
  4311. * @private
  4312. * @constructor
  4313. * @param {Array} [values] The values to cache.
  4314. */
  4315. function SetCache(values) {
  4316. var index = -1,
  4317. length = values == null ? 0 : values.length;
  4318. this.__data__ = new MapCache;
  4319. while (++index < length) {
  4320. this.add(values[index]);
  4321. }
  4322. }
  4323. // Add methods to `SetCache`.
  4324. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  4325. SetCache.prototype.has = setCacheHas;
  4326. module.exports = SetCache;
  4327. /***/ }),
  4328. /***/ "../../node_modules/lodash/_Stack.js":
  4329. /*!*********************************************************************!*\
  4330. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Stack.js ***!
  4331. \*********************************************************************/
  4332. /*! no static exports found */
  4333. /***/ (function(module, exports, __webpack_require__) {
  4334. var ListCache = __webpack_require__(/*! ./_ListCache */ "../../node_modules/lodash/_ListCache.js"),
  4335. stackClear = __webpack_require__(/*! ./_stackClear */ "../../node_modules/lodash/_stackClear.js"),
  4336. stackDelete = __webpack_require__(/*! ./_stackDelete */ "../../node_modules/lodash/_stackDelete.js"),
  4337. stackGet = __webpack_require__(/*! ./_stackGet */ "../../node_modules/lodash/_stackGet.js"),
  4338. stackHas = __webpack_require__(/*! ./_stackHas */ "../../node_modules/lodash/_stackHas.js"),
  4339. stackSet = __webpack_require__(/*! ./_stackSet */ "../../node_modules/lodash/_stackSet.js");
  4340. /**
  4341. * Creates a stack cache object to store key-value pairs.
  4342. *
  4343. * @private
  4344. * @constructor
  4345. * @param {Array} [entries] The key-value pairs to cache.
  4346. */
  4347. function Stack(entries) {
  4348. var data = this.__data__ = new ListCache(entries);
  4349. this.size = data.size;
  4350. }
  4351. // Add methods to `Stack`.
  4352. Stack.prototype.clear = stackClear;
  4353. Stack.prototype['delete'] = stackDelete;
  4354. Stack.prototype.get = stackGet;
  4355. Stack.prototype.has = stackHas;
  4356. Stack.prototype.set = stackSet;
  4357. module.exports = Stack;
  4358. /***/ }),
  4359. /***/ "../../node_modules/lodash/_Symbol.js":
  4360. /*!**********************************************************************!*\
  4361. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Symbol.js ***!
  4362. \**********************************************************************/
  4363. /*! no static exports found */
  4364. /***/ (function(module, exports, __webpack_require__) {
  4365. var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4366. /** Built-in value references. */
  4367. var Symbol = root.Symbol;
  4368. module.exports = Symbol;
  4369. /***/ }),
  4370. /***/ "../../node_modules/lodash/_Uint8Array.js":
  4371. /*!**************************************************************************!*\
  4372. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_Uint8Array.js ***!
  4373. \**************************************************************************/
  4374. /*! no static exports found */
  4375. /***/ (function(module, exports, __webpack_require__) {
  4376. var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4377. /** Built-in value references. */
  4378. var Uint8Array = root.Uint8Array;
  4379. module.exports = Uint8Array;
  4380. /***/ }),
  4381. /***/ "../../node_modules/lodash/_WeakMap.js":
  4382. /*!***********************************************************************!*\
  4383. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_WeakMap.js ***!
  4384. \***********************************************************************/
  4385. /*! no static exports found */
  4386. /***/ (function(module, exports, __webpack_require__) {
  4387. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
  4388. root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  4389. /* Built-in method references that are verified to be native. */
  4390. var WeakMap = getNative(root, 'WeakMap');
  4391. module.exports = WeakMap;
  4392. /***/ }),
  4393. /***/ "../../node_modules/lodash/_apply.js":
  4394. /*!*********************************************************************!*\
  4395. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_apply.js ***!
  4396. \*********************************************************************/
  4397. /*! no static exports found */
  4398. /***/ (function(module, exports) {
  4399. /**
  4400. * A faster alternative to `Function#apply`, this function invokes `func`
  4401. * with the `this` binding of `thisArg` and the arguments of `args`.
  4402. *
  4403. * @private
  4404. * @param {Function} func The function to invoke.
  4405. * @param {*} thisArg The `this` binding of `func`.
  4406. * @param {Array} args The arguments to invoke `func` with.
  4407. * @returns {*} Returns the result of `func`.
  4408. */
  4409. function apply(func, thisArg, args) {
  4410. switch (args.length) {
  4411. case 0: return func.call(thisArg);
  4412. case 1: return func.call(thisArg, args[0]);
  4413. case 2: return func.call(thisArg, args[0], args[1]);
  4414. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  4415. }
  4416. return func.apply(thisArg, args);
  4417. }
  4418. module.exports = apply;
  4419. /***/ }),
  4420. /***/ "../../node_modules/lodash/_arrayEach.js":
  4421. /*!*************************************************************************!*\
  4422. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayEach.js ***!
  4423. \*************************************************************************/
  4424. /*! no static exports found */
  4425. /***/ (function(module, exports) {
  4426. /**
  4427. * A specialized version of `_.forEach` for arrays without support for
  4428. * iteratee shorthands.
  4429. *
  4430. * @private
  4431. * @param {Array} [array] The array to iterate over.
  4432. * @param {Function} iteratee The function invoked per iteration.
  4433. * @returns {Array} Returns `array`.
  4434. */
  4435. function arrayEach(array, iteratee) {
  4436. var index = -1,
  4437. length = array == null ? 0 : array.length;
  4438. while (++index < length) {
  4439. if (iteratee(array[index], index, array) === false) {
  4440. break;
  4441. }
  4442. }
  4443. return array;
  4444. }
  4445. module.exports = arrayEach;
  4446. /***/ }),
  4447. /***/ "../../node_modules/lodash/_arrayFilter.js":
  4448. /*!***************************************************************************!*\
  4449. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayFilter.js ***!
  4450. \***************************************************************************/
  4451. /*! no static exports found */
  4452. /***/ (function(module, exports) {
  4453. /**
  4454. * A specialized version of `_.filter` for arrays without support for
  4455. * iteratee shorthands.
  4456. *
  4457. * @private
  4458. * @param {Array} [array] The array to iterate over.
  4459. * @param {Function} predicate The function invoked per iteration.
  4460. * @returns {Array} Returns the new filtered array.
  4461. */
  4462. function arrayFilter(array, predicate) {
  4463. var index = -1,
  4464. length = array == null ? 0 : array.length,
  4465. resIndex = 0,
  4466. result = [];
  4467. while (++index < length) {
  4468. var value = array[index];
  4469. if (predicate(value, index, array)) {
  4470. result[resIndex++] = value;
  4471. }
  4472. }
  4473. return result;
  4474. }
  4475. module.exports = arrayFilter;
  4476. /***/ }),
  4477. /***/ "../../node_modules/lodash/_arrayIncludes.js":
  4478. /*!*****************************************************************************!*\
  4479. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayIncludes.js ***!
  4480. \*****************************************************************************/
  4481. /*! no static exports found */
  4482. /***/ (function(module, exports, __webpack_require__) {
  4483. var baseIndexOf = __webpack_require__(/*! ./_baseIndexOf */ "../../node_modules/lodash/_baseIndexOf.js");
  4484. /**
  4485. * A specialized version of `_.includes` for arrays without support for
  4486. * specifying an index to search from.
  4487. *
  4488. * @private
  4489. * @param {Array} [array] The array to inspect.
  4490. * @param {*} target The value to search for.
  4491. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  4492. */
  4493. function arrayIncludes(array, value) {
  4494. var length = array == null ? 0 : array.length;
  4495. return !!length && baseIndexOf(array, value, 0) > -1;
  4496. }
  4497. module.exports = arrayIncludes;
  4498. /***/ }),
  4499. /***/ "../../node_modules/lodash/_arrayIncludesWith.js":
  4500. /*!*********************************************************************************!*\
  4501. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayIncludesWith.js ***!
  4502. \*********************************************************************************/
  4503. /*! no static exports found */
  4504. /***/ (function(module, exports) {
  4505. /**
  4506. * This function is like `arrayIncludes` except that it accepts a comparator.
  4507. *
  4508. * @private
  4509. * @param {Array} [array] The array to inspect.
  4510. * @param {*} target The value to search for.
  4511. * @param {Function} comparator The comparator invoked per element.
  4512. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  4513. */
  4514. function arrayIncludesWith(array, value, comparator) {
  4515. var index = -1,
  4516. length = array == null ? 0 : array.length;
  4517. while (++index < length) {
  4518. if (comparator(value, array[index])) {
  4519. return true;
  4520. }
  4521. }
  4522. return false;
  4523. }
  4524. module.exports = arrayIncludesWith;
  4525. /***/ }),
  4526. /***/ "../../node_modules/lodash/_arrayLikeKeys.js":
  4527. /*!*****************************************************************************!*\
  4528. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayLikeKeys.js ***!
  4529. \*****************************************************************************/
  4530. /*! no static exports found */
  4531. /***/ (function(module, exports, __webpack_require__) {
  4532. var baseTimes = __webpack_require__(/*! ./_baseTimes */ "../../node_modules/lodash/_baseTimes.js"),
  4533. isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
  4534. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  4535. isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
  4536. isIndex = __webpack_require__(/*! ./_isIndex */ "../../node_modules/lodash/_isIndex.js"),
  4537. isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../node_modules/lodash/isTypedArray.js");
  4538. /** Used for built-in method references. */
  4539. var objectProto = Object.prototype;
  4540. /** Used to check objects for own properties. */
  4541. var hasOwnProperty = objectProto.hasOwnProperty;
  4542. /**
  4543. * Creates an array of the enumerable property names of the array-like `value`.
  4544. *
  4545. * @private
  4546. * @param {*} value The value to query.
  4547. * @param {boolean} inherited Specify returning inherited property names.
  4548. * @returns {Array} Returns the array of property names.
  4549. */
  4550. function arrayLikeKeys(value, inherited) {
  4551. var isArr = isArray(value),
  4552. isArg = !isArr && isArguments(value),
  4553. isBuff = !isArr && !isArg && isBuffer(value),
  4554. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  4555. skipIndexes = isArr || isArg || isBuff || isType,
  4556. result = skipIndexes ? baseTimes(value.length, String) : [],
  4557. length = result.length;
  4558. for (var key in value) {
  4559. if ((inherited || hasOwnProperty.call(value, key)) &&
  4560. !(skipIndexes && (
  4561. // Safari 9 has enumerable `arguments.length` in strict mode.
  4562. key == 'length' ||
  4563. // Node.js 0.10 has enumerable non-index properties on buffers.
  4564. (isBuff && (key == 'offset' || key == 'parent')) ||
  4565. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  4566. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  4567. // Skip index properties.
  4568. isIndex(key, length)
  4569. ))) {
  4570. result.push(key);
  4571. }
  4572. }
  4573. return result;
  4574. }
  4575. module.exports = arrayLikeKeys;
  4576. /***/ }),
  4577. /***/ "../../node_modules/lodash/_arrayMap.js":
  4578. /*!************************************************************************!*\
  4579. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayMap.js ***!
  4580. \************************************************************************/
  4581. /*! no static exports found */
  4582. /***/ (function(module, exports) {
  4583. /**
  4584. * A specialized version of `_.map` for arrays without support for iteratee
  4585. * shorthands.
  4586. *
  4587. * @private
  4588. * @param {Array} [array] The array to iterate over.
  4589. * @param {Function} iteratee The function invoked per iteration.
  4590. * @returns {Array} Returns the new mapped array.
  4591. */
  4592. function arrayMap(array, iteratee) {
  4593. var index = -1,
  4594. length = array == null ? 0 : array.length,
  4595. result = Array(length);
  4596. while (++index < length) {
  4597. result[index] = iteratee(array[index], index, array);
  4598. }
  4599. return result;
  4600. }
  4601. module.exports = arrayMap;
  4602. /***/ }),
  4603. /***/ "../../node_modules/lodash/_arrayPush.js":
  4604. /*!*************************************************************************!*\
  4605. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayPush.js ***!
  4606. \*************************************************************************/
  4607. /*! no static exports found */
  4608. /***/ (function(module, exports) {
  4609. /**
  4610. * Appends the elements of `values` to `array`.
  4611. *
  4612. * @private
  4613. * @param {Array} array The array to modify.
  4614. * @param {Array} values The values to append.
  4615. * @returns {Array} Returns `array`.
  4616. */
  4617. function arrayPush(array, values) {
  4618. var index = -1,
  4619. length = values.length,
  4620. offset = array.length;
  4621. while (++index < length) {
  4622. array[offset + index] = values[index];
  4623. }
  4624. return array;
  4625. }
  4626. module.exports = arrayPush;
  4627. /***/ }),
  4628. /***/ "../../node_modules/lodash/_arrayReduce.js":
  4629. /*!***************************************************************************!*\
  4630. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arrayReduce.js ***!
  4631. \***************************************************************************/
  4632. /*! no static exports found */
  4633. /***/ (function(module, exports) {
  4634. /**
  4635. * A specialized version of `_.reduce` for arrays without support for
  4636. * iteratee shorthands.
  4637. *
  4638. * @private
  4639. * @param {Array} [array] The array to iterate over.
  4640. * @param {Function} iteratee The function invoked per iteration.
  4641. * @param {*} [accumulator] The initial value.
  4642. * @param {boolean} [initAccum] Specify using the first element of `array` as
  4643. * the initial value.
  4644. * @returns {*} Returns the accumulated value.
  4645. */
  4646. function arrayReduce(array, iteratee, accumulator, initAccum) {
  4647. var index = -1,
  4648. length = array == null ? 0 : array.length;
  4649. if (initAccum && length) {
  4650. accumulator = array[++index];
  4651. }
  4652. while (++index < length) {
  4653. accumulator = iteratee(accumulator, array[index], index, array);
  4654. }
  4655. return accumulator;
  4656. }
  4657. module.exports = arrayReduce;
  4658. /***/ }),
  4659. /***/ "../../node_modules/lodash/_arraySome.js":
  4660. /*!*************************************************************************!*\
  4661. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_arraySome.js ***!
  4662. \*************************************************************************/
  4663. /*! no static exports found */
  4664. /***/ (function(module, exports) {
  4665. /**
  4666. * A specialized version of `_.some` for arrays without support for iteratee
  4667. * shorthands.
  4668. *
  4669. * @private
  4670. * @param {Array} [array] The array to iterate over.
  4671. * @param {Function} predicate The function invoked per iteration.
  4672. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4673. * else `false`.
  4674. */
  4675. function arraySome(array, predicate) {
  4676. var index = -1,
  4677. length = array == null ? 0 : array.length;
  4678. while (++index < length) {
  4679. if (predicate(array[index], index, array)) {
  4680. return true;
  4681. }
  4682. }
  4683. return false;
  4684. }
  4685. module.exports = arraySome;
  4686. /***/ }),
  4687. /***/ "../../node_modules/lodash/_asciiSize.js":
  4688. /*!*************************************************************************!*\
  4689. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_asciiSize.js ***!
  4690. \*************************************************************************/
  4691. /*! no static exports found */
  4692. /***/ (function(module, exports, __webpack_require__) {
  4693. var baseProperty = __webpack_require__(/*! ./_baseProperty */ "../../node_modules/lodash/_baseProperty.js");
  4694. /**
  4695. * Gets the size of an ASCII `string`.
  4696. *
  4697. * @private
  4698. * @param {string} string The string inspect.
  4699. * @returns {number} Returns the string size.
  4700. */
  4701. var asciiSize = baseProperty('length');
  4702. module.exports = asciiSize;
  4703. /***/ }),
  4704. /***/ "../../node_modules/lodash/_assignMergeValue.js":
  4705. /*!********************************************************************************!*\
  4706. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_assignMergeValue.js ***!
  4707. \********************************************************************************/
  4708. /*! no static exports found */
  4709. /***/ (function(module, exports, __webpack_require__) {
  4710. var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "../../node_modules/lodash/_baseAssignValue.js"),
  4711. eq = __webpack_require__(/*! ./eq */ "../../node_modules/lodash/eq.js");
  4712. /**
  4713. * This function is like `assignValue` except that it doesn't assign
  4714. * `undefined` values.
  4715. *
  4716. * @private
  4717. * @param {Object} object The object to modify.
  4718. * @param {string} key The key of the property to assign.
  4719. * @param {*} value The value to assign.
  4720. */
  4721. function assignMergeValue(object, key, value) {
  4722. if ((value !== undefined && !eq(object[key], value)) ||
  4723. (value === undefined && !(key in object))) {
  4724. baseAssignValue(object, key, value);
  4725. }
  4726. }
  4727. module.exports = assignMergeValue;
  4728. /***/ }),
  4729. /***/ "../../node_modules/lodash/_assignValue.js":
  4730. /*!***************************************************************************!*\
  4731. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_assignValue.js ***!
  4732. \***************************************************************************/
  4733. /*! no static exports found */
  4734. /***/ (function(module, exports, __webpack_require__) {
  4735. var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "../../node_modules/lodash/_baseAssignValue.js"),
  4736. eq = __webpack_require__(/*! ./eq */ "../../node_modules/lodash/eq.js");
  4737. /** Used for built-in method references. */
  4738. var objectProto = Object.prototype;
  4739. /** Used to check objects for own properties. */
  4740. var hasOwnProperty = objectProto.hasOwnProperty;
  4741. /**
  4742. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  4743. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4744. * for equality comparisons.
  4745. *
  4746. * @private
  4747. * @param {Object} object The object to modify.
  4748. * @param {string} key The key of the property to assign.
  4749. * @param {*} value The value to assign.
  4750. */
  4751. function assignValue(object, key, value) {
  4752. var objValue = object[key];
  4753. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  4754. (value === undefined && !(key in object))) {
  4755. baseAssignValue(object, key, value);
  4756. }
  4757. }
  4758. module.exports = assignValue;
  4759. /***/ }),
  4760. /***/ "../../node_modules/lodash/_assocIndexOf.js":
  4761. /*!****************************************************************************!*\
  4762. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_assocIndexOf.js ***!
  4763. \****************************************************************************/
  4764. /*! no static exports found */
  4765. /***/ (function(module, exports, __webpack_require__) {
  4766. var eq = __webpack_require__(/*! ./eq */ "../../node_modules/lodash/eq.js");
  4767. /**
  4768. * Gets the index at which the `key` is found in `array` of key-value pairs.
  4769. *
  4770. * @private
  4771. * @param {Array} array The array to inspect.
  4772. * @param {*} key The key to search for.
  4773. * @returns {number} Returns the index of the matched value, else `-1`.
  4774. */
  4775. function assocIndexOf(array, key) {
  4776. var length = array.length;
  4777. while (length--) {
  4778. if (eq(array[length][0], key)) {
  4779. return length;
  4780. }
  4781. }
  4782. return -1;
  4783. }
  4784. module.exports = assocIndexOf;
  4785. /***/ }),
  4786. /***/ "../../node_modules/lodash/_baseAssign.js":
  4787. /*!**************************************************************************!*\
  4788. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseAssign.js ***!
  4789. \**************************************************************************/
  4790. /*! no static exports found */
  4791. /***/ (function(module, exports, __webpack_require__) {
  4792. var copyObject = __webpack_require__(/*! ./_copyObject */ "../../node_modules/lodash/_copyObject.js"),
  4793. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  4794. /**
  4795. * The base implementation of `_.assign` without support for multiple sources
  4796. * or `customizer` functions.
  4797. *
  4798. * @private
  4799. * @param {Object} object The destination object.
  4800. * @param {Object} source The source object.
  4801. * @returns {Object} Returns `object`.
  4802. */
  4803. function baseAssign(object, source) {
  4804. return object && copyObject(source, keys(source), object);
  4805. }
  4806. module.exports = baseAssign;
  4807. /***/ }),
  4808. /***/ "../../node_modules/lodash/_baseAssignIn.js":
  4809. /*!****************************************************************************!*\
  4810. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseAssignIn.js ***!
  4811. \****************************************************************************/
  4812. /*! no static exports found */
  4813. /***/ (function(module, exports, __webpack_require__) {
  4814. var copyObject = __webpack_require__(/*! ./_copyObject */ "../../node_modules/lodash/_copyObject.js"),
  4815. keysIn = __webpack_require__(/*! ./keysIn */ "../../node_modules/lodash/keysIn.js");
  4816. /**
  4817. * The base implementation of `_.assignIn` without support for multiple sources
  4818. * or `customizer` functions.
  4819. *
  4820. * @private
  4821. * @param {Object} object The destination object.
  4822. * @param {Object} source The source object.
  4823. * @returns {Object} Returns `object`.
  4824. */
  4825. function baseAssignIn(object, source) {
  4826. return object && copyObject(source, keysIn(source), object);
  4827. }
  4828. module.exports = baseAssignIn;
  4829. /***/ }),
  4830. /***/ "../../node_modules/lodash/_baseAssignValue.js":
  4831. /*!*******************************************************************************!*\
  4832. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseAssignValue.js ***!
  4833. \*******************************************************************************/
  4834. /*! no static exports found */
  4835. /***/ (function(module, exports, __webpack_require__) {
  4836. var defineProperty = __webpack_require__(/*! ./_defineProperty */ "../../node_modules/lodash/_defineProperty.js");
  4837. /**
  4838. * The base implementation of `assignValue` and `assignMergeValue` without
  4839. * value checks.
  4840. *
  4841. * @private
  4842. * @param {Object} object The object to modify.
  4843. * @param {string} key The key of the property to assign.
  4844. * @param {*} value The value to assign.
  4845. */
  4846. function baseAssignValue(object, key, value) {
  4847. if (key == '__proto__' && defineProperty) {
  4848. defineProperty(object, key, {
  4849. 'configurable': true,
  4850. 'enumerable': true,
  4851. 'value': value,
  4852. 'writable': true
  4853. });
  4854. } else {
  4855. object[key] = value;
  4856. }
  4857. }
  4858. module.exports = baseAssignValue;
  4859. /***/ }),
  4860. /***/ "../../node_modules/lodash/_baseClone.js":
  4861. /*!*************************************************************************!*\
  4862. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseClone.js ***!
  4863. \*************************************************************************/
  4864. /*! no static exports found */
  4865. /***/ (function(module, exports, __webpack_require__) {
  4866. var Stack = __webpack_require__(/*! ./_Stack */ "../../node_modules/lodash/_Stack.js"),
  4867. arrayEach = __webpack_require__(/*! ./_arrayEach */ "../../node_modules/lodash/_arrayEach.js"),
  4868. assignValue = __webpack_require__(/*! ./_assignValue */ "../../node_modules/lodash/_assignValue.js"),
  4869. baseAssign = __webpack_require__(/*! ./_baseAssign */ "../../node_modules/lodash/_baseAssign.js"),
  4870. baseAssignIn = __webpack_require__(/*! ./_baseAssignIn */ "../../node_modules/lodash/_baseAssignIn.js"),
  4871. cloneBuffer = __webpack_require__(/*! ./_cloneBuffer */ "../../node_modules/lodash/_cloneBuffer.js"),
  4872. copyArray = __webpack_require__(/*! ./_copyArray */ "../../node_modules/lodash/_copyArray.js"),
  4873. copySymbols = __webpack_require__(/*! ./_copySymbols */ "../../node_modules/lodash/_copySymbols.js"),
  4874. copySymbolsIn = __webpack_require__(/*! ./_copySymbolsIn */ "../../node_modules/lodash/_copySymbolsIn.js"),
  4875. getAllKeys = __webpack_require__(/*! ./_getAllKeys */ "../../node_modules/lodash/_getAllKeys.js"),
  4876. getAllKeysIn = __webpack_require__(/*! ./_getAllKeysIn */ "../../node_modules/lodash/_getAllKeysIn.js"),
  4877. getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
  4878. initCloneArray = __webpack_require__(/*! ./_initCloneArray */ "../../node_modules/lodash/_initCloneArray.js"),
  4879. initCloneByTag = __webpack_require__(/*! ./_initCloneByTag */ "../../node_modules/lodash/_initCloneByTag.js"),
  4880. initCloneObject = __webpack_require__(/*! ./_initCloneObject */ "../../node_modules/lodash/_initCloneObject.js"),
  4881. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  4882. isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
  4883. isMap = __webpack_require__(/*! ./isMap */ "../../node_modules/lodash/isMap.js"),
  4884. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  4885. isSet = __webpack_require__(/*! ./isSet */ "../../node_modules/lodash/isSet.js"),
  4886. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  4887. /** Used to compose bitmasks for cloning. */
  4888. var CLONE_DEEP_FLAG = 1,
  4889. CLONE_FLAT_FLAG = 2,
  4890. CLONE_SYMBOLS_FLAG = 4;
  4891. /** `Object#toString` result references. */
  4892. var argsTag = '[object Arguments]',
  4893. arrayTag = '[object Array]',
  4894. boolTag = '[object Boolean]',
  4895. dateTag = '[object Date]',
  4896. errorTag = '[object Error]',
  4897. funcTag = '[object Function]',
  4898. genTag = '[object GeneratorFunction]',
  4899. mapTag = '[object Map]',
  4900. numberTag = '[object Number]',
  4901. objectTag = '[object Object]',
  4902. regexpTag = '[object RegExp]',
  4903. setTag = '[object Set]',
  4904. stringTag = '[object String]',
  4905. symbolTag = '[object Symbol]',
  4906. weakMapTag = '[object WeakMap]';
  4907. var arrayBufferTag = '[object ArrayBuffer]',
  4908. dataViewTag = '[object DataView]',
  4909. float32Tag = '[object Float32Array]',
  4910. float64Tag = '[object Float64Array]',
  4911. int8Tag = '[object Int8Array]',
  4912. int16Tag = '[object Int16Array]',
  4913. int32Tag = '[object Int32Array]',
  4914. uint8Tag = '[object Uint8Array]',
  4915. uint8ClampedTag = '[object Uint8ClampedArray]',
  4916. uint16Tag = '[object Uint16Array]',
  4917. uint32Tag = '[object Uint32Array]';
  4918. /** Used to identify `toStringTag` values supported by `_.clone`. */
  4919. var cloneableTags = {};
  4920. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  4921. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  4922. cloneableTags[boolTag] = cloneableTags[dateTag] =
  4923. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  4924. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  4925. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  4926. cloneableTags[numberTag] = cloneableTags[objectTag] =
  4927. cloneableTags[regexpTag] = cloneableTags[setTag] =
  4928. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  4929. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  4930. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  4931. cloneableTags[errorTag] = cloneableTags[funcTag] =
  4932. cloneableTags[weakMapTag] = false;
  4933. /**
  4934. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  4935. * traversed objects.
  4936. *
  4937. * @private
  4938. * @param {*} value The value to clone.
  4939. * @param {boolean} bitmask The bitmask flags.
  4940. * 1 - Deep clone
  4941. * 2 - Flatten inherited properties
  4942. * 4 - Clone symbols
  4943. * @param {Function} [customizer] The function to customize cloning.
  4944. * @param {string} [key] The key of `value`.
  4945. * @param {Object} [object] The parent object of `value`.
  4946. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  4947. * @returns {*} Returns the cloned value.
  4948. */
  4949. function baseClone(value, bitmask, customizer, key, object, stack) {
  4950. var result,
  4951. isDeep = bitmask & CLONE_DEEP_FLAG,
  4952. isFlat = bitmask & CLONE_FLAT_FLAG,
  4953. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  4954. if (customizer) {
  4955. result = object ? customizer(value, key, object, stack) : customizer(value);
  4956. }
  4957. if (result !== undefined) {
  4958. return result;
  4959. }
  4960. if (!isObject(value)) {
  4961. return value;
  4962. }
  4963. var isArr = isArray(value);
  4964. if (isArr) {
  4965. result = initCloneArray(value);
  4966. if (!isDeep) {
  4967. return copyArray(value, result);
  4968. }
  4969. } else {
  4970. var tag = getTag(value),
  4971. isFunc = tag == funcTag || tag == genTag;
  4972. if (isBuffer(value)) {
  4973. return cloneBuffer(value, isDeep);
  4974. }
  4975. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  4976. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  4977. if (!isDeep) {
  4978. return isFlat
  4979. ? copySymbolsIn(value, baseAssignIn(result, value))
  4980. : copySymbols(value, baseAssign(result, value));
  4981. }
  4982. } else {
  4983. if (!cloneableTags[tag]) {
  4984. return object ? value : {};
  4985. }
  4986. result = initCloneByTag(value, tag, isDeep);
  4987. }
  4988. }
  4989. // Check for circular references and return its corresponding clone.
  4990. stack || (stack = new Stack);
  4991. var stacked = stack.get(value);
  4992. if (stacked) {
  4993. return stacked;
  4994. }
  4995. stack.set(value, result);
  4996. if (isSet(value)) {
  4997. value.forEach(function(subValue) {
  4998. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  4999. });
  5000. } else if (isMap(value)) {
  5001. value.forEach(function(subValue, key) {
  5002. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  5003. });
  5004. }
  5005. var keysFunc = isFull
  5006. ? (isFlat ? getAllKeysIn : getAllKeys)
  5007. : (isFlat ? keysIn : keys);
  5008. var props = isArr ? undefined : keysFunc(value);
  5009. arrayEach(props || value, function(subValue, key) {
  5010. if (props) {
  5011. key = subValue;
  5012. subValue = value[key];
  5013. }
  5014. // Recursively populate clone (susceptible to call stack limits).
  5015. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  5016. });
  5017. return result;
  5018. }
  5019. module.exports = baseClone;
  5020. /***/ }),
  5021. /***/ "../../node_modules/lodash/_baseCreate.js":
  5022. /*!**************************************************************************!*\
  5023. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseCreate.js ***!
  5024. \**************************************************************************/
  5025. /*! no static exports found */
  5026. /***/ (function(module, exports, __webpack_require__) {
  5027. var isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js");
  5028. /** Built-in value references. */
  5029. var objectCreate = Object.create;
  5030. /**
  5031. * The base implementation of `_.create` without support for assigning
  5032. * properties to the created object.
  5033. *
  5034. * @private
  5035. * @param {Object} proto The object to inherit from.
  5036. * @returns {Object} Returns the new object.
  5037. */
  5038. var baseCreate = (function() {
  5039. function object() {}
  5040. return function(proto) {
  5041. if (!isObject(proto)) {
  5042. return {};
  5043. }
  5044. if (objectCreate) {
  5045. return objectCreate(proto);
  5046. }
  5047. object.prototype = proto;
  5048. var result = new object;
  5049. object.prototype = undefined;
  5050. return result;
  5051. };
  5052. }());
  5053. module.exports = baseCreate;
  5054. /***/ }),
  5055. /***/ "../../node_modules/lodash/_baseEach.js":
  5056. /*!************************************************************************!*\
  5057. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseEach.js ***!
  5058. \************************************************************************/
  5059. /*! no static exports found */
  5060. /***/ (function(module, exports, __webpack_require__) {
  5061. var baseForOwn = __webpack_require__(/*! ./_baseForOwn */ "../../node_modules/lodash/_baseForOwn.js"),
  5062. createBaseEach = __webpack_require__(/*! ./_createBaseEach */ "../../node_modules/lodash/_createBaseEach.js");
  5063. /**
  5064. * The base implementation of `_.forEach` without support for iteratee shorthands.
  5065. *
  5066. * @private
  5067. * @param {Array|Object} collection The collection to iterate over.
  5068. * @param {Function} iteratee The function invoked per iteration.
  5069. * @returns {Array|Object} Returns `collection`.
  5070. */
  5071. var baseEach = createBaseEach(baseForOwn);
  5072. module.exports = baseEach;
  5073. /***/ }),
  5074. /***/ "../../node_modules/lodash/_baseExtremum.js":
  5075. /*!****************************************************************************!*\
  5076. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseExtremum.js ***!
  5077. \****************************************************************************/
  5078. /*! no static exports found */
  5079. /***/ (function(module, exports, __webpack_require__) {
  5080. var isSymbol = __webpack_require__(/*! ./isSymbol */ "../../node_modules/lodash/isSymbol.js");
  5081. /**
  5082. * The base implementation of methods like `_.max` and `_.min` which accepts a
  5083. * `comparator` to determine the extremum value.
  5084. *
  5085. * @private
  5086. * @param {Array} array The array to iterate over.
  5087. * @param {Function} iteratee The iteratee invoked per iteration.
  5088. * @param {Function} comparator The comparator used to compare values.
  5089. * @returns {*} Returns the extremum value.
  5090. */
  5091. function baseExtremum(array, iteratee, comparator) {
  5092. var index = -1,
  5093. length = array.length;
  5094. while (++index < length) {
  5095. var value = array[index],
  5096. current = iteratee(value);
  5097. if (current != null && (computed === undefined
  5098. ? (current === current && !isSymbol(current))
  5099. : comparator(current, computed)
  5100. )) {
  5101. var computed = current,
  5102. result = value;
  5103. }
  5104. }
  5105. return result;
  5106. }
  5107. module.exports = baseExtremum;
  5108. /***/ }),
  5109. /***/ "../../node_modules/lodash/_baseFilter.js":
  5110. /*!**************************************************************************!*\
  5111. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseFilter.js ***!
  5112. \**************************************************************************/
  5113. /*! no static exports found */
  5114. /***/ (function(module, exports, __webpack_require__) {
  5115. var baseEach = __webpack_require__(/*! ./_baseEach */ "../../node_modules/lodash/_baseEach.js");
  5116. /**
  5117. * The base implementation of `_.filter` without support for iteratee shorthands.
  5118. *
  5119. * @private
  5120. * @param {Array|Object} collection The collection to iterate over.
  5121. * @param {Function} predicate The function invoked per iteration.
  5122. * @returns {Array} Returns the new filtered array.
  5123. */
  5124. function baseFilter(collection, predicate) {
  5125. var result = [];
  5126. baseEach(collection, function(value, index, collection) {
  5127. if (predicate(value, index, collection)) {
  5128. result.push(value);
  5129. }
  5130. });
  5131. return result;
  5132. }
  5133. module.exports = baseFilter;
  5134. /***/ }),
  5135. /***/ "../../node_modules/lodash/_baseFindIndex.js":
  5136. /*!*****************************************************************************!*\
  5137. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseFindIndex.js ***!
  5138. \*****************************************************************************/
  5139. /*! no static exports found */
  5140. /***/ (function(module, exports) {
  5141. /**
  5142. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  5143. * support for iteratee shorthands.
  5144. *
  5145. * @private
  5146. * @param {Array} array The array to inspect.
  5147. * @param {Function} predicate The function invoked per iteration.
  5148. * @param {number} fromIndex The index to search from.
  5149. * @param {boolean} [fromRight] Specify iterating from right to left.
  5150. * @returns {number} Returns the index of the matched value, else `-1`.
  5151. */
  5152. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  5153. var length = array.length,
  5154. index = fromIndex + (fromRight ? 1 : -1);
  5155. while ((fromRight ? index-- : ++index < length)) {
  5156. if (predicate(array[index], index, array)) {
  5157. return index;
  5158. }
  5159. }
  5160. return -1;
  5161. }
  5162. module.exports = baseFindIndex;
  5163. /***/ }),
  5164. /***/ "../../node_modules/lodash/_baseFlatten.js":
  5165. /*!***************************************************************************!*\
  5166. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseFlatten.js ***!
  5167. \***************************************************************************/
  5168. /*! no static exports found */
  5169. /***/ (function(module, exports, __webpack_require__) {
  5170. var arrayPush = __webpack_require__(/*! ./_arrayPush */ "../../node_modules/lodash/_arrayPush.js"),
  5171. isFlattenable = __webpack_require__(/*! ./_isFlattenable */ "../../node_modules/lodash/_isFlattenable.js");
  5172. /**
  5173. * The base implementation of `_.flatten` with support for restricting flattening.
  5174. *
  5175. * @private
  5176. * @param {Array} array The array to flatten.
  5177. * @param {number} depth The maximum recursion depth.
  5178. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  5179. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  5180. * @param {Array} [result=[]] The initial result value.
  5181. * @returns {Array} Returns the new flattened array.
  5182. */
  5183. function baseFlatten(array, depth, predicate, isStrict, result) {
  5184. var index = -1,
  5185. length = array.length;
  5186. predicate || (predicate = isFlattenable);
  5187. result || (result = []);
  5188. while (++index < length) {
  5189. var value = array[index];
  5190. if (depth > 0 && predicate(value)) {
  5191. if (depth > 1) {
  5192. // Recursively flatten arrays (susceptible to call stack limits).
  5193. baseFlatten(value, depth - 1, predicate, isStrict, result);
  5194. } else {
  5195. arrayPush(result, value);
  5196. }
  5197. } else if (!isStrict) {
  5198. result[result.length] = value;
  5199. }
  5200. }
  5201. return result;
  5202. }
  5203. module.exports = baseFlatten;
  5204. /***/ }),
  5205. /***/ "../../node_modules/lodash/_baseFor.js":
  5206. /*!***********************************************************************!*\
  5207. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseFor.js ***!
  5208. \***********************************************************************/
  5209. /*! no static exports found */
  5210. /***/ (function(module, exports, __webpack_require__) {
  5211. var createBaseFor = __webpack_require__(/*! ./_createBaseFor */ "../../node_modules/lodash/_createBaseFor.js");
  5212. /**
  5213. * The base implementation of `baseForOwn` which iterates over `object`
  5214. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  5215. * Iteratee functions may exit iteration early by explicitly returning `false`.
  5216. *
  5217. * @private
  5218. * @param {Object} object The object to iterate over.
  5219. * @param {Function} iteratee The function invoked per iteration.
  5220. * @param {Function} keysFunc The function to get the keys of `object`.
  5221. * @returns {Object} Returns `object`.
  5222. */
  5223. var baseFor = createBaseFor();
  5224. module.exports = baseFor;
  5225. /***/ }),
  5226. /***/ "../../node_modules/lodash/_baseForOwn.js":
  5227. /*!**************************************************************************!*\
  5228. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseForOwn.js ***!
  5229. \**************************************************************************/
  5230. /*! no static exports found */
  5231. /***/ (function(module, exports, __webpack_require__) {
  5232. var baseFor = __webpack_require__(/*! ./_baseFor */ "../../node_modules/lodash/_baseFor.js"),
  5233. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  5234. /**
  5235. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  5236. *
  5237. * @private
  5238. * @param {Object} object The object to iterate over.
  5239. * @param {Function} iteratee The function invoked per iteration.
  5240. * @returns {Object} Returns `object`.
  5241. */
  5242. function baseForOwn(object, iteratee) {
  5243. return object && baseFor(object, iteratee, keys);
  5244. }
  5245. module.exports = baseForOwn;
  5246. /***/ }),
  5247. /***/ "../../node_modules/lodash/_baseGet.js":
  5248. /*!***********************************************************************!*\
  5249. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseGet.js ***!
  5250. \***********************************************************************/
  5251. /*! no static exports found */
  5252. /***/ (function(module, exports, __webpack_require__) {
  5253. var castPath = __webpack_require__(/*! ./_castPath */ "../../node_modules/lodash/_castPath.js"),
  5254. toKey = __webpack_require__(/*! ./_toKey */ "../../node_modules/lodash/_toKey.js");
  5255. /**
  5256. * The base implementation of `_.get` without support for default values.
  5257. *
  5258. * @private
  5259. * @param {Object} object The object to query.
  5260. * @param {Array|string} path The path of the property to get.
  5261. * @returns {*} Returns the resolved value.
  5262. */
  5263. function baseGet(object, path) {
  5264. path = castPath(path, object);
  5265. var index = 0,
  5266. length = path.length;
  5267. while (object != null && index < length) {
  5268. object = object[toKey(path[index++])];
  5269. }
  5270. return (index && index == length) ? object : undefined;
  5271. }
  5272. module.exports = baseGet;
  5273. /***/ }),
  5274. /***/ "../../node_modules/lodash/_baseGetAllKeys.js":
  5275. /*!******************************************************************************!*\
  5276. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseGetAllKeys.js ***!
  5277. \******************************************************************************/
  5278. /*! no static exports found */
  5279. /***/ (function(module, exports, __webpack_require__) {
  5280. var arrayPush = __webpack_require__(/*! ./_arrayPush */ "../../node_modules/lodash/_arrayPush.js"),
  5281. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
  5282. /**
  5283. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  5284. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  5285. * symbols of `object`.
  5286. *
  5287. * @private
  5288. * @param {Object} object The object to query.
  5289. * @param {Function} keysFunc The function to get the keys of `object`.
  5290. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  5291. * @returns {Array} Returns the array of property names and symbols.
  5292. */
  5293. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  5294. var result = keysFunc(object);
  5295. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  5296. }
  5297. module.exports = baseGetAllKeys;
  5298. /***/ }),
  5299. /***/ "../../node_modules/lodash/_baseGetTag.js":
  5300. /*!**************************************************************************!*\
  5301. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseGetTag.js ***!
  5302. \**************************************************************************/
  5303. /*! no static exports found */
  5304. /***/ (function(module, exports, __webpack_require__) {
  5305. var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js"),
  5306. getRawTag = __webpack_require__(/*! ./_getRawTag */ "../../node_modules/lodash/_getRawTag.js"),
  5307. objectToString = __webpack_require__(/*! ./_objectToString */ "../../node_modules/lodash/_objectToString.js");
  5308. /** `Object#toString` result references. */
  5309. var nullTag = '[object Null]',
  5310. undefinedTag = '[object Undefined]';
  5311. /** Built-in value references. */
  5312. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  5313. /**
  5314. * The base implementation of `getTag` without fallbacks for buggy environments.
  5315. *
  5316. * @private
  5317. * @param {*} value The value to query.
  5318. * @returns {string} Returns the `toStringTag`.
  5319. */
  5320. function baseGetTag(value) {
  5321. if (value == null) {
  5322. return value === undefined ? undefinedTag : nullTag;
  5323. }
  5324. return (symToStringTag && symToStringTag in Object(value))
  5325. ? getRawTag(value)
  5326. : objectToString(value);
  5327. }
  5328. module.exports = baseGetTag;
  5329. /***/ }),
  5330. /***/ "../../node_modules/lodash/_baseGt.js":
  5331. /*!**********************************************************************!*\
  5332. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseGt.js ***!
  5333. \**********************************************************************/
  5334. /*! no static exports found */
  5335. /***/ (function(module, exports) {
  5336. /**
  5337. * The base implementation of `_.gt` which doesn't coerce arguments.
  5338. *
  5339. * @private
  5340. * @param {*} value The value to compare.
  5341. * @param {*} other The other value to compare.
  5342. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  5343. * else `false`.
  5344. */
  5345. function baseGt(value, other) {
  5346. return value > other;
  5347. }
  5348. module.exports = baseGt;
  5349. /***/ }),
  5350. /***/ "../../node_modules/lodash/_baseHas.js":
  5351. /*!***********************************************************************!*\
  5352. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseHas.js ***!
  5353. \***********************************************************************/
  5354. /*! no static exports found */
  5355. /***/ (function(module, exports) {
  5356. /** Used for built-in method references. */
  5357. var objectProto = Object.prototype;
  5358. /** Used to check objects for own properties. */
  5359. var hasOwnProperty = objectProto.hasOwnProperty;
  5360. /**
  5361. * The base implementation of `_.has` without support for deep paths.
  5362. *
  5363. * @private
  5364. * @param {Object} [object] The object to query.
  5365. * @param {Array|string} key The key to check.
  5366. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  5367. */
  5368. function baseHas(object, key) {
  5369. return object != null && hasOwnProperty.call(object, key);
  5370. }
  5371. module.exports = baseHas;
  5372. /***/ }),
  5373. /***/ "../../node_modules/lodash/_baseHasIn.js":
  5374. /*!*************************************************************************!*\
  5375. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseHasIn.js ***!
  5376. \*************************************************************************/
  5377. /*! no static exports found */
  5378. /***/ (function(module, exports) {
  5379. /**
  5380. * The base implementation of `_.hasIn` without support for deep paths.
  5381. *
  5382. * @private
  5383. * @param {Object} [object] The object to query.
  5384. * @param {Array|string} key The key to check.
  5385. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  5386. */
  5387. function baseHasIn(object, key) {
  5388. return object != null && key in Object(object);
  5389. }
  5390. module.exports = baseHasIn;
  5391. /***/ }),
  5392. /***/ "../../node_modules/lodash/_baseIndexOf.js":
  5393. /*!***************************************************************************!*\
  5394. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIndexOf.js ***!
  5395. \***************************************************************************/
  5396. /*! no static exports found */
  5397. /***/ (function(module, exports, __webpack_require__) {
  5398. var baseFindIndex = __webpack_require__(/*! ./_baseFindIndex */ "../../node_modules/lodash/_baseFindIndex.js"),
  5399. baseIsNaN = __webpack_require__(/*! ./_baseIsNaN */ "../../node_modules/lodash/_baseIsNaN.js"),
  5400. strictIndexOf = __webpack_require__(/*! ./_strictIndexOf */ "../../node_modules/lodash/_strictIndexOf.js");
  5401. /**
  5402. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  5403. *
  5404. * @private
  5405. * @param {Array} array The array to inspect.
  5406. * @param {*} value The value to search for.
  5407. * @param {number} fromIndex The index to search from.
  5408. * @returns {number} Returns the index of the matched value, else `-1`.
  5409. */
  5410. function baseIndexOf(array, value, fromIndex) {
  5411. return value === value
  5412. ? strictIndexOf(array, value, fromIndex)
  5413. : baseFindIndex(array, baseIsNaN, fromIndex);
  5414. }
  5415. module.exports = baseIndexOf;
  5416. /***/ }),
  5417. /***/ "../../node_modules/lodash/_baseIsArguments.js":
  5418. /*!*******************************************************************************!*\
  5419. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsArguments.js ***!
  5420. \*******************************************************************************/
  5421. /*! no static exports found */
  5422. /***/ (function(module, exports, __webpack_require__) {
  5423. var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  5424. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  5425. /** `Object#toString` result references. */
  5426. var argsTag = '[object Arguments]';
  5427. /**
  5428. * The base implementation of `_.isArguments`.
  5429. *
  5430. * @private
  5431. * @param {*} value The value to check.
  5432. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  5433. */
  5434. function baseIsArguments(value) {
  5435. return isObjectLike(value) && baseGetTag(value) == argsTag;
  5436. }
  5437. module.exports = baseIsArguments;
  5438. /***/ }),
  5439. /***/ "../../node_modules/lodash/_baseIsEqual.js":
  5440. /*!***************************************************************************!*\
  5441. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsEqual.js ***!
  5442. \***************************************************************************/
  5443. /*! no static exports found */
  5444. /***/ (function(module, exports, __webpack_require__) {
  5445. var baseIsEqualDeep = __webpack_require__(/*! ./_baseIsEqualDeep */ "../../node_modules/lodash/_baseIsEqualDeep.js"),
  5446. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  5447. /**
  5448. * The base implementation of `_.isEqual` which supports partial comparisons
  5449. * and tracks traversed objects.
  5450. *
  5451. * @private
  5452. * @param {*} value The value to compare.
  5453. * @param {*} other The other value to compare.
  5454. * @param {boolean} bitmask The bitmask flags.
  5455. * 1 - Unordered comparison
  5456. * 2 - Partial comparison
  5457. * @param {Function} [customizer] The function to customize comparisons.
  5458. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  5459. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5460. */
  5461. function baseIsEqual(value, other, bitmask, customizer, stack) {
  5462. if (value === other) {
  5463. return true;
  5464. }
  5465. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  5466. return value !== value && other !== other;
  5467. }
  5468. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  5469. }
  5470. module.exports = baseIsEqual;
  5471. /***/ }),
  5472. /***/ "../../node_modules/lodash/_baseIsEqualDeep.js":
  5473. /*!*******************************************************************************!*\
  5474. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsEqualDeep.js ***!
  5475. \*******************************************************************************/
  5476. /*! no static exports found */
  5477. /***/ (function(module, exports, __webpack_require__) {
  5478. var Stack = __webpack_require__(/*! ./_Stack */ "../../node_modules/lodash/_Stack.js"),
  5479. equalArrays = __webpack_require__(/*! ./_equalArrays */ "../../node_modules/lodash/_equalArrays.js"),
  5480. equalByTag = __webpack_require__(/*! ./_equalByTag */ "../../node_modules/lodash/_equalByTag.js"),
  5481. equalObjects = __webpack_require__(/*! ./_equalObjects */ "../../node_modules/lodash/_equalObjects.js"),
  5482. getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
  5483. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  5484. isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
  5485. isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../node_modules/lodash/isTypedArray.js");
  5486. /** Used to compose bitmasks for value comparisons. */
  5487. var COMPARE_PARTIAL_FLAG = 1;
  5488. /** `Object#toString` result references. */
  5489. var argsTag = '[object Arguments]',
  5490. arrayTag = '[object Array]',
  5491. objectTag = '[object Object]';
  5492. /** Used for built-in method references. */
  5493. var objectProto = Object.prototype;
  5494. /** Used to check objects for own properties. */
  5495. var hasOwnProperty = objectProto.hasOwnProperty;
  5496. /**
  5497. * A specialized version of `baseIsEqual` for arrays and objects which performs
  5498. * deep comparisons and tracks traversed objects enabling objects with circular
  5499. * references to be compared.
  5500. *
  5501. * @private
  5502. * @param {Object} object The object to compare.
  5503. * @param {Object} other The other object to compare.
  5504. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  5505. * @param {Function} customizer The function to customize comparisons.
  5506. * @param {Function} equalFunc The function to determine equivalents of values.
  5507. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  5508. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5509. */
  5510. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  5511. var objIsArr = isArray(object),
  5512. othIsArr = isArray(other),
  5513. objTag = objIsArr ? arrayTag : getTag(object),
  5514. othTag = othIsArr ? arrayTag : getTag(other);
  5515. objTag = objTag == argsTag ? objectTag : objTag;
  5516. othTag = othTag == argsTag ? objectTag : othTag;
  5517. var objIsObj = objTag == objectTag,
  5518. othIsObj = othTag == objectTag,
  5519. isSameTag = objTag == othTag;
  5520. if (isSameTag && isBuffer(object)) {
  5521. if (!isBuffer(other)) {
  5522. return false;
  5523. }
  5524. objIsArr = true;
  5525. objIsObj = false;
  5526. }
  5527. if (isSameTag && !objIsObj) {
  5528. stack || (stack = new Stack);
  5529. return (objIsArr || isTypedArray(object))
  5530. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  5531. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  5532. }
  5533. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  5534. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  5535. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  5536. if (objIsWrapped || othIsWrapped) {
  5537. var objUnwrapped = objIsWrapped ? object.value() : object,
  5538. othUnwrapped = othIsWrapped ? other.value() : other;
  5539. stack || (stack = new Stack);
  5540. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  5541. }
  5542. }
  5543. if (!isSameTag) {
  5544. return false;
  5545. }
  5546. stack || (stack = new Stack);
  5547. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  5548. }
  5549. module.exports = baseIsEqualDeep;
  5550. /***/ }),
  5551. /***/ "../../node_modules/lodash/_baseIsMap.js":
  5552. /*!*************************************************************************!*\
  5553. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsMap.js ***!
  5554. \*************************************************************************/
  5555. /*! no static exports found */
  5556. /***/ (function(module, exports, __webpack_require__) {
  5557. var getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
  5558. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  5559. /** `Object#toString` result references. */
  5560. var mapTag = '[object Map]';
  5561. /**
  5562. * The base implementation of `_.isMap` without Node.js optimizations.
  5563. *
  5564. * @private
  5565. * @param {*} value The value to check.
  5566. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  5567. */
  5568. function baseIsMap(value) {
  5569. return isObjectLike(value) && getTag(value) == mapTag;
  5570. }
  5571. module.exports = baseIsMap;
  5572. /***/ }),
  5573. /***/ "../../node_modules/lodash/_baseIsMatch.js":
  5574. /*!***************************************************************************!*\
  5575. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsMatch.js ***!
  5576. \***************************************************************************/
  5577. /*! no static exports found */
  5578. /***/ (function(module, exports, __webpack_require__) {
  5579. var Stack = __webpack_require__(/*! ./_Stack */ "../../node_modules/lodash/_Stack.js"),
  5580. baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "../../node_modules/lodash/_baseIsEqual.js");
  5581. /** Used to compose bitmasks for value comparisons. */
  5582. var COMPARE_PARTIAL_FLAG = 1,
  5583. COMPARE_UNORDERED_FLAG = 2;
  5584. /**
  5585. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  5586. *
  5587. * @private
  5588. * @param {Object} object The object to inspect.
  5589. * @param {Object} source The object of property values to match.
  5590. * @param {Array} matchData The property names, values, and compare flags to match.
  5591. * @param {Function} [customizer] The function to customize comparisons.
  5592. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  5593. */
  5594. function baseIsMatch(object, source, matchData, customizer) {
  5595. var index = matchData.length,
  5596. length = index,
  5597. noCustomizer = !customizer;
  5598. if (object == null) {
  5599. return !length;
  5600. }
  5601. object = Object(object);
  5602. while (index--) {
  5603. var data = matchData[index];
  5604. if ((noCustomizer && data[2])
  5605. ? data[1] !== object[data[0]]
  5606. : !(data[0] in object)
  5607. ) {
  5608. return false;
  5609. }
  5610. }
  5611. while (++index < length) {
  5612. data = matchData[index];
  5613. var key = data[0],
  5614. objValue = object[key],
  5615. srcValue = data[1];
  5616. if (noCustomizer && data[2]) {
  5617. if (objValue === undefined && !(key in object)) {
  5618. return false;
  5619. }
  5620. } else {
  5621. var stack = new Stack;
  5622. if (customizer) {
  5623. var result = customizer(objValue, srcValue, key, object, source, stack);
  5624. }
  5625. if (!(result === undefined
  5626. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  5627. : result
  5628. )) {
  5629. return false;
  5630. }
  5631. }
  5632. }
  5633. return true;
  5634. }
  5635. module.exports = baseIsMatch;
  5636. /***/ }),
  5637. /***/ "../../node_modules/lodash/_baseIsNaN.js":
  5638. /*!*************************************************************************!*\
  5639. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsNaN.js ***!
  5640. \*************************************************************************/
  5641. /*! no static exports found */
  5642. /***/ (function(module, exports) {
  5643. /**
  5644. * The base implementation of `_.isNaN` without support for number objects.
  5645. *
  5646. * @private
  5647. * @param {*} value The value to check.
  5648. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  5649. */
  5650. function baseIsNaN(value) {
  5651. return value !== value;
  5652. }
  5653. module.exports = baseIsNaN;
  5654. /***/ }),
  5655. /***/ "../../node_modules/lodash/_baseIsNative.js":
  5656. /*!****************************************************************************!*\
  5657. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsNative.js ***!
  5658. \****************************************************************************/
  5659. /*! no static exports found */
  5660. /***/ (function(module, exports, __webpack_require__) {
  5661. var isFunction = __webpack_require__(/*! ./isFunction */ "../../node_modules/lodash/isFunction.js"),
  5662. isMasked = __webpack_require__(/*! ./_isMasked */ "../../node_modules/lodash/_isMasked.js"),
  5663. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  5664. toSource = __webpack_require__(/*! ./_toSource */ "../../node_modules/lodash/_toSource.js");
  5665. /**
  5666. * Used to match `RegExp`
  5667. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  5668. */
  5669. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  5670. /** Used to detect host constructors (Safari). */
  5671. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  5672. /** Used for built-in method references. */
  5673. var funcProto = Function.prototype,
  5674. objectProto = Object.prototype;
  5675. /** Used to resolve the decompiled source of functions. */
  5676. var funcToString = funcProto.toString;
  5677. /** Used to check objects for own properties. */
  5678. var hasOwnProperty = objectProto.hasOwnProperty;
  5679. /** Used to detect if a method is native. */
  5680. var reIsNative = RegExp('^' +
  5681. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  5682. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  5683. );
  5684. /**
  5685. * The base implementation of `_.isNative` without bad shim checks.
  5686. *
  5687. * @private
  5688. * @param {*} value The value to check.
  5689. * @returns {boolean} Returns `true` if `value` is a native function,
  5690. * else `false`.
  5691. */
  5692. function baseIsNative(value) {
  5693. if (!isObject(value) || isMasked(value)) {
  5694. return false;
  5695. }
  5696. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  5697. return pattern.test(toSource(value));
  5698. }
  5699. module.exports = baseIsNative;
  5700. /***/ }),
  5701. /***/ "../../node_modules/lodash/_baseIsSet.js":
  5702. /*!*************************************************************************!*\
  5703. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsSet.js ***!
  5704. \*************************************************************************/
  5705. /*! no static exports found */
  5706. /***/ (function(module, exports, __webpack_require__) {
  5707. var getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
  5708. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  5709. /** `Object#toString` result references. */
  5710. var setTag = '[object Set]';
  5711. /**
  5712. * The base implementation of `_.isSet` without Node.js optimizations.
  5713. *
  5714. * @private
  5715. * @param {*} value The value to check.
  5716. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  5717. */
  5718. function baseIsSet(value) {
  5719. return isObjectLike(value) && getTag(value) == setTag;
  5720. }
  5721. module.exports = baseIsSet;
  5722. /***/ }),
  5723. /***/ "../../node_modules/lodash/_baseIsTypedArray.js":
  5724. /*!********************************************************************************!*\
  5725. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIsTypedArray.js ***!
  5726. \********************************************************************************/
  5727. /*! no static exports found */
  5728. /***/ (function(module, exports, __webpack_require__) {
  5729. var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  5730. isLength = __webpack_require__(/*! ./isLength */ "../../node_modules/lodash/isLength.js"),
  5731. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  5732. /** `Object#toString` result references. */
  5733. var argsTag = '[object Arguments]',
  5734. arrayTag = '[object Array]',
  5735. boolTag = '[object Boolean]',
  5736. dateTag = '[object Date]',
  5737. errorTag = '[object Error]',
  5738. funcTag = '[object Function]',
  5739. mapTag = '[object Map]',
  5740. numberTag = '[object Number]',
  5741. objectTag = '[object Object]',
  5742. regexpTag = '[object RegExp]',
  5743. setTag = '[object Set]',
  5744. stringTag = '[object String]',
  5745. weakMapTag = '[object WeakMap]';
  5746. var arrayBufferTag = '[object ArrayBuffer]',
  5747. dataViewTag = '[object DataView]',
  5748. float32Tag = '[object Float32Array]',
  5749. float64Tag = '[object Float64Array]',
  5750. int8Tag = '[object Int8Array]',
  5751. int16Tag = '[object Int16Array]',
  5752. int32Tag = '[object Int32Array]',
  5753. uint8Tag = '[object Uint8Array]',
  5754. uint8ClampedTag = '[object Uint8ClampedArray]',
  5755. uint16Tag = '[object Uint16Array]',
  5756. uint32Tag = '[object Uint32Array]';
  5757. /** Used to identify `toStringTag` values of typed arrays. */
  5758. var typedArrayTags = {};
  5759. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  5760. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  5761. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  5762. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  5763. typedArrayTags[uint32Tag] = true;
  5764. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  5765. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  5766. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  5767. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  5768. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  5769. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  5770. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  5771. typedArrayTags[weakMapTag] = false;
  5772. /**
  5773. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  5774. *
  5775. * @private
  5776. * @param {*} value The value to check.
  5777. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5778. */
  5779. function baseIsTypedArray(value) {
  5780. return isObjectLike(value) &&
  5781. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  5782. }
  5783. module.exports = baseIsTypedArray;
  5784. /***/ }),
  5785. /***/ "../../node_modules/lodash/_baseIteratee.js":
  5786. /*!****************************************************************************!*\
  5787. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseIteratee.js ***!
  5788. \****************************************************************************/
  5789. /*! no static exports found */
  5790. /***/ (function(module, exports, __webpack_require__) {
  5791. var baseMatches = __webpack_require__(/*! ./_baseMatches */ "../../node_modules/lodash/_baseMatches.js"),
  5792. baseMatchesProperty = __webpack_require__(/*! ./_baseMatchesProperty */ "../../node_modules/lodash/_baseMatchesProperty.js"),
  5793. identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js"),
  5794. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  5795. property = __webpack_require__(/*! ./property */ "../../node_modules/lodash/property.js");
  5796. /**
  5797. * The base implementation of `_.iteratee`.
  5798. *
  5799. * @private
  5800. * @param {*} [value=_.identity] The value to convert to an iteratee.
  5801. * @returns {Function} Returns the iteratee.
  5802. */
  5803. function baseIteratee(value) {
  5804. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  5805. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  5806. if (typeof value == 'function') {
  5807. return value;
  5808. }
  5809. if (value == null) {
  5810. return identity;
  5811. }
  5812. if (typeof value == 'object') {
  5813. return isArray(value)
  5814. ? baseMatchesProperty(value[0], value[1])
  5815. : baseMatches(value);
  5816. }
  5817. return property(value);
  5818. }
  5819. module.exports = baseIteratee;
  5820. /***/ }),
  5821. /***/ "../../node_modules/lodash/_baseKeys.js":
  5822. /*!************************************************************************!*\
  5823. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseKeys.js ***!
  5824. \************************************************************************/
  5825. /*! no static exports found */
  5826. /***/ (function(module, exports, __webpack_require__) {
  5827. var isPrototype = __webpack_require__(/*! ./_isPrototype */ "../../node_modules/lodash/_isPrototype.js"),
  5828. nativeKeys = __webpack_require__(/*! ./_nativeKeys */ "../../node_modules/lodash/_nativeKeys.js");
  5829. /** Used for built-in method references. */
  5830. var objectProto = Object.prototype;
  5831. /** Used to check objects for own properties. */
  5832. var hasOwnProperty = objectProto.hasOwnProperty;
  5833. /**
  5834. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  5835. *
  5836. * @private
  5837. * @param {Object} object The object to query.
  5838. * @returns {Array} Returns the array of property names.
  5839. */
  5840. function baseKeys(object) {
  5841. if (!isPrototype(object)) {
  5842. return nativeKeys(object);
  5843. }
  5844. var result = [];
  5845. for (var key in Object(object)) {
  5846. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  5847. result.push(key);
  5848. }
  5849. }
  5850. return result;
  5851. }
  5852. module.exports = baseKeys;
  5853. /***/ }),
  5854. /***/ "../../node_modules/lodash/_baseKeysIn.js":
  5855. /*!**************************************************************************!*\
  5856. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseKeysIn.js ***!
  5857. \**************************************************************************/
  5858. /*! no static exports found */
  5859. /***/ (function(module, exports, __webpack_require__) {
  5860. var isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  5861. isPrototype = __webpack_require__(/*! ./_isPrototype */ "../../node_modules/lodash/_isPrototype.js"),
  5862. nativeKeysIn = __webpack_require__(/*! ./_nativeKeysIn */ "../../node_modules/lodash/_nativeKeysIn.js");
  5863. /** Used for built-in method references. */
  5864. var objectProto = Object.prototype;
  5865. /** Used to check objects for own properties. */
  5866. var hasOwnProperty = objectProto.hasOwnProperty;
  5867. /**
  5868. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  5869. *
  5870. * @private
  5871. * @param {Object} object The object to query.
  5872. * @returns {Array} Returns the array of property names.
  5873. */
  5874. function baseKeysIn(object) {
  5875. if (!isObject(object)) {
  5876. return nativeKeysIn(object);
  5877. }
  5878. var isProto = isPrototype(object),
  5879. result = [];
  5880. for (var key in object) {
  5881. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  5882. result.push(key);
  5883. }
  5884. }
  5885. return result;
  5886. }
  5887. module.exports = baseKeysIn;
  5888. /***/ }),
  5889. /***/ "../../node_modules/lodash/_baseLt.js":
  5890. /*!**********************************************************************!*\
  5891. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseLt.js ***!
  5892. \**********************************************************************/
  5893. /*! no static exports found */
  5894. /***/ (function(module, exports) {
  5895. /**
  5896. * The base implementation of `_.lt` which doesn't coerce arguments.
  5897. *
  5898. * @private
  5899. * @param {*} value The value to compare.
  5900. * @param {*} other The other value to compare.
  5901. * @returns {boolean} Returns `true` if `value` is less than `other`,
  5902. * else `false`.
  5903. */
  5904. function baseLt(value, other) {
  5905. return value < other;
  5906. }
  5907. module.exports = baseLt;
  5908. /***/ }),
  5909. /***/ "../../node_modules/lodash/_baseMap.js":
  5910. /*!***********************************************************************!*\
  5911. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseMap.js ***!
  5912. \***********************************************************************/
  5913. /*! no static exports found */
  5914. /***/ (function(module, exports, __webpack_require__) {
  5915. var baseEach = __webpack_require__(/*! ./_baseEach */ "../../node_modules/lodash/_baseEach.js"),
  5916. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js");
  5917. /**
  5918. * The base implementation of `_.map` without support for iteratee shorthands.
  5919. *
  5920. * @private
  5921. * @param {Array|Object} collection The collection to iterate over.
  5922. * @param {Function} iteratee The function invoked per iteration.
  5923. * @returns {Array} Returns the new mapped array.
  5924. */
  5925. function baseMap(collection, iteratee) {
  5926. var index = -1,
  5927. result = isArrayLike(collection) ? Array(collection.length) : [];
  5928. baseEach(collection, function(value, key, collection) {
  5929. result[++index] = iteratee(value, key, collection);
  5930. });
  5931. return result;
  5932. }
  5933. module.exports = baseMap;
  5934. /***/ }),
  5935. /***/ "../../node_modules/lodash/_baseMatches.js":
  5936. /*!***************************************************************************!*\
  5937. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseMatches.js ***!
  5938. \***************************************************************************/
  5939. /*! no static exports found */
  5940. /***/ (function(module, exports, __webpack_require__) {
  5941. var baseIsMatch = __webpack_require__(/*! ./_baseIsMatch */ "../../node_modules/lodash/_baseIsMatch.js"),
  5942. getMatchData = __webpack_require__(/*! ./_getMatchData */ "../../node_modules/lodash/_getMatchData.js"),
  5943. matchesStrictComparable = __webpack_require__(/*! ./_matchesStrictComparable */ "../../node_modules/lodash/_matchesStrictComparable.js");
  5944. /**
  5945. * The base implementation of `_.matches` which doesn't clone `source`.
  5946. *
  5947. * @private
  5948. * @param {Object} source The object of property values to match.
  5949. * @returns {Function} Returns the new spec function.
  5950. */
  5951. function baseMatches(source) {
  5952. var matchData = getMatchData(source);
  5953. if (matchData.length == 1 && matchData[0][2]) {
  5954. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  5955. }
  5956. return function(object) {
  5957. return object === source || baseIsMatch(object, source, matchData);
  5958. };
  5959. }
  5960. module.exports = baseMatches;
  5961. /***/ }),
  5962. /***/ "../../node_modules/lodash/_baseMatchesProperty.js":
  5963. /*!***********************************************************************************!*\
  5964. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseMatchesProperty.js ***!
  5965. \***********************************************************************************/
  5966. /*! no static exports found */
  5967. /***/ (function(module, exports, __webpack_require__) {
  5968. var baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "../../node_modules/lodash/_baseIsEqual.js"),
  5969. get = __webpack_require__(/*! ./get */ "../../node_modules/lodash/get.js"),
  5970. hasIn = __webpack_require__(/*! ./hasIn */ "../../node_modules/lodash/hasIn.js"),
  5971. isKey = __webpack_require__(/*! ./_isKey */ "../../node_modules/lodash/_isKey.js"),
  5972. isStrictComparable = __webpack_require__(/*! ./_isStrictComparable */ "../../node_modules/lodash/_isStrictComparable.js"),
  5973. matchesStrictComparable = __webpack_require__(/*! ./_matchesStrictComparable */ "../../node_modules/lodash/_matchesStrictComparable.js"),
  5974. toKey = __webpack_require__(/*! ./_toKey */ "../../node_modules/lodash/_toKey.js");
  5975. /** Used to compose bitmasks for value comparisons. */
  5976. var COMPARE_PARTIAL_FLAG = 1,
  5977. COMPARE_UNORDERED_FLAG = 2;
  5978. /**
  5979. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  5980. *
  5981. * @private
  5982. * @param {string} path The path of the property to get.
  5983. * @param {*} srcValue The value to match.
  5984. * @returns {Function} Returns the new spec function.
  5985. */
  5986. function baseMatchesProperty(path, srcValue) {
  5987. if (isKey(path) && isStrictComparable(srcValue)) {
  5988. return matchesStrictComparable(toKey(path), srcValue);
  5989. }
  5990. return function(object) {
  5991. var objValue = get(object, path);
  5992. return (objValue === undefined && objValue === srcValue)
  5993. ? hasIn(object, path)
  5994. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  5995. };
  5996. }
  5997. module.exports = baseMatchesProperty;
  5998. /***/ }),
  5999. /***/ "../../node_modules/lodash/_baseMerge.js":
  6000. /*!*************************************************************************!*\
  6001. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseMerge.js ***!
  6002. \*************************************************************************/
  6003. /*! no static exports found */
  6004. /***/ (function(module, exports, __webpack_require__) {
  6005. var Stack = __webpack_require__(/*! ./_Stack */ "../../node_modules/lodash/_Stack.js"),
  6006. assignMergeValue = __webpack_require__(/*! ./_assignMergeValue */ "../../node_modules/lodash/_assignMergeValue.js"),
  6007. baseFor = __webpack_require__(/*! ./_baseFor */ "../../node_modules/lodash/_baseFor.js"),
  6008. baseMergeDeep = __webpack_require__(/*! ./_baseMergeDeep */ "../../node_modules/lodash/_baseMergeDeep.js"),
  6009. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  6010. keysIn = __webpack_require__(/*! ./keysIn */ "../../node_modules/lodash/keysIn.js"),
  6011. safeGet = __webpack_require__(/*! ./_safeGet */ "../../node_modules/lodash/_safeGet.js");
  6012. /**
  6013. * The base implementation of `_.merge` without support for multiple sources.
  6014. *
  6015. * @private
  6016. * @param {Object} object The destination object.
  6017. * @param {Object} source The source object.
  6018. * @param {number} srcIndex The index of `source`.
  6019. * @param {Function} [customizer] The function to customize merged values.
  6020. * @param {Object} [stack] Tracks traversed source values and their merged
  6021. * counterparts.
  6022. */
  6023. function baseMerge(object, source, srcIndex, customizer, stack) {
  6024. if (object === source) {
  6025. return;
  6026. }
  6027. baseFor(source, function(srcValue, key) {
  6028. stack || (stack = new Stack);
  6029. if (isObject(srcValue)) {
  6030. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  6031. }
  6032. else {
  6033. var newValue = customizer
  6034. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  6035. : undefined;
  6036. if (newValue === undefined) {
  6037. newValue = srcValue;
  6038. }
  6039. assignMergeValue(object, key, newValue);
  6040. }
  6041. }, keysIn);
  6042. }
  6043. module.exports = baseMerge;
  6044. /***/ }),
  6045. /***/ "../../node_modules/lodash/_baseMergeDeep.js":
  6046. /*!*****************************************************************************!*\
  6047. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseMergeDeep.js ***!
  6048. \*****************************************************************************/
  6049. /*! no static exports found */
  6050. /***/ (function(module, exports, __webpack_require__) {
  6051. var assignMergeValue = __webpack_require__(/*! ./_assignMergeValue */ "../../node_modules/lodash/_assignMergeValue.js"),
  6052. cloneBuffer = __webpack_require__(/*! ./_cloneBuffer */ "../../node_modules/lodash/_cloneBuffer.js"),
  6053. cloneTypedArray = __webpack_require__(/*! ./_cloneTypedArray */ "../../node_modules/lodash/_cloneTypedArray.js"),
  6054. copyArray = __webpack_require__(/*! ./_copyArray */ "../../node_modules/lodash/_copyArray.js"),
  6055. initCloneObject = __webpack_require__(/*! ./_initCloneObject */ "../../node_modules/lodash/_initCloneObject.js"),
  6056. isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
  6057. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  6058. isArrayLikeObject = __webpack_require__(/*! ./isArrayLikeObject */ "../../node_modules/lodash/isArrayLikeObject.js"),
  6059. isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
  6060. isFunction = __webpack_require__(/*! ./isFunction */ "../../node_modules/lodash/isFunction.js"),
  6061. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  6062. isPlainObject = __webpack_require__(/*! ./isPlainObject */ "../../node_modules/lodash/isPlainObject.js"),
  6063. isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../node_modules/lodash/isTypedArray.js"),
  6064. safeGet = __webpack_require__(/*! ./_safeGet */ "../../node_modules/lodash/_safeGet.js"),
  6065. toPlainObject = __webpack_require__(/*! ./toPlainObject */ "../../node_modules/lodash/toPlainObject.js");
  6066. /**
  6067. * A specialized version of `baseMerge` for arrays and objects which performs
  6068. * deep merges and tracks traversed objects enabling objects with circular
  6069. * references to be merged.
  6070. *
  6071. * @private
  6072. * @param {Object} object The destination object.
  6073. * @param {Object} source The source object.
  6074. * @param {string} key The key of the value to merge.
  6075. * @param {number} srcIndex The index of `source`.
  6076. * @param {Function} mergeFunc The function to merge values.
  6077. * @param {Function} [customizer] The function to customize assigned values.
  6078. * @param {Object} [stack] Tracks traversed source values and their merged
  6079. * counterparts.
  6080. */
  6081. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  6082. var objValue = safeGet(object, key),
  6083. srcValue = safeGet(source, key),
  6084. stacked = stack.get(srcValue);
  6085. if (stacked) {
  6086. assignMergeValue(object, key, stacked);
  6087. return;
  6088. }
  6089. var newValue = customizer
  6090. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  6091. : undefined;
  6092. var isCommon = newValue === undefined;
  6093. if (isCommon) {
  6094. var isArr = isArray(srcValue),
  6095. isBuff = !isArr && isBuffer(srcValue),
  6096. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  6097. newValue = srcValue;
  6098. if (isArr || isBuff || isTyped) {
  6099. if (isArray(objValue)) {
  6100. newValue = objValue;
  6101. }
  6102. else if (isArrayLikeObject(objValue)) {
  6103. newValue = copyArray(objValue);
  6104. }
  6105. else if (isBuff) {
  6106. isCommon = false;
  6107. newValue = cloneBuffer(srcValue, true);
  6108. }
  6109. else if (isTyped) {
  6110. isCommon = false;
  6111. newValue = cloneTypedArray(srcValue, true);
  6112. }
  6113. else {
  6114. newValue = [];
  6115. }
  6116. }
  6117. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  6118. newValue = objValue;
  6119. if (isArguments(objValue)) {
  6120. newValue = toPlainObject(objValue);
  6121. }
  6122. else if (!isObject(objValue) || isFunction(objValue)) {
  6123. newValue = initCloneObject(srcValue);
  6124. }
  6125. }
  6126. else {
  6127. isCommon = false;
  6128. }
  6129. }
  6130. if (isCommon) {
  6131. // Recursively merge objects and arrays (susceptible to call stack limits).
  6132. stack.set(srcValue, newValue);
  6133. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  6134. stack['delete'](srcValue);
  6135. }
  6136. assignMergeValue(object, key, newValue);
  6137. }
  6138. module.exports = baseMergeDeep;
  6139. /***/ }),
  6140. /***/ "../../node_modules/lodash/_baseOrderBy.js":
  6141. /*!***************************************************************************!*\
  6142. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseOrderBy.js ***!
  6143. \***************************************************************************/
  6144. /*! no static exports found */
  6145. /***/ (function(module, exports, __webpack_require__) {
  6146. var arrayMap = __webpack_require__(/*! ./_arrayMap */ "../../node_modules/lodash/_arrayMap.js"),
  6147. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  6148. baseMap = __webpack_require__(/*! ./_baseMap */ "../../node_modules/lodash/_baseMap.js"),
  6149. baseSortBy = __webpack_require__(/*! ./_baseSortBy */ "../../node_modules/lodash/_baseSortBy.js"),
  6150. baseUnary = __webpack_require__(/*! ./_baseUnary */ "../../node_modules/lodash/_baseUnary.js"),
  6151. compareMultiple = __webpack_require__(/*! ./_compareMultiple */ "../../node_modules/lodash/_compareMultiple.js"),
  6152. identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js");
  6153. /**
  6154. * The base implementation of `_.orderBy` without param guards.
  6155. *
  6156. * @private
  6157. * @param {Array|Object} collection The collection to iterate over.
  6158. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  6159. * @param {string[]} orders The sort orders of `iteratees`.
  6160. * @returns {Array} Returns the new sorted array.
  6161. */
  6162. function baseOrderBy(collection, iteratees, orders) {
  6163. var index = -1;
  6164. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
  6165. var result = baseMap(collection, function(value, key, collection) {
  6166. var criteria = arrayMap(iteratees, function(iteratee) {
  6167. return iteratee(value);
  6168. });
  6169. return { 'criteria': criteria, 'index': ++index, 'value': value };
  6170. });
  6171. return baseSortBy(result, function(object, other) {
  6172. return compareMultiple(object, other, orders);
  6173. });
  6174. }
  6175. module.exports = baseOrderBy;
  6176. /***/ }),
  6177. /***/ "../../node_modules/lodash/_basePick.js":
  6178. /*!************************************************************************!*\
  6179. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_basePick.js ***!
  6180. \************************************************************************/
  6181. /*! no static exports found */
  6182. /***/ (function(module, exports, __webpack_require__) {
  6183. var basePickBy = __webpack_require__(/*! ./_basePickBy */ "../../node_modules/lodash/_basePickBy.js"),
  6184. hasIn = __webpack_require__(/*! ./hasIn */ "../../node_modules/lodash/hasIn.js");
  6185. /**
  6186. * The base implementation of `_.pick` without support for individual
  6187. * property identifiers.
  6188. *
  6189. * @private
  6190. * @param {Object} object The source object.
  6191. * @param {string[]} paths The property paths to pick.
  6192. * @returns {Object} Returns the new object.
  6193. */
  6194. function basePick(object, paths) {
  6195. return basePickBy(object, paths, function(value, path) {
  6196. return hasIn(object, path);
  6197. });
  6198. }
  6199. module.exports = basePick;
  6200. /***/ }),
  6201. /***/ "../../node_modules/lodash/_basePickBy.js":
  6202. /*!**************************************************************************!*\
  6203. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_basePickBy.js ***!
  6204. \**************************************************************************/
  6205. /*! no static exports found */
  6206. /***/ (function(module, exports, __webpack_require__) {
  6207. var baseGet = __webpack_require__(/*! ./_baseGet */ "../../node_modules/lodash/_baseGet.js"),
  6208. baseSet = __webpack_require__(/*! ./_baseSet */ "../../node_modules/lodash/_baseSet.js"),
  6209. castPath = __webpack_require__(/*! ./_castPath */ "../../node_modules/lodash/_castPath.js");
  6210. /**
  6211. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  6212. *
  6213. * @private
  6214. * @param {Object} object The source object.
  6215. * @param {string[]} paths The property paths to pick.
  6216. * @param {Function} predicate The function invoked per property.
  6217. * @returns {Object} Returns the new object.
  6218. */
  6219. function basePickBy(object, paths, predicate) {
  6220. var index = -1,
  6221. length = paths.length,
  6222. result = {};
  6223. while (++index < length) {
  6224. var path = paths[index],
  6225. value = baseGet(object, path);
  6226. if (predicate(value, path)) {
  6227. baseSet(result, castPath(path, object), value);
  6228. }
  6229. }
  6230. return result;
  6231. }
  6232. module.exports = basePickBy;
  6233. /***/ }),
  6234. /***/ "../../node_modules/lodash/_baseProperty.js":
  6235. /*!****************************************************************************!*\
  6236. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseProperty.js ***!
  6237. \****************************************************************************/
  6238. /*! no static exports found */
  6239. /***/ (function(module, exports) {
  6240. /**
  6241. * The base implementation of `_.property` without support for deep paths.
  6242. *
  6243. * @private
  6244. * @param {string} key The key of the property to get.
  6245. * @returns {Function} Returns the new accessor function.
  6246. */
  6247. function baseProperty(key) {
  6248. return function(object) {
  6249. return object == null ? undefined : object[key];
  6250. };
  6251. }
  6252. module.exports = baseProperty;
  6253. /***/ }),
  6254. /***/ "../../node_modules/lodash/_basePropertyDeep.js":
  6255. /*!********************************************************************************!*\
  6256. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_basePropertyDeep.js ***!
  6257. \********************************************************************************/
  6258. /*! no static exports found */
  6259. /***/ (function(module, exports, __webpack_require__) {
  6260. var baseGet = __webpack_require__(/*! ./_baseGet */ "../../node_modules/lodash/_baseGet.js");
  6261. /**
  6262. * A specialized version of `baseProperty` which supports deep paths.
  6263. *
  6264. * @private
  6265. * @param {Array|string} path The path of the property to get.
  6266. * @returns {Function} Returns the new accessor function.
  6267. */
  6268. function basePropertyDeep(path) {
  6269. return function(object) {
  6270. return baseGet(object, path);
  6271. };
  6272. }
  6273. module.exports = basePropertyDeep;
  6274. /***/ }),
  6275. /***/ "../../node_modules/lodash/_baseRange.js":
  6276. /*!*************************************************************************!*\
  6277. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseRange.js ***!
  6278. \*************************************************************************/
  6279. /*! no static exports found */
  6280. /***/ (function(module, exports) {
  6281. /* Built-in method references for those with the same name as other `lodash` methods. */
  6282. var nativeCeil = Math.ceil,
  6283. nativeMax = Math.max;
  6284. /**
  6285. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  6286. * coerce arguments.
  6287. *
  6288. * @private
  6289. * @param {number} start The start of the range.
  6290. * @param {number} end The end of the range.
  6291. * @param {number} step The value to increment or decrement by.
  6292. * @param {boolean} [fromRight] Specify iterating from right to left.
  6293. * @returns {Array} Returns the range of numbers.
  6294. */
  6295. function baseRange(start, end, step, fromRight) {
  6296. var index = -1,
  6297. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  6298. result = Array(length);
  6299. while (length--) {
  6300. result[fromRight ? length : ++index] = start;
  6301. start += step;
  6302. }
  6303. return result;
  6304. }
  6305. module.exports = baseRange;
  6306. /***/ }),
  6307. /***/ "../../node_modules/lodash/_baseReduce.js":
  6308. /*!**************************************************************************!*\
  6309. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseReduce.js ***!
  6310. \**************************************************************************/
  6311. /*! no static exports found */
  6312. /***/ (function(module, exports) {
  6313. /**
  6314. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  6315. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  6316. *
  6317. * @private
  6318. * @param {Array|Object} collection The collection to iterate over.
  6319. * @param {Function} iteratee The function invoked per iteration.
  6320. * @param {*} accumulator The initial value.
  6321. * @param {boolean} initAccum Specify using the first or last element of
  6322. * `collection` as the initial value.
  6323. * @param {Function} eachFunc The function to iterate over `collection`.
  6324. * @returns {*} Returns the accumulated value.
  6325. */
  6326. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  6327. eachFunc(collection, function(value, index, collection) {
  6328. accumulator = initAccum
  6329. ? (initAccum = false, value)
  6330. : iteratee(accumulator, value, index, collection);
  6331. });
  6332. return accumulator;
  6333. }
  6334. module.exports = baseReduce;
  6335. /***/ }),
  6336. /***/ "../../node_modules/lodash/_baseRest.js":
  6337. /*!************************************************************************!*\
  6338. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseRest.js ***!
  6339. \************************************************************************/
  6340. /*! no static exports found */
  6341. /***/ (function(module, exports, __webpack_require__) {
  6342. var identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js"),
  6343. overRest = __webpack_require__(/*! ./_overRest */ "../../node_modules/lodash/_overRest.js"),
  6344. setToString = __webpack_require__(/*! ./_setToString */ "../../node_modules/lodash/_setToString.js");
  6345. /**
  6346. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  6347. *
  6348. * @private
  6349. * @param {Function} func The function to apply a rest parameter to.
  6350. * @param {number} [start=func.length-1] The start position of the rest parameter.
  6351. * @returns {Function} Returns the new function.
  6352. */
  6353. function baseRest(func, start) {
  6354. return setToString(overRest(func, start, identity), func + '');
  6355. }
  6356. module.exports = baseRest;
  6357. /***/ }),
  6358. /***/ "../../node_modules/lodash/_baseSet.js":
  6359. /*!***********************************************************************!*\
  6360. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseSet.js ***!
  6361. \***********************************************************************/
  6362. /*! no static exports found */
  6363. /***/ (function(module, exports, __webpack_require__) {
  6364. var assignValue = __webpack_require__(/*! ./_assignValue */ "../../node_modules/lodash/_assignValue.js"),
  6365. castPath = __webpack_require__(/*! ./_castPath */ "../../node_modules/lodash/_castPath.js"),
  6366. isIndex = __webpack_require__(/*! ./_isIndex */ "../../node_modules/lodash/_isIndex.js"),
  6367. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  6368. toKey = __webpack_require__(/*! ./_toKey */ "../../node_modules/lodash/_toKey.js");
  6369. /**
  6370. * The base implementation of `_.set`.
  6371. *
  6372. * @private
  6373. * @param {Object} object The object to modify.
  6374. * @param {Array|string} path The path of the property to set.
  6375. * @param {*} value The value to set.
  6376. * @param {Function} [customizer] The function to customize path creation.
  6377. * @returns {Object} Returns `object`.
  6378. */
  6379. function baseSet(object, path, value, customizer) {
  6380. if (!isObject(object)) {
  6381. return object;
  6382. }
  6383. path = castPath(path, object);
  6384. var index = -1,
  6385. length = path.length,
  6386. lastIndex = length - 1,
  6387. nested = object;
  6388. while (nested != null && ++index < length) {
  6389. var key = toKey(path[index]),
  6390. newValue = value;
  6391. if (index != lastIndex) {
  6392. var objValue = nested[key];
  6393. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  6394. if (newValue === undefined) {
  6395. newValue = isObject(objValue)
  6396. ? objValue
  6397. : (isIndex(path[index + 1]) ? [] : {});
  6398. }
  6399. }
  6400. assignValue(nested, key, newValue);
  6401. nested = nested[key];
  6402. }
  6403. return object;
  6404. }
  6405. module.exports = baseSet;
  6406. /***/ }),
  6407. /***/ "../../node_modules/lodash/_baseSetToString.js":
  6408. /*!*******************************************************************************!*\
  6409. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseSetToString.js ***!
  6410. \*******************************************************************************/
  6411. /*! no static exports found */
  6412. /***/ (function(module, exports, __webpack_require__) {
  6413. var constant = __webpack_require__(/*! ./constant */ "../../node_modules/lodash/constant.js"),
  6414. defineProperty = __webpack_require__(/*! ./_defineProperty */ "../../node_modules/lodash/_defineProperty.js"),
  6415. identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js");
  6416. /**
  6417. * The base implementation of `setToString` without support for hot loop shorting.
  6418. *
  6419. * @private
  6420. * @param {Function} func The function to modify.
  6421. * @param {Function} string The `toString` result.
  6422. * @returns {Function} Returns `func`.
  6423. */
  6424. var baseSetToString = !defineProperty ? identity : function(func, string) {
  6425. return defineProperty(func, 'toString', {
  6426. 'configurable': true,
  6427. 'enumerable': false,
  6428. 'value': constant(string),
  6429. 'writable': true
  6430. });
  6431. };
  6432. module.exports = baseSetToString;
  6433. /***/ }),
  6434. /***/ "../../node_modules/lodash/_baseSortBy.js":
  6435. /*!**************************************************************************!*\
  6436. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseSortBy.js ***!
  6437. \**************************************************************************/
  6438. /*! no static exports found */
  6439. /***/ (function(module, exports) {
  6440. /**
  6441. * The base implementation of `_.sortBy` which uses `comparer` to define the
  6442. * sort order of `array` and replaces criteria objects with their corresponding
  6443. * values.
  6444. *
  6445. * @private
  6446. * @param {Array} array The array to sort.
  6447. * @param {Function} comparer The function to define sort order.
  6448. * @returns {Array} Returns `array`.
  6449. */
  6450. function baseSortBy(array, comparer) {
  6451. var length = array.length;
  6452. array.sort(comparer);
  6453. while (length--) {
  6454. array[length] = array[length].value;
  6455. }
  6456. return array;
  6457. }
  6458. module.exports = baseSortBy;
  6459. /***/ }),
  6460. /***/ "../../node_modules/lodash/_baseTimes.js":
  6461. /*!*************************************************************************!*\
  6462. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseTimes.js ***!
  6463. \*************************************************************************/
  6464. /*! no static exports found */
  6465. /***/ (function(module, exports) {
  6466. /**
  6467. * The base implementation of `_.times` without support for iteratee shorthands
  6468. * or max array length checks.
  6469. *
  6470. * @private
  6471. * @param {number} n The number of times to invoke `iteratee`.
  6472. * @param {Function} iteratee The function invoked per iteration.
  6473. * @returns {Array} Returns the array of results.
  6474. */
  6475. function baseTimes(n, iteratee) {
  6476. var index = -1,
  6477. result = Array(n);
  6478. while (++index < n) {
  6479. result[index] = iteratee(index);
  6480. }
  6481. return result;
  6482. }
  6483. module.exports = baseTimes;
  6484. /***/ }),
  6485. /***/ "../../node_modules/lodash/_baseToString.js":
  6486. /*!****************************************************************************!*\
  6487. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseToString.js ***!
  6488. \****************************************************************************/
  6489. /*! no static exports found */
  6490. /***/ (function(module, exports, __webpack_require__) {
  6491. var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js"),
  6492. arrayMap = __webpack_require__(/*! ./_arrayMap */ "../../node_modules/lodash/_arrayMap.js"),
  6493. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  6494. isSymbol = __webpack_require__(/*! ./isSymbol */ "../../node_modules/lodash/isSymbol.js");
  6495. /** Used as references for various `Number` constants. */
  6496. var INFINITY = 1 / 0;
  6497. /** Used to convert symbols to primitives and strings. */
  6498. var symbolProto = Symbol ? Symbol.prototype : undefined,
  6499. symbolToString = symbolProto ? symbolProto.toString : undefined;
  6500. /**
  6501. * The base implementation of `_.toString` which doesn't convert nullish
  6502. * values to empty strings.
  6503. *
  6504. * @private
  6505. * @param {*} value The value to process.
  6506. * @returns {string} Returns the string.
  6507. */
  6508. function baseToString(value) {
  6509. // Exit early for strings to avoid a performance hit in some environments.
  6510. if (typeof value == 'string') {
  6511. return value;
  6512. }
  6513. if (isArray(value)) {
  6514. // Recursively convert values (susceptible to call stack limits).
  6515. return arrayMap(value, baseToString) + '';
  6516. }
  6517. if (isSymbol(value)) {
  6518. return symbolToString ? symbolToString.call(value) : '';
  6519. }
  6520. var result = (value + '');
  6521. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  6522. }
  6523. module.exports = baseToString;
  6524. /***/ }),
  6525. /***/ "../../node_modules/lodash/_baseUnary.js":
  6526. /*!*************************************************************************!*\
  6527. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseUnary.js ***!
  6528. \*************************************************************************/
  6529. /*! no static exports found */
  6530. /***/ (function(module, exports) {
  6531. /**
  6532. * The base implementation of `_.unary` without support for storing metadata.
  6533. *
  6534. * @private
  6535. * @param {Function} func The function to cap arguments for.
  6536. * @returns {Function} Returns the new capped function.
  6537. */
  6538. function baseUnary(func) {
  6539. return function(value) {
  6540. return func(value);
  6541. };
  6542. }
  6543. module.exports = baseUnary;
  6544. /***/ }),
  6545. /***/ "../../node_modules/lodash/_baseUniq.js":
  6546. /*!************************************************************************!*\
  6547. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseUniq.js ***!
  6548. \************************************************************************/
  6549. /*! no static exports found */
  6550. /***/ (function(module, exports, __webpack_require__) {
  6551. var SetCache = __webpack_require__(/*! ./_SetCache */ "../../node_modules/lodash/_SetCache.js"),
  6552. arrayIncludes = __webpack_require__(/*! ./_arrayIncludes */ "../../node_modules/lodash/_arrayIncludes.js"),
  6553. arrayIncludesWith = __webpack_require__(/*! ./_arrayIncludesWith */ "../../node_modules/lodash/_arrayIncludesWith.js"),
  6554. cacheHas = __webpack_require__(/*! ./_cacheHas */ "../../node_modules/lodash/_cacheHas.js"),
  6555. createSet = __webpack_require__(/*! ./_createSet */ "../../node_modules/lodash/_createSet.js"),
  6556. setToArray = __webpack_require__(/*! ./_setToArray */ "../../node_modules/lodash/_setToArray.js");
  6557. /** Used as the size to enable large array optimizations. */
  6558. var LARGE_ARRAY_SIZE = 200;
  6559. /**
  6560. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  6561. *
  6562. * @private
  6563. * @param {Array} array The array to inspect.
  6564. * @param {Function} [iteratee] The iteratee invoked per element.
  6565. * @param {Function} [comparator] The comparator invoked per element.
  6566. * @returns {Array} Returns the new duplicate free array.
  6567. */
  6568. function baseUniq(array, iteratee, comparator) {
  6569. var index = -1,
  6570. includes = arrayIncludes,
  6571. length = array.length,
  6572. isCommon = true,
  6573. result = [],
  6574. seen = result;
  6575. if (comparator) {
  6576. isCommon = false;
  6577. includes = arrayIncludesWith;
  6578. }
  6579. else if (length >= LARGE_ARRAY_SIZE) {
  6580. var set = iteratee ? null : createSet(array);
  6581. if (set) {
  6582. return setToArray(set);
  6583. }
  6584. isCommon = false;
  6585. includes = cacheHas;
  6586. seen = new SetCache;
  6587. }
  6588. else {
  6589. seen = iteratee ? [] : result;
  6590. }
  6591. outer:
  6592. while (++index < length) {
  6593. var value = array[index],
  6594. computed = iteratee ? iteratee(value) : value;
  6595. value = (comparator || value !== 0) ? value : 0;
  6596. if (isCommon && computed === computed) {
  6597. var seenIndex = seen.length;
  6598. while (seenIndex--) {
  6599. if (seen[seenIndex] === computed) {
  6600. continue outer;
  6601. }
  6602. }
  6603. if (iteratee) {
  6604. seen.push(computed);
  6605. }
  6606. result.push(value);
  6607. }
  6608. else if (!includes(seen, computed, comparator)) {
  6609. if (seen !== result) {
  6610. seen.push(computed);
  6611. }
  6612. result.push(value);
  6613. }
  6614. }
  6615. return result;
  6616. }
  6617. module.exports = baseUniq;
  6618. /***/ }),
  6619. /***/ "../../node_modules/lodash/_baseValues.js":
  6620. /*!**************************************************************************!*\
  6621. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseValues.js ***!
  6622. \**************************************************************************/
  6623. /*! no static exports found */
  6624. /***/ (function(module, exports, __webpack_require__) {
  6625. var arrayMap = __webpack_require__(/*! ./_arrayMap */ "../../node_modules/lodash/_arrayMap.js");
  6626. /**
  6627. * The base implementation of `_.values` and `_.valuesIn` which creates an
  6628. * array of `object` property values corresponding to the property names
  6629. * of `props`.
  6630. *
  6631. * @private
  6632. * @param {Object} object The object to query.
  6633. * @param {Array} props The property names to get values for.
  6634. * @returns {Object} Returns the array of property values.
  6635. */
  6636. function baseValues(object, props) {
  6637. return arrayMap(props, function(key) {
  6638. return object[key];
  6639. });
  6640. }
  6641. module.exports = baseValues;
  6642. /***/ }),
  6643. /***/ "../../node_modules/lodash/_baseZipObject.js":
  6644. /*!*****************************************************************************!*\
  6645. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_baseZipObject.js ***!
  6646. \*****************************************************************************/
  6647. /*! no static exports found */
  6648. /***/ (function(module, exports) {
  6649. /**
  6650. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  6651. *
  6652. * @private
  6653. * @param {Array} props The property identifiers.
  6654. * @param {Array} values The property values.
  6655. * @param {Function} assignFunc The function to assign values.
  6656. * @returns {Object} Returns the new object.
  6657. */
  6658. function baseZipObject(props, values, assignFunc) {
  6659. var index = -1,
  6660. length = props.length,
  6661. valsLength = values.length,
  6662. result = {};
  6663. while (++index < length) {
  6664. var value = index < valsLength ? values[index] : undefined;
  6665. assignFunc(result, props[index], value);
  6666. }
  6667. return result;
  6668. }
  6669. module.exports = baseZipObject;
  6670. /***/ }),
  6671. /***/ "../../node_modules/lodash/_cacheHas.js":
  6672. /*!************************************************************************!*\
  6673. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cacheHas.js ***!
  6674. \************************************************************************/
  6675. /*! no static exports found */
  6676. /***/ (function(module, exports) {
  6677. /**
  6678. * Checks if a `cache` value for `key` exists.
  6679. *
  6680. * @private
  6681. * @param {Object} cache The cache to query.
  6682. * @param {string} key The key of the entry to check.
  6683. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  6684. */
  6685. function cacheHas(cache, key) {
  6686. return cache.has(key);
  6687. }
  6688. module.exports = cacheHas;
  6689. /***/ }),
  6690. /***/ "../../node_modules/lodash/_castFunction.js":
  6691. /*!****************************************************************************!*\
  6692. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_castFunction.js ***!
  6693. \****************************************************************************/
  6694. /*! no static exports found */
  6695. /***/ (function(module, exports, __webpack_require__) {
  6696. var identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js");
  6697. /**
  6698. * Casts `value` to `identity` if it's not a function.
  6699. *
  6700. * @private
  6701. * @param {*} value The value to inspect.
  6702. * @returns {Function} Returns cast function.
  6703. */
  6704. function castFunction(value) {
  6705. return typeof value == 'function' ? value : identity;
  6706. }
  6707. module.exports = castFunction;
  6708. /***/ }),
  6709. /***/ "../../node_modules/lodash/_castPath.js":
  6710. /*!************************************************************************!*\
  6711. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_castPath.js ***!
  6712. \************************************************************************/
  6713. /*! no static exports found */
  6714. /***/ (function(module, exports, __webpack_require__) {
  6715. var isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  6716. isKey = __webpack_require__(/*! ./_isKey */ "../../node_modules/lodash/_isKey.js"),
  6717. stringToPath = __webpack_require__(/*! ./_stringToPath */ "../../node_modules/lodash/_stringToPath.js"),
  6718. toString = __webpack_require__(/*! ./toString */ "../../node_modules/lodash/toString.js");
  6719. /**
  6720. * Casts `value` to a path array if it's not one.
  6721. *
  6722. * @private
  6723. * @param {*} value The value to inspect.
  6724. * @param {Object} [object] The object to query keys on.
  6725. * @returns {Array} Returns the cast property path array.
  6726. */
  6727. function castPath(value, object) {
  6728. if (isArray(value)) {
  6729. return value;
  6730. }
  6731. return isKey(value, object) ? [value] : stringToPath(toString(value));
  6732. }
  6733. module.exports = castPath;
  6734. /***/ }),
  6735. /***/ "../../node_modules/lodash/_cloneArrayBuffer.js":
  6736. /*!********************************************************************************!*\
  6737. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cloneArrayBuffer.js ***!
  6738. \********************************************************************************/
  6739. /*! no static exports found */
  6740. /***/ (function(module, exports, __webpack_require__) {
  6741. var Uint8Array = __webpack_require__(/*! ./_Uint8Array */ "../../node_modules/lodash/_Uint8Array.js");
  6742. /**
  6743. * Creates a clone of `arrayBuffer`.
  6744. *
  6745. * @private
  6746. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  6747. * @returns {ArrayBuffer} Returns the cloned array buffer.
  6748. */
  6749. function cloneArrayBuffer(arrayBuffer) {
  6750. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  6751. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  6752. return result;
  6753. }
  6754. module.exports = cloneArrayBuffer;
  6755. /***/ }),
  6756. /***/ "../../node_modules/lodash/_cloneBuffer.js":
  6757. /*!***************************************************************************!*\
  6758. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cloneBuffer.js ***!
  6759. \***************************************************************************/
  6760. /*! no static exports found */
  6761. /***/ (function(module, exports, __webpack_require__) {
  6762. /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  6763. /** Detect free variable `exports`. */
  6764. var freeExports = true && exports && !exports.nodeType && exports;
  6765. /** Detect free variable `module`. */
  6766. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  6767. /** Detect the popular CommonJS extension `module.exports`. */
  6768. var moduleExports = freeModule && freeModule.exports === freeExports;
  6769. /** Built-in value references. */
  6770. var Buffer = moduleExports ? root.Buffer : undefined,
  6771. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
  6772. /**
  6773. * Creates a clone of `buffer`.
  6774. *
  6775. * @private
  6776. * @param {Buffer} buffer The buffer to clone.
  6777. * @param {boolean} [isDeep] Specify a deep clone.
  6778. * @returns {Buffer} Returns the cloned buffer.
  6779. */
  6780. function cloneBuffer(buffer, isDeep) {
  6781. if (isDeep) {
  6782. return buffer.slice();
  6783. }
  6784. var length = buffer.length,
  6785. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  6786. buffer.copy(result);
  6787. return result;
  6788. }
  6789. module.exports = cloneBuffer;
  6790. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
  6791. /***/ }),
  6792. /***/ "../../node_modules/lodash/_cloneDataView.js":
  6793. /*!*****************************************************************************!*\
  6794. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cloneDataView.js ***!
  6795. \*****************************************************************************/
  6796. /*! no static exports found */
  6797. /***/ (function(module, exports, __webpack_require__) {
  6798. var cloneArrayBuffer = __webpack_require__(/*! ./_cloneArrayBuffer */ "../../node_modules/lodash/_cloneArrayBuffer.js");
  6799. /**
  6800. * Creates a clone of `dataView`.
  6801. *
  6802. * @private
  6803. * @param {Object} dataView The data view to clone.
  6804. * @param {boolean} [isDeep] Specify a deep clone.
  6805. * @returns {Object} Returns the cloned data view.
  6806. */
  6807. function cloneDataView(dataView, isDeep) {
  6808. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  6809. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  6810. }
  6811. module.exports = cloneDataView;
  6812. /***/ }),
  6813. /***/ "../../node_modules/lodash/_cloneRegExp.js":
  6814. /*!***************************************************************************!*\
  6815. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cloneRegExp.js ***!
  6816. \***************************************************************************/
  6817. /*! no static exports found */
  6818. /***/ (function(module, exports) {
  6819. /** Used to match `RegExp` flags from their coerced string values. */
  6820. var reFlags = /\w*$/;
  6821. /**
  6822. * Creates a clone of `regexp`.
  6823. *
  6824. * @private
  6825. * @param {Object} regexp The regexp to clone.
  6826. * @returns {Object} Returns the cloned regexp.
  6827. */
  6828. function cloneRegExp(regexp) {
  6829. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  6830. result.lastIndex = regexp.lastIndex;
  6831. return result;
  6832. }
  6833. module.exports = cloneRegExp;
  6834. /***/ }),
  6835. /***/ "../../node_modules/lodash/_cloneSymbol.js":
  6836. /*!***************************************************************************!*\
  6837. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cloneSymbol.js ***!
  6838. \***************************************************************************/
  6839. /*! no static exports found */
  6840. /***/ (function(module, exports, __webpack_require__) {
  6841. var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js");
  6842. /** Used to convert symbols to primitives and strings. */
  6843. var symbolProto = Symbol ? Symbol.prototype : undefined,
  6844. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  6845. /**
  6846. * Creates a clone of the `symbol` object.
  6847. *
  6848. * @private
  6849. * @param {Object} symbol The symbol object to clone.
  6850. * @returns {Object} Returns the cloned symbol object.
  6851. */
  6852. function cloneSymbol(symbol) {
  6853. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  6854. }
  6855. module.exports = cloneSymbol;
  6856. /***/ }),
  6857. /***/ "../../node_modules/lodash/_cloneTypedArray.js":
  6858. /*!*******************************************************************************!*\
  6859. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_cloneTypedArray.js ***!
  6860. \*******************************************************************************/
  6861. /*! no static exports found */
  6862. /***/ (function(module, exports, __webpack_require__) {
  6863. var cloneArrayBuffer = __webpack_require__(/*! ./_cloneArrayBuffer */ "../../node_modules/lodash/_cloneArrayBuffer.js");
  6864. /**
  6865. * Creates a clone of `typedArray`.
  6866. *
  6867. * @private
  6868. * @param {Object} typedArray The typed array to clone.
  6869. * @param {boolean} [isDeep] Specify a deep clone.
  6870. * @returns {Object} Returns the cloned typed array.
  6871. */
  6872. function cloneTypedArray(typedArray, isDeep) {
  6873. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  6874. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  6875. }
  6876. module.exports = cloneTypedArray;
  6877. /***/ }),
  6878. /***/ "../../node_modules/lodash/_compareAscending.js":
  6879. /*!********************************************************************************!*\
  6880. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_compareAscending.js ***!
  6881. \********************************************************************************/
  6882. /*! no static exports found */
  6883. /***/ (function(module, exports, __webpack_require__) {
  6884. var isSymbol = __webpack_require__(/*! ./isSymbol */ "../../node_modules/lodash/isSymbol.js");
  6885. /**
  6886. * Compares values to sort them in ascending order.
  6887. *
  6888. * @private
  6889. * @param {*} value The value to compare.
  6890. * @param {*} other The other value to compare.
  6891. * @returns {number} Returns the sort order indicator for `value`.
  6892. */
  6893. function compareAscending(value, other) {
  6894. if (value !== other) {
  6895. var valIsDefined = value !== undefined,
  6896. valIsNull = value === null,
  6897. valIsReflexive = value === value,
  6898. valIsSymbol = isSymbol(value);
  6899. var othIsDefined = other !== undefined,
  6900. othIsNull = other === null,
  6901. othIsReflexive = other === other,
  6902. othIsSymbol = isSymbol(other);
  6903. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  6904. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  6905. (valIsNull && othIsDefined && othIsReflexive) ||
  6906. (!valIsDefined && othIsReflexive) ||
  6907. !valIsReflexive) {
  6908. return 1;
  6909. }
  6910. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  6911. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  6912. (othIsNull && valIsDefined && valIsReflexive) ||
  6913. (!othIsDefined && valIsReflexive) ||
  6914. !othIsReflexive) {
  6915. return -1;
  6916. }
  6917. }
  6918. return 0;
  6919. }
  6920. module.exports = compareAscending;
  6921. /***/ }),
  6922. /***/ "../../node_modules/lodash/_compareMultiple.js":
  6923. /*!*******************************************************************************!*\
  6924. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_compareMultiple.js ***!
  6925. \*******************************************************************************/
  6926. /*! no static exports found */
  6927. /***/ (function(module, exports, __webpack_require__) {
  6928. var compareAscending = __webpack_require__(/*! ./_compareAscending */ "../../node_modules/lodash/_compareAscending.js");
  6929. /**
  6930. * Used by `_.orderBy` to compare multiple properties of a value to another
  6931. * and stable sort them.
  6932. *
  6933. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  6934. * specify an order of "desc" for descending or "asc" for ascending sort order
  6935. * of corresponding values.
  6936. *
  6937. * @private
  6938. * @param {Object} object The object to compare.
  6939. * @param {Object} other The other object to compare.
  6940. * @param {boolean[]|string[]} orders The order to sort by for each property.
  6941. * @returns {number} Returns the sort order indicator for `object`.
  6942. */
  6943. function compareMultiple(object, other, orders) {
  6944. var index = -1,
  6945. objCriteria = object.criteria,
  6946. othCriteria = other.criteria,
  6947. length = objCriteria.length,
  6948. ordersLength = orders.length;
  6949. while (++index < length) {
  6950. var result = compareAscending(objCriteria[index], othCriteria[index]);
  6951. if (result) {
  6952. if (index >= ordersLength) {
  6953. return result;
  6954. }
  6955. var order = orders[index];
  6956. return result * (order == 'desc' ? -1 : 1);
  6957. }
  6958. }
  6959. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  6960. // that causes it, under certain circumstances, to provide the same value for
  6961. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  6962. // for more details.
  6963. //
  6964. // This also ensures a stable sort in V8 and other engines.
  6965. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  6966. return object.index - other.index;
  6967. }
  6968. module.exports = compareMultiple;
  6969. /***/ }),
  6970. /***/ "../../node_modules/lodash/_copyArray.js":
  6971. /*!*************************************************************************!*\
  6972. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_copyArray.js ***!
  6973. \*************************************************************************/
  6974. /*! no static exports found */
  6975. /***/ (function(module, exports) {
  6976. /**
  6977. * Copies the values of `source` to `array`.
  6978. *
  6979. * @private
  6980. * @param {Array} source The array to copy values from.
  6981. * @param {Array} [array=[]] The array to copy values to.
  6982. * @returns {Array} Returns `array`.
  6983. */
  6984. function copyArray(source, array) {
  6985. var index = -1,
  6986. length = source.length;
  6987. array || (array = Array(length));
  6988. while (++index < length) {
  6989. array[index] = source[index];
  6990. }
  6991. return array;
  6992. }
  6993. module.exports = copyArray;
  6994. /***/ }),
  6995. /***/ "../../node_modules/lodash/_copyObject.js":
  6996. /*!**************************************************************************!*\
  6997. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_copyObject.js ***!
  6998. \**************************************************************************/
  6999. /*! no static exports found */
  7000. /***/ (function(module, exports, __webpack_require__) {
  7001. var assignValue = __webpack_require__(/*! ./_assignValue */ "../../node_modules/lodash/_assignValue.js"),
  7002. baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "../../node_modules/lodash/_baseAssignValue.js");
  7003. /**
  7004. * Copies properties of `source` to `object`.
  7005. *
  7006. * @private
  7007. * @param {Object} source The object to copy properties from.
  7008. * @param {Array} props The property identifiers to copy.
  7009. * @param {Object} [object={}] The object to copy properties to.
  7010. * @param {Function} [customizer] The function to customize copied values.
  7011. * @returns {Object} Returns `object`.
  7012. */
  7013. function copyObject(source, props, object, customizer) {
  7014. var isNew = !object;
  7015. object || (object = {});
  7016. var index = -1,
  7017. length = props.length;
  7018. while (++index < length) {
  7019. var key = props[index];
  7020. var newValue = customizer
  7021. ? customizer(object[key], source[key], key, object, source)
  7022. : undefined;
  7023. if (newValue === undefined) {
  7024. newValue = source[key];
  7025. }
  7026. if (isNew) {
  7027. baseAssignValue(object, key, newValue);
  7028. } else {
  7029. assignValue(object, key, newValue);
  7030. }
  7031. }
  7032. return object;
  7033. }
  7034. module.exports = copyObject;
  7035. /***/ }),
  7036. /***/ "../../node_modules/lodash/_copySymbols.js":
  7037. /*!***************************************************************************!*\
  7038. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_copySymbols.js ***!
  7039. \***************************************************************************/
  7040. /*! no static exports found */
  7041. /***/ (function(module, exports, __webpack_require__) {
  7042. var copyObject = __webpack_require__(/*! ./_copyObject */ "../../node_modules/lodash/_copyObject.js"),
  7043. getSymbols = __webpack_require__(/*! ./_getSymbols */ "../../node_modules/lodash/_getSymbols.js");
  7044. /**
  7045. * Copies own symbols of `source` to `object`.
  7046. *
  7047. * @private
  7048. * @param {Object} source The object to copy symbols from.
  7049. * @param {Object} [object={}] The object to copy symbols to.
  7050. * @returns {Object} Returns `object`.
  7051. */
  7052. function copySymbols(source, object) {
  7053. return copyObject(source, getSymbols(source), object);
  7054. }
  7055. module.exports = copySymbols;
  7056. /***/ }),
  7057. /***/ "../../node_modules/lodash/_copySymbolsIn.js":
  7058. /*!*****************************************************************************!*\
  7059. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_copySymbolsIn.js ***!
  7060. \*****************************************************************************/
  7061. /*! no static exports found */
  7062. /***/ (function(module, exports, __webpack_require__) {
  7063. var copyObject = __webpack_require__(/*! ./_copyObject */ "../../node_modules/lodash/_copyObject.js"),
  7064. getSymbolsIn = __webpack_require__(/*! ./_getSymbolsIn */ "../../node_modules/lodash/_getSymbolsIn.js");
  7065. /**
  7066. * Copies own and inherited symbols of `source` to `object`.
  7067. *
  7068. * @private
  7069. * @param {Object} source The object to copy symbols from.
  7070. * @param {Object} [object={}] The object to copy symbols to.
  7071. * @returns {Object} Returns `object`.
  7072. */
  7073. function copySymbolsIn(source, object) {
  7074. return copyObject(source, getSymbolsIn(source), object);
  7075. }
  7076. module.exports = copySymbolsIn;
  7077. /***/ }),
  7078. /***/ "../../node_modules/lodash/_coreJsData.js":
  7079. /*!**************************************************************************!*\
  7080. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_coreJsData.js ***!
  7081. \**************************************************************************/
  7082. /*! no static exports found */
  7083. /***/ (function(module, exports, __webpack_require__) {
  7084. var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  7085. /** Used to detect overreaching core-js shims. */
  7086. var coreJsData = root['__core-js_shared__'];
  7087. module.exports = coreJsData;
  7088. /***/ }),
  7089. /***/ "../../node_modules/lodash/_createAssigner.js":
  7090. /*!******************************************************************************!*\
  7091. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_createAssigner.js ***!
  7092. \******************************************************************************/
  7093. /*! no static exports found */
  7094. /***/ (function(module, exports, __webpack_require__) {
  7095. var baseRest = __webpack_require__(/*! ./_baseRest */ "../../node_modules/lodash/_baseRest.js"),
  7096. isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ "../../node_modules/lodash/_isIterateeCall.js");
  7097. /**
  7098. * Creates a function like `_.assign`.
  7099. *
  7100. * @private
  7101. * @param {Function} assigner The function to assign values.
  7102. * @returns {Function} Returns the new assigner function.
  7103. */
  7104. function createAssigner(assigner) {
  7105. return baseRest(function(object, sources) {
  7106. var index = -1,
  7107. length = sources.length,
  7108. customizer = length > 1 ? sources[length - 1] : undefined,
  7109. guard = length > 2 ? sources[2] : undefined;
  7110. customizer = (assigner.length > 3 && typeof customizer == 'function')
  7111. ? (length--, customizer)
  7112. : undefined;
  7113. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  7114. customizer = length < 3 ? undefined : customizer;
  7115. length = 1;
  7116. }
  7117. object = Object(object);
  7118. while (++index < length) {
  7119. var source = sources[index];
  7120. if (source) {
  7121. assigner(object, source, index, customizer);
  7122. }
  7123. }
  7124. return object;
  7125. });
  7126. }
  7127. module.exports = createAssigner;
  7128. /***/ }),
  7129. /***/ "../../node_modules/lodash/_createBaseEach.js":
  7130. /*!******************************************************************************!*\
  7131. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_createBaseEach.js ***!
  7132. \******************************************************************************/
  7133. /*! no static exports found */
  7134. /***/ (function(module, exports, __webpack_require__) {
  7135. var isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js");
  7136. /**
  7137. * Creates a `baseEach` or `baseEachRight` function.
  7138. *
  7139. * @private
  7140. * @param {Function} eachFunc The function to iterate over a collection.
  7141. * @param {boolean} [fromRight] Specify iterating from right to left.
  7142. * @returns {Function} Returns the new base function.
  7143. */
  7144. function createBaseEach(eachFunc, fromRight) {
  7145. return function(collection, iteratee) {
  7146. if (collection == null) {
  7147. return collection;
  7148. }
  7149. if (!isArrayLike(collection)) {
  7150. return eachFunc(collection, iteratee);
  7151. }
  7152. var length = collection.length,
  7153. index = fromRight ? length : -1,
  7154. iterable = Object(collection);
  7155. while ((fromRight ? index-- : ++index < length)) {
  7156. if (iteratee(iterable[index], index, iterable) === false) {
  7157. break;
  7158. }
  7159. }
  7160. return collection;
  7161. };
  7162. }
  7163. module.exports = createBaseEach;
  7164. /***/ }),
  7165. /***/ "../../node_modules/lodash/_createBaseFor.js":
  7166. /*!*****************************************************************************!*\
  7167. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_createBaseFor.js ***!
  7168. \*****************************************************************************/
  7169. /*! no static exports found */
  7170. /***/ (function(module, exports) {
  7171. /**
  7172. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  7173. *
  7174. * @private
  7175. * @param {boolean} [fromRight] Specify iterating from right to left.
  7176. * @returns {Function} Returns the new base function.
  7177. */
  7178. function createBaseFor(fromRight) {
  7179. return function(object, iteratee, keysFunc) {
  7180. var index = -1,
  7181. iterable = Object(object),
  7182. props = keysFunc(object),
  7183. length = props.length;
  7184. while (length--) {
  7185. var key = props[fromRight ? length : ++index];
  7186. if (iteratee(iterable[key], key, iterable) === false) {
  7187. break;
  7188. }
  7189. }
  7190. return object;
  7191. };
  7192. }
  7193. module.exports = createBaseFor;
  7194. /***/ }),
  7195. /***/ "../../node_modules/lodash/_createFind.js":
  7196. /*!**************************************************************************!*\
  7197. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_createFind.js ***!
  7198. \**************************************************************************/
  7199. /*! no static exports found */
  7200. /***/ (function(module, exports, __webpack_require__) {
  7201. var baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  7202. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js"),
  7203. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  7204. /**
  7205. * Creates a `_.find` or `_.findLast` function.
  7206. *
  7207. * @private
  7208. * @param {Function} findIndexFunc The function to find the collection index.
  7209. * @returns {Function} Returns the new find function.
  7210. */
  7211. function createFind(findIndexFunc) {
  7212. return function(collection, predicate, fromIndex) {
  7213. var iterable = Object(collection);
  7214. if (!isArrayLike(collection)) {
  7215. var iteratee = baseIteratee(predicate, 3);
  7216. collection = keys(collection);
  7217. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  7218. }
  7219. var index = findIndexFunc(collection, predicate, fromIndex);
  7220. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  7221. };
  7222. }
  7223. module.exports = createFind;
  7224. /***/ }),
  7225. /***/ "../../node_modules/lodash/_createRange.js":
  7226. /*!***************************************************************************!*\
  7227. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_createRange.js ***!
  7228. \***************************************************************************/
  7229. /*! no static exports found */
  7230. /***/ (function(module, exports, __webpack_require__) {
  7231. var baseRange = __webpack_require__(/*! ./_baseRange */ "../../node_modules/lodash/_baseRange.js"),
  7232. isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ "../../node_modules/lodash/_isIterateeCall.js"),
  7233. toFinite = __webpack_require__(/*! ./toFinite */ "../../node_modules/lodash/toFinite.js");
  7234. /**
  7235. * Creates a `_.range` or `_.rangeRight` function.
  7236. *
  7237. * @private
  7238. * @param {boolean} [fromRight] Specify iterating from right to left.
  7239. * @returns {Function} Returns the new range function.
  7240. */
  7241. function createRange(fromRight) {
  7242. return function(start, end, step) {
  7243. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  7244. end = step = undefined;
  7245. }
  7246. // Ensure the sign of `-0` is preserved.
  7247. start = toFinite(start);
  7248. if (end === undefined) {
  7249. end = start;
  7250. start = 0;
  7251. } else {
  7252. end = toFinite(end);
  7253. }
  7254. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  7255. return baseRange(start, end, step, fromRight);
  7256. };
  7257. }
  7258. module.exports = createRange;
  7259. /***/ }),
  7260. /***/ "../../node_modules/lodash/_createSet.js":
  7261. /*!*************************************************************************!*\
  7262. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_createSet.js ***!
  7263. \*************************************************************************/
  7264. /*! no static exports found */
  7265. /***/ (function(module, exports, __webpack_require__) {
  7266. var Set = __webpack_require__(/*! ./_Set */ "../../node_modules/lodash/_Set.js"),
  7267. noop = __webpack_require__(/*! ./noop */ "../../node_modules/lodash/noop.js"),
  7268. setToArray = __webpack_require__(/*! ./_setToArray */ "../../node_modules/lodash/_setToArray.js");
  7269. /** Used as references for various `Number` constants. */
  7270. var INFINITY = 1 / 0;
  7271. /**
  7272. * Creates a set object of `values`.
  7273. *
  7274. * @private
  7275. * @param {Array} values The values to add to the set.
  7276. * @returns {Object} Returns the new set.
  7277. */
  7278. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  7279. return new Set(values);
  7280. };
  7281. module.exports = createSet;
  7282. /***/ }),
  7283. /***/ "../../node_modules/lodash/_defineProperty.js":
  7284. /*!******************************************************************************!*\
  7285. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_defineProperty.js ***!
  7286. \******************************************************************************/
  7287. /*! no static exports found */
  7288. /***/ (function(module, exports, __webpack_require__) {
  7289. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js");
  7290. var defineProperty = (function() {
  7291. try {
  7292. var func = getNative(Object, 'defineProperty');
  7293. func({}, '', {});
  7294. return func;
  7295. } catch (e) {}
  7296. }());
  7297. module.exports = defineProperty;
  7298. /***/ }),
  7299. /***/ "../../node_modules/lodash/_equalArrays.js":
  7300. /*!***************************************************************************!*\
  7301. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_equalArrays.js ***!
  7302. \***************************************************************************/
  7303. /*! no static exports found */
  7304. /***/ (function(module, exports, __webpack_require__) {
  7305. var SetCache = __webpack_require__(/*! ./_SetCache */ "../../node_modules/lodash/_SetCache.js"),
  7306. arraySome = __webpack_require__(/*! ./_arraySome */ "../../node_modules/lodash/_arraySome.js"),
  7307. cacheHas = __webpack_require__(/*! ./_cacheHas */ "../../node_modules/lodash/_cacheHas.js");
  7308. /** Used to compose bitmasks for value comparisons. */
  7309. var COMPARE_PARTIAL_FLAG = 1,
  7310. COMPARE_UNORDERED_FLAG = 2;
  7311. /**
  7312. * A specialized version of `baseIsEqualDeep` for arrays with support for
  7313. * partial deep comparisons.
  7314. *
  7315. * @private
  7316. * @param {Array} array The array to compare.
  7317. * @param {Array} other The other array to compare.
  7318. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  7319. * @param {Function} customizer The function to customize comparisons.
  7320. * @param {Function} equalFunc The function to determine equivalents of values.
  7321. * @param {Object} stack Tracks traversed `array` and `other` objects.
  7322. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  7323. */
  7324. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  7325. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  7326. arrLength = array.length,
  7327. othLength = other.length;
  7328. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  7329. return false;
  7330. }
  7331. // Assume cyclic values are equal.
  7332. var stacked = stack.get(array);
  7333. if (stacked && stack.get(other)) {
  7334. return stacked == other;
  7335. }
  7336. var index = -1,
  7337. result = true,
  7338. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  7339. stack.set(array, other);
  7340. stack.set(other, array);
  7341. // Ignore non-index properties.
  7342. while (++index < arrLength) {
  7343. var arrValue = array[index],
  7344. othValue = other[index];
  7345. if (customizer) {
  7346. var compared = isPartial
  7347. ? customizer(othValue, arrValue, index, other, array, stack)
  7348. : customizer(arrValue, othValue, index, array, other, stack);
  7349. }
  7350. if (compared !== undefined) {
  7351. if (compared) {
  7352. continue;
  7353. }
  7354. result = false;
  7355. break;
  7356. }
  7357. // Recursively compare arrays (susceptible to call stack limits).
  7358. if (seen) {
  7359. if (!arraySome(other, function(othValue, othIndex) {
  7360. if (!cacheHas(seen, othIndex) &&
  7361. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  7362. return seen.push(othIndex);
  7363. }
  7364. })) {
  7365. result = false;
  7366. break;
  7367. }
  7368. } else if (!(
  7369. arrValue === othValue ||
  7370. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  7371. )) {
  7372. result = false;
  7373. break;
  7374. }
  7375. }
  7376. stack['delete'](array);
  7377. stack['delete'](other);
  7378. return result;
  7379. }
  7380. module.exports = equalArrays;
  7381. /***/ }),
  7382. /***/ "../../node_modules/lodash/_equalByTag.js":
  7383. /*!**************************************************************************!*\
  7384. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_equalByTag.js ***!
  7385. \**************************************************************************/
  7386. /*! no static exports found */
  7387. /***/ (function(module, exports, __webpack_require__) {
  7388. var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js"),
  7389. Uint8Array = __webpack_require__(/*! ./_Uint8Array */ "../../node_modules/lodash/_Uint8Array.js"),
  7390. eq = __webpack_require__(/*! ./eq */ "../../node_modules/lodash/eq.js"),
  7391. equalArrays = __webpack_require__(/*! ./_equalArrays */ "../../node_modules/lodash/_equalArrays.js"),
  7392. mapToArray = __webpack_require__(/*! ./_mapToArray */ "../../node_modules/lodash/_mapToArray.js"),
  7393. setToArray = __webpack_require__(/*! ./_setToArray */ "../../node_modules/lodash/_setToArray.js");
  7394. /** Used to compose bitmasks for value comparisons. */
  7395. var COMPARE_PARTIAL_FLAG = 1,
  7396. COMPARE_UNORDERED_FLAG = 2;
  7397. /** `Object#toString` result references. */
  7398. var boolTag = '[object Boolean]',
  7399. dateTag = '[object Date]',
  7400. errorTag = '[object Error]',
  7401. mapTag = '[object Map]',
  7402. numberTag = '[object Number]',
  7403. regexpTag = '[object RegExp]',
  7404. setTag = '[object Set]',
  7405. stringTag = '[object String]',
  7406. symbolTag = '[object Symbol]';
  7407. var arrayBufferTag = '[object ArrayBuffer]',
  7408. dataViewTag = '[object DataView]';
  7409. /** Used to convert symbols to primitives and strings. */
  7410. var symbolProto = Symbol ? Symbol.prototype : undefined,
  7411. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  7412. /**
  7413. * A specialized version of `baseIsEqualDeep` for comparing objects of
  7414. * the same `toStringTag`.
  7415. *
  7416. * **Note:** This function only supports comparing values with tags of
  7417. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  7418. *
  7419. * @private
  7420. * @param {Object} object The object to compare.
  7421. * @param {Object} other The other object to compare.
  7422. * @param {string} tag The `toStringTag` of the objects to compare.
  7423. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  7424. * @param {Function} customizer The function to customize comparisons.
  7425. * @param {Function} equalFunc The function to determine equivalents of values.
  7426. * @param {Object} stack Tracks traversed `object` and `other` objects.
  7427. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  7428. */
  7429. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  7430. switch (tag) {
  7431. case dataViewTag:
  7432. if ((object.byteLength != other.byteLength) ||
  7433. (object.byteOffset != other.byteOffset)) {
  7434. return false;
  7435. }
  7436. object = object.buffer;
  7437. other = other.buffer;
  7438. case arrayBufferTag:
  7439. if ((object.byteLength != other.byteLength) ||
  7440. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  7441. return false;
  7442. }
  7443. return true;
  7444. case boolTag:
  7445. case dateTag:
  7446. case numberTag:
  7447. // Coerce booleans to `1` or `0` and dates to milliseconds.
  7448. // Invalid dates are coerced to `NaN`.
  7449. return eq(+object, +other);
  7450. case errorTag:
  7451. return object.name == other.name && object.message == other.message;
  7452. case regexpTag:
  7453. case stringTag:
  7454. // Coerce regexes to strings and treat strings, primitives and objects,
  7455. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  7456. // for more details.
  7457. return object == (other + '');
  7458. case mapTag:
  7459. var convert = mapToArray;
  7460. case setTag:
  7461. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  7462. convert || (convert = setToArray);
  7463. if (object.size != other.size && !isPartial) {
  7464. return false;
  7465. }
  7466. // Assume cyclic values are equal.
  7467. var stacked = stack.get(object);
  7468. if (stacked) {
  7469. return stacked == other;
  7470. }
  7471. bitmask |= COMPARE_UNORDERED_FLAG;
  7472. // Recursively compare objects (susceptible to call stack limits).
  7473. stack.set(object, other);
  7474. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  7475. stack['delete'](object);
  7476. return result;
  7477. case symbolTag:
  7478. if (symbolValueOf) {
  7479. return symbolValueOf.call(object) == symbolValueOf.call(other);
  7480. }
  7481. }
  7482. return false;
  7483. }
  7484. module.exports = equalByTag;
  7485. /***/ }),
  7486. /***/ "../../node_modules/lodash/_equalObjects.js":
  7487. /*!****************************************************************************!*\
  7488. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_equalObjects.js ***!
  7489. \****************************************************************************/
  7490. /*! no static exports found */
  7491. /***/ (function(module, exports, __webpack_require__) {
  7492. var getAllKeys = __webpack_require__(/*! ./_getAllKeys */ "../../node_modules/lodash/_getAllKeys.js");
  7493. /** Used to compose bitmasks for value comparisons. */
  7494. var COMPARE_PARTIAL_FLAG = 1;
  7495. /** Used for built-in method references. */
  7496. var objectProto = Object.prototype;
  7497. /** Used to check objects for own properties. */
  7498. var hasOwnProperty = objectProto.hasOwnProperty;
  7499. /**
  7500. * A specialized version of `baseIsEqualDeep` for objects with support for
  7501. * partial deep comparisons.
  7502. *
  7503. * @private
  7504. * @param {Object} object The object to compare.
  7505. * @param {Object} other The other object to compare.
  7506. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  7507. * @param {Function} customizer The function to customize comparisons.
  7508. * @param {Function} equalFunc The function to determine equivalents of values.
  7509. * @param {Object} stack Tracks traversed `object` and `other` objects.
  7510. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  7511. */
  7512. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  7513. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  7514. objProps = getAllKeys(object),
  7515. objLength = objProps.length,
  7516. othProps = getAllKeys(other),
  7517. othLength = othProps.length;
  7518. if (objLength != othLength && !isPartial) {
  7519. return false;
  7520. }
  7521. var index = objLength;
  7522. while (index--) {
  7523. var key = objProps[index];
  7524. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  7525. return false;
  7526. }
  7527. }
  7528. // Assume cyclic values are equal.
  7529. var stacked = stack.get(object);
  7530. if (stacked && stack.get(other)) {
  7531. return stacked == other;
  7532. }
  7533. var result = true;
  7534. stack.set(object, other);
  7535. stack.set(other, object);
  7536. var skipCtor = isPartial;
  7537. while (++index < objLength) {
  7538. key = objProps[index];
  7539. var objValue = object[key],
  7540. othValue = other[key];
  7541. if (customizer) {
  7542. var compared = isPartial
  7543. ? customizer(othValue, objValue, key, other, object, stack)
  7544. : customizer(objValue, othValue, key, object, other, stack);
  7545. }
  7546. // Recursively compare objects (susceptible to call stack limits).
  7547. if (!(compared === undefined
  7548. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  7549. : compared
  7550. )) {
  7551. result = false;
  7552. break;
  7553. }
  7554. skipCtor || (skipCtor = key == 'constructor');
  7555. }
  7556. if (result && !skipCtor) {
  7557. var objCtor = object.constructor,
  7558. othCtor = other.constructor;
  7559. // Non `Object` object instances with different constructors are not equal.
  7560. if (objCtor != othCtor &&
  7561. ('constructor' in object && 'constructor' in other) &&
  7562. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  7563. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  7564. result = false;
  7565. }
  7566. }
  7567. stack['delete'](object);
  7568. stack['delete'](other);
  7569. return result;
  7570. }
  7571. module.exports = equalObjects;
  7572. /***/ }),
  7573. /***/ "../../node_modules/lodash/_flatRest.js":
  7574. /*!************************************************************************!*\
  7575. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_flatRest.js ***!
  7576. \************************************************************************/
  7577. /*! no static exports found */
  7578. /***/ (function(module, exports, __webpack_require__) {
  7579. var flatten = __webpack_require__(/*! ./flatten */ "../../node_modules/lodash/flatten.js"),
  7580. overRest = __webpack_require__(/*! ./_overRest */ "../../node_modules/lodash/_overRest.js"),
  7581. setToString = __webpack_require__(/*! ./_setToString */ "../../node_modules/lodash/_setToString.js");
  7582. /**
  7583. * A specialized version of `baseRest` which flattens the rest array.
  7584. *
  7585. * @private
  7586. * @param {Function} func The function to apply a rest parameter to.
  7587. * @returns {Function} Returns the new function.
  7588. */
  7589. function flatRest(func) {
  7590. return setToString(overRest(func, undefined, flatten), func + '');
  7591. }
  7592. module.exports = flatRest;
  7593. /***/ }),
  7594. /***/ "../../node_modules/lodash/_freeGlobal.js":
  7595. /*!**************************************************************************!*\
  7596. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_freeGlobal.js ***!
  7597. \**************************************************************************/
  7598. /*! no static exports found */
  7599. /***/ (function(module, exports, __webpack_require__) {
  7600. /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
  7601. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  7602. module.exports = freeGlobal;
  7603. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  7604. /***/ }),
  7605. /***/ "../../node_modules/lodash/_getAllKeys.js":
  7606. /*!**************************************************************************!*\
  7607. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getAllKeys.js ***!
  7608. \**************************************************************************/
  7609. /*! no static exports found */
  7610. /***/ (function(module, exports, __webpack_require__) {
  7611. var baseGetAllKeys = __webpack_require__(/*! ./_baseGetAllKeys */ "../../node_modules/lodash/_baseGetAllKeys.js"),
  7612. getSymbols = __webpack_require__(/*! ./_getSymbols */ "../../node_modules/lodash/_getSymbols.js"),
  7613. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  7614. /**
  7615. * Creates an array of own enumerable property names and symbols of `object`.
  7616. *
  7617. * @private
  7618. * @param {Object} object The object to query.
  7619. * @returns {Array} Returns the array of property names and symbols.
  7620. */
  7621. function getAllKeys(object) {
  7622. return baseGetAllKeys(object, keys, getSymbols);
  7623. }
  7624. module.exports = getAllKeys;
  7625. /***/ }),
  7626. /***/ "../../node_modules/lodash/_getAllKeysIn.js":
  7627. /*!****************************************************************************!*\
  7628. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getAllKeysIn.js ***!
  7629. \****************************************************************************/
  7630. /*! no static exports found */
  7631. /***/ (function(module, exports, __webpack_require__) {
  7632. var baseGetAllKeys = __webpack_require__(/*! ./_baseGetAllKeys */ "../../node_modules/lodash/_baseGetAllKeys.js"),
  7633. getSymbolsIn = __webpack_require__(/*! ./_getSymbolsIn */ "../../node_modules/lodash/_getSymbolsIn.js"),
  7634. keysIn = __webpack_require__(/*! ./keysIn */ "../../node_modules/lodash/keysIn.js");
  7635. /**
  7636. * Creates an array of own and inherited enumerable property names and
  7637. * symbols of `object`.
  7638. *
  7639. * @private
  7640. * @param {Object} object The object to query.
  7641. * @returns {Array} Returns the array of property names and symbols.
  7642. */
  7643. function getAllKeysIn(object) {
  7644. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  7645. }
  7646. module.exports = getAllKeysIn;
  7647. /***/ }),
  7648. /***/ "../../node_modules/lodash/_getMapData.js":
  7649. /*!**************************************************************************!*\
  7650. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getMapData.js ***!
  7651. \**************************************************************************/
  7652. /*! no static exports found */
  7653. /***/ (function(module, exports, __webpack_require__) {
  7654. var isKeyable = __webpack_require__(/*! ./_isKeyable */ "../../node_modules/lodash/_isKeyable.js");
  7655. /**
  7656. * Gets the data for `map`.
  7657. *
  7658. * @private
  7659. * @param {Object} map The map to query.
  7660. * @param {string} key The reference key.
  7661. * @returns {*} Returns the map data.
  7662. */
  7663. function getMapData(map, key) {
  7664. var data = map.__data__;
  7665. return isKeyable(key)
  7666. ? data[typeof key == 'string' ? 'string' : 'hash']
  7667. : data.map;
  7668. }
  7669. module.exports = getMapData;
  7670. /***/ }),
  7671. /***/ "../../node_modules/lodash/_getMatchData.js":
  7672. /*!****************************************************************************!*\
  7673. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getMatchData.js ***!
  7674. \****************************************************************************/
  7675. /*! no static exports found */
  7676. /***/ (function(module, exports, __webpack_require__) {
  7677. var isStrictComparable = __webpack_require__(/*! ./_isStrictComparable */ "../../node_modules/lodash/_isStrictComparable.js"),
  7678. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  7679. /**
  7680. * Gets the property names, values, and compare flags of `object`.
  7681. *
  7682. * @private
  7683. * @param {Object} object The object to query.
  7684. * @returns {Array} Returns the match data of `object`.
  7685. */
  7686. function getMatchData(object) {
  7687. var result = keys(object),
  7688. length = result.length;
  7689. while (length--) {
  7690. var key = result[length],
  7691. value = object[key];
  7692. result[length] = [key, value, isStrictComparable(value)];
  7693. }
  7694. return result;
  7695. }
  7696. module.exports = getMatchData;
  7697. /***/ }),
  7698. /***/ "../../node_modules/lodash/_getNative.js":
  7699. /*!*************************************************************************!*\
  7700. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getNative.js ***!
  7701. \*************************************************************************/
  7702. /*! no static exports found */
  7703. /***/ (function(module, exports, __webpack_require__) {
  7704. var baseIsNative = __webpack_require__(/*! ./_baseIsNative */ "../../node_modules/lodash/_baseIsNative.js"),
  7705. getValue = __webpack_require__(/*! ./_getValue */ "../../node_modules/lodash/_getValue.js");
  7706. /**
  7707. * Gets the native function at `key` of `object`.
  7708. *
  7709. * @private
  7710. * @param {Object} object The object to query.
  7711. * @param {string} key The key of the method to get.
  7712. * @returns {*} Returns the function if it's native, else `undefined`.
  7713. */
  7714. function getNative(object, key) {
  7715. var value = getValue(object, key);
  7716. return baseIsNative(value) ? value : undefined;
  7717. }
  7718. module.exports = getNative;
  7719. /***/ }),
  7720. /***/ "../../node_modules/lodash/_getPrototype.js":
  7721. /*!****************************************************************************!*\
  7722. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getPrototype.js ***!
  7723. \****************************************************************************/
  7724. /*! no static exports found */
  7725. /***/ (function(module, exports, __webpack_require__) {
  7726. var overArg = __webpack_require__(/*! ./_overArg */ "../../node_modules/lodash/_overArg.js");
  7727. /** Built-in value references. */
  7728. var getPrototype = overArg(Object.getPrototypeOf, Object);
  7729. module.exports = getPrototype;
  7730. /***/ }),
  7731. /***/ "../../node_modules/lodash/_getRawTag.js":
  7732. /*!*************************************************************************!*\
  7733. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getRawTag.js ***!
  7734. \*************************************************************************/
  7735. /*! no static exports found */
  7736. /***/ (function(module, exports, __webpack_require__) {
  7737. var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js");
  7738. /** Used for built-in method references. */
  7739. var objectProto = Object.prototype;
  7740. /** Used to check objects for own properties. */
  7741. var hasOwnProperty = objectProto.hasOwnProperty;
  7742. /**
  7743. * Used to resolve the
  7744. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  7745. * of values.
  7746. */
  7747. var nativeObjectToString = objectProto.toString;
  7748. /** Built-in value references. */
  7749. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  7750. /**
  7751. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  7752. *
  7753. * @private
  7754. * @param {*} value The value to query.
  7755. * @returns {string} Returns the raw `toStringTag`.
  7756. */
  7757. function getRawTag(value) {
  7758. var isOwn = hasOwnProperty.call(value, symToStringTag),
  7759. tag = value[symToStringTag];
  7760. try {
  7761. value[symToStringTag] = undefined;
  7762. var unmasked = true;
  7763. } catch (e) {}
  7764. var result = nativeObjectToString.call(value);
  7765. if (unmasked) {
  7766. if (isOwn) {
  7767. value[symToStringTag] = tag;
  7768. } else {
  7769. delete value[symToStringTag];
  7770. }
  7771. }
  7772. return result;
  7773. }
  7774. module.exports = getRawTag;
  7775. /***/ }),
  7776. /***/ "../../node_modules/lodash/_getSymbols.js":
  7777. /*!**************************************************************************!*\
  7778. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getSymbols.js ***!
  7779. \**************************************************************************/
  7780. /*! no static exports found */
  7781. /***/ (function(module, exports, __webpack_require__) {
  7782. var arrayFilter = __webpack_require__(/*! ./_arrayFilter */ "../../node_modules/lodash/_arrayFilter.js"),
  7783. stubArray = __webpack_require__(/*! ./stubArray */ "../../node_modules/lodash/stubArray.js");
  7784. /** Used for built-in method references. */
  7785. var objectProto = Object.prototype;
  7786. /** Built-in value references. */
  7787. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  7788. /* Built-in method references for those with the same name as other `lodash` methods. */
  7789. var nativeGetSymbols = Object.getOwnPropertySymbols;
  7790. /**
  7791. * Creates an array of the own enumerable symbols of `object`.
  7792. *
  7793. * @private
  7794. * @param {Object} object The object to query.
  7795. * @returns {Array} Returns the array of symbols.
  7796. */
  7797. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  7798. if (object == null) {
  7799. return [];
  7800. }
  7801. object = Object(object);
  7802. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  7803. return propertyIsEnumerable.call(object, symbol);
  7804. });
  7805. };
  7806. module.exports = getSymbols;
  7807. /***/ }),
  7808. /***/ "../../node_modules/lodash/_getSymbolsIn.js":
  7809. /*!****************************************************************************!*\
  7810. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getSymbolsIn.js ***!
  7811. \****************************************************************************/
  7812. /*! no static exports found */
  7813. /***/ (function(module, exports, __webpack_require__) {
  7814. var arrayPush = __webpack_require__(/*! ./_arrayPush */ "../../node_modules/lodash/_arrayPush.js"),
  7815. getPrototype = __webpack_require__(/*! ./_getPrototype */ "../../node_modules/lodash/_getPrototype.js"),
  7816. getSymbols = __webpack_require__(/*! ./_getSymbols */ "../../node_modules/lodash/_getSymbols.js"),
  7817. stubArray = __webpack_require__(/*! ./stubArray */ "../../node_modules/lodash/stubArray.js");
  7818. /* Built-in method references for those with the same name as other `lodash` methods. */
  7819. var nativeGetSymbols = Object.getOwnPropertySymbols;
  7820. /**
  7821. * Creates an array of the own and inherited enumerable symbols of `object`.
  7822. *
  7823. * @private
  7824. * @param {Object} object The object to query.
  7825. * @returns {Array} Returns the array of symbols.
  7826. */
  7827. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  7828. var result = [];
  7829. while (object) {
  7830. arrayPush(result, getSymbols(object));
  7831. object = getPrototype(object);
  7832. }
  7833. return result;
  7834. };
  7835. module.exports = getSymbolsIn;
  7836. /***/ }),
  7837. /***/ "../../node_modules/lodash/_getTag.js":
  7838. /*!**********************************************************************!*\
  7839. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getTag.js ***!
  7840. \**********************************************************************/
  7841. /*! no static exports found */
  7842. /***/ (function(module, exports, __webpack_require__) {
  7843. var DataView = __webpack_require__(/*! ./_DataView */ "../../node_modules/lodash/_DataView.js"),
  7844. Map = __webpack_require__(/*! ./_Map */ "../../node_modules/lodash/_Map.js"),
  7845. Promise = __webpack_require__(/*! ./_Promise */ "../../node_modules/lodash/_Promise.js"),
  7846. Set = __webpack_require__(/*! ./_Set */ "../../node_modules/lodash/_Set.js"),
  7847. WeakMap = __webpack_require__(/*! ./_WeakMap */ "../../node_modules/lodash/_WeakMap.js"),
  7848. baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  7849. toSource = __webpack_require__(/*! ./_toSource */ "../../node_modules/lodash/_toSource.js");
  7850. /** `Object#toString` result references. */
  7851. var mapTag = '[object Map]',
  7852. objectTag = '[object Object]',
  7853. promiseTag = '[object Promise]',
  7854. setTag = '[object Set]',
  7855. weakMapTag = '[object WeakMap]';
  7856. var dataViewTag = '[object DataView]';
  7857. /** Used to detect maps, sets, and weakmaps. */
  7858. var dataViewCtorString = toSource(DataView),
  7859. mapCtorString = toSource(Map),
  7860. promiseCtorString = toSource(Promise),
  7861. setCtorString = toSource(Set),
  7862. weakMapCtorString = toSource(WeakMap);
  7863. /**
  7864. * Gets the `toStringTag` of `value`.
  7865. *
  7866. * @private
  7867. * @param {*} value The value to query.
  7868. * @returns {string} Returns the `toStringTag`.
  7869. */
  7870. var getTag = baseGetTag;
  7871. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  7872. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  7873. (Map && getTag(new Map) != mapTag) ||
  7874. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  7875. (Set && getTag(new Set) != setTag) ||
  7876. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  7877. getTag = function(value) {
  7878. var result = baseGetTag(value),
  7879. Ctor = result == objectTag ? value.constructor : undefined,
  7880. ctorString = Ctor ? toSource(Ctor) : '';
  7881. if (ctorString) {
  7882. switch (ctorString) {
  7883. case dataViewCtorString: return dataViewTag;
  7884. case mapCtorString: return mapTag;
  7885. case promiseCtorString: return promiseTag;
  7886. case setCtorString: return setTag;
  7887. case weakMapCtorString: return weakMapTag;
  7888. }
  7889. }
  7890. return result;
  7891. };
  7892. }
  7893. module.exports = getTag;
  7894. /***/ }),
  7895. /***/ "../../node_modules/lodash/_getValue.js":
  7896. /*!************************************************************************!*\
  7897. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_getValue.js ***!
  7898. \************************************************************************/
  7899. /*! no static exports found */
  7900. /***/ (function(module, exports) {
  7901. /**
  7902. * Gets the value at `key` of `object`.
  7903. *
  7904. * @private
  7905. * @param {Object} [object] The object to query.
  7906. * @param {string} key The key of the property to get.
  7907. * @returns {*} Returns the property value.
  7908. */
  7909. function getValue(object, key) {
  7910. return object == null ? undefined : object[key];
  7911. }
  7912. module.exports = getValue;
  7913. /***/ }),
  7914. /***/ "../../node_modules/lodash/_hasPath.js":
  7915. /*!***********************************************************************!*\
  7916. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hasPath.js ***!
  7917. \***********************************************************************/
  7918. /*! no static exports found */
  7919. /***/ (function(module, exports, __webpack_require__) {
  7920. var castPath = __webpack_require__(/*! ./_castPath */ "../../node_modules/lodash/_castPath.js"),
  7921. isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
  7922. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  7923. isIndex = __webpack_require__(/*! ./_isIndex */ "../../node_modules/lodash/_isIndex.js"),
  7924. isLength = __webpack_require__(/*! ./isLength */ "../../node_modules/lodash/isLength.js"),
  7925. toKey = __webpack_require__(/*! ./_toKey */ "../../node_modules/lodash/_toKey.js");
  7926. /**
  7927. * Checks if `path` exists on `object`.
  7928. *
  7929. * @private
  7930. * @param {Object} object The object to query.
  7931. * @param {Array|string} path The path to check.
  7932. * @param {Function} hasFunc The function to check properties.
  7933. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7934. */
  7935. function hasPath(object, path, hasFunc) {
  7936. path = castPath(path, object);
  7937. var index = -1,
  7938. length = path.length,
  7939. result = false;
  7940. while (++index < length) {
  7941. var key = toKey(path[index]);
  7942. if (!(result = object != null && hasFunc(object, key))) {
  7943. break;
  7944. }
  7945. object = object[key];
  7946. }
  7947. if (result || ++index != length) {
  7948. return result;
  7949. }
  7950. length = object == null ? 0 : object.length;
  7951. return !!length && isLength(length) && isIndex(key, length) &&
  7952. (isArray(object) || isArguments(object));
  7953. }
  7954. module.exports = hasPath;
  7955. /***/ }),
  7956. /***/ "../../node_modules/lodash/_hasUnicode.js":
  7957. /*!**************************************************************************!*\
  7958. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hasUnicode.js ***!
  7959. \**************************************************************************/
  7960. /*! no static exports found */
  7961. /***/ (function(module, exports) {
  7962. /** Used to compose unicode character classes. */
  7963. var rsAstralRange = '\\ud800-\\udfff',
  7964. rsComboMarksRange = '\\u0300-\\u036f',
  7965. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  7966. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  7967. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  7968. rsVarRange = '\\ufe0e\\ufe0f';
  7969. /** Used to compose unicode capture groups. */
  7970. var rsZWJ = '\\u200d';
  7971. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  7972. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  7973. /**
  7974. * Checks if `string` contains Unicode symbols.
  7975. *
  7976. * @private
  7977. * @param {string} string The string to inspect.
  7978. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  7979. */
  7980. function hasUnicode(string) {
  7981. return reHasUnicode.test(string);
  7982. }
  7983. module.exports = hasUnicode;
  7984. /***/ }),
  7985. /***/ "../../node_modules/lodash/_hashClear.js":
  7986. /*!*************************************************************************!*\
  7987. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hashClear.js ***!
  7988. \*************************************************************************/
  7989. /*! no static exports found */
  7990. /***/ (function(module, exports, __webpack_require__) {
  7991. var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ "../../node_modules/lodash/_nativeCreate.js");
  7992. /**
  7993. * Removes all key-value entries from the hash.
  7994. *
  7995. * @private
  7996. * @name clear
  7997. * @memberOf Hash
  7998. */
  7999. function hashClear() {
  8000. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  8001. this.size = 0;
  8002. }
  8003. module.exports = hashClear;
  8004. /***/ }),
  8005. /***/ "../../node_modules/lodash/_hashDelete.js":
  8006. /*!**************************************************************************!*\
  8007. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hashDelete.js ***!
  8008. \**************************************************************************/
  8009. /*! no static exports found */
  8010. /***/ (function(module, exports) {
  8011. /**
  8012. * Removes `key` and its value from the hash.
  8013. *
  8014. * @private
  8015. * @name delete
  8016. * @memberOf Hash
  8017. * @param {Object} hash The hash to modify.
  8018. * @param {string} key The key of the value to remove.
  8019. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  8020. */
  8021. function hashDelete(key) {
  8022. var result = this.has(key) && delete this.__data__[key];
  8023. this.size -= result ? 1 : 0;
  8024. return result;
  8025. }
  8026. module.exports = hashDelete;
  8027. /***/ }),
  8028. /***/ "../../node_modules/lodash/_hashGet.js":
  8029. /*!***********************************************************************!*\
  8030. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hashGet.js ***!
  8031. \***********************************************************************/
  8032. /*! no static exports found */
  8033. /***/ (function(module, exports, __webpack_require__) {
  8034. var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ "../../node_modules/lodash/_nativeCreate.js");
  8035. /** Used to stand-in for `undefined` hash values. */
  8036. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  8037. /** Used for built-in method references. */
  8038. var objectProto = Object.prototype;
  8039. /** Used to check objects for own properties. */
  8040. var hasOwnProperty = objectProto.hasOwnProperty;
  8041. /**
  8042. * Gets the hash value for `key`.
  8043. *
  8044. * @private
  8045. * @name get
  8046. * @memberOf Hash
  8047. * @param {string} key The key of the value to get.
  8048. * @returns {*} Returns the entry value.
  8049. */
  8050. function hashGet(key) {
  8051. var data = this.__data__;
  8052. if (nativeCreate) {
  8053. var result = data[key];
  8054. return result === HASH_UNDEFINED ? undefined : result;
  8055. }
  8056. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  8057. }
  8058. module.exports = hashGet;
  8059. /***/ }),
  8060. /***/ "../../node_modules/lodash/_hashHas.js":
  8061. /*!***********************************************************************!*\
  8062. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hashHas.js ***!
  8063. \***********************************************************************/
  8064. /*! no static exports found */
  8065. /***/ (function(module, exports, __webpack_require__) {
  8066. var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ "../../node_modules/lodash/_nativeCreate.js");
  8067. /** Used for built-in method references. */
  8068. var objectProto = Object.prototype;
  8069. /** Used to check objects for own properties. */
  8070. var hasOwnProperty = objectProto.hasOwnProperty;
  8071. /**
  8072. * Checks if a hash value for `key` exists.
  8073. *
  8074. * @private
  8075. * @name has
  8076. * @memberOf Hash
  8077. * @param {string} key The key of the entry to check.
  8078. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  8079. */
  8080. function hashHas(key) {
  8081. var data = this.__data__;
  8082. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  8083. }
  8084. module.exports = hashHas;
  8085. /***/ }),
  8086. /***/ "../../node_modules/lodash/_hashSet.js":
  8087. /*!***********************************************************************!*\
  8088. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_hashSet.js ***!
  8089. \***********************************************************************/
  8090. /*! no static exports found */
  8091. /***/ (function(module, exports, __webpack_require__) {
  8092. var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ "../../node_modules/lodash/_nativeCreate.js");
  8093. /** Used to stand-in for `undefined` hash values. */
  8094. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  8095. /**
  8096. * Sets the hash `key` to `value`.
  8097. *
  8098. * @private
  8099. * @name set
  8100. * @memberOf Hash
  8101. * @param {string} key The key of the value to set.
  8102. * @param {*} value The value to set.
  8103. * @returns {Object} Returns the hash instance.
  8104. */
  8105. function hashSet(key, value) {
  8106. var data = this.__data__;
  8107. this.size += this.has(key) ? 0 : 1;
  8108. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  8109. return this;
  8110. }
  8111. module.exports = hashSet;
  8112. /***/ }),
  8113. /***/ "../../node_modules/lodash/_initCloneArray.js":
  8114. /*!******************************************************************************!*\
  8115. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_initCloneArray.js ***!
  8116. \******************************************************************************/
  8117. /*! no static exports found */
  8118. /***/ (function(module, exports) {
  8119. /** Used for built-in method references. */
  8120. var objectProto = Object.prototype;
  8121. /** Used to check objects for own properties. */
  8122. var hasOwnProperty = objectProto.hasOwnProperty;
  8123. /**
  8124. * Initializes an array clone.
  8125. *
  8126. * @private
  8127. * @param {Array} array The array to clone.
  8128. * @returns {Array} Returns the initialized clone.
  8129. */
  8130. function initCloneArray(array) {
  8131. var length = array.length,
  8132. result = new array.constructor(length);
  8133. // Add properties assigned by `RegExp#exec`.
  8134. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  8135. result.index = array.index;
  8136. result.input = array.input;
  8137. }
  8138. return result;
  8139. }
  8140. module.exports = initCloneArray;
  8141. /***/ }),
  8142. /***/ "../../node_modules/lodash/_initCloneByTag.js":
  8143. /*!******************************************************************************!*\
  8144. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_initCloneByTag.js ***!
  8145. \******************************************************************************/
  8146. /*! no static exports found */
  8147. /***/ (function(module, exports, __webpack_require__) {
  8148. var cloneArrayBuffer = __webpack_require__(/*! ./_cloneArrayBuffer */ "../../node_modules/lodash/_cloneArrayBuffer.js"),
  8149. cloneDataView = __webpack_require__(/*! ./_cloneDataView */ "../../node_modules/lodash/_cloneDataView.js"),
  8150. cloneRegExp = __webpack_require__(/*! ./_cloneRegExp */ "../../node_modules/lodash/_cloneRegExp.js"),
  8151. cloneSymbol = __webpack_require__(/*! ./_cloneSymbol */ "../../node_modules/lodash/_cloneSymbol.js"),
  8152. cloneTypedArray = __webpack_require__(/*! ./_cloneTypedArray */ "../../node_modules/lodash/_cloneTypedArray.js");
  8153. /** `Object#toString` result references. */
  8154. var boolTag = '[object Boolean]',
  8155. dateTag = '[object Date]',
  8156. mapTag = '[object Map]',
  8157. numberTag = '[object Number]',
  8158. regexpTag = '[object RegExp]',
  8159. setTag = '[object Set]',
  8160. stringTag = '[object String]',
  8161. symbolTag = '[object Symbol]';
  8162. var arrayBufferTag = '[object ArrayBuffer]',
  8163. dataViewTag = '[object DataView]',
  8164. float32Tag = '[object Float32Array]',
  8165. float64Tag = '[object Float64Array]',
  8166. int8Tag = '[object Int8Array]',
  8167. int16Tag = '[object Int16Array]',
  8168. int32Tag = '[object Int32Array]',
  8169. uint8Tag = '[object Uint8Array]',
  8170. uint8ClampedTag = '[object Uint8ClampedArray]',
  8171. uint16Tag = '[object Uint16Array]',
  8172. uint32Tag = '[object Uint32Array]';
  8173. /**
  8174. * Initializes an object clone based on its `toStringTag`.
  8175. *
  8176. * **Note:** This function only supports cloning values with tags of
  8177. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  8178. *
  8179. * @private
  8180. * @param {Object} object The object to clone.
  8181. * @param {string} tag The `toStringTag` of the object to clone.
  8182. * @param {boolean} [isDeep] Specify a deep clone.
  8183. * @returns {Object} Returns the initialized clone.
  8184. */
  8185. function initCloneByTag(object, tag, isDeep) {
  8186. var Ctor = object.constructor;
  8187. switch (tag) {
  8188. case arrayBufferTag:
  8189. return cloneArrayBuffer(object);
  8190. case boolTag:
  8191. case dateTag:
  8192. return new Ctor(+object);
  8193. case dataViewTag:
  8194. return cloneDataView(object, isDeep);
  8195. case float32Tag: case float64Tag:
  8196. case int8Tag: case int16Tag: case int32Tag:
  8197. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  8198. return cloneTypedArray(object, isDeep);
  8199. case mapTag:
  8200. return new Ctor;
  8201. case numberTag:
  8202. case stringTag:
  8203. return new Ctor(object);
  8204. case regexpTag:
  8205. return cloneRegExp(object);
  8206. case setTag:
  8207. return new Ctor;
  8208. case symbolTag:
  8209. return cloneSymbol(object);
  8210. }
  8211. }
  8212. module.exports = initCloneByTag;
  8213. /***/ }),
  8214. /***/ "../../node_modules/lodash/_initCloneObject.js":
  8215. /*!*******************************************************************************!*\
  8216. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_initCloneObject.js ***!
  8217. \*******************************************************************************/
  8218. /*! no static exports found */
  8219. /***/ (function(module, exports, __webpack_require__) {
  8220. var baseCreate = __webpack_require__(/*! ./_baseCreate */ "../../node_modules/lodash/_baseCreate.js"),
  8221. getPrototype = __webpack_require__(/*! ./_getPrototype */ "../../node_modules/lodash/_getPrototype.js"),
  8222. isPrototype = __webpack_require__(/*! ./_isPrototype */ "../../node_modules/lodash/_isPrototype.js");
  8223. /**
  8224. * Initializes an object clone.
  8225. *
  8226. * @private
  8227. * @param {Object} object The object to clone.
  8228. * @returns {Object} Returns the initialized clone.
  8229. */
  8230. function initCloneObject(object) {
  8231. return (typeof object.constructor == 'function' && !isPrototype(object))
  8232. ? baseCreate(getPrototype(object))
  8233. : {};
  8234. }
  8235. module.exports = initCloneObject;
  8236. /***/ }),
  8237. /***/ "../../node_modules/lodash/_isFlattenable.js":
  8238. /*!*****************************************************************************!*\
  8239. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isFlattenable.js ***!
  8240. \*****************************************************************************/
  8241. /*! no static exports found */
  8242. /***/ (function(module, exports, __webpack_require__) {
  8243. var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js"),
  8244. isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
  8245. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
  8246. /** Built-in value references. */
  8247. var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
  8248. /**
  8249. * Checks if `value` is a flattenable `arguments` object or array.
  8250. *
  8251. * @private
  8252. * @param {*} value The value to check.
  8253. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  8254. */
  8255. function isFlattenable(value) {
  8256. return isArray(value) || isArguments(value) ||
  8257. !!(spreadableSymbol && value && value[spreadableSymbol]);
  8258. }
  8259. module.exports = isFlattenable;
  8260. /***/ }),
  8261. /***/ "../../node_modules/lodash/_isIndex.js":
  8262. /*!***********************************************************************!*\
  8263. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isIndex.js ***!
  8264. \***********************************************************************/
  8265. /*! no static exports found */
  8266. /***/ (function(module, exports) {
  8267. /** Used as references for various `Number` constants. */
  8268. var MAX_SAFE_INTEGER = 9007199254740991;
  8269. /** Used to detect unsigned integer values. */
  8270. var reIsUint = /^(?:0|[1-9]\d*)$/;
  8271. /**
  8272. * Checks if `value` is a valid array-like index.
  8273. *
  8274. * @private
  8275. * @param {*} value The value to check.
  8276. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  8277. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  8278. */
  8279. function isIndex(value, length) {
  8280. var type = typeof value;
  8281. length = length == null ? MAX_SAFE_INTEGER : length;
  8282. return !!length &&
  8283. (type == 'number' ||
  8284. (type != 'symbol' && reIsUint.test(value))) &&
  8285. (value > -1 && value % 1 == 0 && value < length);
  8286. }
  8287. module.exports = isIndex;
  8288. /***/ }),
  8289. /***/ "../../node_modules/lodash/_isIterateeCall.js":
  8290. /*!******************************************************************************!*\
  8291. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isIterateeCall.js ***!
  8292. \******************************************************************************/
  8293. /*! no static exports found */
  8294. /***/ (function(module, exports, __webpack_require__) {
  8295. var eq = __webpack_require__(/*! ./eq */ "../../node_modules/lodash/eq.js"),
  8296. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js"),
  8297. isIndex = __webpack_require__(/*! ./_isIndex */ "../../node_modules/lodash/_isIndex.js"),
  8298. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js");
  8299. /**
  8300. * Checks if the given arguments are from an iteratee call.
  8301. *
  8302. * @private
  8303. * @param {*} value The potential iteratee value argument.
  8304. * @param {*} index The potential iteratee index or key argument.
  8305. * @param {*} object The potential iteratee object argument.
  8306. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  8307. * else `false`.
  8308. */
  8309. function isIterateeCall(value, index, object) {
  8310. if (!isObject(object)) {
  8311. return false;
  8312. }
  8313. var type = typeof index;
  8314. if (type == 'number'
  8315. ? (isArrayLike(object) && isIndex(index, object.length))
  8316. : (type == 'string' && index in object)
  8317. ) {
  8318. return eq(object[index], value);
  8319. }
  8320. return false;
  8321. }
  8322. module.exports = isIterateeCall;
  8323. /***/ }),
  8324. /***/ "../../node_modules/lodash/_isKey.js":
  8325. /*!*********************************************************************!*\
  8326. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isKey.js ***!
  8327. \*********************************************************************/
  8328. /*! no static exports found */
  8329. /***/ (function(module, exports, __webpack_require__) {
  8330. var isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  8331. isSymbol = __webpack_require__(/*! ./isSymbol */ "../../node_modules/lodash/isSymbol.js");
  8332. /** Used to match property names within property paths. */
  8333. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  8334. reIsPlainProp = /^\w*$/;
  8335. /**
  8336. * Checks if `value` is a property name and not a property path.
  8337. *
  8338. * @private
  8339. * @param {*} value The value to check.
  8340. * @param {Object} [object] The object to query keys on.
  8341. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  8342. */
  8343. function isKey(value, object) {
  8344. if (isArray(value)) {
  8345. return false;
  8346. }
  8347. var type = typeof value;
  8348. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  8349. value == null || isSymbol(value)) {
  8350. return true;
  8351. }
  8352. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  8353. (object != null && value in Object(object));
  8354. }
  8355. module.exports = isKey;
  8356. /***/ }),
  8357. /***/ "../../node_modules/lodash/_isKeyable.js":
  8358. /*!*************************************************************************!*\
  8359. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isKeyable.js ***!
  8360. \*************************************************************************/
  8361. /*! no static exports found */
  8362. /***/ (function(module, exports) {
  8363. /**
  8364. * Checks if `value` is suitable for use as unique object key.
  8365. *
  8366. * @private
  8367. * @param {*} value The value to check.
  8368. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  8369. */
  8370. function isKeyable(value) {
  8371. var type = typeof value;
  8372. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  8373. ? (value !== '__proto__')
  8374. : (value === null);
  8375. }
  8376. module.exports = isKeyable;
  8377. /***/ }),
  8378. /***/ "../../node_modules/lodash/_isMasked.js":
  8379. /*!************************************************************************!*\
  8380. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isMasked.js ***!
  8381. \************************************************************************/
  8382. /*! no static exports found */
  8383. /***/ (function(module, exports, __webpack_require__) {
  8384. var coreJsData = __webpack_require__(/*! ./_coreJsData */ "../../node_modules/lodash/_coreJsData.js");
  8385. /** Used to detect methods masquerading as native. */
  8386. var maskSrcKey = (function() {
  8387. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  8388. return uid ? ('Symbol(src)_1.' + uid) : '';
  8389. }());
  8390. /**
  8391. * Checks if `func` has its source masked.
  8392. *
  8393. * @private
  8394. * @param {Function} func The function to check.
  8395. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  8396. */
  8397. function isMasked(func) {
  8398. return !!maskSrcKey && (maskSrcKey in func);
  8399. }
  8400. module.exports = isMasked;
  8401. /***/ }),
  8402. /***/ "../../node_modules/lodash/_isPrototype.js":
  8403. /*!***************************************************************************!*\
  8404. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isPrototype.js ***!
  8405. \***************************************************************************/
  8406. /*! no static exports found */
  8407. /***/ (function(module, exports) {
  8408. /** Used for built-in method references. */
  8409. var objectProto = Object.prototype;
  8410. /**
  8411. * Checks if `value` is likely a prototype object.
  8412. *
  8413. * @private
  8414. * @param {*} value The value to check.
  8415. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  8416. */
  8417. function isPrototype(value) {
  8418. var Ctor = value && value.constructor,
  8419. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  8420. return value === proto;
  8421. }
  8422. module.exports = isPrototype;
  8423. /***/ }),
  8424. /***/ "../../node_modules/lodash/_isStrictComparable.js":
  8425. /*!**********************************************************************************!*\
  8426. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_isStrictComparable.js ***!
  8427. \**********************************************************************************/
  8428. /*! no static exports found */
  8429. /***/ (function(module, exports, __webpack_require__) {
  8430. var isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js");
  8431. /**
  8432. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  8433. *
  8434. * @private
  8435. * @param {*} value The value to check.
  8436. * @returns {boolean} Returns `true` if `value` if suitable for strict
  8437. * equality comparisons, else `false`.
  8438. */
  8439. function isStrictComparable(value) {
  8440. return value === value && !isObject(value);
  8441. }
  8442. module.exports = isStrictComparable;
  8443. /***/ }),
  8444. /***/ "../../node_modules/lodash/_listCacheClear.js":
  8445. /*!******************************************************************************!*\
  8446. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_listCacheClear.js ***!
  8447. \******************************************************************************/
  8448. /*! no static exports found */
  8449. /***/ (function(module, exports) {
  8450. /**
  8451. * Removes all key-value entries from the list cache.
  8452. *
  8453. * @private
  8454. * @name clear
  8455. * @memberOf ListCache
  8456. */
  8457. function listCacheClear() {
  8458. this.__data__ = [];
  8459. this.size = 0;
  8460. }
  8461. module.exports = listCacheClear;
  8462. /***/ }),
  8463. /***/ "../../node_modules/lodash/_listCacheDelete.js":
  8464. /*!*******************************************************************************!*\
  8465. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_listCacheDelete.js ***!
  8466. \*******************************************************************************/
  8467. /*! no static exports found */
  8468. /***/ (function(module, exports, __webpack_require__) {
  8469. var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "../../node_modules/lodash/_assocIndexOf.js");
  8470. /** Used for built-in method references. */
  8471. var arrayProto = Array.prototype;
  8472. /** Built-in value references. */
  8473. var splice = arrayProto.splice;
  8474. /**
  8475. * Removes `key` and its value from the list cache.
  8476. *
  8477. * @private
  8478. * @name delete
  8479. * @memberOf ListCache
  8480. * @param {string} key The key of the value to remove.
  8481. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  8482. */
  8483. function listCacheDelete(key) {
  8484. var data = this.__data__,
  8485. index = assocIndexOf(data, key);
  8486. if (index < 0) {
  8487. return false;
  8488. }
  8489. var lastIndex = data.length - 1;
  8490. if (index == lastIndex) {
  8491. data.pop();
  8492. } else {
  8493. splice.call(data, index, 1);
  8494. }
  8495. --this.size;
  8496. return true;
  8497. }
  8498. module.exports = listCacheDelete;
  8499. /***/ }),
  8500. /***/ "../../node_modules/lodash/_listCacheGet.js":
  8501. /*!****************************************************************************!*\
  8502. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_listCacheGet.js ***!
  8503. \****************************************************************************/
  8504. /*! no static exports found */
  8505. /***/ (function(module, exports, __webpack_require__) {
  8506. var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "../../node_modules/lodash/_assocIndexOf.js");
  8507. /**
  8508. * Gets the list cache value for `key`.
  8509. *
  8510. * @private
  8511. * @name get
  8512. * @memberOf ListCache
  8513. * @param {string} key The key of the value to get.
  8514. * @returns {*} Returns the entry value.
  8515. */
  8516. function listCacheGet(key) {
  8517. var data = this.__data__,
  8518. index = assocIndexOf(data, key);
  8519. return index < 0 ? undefined : data[index][1];
  8520. }
  8521. module.exports = listCacheGet;
  8522. /***/ }),
  8523. /***/ "../../node_modules/lodash/_listCacheHas.js":
  8524. /*!****************************************************************************!*\
  8525. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_listCacheHas.js ***!
  8526. \****************************************************************************/
  8527. /*! no static exports found */
  8528. /***/ (function(module, exports, __webpack_require__) {
  8529. var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "../../node_modules/lodash/_assocIndexOf.js");
  8530. /**
  8531. * Checks if a list cache value for `key` exists.
  8532. *
  8533. * @private
  8534. * @name has
  8535. * @memberOf ListCache
  8536. * @param {string} key The key of the entry to check.
  8537. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  8538. */
  8539. function listCacheHas(key) {
  8540. return assocIndexOf(this.__data__, key) > -1;
  8541. }
  8542. module.exports = listCacheHas;
  8543. /***/ }),
  8544. /***/ "../../node_modules/lodash/_listCacheSet.js":
  8545. /*!****************************************************************************!*\
  8546. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_listCacheSet.js ***!
  8547. \****************************************************************************/
  8548. /*! no static exports found */
  8549. /***/ (function(module, exports, __webpack_require__) {
  8550. var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "../../node_modules/lodash/_assocIndexOf.js");
  8551. /**
  8552. * Sets the list cache `key` to `value`.
  8553. *
  8554. * @private
  8555. * @name set
  8556. * @memberOf ListCache
  8557. * @param {string} key The key of the value to set.
  8558. * @param {*} value The value to set.
  8559. * @returns {Object} Returns the list cache instance.
  8560. */
  8561. function listCacheSet(key, value) {
  8562. var data = this.__data__,
  8563. index = assocIndexOf(data, key);
  8564. if (index < 0) {
  8565. ++this.size;
  8566. data.push([key, value]);
  8567. } else {
  8568. data[index][1] = value;
  8569. }
  8570. return this;
  8571. }
  8572. module.exports = listCacheSet;
  8573. /***/ }),
  8574. /***/ "../../node_modules/lodash/_mapCacheClear.js":
  8575. /*!*****************************************************************************!*\
  8576. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_mapCacheClear.js ***!
  8577. \*****************************************************************************/
  8578. /*! no static exports found */
  8579. /***/ (function(module, exports, __webpack_require__) {
  8580. var Hash = __webpack_require__(/*! ./_Hash */ "../../node_modules/lodash/_Hash.js"),
  8581. ListCache = __webpack_require__(/*! ./_ListCache */ "../../node_modules/lodash/_ListCache.js"),
  8582. Map = __webpack_require__(/*! ./_Map */ "../../node_modules/lodash/_Map.js");
  8583. /**
  8584. * Removes all key-value entries from the map.
  8585. *
  8586. * @private
  8587. * @name clear
  8588. * @memberOf MapCache
  8589. */
  8590. function mapCacheClear() {
  8591. this.size = 0;
  8592. this.__data__ = {
  8593. 'hash': new Hash,
  8594. 'map': new (Map || ListCache),
  8595. 'string': new Hash
  8596. };
  8597. }
  8598. module.exports = mapCacheClear;
  8599. /***/ }),
  8600. /***/ "../../node_modules/lodash/_mapCacheDelete.js":
  8601. /*!******************************************************************************!*\
  8602. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_mapCacheDelete.js ***!
  8603. \******************************************************************************/
  8604. /*! no static exports found */
  8605. /***/ (function(module, exports, __webpack_require__) {
  8606. var getMapData = __webpack_require__(/*! ./_getMapData */ "../../node_modules/lodash/_getMapData.js");
  8607. /**
  8608. * Removes `key` and its value from the map.
  8609. *
  8610. * @private
  8611. * @name delete
  8612. * @memberOf MapCache
  8613. * @param {string} key The key of the value to remove.
  8614. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  8615. */
  8616. function mapCacheDelete(key) {
  8617. var result = getMapData(this, key)['delete'](key);
  8618. this.size -= result ? 1 : 0;
  8619. return result;
  8620. }
  8621. module.exports = mapCacheDelete;
  8622. /***/ }),
  8623. /***/ "../../node_modules/lodash/_mapCacheGet.js":
  8624. /*!***************************************************************************!*\
  8625. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_mapCacheGet.js ***!
  8626. \***************************************************************************/
  8627. /*! no static exports found */
  8628. /***/ (function(module, exports, __webpack_require__) {
  8629. var getMapData = __webpack_require__(/*! ./_getMapData */ "../../node_modules/lodash/_getMapData.js");
  8630. /**
  8631. * Gets the map value for `key`.
  8632. *
  8633. * @private
  8634. * @name get
  8635. * @memberOf MapCache
  8636. * @param {string} key The key of the value to get.
  8637. * @returns {*} Returns the entry value.
  8638. */
  8639. function mapCacheGet(key) {
  8640. return getMapData(this, key).get(key);
  8641. }
  8642. module.exports = mapCacheGet;
  8643. /***/ }),
  8644. /***/ "../../node_modules/lodash/_mapCacheHas.js":
  8645. /*!***************************************************************************!*\
  8646. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_mapCacheHas.js ***!
  8647. \***************************************************************************/
  8648. /*! no static exports found */
  8649. /***/ (function(module, exports, __webpack_require__) {
  8650. var getMapData = __webpack_require__(/*! ./_getMapData */ "../../node_modules/lodash/_getMapData.js");
  8651. /**
  8652. * Checks if a map value for `key` exists.
  8653. *
  8654. * @private
  8655. * @name has
  8656. * @memberOf MapCache
  8657. * @param {string} key The key of the entry to check.
  8658. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  8659. */
  8660. function mapCacheHas(key) {
  8661. return getMapData(this, key).has(key);
  8662. }
  8663. module.exports = mapCacheHas;
  8664. /***/ }),
  8665. /***/ "../../node_modules/lodash/_mapCacheSet.js":
  8666. /*!***************************************************************************!*\
  8667. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_mapCacheSet.js ***!
  8668. \***************************************************************************/
  8669. /*! no static exports found */
  8670. /***/ (function(module, exports, __webpack_require__) {
  8671. var getMapData = __webpack_require__(/*! ./_getMapData */ "../../node_modules/lodash/_getMapData.js");
  8672. /**
  8673. * Sets the map `key` to `value`.
  8674. *
  8675. * @private
  8676. * @name set
  8677. * @memberOf MapCache
  8678. * @param {string} key The key of the value to set.
  8679. * @param {*} value The value to set.
  8680. * @returns {Object} Returns the map cache instance.
  8681. */
  8682. function mapCacheSet(key, value) {
  8683. var data = getMapData(this, key),
  8684. size = data.size;
  8685. data.set(key, value);
  8686. this.size += data.size == size ? 0 : 1;
  8687. return this;
  8688. }
  8689. module.exports = mapCacheSet;
  8690. /***/ }),
  8691. /***/ "../../node_modules/lodash/_mapToArray.js":
  8692. /*!**************************************************************************!*\
  8693. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_mapToArray.js ***!
  8694. \**************************************************************************/
  8695. /*! no static exports found */
  8696. /***/ (function(module, exports) {
  8697. /**
  8698. * Converts `map` to its key-value pairs.
  8699. *
  8700. * @private
  8701. * @param {Object} map The map to convert.
  8702. * @returns {Array} Returns the key-value pairs.
  8703. */
  8704. function mapToArray(map) {
  8705. var index = -1,
  8706. result = Array(map.size);
  8707. map.forEach(function(value, key) {
  8708. result[++index] = [key, value];
  8709. });
  8710. return result;
  8711. }
  8712. module.exports = mapToArray;
  8713. /***/ }),
  8714. /***/ "../../node_modules/lodash/_matchesStrictComparable.js":
  8715. /*!***************************************************************************************!*\
  8716. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_matchesStrictComparable.js ***!
  8717. \***************************************************************************************/
  8718. /*! no static exports found */
  8719. /***/ (function(module, exports) {
  8720. /**
  8721. * A specialized version of `matchesProperty` for source values suitable
  8722. * for strict equality comparisons, i.e. `===`.
  8723. *
  8724. * @private
  8725. * @param {string} key The key of the property to get.
  8726. * @param {*} srcValue The value to match.
  8727. * @returns {Function} Returns the new spec function.
  8728. */
  8729. function matchesStrictComparable(key, srcValue) {
  8730. return function(object) {
  8731. if (object == null) {
  8732. return false;
  8733. }
  8734. return object[key] === srcValue &&
  8735. (srcValue !== undefined || (key in Object(object)));
  8736. };
  8737. }
  8738. module.exports = matchesStrictComparable;
  8739. /***/ }),
  8740. /***/ "../../node_modules/lodash/_memoizeCapped.js":
  8741. /*!*****************************************************************************!*\
  8742. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_memoizeCapped.js ***!
  8743. \*****************************************************************************/
  8744. /*! no static exports found */
  8745. /***/ (function(module, exports, __webpack_require__) {
  8746. var memoize = __webpack_require__(/*! ./memoize */ "../../node_modules/lodash/memoize.js");
  8747. /** Used as the maximum memoize cache size. */
  8748. var MAX_MEMOIZE_SIZE = 500;
  8749. /**
  8750. * A specialized version of `_.memoize` which clears the memoized function's
  8751. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  8752. *
  8753. * @private
  8754. * @param {Function} func The function to have its output memoized.
  8755. * @returns {Function} Returns the new memoized function.
  8756. */
  8757. function memoizeCapped(func) {
  8758. var result = memoize(func, function(key) {
  8759. if (cache.size === MAX_MEMOIZE_SIZE) {
  8760. cache.clear();
  8761. }
  8762. return key;
  8763. });
  8764. var cache = result.cache;
  8765. return result;
  8766. }
  8767. module.exports = memoizeCapped;
  8768. /***/ }),
  8769. /***/ "../../node_modules/lodash/_nativeCreate.js":
  8770. /*!****************************************************************************!*\
  8771. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_nativeCreate.js ***!
  8772. \****************************************************************************/
  8773. /*! no static exports found */
  8774. /***/ (function(module, exports, __webpack_require__) {
  8775. var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js");
  8776. /* Built-in method references that are verified to be native. */
  8777. var nativeCreate = getNative(Object, 'create');
  8778. module.exports = nativeCreate;
  8779. /***/ }),
  8780. /***/ "../../node_modules/lodash/_nativeKeys.js":
  8781. /*!**************************************************************************!*\
  8782. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_nativeKeys.js ***!
  8783. \**************************************************************************/
  8784. /*! no static exports found */
  8785. /***/ (function(module, exports, __webpack_require__) {
  8786. var overArg = __webpack_require__(/*! ./_overArg */ "../../node_modules/lodash/_overArg.js");
  8787. /* Built-in method references for those with the same name as other `lodash` methods. */
  8788. var nativeKeys = overArg(Object.keys, Object);
  8789. module.exports = nativeKeys;
  8790. /***/ }),
  8791. /***/ "../../node_modules/lodash/_nativeKeysIn.js":
  8792. /*!****************************************************************************!*\
  8793. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_nativeKeysIn.js ***!
  8794. \****************************************************************************/
  8795. /*! no static exports found */
  8796. /***/ (function(module, exports) {
  8797. /**
  8798. * This function is like
  8799. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  8800. * except that it includes inherited enumerable properties.
  8801. *
  8802. * @private
  8803. * @param {Object} object The object to query.
  8804. * @returns {Array} Returns the array of property names.
  8805. */
  8806. function nativeKeysIn(object) {
  8807. var result = [];
  8808. if (object != null) {
  8809. for (var key in Object(object)) {
  8810. result.push(key);
  8811. }
  8812. }
  8813. return result;
  8814. }
  8815. module.exports = nativeKeysIn;
  8816. /***/ }),
  8817. /***/ "../../node_modules/lodash/_nodeUtil.js":
  8818. /*!************************************************************************!*\
  8819. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_nodeUtil.js ***!
  8820. \************************************************************************/
  8821. /*! no static exports found */
  8822. /***/ (function(module, exports, __webpack_require__) {
  8823. /* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(/*! ./_freeGlobal */ "../../node_modules/lodash/_freeGlobal.js");
  8824. /** Detect free variable `exports`. */
  8825. var freeExports = true && exports && !exports.nodeType && exports;
  8826. /** Detect free variable `module`. */
  8827. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  8828. /** Detect the popular CommonJS extension `module.exports`. */
  8829. var moduleExports = freeModule && freeModule.exports === freeExports;
  8830. /** Detect free variable `process` from Node.js. */
  8831. var freeProcess = moduleExports && freeGlobal.process;
  8832. /** Used to access faster Node.js helpers. */
  8833. var nodeUtil = (function() {
  8834. try {
  8835. // Use `util.types` for Node.js 10+.
  8836. var types = freeModule && freeModule.require && freeModule.require('util').types;
  8837. if (types) {
  8838. return types;
  8839. }
  8840. // Legacy `process.binding('util')` for Node.js < 10.
  8841. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  8842. } catch (e) {}
  8843. }());
  8844. module.exports = nodeUtil;
  8845. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
  8846. /***/ }),
  8847. /***/ "../../node_modules/lodash/_objectToString.js":
  8848. /*!******************************************************************************!*\
  8849. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_objectToString.js ***!
  8850. \******************************************************************************/
  8851. /*! no static exports found */
  8852. /***/ (function(module, exports) {
  8853. /** Used for built-in method references. */
  8854. var objectProto = Object.prototype;
  8855. /**
  8856. * Used to resolve the
  8857. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  8858. * of values.
  8859. */
  8860. var nativeObjectToString = objectProto.toString;
  8861. /**
  8862. * Converts `value` to a string using `Object.prototype.toString`.
  8863. *
  8864. * @private
  8865. * @param {*} value The value to convert.
  8866. * @returns {string} Returns the converted string.
  8867. */
  8868. function objectToString(value) {
  8869. return nativeObjectToString.call(value);
  8870. }
  8871. module.exports = objectToString;
  8872. /***/ }),
  8873. /***/ "../../node_modules/lodash/_overArg.js":
  8874. /*!***********************************************************************!*\
  8875. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_overArg.js ***!
  8876. \***********************************************************************/
  8877. /*! no static exports found */
  8878. /***/ (function(module, exports) {
  8879. /**
  8880. * Creates a unary function that invokes `func` with its argument transformed.
  8881. *
  8882. * @private
  8883. * @param {Function} func The function to wrap.
  8884. * @param {Function} transform The argument transform.
  8885. * @returns {Function} Returns the new function.
  8886. */
  8887. function overArg(func, transform) {
  8888. return function(arg) {
  8889. return func(transform(arg));
  8890. };
  8891. }
  8892. module.exports = overArg;
  8893. /***/ }),
  8894. /***/ "../../node_modules/lodash/_overRest.js":
  8895. /*!************************************************************************!*\
  8896. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_overRest.js ***!
  8897. \************************************************************************/
  8898. /*! no static exports found */
  8899. /***/ (function(module, exports, __webpack_require__) {
  8900. var apply = __webpack_require__(/*! ./_apply */ "../../node_modules/lodash/_apply.js");
  8901. /* Built-in method references for those with the same name as other `lodash` methods. */
  8902. var nativeMax = Math.max;
  8903. /**
  8904. * A specialized version of `baseRest` which transforms the rest array.
  8905. *
  8906. * @private
  8907. * @param {Function} func The function to apply a rest parameter to.
  8908. * @param {number} [start=func.length-1] The start position of the rest parameter.
  8909. * @param {Function} transform The rest array transform.
  8910. * @returns {Function} Returns the new function.
  8911. */
  8912. function overRest(func, start, transform) {
  8913. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  8914. return function() {
  8915. var args = arguments,
  8916. index = -1,
  8917. length = nativeMax(args.length - start, 0),
  8918. array = Array(length);
  8919. while (++index < length) {
  8920. array[index] = args[start + index];
  8921. }
  8922. index = -1;
  8923. var otherArgs = Array(start + 1);
  8924. while (++index < start) {
  8925. otherArgs[index] = args[index];
  8926. }
  8927. otherArgs[start] = transform(array);
  8928. return apply(func, this, otherArgs);
  8929. };
  8930. }
  8931. module.exports = overRest;
  8932. /***/ }),
  8933. /***/ "../../node_modules/lodash/_root.js":
  8934. /*!********************************************************************!*\
  8935. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_root.js ***!
  8936. \********************************************************************/
  8937. /*! no static exports found */
  8938. /***/ (function(module, exports, __webpack_require__) {
  8939. var freeGlobal = __webpack_require__(/*! ./_freeGlobal */ "../../node_modules/lodash/_freeGlobal.js");
  8940. /** Detect free variable `self`. */
  8941. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  8942. /** Used as a reference to the global object. */
  8943. var root = freeGlobal || freeSelf || Function('return this')();
  8944. module.exports = root;
  8945. /***/ }),
  8946. /***/ "../../node_modules/lodash/_safeGet.js":
  8947. /*!***********************************************************************!*\
  8948. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_safeGet.js ***!
  8949. \***********************************************************************/
  8950. /*! no static exports found */
  8951. /***/ (function(module, exports) {
  8952. /**
  8953. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  8954. *
  8955. * @private
  8956. * @param {Object} object The object to query.
  8957. * @param {string} key The key of the property to get.
  8958. * @returns {*} Returns the property value.
  8959. */
  8960. function safeGet(object, key) {
  8961. if (key === 'constructor' && typeof object[key] === 'function') {
  8962. return;
  8963. }
  8964. if (key == '__proto__') {
  8965. return;
  8966. }
  8967. return object[key];
  8968. }
  8969. module.exports = safeGet;
  8970. /***/ }),
  8971. /***/ "../../node_modules/lodash/_setCacheAdd.js":
  8972. /*!***************************************************************************!*\
  8973. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_setCacheAdd.js ***!
  8974. \***************************************************************************/
  8975. /*! no static exports found */
  8976. /***/ (function(module, exports) {
  8977. /** Used to stand-in for `undefined` hash values. */
  8978. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  8979. /**
  8980. * Adds `value` to the array cache.
  8981. *
  8982. * @private
  8983. * @name add
  8984. * @memberOf SetCache
  8985. * @alias push
  8986. * @param {*} value The value to cache.
  8987. * @returns {Object} Returns the cache instance.
  8988. */
  8989. function setCacheAdd(value) {
  8990. this.__data__.set(value, HASH_UNDEFINED);
  8991. return this;
  8992. }
  8993. module.exports = setCacheAdd;
  8994. /***/ }),
  8995. /***/ "../../node_modules/lodash/_setCacheHas.js":
  8996. /*!***************************************************************************!*\
  8997. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_setCacheHas.js ***!
  8998. \***************************************************************************/
  8999. /*! no static exports found */
  9000. /***/ (function(module, exports) {
  9001. /**
  9002. * Checks if `value` is in the array cache.
  9003. *
  9004. * @private
  9005. * @name has
  9006. * @memberOf SetCache
  9007. * @param {*} value The value to search for.
  9008. * @returns {number} Returns `true` if `value` is found, else `false`.
  9009. */
  9010. function setCacheHas(value) {
  9011. return this.__data__.has(value);
  9012. }
  9013. module.exports = setCacheHas;
  9014. /***/ }),
  9015. /***/ "../../node_modules/lodash/_setToArray.js":
  9016. /*!**************************************************************************!*\
  9017. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_setToArray.js ***!
  9018. \**************************************************************************/
  9019. /*! no static exports found */
  9020. /***/ (function(module, exports) {
  9021. /**
  9022. * Converts `set` to an array of its values.
  9023. *
  9024. * @private
  9025. * @param {Object} set The set to convert.
  9026. * @returns {Array} Returns the values.
  9027. */
  9028. function setToArray(set) {
  9029. var index = -1,
  9030. result = Array(set.size);
  9031. set.forEach(function(value) {
  9032. result[++index] = value;
  9033. });
  9034. return result;
  9035. }
  9036. module.exports = setToArray;
  9037. /***/ }),
  9038. /***/ "../../node_modules/lodash/_setToString.js":
  9039. /*!***************************************************************************!*\
  9040. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_setToString.js ***!
  9041. \***************************************************************************/
  9042. /*! no static exports found */
  9043. /***/ (function(module, exports, __webpack_require__) {
  9044. var baseSetToString = __webpack_require__(/*! ./_baseSetToString */ "../../node_modules/lodash/_baseSetToString.js"),
  9045. shortOut = __webpack_require__(/*! ./_shortOut */ "../../node_modules/lodash/_shortOut.js");
  9046. /**
  9047. * Sets the `toString` method of `func` to return `string`.
  9048. *
  9049. * @private
  9050. * @param {Function} func The function to modify.
  9051. * @param {Function} string The `toString` result.
  9052. * @returns {Function} Returns `func`.
  9053. */
  9054. var setToString = shortOut(baseSetToString);
  9055. module.exports = setToString;
  9056. /***/ }),
  9057. /***/ "../../node_modules/lodash/_shortOut.js":
  9058. /*!************************************************************************!*\
  9059. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_shortOut.js ***!
  9060. \************************************************************************/
  9061. /*! no static exports found */
  9062. /***/ (function(module, exports) {
  9063. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  9064. var HOT_COUNT = 800,
  9065. HOT_SPAN = 16;
  9066. /* Built-in method references for those with the same name as other `lodash` methods. */
  9067. var nativeNow = Date.now;
  9068. /**
  9069. * Creates a function that'll short out and invoke `identity` instead
  9070. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  9071. * milliseconds.
  9072. *
  9073. * @private
  9074. * @param {Function} func The function to restrict.
  9075. * @returns {Function} Returns the new shortable function.
  9076. */
  9077. function shortOut(func) {
  9078. var count = 0,
  9079. lastCalled = 0;
  9080. return function() {
  9081. var stamp = nativeNow(),
  9082. remaining = HOT_SPAN - (stamp - lastCalled);
  9083. lastCalled = stamp;
  9084. if (remaining > 0) {
  9085. if (++count >= HOT_COUNT) {
  9086. return arguments[0];
  9087. }
  9088. } else {
  9089. count = 0;
  9090. }
  9091. return func.apply(undefined, arguments);
  9092. };
  9093. }
  9094. module.exports = shortOut;
  9095. /***/ }),
  9096. /***/ "../../node_modules/lodash/_stackClear.js":
  9097. /*!**************************************************************************!*\
  9098. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stackClear.js ***!
  9099. \**************************************************************************/
  9100. /*! no static exports found */
  9101. /***/ (function(module, exports, __webpack_require__) {
  9102. var ListCache = __webpack_require__(/*! ./_ListCache */ "../../node_modules/lodash/_ListCache.js");
  9103. /**
  9104. * Removes all key-value entries from the stack.
  9105. *
  9106. * @private
  9107. * @name clear
  9108. * @memberOf Stack
  9109. */
  9110. function stackClear() {
  9111. this.__data__ = new ListCache;
  9112. this.size = 0;
  9113. }
  9114. module.exports = stackClear;
  9115. /***/ }),
  9116. /***/ "../../node_modules/lodash/_stackDelete.js":
  9117. /*!***************************************************************************!*\
  9118. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stackDelete.js ***!
  9119. \***************************************************************************/
  9120. /*! no static exports found */
  9121. /***/ (function(module, exports) {
  9122. /**
  9123. * Removes `key` and its value from the stack.
  9124. *
  9125. * @private
  9126. * @name delete
  9127. * @memberOf Stack
  9128. * @param {string} key The key of the value to remove.
  9129. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  9130. */
  9131. function stackDelete(key) {
  9132. var data = this.__data__,
  9133. result = data['delete'](key);
  9134. this.size = data.size;
  9135. return result;
  9136. }
  9137. module.exports = stackDelete;
  9138. /***/ }),
  9139. /***/ "../../node_modules/lodash/_stackGet.js":
  9140. /*!************************************************************************!*\
  9141. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stackGet.js ***!
  9142. \************************************************************************/
  9143. /*! no static exports found */
  9144. /***/ (function(module, exports) {
  9145. /**
  9146. * Gets the stack value for `key`.
  9147. *
  9148. * @private
  9149. * @name get
  9150. * @memberOf Stack
  9151. * @param {string} key The key of the value to get.
  9152. * @returns {*} Returns the entry value.
  9153. */
  9154. function stackGet(key) {
  9155. return this.__data__.get(key);
  9156. }
  9157. module.exports = stackGet;
  9158. /***/ }),
  9159. /***/ "../../node_modules/lodash/_stackHas.js":
  9160. /*!************************************************************************!*\
  9161. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stackHas.js ***!
  9162. \************************************************************************/
  9163. /*! no static exports found */
  9164. /***/ (function(module, exports) {
  9165. /**
  9166. * Checks if a stack value for `key` exists.
  9167. *
  9168. * @private
  9169. * @name has
  9170. * @memberOf Stack
  9171. * @param {string} key The key of the entry to check.
  9172. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  9173. */
  9174. function stackHas(key) {
  9175. return this.__data__.has(key);
  9176. }
  9177. module.exports = stackHas;
  9178. /***/ }),
  9179. /***/ "../../node_modules/lodash/_stackSet.js":
  9180. /*!************************************************************************!*\
  9181. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stackSet.js ***!
  9182. \************************************************************************/
  9183. /*! no static exports found */
  9184. /***/ (function(module, exports, __webpack_require__) {
  9185. var ListCache = __webpack_require__(/*! ./_ListCache */ "../../node_modules/lodash/_ListCache.js"),
  9186. Map = __webpack_require__(/*! ./_Map */ "../../node_modules/lodash/_Map.js"),
  9187. MapCache = __webpack_require__(/*! ./_MapCache */ "../../node_modules/lodash/_MapCache.js");
  9188. /** Used as the size to enable large array optimizations. */
  9189. var LARGE_ARRAY_SIZE = 200;
  9190. /**
  9191. * Sets the stack `key` to `value`.
  9192. *
  9193. * @private
  9194. * @name set
  9195. * @memberOf Stack
  9196. * @param {string} key The key of the value to set.
  9197. * @param {*} value The value to set.
  9198. * @returns {Object} Returns the stack cache instance.
  9199. */
  9200. function stackSet(key, value) {
  9201. var data = this.__data__;
  9202. if (data instanceof ListCache) {
  9203. var pairs = data.__data__;
  9204. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  9205. pairs.push([key, value]);
  9206. this.size = ++data.size;
  9207. return this;
  9208. }
  9209. data = this.__data__ = new MapCache(pairs);
  9210. }
  9211. data.set(key, value);
  9212. this.size = data.size;
  9213. return this;
  9214. }
  9215. module.exports = stackSet;
  9216. /***/ }),
  9217. /***/ "../../node_modules/lodash/_strictIndexOf.js":
  9218. /*!*****************************************************************************!*\
  9219. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_strictIndexOf.js ***!
  9220. \*****************************************************************************/
  9221. /*! no static exports found */
  9222. /***/ (function(module, exports) {
  9223. /**
  9224. * A specialized version of `_.indexOf` which performs strict equality
  9225. * comparisons of values, i.e. `===`.
  9226. *
  9227. * @private
  9228. * @param {Array} array The array to inspect.
  9229. * @param {*} value The value to search for.
  9230. * @param {number} fromIndex The index to search from.
  9231. * @returns {number} Returns the index of the matched value, else `-1`.
  9232. */
  9233. function strictIndexOf(array, value, fromIndex) {
  9234. var index = fromIndex - 1,
  9235. length = array.length;
  9236. while (++index < length) {
  9237. if (array[index] === value) {
  9238. return index;
  9239. }
  9240. }
  9241. return -1;
  9242. }
  9243. module.exports = strictIndexOf;
  9244. /***/ }),
  9245. /***/ "../../node_modules/lodash/_stringSize.js":
  9246. /*!**************************************************************************!*\
  9247. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stringSize.js ***!
  9248. \**************************************************************************/
  9249. /*! no static exports found */
  9250. /***/ (function(module, exports, __webpack_require__) {
  9251. var asciiSize = __webpack_require__(/*! ./_asciiSize */ "../../node_modules/lodash/_asciiSize.js"),
  9252. hasUnicode = __webpack_require__(/*! ./_hasUnicode */ "../../node_modules/lodash/_hasUnicode.js"),
  9253. unicodeSize = __webpack_require__(/*! ./_unicodeSize */ "../../node_modules/lodash/_unicodeSize.js");
  9254. /**
  9255. * Gets the number of symbols in `string`.
  9256. *
  9257. * @private
  9258. * @param {string} string The string to inspect.
  9259. * @returns {number} Returns the string size.
  9260. */
  9261. function stringSize(string) {
  9262. return hasUnicode(string)
  9263. ? unicodeSize(string)
  9264. : asciiSize(string);
  9265. }
  9266. module.exports = stringSize;
  9267. /***/ }),
  9268. /***/ "../../node_modules/lodash/_stringToPath.js":
  9269. /*!****************************************************************************!*\
  9270. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_stringToPath.js ***!
  9271. \****************************************************************************/
  9272. /*! no static exports found */
  9273. /***/ (function(module, exports, __webpack_require__) {
  9274. var memoizeCapped = __webpack_require__(/*! ./_memoizeCapped */ "../../node_modules/lodash/_memoizeCapped.js");
  9275. /** Used to match property names within property paths. */
  9276. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  9277. /** Used to match backslashes in property paths. */
  9278. var reEscapeChar = /\\(\\)?/g;
  9279. /**
  9280. * Converts `string` to a property path array.
  9281. *
  9282. * @private
  9283. * @param {string} string The string to convert.
  9284. * @returns {Array} Returns the property path array.
  9285. */
  9286. var stringToPath = memoizeCapped(function(string) {
  9287. var result = [];
  9288. if (string.charCodeAt(0) === 46 /* . */) {
  9289. result.push('');
  9290. }
  9291. string.replace(rePropName, function(match, number, quote, subString) {
  9292. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  9293. });
  9294. return result;
  9295. });
  9296. module.exports = stringToPath;
  9297. /***/ }),
  9298. /***/ "../../node_modules/lodash/_toKey.js":
  9299. /*!*********************************************************************!*\
  9300. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_toKey.js ***!
  9301. \*********************************************************************/
  9302. /*! no static exports found */
  9303. /***/ (function(module, exports, __webpack_require__) {
  9304. var isSymbol = __webpack_require__(/*! ./isSymbol */ "../../node_modules/lodash/isSymbol.js");
  9305. /** Used as references for various `Number` constants. */
  9306. var INFINITY = 1 / 0;
  9307. /**
  9308. * Converts `value` to a string key if it's not a string or symbol.
  9309. *
  9310. * @private
  9311. * @param {*} value The value to inspect.
  9312. * @returns {string|symbol} Returns the key.
  9313. */
  9314. function toKey(value) {
  9315. if (typeof value == 'string' || isSymbol(value)) {
  9316. return value;
  9317. }
  9318. var result = (value + '');
  9319. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  9320. }
  9321. module.exports = toKey;
  9322. /***/ }),
  9323. /***/ "../../node_modules/lodash/_toSource.js":
  9324. /*!************************************************************************!*\
  9325. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_toSource.js ***!
  9326. \************************************************************************/
  9327. /*! no static exports found */
  9328. /***/ (function(module, exports) {
  9329. /** Used for built-in method references. */
  9330. var funcProto = Function.prototype;
  9331. /** Used to resolve the decompiled source of functions. */
  9332. var funcToString = funcProto.toString;
  9333. /**
  9334. * Converts `func` to its source code.
  9335. *
  9336. * @private
  9337. * @param {Function} func The function to convert.
  9338. * @returns {string} Returns the source code.
  9339. */
  9340. function toSource(func) {
  9341. if (func != null) {
  9342. try {
  9343. return funcToString.call(func);
  9344. } catch (e) {}
  9345. try {
  9346. return (func + '');
  9347. } catch (e) {}
  9348. }
  9349. return '';
  9350. }
  9351. module.exports = toSource;
  9352. /***/ }),
  9353. /***/ "../../node_modules/lodash/_unicodeSize.js":
  9354. /*!***************************************************************************!*\
  9355. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/_unicodeSize.js ***!
  9356. \***************************************************************************/
  9357. /*! no static exports found */
  9358. /***/ (function(module, exports) {
  9359. /** Used to compose unicode character classes. */
  9360. var rsAstralRange = '\\ud800-\\udfff',
  9361. rsComboMarksRange = '\\u0300-\\u036f',
  9362. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  9363. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  9364. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  9365. rsVarRange = '\\ufe0e\\ufe0f';
  9366. /** Used to compose unicode capture groups. */
  9367. var rsAstral = '[' + rsAstralRange + ']',
  9368. rsCombo = '[' + rsComboRange + ']',
  9369. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  9370. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  9371. rsNonAstral = '[^' + rsAstralRange + ']',
  9372. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  9373. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  9374. rsZWJ = '\\u200d';
  9375. /** Used to compose unicode regexes. */
  9376. var reOptMod = rsModifier + '?',
  9377. rsOptVar = '[' + rsVarRange + ']?',
  9378. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  9379. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  9380. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  9381. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  9382. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  9383. /**
  9384. * Gets the size of a Unicode `string`.
  9385. *
  9386. * @private
  9387. * @param {string} string The string inspect.
  9388. * @returns {number} Returns the string size.
  9389. */
  9390. function unicodeSize(string) {
  9391. var result = reUnicode.lastIndex = 0;
  9392. while (reUnicode.test(string)) {
  9393. ++result;
  9394. }
  9395. return result;
  9396. }
  9397. module.exports = unicodeSize;
  9398. /***/ }),
  9399. /***/ "../../node_modules/lodash/clone.js":
  9400. /*!********************************************************************!*\
  9401. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/clone.js ***!
  9402. \********************************************************************/
  9403. /*! no static exports found */
  9404. /***/ (function(module, exports, __webpack_require__) {
  9405. var baseClone = __webpack_require__(/*! ./_baseClone */ "../../node_modules/lodash/_baseClone.js");
  9406. /** Used to compose bitmasks for cloning. */
  9407. var CLONE_SYMBOLS_FLAG = 4;
  9408. /**
  9409. * Creates a shallow clone of `value`.
  9410. *
  9411. * **Note:** This method is loosely based on the
  9412. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  9413. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  9414. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  9415. * arrays. The own enumerable properties of `arguments` objects are cloned
  9416. * as plain objects. An empty object is returned for uncloneable values such
  9417. * as error objects, functions, DOM nodes, and WeakMaps.
  9418. *
  9419. * @static
  9420. * @memberOf _
  9421. * @since 0.1.0
  9422. * @category Lang
  9423. * @param {*} value The value to clone.
  9424. * @returns {*} Returns the cloned value.
  9425. * @see _.cloneDeep
  9426. * @example
  9427. *
  9428. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  9429. *
  9430. * var shallow = _.clone(objects);
  9431. * console.log(shallow[0] === objects[0]);
  9432. * // => true
  9433. */
  9434. function clone(value) {
  9435. return baseClone(value, CLONE_SYMBOLS_FLAG);
  9436. }
  9437. module.exports = clone;
  9438. /***/ }),
  9439. /***/ "../../node_modules/lodash/cloneDeep.js":
  9440. /*!************************************************************************!*\
  9441. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/cloneDeep.js ***!
  9442. \************************************************************************/
  9443. /*! no static exports found */
  9444. /***/ (function(module, exports, __webpack_require__) {
  9445. var baseClone = __webpack_require__(/*! ./_baseClone */ "../../node_modules/lodash/_baseClone.js");
  9446. /** Used to compose bitmasks for cloning. */
  9447. var CLONE_DEEP_FLAG = 1,
  9448. CLONE_SYMBOLS_FLAG = 4;
  9449. /**
  9450. * This method is like `_.clone` except that it recursively clones `value`.
  9451. *
  9452. * @static
  9453. * @memberOf _
  9454. * @since 1.0.0
  9455. * @category Lang
  9456. * @param {*} value The value to recursively clone.
  9457. * @returns {*} Returns the deep cloned value.
  9458. * @see _.clone
  9459. * @example
  9460. *
  9461. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  9462. *
  9463. * var deep = _.cloneDeep(objects);
  9464. * console.log(deep[0] === objects[0]);
  9465. * // => false
  9466. */
  9467. function cloneDeep(value) {
  9468. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  9469. }
  9470. module.exports = cloneDeep;
  9471. /***/ }),
  9472. /***/ "../../node_modules/lodash/constant.js":
  9473. /*!***********************************************************************!*\
  9474. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/constant.js ***!
  9475. \***********************************************************************/
  9476. /*! no static exports found */
  9477. /***/ (function(module, exports) {
  9478. /**
  9479. * Creates a function that returns `value`.
  9480. *
  9481. * @static
  9482. * @memberOf _
  9483. * @since 2.4.0
  9484. * @category Util
  9485. * @param {*} value The value to return from the new function.
  9486. * @returns {Function} Returns the new constant function.
  9487. * @example
  9488. *
  9489. * var objects = _.times(2, _.constant({ 'a': 1 }));
  9490. *
  9491. * console.log(objects);
  9492. * // => [{ 'a': 1 }, { 'a': 1 }]
  9493. *
  9494. * console.log(objects[0] === objects[1]);
  9495. * // => true
  9496. */
  9497. function constant(value) {
  9498. return function() {
  9499. return value;
  9500. };
  9501. }
  9502. module.exports = constant;
  9503. /***/ }),
  9504. /***/ "../../node_modules/lodash/defaults.js":
  9505. /*!***********************************************************************!*\
  9506. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/defaults.js ***!
  9507. \***********************************************************************/
  9508. /*! no static exports found */
  9509. /***/ (function(module, exports, __webpack_require__) {
  9510. var baseRest = __webpack_require__(/*! ./_baseRest */ "../../node_modules/lodash/_baseRest.js"),
  9511. eq = __webpack_require__(/*! ./eq */ "../../node_modules/lodash/eq.js"),
  9512. isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ "../../node_modules/lodash/_isIterateeCall.js"),
  9513. keysIn = __webpack_require__(/*! ./keysIn */ "../../node_modules/lodash/keysIn.js");
  9514. /** Used for built-in method references. */
  9515. var objectProto = Object.prototype;
  9516. /** Used to check objects for own properties. */
  9517. var hasOwnProperty = objectProto.hasOwnProperty;
  9518. /**
  9519. * Assigns own and inherited enumerable string keyed properties of source
  9520. * objects to the destination object for all destination properties that
  9521. * resolve to `undefined`. Source objects are applied from left to right.
  9522. * Once a property is set, additional values of the same property are ignored.
  9523. *
  9524. * **Note:** This method mutates `object`.
  9525. *
  9526. * @static
  9527. * @since 0.1.0
  9528. * @memberOf _
  9529. * @category Object
  9530. * @param {Object} object The destination object.
  9531. * @param {...Object} [sources] The source objects.
  9532. * @returns {Object} Returns `object`.
  9533. * @see _.defaultsDeep
  9534. * @example
  9535. *
  9536. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  9537. * // => { 'a': 1, 'b': 2 }
  9538. */
  9539. var defaults = baseRest(function(object, sources) {
  9540. object = Object(object);
  9541. var index = -1;
  9542. var length = sources.length;
  9543. var guard = length > 2 ? sources[2] : undefined;
  9544. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  9545. length = 1;
  9546. }
  9547. while (++index < length) {
  9548. var source = sources[index];
  9549. var props = keysIn(source);
  9550. var propsIndex = -1;
  9551. var propsLength = props.length;
  9552. while (++propsIndex < propsLength) {
  9553. var key = props[propsIndex];
  9554. var value = object[key];
  9555. if (value === undefined ||
  9556. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  9557. object[key] = source[key];
  9558. }
  9559. }
  9560. }
  9561. return object;
  9562. });
  9563. module.exports = defaults;
  9564. /***/ }),
  9565. /***/ "../../node_modules/lodash/each.js":
  9566. /*!*******************************************************************!*\
  9567. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/each.js ***!
  9568. \*******************************************************************/
  9569. /*! no static exports found */
  9570. /***/ (function(module, exports, __webpack_require__) {
  9571. module.exports = __webpack_require__(/*! ./forEach */ "../../node_modules/lodash/forEach.js");
  9572. /***/ }),
  9573. /***/ "../../node_modules/lodash/eq.js":
  9574. /*!*****************************************************************!*\
  9575. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/eq.js ***!
  9576. \*****************************************************************/
  9577. /*! no static exports found */
  9578. /***/ (function(module, exports) {
  9579. /**
  9580. * Performs a
  9581. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9582. * comparison between two values to determine if they are equivalent.
  9583. *
  9584. * @static
  9585. * @memberOf _
  9586. * @since 4.0.0
  9587. * @category Lang
  9588. * @param {*} value The value to compare.
  9589. * @param {*} other The other value to compare.
  9590. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  9591. * @example
  9592. *
  9593. * var object = { 'a': 1 };
  9594. * var other = { 'a': 1 };
  9595. *
  9596. * _.eq(object, object);
  9597. * // => true
  9598. *
  9599. * _.eq(object, other);
  9600. * // => false
  9601. *
  9602. * _.eq('a', 'a');
  9603. * // => true
  9604. *
  9605. * _.eq('a', Object('a'));
  9606. * // => false
  9607. *
  9608. * _.eq(NaN, NaN);
  9609. * // => true
  9610. */
  9611. function eq(value, other) {
  9612. return value === other || (value !== value && other !== other);
  9613. }
  9614. module.exports = eq;
  9615. /***/ }),
  9616. /***/ "../../node_modules/lodash/filter.js":
  9617. /*!*********************************************************************!*\
  9618. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/filter.js ***!
  9619. \*********************************************************************/
  9620. /*! no static exports found */
  9621. /***/ (function(module, exports, __webpack_require__) {
  9622. var arrayFilter = __webpack_require__(/*! ./_arrayFilter */ "../../node_modules/lodash/_arrayFilter.js"),
  9623. baseFilter = __webpack_require__(/*! ./_baseFilter */ "../../node_modules/lodash/_baseFilter.js"),
  9624. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  9625. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
  9626. /**
  9627. * Iterates over elements of `collection`, returning an array of all elements
  9628. * `predicate` returns truthy for. The predicate is invoked with three
  9629. * arguments: (value, index|key, collection).
  9630. *
  9631. * **Note:** Unlike `_.remove`, this method returns a new array.
  9632. *
  9633. * @static
  9634. * @memberOf _
  9635. * @since 0.1.0
  9636. * @category Collection
  9637. * @param {Array|Object} collection The collection to iterate over.
  9638. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9639. * @returns {Array} Returns the new filtered array.
  9640. * @see _.reject
  9641. * @example
  9642. *
  9643. * var users = [
  9644. * { 'user': 'barney', 'age': 36, 'active': true },
  9645. * { 'user': 'fred', 'age': 40, 'active': false }
  9646. * ];
  9647. *
  9648. * _.filter(users, function(o) { return !o.active; });
  9649. * // => objects for ['fred']
  9650. *
  9651. * // The `_.matches` iteratee shorthand.
  9652. * _.filter(users, { 'age': 36, 'active': true });
  9653. * // => objects for ['barney']
  9654. *
  9655. * // The `_.matchesProperty` iteratee shorthand.
  9656. * _.filter(users, ['active', false]);
  9657. * // => objects for ['fred']
  9658. *
  9659. * // The `_.property` iteratee shorthand.
  9660. * _.filter(users, 'active');
  9661. * // => objects for ['barney']
  9662. */
  9663. function filter(collection, predicate) {
  9664. var func = isArray(collection) ? arrayFilter : baseFilter;
  9665. return func(collection, baseIteratee(predicate, 3));
  9666. }
  9667. module.exports = filter;
  9668. /***/ }),
  9669. /***/ "../../node_modules/lodash/find.js":
  9670. /*!*******************************************************************!*\
  9671. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/find.js ***!
  9672. \*******************************************************************/
  9673. /*! no static exports found */
  9674. /***/ (function(module, exports, __webpack_require__) {
  9675. var createFind = __webpack_require__(/*! ./_createFind */ "../../node_modules/lodash/_createFind.js"),
  9676. findIndex = __webpack_require__(/*! ./findIndex */ "../../node_modules/lodash/findIndex.js");
  9677. /**
  9678. * Iterates over elements of `collection`, returning the first element
  9679. * `predicate` returns truthy for. The predicate is invoked with three
  9680. * arguments: (value, index|key, collection).
  9681. *
  9682. * @static
  9683. * @memberOf _
  9684. * @since 0.1.0
  9685. * @category Collection
  9686. * @param {Array|Object} collection The collection to inspect.
  9687. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9688. * @param {number} [fromIndex=0] The index to search from.
  9689. * @returns {*} Returns the matched element, else `undefined`.
  9690. * @example
  9691. *
  9692. * var users = [
  9693. * { 'user': 'barney', 'age': 36, 'active': true },
  9694. * { 'user': 'fred', 'age': 40, 'active': false },
  9695. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9696. * ];
  9697. *
  9698. * _.find(users, function(o) { return o.age < 40; });
  9699. * // => object for 'barney'
  9700. *
  9701. * // The `_.matches` iteratee shorthand.
  9702. * _.find(users, { 'age': 1, 'active': true });
  9703. * // => object for 'pebbles'
  9704. *
  9705. * // The `_.matchesProperty` iteratee shorthand.
  9706. * _.find(users, ['active', false]);
  9707. * // => object for 'fred'
  9708. *
  9709. * // The `_.property` iteratee shorthand.
  9710. * _.find(users, 'active');
  9711. * // => object for 'barney'
  9712. */
  9713. var find = createFind(findIndex);
  9714. module.exports = find;
  9715. /***/ }),
  9716. /***/ "../../node_modules/lodash/findIndex.js":
  9717. /*!************************************************************************!*\
  9718. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/findIndex.js ***!
  9719. \************************************************************************/
  9720. /*! no static exports found */
  9721. /***/ (function(module, exports, __webpack_require__) {
  9722. var baseFindIndex = __webpack_require__(/*! ./_baseFindIndex */ "../../node_modules/lodash/_baseFindIndex.js"),
  9723. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  9724. toInteger = __webpack_require__(/*! ./toInteger */ "../../node_modules/lodash/toInteger.js");
  9725. /* Built-in method references for those with the same name as other `lodash` methods. */
  9726. var nativeMax = Math.max;
  9727. /**
  9728. * This method is like `_.find` except that it returns the index of the first
  9729. * element `predicate` returns truthy for instead of the element itself.
  9730. *
  9731. * @static
  9732. * @memberOf _
  9733. * @since 1.1.0
  9734. * @category Array
  9735. * @param {Array} array The array to inspect.
  9736. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9737. * @param {number} [fromIndex=0] The index to search from.
  9738. * @returns {number} Returns the index of the found element, else `-1`.
  9739. * @example
  9740. *
  9741. * var users = [
  9742. * { 'user': 'barney', 'active': false },
  9743. * { 'user': 'fred', 'active': false },
  9744. * { 'user': 'pebbles', 'active': true }
  9745. * ];
  9746. *
  9747. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  9748. * // => 0
  9749. *
  9750. * // The `_.matches` iteratee shorthand.
  9751. * _.findIndex(users, { 'user': 'fred', 'active': false });
  9752. * // => 1
  9753. *
  9754. * // The `_.matchesProperty` iteratee shorthand.
  9755. * _.findIndex(users, ['active', false]);
  9756. * // => 0
  9757. *
  9758. * // The `_.property` iteratee shorthand.
  9759. * _.findIndex(users, 'active');
  9760. * // => 2
  9761. */
  9762. function findIndex(array, predicate, fromIndex) {
  9763. var length = array == null ? 0 : array.length;
  9764. if (!length) {
  9765. return -1;
  9766. }
  9767. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  9768. if (index < 0) {
  9769. index = nativeMax(length + index, 0);
  9770. }
  9771. return baseFindIndex(array, baseIteratee(predicate, 3), index);
  9772. }
  9773. module.exports = findIndex;
  9774. /***/ }),
  9775. /***/ "../../node_modules/lodash/flatten.js":
  9776. /*!**********************************************************************!*\
  9777. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/flatten.js ***!
  9778. \**********************************************************************/
  9779. /*! no static exports found */
  9780. /***/ (function(module, exports, __webpack_require__) {
  9781. var baseFlatten = __webpack_require__(/*! ./_baseFlatten */ "../../node_modules/lodash/_baseFlatten.js");
  9782. /**
  9783. * Flattens `array` a single level deep.
  9784. *
  9785. * @static
  9786. * @memberOf _
  9787. * @since 0.1.0
  9788. * @category Array
  9789. * @param {Array} array The array to flatten.
  9790. * @returns {Array} Returns the new flattened array.
  9791. * @example
  9792. *
  9793. * _.flatten([1, [2, [3, [4]], 5]]);
  9794. * // => [1, 2, [3, [4]], 5]
  9795. */
  9796. function flatten(array) {
  9797. var length = array == null ? 0 : array.length;
  9798. return length ? baseFlatten(array, 1) : [];
  9799. }
  9800. module.exports = flatten;
  9801. /***/ }),
  9802. /***/ "../../node_modules/lodash/forEach.js":
  9803. /*!**********************************************************************!*\
  9804. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/forEach.js ***!
  9805. \**********************************************************************/
  9806. /*! no static exports found */
  9807. /***/ (function(module, exports, __webpack_require__) {
  9808. var arrayEach = __webpack_require__(/*! ./_arrayEach */ "../../node_modules/lodash/_arrayEach.js"),
  9809. baseEach = __webpack_require__(/*! ./_baseEach */ "../../node_modules/lodash/_baseEach.js"),
  9810. castFunction = __webpack_require__(/*! ./_castFunction */ "../../node_modules/lodash/_castFunction.js"),
  9811. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
  9812. /**
  9813. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9814. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9815. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9816. *
  9817. * **Note:** As with other "Collections" methods, objects with a "length"
  9818. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  9819. * or `_.forOwn` for object iteration.
  9820. *
  9821. * @static
  9822. * @memberOf _
  9823. * @since 0.1.0
  9824. * @alias each
  9825. * @category Collection
  9826. * @param {Array|Object} collection The collection to iterate over.
  9827. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9828. * @returns {Array|Object} Returns `collection`.
  9829. * @see _.forEachRight
  9830. * @example
  9831. *
  9832. * _.forEach([1, 2], function(value) {
  9833. * console.log(value);
  9834. * });
  9835. * // => Logs `1` then `2`.
  9836. *
  9837. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  9838. * console.log(key);
  9839. * });
  9840. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  9841. */
  9842. function forEach(collection, iteratee) {
  9843. var func = isArray(collection) ? arrayEach : baseEach;
  9844. return func(collection, castFunction(iteratee));
  9845. }
  9846. module.exports = forEach;
  9847. /***/ }),
  9848. /***/ "../../node_modules/lodash/forIn.js":
  9849. /*!********************************************************************!*\
  9850. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/forIn.js ***!
  9851. \********************************************************************/
  9852. /*! no static exports found */
  9853. /***/ (function(module, exports, __webpack_require__) {
  9854. var baseFor = __webpack_require__(/*! ./_baseFor */ "../../node_modules/lodash/_baseFor.js"),
  9855. castFunction = __webpack_require__(/*! ./_castFunction */ "../../node_modules/lodash/_castFunction.js"),
  9856. keysIn = __webpack_require__(/*! ./keysIn */ "../../node_modules/lodash/keysIn.js");
  9857. /**
  9858. * Iterates over own and inherited enumerable string keyed properties of an
  9859. * object and invokes `iteratee` for each property. The iteratee is invoked
  9860. * with three arguments: (value, key, object). Iteratee functions may exit
  9861. * iteration early by explicitly returning `false`.
  9862. *
  9863. * @static
  9864. * @memberOf _
  9865. * @since 0.3.0
  9866. * @category Object
  9867. * @param {Object} object The object to iterate over.
  9868. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9869. * @returns {Object} Returns `object`.
  9870. * @see _.forInRight
  9871. * @example
  9872. *
  9873. * function Foo() {
  9874. * this.a = 1;
  9875. * this.b = 2;
  9876. * }
  9877. *
  9878. * Foo.prototype.c = 3;
  9879. *
  9880. * _.forIn(new Foo, function(value, key) {
  9881. * console.log(key);
  9882. * });
  9883. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  9884. */
  9885. function forIn(object, iteratee) {
  9886. return object == null
  9887. ? object
  9888. : baseFor(object, castFunction(iteratee), keysIn);
  9889. }
  9890. module.exports = forIn;
  9891. /***/ }),
  9892. /***/ "../../node_modules/lodash/get.js":
  9893. /*!******************************************************************!*\
  9894. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/get.js ***!
  9895. \******************************************************************/
  9896. /*! no static exports found */
  9897. /***/ (function(module, exports, __webpack_require__) {
  9898. var baseGet = __webpack_require__(/*! ./_baseGet */ "../../node_modules/lodash/_baseGet.js");
  9899. /**
  9900. * Gets the value at `path` of `object`. If the resolved value is
  9901. * `undefined`, the `defaultValue` is returned in its place.
  9902. *
  9903. * @static
  9904. * @memberOf _
  9905. * @since 3.7.0
  9906. * @category Object
  9907. * @param {Object} object The object to query.
  9908. * @param {Array|string} path The path of the property to get.
  9909. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  9910. * @returns {*} Returns the resolved value.
  9911. * @example
  9912. *
  9913. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  9914. *
  9915. * _.get(object, 'a[0].b.c');
  9916. * // => 3
  9917. *
  9918. * _.get(object, ['a', '0', 'b', 'c']);
  9919. * // => 3
  9920. *
  9921. * _.get(object, 'a.b.c', 'default');
  9922. * // => 'default'
  9923. */
  9924. function get(object, path, defaultValue) {
  9925. var result = object == null ? undefined : baseGet(object, path);
  9926. return result === undefined ? defaultValue : result;
  9927. }
  9928. module.exports = get;
  9929. /***/ }),
  9930. /***/ "../../node_modules/lodash/has.js":
  9931. /*!******************************************************************!*\
  9932. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/has.js ***!
  9933. \******************************************************************/
  9934. /*! no static exports found */
  9935. /***/ (function(module, exports, __webpack_require__) {
  9936. var baseHas = __webpack_require__(/*! ./_baseHas */ "../../node_modules/lodash/_baseHas.js"),
  9937. hasPath = __webpack_require__(/*! ./_hasPath */ "../../node_modules/lodash/_hasPath.js");
  9938. /**
  9939. * Checks if `path` is a direct property of `object`.
  9940. *
  9941. * @static
  9942. * @since 0.1.0
  9943. * @memberOf _
  9944. * @category Object
  9945. * @param {Object} object The object to query.
  9946. * @param {Array|string} path The path to check.
  9947. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  9948. * @example
  9949. *
  9950. * var object = { 'a': { 'b': 2 } };
  9951. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  9952. *
  9953. * _.has(object, 'a');
  9954. * // => true
  9955. *
  9956. * _.has(object, 'a.b');
  9957. * // => true
  9958. *
  9959. * _.has(object, ['a', 'b']);
  9960. * // => true
  9961. *
  9962. * _.has(other, 'a');
  9963. * // => false
  9964. */
  9965. function has(object, path) {
  9966. return object != null && hasPath(object, path, baseHas);
  9967. }
  9968. module.exports = has;
  9969. /***/ }),
  9970. /***/ "../../node_modules/lodash/hasIn.js":
  9971. /*!********************************************************************!*\
  9972. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/hasIn.js ***!
  9973. \********************************************************************/
  9974. /*! no static exports found */
  9975. /***/ (function(module, exports, __webpack_require__) {
  9976. var baseHasIn = __webpack_require__(/*! ./_baseHasIn */ "../../node_modules/lodash/_baseHasIn.js"),
  9977. hasPath = __webpack_require__(/*! ./_hasPath */ "../../node_modules/lodash/_hasPath.js");
  9978. /**
  9979. * Checks if `path` is a direct or inherited property of `object`.
  9980. *
  9981. * @static
  9982. * @memberOf _
  9983. * @since 4.0.0
  9984. * @category Object
  9985. * @param {Object} object The object to query.
  9986. * @param {Array|string} path The path to check.
  9987. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  9988. * @example
  9989. *
  9990. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  9991. *
  9992. * _.hasIn(object, 'a');
  9993. * // => true
  9994. *
  9995. * _.hasIn(object, 'a.b');
  9996. * // => true
  9997. *
  9998. * _.hasIn(object, ['a', 'b']);
  9999. * // => true
  10000. *
  10001. * _.hasIn(object, 'b');
  10002. * // => false
  10003. */
  10004. function hasIn(object, path) {
  10005. return object != null && hasPath(object, path, baseHasIn);
  10006. }
  10007. module.exports = hasIn;
  10008. /***/ }),
  10009. /***/ "../../node_modules/lodash/identity.js":
  10010. /*!***********************************************************************!*\
  10011. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/identity.js ***!
  10012. \***********************************************************************/
  10013. /*! no static exports found */
  10014. /***/ (function(module, exports) {
  10015. /**
  10016. * This method returns the first argument it receives.
  10017. *
  10018. * @static
  10019. * @since 0.1.0
  10020. * @memberOf _
  10021. * @category Util
  10022. * @param {*} value Any value.
  10023. * @returns {*} Returns `value`.
  10024. * @example
  10025. *
  10026. * var object = { 'a': 1 };
  10027. *
  10028. * console.log(_.identity(object) === object);
  10029. * // => true
  10030. */
  10031. function identity(value) {
  10032. return value;
  10033. }
  10034. module.exports = identity;
  10035. /***/ }),
  10036. /***/ "../../node_modules/lodash/isArguments.js":
  10037. /*!**************************************************************************!*\
  10038. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isArguments.js ***!
  10039. \**************************************************************************/
  10040. /*! no static exports found */
  10041. /***/ (function(module, exports, __webpack_require__) {
  10042. var baseIsArguments = __webpack_require__(/*! ./_baseIsArguments */ "../../node_modules/lodash/_baseIsArguments.js"),
  10043. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  10044. /** Used for built-in method references. */
  10045. var objectProto = Object.prototype;
  10046. /** Used to check objects for own properties. */
  10047. var hasOwnProperty = objectProto.hasOwnProperty;
  10048. /** Built-in value references. */
  10049. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  10050. /**
  10051. * Checks if `value` is likely an `arguments` object.
  10052. *
  10053. * @static
  10054. * @memberOf _
  10055. * @since 0.1.0
  10056. * @category Lang
  10057. * @param {*} value The value to check.
  10058. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  10059. * else `false`.
  10060. * @example
  10061. *
  10062. * _.isArguments(function() { return arguments; }());
  10063. * // => true
  10064. *
  10065. * _.isArguments([1, 2, 3]);
  10066. * // => false
  10067. */
  10068. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  10069. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  10070. !propertyIsEnumerable.call(value, 'callee');
  10071. };
  10072. module.exports = isArguments;
  10073. /***/ }),
  10074. /***/ "../../node_modules/lodash/isArray.js":
  10075. /*!**********************************************************************!*\
  10076. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isArray.js ***!
  10077. \**********************************************************************/
  10078. /*! no static exports found */
  10079. /***/ (function(module, exports) {
  10080. /**
  10081. * Checks if `value` is classified as an `Array` object.
  10082. *
  10083. * @static
  10084. * @memberOf _
  10085. * @since 0.1.0
  10086. * @category Lang
  10087. * @param {*} value The value to check.
  10088. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  10089. * @example
  10090. *
  10091. * _.isArray([1, 2, 3]);
  10092. * // => true
  10093. *
  10094. * _.isArray(document.body.children);
  10095. * // => false
  10096. *
  10097. * _.isArray('abc');
  10098. * // => false
  10099. *
  10100. * _.isArray(_.noop);
  10101. * // => false
  10102. */
  10103. var isArray = Array.isArray;
  10104. module.exports = isArray;
  10105. /***/ }),
  10106. /***/ "../../node_modules/lodash/isArrayLike.js":
  10107. /*!**************************************************************************!*\
  10108. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isArrayLike.js ***!
  10109. \**************************************************************************/
  10110. /*! no static exports found */
  10111. /***/ (function(module, exports, __webpack_require__) {
  10112. var isFunction = __webpack_require__(/*! ./isFunction */ "../../node_modules/lodash/isFunction.js"),
  10113. isLength = __webpack_require__(/*! ./isLength */ "../../node_modules/lodash/isLength.js");
  10114. /**
  10115. * Checks if `value` is array-like. A value is considered array-like if it's
  10116. * not a function and has a `value.length` that's an integer greater than or
  10117. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  10118. *
  10119. * @static
  10120. * @memberOf _
  10121. * @since 4.0.0
  10122. * @category Lang
  10123. * @param {*} value The value to check.
  10124. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  10125. * @example
  10126. *
  10127. * _.isArrayLike([1, 2, 3]);
  10128. * // => true
  10129. *
  10130. * _.isArrayLike(document.body.children);
  10131. * // => true
  10132. *
  10133. * _.isArrayLike('abc');
  10134. * // => true
  10135. *
  10136. * _.isArrayLike(_.noop);
  10137. * // => false
  10138. */
  10139. function isArrayLike(value) {
  10140. return value != null && isLength(value.length) && !isFunction(value);
  10141. }
  10142. module.exports = isArrayLike;
  10143. /***/ }),
  10144. /***/ "../../node_modules/lodash/isArrayLikeObject.js":
  10145. /*!********************************************************************************!*\
  10146. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isArrayLikeObject.js ***!
  10147. \********************************************************************************/
  10148. /*! no static exports found */
  10149. /***/ (function(module, exports, __webpack_require__) {
  10150. var isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js"),
  10151. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  10152. /**
  10153. * This method is like `_.isArrayLike` except that it also checks if `value`
  10154. * is an object.
  10155. *
  10156. * @static
  10157. * @memberOf _
  10158. * @since 4.0.0
  10159. * @category Lang
  10160. * @param {*} value The value to check.
  10161. * @returns {boolean} Returns `true` if `value` is an array-like object,
  10162. * else `false`.
  10163. * @example
  10164. *
  10165. * _.isArrayLikeObject([1, 2, 3]);
  10166. * // => true
  10167. *
  10168. * _.isArrayLikeObject(document.body.children);
  10169. * // => true
  10170. *
  10171. * _.isArrayLikeObject('abc');
  10172. * // => false
  10173. *
  10174. * _.isArrayLikeObject(_.noop);
  10175. * // => false
  10176. */
  10177. function isArrayLikeObject(value) {
  10178. return isObjectLike(value) && isArrayLike(value);
  10179. }
  10180. module.exports = isArrayLikeObject;
  10181. /***/ }),
  10182. /***/ "../../node_modules/lodash/isBuffer.js":
  10183. /*!***********************************************************************!*\
  10184. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isBuffer.js ***!
  10185. \***********************************************************************/
  10186. /*! no static exports found */
  10187. /***/ (function(module, exports, __webpack_require__) {
  10188. /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js"),
  10189. stubFalse = __webpack_require__(/*! ./stubFalse */ "../../node_modules/lodash/stubFalse.js");
  10190. /** Detect free variable `exports`. */
  10191. var freeExports = true && exports && !exports.nodeType && exports;
  10192. /** Detect free variable `module`. */
  10193. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  10194. /** Detect the popular CommonJS extension `module.exports`. */
  10195. var moduleExports = freeModule && freeModule.exports === freeExports;
  10196. /** Built-in value references. */
  10197. var Buffer = moduleExports ? root.Buffer : undefined;
  10198. /* Built-in method references for those with the same name as other `lodash` methods. */
  10199. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  10200. /**
  10201. * Checks if `value` is a buffer.
  10202. *
  10203. * @static
  10204. * @memberOf _
  10205. * @since 4.3.0
  10206. * @category Lang
  10207. * @param {*} value The value to check.
  10208. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  10209. * @example
  10210. *
  10211. * _.isBuffer(new Buffer(2));
  10212. * // => true
  10213. *
  10214. * _.isBuffer(new Uint8Array(2));
  10215. * // => false
  10216. */
  10217. var isBuffer = nativeIsBuffer || stubFalse;
  10218. module.exports = isBuffer;
  10219. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
  10220. /***/ }),
  10221. /***/ "../../node_modules/lodash/isEmpty.js":
  10222. /*!**********************************************************************!*\
  10223. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isEmpty.js ***!
  10224. \**********************************************************************/
  10225. /*! no static exports found */
  10226. /***/ (function(module, exports, __webpack_require__) {
  10227. var baseKeys = __webpack_require__(/*! ./_baseKeys */ "../../node_modules/lodash/_baseKeys.js"),
  10228. getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
  10229. isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
  10230. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  10231. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js"),
  10232. isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
  10233. isPrototype = __webpack_require__(/*! ./_isPrototype */ "../../node_modules/lodash/_isPrototype.js"),
  10234. isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../node_modules/lodash/isTypedArray.js");
  10235. /** `Object#toString` result references. */
  10236. var mapTag = '[object Map]',
  10237. setTag = '[object Set]';
  10238. /** Used for built-in method references. */
  10239. var objectProto = Object.prototype;
  10240. /** Used to check objects for own properties. */
  10241. var hasOwnProperty = objectProto.hasOwnProperty;
  10242. /**
  10243. * Checks if `value` is an empty object, collection, map, or set.
  10244. *
  10245. * Objects are considered empty if they have no own enumerable string keyed
  10246. * properties.
  10247. *
  10248. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  10249. * jQuery-like collections are considered empty if they have a `length` of `0`.
  10250. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  10251. *
  10252. * @static
  10253. * @memberOf _
  10254. * @since 0.1.0
  10255. * @category Lang
  10256. * @param {*} value The value to check.
  10257. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  10258. * @example
  10259. *
  10260. * _.isEmpty(null);
  10261. * // => true
  10262. *
  10263. * _.isEmpty(true);
  10264. * // => true
  10265. *
  10266. * _.isEmpty(1);
  10267. * // => true
  10268. *
  10269. * _.isEmpty([1, 2, 3]);
  10270. * // => false
  10271. *
  10272. * _.isEmpty({ 'a': 1 });
  10273. * // => false
  10274. */
  10275. function isEmpty(value) {
  10276. if (value == null) {
  10277. return true;
  10278. }
  10279. if (isArrayLike(value) &&
  10280. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  10281. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  10282. return !value.length;
  10283. }
  10284. var tag = getTag(value);
  10285. if (tag == mapTag || tag == setTag) {
  10286. return !value.size;
  10287. }
  10288. if (isPrototype(value)) {
  10289. return !baseKeys(value).length;
  10290. }
  10291. for (var key in value) {
  10292. if (hasOwnProperty.call(value, key)) {
  10293. return false;
  10294. }
  10295. }
  10296. return true;
  10297. }
  10298. module.exports = isEmpty;
  10299. /***/ }),
  10300. /***/ "../../node_modules/lodash/isFunction.js":
  10301. /*!*************************************************************************!*\
  10302. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isFunction.js ***!
  10303. \*************************************************************************/
  10304. /*! no static exports found */
  10305. /***/ (function(module, exports, __webpack_require__) {
  10306. var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  10307. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js");
  10308. /** `Object#toString` result references. */
  10309. var asyncTag = '[object AsyncFunction]',
  10310. funcTag = '[object Function]',
  10311. genTag = '[object GeneratorFunction]',
  10312. proxyTag = '[object Proxy]';
  10313. /**
  10314. * Checks if `value` is classified as a `Function` object.
  10315. *
  10316. * @static
  10317. * @memberOf _
  10318. * @since 0.1.0
  10319. * @category Lang
  10320. * @param {*} value The value to check.
  10321. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  10322. * @example
  10323. *
  10324. * _.isFunction(_);
  10325. * // => true
  10326. *
  10327. * _.isFunction(/abc/);
  10328. * // => false
  10329. */
  10330. function isFunction(value) {
  10331. if (!isObject(value)) {
  10332. return false;
  10333. }
  10334. // The use of `Object#toString` avoids issues with the `typeof` operator
  10335. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  10336. var tag = baseGetTag(value);
  10337. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  10338. }
  10339. module.exports = isFunction;
  10340. /***/ }),
  10341. /***/ "../../node_modules/lodash/isLength.js":
  10342. /*!***********************************************************************!*\
  10343. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isLength.js ***!
  10344. \***********************************************************************/
  10345. /*! no static exports found */
  10346. /***/ (function(module, exports) {
  10347. /** Used as references for various `Number` constants. */
  10348. var MAX_SAFE_INTEGER = 9007199254740991;
  10349. /**
  10350. * Checks if `value` is a valid array-like length.
  10351. *
  10352. * **Note:** This method is loosely based on
  10353. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  10354. *
  10355. * @static
  10356. * @memberOf _
  10357. * @since 4.0.0
  10358. * @category Lang
  10359. * @param {*} value The value to check.
  10360. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  10361. * @example
  10362. *
  10363. * _.isLength(3);
  10364. * // => true
  10365. *
  10366. * _.isLength(Number.MIN_VALUE);
  10367. * // => false
  10368. *
  10369. * _.isLength(Infinity);
  10370. * // => false
  10371. *
  10372. * _.isLength('3');
  10373. * // => false
  10374. */
  10375. function isLength(value) {
  10376. return typeof value == 'number' &&
  10377. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  10378. }
  10379. module.exports = isLength;
  10380. /***/ }),
  10381. /***/ "../../node_modules/lodash/isMap.js":
  10382. /*!********************************************************************!*\
  10383. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isMap.js ***!
  10384. \********************************************************************/
  10385. /*! no static exports found */
  10386. /***/ (function(module, exports, __webpack_require__) {
  10387. var baseIsMap = __webpack_require__(/*! ./_baseIsMap */ "../../node_modules/lodash/_baseIsMap.js"),
  10388. baseUnary = __webpack_require__(/*! ./_baseUnary */ "../../node_modules/lodash/_baseUnary.js"),
  10389. nodeUtil = __webpack_require__(/*! ./_nodeUtil */ "../../node_modules/lodash/_nodeUtil.js");
  10390. /* Node.js helper references. */
  10391. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  10392. /**
  10393. * Checks if `value` is classified as a `Map` object.
  10394. *
  10395. * @static
  10396. * @memberOf _
  10397. * @since 4.3.0
  10398. * @category Lang
  10399. * @param {*} value The value to check.
  10400. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  10401. * @example
  10402. *
  10403. * _.isMap(new Map);
  10404. * // => true
  10405. *
  10406. * _.isMap(new WeakMap);
  10407. * // => false
  10408. */
  10409. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  10410. module.exports = isMap;
  10411. /***/ }),
  10412. /***/ "../../node_modules/lodash/isObject.js":
  10413. /*!***********************************************************************!*\
  10414. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isObject.js ***!
  10415. \***********************************************************************/
  10416. /*! no static exports found */
  10417. /***/ (function(module, exports) {
  10418. /**
  10419. * Checks if `value` is the
  10420. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  10421. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  10422. *
  10423. * @static
  10424. * @memberOf _
  10425. * @since 0.1.0
  10426. * @category Lang
  10427. * @param {*} value The value to check.
  10428. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  10429. * @example
  10430. *
  10431. * _.isObject({});
  10432. * // => true
  10433. *
  10434. * _.isObject([1, 2, 3]);
  10435. * // => true
  10436. *
  10437. * _.isObject(_.noop);
  10438. * // => true
  10439. *
  10440. * _.isObject(null);
  10441. * // => false
  10442. */
  10443. function isObject(value) {
  10444. var type = typeof value;
  10445. return value != null && (type == 'object' || type == 'function');
  10446. }
  10447. module.exports = isObject;
  10448. /***/ }),
  10449. /***/ "../../node_modules/lodash/isObjectLike.js":
  10450. /*!***************************************************************************!*\
  10451. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isObjectLike.js ***!
  10452. \***************************************************************************/
  10453. /*! no static exports found */
  10454. /***/ (function(module, exports) {
  10455. /**
  10456. * Checks if `value` is object-like. A value is object-like if it's not `null`
  10457. * and has a `typeof` result of "object".
  10458. *
  10459. * @static
  10460. * @memberOf _
  10461. * @since 4.0.0
  10462. * @category Lang
  10463. * @param {*} value The value to check.
  10464. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  10465. * @example
  10466. *
  10467. * _.isObjectLike({});
  10468. * // => true
  10469. *
  10470. * _.isObjectLike([1, 2, 3]);
  10471. * // => true
  10472. *
  10473. * _.isObjectLike(_.noop);
  10474. * // => false
  10475. *
  10476. * _.isObjectLike(null);
  10477. * // => false
  10478. */
  10479. function isObjectLike(value) {
  10480. return value != null && typeof value == 'object';
  10481. }
  10482. module.exports = isObjectLike;
  10483. /***/ }),
  10484. /***/ "../../node_modules/lodash/isPlainObject.js":
  10485. /*!****************************************************************************!*\
  10486. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isPlainObject.js ***!
  10487. \****************************************************************************/
  10488. /*! no static exports found */
  10489. /***/ (function(module, exports, __webpack_require__) {
  10490. var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  10491. getPrototype = __webpack_require__(/*! ./_getPrototype */ "../../node_modules/lodash/_getPrototype.js"),
  10492. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  10493. /** `Object#toString` result references. */
  10494. var objectTag = '[object Object]';
  10495. /** Used for built-in method references. */
  10496. var funcProto = Function.prototype,
  10497. objectProto = Object.prototype;
  10498. /** Used to resolve the decompiled source of functions. */
  10499. var funcToString = funcProto.toString;
  10500. /** Used to check objects for own properties. */
  10501. var hasOwnProperty = objectProto.hasOwnProperty;
  10502. /** Used to infer the `Object` constructor. */
  10503. var objectCtorString = funcToString.call(Object);
  10504. /**
  10505. * Checks if `value` is a plain object, that is, an object created by the
  10506. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  10507. *
  10508. * @static
  10509. * @memberOf _
  10510. * @since 0.8.0
  10511. * @category Lang
  10512. * @param {*} value The value to check.
  10513. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  10514. * @example
  10515. *
  10516. * function Foo() {
  10517. * this.a = 1;
  10518. * }
  10519. *
  10520. * _.isPlainObject(new Foo);
  10521. * // => false
  10522. *
  10523. * _.isPlainObject([1, 2, 3]);
  10524. * // => false
  10525. *
  10526. * _.isPlainObject({ 'x': 0, 'y': 0 });
  10527. * // => true
  10528. *
  10529. * _.isPlainObject(Object.create(null));
  10530. * // => true
  10531. */
  10532. function isPlainObject(value) {
  10533. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  10534. return false;
  10535. }
  10536. var proto = getPrototype(value);
  10537. if (proto === null) {
  10538. return true;
  10539. }
  10540. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  10541. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  10542. funcToString.call(Ctor) == objectCtorString;
  10543. }
  10544. module.exports = isPlainObject;
  10545. /***/ }),
  10546. /***/ "../../node_modules/lodash/isSet.js":
  10547. /*!********************************************************************!*\
  10548. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isSet.js ***!
  10549. \********************************************************************/
  10550. /*! no static exports found */
  10551. /***/ (function(module, exports, __webpack_require__) {
  10552. var baseIsSet = __webpack_require__(/*! ./_baseIsSet */ "../../node_modules/lodash/_baseIsSet.js"),
  10553. baseUnary = __webpack_require__(/*! ./_baseUnary */ "../../node_modules/lodash/_baseUnary.js"),
  10554. nodeUtil = __webpack_require__(/*! ./_nodeUtil */ "../../node_modules/lodash/_nodeUtil.js");
  10555. /* Node.js helper references. */
  10556. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  10557. /**
  10558. * Checks if `value` is classified as a `Set` object.
  10559. *
  10560. * @static
  10561. * @memberOf _
  10562. * @since 4.3.0
  10563. * @category Lang
  10564. * @param {*} value The value to check.
  10565. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  10566. * @example
  10567. *
  10568. * _.isSet(new Set);
  10569. * // => true
  10570. *
  10571. * _.isSet(new WeakSet);
  10572. * // => false
  10573. */
  10574. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  10575. module.exports = isSet;
  10576. /***/ }),
  10577. /***/ "../../node_modules/lodash/isString.js":
  10578. /*!***********************************************************************!*\
  10579. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isString.js ***!
  10580. \***********************************************************************/
  10581. /*! no static exports found */
  10582. /***/ (function(module, exports, __webpack_require__) {
  10583. var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  10584. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  10585. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  10586. /** `Object#toString` result references. */
  10587. var stringTag = '[object String]';
  10588. /**
  10589. * Checks if `value` is classified as a `String` primitive or object.
  10590. *
  10591. * @static
  10592. * @since 0.1.0
  10593. * @memberOf _
  10594. * @category Lang
  10595. * @param {*} value The value to check.
  10596. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  10597. * @example
  10598. *
  10599. * _.isString('abc');
  10600. * // => true
  10601. *
  10602. * _.isString(1);
  10603. * // => false
  10604. */
  10605. function isString(value) {
  10606. return typeof value == 'string' ||
  10607. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  10608. }
  10609. module.exports = isString;
  10610. /***/ }),
  10611. /***/ "../../node_modules/lodash/isSymbol.js":
  10612. /*!***********************************************************************!*\
  10613. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isSymbol.js ***!
  10614. \***********************************************************************/
  10615. /*! no static exports found */
  10616. /***/ (function(module, exports, __webpack_require__) {
  10617. var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
  10618. isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
  10619. /** `Object#toString` result references. */
  10620. var symbolTag = '[object Symbol]';
  10621. /**
  10622. * Checks if `value` is classified as a `Symbol` primitive or object.
  10623. *
  10624. * @static
  10625. * @memberOf _
  10626. * @since 4.0.0
  10627. * @category Lang
  10628. * @param {*} value The value to check.
  10629. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  10630. * @example
  10631. *
  10632. * _.isSymbol(Symbol.iterator);
  10633. * // => true
  10634. *
  10635. * _.isSymbol('abc');
  10636. * // => false
  10637. */
  10638. function isSymbol(value) {
  10639. return typeof value == 'symbol' ||
  10640. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  10641. }
  10642. module.exports = isSymbol;
  10643. /***/ }),
  10644. /***/ "../../node_modules/lodash/isTypedArray.js":
  10645. /*!***************************************************************************!*\
  10646. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isTypedArray.js ***!
  10647. \***************************************************************************/
  10648. /*! no static exports found */
  10649. /***/ (function(module, exports, __webpack_require__) {
  10650. var baseIsTypedArray = __webpack_require__(/*! ./_baseIsTypedArray */ "../../node_modules/lodash/_baseIsTypedArray.js"),
  10651. baseUnary = __webpack_require__(/*! ./_baseUnary */ "../../node_modules/lodash/_baseUnary.js"),
  10652. nodeUtil = __webpack_require__(/*! ./_nodeUtil */ "../../node_modules/lodash/_nodeUtil.js");
  10653. /* Node.js helper references. */
  10654. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  10655. /**
  10656. * Checks if `value` is classified as a typed array.
  10657. *
  10658. * @static
  10659. * @memberOf _
  10660. * @since 3.0.0
  10661. * @category Lang
  10662. * @param {*} value The value to check.
  10663. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  10664. * @example
  10665. *
  10666. * _.isTypedArray(new Uint8Array);
  10667. * // => true
  10668. *
  10669. * _.isTypedArray([]);
  10670. * // => false
  10671. */
  10672. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  10673. module.exports = isTypedArray;
  10674. /***/ }),
  10675. /***/ "../../node_modules/lodash/isUndefined.js":
  10676. /*!**************************************************************************!*\
  10677. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/isUndefined.js ***!
  10678. \**************************************************************************/
  10679. /*! no static exports found */
  10680. /***/ (function(module, exports) {
  10681. /**
  10682. * Checks if `value` is `undefined`.
  10683. *
  10684. * @static
  10685. * @since 0.1.0
  10686. * @memberOf _
  10687. * @category Lang
  10688. * @param {*} value The value to check.
  10689. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  10690. * @example
  10691. *
  10692. * _.isUndefined(void 0);
  10693. * // => true
  10694. *
  10695. * _.isUndefined(null);
  10696. * // => false
  10697. */
  10698. function isUndefined(value) {
  10699. return value === undefined;
  10700. }
  10701. module.exports = isUndefined;
  10702. /***/ }),
  10703. /***/ "../../node_modules/lodash/keys.js":
  10704. /*!*******************************************************************!*\
  10705. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/keys.js ***!
  10706. \*******************************************************************/
  10707. /*! no static exports found */
  10708. /***/ (function(module, exports, __webpack_require__) {
  10709. var arrayLikeKeys = __webpack_require__(/*! ./_arrayLikeKeys */ "../../node_modules/lodash/_arrayLikeKeys.js"),
  10710. baseKeys = __webpack_require__(/*! ./_baseKeys */ "../../node_modules/lodash/_baseKeys.js"),
  10711. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js");
  10712. /**
  10713. * Creates an array of the own enumerable property names of `object`.
  10714. *
  10715. * **Note:** Non-object values are coerced to objects. See the
  10716. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  10717. * for more details.
  10718. *
  10719. * @static
  10720. * @since 0.1.0
  10721. * @memberOf _
  10722. * @category Object
  10723. * @param {Object} object The object to query.
  10724. * @returns {Array} Returns the array of property names.
  10725. * @example
  10726. *
  10727. * function Foo() {
  10728. * this.a = 1;
  10729. * this.b = 2;
  10730. * }
  10731. *
  10732. * Foo.prototype.c = 3;
  10733. *
  10734. * _.keys(new Foo);
  10735. * // => ['a', 'b'] (iteration order is not guaranteed)
  10736. *
  10737. * _.keys('hi');
  10738. * // => ['0', '1']
  10739. */
  10740. function keys(object) {
  10741. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  10742. }
  10743. module.exports = keys;
  10744. /***/ }),
  10745. /***/ "../../node_modules/lodash/keysIn.js":
  10746. /*!*********************************************************************!*\
  10747. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/keysIn.js ***!
  10748. \*********************************************************************/
  10749. /*! no static exports found */
  10750. /***/ (function(module, exports, __webpack_require__) {
  10751. var arrayLikeKeys = __webpack_require__(/*! ./_arrayLikeKeys */ "../../node_modules/lodash/_arrayLikeKeys.js"),
  10752. baseKeysIn = __webpack_require__(/*! ./_baseKeysIn */ "../../node_modules/lodash/_baseKeysIn.js"),
  10753. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js");
  10754. /**
  10755. * Creates an array of the own and inherited enumerable property names of `object`.
  10756. *
  10757. * **Note:** Non-object values are coerced to objects.
  10758. *
  10759. * @static
  10760. * @memberOf _
  10761. * @since 3.0.0
  10762. * @category Object
  10763. * @param {Object} object The object to query.
  10764. * @returns {Array} Returns the array of property names.
  10765. * @example
  10766. *
  10767. * function Foo() {
  10768. * this.a = 1;
  10769. * this.b = 2;
  10770. * }
  10771. *
  10772. * Foo.prototype.c = 3;
  10773. *
  10774. * _.keysIn(new Foo);
  10775. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  10776. */
  10777. function keysIn(object) {
  10778. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  10779. }
  10780. module.exports = keysIn;
  10781. /***/ }),
  10782. /***/ "../../node_modules/lodash/last.js":
  10783. /*!*******************************************************************!*\
  10784. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/last.js ***!
  10785. \*******************************************************************/
  10786. /*! no static exports found */
  10787. /***/ (function(module, exports) {
  10788. /**
  10789. * Gets the last element of `array`.
  10790. *
  10791. * @static
  10792. * @memberOf _
  10793. * @since 0.1.0
  10794. * @category Array
  10795. * @param {Array} array The array to query.
  10796. * @returns {*} Returns the last element of `array`.
  10797. * @example
  10798. *
  10799. * _.last([1, 2, 3]);
  10800. * // => 3
  10801. */
  10802. function last(array) {
  10803. var length = array == null ? 0 : array.length;
  10804. return length ? array[length - 1] : undefined;
  10805. }
  10806. module.exports = last;
  10807. /***/ }),
  10808. /***/ "../../node_modules/lodash/map.js":
  10809. /*!******************************************************************!*\
  10810. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/map.js ***!
  10811. \******************************************************************/
  10812. /*! no static exports found */
  10813. /***/ (function(module, exports, __webpack_require__) {
  10814. var arrayMap = __webpack_require__(/*! ./_arrayMap */ "../../node_modules/lodash/_arrayMap.js"),
  10815. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  10816. baseMap = __webpack_require__(/*! ./_baseMap */ "../../node_modules/lodash/_baseMap.js"),
  10817. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
  10818. /**
  10819. * Creates an array of values by running each element in `collection` thru
  10820. * `iteratee`. The iteratee is invoked with three arguments:
  10821. * (value, index|key, collection).
  10822. *
  10823. * Many lodash methods are guarded to work as iteratees for methods like
  10824. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  10825. *
  10826. * The guarded methods are:
  10827. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  10828. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  10829. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  10830. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  10831. *
  10832. * @static
  10833. * @memberOf _
  10834. * @since 0.1.0
  10835. * @category Collection
  10836. * @param {Array|Object} collection The collection to iterate over.
  10837. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10838. * @returns {Array} Returns the new mapped array.
  10839. * @example
  10840. *
  10841. * function square(n) {
  10842. * return n * n;
  10843. * }
  10844. *
  10845. * _.map([4, 8], square);
  10846. * // => [16, 64]
  10847. *
  10848. * _.map({ 'a': 4, 'b': 8 }, square);
  10849. * // => [16, 64] (iteration order is not guaranteed)
  10850. *
  10851. * var users = [
  10852. * { 'user': 'barney' },
  10853. * { 'user': 'fred' }
  10854. * ];
  10855. *
  10856. * // The `_.property` iteratee shorthand.
  10857. * _.map(users, 'user');
  10858. * // => ['barney', 'fred']
  10859. */
  10860. function map(collection, iteratee) {
  10861. var func = isArray(collection) ? arrayMap : baseMap;
  10862. return func(collection, baseIteratee(iteratee, 3));
  10863. }
  10864. module.exports = map;
  10865. /***/ }),
  10866. /***/ "../../node_modules/lodash/mapValues.js":
  10867. /*!************************************************************************!*\
  10868. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/mapValues.js ***!
  10869. \************************************************************************/
  10870. /*! no static exports found */
  10871. /***/ (function(module, exports, __webpack_require__) {
  10872. var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "../../node_modules/lodash/_baseAssignValue.js"),
  10873. baseForOwn = __webpack_require__(/*! ./_baseForOwn */ "../../node_modules/lodash/_baseForOwn.js"),
  10874. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js");
  10875. /**
  10876. * Creates an object with the same keys as `object` and values generated
  10877. * by running each own enumerable string keyed property of `object` thru
  10878. * `iteratee`. The iteratee is invoked with three arguments:
  10879. * (value, key, object).
  10880. *
  10881. * @static
  10882. * @memberOf _
  10883. * @since 2.4.0
  10884. * @category Object
  10885. * @param {Object} object The object to iterate over.
  10886. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10887. * @returns {Object} Returns the new mapped object.
  10888. * @see _.mapKeys
  10889. * @example
  10890. *
  10891. * var users = {
  10892. * 'fred': { 'user': 'fred', 'age': 40 },
  10893. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  10894. * };
  10895. *
  10896. * _.mapValues(users, function(o) { return o.age; });
  10897. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  10898. *
  10899. * // The `_.property` iteratee shorthand.
  10900. * _.mapValues(users, 'age');
  10901. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  10902. */
  10903. function mapValues(object, iteratee) {
  10904. var result = {};
  10905. iteratee = baseIteratee(iteratee, 3);
  10906. baseForOwn(object, function(value, key, object) {
  10907. baseAssignValue(result, key, iteratee(value, key, object));
  10908. });
  10909. return result;
  10910. }
  10911. module.exports = mapValues;
  10912. /***/ }),
  10913. /***/ "../../node_modules/lodash/max.js":
  10914. /*!******************************************************************!*\
  10915. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/max.js ***!
  10916. \******************************************************************/
  10917. /*! no static exports found */
  10918. /***/ (function(module, exports, __webpack_require__) {
  10919. var baseExtremum = __webpack_require__(/*! ./_baseExtremum */ "../../node_modules/lodash/_baseExtremum.js"),
  10920. baseGt = __webpack_require__(/*! ./_baseGt */ "../../node_modules/lodash/_baseGt.js"),
  10921. identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js");
  10922. /**
  10923. * Computes the maximum value of `array`. If `array` is empty or falsey,
  10924. * `undefined` is returned.
  10925. *
  10926. * @static
  10927. * @since 0.1.0
  10928. * @memberOf _
  10929. * @category Math
  10930. * @param {Array} array The array to iterate over.
  10931. * @returns {*} Returns the maximum value.
  10932. * @example
  10933. *
  10934. * _.max([4, 2, 8, 6]);
  10935. * // => 8
  10936. *
  10937. * _.max([]);
  10938. * // => undefined
  10939. */
  10940. function max(array) {
  10941. return (array && array.length)
  10942. ? baseExtremum(array, identity, baseGt)
  10943. : undefined;
  10944. }
  10945. module.exports = max;
  10946. /***/ }),
  10947. /***/ "../../node_modules/lodash/memoize.js":
  10948. /*!**********************************************************************!*\
  10949. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/memoize.js ***!
  10950. \**********************************************************************/
  10951. /*! no static exports found */
  10952. /***/ (function(module, exports, __webpack_require__) {
  10953. var MapCache = __webpack_require__(/*! ./_MapCache */ "../../node_modules/lodash/_MapCache.js");
  10954. /** Error message constants. */
  10955. var FUNC_ERROR_TEXT = 'Expected a function';
  10956. /**
  10957. * Creates a function that memoizes the result of `func`. If `resolver` is
  10958. * provided, it determines the cache key for storing the result based on the
  10959. * arguments provided to the memoized function. By default, the first argument
  10960. * provided to the memoized function is used as the map cache key. The `func`
  10961. * is invoked with the `this` binding of the memoized function.
  10962. *
  10963. * **Note:** The cache is exposed as the `cache` property on the memoized
  10964. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  10965. * constructor with one whose instances implement the
  10966. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  10967. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  10968. *
  10969. * @static
  10970. * @memberOf _
  10971. * @since 0.1.0
  10972. * @category Function
  10973. * @param {Function} func The function to have its output memoized.
  10974. * @param {Function} [resolver] The function to resolve the cache key.
  10975. * @returns {Function} Returns the new memoized function.
  10976. * @example
  10977. *
  10978. * var object = { 'a': 1, 'b': 2 };
  10979. * var other = { 'c': 3, 'd': 4 };
  10980. *
  10981. * var values = _.memoize(_.values);
  10982. * values(object);
  10983. * // => [1, 2]
  10984. *
  10985. * values(other);
  10986. * // => [3, 4]
  10987. *
  10988. * object.a = 2;
  10989. * values(object);
  10990. * // => [1, 2]
  10991. *
  10992. * // Modify the result cache.
  10993. * values.cache.set(object, ['a', 'b']);
  10994. * values(object);
  10995. * // => ['a', 'b']
  10996. *
  10997. * // Replace `_.memoize.Cache`.
  10998. * _.memoize.Cache = WeakMap;
  10999. */
  11000. function memoize(func, resolver) {
  11001. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  11002. throw new TypeError(FUNC_ERROR_TEXT);
  11003. }
  11004. var memoized = function() {
  11005. var args = arguments,
  11006. key = resolver ? resolver.apply(this, args) : args[0],
  11007. cache = memoized.cache;
  11008. if (cache.has(key)) {
  11009. return cache.get(key);
  11010. }
  11011. var result = func.apply(this, args);
  11012. memoized.cache = cache.set(key, result) || cache;
  11013. return result;
  11014. };
  11015. memoized.cache = new (memoize.Cache || MapCache);
  11016. return memoized;
  11017. }
  11018. // Expose `MapCache`.
  11019. memoize.Cache = MapCache;
  11020. module.exports = memoize;
  11021. /***/ }),
  11022. /***/ "../../node_modules/lodash/merge.js":
  11023. /*!********************************************************************!*\
  11024. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/merge.js ***!
  11025. \********************************************************************/
  11026. /*! no static exports found */
  11027. /***/ (function(module, exports, __webpack_require__) {
  11028. var baseMerge = __webpack_require__(/*! ./_baseMerge */ "../../node_modules/lodash/_baseMerge.js"),
  11029. createAssigner = __webpack_require__(/*! ./_createAssigner */ "../../node_modules/lodash/_createAssigner.js");
  11030. /**
  11031. * This method is like `_.assign` except that it recursively merges own and
  11032. * inherited enumerable string keyed properties of source objects into the
  11033. * destination object. Source properties that resolve to `undefined` are
  11034. * skipped if a destination value exists. Array and plain object properties
  11035. * are merged recursively. Other objects and value types are overridden by
  11036. * assignment. Source objects are applied from left to right. Subsequent
  11037. * sources overwrite property assignments of previous sources.
  11038. *
  11039. * **Note:** This method mutates `object`.
  11040. *
  11041. * @static
  11042. * @memberOf _
  11043. * @since 0.5.0
  11044. * @category Object
  11045. * @param {Object} object The destination object.
  11046. * @param {...Object} [sources] The source objects.
  11047. * @returns {Object} Returns `object`.
  11048. * @example
  11049. *
  11050. * var object = {
  11051. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  11052. * };
  11053. *
  11054. * var other = {
  11055. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  11056. * };
  11057. *
  11058. * _.merge(object, other);
  11059. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  11060. */
  11061. var merge = createAssigner(function(object, source, srcIndex) {
  11062. baseMerge(object, source, srcIndex);
  11063. });
  11064. module.exports = merge;
  11065. /***/ }),
  11066. /***/ "../../node_modules/lodash/min.js":
  11067. /*!******************************************************************!*\
  11068. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/min.js ***!
  11069. \******************************************************************/
  11070. /*! no static exports found */
  11071. /***/ (function(module, exports, __webpack_require__) {
  11072. var baseExtremum = __webpack_require__(/*! ./_baseExtremum */ "../../node_modules/lodash/_baseExtremum.js"),
  11073. baseLt = __webpack_require__(/*! ./_baseLt */ "../../node_modules/lodash/_baseLt.js"),
  11074. identity = __webpack_require__(/*! ./identity */ "../../node_modules/lodash/identity.js");
  11075. /**
  11076. * Computes the minimum value of `array`. If `array` is empty or falsey,
  11077. * `undefined` is returned.
  11078. *
  11079. * @static
  11080. * @since 0.1.0
  11081. * @memberOf _
  11082. * @category Math
  11083. * @param {Array} array The array to iterate over.
  11084. * @returns {*} Returns the minimum value.
  11085. * @example
  11086. *
  11087. * _.min([4, 2, 8, 6]);
  11088. * // => 2
  11089. *
  11090. * _.min([]);
  11091. * // => undefined
  11092. */
  11093. function min(array) {
  11094. return (array && array.length)
  11095. ? baseExtremum(array, identity, baseLt)
  11096. : undefined;
  11097. }
  11098. module.exports = min;
  11099. /***/ }),
  11100. /***/ "../../node_modules/lodash/minBy.js":
  11101. /*!********************************************************************!*\
  11102. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/minBy.js ***!
  11103. \********************************************************************/
  11104. /*! no static exports found */
  11105. /***/ (function(module, exports, __webpack_require__) {
  11106. var baseExtremum = __webpack_require__(/*! ./_baseExtremum */ "../../node_modules/lodash/_baseExtremum.js"),
  11107. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  11108. baseLt = __webpack_require__(/*! ./_baseLt */ "../../node_modules/lodash/_baseLt.js");
  11109. /**
  11110. * This method is like `_.min` except that it accepts `iteratee` which is
  11111. * invoked for each element in `array` to generate the criterion by which
  11112. * the value is ranked. The iteratee is invoked with one argument: (value).
  11113. *
  11114. * @static
  11115. * @memberOf _
  11116. * @since 4.0.0
  11117. * @category Math
  11118. * @param {Array} array The array to iterate over.
  11119. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  11120. * @returns {*} Returns the minimum value.
  11121. * @example
  11122. *
  11123. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  11124. *
  11125. * _.minBy(objects, function(o) { return o.n; });
  11126. * // => { 'n': 1 }
  11127. *
  11128. * // The `_.property` iteratee shorthand.
  11129. * _.minBy(objects, 'n');
  11130. * // => { 'n': 1 }
  11131. */
  11132. function minBy(array, iteratee) {
  11133. return (array && array.length)
  11134. ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt)
  11135. : undefined;
  11136. }
  11137. module.exports = minBy;
  11138. /***/ }),
  11139. /***/ "../../node_modules/lodash/noop.js":
  11140. /*!*******************************************************************!*\
  11141. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/noop.js ***!
  11142. \*******************************************************************/
  11143. /*! no static exports found */
  11144. /***/ (function(module, exports) {
  11145. /**
  11146. * This method returns `undefined`.
  11147. *
  11148. * @static
  11149. * @memberOf _
  11150. * @since 2.3.0
  11151. * @category Util
  11152. * @example
  11153. *
  11154. * _.times(2, _.noop);
  11155. * // => [undefined, undefined]
  11156. */
  11157. function noop() {
  11158. // No operation performed.
  11159. }
  11160. module.exports = noop;
  11161. /***/ }),
  11162. /***/ "../../node_modules/lodash/now.js":
  11163. /*!******************************************************************!*\
  11164. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/now.js ***!
  11165. \******************************************************************/
  11166. /*! no static exports found */
  11167. /***/ (function(module, exports, __webpack_require__) {
  11168. var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
  11169. /**
  11170. * Gets the timestamp of the number of milliseconds that have elapsed since
  11171. * the Unix epoch (1 January 1970 00:00:00 UTC).
  11172. *
  11173. * @static
  11174. * @memberOf _
  11175. * @since 2.4.0
  11176. * @category Date
  11177. * @returns {number} Returns the timestamp.
  11178. * @example
  11179. *
  11180. * _.defer(function(stamp) {
  11181. * console.log(_.now() - stamp);
  11182. * }, _.now());
  11183. * // => Logs the number of milliseconds it took for the deferred invocation.
  11184. */
  11185. var now = function() {
  11186. return root.Date.now();
  11187. };
  11188. module.exports = now;
  11189. /***/ }),
  11190. /***/ "../../node_modules/lodash/pick.js":
  11191. /*!*******************************************************************!*\
  11192. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/pick.js ***!
  11193. \*******************************************************************/
  11194. /*! no static exports found */
  11195. /***/ (function(module, exports, __webpack_require__) {
  11196. var basePick = __webpack_require__(/*! ./_basePick */ "../../node_modules/lodash/_basePick.js"),
  11197. flatRest = __webpack_require__(/*! ./_flatRest */ "../../node_modules/lodash/_flatRest.js");
  11198. /**
  11199. * Creates an object composed of the picked `object` properties.
  11200. *
  11201. * @static
  11202. * @since 0.1.0
  11203. * @memberOf _
  11204. * @category Object
  11205. * @param {Object} object The source object.
  11206. * @param {...(string|string[])} [paths] The property paths to pick.
  11207. * @returns {Object} Returns the new object.
  11208. * @example
  11209. *
  11210. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  11211. *
  11212. * _.pick(object, ['a', 'c']);
  11213. * // => { 'a': 1, 'c': 3 }
  11214. */
  11215. var pick = flatRest(function(object, paths) {
  11216. return object == null ? {} : basePick(object, paths);
  11217. });
  11218. module.exports = pick;
  11219. /***/ }),
  11220. /***/ "../../node_modules/lodash/property.js":
  11221. /*!***********************************************************************!*\
  11222. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/property.js ***!
  11223. \***********************************************************************/
  11224. /*! no static exports found */
  11225. /***/ (function(module, exports, __webpack_require__) {
  11226. var baseProperty = __webpack_require__(/*! ./_baseProperty */ "../../node_modules/lodash/_baseProperty.js"),
  11227. basePropertyDeep = __webpack_require__(/*! ./_basePropertyDeep */ "../../node_modules/lodash/_basePropertyDeep.js"),
  11228. isKey = __webpack_require__(/*! ./_isKey */ "../../node_modules/lodash/_isKey.js"),
  11229. toKey = __webpack_require__(/*! ./_toKey */ "../../node_modules/lodash/_toKey.js");
  11230. /**
  11231. * Creates a function that returns the value at `path` of a given object.
  11232. *
  11233. * @static
  11234. * @memberOf _
  11235. * @since 2.4.0
  11236. * @category Util
  11237. * @param {Array|string} path The path of the property to get.
  11238. * @returns {Function} Returns the new accessor function.
  11239. * @example
  11240. *
  11241. * var objects = [
  11242. * { 'a': { 'b': 2 } },
  11243. * { 'a': { 'b': 1 } }
  11244. * ];
  11245. *
  11246. * _.map(objects, _.property('a.b'));
  11247. * // => [2, 1]
  11248. *
  11249. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  11250. * // => [1, 2]
  11251. */
  11252. function property(path) {
  11253. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  11254. }
  11255. module.exports = property;
  11256. /***/ }),
  11257. /***/ "../../node_modules/lodash/range.js":
  11258. /*!********************************************************************!*\
  11259. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/range.js ***!
  11260. \********************************************************************/
  11261. /*! no static exports found */
  11262. /***/ (function(module, exports, __webpack_require__) {
  11263. var createRange = __webpack_require__(/*! ./_createRange */ "../../node_modules/lodash/_createRange.js");
  11264. /**
  11265. * Creates an array of numbers (positive and/or negative) progressing from
  11266. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  11267. * `start` is specified without an `end` or `step`. If `end` is not specified,
  11268. * it's set to `start` with `start` then set to `0`.
  11269. *
  11270. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  11271. * floating-point values which can produce unexpected results.
  11272. *
  11273. * @static
  11274. * @since 0.1.0
  11275. * @memberOf _
  11276. * @category Util
  11277. * @param {number} [start=0] The start of the range.
  11278. * @param {number} end The end of the range.
  11279. * @param {number} [step=1] The value to increment or decrement by.
  11280. * @returns {Array} Returns the range of numbers.
  11281. * @see _.inRange, _.rangeRight
  11282. * @example
  11283. *
  11284. * _.range(4);
  11285. * // => [0, 1, 2, 3]
  11286. *
  11287. * _.range(-4);
  11288. * // => [0, -1, -2, -3]
  11289. *
  11290. * _.range(1, 5);
  11291. * // => [1, 2, 3, 4]
  11292. *
  11293. * _.range(0, 20, 5);
  11294. * // => [0, 5, 10, 15]
  11295. *
  11296. * _.range(0, -4, -1);
  11297. * // => [0, -1, -2, -3]
  11298. *
  11299. * _.range(1, 4, 0);
  11300. * // => [1, 1, 1]
  11301. *
  11302. * _.range(0);
  11303. * // => []
  11304. */
  11305. var range = createRange();
  11306. module.exports = range;
  11307. /***/ }),
  11308. /***/ "../../node_modules/lodash/reduce.js":
  11309. /*!*********************************************************************!*\
  11310. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/reduce.js ***!
  11311. \*********************************************************************/
  11312. /*! no static exports found */
  11313. /***/ (function(module, exports, __webpack_require__) {
  11314. var arrayReduce = __webpack_require__(/*! ./_arrayReduce */ "../../node_modules/lodash/_arrayReduce.js"),
  11315. baseEach = __webpack_require__(/*! ./_baseEach */ "../../node_modules/lodash/_baseEach.js"),
  11316. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  11317. baseReduce = __webpack_require__(/*! ./_baseReduce */ "../../node_modules/lodash/_baseReduce.js"),
  11318. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
  11319. /**
  11320. * Reduces `collection` to a value which is the accumulated result of running
  11321. * each element in `collection` thru `iteratee`, where each successive
  11322. * invocation is supplied the return value of the previous. If `accumulator`
  11323. * is not given, the first element of `collection` is used as the initial
  11324. * value. The iteratee is invoked with four arguments:
  11325. * (accumulator, value, index|key, collection).
  11326. *
  11327. * Many lodash methods are guarded to work as iteratees for methods like
  11328. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  11329. *
  11330. * The guarded methods are:
  11331. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  11332. * and `sortBy`
  11333. *
  11334. * @static
  11335. * @memberOf _
  11336. * @since 0.1.0
  11337. * @category Collection
  11338. * @param {Array|Object} collection The collection to iterate over.
  11339. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  11340. * @param {*} [accumulator] The initial value.
  11341. * @returns {*} Returns the accumulated value.
  11342. * @see _.reduceRight
  11343. * @example
  11344. *
  11345. * _.reduce([1, 2], function(sum, n) {
  11346. * return sum + n;
  11347. * }, 0);
  11348. * // => 3
  11349. *
  11350. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  11351. * (result[value] || (result[value] = [])).push(key);
  11352. * return result;
  11353. * }, {});
  11354. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  11355. */
  11356. function reduce(collection, iteratee, accumulator) {
  11357. var func = isArray(collection) ? arrayReduce : baseReduce,
  11358. initAccum = arguments.length < 3;
  11359. return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  11360. }
  11361. module.exports = reduce;
  11362. /***/ }),
  11363. /***/ "../../node_modules/lodash/size.js":
  11364. /*!*******************************************************************!*\
  11365. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/size.js ***!
  11366. \*******************************************************************/
  11367. /*! no static exports found */
  11368. /***/ (function(module, exports, __webpack_require__) {
  11369. var baseKeys = __webpack_require__(/*! ./_baseKeys */ "../../node_modules/lodash/_baseKeys.js"),
  11370. getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
  11371. isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js"),
  11372. isString = __webpack_require__(/*! ./isString */ "../../node_modules/lodash/isString.js"),
  11373. stringSize = __webpack_require__(/*! ./_stringSize */ "../../node_modules/lodash/_stringSize.js");
  11374. /** `Object#toString` result references. */
  11375. var mapTag = '[object Map]',
  11376. setTag = '[object Set]';
  11377. /**
  11378. * Gets the size of `collection` by returning its length for array-like
  11379. * values or the number of own enumerable string keyed properties for objects.
  11380. *
  11381. * @static
  11382. * @memberOf _
  11383. * @since 0.1.0
  11384. * @category Collection
  11385. * @param {Array|Object|string} collection The collection to inspect.
  11386. * @returns {number} Returns the collection size.
  11387. * @example
  11388. *
  11389. * _.size([1, 2, 3]);
  11390. * // => 3
  11391. *
  11392. * _.size({ 'a': 1, 'b': 2 });
  11393. * // => 2
  11394. *
  11395. * _.size('pebbles');
  11396. * // => 7
  11397. */
  11398. function size(collection) {
  11399. if (collection == null) {
  11400. return 0;
  11401. }
  11402. if (isArrayLike(collection)) {
  11403. return isString(collection) ? stringSize(collection) : collection.length;
  11404. }
  11405. var tag = getTag(collection);
  11406. if (tag == mapTag || tag == setTag) {
  11407. return collection.size;
  11408. }
  11409. return baseKeys(collection).length;
  11410. }
  11411. module.exports = size;
  11412. /***/ }),
  11413. /***/ "../../node_modules/lodash/sortBy.js":
  11414. /*!*********************************************************************!*\
  11415. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/sortBy.js ***!
  11416. \*********************************************************************/
  11417. /*! no static exports found */
  11418. /***/ (function(module, exports, __webpack_require__) {
  11419. var baseFlatten = __webpack_require__(/*! ./_baseFlatten */ "../../node_modules/lodash/_baseFlatten.js"),
  11420. baseOrderBy = __webpack_require__(/*! ./_baseOrderBy */ "../../node_modules/lodash/_baseOrderBy.js"),
  11421. baseRest = __webpack_require__(/*! ./_baseRest */ "../../node_modules/lodash/_baseRest.js"),
  11422. isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ "../../node_modules/lodash/_isIterateeCall.js");
  11423. /**
  11424. * Creates an array of elements, sorted in ascending order by the results of
  11425. * running each element in a collection thru each iteratee. This method
  11426. * performs a stable sort, that is, it preserves the original sort order of
  11427. * equal elements. The iteratees are invoked with one argument: (value).
  11428. *
  11429. * @static
  11430. * @memberOf _
  11431. * @since 0.1.0
  11432. * @category Collection
  11433. * @param {Array|Object} collection The collection to iterate over.
  11434. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  11435. * The iteratees to sort by.
  11436. * @returns {Array} Returns the new sorted array.
  11437. * @example
  11438. *
  11439. * var users = [
  11440. * { 'user': 'fred', 'age': 48 },
  11441. * { 'user': 'barney', 'age': 36 },
  11442. * { 'user': 'fred', 'age': 40 },
  11443. * { 'user': 'barney', 'age': 34 }
  11444. * ];
  11445. *
  11446. * _.sortBy(users, [function(o) { return o.user; }]);
  11447. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  11448. *
  11449. * _.sortBy(users, ['user', 'age']);
  11450. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  11451. */
  11452. var sortBy = baseRest(function(collection, iteratees) {
  11453. if (collection == null) {
  11454. return [];
  11455. }
  11456. var length = iteratees.length;
  11457. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  11458. iteratees = [];
  11459. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  11460. iteratees = [iteratees[0]];
  11461. }
  11462. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  11463. });
  11464. module.exports = sortBy;
  11465. /***/ }),
  11466. /***/ "../../node_modules/lodash/stubArray.js":
  11467. /*!************************************************************************!*\
  11468. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/stubArray.js ***!
  11469. \************************************************************************/
  11470. /*! no static exports found */
  11471. /***/ (function(module, exports) {
  11472. /**
  11473. * This method returns a new empty array.
  11474. *
  11475. * @static
  11476. * @memberOf _
  11477. * @since 4.13.0
  11478. * @category Util
  11479. * @returns {Array} Returns the new empty array.
  11480. * @example
  11481. *
  11482. * var arrays = _.times(2, _.stubArray);
  11483. *
  11484. * console.log(arrays);
  11485. * // => [[], []]
  11486. *
  11487. * console.log(arrays[0] === arrays[1]);
  11488. * // => false
  11489. */
  11490. function stubArray() {
  11491. return [];
  11492. }
  11493. module.exports = stubArray;
  11494. /***/ }),
  11495. /***/ "../../node_modules/lodash/stubFalse.js":
  11496. /*!************************************************************************!*\
  11497. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/stubFalse.js ***!
  11498. \************************************************************************/
  11499. /*! no static exports found */
  11500. /***/ (function(module, exports) {
  11501. /**
  11502. * This method returns `false`.
  11503. *
  11504. * @static
  11505. * @memberOf _
  11506. * @since 4.13.0
  11507. * @category Util
  11508. * @returns {boolean} Returns `false`.
  11509. * @example
  11510. *
  11511. * _.times(2, _.stubFalse);
  11512. * // => [false, false]
  11513. */
  11514. function stubFalse() {
  11515. return false;
  11516. }
  11517. module.exports = stubFalse;
  11518. /***/ }),
  11519. /***/ "../../node_modules/lodash/toFinite.js":
  11520. /*!***********************************************************************!*\
  11521. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/toFinite.js ***!
  11522. \***********************************************************************/
  11523. /*! no static exports found */
  11524. /***/ (function(module, exports, __webpack_require__) {
  11525. var toNumber = __webpack_require__(/*! ./toNumber */ "../../node_modules/lodash/toNumber.js");
  11526. /** Used as references for various `Number` constants. */
  11527. var INFINITY = 1 / 0,
  11528. MAX_INTEGER = 1.7976931348623157e+308;
  11529. /**
  11530. * Converts `value` to a finite number.
  11531. *
  11532. * @static
  11533. * @memberOf _
  11534. * @since 4.12.0
  11535. * @category Lang
  11536. * @param {*} value The value to convert.
  11537. * @returns {number} Returns the converted number.
  11538. * @example
  11539. *
  11540. * _.toFinite(3.2);
  11541. * // => 3.2
  11542. *
  11543. * _.toFinite(Number.MIN_VALUE);
  11544. * // => 5e-324
  11545. *
  11546. * _.toFinite(Infinity);
  11547. * // => 1.7976931348623157e+308
  11548. *
  11549. * _.toFinite('3.2');
  11550. * // => 3.2
  11551. */
  11552. function toFinite(value) {
  11553. if (!value) {
  11554. return value === 0 ? value : 0;
  11555. }
  11556. value = toNumber(value);
  11557. if (value === INFINITY || value === -INFINITY) {
  11558. var sign = (value < 0 ? -1 : 1);
  11559. return sign * MAX_INTEGER;
  11560. }
  11561. return value === value ? value : 0;
  11562. }
  11563. module.exports = toFinite;
  11564. /***/ }),
  11565. /***/ "../../node_modules/lodash/toInteger.js":
  11566. /*!************************************************************************!*\
  11567. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/toInteger.js ***!
  11568. \************************************************************************/
  11569. /*! no static exports found */
  11570. /***/ (function(module, exports, __webpack_require__) {
  11571. var toFinite = __webpack_require__(/*! ./toFinite */ "../../node_modules/lodash/toFinite.js");
  11572. /**
  11573. * Converts `value` to an integer.
  11574. *
  11575. * **Note:** This method is loosely based on
  11576. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  11577. *
  11578. * @static
  11579. * @memberOf _
  11580. * @since 4.0.0
  11581. * @category Lang
  11582. * @param {*} value The value to convert.
  11583. * @returns {number} Returns the converted integer.
  11584. * @example
  11585. *
  11586. * _.toInteger(3.2);
  11587. * // => 3
  11588. *
  11589. * _.toInteger(Number.MIN_VALUE);
  11590. * // => 0
  11591. *
  11592. * _.toInteger(Infinity);
  11593. * // => 1.7976931348623157e+308
  11594. *
  11595. * _.toInteger('3.2');
  11596. * // => 3
  11597. */
  11598. function toInteger(value) {
  11599. var result = toFinite(value),
  11600. remainder = result % 1;
  11601. return result === result ? (remainder ? result - remainder : result) : 0;
  11602. }
  11603. module.exports = toInteger;
  11604. /***/ }),
  11605. /***/ "../../node_modules/lodash/toNumber.js":
  11606. /*!***********************************************************************!*\
  11607. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/toNumber.js ***!
  11608. \***********************************************************************/
  11609. /*! no static exports found */
  11610. /***/ (function(module, exports, __webpack_require__) {
  11611. var isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  11612. isSymbol = __webpack_require__(/*! ./isSymbol */ "../../node_modules/lodash/isSymbol.js");
  11613. /** Used as references for various `Number` constants. */
  11614. var NAN = 0 / 0;
  11615. /** Used to match leading and trailing whitespace. */
  11616. var reTrim = /^\s+|\s+$/g;
  11617. /** Used to detect bad signed hexadecimal string values. */
  11618. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  11619. /** Used to detect binary string values. */
  11620. var reIsBinary = /^0b[01]+$/i;
  11621. /** Used to detect octal string values. */
  11622. var reIsOctal = /^0o[0-7]+$/i;
  11623. /** Built-in method references without a dependency on `root`. */
  11624. var freeParseInt = parseInt;
  11625. /**
  11626. * Converts `value` to a number.
  11627. *
  11628. * @static
  11629. * @memberOf _
  11630. * @since 4.0.0
  11631. * @category Lang
  11632. * @param {*} value The value to process.
  11633. * @returns {number} Returns the number.
  11634. * @example
  11635. *
  11636. * _.toNumber(3.2);
  11637. * // => 3.2
  11638. *
  11639. * _.toNumber(Number.MIN_VALUE);
  11640. * // => 5e-324
  11641. *
  11642. * _.toNumber(Infinity);
  11643. * // => Infinity
  11644. *
  11645. * _.toNumber('3.2');
  11646. * // => 3.2
  11647. */
  11648. function toNumber(value) {
  11649. if (typeof value == 'number') {
  11650. return value;
  11651. }
  11652. if (isSymbol(value)) {
  11653. return NAN;
  11654. }
  11655. if (isObject(value)) {
  11656. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  11657. value = isObject(other) ? (other + '') : other;
  11658. }
  11659. if (typeof value != 'string') {
  11660. return value === 0 ? value : +value;
  11661. }
  11662. value = value.replace(reTrim, '');
  11663. var isBinary = reIsBinary.test(value);
  11664. return (isBinary || reIsOctal.test(value))
  11665. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  11666. : (reIsBadHex.test(value) ? NAN : +value);
  11667. }
  11668. module.exports = toNumber;
  11669. /***/ }),
  11670. /***/ "../../node_modules/lodash/toPlainObject.js":
  11671. /*!****************************************************************************!*\
  11672. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/toPlainObject.js ***!
  11673. \****************************************************************************/
  11674. /*! no static exports found */
  11675. /***/ (function(module, exports, __webpack_require__) {
  11676. var copyObject = __webpack_require__(/*! ./_copyObject */ "../../node_modules/lodash/_copyObject.js"),
  11677. keysIn = __webpack_require__(/*! ./keysIn */ "../../node_modules/lodash/keysIn.js");
  11678. /**
  11679. * Converts `value` to a plain object flattening inherited enumerable string
  11680. * keyed properties of `value` to own properties of the plain object.
  11681. *
  11682. * @static
  11683. * @memberOf _
  11684. * @since 3.0.0
  11685. * @category Lang
  11686. * @param {*} value The value to convert.
  11687. * @returns {Object} Returns the converted plain object.
  11688. * @example
  11689. *
  11690. * function Foo() {
  11691. * this.b = 2;
  11692. * }
  11693. *
  11694. * Foo.prototype.c = 3;
  11695. *
  11696. * _.assign({ 'a': 1 }, new Foo);
  11697. * // => { 'a': 1, 'b': 2 }
  11698. *
  11699. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  11700. * // => { 'a': 1, 'b': 2, 'c': 3 }
  11701. */
  11702. function toPlainObject(value) {
  11703. return copyObject(value, keysIn(value));
  11704. }
  11705. module.exports = toPlainObject;
  11706. /***/ }),
  11707. /***/ "../../node_modules/lodash/toString.js":
  11708. /*!***********************************************************************!*\
  11709. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/toString.js ***!
  11710. \***********************************************************************/
  11711. /*! no static exports found */
  11712. /***/ (function(module, exports, __webpack_require__) {
  11713. var baseToString = __webpack_require__(/*! ./_baseToString */ "../../node_modules/lodash/_baseToString.js");
  11714. /**
  11715. * Converts `value` to a string. An empty string is returned for `null`
  11716. * and `undefined` values. The sign of `-0` is preserved.
  11717. *
  11718. * @static
  11719. * @memberOf _
  11720. * @since 4.0.0
  11721. * @category Lang
  11722. * @param {*} value The value to convert.
  11723. * @returns {string} Returns the converted string.
  11724. * @example
  11725. *
  11726. * _.toString(null);
  11727. * // => ''
  11728. *
  11729. * _.toString(-0);
  11730. * // => '-0'
  11731. *
  11732. * _.toString([1, 2, 3]);
  11733. * // => '1,2,3'
  11734. */
  11735. function toString(value) {
  11736. return value == null ? '' : baseToString(value);
  11737. }
  11738. module.exports = toString;
  11739. /***/ }),
  11740. /***/ "../../node_modules/lodash/transform.js":
  11741. /*!************************************************************************!*\
  11742. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/transform.js ***!
  11743. \************************************************************************/
  11744. /*! no static exports found */
  11745. /***/ (function(module, exports, __webpack_require__) {
  11746. var arrayEach = __webpack_require__(/*! ./_arrayEach */ "../../node_modules/lodash/_arrayEach.js"),
  11747. baseCreate = __webpack_require__(/*! ./_baseCreate */ "../../node_modules/lodash/_baseCreate.js"),
  11748. baseForOwn = __webpack_require__(/*! ./_baseForOwn */ "../../node_modules/lodash/_baseForOwn.js"),
  11749. baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../node_modules/lodash/_baseIteratee.js"),
  11750. getPrototype = __webpack_require__(/*! ./_getPrototype */ "../../node_modules/lodash/_getPrototype.js"),
  11751. isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
  11752. isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
  11753. isFunction = __webpack_require__(/*! ./isFunction */ "../../node_modules/lodash/isFunction.js"),
  11754. isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
  11755. isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../node_modules/lodash/isTypedArray.js");
  11756. /**
  11757. * An alternative to `_.reduce`; this method transforms `object` to a new
  11758. * `accumulator` object which is the result of running each of its own
  11759. * enumerable string keyed properties thru `iteratee`, with each invocation
  11760. * potentially mutating the `accumulator` object. If `accumulator` is not
  11761. * provided, a new object with the same `[[Prototype]]` will be used. The
  11762. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  11763. * Iteratee functions may exit iteration early by explicitly returning `false`.
  11764. *
  11765. * @static
  11766. * @memberOf _
  11767. * @since 1.3.0
  11768. * @category Object
  11769. * @param {Object} object The object to iterate over.
  11770. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  11771. * @param {*} [accumulator] The custom accumulator value.
  11772. * @returns {*} Returns the accumulated value.
  11773. * @example
  11774. *
  11775. * _.transform([2, 3, 4], function(result, n) {
  11776. * result.push(n *= n);
  11777. * return n % 2 == 0;
  11778. * }, []);
  11779. * // => [4, 9]
  11780. *
  11781. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  11782. * (result[value] || (result[value] = [])).push(key);
  11783. * }, {});
  11784. * // => { '1': ['a', 'c'], '2': ['b'] }
  11785. */
  11786. function transform(object, iteratee, accumulator) {
  11787. var isArr = isArray(object),
  11788. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  11789. iteratee = baseIteratee(iteratee, 4);
  11790. if (accumulator == null) {
  11791. var Ctor = object && object.constructor;
  11792. if (isArrLike) {
  11793. accumulator = isArr ? new Ctor : [];
  11794. }
  11795. else if (isObject(object)) {
  11796. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  11797. }
  11798. else {
  11799. accumulator = {};
  11800. }
  11801. }
  11802. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  11803. return iteratee(accumulator, value, index, object);
  11804. });
  11805. return accumulator;
  11806. }
  11807. module.exports = transform;
  11808. /***/ }),
  11809. /***/ "../../node_modules/lodash/union.js":
  11810. /*!********************************************************************!*\
  11811. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/union.js ***!
  11812. \********************************************************************/
  11813. /*! no static exports found */
  11814. /***/ (function(module, exports, __webpack_require__) {
  11815. var baseFlatten = __webpack_require__(/*! ./_baseFlatten */ "../../node_modules/lodash/_baseFlatten.js"),
  11816. baseRest = __webpack_require__(/*! ./_baseRest */ "../../node_modules/lodash/_baseRest.js"),
  11817. baseUniq = __webpack_require__(/*! ./_baseUniq */ "../../node_modules/lodash/_baseUniq.js"),
  11818. isArrayLikeObject = __webpack_require__(/*! ./isArrayLikeObject */ "../../node_modules/lodash/isArrayLikeObject.js");
  11819. /**
  11820. * Creates an array of unique values, in order, from all given arrays using
  11821. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11822. * for equality comparisons.
  11823. *
  11824. * @static
  11825. * @memberOf _
  11826. * @since 0.1.0
  11827. * @category Array
  11828. * @param {...Array} [arrays] The arrays to inspect.
  11829. * @returns {Array} Returns the new array of combined values.
  11830. * @example
  11831. *
  11832. * _.union([2], [1, 2]);
  11833. * // => [2, 1]
  11834. */
  11835. var union = baseRest(function(arrays) {
  11836. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  11837. });
  11838. module.exports = union;
  11839. /***/ }),
  11840. /***/ "../../node_modules/lodash/uniqueId.js":
  11841. /*!***********************************************************************!*\
  11842. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/uniqueId.js ***!
  11843. \***********************************************************************/
  11844. /*! no static exports found */
  11845. /***/ (function(module, exports, __webpack_require__) {
  11846. var toString = __webpack_require__(/*! ./toString */ "../../node_modules/lodash/toString.js");
  11847. /** Used to generate unique IDs. */
  11848. var idCounter = 0;
  11849. /**
  11850. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  11851. *
  11852. * @static
  11853. * @since 0.1.0
  11854. * @memberOf _
  11855. * @category Util
  11856. * @param {string} [prefix=''] The value to prefix the ID with.
  11857. * @returns {string} Returns the unique ID.
  11858. * @example
  11859. *
  11860. * _.uniqueId('contact_');
  11861. * // => 'contact_104'
  11862. *
  11863. * _.uniqueId();
  11864. * // => '105'
  11865. */
  11866. function uniqueId(prefix) {
  11867. var id = ++idCounter;
  11868. return toString(prefix) + id;
  11869. }
  11870. module.exports = uniqueId;
  11871. /***/ }),
  11872. /***/ "../../node_modules/lodash/values.js":
  11873. /*!*********************************************************************!*\
  11874. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/values.js ***!
  11875. \*********************************************************************/
  11876. /*! no static exports found */
  11877. /***/ (function(module, exports, __webpack_require__) {
  11878. var baseValues = __webpack_require__(/*! ./_baseValues */ "../../node_modules/lodash/_baseValues.js"),
  11879. keys = __webpack_require__(/*! ./keys */ "../../node_modules/lodash/keys.js");
  11880. /**
  11881. * Creates an array of the own enumerable string keyed property values of `object`.
  11882. *
  11883. * **Note:** Non-object values are coerced to objects.
  11884. *
  11885. * @static
  11886. * @since 0.1.0
  11887. * @memberOf _
  11888. * @category Object
  11889. * @param {Object} object The object to query.
  11890. * @returns {Array} Returns the array of property values.
  11891. * @example
  11892. *
  11893. * function Foo() {
  11894. * this.a = 1;
  11895. * this.b = 2;
  11896. * }
  11897. *
  11898. * Foo.prototype.c = 3;
  11899. *
  11900. * _.values(new Foo);
  11901. * // => [1, 2] (iteration order is not guaranteed)
  11902. *
  11903. * _.values('hi');
  11904. * // => ['h', 'i']
  11905. */
  11906. function values(object) {
  11907. return object == null ? [] : baseValues(object, keys(object));
  11908. }
  11909. module.exports = values;
  11910. /***/ }),
  11911. /***/ "../../node_modules/lodash/zipObject.js":
  11912. /*!************************************************************************!*\
  11913. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/lodash/zipObject.js ***!
  11914. \************************************************************************/
  11915. /*! no static exports found */
  11916. /***/ (function(module, exports, __webpack_require__) {
  11917. var assignValue = __webpack_require__(/*! ./_assignValue */ "../../node_modules/lodash/_assignValue.js"),
  11918. baseZipObject = __webpack_require__(/*! ./_baseZipObject */ "../../node_modules/lodash/_baseZipObject.js");
  11919. /**
  11920. * This method is like `_.fromPairs` except that it accepts two arrays,
  11921. * one of property identifiers and one of corresponding values.
  11922. *
  11923. * @static
  11924. * @memberOf _
  11925. * @since 0.4.0
  11926. * @category Array
  11927. * @param {Array} [props=[]] The property identifiers.
  11928. * @param {Array} [values=[]] The property values.
  11929. * @returns {Object} Returns the new object.
  11930. * @example
  11931. *
  11932. * _.zipObject(['a', 'b'], [1, 2]);
  11933. * // => { 'a': 1, 'b': 2 }
  11934. */
  11935. function zipObject(props, values) {
  11936. return baseZipObject(props || [], values || [], assignValue);
  11937. }
  11938. module.exports = zipObject;
  11939. /***/ }),
  11940. /***/ "../../node_modules/object-assign/index.js":
  11941. /*!***************************************************************************!*\
  11942. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/object-assign/index.js ***!
  11943. \***************************************************************************/
  11944. /*! no static exports found */
  11945. /***/ (function(module, exports, __webpack_require__) {
  11946. "use strict";
  11947. /*
  11948. object-assign
  11949. (c) Sindre Sorhus
  11950. @license MIT
  11951. */
  11952. /* eslint-disable no-unused-vars */
  11953. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  11954. var hasOwnProperty = Object.prototype.hasOwnProperty;
  11955. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  11956. function toObject(val) {
  11957. if (val === null || val === undefined) {
  11958. throw new TypeError('Object.assign cannot be called with null or undefined');
  11959. }
  11960. return Object(val);
  11961. }
  11962. function shouldUseNative() {
  11963. try {
  11964. if (!Object.assign) {
  11965. return false;
  11966. }
  11967. // Detect buggy property enumeration order in older V8 versions.
  11968. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  11969. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  11970. test1[5] = 'de';
  11971. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  11972. return false;
  11973. }
  11974. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  11975. var test2 = {};
  11976. for (var i = 0; i < 10; i++) {
  11977. test2['_' + String.fromCharCode(i)] = i;
  11978. }
  11979. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  11980. return test2[n];
  11981. });
  11982. if (order2.join('') !== '0123456789') {
  11983. return false;
  11984. }
  11985. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  11986. var test3 = {};
  11987. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  11988. test3[letter] = letter;
  11989. });
  11990. if (Object.keys(Object.assign({}, test3)).join('') !==
  11991. 'abcdefghijklmnopqrst') {
  11992. return false;
  11993. }
  11994. return true;
  11995. } catch (err) {
  11996. // We don't expect any of the above to throw, but better to be safe.
  11997. return false;
  11998. }
  11999. }
  12000. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  12001. var from;
  12002. var to = toObject(target);
  12003. var symbols;
  12004. for (var s = 1; s < arguments.length; s++) {
  12005. from = Object(arguments[s]);
  12006. for (var key in from) {
  12007. if (hasOwnProperty.call(from, key)) {
  12008. to[key] = from[key];
  12009. }
  12010. }
  12011. if (getOwnPropertySymbols) {
  12012. symbols = getOwnPropertySymbols(from);
  12013. for (var i = 0; i < symbols.length; i++) {
  12014. if (propIsEnumerable.call(from, symbols[i])) {
  12015. to[symbols[i]] = from[symbols[i]];
  12016. }
  12017. }
  12018. }
  12019. }
  12020. return to;
  12021. };
  12022. /***/ }),
  12023. /***/ "../../node_modules/prop-types/checkPropTypes.js":
  12024. /*!*********************************************************************************!*\
  12025. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/prop-types/checkPropTypes.js ***!
  12026. \*********************************************************************************/
  12027. /*! no static exports found */
  12028. /***/ (function(module, exports, __webpack_require__) {
  12029. "use strict";
  12030. /**
  12031. * Copyright (c) 2013-present, Facebook, Inc.
  12032. *
  12033. * This source code is licensed under the MIT license found in the
  12034. * LICENSE file in the root directory of this source tree.
  12035. */
  12036. var printWarning = function() {};
  12037. if (true) {
  12038. var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "../../node_modules/prop-types/lib/ReactPropTypesSecret.js");
  12039. var loggedTypeFailures = {};
  12040. var has = Function.call.bind(Object.prototype.hasOwnProperty);
  12041. printWarning = function(text) {
  12042. var message = 'Warning: ' + text;
  12043. if (typeof console !== 'undefined') {
  12044. console.error(message);
  12045. }
  12046. try {
  12047. // --- Welcome to debugging React ---
  12048. // This error was thrown as a convenience so that you can use this stack
  12049. // to find the callsite that caused this warning to fire.
  12050. throw new Error(message);
  12051. } catch (x) {}
  12052. };
  12053. }
  12054. /**
  12055. * Assert that the values match with the type specs.
  12056. * Error messages are memorized and will only be shown once.
  12057. *
  12058. * @param {object} typeSpecs Map of name to a ReactPropType
  12059. * @param {object} values Runtime values that need to be type-checked
  12060. * @param {string} location e.g. "prop", "context", "child context"
  12061. * @param {string} componentName Name of the component for error messages.
  12062. * @param {?Function} getStack Returns the component stack.
  12063. * @private
  12064. */
  12065. function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  12066. if (true) {
  12067. for (var typeSpecName in typeSpecs) {
  12068. if (has(typeSpecs, typeSpecName)) {
  12069. var error;
  12070. // Prop type validation may throw. In case they do, we don't want to
  12071. // fail the render phase where it didn't fail before. So we log it.
  12072. // After these have been cleaned up, we'll let them throw.
  12073. try {
  12074. // This is intentionally an invariant that gets caught. It's the same
  12075. // behavior as without this statement except with a better message.
  12076. if (typeof typeSpecs[typeSpecName] !== 'function') {
  12077. var err = Error(
  12078. (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
  12079. 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
  12080. );
  12081. err.name = 'Invariant Violation';
  12082. throw err;
  12083. }
  12084. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
  12085. } catch (ex) {
  12086. error = ex;
  12087. }
  12088. if (error && !(error instanceof Error)) {
  12089. printWarning(
  12090. (componentName || 'React class') + ': type specification of ' +
  12091. location + ' `' + typeSpecName + '` is invalid; the type checker ' +
  12092. 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
  12093. 'You may have forgotten to pass an argument to the type checker ' +
  12094. 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
  12095. 'shape all require an argument).'
  12096. );
  12097. }
  12098. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  12099. // Only monitor this failure once because there tends to be a lot of the
  12100. // same error.
  12101. loggedTypeFailures[error.message] = true;
  12102. var stack = getStack ? getStack() : '';
  12103. printWarning(
  12104. 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
  12105. );
  12106. }
  12107. }
  12108. }
  12109. }
  12110. }
  12111. /**
  12112. * Resets warning cache when testing.
  12113. *
  12114. * @private
  12115. */
  12116. checkPropTypes.resetWarningCache = function() {
  12117. if (true) {
  12118. loggedTypeFailures = {};
  12119. }
  12120. }
  12121. module.exports = checkPropTypes;
  12122. /***/ }),
  12123. /***/ "../../node_modules/prop-types/lib/ReactPropTypesSecret.js":
  12124. /*!*******************************************************************************************!*\
  12125. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
  12126. \*******************************************************************************************/
  12127. /*! no static exports found */
  12128. /***/ (function(module, exports, __webpack_require__) {
  12129. "use strict";
  12130. /**
  12131. * Copyright (c) 2013-present, Facebook, Inc.
  12132. *
  12133. * This source code is licensed under the MIT license found in the
  12134. * LICENSE file in the root directory of this source tree.
  12135. */
  12136. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  12137. module.exports = ReactPropTypesSecret;
  12138. /***/ }),
  12139. /***/ "../../node_modules/react-dom/cjs/react-dom.development.js":
  12140. /*!*******************************************************************************************!*\
  12141. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/react-dom/cjs/react-dom.development.js ***!
  12142. \*******************************************************************************************/
  12143. /*! no static exports found */
  12144. /***/ (function(module, exports, __webpack_require__) {
  12145. "use strict";
  12146. /** @license React v16.13.1
  12147. * react-dom.development.js
  12148. *
  12149. * Copyright (c) Facebook, Inc. and its affiliates.
  12150. *
  12151. * This source code is licensed under the MIT license found in the
  12152. * LICENSE file in the root directory of this source tree.
  12153. */
  12154. if (true) {
  12155. (function() {
  12156. 'use strict';
  12157. var React = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  12158. var _assign = __webpack_require__(/*! object-assign */ "../../node_modules/object-assign/index.js");
  12159. var Scheduler = __webpack_require__(/*! scheduler */ "../../node_modules/scheduler/index.js");
  12160. var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "../../node_modules/prop-types/checkPropTypes.js");
  12161. var tracing = __webpack_require__(/*! scheduler/tracing */ "../../node_modules/scheduler/tracing.js");
  12162. var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
  12163. // Current owner and dispatcher used to share the same ref,
  12164. // but PR #14548 split them out to better support the react-debug-tools package.
  12165. if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
  12166. ReactSharedInternals.ReactCurrentDispatcher = {
  12167. current: null
  12168. };
  12169. }
  12170. if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
  12171. ReactSharedInternals.ReactCurrentBatchConfig = {
  12172. suspense: null
  12173. };
  12174. }
  12175. // by calls to these methods by a Babel plugin.
  12176. //
  12177. // In PROD (or in packages without access to React internals),
  12178. // they are left as they are instead.
  12179. function warn(format) {
  12180. {
  12181. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12182. args[_key - 1] = arguments[_key];
  12183. }
  12184. printWarning('warn', format, args);
  12185. }
  12186. }
  12187. function error(format) {
  12188. {
  12189. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  12190. args[_key2 - 1] = arguments[_key2];
  12191. }
  12192. printWarning('error', format, args);
  12193. }
  12194. }
  12195. function printWarning(level, format, args) {
  12196. // When changing this logic, you might want to also
  12197. // update consoleWithStackDev.www.js as well.
  12198. {
  12199. var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
  12200. if (!hasExistingStack) {
  12201. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  12202. var stack = ReactDebugCurrentFrame.getStackAddendum();
  12203. if (stack !== '') {
  12204. format += '%s';
  12205. args = args.concat([stack]);
  12206. }
  12207. }
  12208. var argsWithFormat = args.map(function (item) {
  12209. return '' + item;
  12210. }); // Careful: RN currently depends on this prefix
  12211. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  12212. // breaks IE9: https://github.com/facebook/react/issues/13610
  12213. // eslint-disable-next-line react-internal/no-production-logging
  12214. Function.prototype.apply.call(console[level], console, argsWithFormat);
  12215. try {
  12216. // --- Welcome to debugging React ---
  12217. // This error was thrown as a convenience so that you can use this stack
  12218. // to find the callsite that caused this warning to fire.
  12219. var argIndex = 0;
  12220. var message = 'Warning: ' + format.replace(/%s/g, function () {
  12221. return args[argIndex++];
  12222. });
  12223. throw new Error(message);
  12224. } catch (x) {}
  12225. }
  12226. }
  12227. if (!React) {
  12228. {
  12229. throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." );
  12230. }
  12231. }
  12232. var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
  12233. var funcArgs = Array.prototype.slice.call(arguments, 3);
  12234. try {
  12235. func.apply(context, funcArgs);
  12236. } catch (error) {
  12237. this.onError(error);
  12238. }
  12239. };
  12240. {
  12241. // In DEV mode, we swap out invokeGuardedCallback for a special version
  12242. // that plays more nicely with the browser's DevTools. The idea is to preserve
  12243. // "Pause on exceptions" behavior. Because React wraps all user-provided
  12244. // functions in invokeGuardedCallback, and the production version of
  12245. // invokeGuardedCallback uses a try-catch, all user exceptions are treated
  12246. // like caught exceptions, and the DevTools won't pause unless the developer
  12247. // takes the extra step of enabling pause on caught exceptions. This is
  12248. // unintuitive, though, because even though React has caught the error, from
  12249. // the developer's perspective, the error is uncaught.
  12250. //
  12251. // To preserve the expected "Pause on exceptions" behavior, we don't use a
  12252. // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
  12253. // DOM node, and call the user-provided callback from inside an event handler
  12254. // for that fake event. If the callback throws, the error is "captured" using
  12255. // a global event handler. But because the error happens in a different
  12256. // event loop context, it does not interrupt the normal program flow.
  12257. // Effectively, this gives us try-catch behavior without actually using
  12258. // try-catch. Neat!
  12259. // Check that the browser supports the APIs we need to implement our special
  12260. // DEV version of invokeGuardedCallback
  12261. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  12262. var fakeNode = document.createElement('react');
  12263. var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
  12264. // If document doesn't exist we know for sure we will crash in this method
  12265. // when we call document.createEvent(). However this can cause confusing
  12266. // errors: https://github.com/facebookincubator/create-react-app/issues/3482
  12267. // So we preemptively throw with a better message instead.
  12268. if (!(typeof document !== 'undefined')) {
  12269. {
  12270. throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." );
  12271. }
  12272. }
  12273. var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
  12274. // set this to true at the beginning, then set it to false right after
  12275. // calling the function. If the function errors, `didError` will never be
  12276. // set to false. This strategy works even if the browser is flaky and
  12277. // fails to call our global error handler, because it doesn't rely on
  12278. // the error event at all.
  12279. var didError = true; // Keeps track of the value of window.event so that we can reset it
  12280. // during the callback to let user code access window.event in the
  12281. // browsers that support it.
  12282. var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event
  12283. // dispatching: https://github.com/facebook/react/issues/13688
  12284. var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously
  12285. // dispatch our fake event using `dispatchEvent`. Inside the handler, we
  12286. // call the user-provided callback.
  12287. var funcArgs = Array.prototype.slice.call(arguments, 3);
  12288. function callCallback() {
  12289. // We immediately remove the callback from event listeners so that
  12290. // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
  12291. // nested call would trigger the fake event handlers of any call higher
  12292. // in the stack.
  12293. fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the
  12294. // window.event assignment in both IE <= 10 as they throw an error
  12295. // "Member not found" in strict mode, and in Firefox which does not
  12296. // support window.event.
  12297. if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
  12298. window.event = windowEvent;
  12299. }
  12300. func.apply(context, funcArgs);
  12301. didError = false;
  12302. } // Create a global error event handler. We use this to capture the value
  12303. // that was thrown. It's possible that this error handler will fire more
  12304. // than once; for example, if non-React code also calls `dispatchEvent`
  12305. // and a handler for that event throws. We should be resilient to most of
  12306. // those cases. Even if our error event handler fires more than once, the
  12307. // last error event is always used. If the callback actually does error,
  12308. // we know that the last error event is the correct one, because it's not
  12309. // possible for anything else to have happened in between our callback
  12310. // erroring and the code that follows the `dispatchEvent` call below. If
  12311. // the callback doesn't error, but the error event was fired, we know to
  12312. // ignore it because `didError` will be false, as described above.
  12313. var error; // Use this to track whether the error event is ever called.
  12314. var didSetError = false;
  12315. var isCrossOriginError = false;
  12316. function handleWindowError(event) {
  12317. error = event.error;
  12318. didSetError = true;
  12319. if (error === null && event.colno === 0 && event.lineno === 0) {
  12320. isCrossOriginError = true;
  12321. }
  12322. if (event.defaultPrevented) {
  12323. // Some other error handler has prevented default.
  12324. // Browsers silence the error report if this happens.
  12325. // We'll remember this to later decide whether to log it or not.
  12326. if (error != null && typeof error === 'object') {
  12327. try {
  12328. error._suppressLogging = true;
  12329. } catch (inner) {// Ignore.
  12330. }
  12331. }
  12332. }
  12333. } // Create a fake event type.
  12334. var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers
  12335. window.addEventListener('error', handleWindowError);
  12336. fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function
  12337. // errors, it will trigger our global error handler.
  12338. evt.initEvent(evtType, false, false);
  12339. fakeNode.dispatchEvent(evt);
  12340. if (windowEventDescriptor) {
  12341. Object.defineProperty(window, 'event', windowEventDescriptor);
  12342. }
  12343. if (didError) {
  12344. if (!didSetError) {
  12345. // The callback errored, but the error event never fired.
  12346. error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
  12347. } else if (isCrossOriginError) {
  12348. error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
  12349. }
  12350. this.onError(error);
  12351. } // Remove our event listeners
  12352. window.removeEventListener('error', handleWindowError);
  12353. };
  12354. invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
  12355. }
  12356. }
  12357. var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
  12358. var hasError = false;
  12359. var caughtError = null; // Used by event system to capture/rethrow the first error.
  12360. var hasRethrowError = false;
  12361. var rethrowError = null;
  12362. var reporter = {
  12363. onError: function (error) {
  12364. hasError = true;
  12365. caughtError = error;
  12366. }
  12367. };
  12368. /**
  12369. * Call a function while guarding against errors that happens within it.
  12370. * Returns an error if it throws, otherwise null.
  12371. *
  12372. * In production, this is implemented using a try-catch. The reason we don't
  12373. * use a try-catch directly is so that we can swap out a different
  12374. * implementation in DEV mode.
  12375. *
  12376. * @param {String} name of the guard to use for logging or debugging
  12377. * @param {Function} func The function to invoke
  12378. * @param {*} context The context to use when calling the function
  12379. * @param {...*} args Arguments for function
  12380. */
  12381. function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
  12382. hasError = false;
  12383. caughtError = null;
  12384. invokeGuardedCallbackImpl$1.apply(reporter, arguments);
  12385. }
  12386. /**
  12387. * Same as invokeGuardedCallback, but instead of returning an error, it stores
  12388. * it in a global so it can be rethrown by `rethrowCaughtError` later.
  12389. * TODO: See if caughtError and rethrowError can be unified.
  12390. *
  12391. * @param {String} name of the guard to use for logging or debugging
  12392. * @param {Function} func The function to invoke
  12393. * @param {*} context The context to use when calling the function
  12394. * @param {...*} args Arguments for function
  12395. */
  12396. function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
  12397. invokeGuardedCallback.apply(this, arguments);
  12398. if (hasError) {
  12399. var error = clearCaughtError();
  12400. if (!hasRethrowError) {
  12401. hasRethrowError = true;
  12402. rethrowError = error;
  12403. }
  12404. }
  12405. }
  12406. /**
  12407. * During execution of guarded functions we will capture the first error which
  12408. * we will rethrow to be handled by the top level error handler.
  12409. */
  12410. function rethrowCaughtError() {
  12411. if (hasRethrowError) {
  12412. var error = rethrowError;
  12413. hasRethrowError = false;
  12414. rethrowError = null;
  12415. throw error;
  12416. }
  12417. }
  12418. function hasCaughtError() {
  12419. return hasError;
  12420. }
  12421. function clearCaughtError() {
  12422. if (hasError) {
  12423. var error = caughtError;
  12424. hasError = false;
  12425. caughtError = null;
  12426. return error;
  12427. } else {
  12428. {
  12429. {
  12430. throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." );
  12431. }
  12432. }
  12433. }
  12434. }
  12435. var getFiberCurrentPropsFromNode = null;
  12436. var getInstanceFromNode = null;
  12437. var getNodeFromInstance = null;
  12438. function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
  12439. getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
  12440. getInstanceFromNode = getInstanceFromNodeImpl;
  12441. getNodeFromInstance = getNodeFromInstanceImpl;
  12442. {
  12443. if (!getNodeFromInstance || !getInstanceFromNode) {
  12444. error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
  12445. }
  12446. }
  12447. }
  12448. var validateEventDispatches;
  12449. {
  12450. validateEventDispatches = function (event) {
  12451. var dispatchListeners = event._dispatchListeners;
  12452. var dispatchInstances = event._dispatchInstances;
  12453. var listenersIsArr = Array.isArray(dispatchListeners);
  12454. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  12455. var instancesIsArr = Array.isArray(dispatchInstances);
  12456. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  12457. if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
  12458. error('EventPluginUtils: Invalid `event`.');
  12459. }
  12460. };
  12461. }
  12462. /**
  12463. * Dispatch the event to the listener.
  12464. * @param {SyntheticEvent} event SyntheticEvent to handle
  12465. * @param {function} listener Application-level callback
  12466. * @param {*} inst Internal component instance
  12467. */
  12468. function executeDispatch(event, listener, inst) {
  12469. var type = event.type || 'unknown-event';
  12470. event.currentTarget = getNodeFromInstance(inst);
  12471. invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
  12472. event.currentTarget = null;
  12473. }
  12474. /**
  12475. * Standard/simple iteration through an event's collected dispatches.
  12476. */
  12477. function executeDispatchesInOrder(event) {
  12478. var dispatchListeners = event._dispatchListeners;
  12479. var dispatchInstances = event._dispatchInstances;
  12480. {
  12481. validateEventDispatches(event);
  12482. }
  12483. if (Array.isArray(dispatchListeners)) {
  12484. for (var i = 0; i < dispatchListeners.length; i++) {
  12485. if (event.isPropagationStopped()) {
  12486. break;
  12487. } // Listeners and Instances are two parallel arrays that are always in sync.
  12488. executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
  12489. }
  12490. } else if (dispatchListeners) {
  12491. executeDispatch(event, dispatchListeners, dispatchInstances);
  12492. }
  12493. event._dispatchListeners = null;
  12494. event._dispatchInstances = null;
  12495. }
  12496. var FunctionComponent = 0;
  12497. var ClassComponent = 1;
  12498. var IndeterminateComponent = 2; // Before we know whether it is function or class
  12499. var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
  12500. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
  12501. var HostComponent = 5;
  12502. var HostText = 6;
  12503. var Fragment = 7;
  12504. var Mode = 8;
  12505. var ContextConsumer = 9;
  12506. var ContextProvider = 10;
  12507. var ForwardRef = 11;
  12508. var Profiler = 12;
  12509. var SuspenseComponent = 13;
  12510. var MemoComponent = 14;
  12511. var SimpleMemoComponent = 15;
  12512. var LazyComponent = 16;
  12513. var IncompleteClassComponent = 17;
  12514. var DehydratedFragment = 18;
  12515. var SuspenseListComponent = 19;
  12516. var FundamentalComponent = 20;
  12517. var ScopeComponent = 21;
  12518. var Block = 22;
  12519. /**
  12520. * Injectable ordering of event plugins.
  12521. */
  12522. var eventPluginOrder = null;
  12523. /**
  12524. * Injectable mapping from names to event plugin modules.
  12525. */
  12526. var namesToPlugins = {};
  12527. /**
  12528. * Recomputes the plugin list using the injected plugins and plugin ordering.
  12529. *
  12530. * @private
  12531. */
  12532. function recomputePluginOrdering() {
  12533. if (!eventPluginOrder) {
  12534. // Wait until an `eventPluginOrder` is injected.
  12535. return;
  12536. }
  12537. for (var pluginName in namesToPlugins) {
  12538. var pluginModule = namesToPlugins[pluginName];
  12539. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  12540. if (!(pluginIndex > -1)) {
  12541. {
  12542. throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." );
  12543. }
  12544. }
  12545. if (plugins[pluginIndex]) {
  12546. continue;
  12547. }
  12548. if (!pluginModule.extractEvents) {
  12549. {
  12550. throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." );
  12551. }
  12552. }
  12553. plugins[pluginIndex] = pluginModule;
  12554. var publishedEvents = pluginModule.eventTypes;
  12555. for (var eventName in publishedEvents) {
  12556. if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
  12557. {
  12558. throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." );
  12559. }
  12560. }
  12561. }
  12562. }
  12563. }
  12564. /**
  12565. * Publishes an event so that it can be dispatched by the supplied plugin.
  12566. *
  12567. * @param {object} dispatchConfig Dispatch configuration for the event.
  12568. * @param {object} PluginModule Plugin publishing the event.
  12569. * @return {boolean} True if the event was successfully published.
  12570. * @private
  12571. */
  12572. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  12573. if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  12574. {
  12575. throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." );
  12576. }
  12577. }
  12578. eventNameDispatchConfigs[eventName] = dispatchConfig;
  12579. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12580. if (phasedRegistrationNames) {
  12581. for (var phaseName in phasedRegistrationNames) {
  12582. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  12583. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  12584. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  12585. }
  12586. }
  12587. return true;
  12588. } else if (dispatchConfig.registrationName) {
  12589. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  12590. return true;
  12591. }
  12592. return false;
  12593. }
  12594. /**
  12595. * Publishes a registration name that is used to identify dispatched events.
  12596. *
  12597. * @param {string} registrationName Registration name to add.
  12598. * @param {object} PluginModule Plugin publishing the event.
  12599. * @private
  12600. */
  12601. function publishRegistrationName(registrationName, pluginModule, eventName) {
  12602. if (!!registrationNameModules[registrationName]) {
  12603. {
  12604. throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." );
  12605. }
  12606. }
  12607. registrationNameModules[registrationName] = pluginModule;
  12608. registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  12609. {
  12610. var lowerCasedName = registrationName.toLowerCase();
  12611. possibleRegistrationNames[lowerCasedName] = registrationName;
  12612. if (registrationName === 'onDoubleClick') {
  12613. possibleRegistrationNames.ondblclick = registrationName;
  12614. }
  12615. }
  12616. }
  12617. /**
  12618. * Registers plugins so that they can extract and dispatch events.
  12619. */
  12620. /**
  12621. * Ordered list of injected plugins.
  12622. */
  12623. var plugins = [];
  12624. /**
  12625. * Mapping from event name to dispatch config
  12626. */
  12627. var eventNameDispatchConfigs = {};
  12628. /**
  12629. * Mapping from registration name to plugin module
  12630. */
  12631. var registrationNameModules = {};
  12632. /**
  12633. * Mapping from registration name to event name
  12634. */
  12635. var registrationNameDependencies = {};
  12636. /**
  12637. * Mapping from lowercase registration names to the properly cased version,
  12638. * used to warn in the case of missing event handlers. Available
  12639. * only in true.
  12640. * @type {Object}
  12641. */
  12642. var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true
  12643. /**
  12644. * Injects an ordering of plugins (by plugin name). This allows the ordering
  12645. * to be decoupled from injection of the actual plugins so that ordering is
  12646. * always deterministic regardless of packaging, on-the-fly injection, etc.
  12647. *
  12648. * @param {array} InjectedEventPluginOrder
  12649. * @internal
  12650. */
  12651. function injectEventPluginOrder(injectedEventPluginOrder) {
  12652. if (!!eventPluginOrder) {
  12653. {
  12654. throw Error( "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." );
  12655. }
  12656. } // Clone the ordering so it cannot be dynamically mutated.
  12657. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  12658. recomputePluginOrdering();
  12659. }
  12660. /**
  12661. * Injects plugins to be used by plugin event system. The plugin names must be
  12662. * in the ordering injected by `injectEventPluginOrder`.
  12663. *
  12664. * Plugins can be injected as part of page initialization or on-the-fly.
  12665. *
  12666. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  12667. * @internal
  12668. */
  12669. function injectEventPluginsByName(injectedNamesToPlugins) {
  12670. var isOrderingDirty = false;
  12671. for (var pluginName in injectedNamesToPlugins) {
  12672. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  12673. continue;
  12674. }
  12675. var pluginModule = injectedNamesToPlugins[pluginName];
  12676. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  12677. if (!!namesToPlugins[pluginName]) {
  12678. {
  12679. throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." );
  12680. }
  12681. }
  12682. namesToPlugins[pluginName] = pluginModule;
  12683. isOrderingDirty = true;
  12684. }
  12685. }
  12686. if (isOrderingDirty) {
  12687. recomputePluginOrdering();
  12688. }
  12689. }
  12690. var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
  12691. var PLUGIN_EVENT_SYSTEM = 1;
  12692. var IS_REPLAYED = 1 << 5;
  12693. var IS_FIRST_ANCESTOR = 1 << 6;
  12694. var restoreImpl = null;
  12695. var restoreTarget = null;
  12696. var restoreQueue = null;
  12697. function restoreStateOfTarget(target) {
  12698. // We perform this translation at the end of the event loop so that we
  12699. // always receive the correct fiber here
  12700. var internalInstance = getInstanceFromNode(target);
  12701. if (!internalInstance) {
  12702. // Unmounted
  12703. return;
  12704. }
  12705. if (!(typeof restoreImpl === 'function')) {
  12706. {
  12707. throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." );
  12708. }
  12709. }
  12710. var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted.
  12711. if (stateNode) {
  12712. var _props = getFiberCurrentPropsFromNode(stateNode);
  12713. restoreImpl(internalInstance.stateNode, internalInstance.type, _props);
  12714. }
  12715. }
  12716. function setRestoreImplementation(impl) {
  12717. restoreImpl = impl;
  12718. }
  12719. function enqueueStateRestore(target) {
  12720. if (restoreTarget) {
  12721. if (restoreQueue) {
  12722. restoreQueue.push(target);
  12723. } else {
  12724. restoreQueue = [target];
  12725. }
  12726. } else {
  12727. restoreTarget = target;
  12728. }
  12729. }
  12730. function needsStateRestore() {
  12731. return restoreTarget !== null || restoreQueue !== null;
  12732. }
  12733. function restoreStateIfNeeded() {
  12734. if (!restoreTarget) {
  12735. return;
  12736. }
  12737. var target = restoreTarget;
  12738. var queuedTargets = restoreQueue;
  12739. restoreTarget = null;
  12740. restoreQueue = null;
  12741. restoreStateOfTarget(target);
  12742. if (queuedTargets) {
  12743. for (var i = 0; i < queuedTargets.length; i++) {
  12744. restoreStateOfTarget(queuedTargets[i]);
  12745. }
  12746. }
  12747. }
  12748. var enableProfilerTimer = true; // Trace which interactions trigger each commit.
  12749. var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
  12750. var enableFundamentalAPI = false; // Experimental Scope support.
  12751. var warnAboutStringRefs = false;
  12752. // the renderer. Such as when we're dispatching events or if third party
  12753. // libraries need to call batchedUpdates. Eventually, this API will go away when
  12754. // everything is batched by default. We'll then have a similar API to opt-out of
  12755. // scheduled work and instead do synchronous work.
  12756. // Defaults
  12757. var batchedUpdatesImpl = function (fn, bookkeeping) {
  12758. return fn(bookkeeping);
  12759. };
  12760. var discreteUpdatesImpl = function (fn, a, b, c, d) {
  12761. return fn(a, b, c, d);
  12762. };
  12763. var flushDiscreteUpdatesImpl = function () {};
  12764. var batchedEventUpdatesImpl = batchedUpdatesImpl;
  12765. var isInsideEventHandler = false;
  12766. var isBatchingEventUpdates = false;
  12767. function finishEventHandler() {
  12768. // Here we wait until all updates have propagated, which is important
  12769. // when using controlled components within layers:
  12770. // https://github.com/facebook/react/issues/1698
  12771. // Then we restore state of any controlled component.
  12772. var controlledComponentsHavePendingUpdates = needsStateRestore();
  12773. if (controlledComponentsHavePendingUpdates) {
  12774. // If a controlled event was fired, we may need to restore the state of
  12775. // the DOM node back to the controlled value. This is necessary when React
  12776. // bails out of the update without touching the DOM.
  12777. flushDiscreteUpdatesImpl();
  12778. restoreStateIfNeeded();
  12779. }
  12780. }
  12781. function batchedUpdates(fn, bookkeeping) {
  12782. if (isInsideEventHandler) {
  12783. // If we are currently inside another batch, we need to wait until it
  12784. // fully completes before restoring state.
  12785. return fn(bookkeeping);
  12786. }
  12787. isInsideEventHandler = true;
  12788. try {
  12789. return batchedUpdatesImpl(fn, bookkeeping);
  12790. } finally {
  12791. isInsideEventHandler = false;
  12792. finishEventHandler();
  12793. }
  12794. }
  12795. function batchedEventUpdates(fn, a, b) {
  12796. if (isBatchingEventUpdates) {
  12797. // If we are currently inside another batch, we need to wait until it
  12798. // fully completes before restoring state.
  12799. return fn(a, b);
  12800. }
  12801. isBatchingEventUpdates = true;
  12802. try {
  12803. return batchedEventUpdatesImpl(fn, a, b);
  12804. } finally {
  12805. isBatchingEventUpdates = false;
  12806. finishEventHandler();
  12807. }
  12808. } // This is for the React Flare event system
  12809. function discreteUpdates(fn, a, b, c, d) {
  12810. var prevIsInsideEventHandler = isInsideEventHandler;
  12811. isInsideEventHandler = true;
  12812. try {
  12813. return discreteUpdatesImpl(fn, a, b, c, d);
  12814. } finally {
  12815. isInsideEventHandler = prevIsInsideEventHandler;
  12816. if (!isInsideEventHandler) {
  12817. finishEventHandler();
  12818. }
  12819. }
  12820. }
  12821. function flushDiscreteUpdatesIfNeeded(timeStamp) {
  12822. // event.timeStamp isn't overly reliable due to inconsistencies in
  12823. // how different browsers have historically provided the time stamp.
  12824. // Some browsers provide high-resolution time stamps for all events,
  12825. // some provide low-resolution time stamps for all events. FF < 52
  12826. // even mixes both time stamps together. Some browsers even report
  12827. // negative time stamps or time stamps that are 0 (iOS9) in some cases.
  12828. // Given we are only comparing two time stamps with equality (!==),
  12829. // we are safe from the resolution differences. If the time stamp is 0
  12830. // we bail-out of preventing the flush, which can affect semantics,
  12831. // such as if an earlier flush removes or adds event listeners that
  12832. // are fired in the subsequent flush. However, this is the same
  12833. // behaviour as we had before this change, so the risks are low.
  12834. if (!isInsideEventHandler && (!enableDeprecatedFlareAPI )) {
  12835. flushDiscreteUpdatesImpl();
  12836. }
  12837. }
  12838. function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
  12839. batchedUpdatesImpl = _batchedUpdatesImpl;
  12840. discreteUpdatesImpl = _discreteUpdatesImpl;
  12841. flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
  12842. batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
  12843. }
  12844. var DiscreteEvent = 0;
  12845. var UserBlockingEvent = 1;
  12846. var ContinuousEvent = 2;
  12847. // A reserved attribute.
  12848. // It is handled by React separately and shouldn't be written to the DOM.
  12849. var RESERVED = 0; // A simple string attribute.
  12850. // Attributes that aren't in the whitelist are presumed to have this type.
  12851. var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
  12852. // "enumerated" attributes with "true" and "false" as possible values.
  12853. // When true, it should be set to a "true" string.
  12854. // When false, it should be set to a "false" string.
  12855. var BOOLEANISH_STRING = 2; // A real boolean attribute.
  12856. // When true, it should be present (set either to an empty string or its name).
  12857. // When false, it should be omitted.
  12858. var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
  12859. // When true, it should be present (set either to an empty string or its name).
  12860. // When false, it should be omitted.
  12861. // For any other value, should be present with that value.
  12862. var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
  12863. // When falsy, it should be removed.
  12864. var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
  12865. // When falsy, it should be removed.
  12866. var POSITIVE_NUMERIC = 6;
  12867. /* eslint-disable max-len */
  12868. var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
  12869. /* eslint-enable max-len */
  12870. var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
  12871. var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
  12872. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
  12873. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12874. var illegalAttributeNameCache = {};
  12875. var validatedAttributeNameCache = {};
  12876. function isAttributeNameSafe(attributeName) {
  12877. if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
  12878. return true;
  12879. }
  12880. if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
  12881. return false;
  12882. }
  12883. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  12884. validatedAttributeNameCache[attributeName] = true;
  12885. return true;
  12886. }
  12887. illegalAttributeNameCache[attributeName] = true;
  12888. {
  12889. error('Invalid attribute name: `%s`', attributeName);
  12890. }
  12891. return false;
  12892. }
  12893. function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
  12894. if (propertyInfo !== null) {
  12895. return propertyInfo.type === RESERVED;
  12896. }
  12897. if (isCustomComponentTag) {
  12898. return false;
  12899. }
  12900. if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
  12901. return true;
  12902. }
  12903. return false;
  12904. }
  12905. function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
  12906. if (propertyInfo !== null && propertyInfo.type === RESERVED) {
  12907. return false;
  12908. }
  12909. switch (typeof value) {
  12910. case 'function': // $FlowIssue symbol is perfectly valid here
  12911. case 'symbol':
  12912. // eslint-disable-line
  12913. return true;
  12914. case 'boolean':
  12915. {
  12916. if (isCustomComponentTag) {
  12917. return false;
  12918. }
  12919. if (propertyInfo !== null) {
  12920. return !propertyInfo.acceptsBooleans;
  12921. } else {
  12922. var prefix = name.toLowerCase().slice(0, 5);
  12923. return prefix !== 'data-' && prefix !== 'aria-';
  12924. }
  12925. }
  12926. default:
  12927. return false;
  12928. }
  12929. }
  12930. function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
  12931. if (value === null || typeof value === 'undefined') {
  12932. return true;
  12933. }
  12934. if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
  12935. return true;
  12936. }
  12937. if (isCustomComponentTag) {
  12938. return false;
  12939. }
  12940. if (propertyInfo !== null) {
  12941. switch (propertyInfo.type) {
  12942. case BOOLEAN:
  12943. return !value;
  12944. case OVERLOADED_BOOLEAN:
  12945. return value === false;
  12946. case NUMERIC:
  12947. return isNaN(value);
  12948. case POSITIVE_NUMERIC:
  12949. return isNaN(value) || value < 1;
  12950. }
  12951. }
  12952. return false;
  12953. }
  12954. function getPropertyInfo(name) {
  12955. return properties.hasOwnProperty(name) ? properties[name] : null;
  12956. }
  12957. function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
  12958. this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
  12959. this.attributeName = attributeName;
  12960. this.attributeNamespace = attributeNamespace;
  12961. this.mustUseProperty = mustUseProperty;
  12962. this.propertyName = name;
  12963. this.type = type;
  12964. this.sanitizeURL = sanitizeURL;
  12965. } // When adding attributes to this list, be sure to also add them to
  12966. // the `possibleStandardNames` module to ensure casing and incorrect
  12967. // name warnings.
  12968. var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
  12969. var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
  12970. // elements (not just inputs). Now that ReactDOMInput assigns to the
  12971. // defaultValue property -- do we need this?
  12972. 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
  12973. reservedProps.forEach(function (name) {
  12974. properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
  12975. name, // attributeName
  12976. null, // attributeNamespace
  12977. false);
  12978. }); // A few React string attributes have a different name.
  12979. // This is a mapping from React prop names to the attribute names.
  12980. [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
  12981. var name = _ref[0],
  12982. attributeName = _ref[1];
  12983. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  12984. attributeName, // attributeName
  12985. null, // attributeNamespace
  12986. false);
  12987. }); // These are "enumerated" HTML attributes that accept "true" and "false".
  12988. // In React, we let users pass `true` and `false` even though technically
  12989. // these aren't boolean attributes (they are coerced to strings).
  12990. ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
  12991. properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  12992. name.toLowerCase(), // attributeName
  12993. null, // attributeNamespace
  12994. false);
  12995. }); // These are "enumerated" SVG attributes that accept "true" and "false".
  12996. // In React, we let users pass `true` and `false` even though technically
  12997. // these aren't boolean attributes (they are coerced to strings).
  12998. // Since these are SVG attributes, their attribute names are case-sensitive.
  12999. ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
  13000. properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  13001. name, // attributeName
  13002. null, // attributeNamespace
  13003. false);
  13004. }); // These are HTML boolean attributes.
  13005. ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
  13006. // on the client side because the browsers are inconsistent. Instead we call focus().
  13007. 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
  13008. 'itemScope'].forEach(function (name) {
  13009. properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
  13010. name.toLowerCase(), // attributeName
  13011. null, // attributeNamespace
  13012. false);
  13013. }); // These are the few React props that we set as DOM properties
  13014. // rather than attributes. These are all booleans.
  13015. ['checked', // Note: `option.selected` is not updated if `select.multiple` is
  13016. // disabled with `removeAttribute`. We have special logic for handling this.
  13017. 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
  13018. // you'll need to set attributeName to name.toLowerCase()
  13019. // instead in the assignment below.
  13020. ].forEach(function (name) {
  13021. properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
  13022. name, // attributeName
  13023. null, // attributeNamespace
  13024. false);
  13025. }); // These are HTML attributes that are "overloaded booleans": they behave like
  13026. // booleans, but can also accept a string value.
  13027. ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
  13028. // you'll need to set attributeName to name.toLowerCase()
  13029. // instead in the assignment below.
  13030. ].forEach(function (name) {
  13031. properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
  13032. name, // attributeName
  13033. null, // attributeNamespace
  13034. false);
  13035. }); // These are HTML attributes that must be positive numbers.
  13036. ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
  13037. // you'll need to set attributeName to name.toLowerCase()
  13038. // instead in the assignment below.
  13039. ].forEach(function (name) {
  13040. properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
  13041. name, // attributeName
  13042. null, // attributeNamespace
  13043. false);
  13044. }); // These are HTML attributes that must be numbers.
  13045. ['rowSpan', 'start'].forEach(function (name) {
  13046. properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
  13047. name.toLowerCase(), // attributeName
  13048. null, // attributeNamespace
  13049. false);
  13050. });
  13051. var CAMELIZE = /[\-\:]([a-z])/g;
  13052. var capitalize = function (token) {
  13053. return token[1].toUpperCase();
  13054. }; // This is a list of all SVG attributes that need special casing, namespacing,
  13055. // or boolean value assignment. Regular attributes that just accept strings
  13056. // and have the same names are omitted, just like in the HTML whitelist.
  13057. // Some of these attributes can be hard to find. This list was created by
  13058. // scraping the MDN documentation.
  13059. ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
  13060. // you'll need to set attributeName to name.toLowerCase()
  13061. // instead in the assignment below.
  13062. ].forEach(function (attributeName) {
  13063. var name = attributeName.replace(CAMELIZE, capitalize);
  13064. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  13065. attributeName, null, // attributeNamespace
  13066. false);
  13067. }); // String SVG attributes with the xlink namespace.
  13068. ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
  13069. // you'll need to set attributeName to name.toLowerCase()
  13070. // instead in the assignment below.
  13071. ].forEach(function (attributeName) {
  13072. var name = attributeName.replace(CAMELIZE, capitalize);
  13073. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  13074. attributeName, 'http://www.w3.org/1999/xlink', false);
  13075. }); // String SVG attributes with the xml namespace.
  13076. ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
  13077. // you'll need to set attributeName to name.toLowerCase()
  13078. // instead in the assignment below.
  13079. ].forEach(function (attributeName) {
  13080. var name = attributeName.replace(CAMELIZE, capitalize);
  13081. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  13082. attributeName, 'http://www.w3.org/XML/1998/namespace', false);
  13083. }); // These attribute exists both in HTML and SVG.
  13084. // The attribute name is case-sensitive in SVG so we can't just use
  13085. // the React name like we do for attributes that exist only in HTML.
  13086. ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
  13087. properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
  13088. attributeName.toLowerCase(), // attributeName
  13089. null, // attributeNamespace
  13090. false);
  13091. }); // These attributes accept URLs. These must not allow javascript: URLS.
  13092. // These will also need to accept Trusted Types object in the future.
  13093. var xlinkHref = 'xlinkHref';
  13094. properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
  13095. 'xlink:href', 'http://www.w3.org/1999/xlink', true);
  13096. ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
  13097. properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
  13098. attributeName.toLowerCase(), // attributeName
  13099. null, // attributeNamespace
  13100. true);
  13101. });
  13102. var ReactDebugCurrentFrame = null;
  13103. {
  13104. ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  13105. } // A javascript: URL can contain leading C0 control or \u0020 SPACE,
  13106. // and any newline or tab are filtered out as if they're not part of the URL.
  13107. // https://url.spec.whatwg.org/#url-parsing
  13108. // Tab or newline are defined as \r\n\t:
  13109. // https://infra.spec.whatwg.org/#ascii-tab-or-newline
  13110. // A C0 control is a code point in the range \u0000 NULL to \u001F
  13111. // INFORMATION SEPARATOR ONE, inclusive:
  13112. // https://infra.spec.whatwg.org/#c0-control-or-space
  13113. /* eslint-disable max-len */
  13114. var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
  13115. var didWarn = false;
  13116. function sanitizeURL(url) {
  13117. {
  13118. if (!didWarn && isJavaScriptProtocol.test(url)) {
  13119. didWarn = true;
  13120. error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
  13121. }
  13122. }
  13123. }
  13124. /**
  13125. * Get the value for a property on a node. Only used in DEV for SSR validation.
  13126. * The "expected" argument is used as a hint of what the expected value is.
  13127. * Some properties have multiple equivalent values.
  13128. */
  13129. function getValueForProperty(node, name, expected, propertyInfo) {
  13130. {
  13131. if (propertyInfo.mustUseProperty) {
  13132. var propertyName = propertyInfo.propertyName;
  13133. return node[propertyName];
  13134. } else {
  13135. if ( propertyInfo.sanitizeURL) {
  13136. // If we haven't fully disabled javascript: URLs, and if
  13137. // the hydration is successful of a javascript: URL, we
  13138. // still want to warn on the client.
  13139. sanitizeURL('' + expected);
  13140. }
  13141. var attributeName = propertyInfo.attributeName;
  13142. var stringValue = null;
  13143. if (propertyInfo.type === OVERLOADED_BOOLEAN) {
  13144. if (node.hasAttribute(attributeName)) {
  13145. var value = node.getAttribute(attributeName);
  13146. if (value === '') {
  13147. return true;
  13148. }
  13149. if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
  13150. return value;
  13151. }
  13152. if (value === '' + expected) {
  13153. return expected;
  13154. }
  13155. return value;
  13156. }
  13157. } else if (node.hasAttribute(attributeName)) {
  13158. if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
  13159. // We had an attribute but shouldn't have had one, so read it
  13160. // for the error message.
  13161. return node.getAttribute(attributeName);
  13162. }
  13163. if (propertyInfo.type === BOOLEAN) {
  13164. // If this was a boolean, it doesn't matter what the value is
  13165. // the fact that we have it is the same as the expected.
  13166. return expected;
  13167. } // Even if this property uses a namespace we use getAttribute
  13168. // because we assume its namespaced name is the same as our config.
  13169. // To use getAttributeNS we need the local name which we don't have
  13170. // in our config atm.
  13171. stringValue = node.getAttribute(attributeName);
  13172. }
  13173. if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
  13174. return stringValue === null ? expected : stringValue;
  13175. } else if (stringValue === '' + expected) {
  13176. return expected;
  13177. } else {
  13178. return stringValue;
  13179. }
  13180. }
  13181. }
  13182. }
  13183. /**
  13184. * Get the value for a attribute on a node. Only used in DEV for SSR validation.
  13185. * The third argument is used as a hint of what the expected value is. Some
  13186. * attributes have multiple equivalent values.
  13187. */
  13188. function getValueForAttribute(node, name, expected) {
  13189. {
  13190. if (!isAttributeNameSafe(name)) {
  13191. return;
  13192. }
  13193. if (!node.hasAttribute(name)) {
  13194. return expected === undefined ? undefined : null;
  13195. }
  13196. var value = node.getAttribute(name);
  13197. if (value === '' + expected) {
  13198. return expected;
  13199. }
  13200. return value;
  13201. }
  13202. }
  13203. /**
  13204. * Sets the value for a property on a node.
  13205. *
  13206. * @param {DOMElement} node
  13207. * @param {string} name
  13208. * @param {*} value
  13209. */
  13210. function setValueForProperty(node, name, value, isCustomComponentTag) {
  13211. var propertyInfo = getPropertyInfo(name);
  13212. if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
  13213. return;
  13214. }
  13215. if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
  13216. value = null;
  13217. } // If the prop isn't in the special list, treat it as a simple attribute.
  13218. if (isCustomComponentTag || propertyInfo === null) {
  13219. if (isAttributeNameSafe(name)) {
  13220. var _attributeName = name;
  13221. if (value === null) {
  13222. node.removeAttribute(_attributeName);
  13223. } else {
  13224. node.setAttribute(_attributeName, '' + value);
  13225. }
  13226. }
  13227. return;
  13228. }
  13229. var mustUseProperty = propertyInfo.mustUseProperty;
  13230. if (mustUseProperty) {
  13231. var propertyName = propertyInfo.propertyName;
  13232. if (value === null) {
  13233. var type = propertyInfo.type;
  13234. node[propertyName] = type === BOOLEAN ? false : '';
  13235. } else {
  13236. // Contrary to `setAttribute`, object properties are properly
  13237. // `toString`ed by IE8/9.
  13238. node[propertyName] = value;
  13239. }
  13240. return;
  13241. } // The rest are treated as attributes with special cases.
  13242. var attributeName = propertyInfo.attributeName,
  13243. attributeNamespace = propertyInfo.attributeNamespace;
  13244. if (value === null) {
  13245. node.removeAttribute(attributeName);
  13246. } else {
  13247. var _type = propertyInfo.type;
  13248. var attributeValue;
  13249. if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
  13250. // If attribute type is boolean, we know for sure it won't be an execution sink
  13251. // and we won't require Trusted Type here.
  13252. attributeValue = '';
  13253. } else {
  13254. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  13255. // ('' + value) makes it output the correct toString()-value.
  13256. {
  13257. attributeValue = '' + value;
  13258. }
  13259. if (propertyInfo.sanitizeURL) {
  13260. sanitizeURL(attributeValue.toString());
  13261. }
  13262. }
  13263. if (attributeNamespace) {
  13264. node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
  13265. } else {
  13266. node.setAttribute(attributeName, attributeValue);
  13267. }
  13268. }
  13269. }
  13270. var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  13271. function describeComponentFrame (name, source, ownerName) {
  13272. var sourceInfo = '';
  13273. if (source) {
  13274. var path = source.fileName;
  13275. var fileName = path.replace(BEFORE_SLASH_RE, '');
  13276. {
  13277. // In DEV, include code for a common special case:
  13278. // prefer "folder/index.js" instead of just "index.js".
  13279. if (/^index\./.test(fileName)) {
  13280. var match = path.match(BEFORE_SLASH_RE);
  13281. if (match) {
  13282. var pathBeforeSlash = match[1];
  13283. if (pathBeforeSlash) {
  13284. var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
  13285. fileName = folderName + '/' + fileName;
  13286. }
  13287. }
  13288. }
  13289. }
  13290. sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
  13291. } else if (ownerName) {
  13292. sourceInfo = ' (created by ' + ownerName + ')';
  13293. }
  13294. return '\n in ' + (name || 'Unknown') + sourceInfo;
  13295. }
  13296. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  13297. // nor polyfill, then a plain number is used for performance.
  13298. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  13299. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  13300. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  13301. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  13302. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  13303. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  13304. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  13305. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  13306. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  13307. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  13308. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  13309. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  13310. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  13311. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  13312. var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  13313. var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  13314. var FAUX_ITERATOR_SYMBOL = '@@iterator';
  13315. function getIteratorFn(maybeIterable) {
  13316. if (maybeIterable === null || typeof maybeIterable !== 'object') {
  13317. return null;
  13318. }
  13319. var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  13320. if (typeof maybeIterator === 'function') {
  13321. return maybeIterator;
  13322. }
  13323. return null;
  13324. }
  13325. var Uninitialized = -1;
  13326. var Pending = 0;
  13327. var Resolved = 1;
  13328. var Rejected = 2;
  13329. function refineResolvedLazyComponent(lazyComponent) {
  13330. return lazyComponent._status === Resolved ? lazyComponent._result : null;
  13331. }
  13332. function initializeLazyComponentType(lazyComponent) {
  13333. if (lazyComponent._status === Uninitialized) {
  13334. lazyComponent._status = Pending;
  13335. var ctor = lazyComponent._ctor;
  13336. var thenable = ctor();
  13337. lazyComponent._result = thenable;
  13338. thenable.then(function (moduleObject) {
  13339. if (lazyComponent._status === Pending) {
  13340. var defaultExport = moduleObject.default;
  13341. {
  13342. if (defaultExport === undefined) {
  13343. error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
  13344. }
  13345. }
  13346. lazyComponent._status = Resolved;
  13347. lazyComponent._result = defaultExport;
  13348. }
  13349. }, function (error) {
  13350. if (lazyComponent._status === Pending) {
  13351. lazyComponent._status = Rejected;
  13352. lazyComponent._result = error;
  13353. }
  13354. });
  13355. }
  13356. }
  13357. function getWrappedName(outerType, innerType, wrapperName) {
  13358. var functionName = innerType.displayName || innerType.name || '';
  13359. return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
  13360. }
  13361. function getComponentName(type) {
  13362. if (type == null) {
  13363. // Host root, text node or just invalid type.
  13364. return null;
  13365. }
  13366. {
  13367. if (typeof type.tag === 'number') {
  13368. error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
  13369. }
  13370. }
  13371. if (typeof type === 'function') {
  13372. return type.displayName || type.name || null;
  13373. }
  13374. if (typeof type === 'string') {
  13375. return type;
  13376. }
  13377. switch (type) {
  13378. case REACT_FRAGMENT_TYPE:
  13379. return 'Fragment';
  13380. case REACT_PORTAL_TYPE:
  13381. return 'Portal';
  13382. case REACT_PROFILER_TYPE:
  13383. return "Profiler";
  13384. case REACT_STRICT_MODE_TYPE:
  13385. return 'StrictMode';
  13386. case REACT_SUSPENSE_TYPE:
  13387. return 'Suspense';
  13388. case REACT_SUSPENSE_LIST_TYPE:
  13389. return 'SuspenseList';
  13390. }
  13391. if (typeof type === 'object') {
  13392. switch (type.$$typeof) {
  13393. case REACT_CONTEXT_TYPE:
  13394. return 'Context.Consumer';
  13395. case REACT_PROVIDER_TYPE:
  13396. return 'Context.Provider';
  13397. case REACT_FORWARD_REF_TYPE:
  13398. return getWrappedName(type, type.render, 'ForwardRef');
  13399. case REACT_MEMO_TYPE:
  13400. return getComponentName(type.type);
  13401. case REACT_BLOCK_TYPE:
  13402. return getComponentName(type.render);
  13403. case REACT_LAZY_TYPE:
  13404. {
  13405. var thenable = type;
  13406. var resolvedThenable = refineResolvedLazyComponent(thenable);
  13407. if (resolvedThenable) {
  13408. return getComponentName(resolvedThenable);
  13409. }
  13410. break;
  13411. }
  13412. }
  13413. }
  13414. return null;
  13415. }
  13416. var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
  13417. function describeFiber(fiber) {
  13418. switch (fiber.tag) {
  13419. case HostRoot:
  13420. case HostPortal:
  13421. case HostText:
  13422. case Fragment:
  13423. case ContextProvider:
  13424. case ContextConsumer:
  13425. return '';
  13426. default:
  13427. var owner = fiber._debugOwner;
  13428. var source = fiber._debugSource;
  13429. var name = getComponentName(fiber.type);
  13430. var ownerName = null;
  13431. if (owner) {
  13432. ownerName = getComponentName(owner.type);
  13433. }
  13434. return describeComponentFrame(name, source, ownerName);
  13435. }
  13436. }
  13437. function getStackByFiberInDevAndProd(workInProgress) {
  13438. var info = '';
  13439. var node = workInProgress;
  13440. do {
  13441. info += describeFiber(node);
  13442. node = node.return;
  13443. } while (node);
  13444. return info;
  13445. }
  13446. var current = null;
  13447. var isRendering = false;
  13448. function getCurrentFiberOwnerNameInDevOrNull() {
  13449. {
  13450. if (current === null) {
  13451. return null;
  13452. }
  13453. var owner = current._debugOwner;
  13454. if (owner !== null && typeof owner !== 'undefined') {
  13455. return getComponentName(owner.type);
  13456. }
  13457. }
  13458. return null;
  13459. }
  13460. function getCurrentFiberStackInDev() {
  13461. {
  13462. if (current === null) {
  13463. return '';
  13464. } // Safe because if current fiber exists, we are reconciling,
  13465. // and it is guaranteed to be the work-in-progress version.
  13466. return getStackByFiberInDevAndProd(current);
  13467. }
  13468. }
  13469. function resetCurrentFiber() {
  13470. {
  13471. ReactDebugCurrentFrame$1.getCurrentStack = null;
  13472. current = null;
  13473. isRendering = false;
  13474. }
  13475. }
  13476. function setCurrentFiber(fiber) {
  13477. {
  13478. ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev;
  13479. current = fiber;
  13480. isRendering = false;
  13481. }
  13482. }
  13483. function setIsRendering(rendering) {
  13484. {
  13485. isRendering = rendering;
  13486. }
  13487. }
  13488. // Flow does not allow string concatenation of most non-string types. To work
  13489. // around this limitation, we use an opaque type that can only be obtained by
  13490. // passing the value through getToStringValue first.
  13491. function toString(value) {
  13492. return '' + value;
  13493. }
  13494. function getToStringValue(value) {
  13495. switch (typeof value) {
  13496. case 'boolean':
  13497. case 'number':
  13498. case 'object':
  13499. case 'string':
  13500. case 'undefined':
  13501. return value;
  13502. default:
  13503. // function, symbol are assigned as empty strings
  13504. return '';
  13505. }
  13506. }
  13507. var ReactDebugCurrentFrame$2 = null;
  13508. var ReactControlledValuePropTypes = {
  13509. checkPropTypes: null
  13510. };
  13511. {
  13512. ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
  13513. var hasReadOnlyValue = {
  13514. button: true,
  13515. checkbox: true,
  13516. image: true,
  13517. hidden: true,
  13518. radio: true,
  13519. reset: true,
  13520. submit: true
  13521. };
  13522. var propTypes = {
  13523. value: function (props, propName, componentName) {
  13524. if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
  13525. return null;
  13526. }
  13527. return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  13528. },
  13529. checked: function (props, propName, componentName) {
  13530. if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
  13531. return null;
  13532. }
  13533. return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  13534. }
  13535. };
  13536. /**
  13537. * Provide a linked `value` attribute for controlled forms. You should not use
  13538. * this outside of the ReactDOM controlled form components.
  13539. */
  13540. ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
  13541. checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
  13542. };
  13543. }
  13544. function isCheckable(elem) {
  13545. var type = elem.type;
  13546. var nodeName = elem.nodeName;
  13547. return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
  13548. }
  13549. function getTracker(node) {
  13550. return node._valueTracker;
  13551. }
  13552. function detachTracker(node) {
  13553. node._valueTracker = null;
  13554. }
  13555. function getValueFromNode(node) {
  13556. var value = '';
  13557. if (!node) {
  13558. return value;
  13559. }
  13560. if (isCheckable(node)) {
  13561. value = node.checked ? 'true' : 'false';
  13562. } else {
  13563. value = node.value;
  13564. }
  13565. return value;
  13566. }
  13567. function trackValueOnNode(node) {
  13568. var valueField = isCheckable(node) ? 'checked' : 'value';
  13569. var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
  13570. var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail
  13571. // and don't track value will cause over reporting of changes,
  13572. // but it's better then a hard failure
  13573. // (needed for certain tests that spyOn input values and Safari)
  13574. if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
  13575. return;
  13576. }
  13577. var get = descriptor.get,
  13578. set = descriptor.set;
  13579. Object.defineProperty(node, valueField, {
  13580. configurable: true,
  13581. get: function () {
  13582. return get.call(this);
  13583. },
  13584. set: function (value) {
  13585. currentValue = '' + value;
  13586. set.call(this, value);
  13587. }
  13588. }); // We could've passed this the first time
  13589. // but it triggers a bug in IE11 and Edge 14/15.
  13590. // Calling defineProperty() again should be equivalent.
  13591. // https://github.com/facebook/react/issues/11768
  13592. Object.defineProperty(node, valueField, {
  13593. enumerable: descriptor.enumerable
  13594. });
  13595. var tracker = {
  13596. getValue: function () {
  13597. return currentValue;
  13598. },
  13599. setValue: function (value) {
  13600. currentValue = '' + value;
  13601. },
  13602. stopTracking: function () {
  13603. detachTracker(node);
  13604. delete node[valueField];
  13605. }
  13606. };
  13607. return tracker;
  13608. }
  13609. function track(node) {
  13610. if (getTracker(node)) {
  13611. return;
  13612. } // TODO: Once it's just Fiber we can move this to node._wrapperState
  13613. node._valueTracker = trackValueOnNode(node);
  13614. }
  13615. function updateValueIfChanged(node) {
  13616. if (!node) {
  13617. return false;
  13618. }
  13619. var tracker = getTracker(node); // if there is no tracker at this point it's unlikely
  13620. // that trying again will succeed
  13621. if (!tracker) {
  13622. return true;
  13623. }
  13624. var lastValue = tracker.getValue();
  13625. var nextValue = getValueFromNode(node);
  13626. if (nextValue !== lastValue) {
  13627. tracker.setValue(nextValue);
  13628. return true;
  13629. }
  13630. return false;
  13631. }
  13632. var didWarnValueDefaultValue = false;
  13633. var didWarnCheckedDefaultChecked = false;
  13634. var didWarnControlledToUncontrolled = false;
  13635. var didWarnUncontrolledToControlled = false;
  13636. function isControlled(props) {
  13637. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  13638. return usesChecked ? props.checked != null : props.value != null;
  13639. }
  13640. /**
  13641. * Implements an <input> host component that allows setting these optional
  13642. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  13643. *
  13644. * If `checked` or `value` are not supplied (or null/undefined), user actions
  13645. * that affect the checked state or value will trigger updates to the element.
  13646. *
  13647. * If they are supplied (and not null/undefined), the rendered element will not
  13648. * trigger updates to the element. Instead, the props must change in order for
  13649. * the rendered element to be updated.
  13650. *
  13651. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  13652. * with an empty value (or `defaultValue`).
  13653. *
  13654. * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  13655. */
  13656. function getHostProps(element, props) {
  13657. var node = element;
  13658. var checked = props.checked;
  13659. var hostProps = _assign({}, props, {
  13660. defaultChecked: undefined,
  13661. defaultValue: undefined,
  13662. value: undefined,
  13663. checked: checked != null ? checked : node._wrapperState.initialChecked
  13664. });
  13665. return hostProps;
  13666. }
  13667. function initWrapperState(element, props) {
  13668. {
  13669. ReactControlledValuePropTypes.checkPropTypes('input', props);
  13670. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  13671. error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
  13672. didWarnCheckedDefaultChecked = true;
  13673. }
  13674. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  13675. error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
  13676. didWarnValueDefaultValue = true;
  13677. }
  13678. }
  13679. var node = element;
  13680. var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
  13681. node._wrapperState = {
  13682. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  13683. initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
  13684. controlled: isControlled(props)
  13685. };
  13686. }
  13687. function updateChecked(element, props) {
  13688. var node = element;
  13689. var checked = props.checked;
  13690. if (checked != null) {
  13691. setValueForProperty(node, 'checked', checked, false);
  13692. }
  13693. }
  13694. function updateWrapper(element, props) {
  13695. var node = element;
  13696. {
  13697. var controlled = isControlled(props);
  13698. if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  13699. error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
  13700. didWarnUncontrolledToControlled = true;
  13701. }
  13702. if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  13703. error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
  13704. didWarnControlledToUncontrolled = true;
  13705. }
  13706. }
  13707. updateChecked(element, props);
  13708. var value = getToStringValue(props.value);
  13709. var type = props.type;
  13710. if (value != null) {
  13711. if (type === 'number') {
  13712. if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible.
  13713. // eslint-disable-next-line
  13714. node.value != value) {
  13715. node.value = toString(value);
  13716. }
  13717. } else if (node.value !== toString(value)) {
  13718. node.value = toString(value);
  13719. }
  13720. } else if (type === 'submit' || type === 'reset') {
  13721. // Submit/reset inputs need the attribute removed completely to avoid
  13722. // blank-text buttons.
  13723. node.removeAttribute('value');
  13724. return;
  13725. }
  13726. {
  13727. // When syncing the value attribute, the value comes from a cascade of
  13728. // properties:
  13729. // 1. The value React property
  13730. // 2. The defaultValue React property
  13731. // 3. Otherwise there should be no change
  13732. if (props.hasOwnProperty('value')) {
  13733. setDefaultValue(node, props.type, value);
  13734. } else if (props.hasOwnProperty('defaultValue')) {
  13735. setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
  13736. }
  13737. }
  13738. {
  13739. // When syncing the checked attribute, it only changes when it needs
  13740. // to be removed, such as transitioning from a checkbox into a text input
  13741. if (props.checked == null && props.defaultChecked != null) {
  13742. node.defaultChecked = !!props.defaultChecked;
  13743. }
  13744. }
  13745. }
  13746. function postMountWrapper(element, props, isHydrating) {
  13747. var node = element; // Do not assign value if it is already set. This prevents user text input
  13748. // from being lost during SSR hydration.
  13749. if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
  13750. var type = props.type;
  13751. var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the
  13752. // default value provided by the browser. See: #12872
  13753. if (isButton && (props.value === undefined || props.value === null)) {
  13754. return;
  13755. }
  13756. var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input
  13757. // from being lost during SSR hydration.
  13758. if (!isHydrating) {
  13759. {
  13760. // When syncing the value attribute, the value property should use
  13761. // the wrapperState._initialValue property. This uses:
  13762. //
  13763. // 1. The value React property when present
  13764. // 2. The defaultValue React property when present
  13765. // 3. An empty string
  13766. if (initialValue !== node.value) {
  13767. node.value = initialValue;
  13768. }
  13769. }
  13770. }
  13771. {
  13772. // Otherwise, the value attribute is synchronized to the property,
  13773. // so we assign defaultValue to the same thing as the value property
  13774. // assignment step above.
  13775. node.defaultValue = initialValue;
  13776. }
  13777. } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  13778. // this is needed to work around a chrome bug where setting defaultChecked
  13779. // will sometimes influence the value of checked (even after detachment).
  13780. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  13781. // We need to temporarily unset name to avoid disrupting radio button groups.
  13782. var name = node.name;
  13783. if (name !== '') {
  13784. node.name = '';
  13785. }
  13786. {
  13787. // When syncing the checked attribute, both the checked property and
  13788. // attribute are assigned at the same time using defaultChecked. This uses:
  13789. //
  13790. // 1. The checked React property when present
  13791. // 2. The defaultChecked React property when present
  13792. // 3. Otherwise, false
  13793. node.defaultChecked = !node.defaultChecked;
  13794. node.defaultChecked = !!node._wrapperState.initialChecked;
  13795. }
  13796. if (name !== '') {
  13797. node.name = name;
  13798. }
  13799. }
  13800. function restoreControlledState(element, props) {
  13801. var node = element;
  13802. updateWrapper(node, props);
  13803. updateNamedCousins(node, props);
  13804. }
  13805. function updateNamedCousins(rootNode, props) {
  13806. var name = props.name;
  13807. if (props.type === 'radio' && name != null) {
  13808. var queryRoot = rootNode;
  13809. while (queryRoot.parentNode) {
  13810. queryRoot = queryRoot.parentNode;
  13811. } // If `rootNode.form` was non-null, then we could try `form.elements`,
  13812. // but that sometimes behaves strangely in IE8. We could also try using
  13813. // `form.getElementsByName`, but that will only return direct children
  13814. // and won't include inputs that use the HTML5 `form=` attribute. Since
  13815. // the input might not even be in a form. It might not even be in the
  13816. // document. Let's just use the local `querySelectorAll` to ensure we don't
  13817. // miss anything.
  13818. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  13819. for (var i = 0; i < group.length; i++) {
  13820. var otherNode = group[i];
  13821. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  13822. continue;
  13823. } // This will throw if radio buttons rendered by different copies of React
  13824. // and the same name are rendered into the same form (same as #1939).
  13825. // That's probably okay; we don't support it just as we don't support
  13826. // mixing React radio buttons with non-React ones.
  13827. var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
  13828. if (!otherProps) {
  13829. {
  13830. throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." );
  13831. }
  13832. } // We need update the tracked value on the named cousin since the value
  13833. // was changed but the input saw no event or value set
  13834. updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that
  13835. // was previously checked to update will cause it to be come re-checked
  13836. // as appropriate.
  13837. updateWrapper(otherNode, otherProps);
  13838. }
  13839. }
  13840. } // In Chrome, assigning defaultValue to certain input types triggers input validation.
  13841. // For number inputs, the display value loses trailing decimal points. For email inputs,
  13842. // Chrome raises "The specified value <x> is not a valid email address".
  13843. //
  13844. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  13845. // when the user is inputting text
  13846. //
  13847. // https://github.com/facebook/react/issues/7253
  13848. function setDefaultValue(node, type, value) {
  13849. if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
  13850. type !== 'number' || node.ownerDocument.activeElement !== node) {
  13851. if (value == null) {
  13852. node.defaultValue = toString(node._wrapperState.initialValue);
  13853. } else if (node.defaultValue !== toString(value)) {
  13854. node.defaultValue = toString(value);
  13855. }
  13856. }
  13857. }
  13858. var didWarnSelectedSetOnOption = false;
  13859. var didWarnInvalidChild = false;
  13860. function flattenChildren(children) {
  13861. var content = ''; // Flatten children. We'll warn if they are invalid
  13862. // during validateProps() which runs for hydration too.
  13863. // Note that this would throw on non-element objects.
  13864. // Elements are stringified (which is normally irrelevant
  13865. // but matters for <fbt>).
  13866. React.Children.forEach(children, function (child) {
  13867. if (child == null) {
  13868. return;
  13869. }
  13870. content += child; // Note: we don't warn about invalid children here.
  13871. // Instead, this is done separately below so that
  13872. // it happens during the hydration codepath too.
  13873. });
  13874. return content;
  13875. }
  13876. /**
  13877. * Implements an <option> host component that warns when `selected` is set.
  13878. */
  13879. function validateProps(element, props) {
  13880. {
  13881. // This mirrors the codepath above, but runs for hydration too.
  13882. // Warn about invalid children here so that client and hydration are consistent.
  13883. // TODO: this seems like it could cause a DEV-only throw for hydration
  13884. // if children contains a non-element object. We should try to avoid that.
  13885. if (typeof props.children === 'object' && props.children !== null) {
  13886. React.Children.forEach(props.children, function (child) {
  13887. if (child == null) {
  13888. return;
  13889. }
  13890. if (typeof child === 'string' || typeof child === 'number') {
  13891. return;
  13892. }
  13893. if (typeof child.type !== 'string') {
  13894. return;
  13895. }
  13896. if (!didWarnInvalidChild) {
  13897. didWarnInvalidChild = true;
  13898. error('Only strings and numbers are supported as <option> children.');
  13899. }
  13900. });
  13901. } // TODO: Remove support for `selected` in <option>.
  13902. if (props.selected != null && !didWarnSelectedSetOnOption) {
  13903. error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
  13904. didWarnSelectedSetOnOption = true;
  13905. }
  13906. }
  13907. }
  13908. function postMountWrapper$1(element, props) {
  13909. // value="" should make a value attribute (#6219)
  13910. if (props.value != null) {
  13911. element.setAttribute('value', toString(getToStringValue(props.value)));
  13912. }
  13913. }
  13914. function getHostProps$1(element, props) {
  13915. var hostProps = _assign({
  13916. children: undefined
  13917. }, props);
  13918. var content = flattenChildren(props.children);
  13919. if (content) {
  13920. hostProps.children = content;
  13921. }
  13922. return hostProps;
  13923. }
  13924. var didWarnValueDefaultValue$1;
  13925. {
  13926. didWarnValueDefaultValue$1 = false;
  13927. }
  13928. function getDeclarationErrorAddendum() {
  13929. var ownerName = getCurrentFiberOwnerNameInDevOrNull();
  13930. if (ownerName) {
  13931. return '\n\nCheck the render method of `' + ownerName + '`.';
  13932. }
  13933. return '';
  13934. }
  13935. var valuePropNames = ['value', 'defaultValue'];
  13936. /**
  13937. * Validation function for `value` and `defaultValue`.
  13938. */
  13939. function checkSelectPropTypes(props) {
  13940. {
  13941. ReactControlledValuePropTypes.checkPropTypes('select', props);
  13942. for (var i = 0; i < valuePropNames.length; i++) {
  13943. var propName = valuePropNames[i];
  13944. if (props[propName] == null) {
  13945. continue;
  13946. }
  13947. var isArray = Array.isArray(props[propName]);
  13948. if (props.multiple && !isArray) {
  13949. error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
  13950. } else if (!props.multiple && isArray) {
  13951. error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
  13952. }
  13953. }
  13954. }
  13955. }
  13956. function updateOptions(node, multiple, propValue, setDefaultSelected) {
  13957. var options = node.options;
  13958. if (multiple) {
  13959. var selectedValues = propValue;
  13960. var selectedValue = {};
  13961. for (var i = 0; i < selectedValues.length; i++) {
  13962. // Prefix to avoid chaos with special keys.
  13963. selectedValue['$' + selectedValues[i]] = true;
  13964. }
  13965. for (var _i = 0; _i < options.length; _i++) {
  13966. var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
  13967. if (options[_i].selected !== selected) {
  13968. options[_i].selected = selected;
  13969. }
  13970. if (selected && setDefaultSelected) {
  13971. options[_i].defaultSelected = true;
  13972. }
  13973. }
  13974. } else {
  13975. // Do not set `select.value` as exact behavior isn't consistent across all
  13976. // browsers for all cases.
  13977. var _selectedValue = toString(getToStringValue(propValue));
  13978. var defaultSelected = null;
  13979. for (var _i2 = 0; _i2 < options.length; _i2++) {
  13980. if (options[_i2].value === _selectedValue) {
  13981. options[_i2].selected = true;
  13982. if (setDefaultSelected) {
  13983. options[_i2].defaultSelected = true;
  13984. }
  13985. return;
  13986. }
  13987. if (defaultSelected === null && !options[_i2].disabled) {
  13988. defaultSelected = options[_i2];
  13989. }
  13990. }
  13991. if (defaultSelected !== null) {
  13992. defaultSelected.selected = true;
  13993. }
  13994. }
  13995. }
  13996. /**
  13997. * Implements a <select> host component that allows optionally setting the
  13998. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  13999. * stringable. If `multiple` is true, the prop must be an array of stringables.
  14000. *
  14001. * If `value` is not supplied (or null/undefined), user actions that change the
  14002. * selected option will trigger updates to the rendered options.
  14003. *
  14004. * If it is supplied (and not null/undefined), the rendered options will not
  14005. * update in response to user actions. Instead, the `value` prop must change in
  14006. * order for the rendered options to update.
  14007. *
  14008. * If `defaultValue` is provided, any options with the supplied values will be
  14009. * selected.
  14010. */
  14011. function getHostProps$2(element, props) {
  14012. return _assign({}, props, {
  14013. value: undefined
  14014. });
  14015. }
  14016. function initWrapperState$1(element, props) {
  14017. var node = element;
  14018. {
  14019. checkSelectPropTypes(props);
  14020. }
  14021. node._wrapperState = {
  14022. wasMultiple: !!props.multiple
  14023. };
  14024. {
  14025. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
  14026. error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
  14027. didWarnValueDefaultValue$1 = true;
  14028. }
  14029. }
  14030. }
  14031. function postMountWrapper$2(element, props) {
  14032. var node = element;
  14033. node.multiple = !!props.multiple;
  14034. var value = props.value;
  14035. if (value != null) {
  14036. updateOptions(node, !!props.multiple, value, false);
  14037. } else if (props.defaultValue != null) {
  14038. updateOptions(node, !!props.multiple, props.defaultValue, true);
  14039. }
  14040. }
  14041. function postUpdateWrapper(element, props) {
  14042. var node = element;
  14043. var wasMultiple = node._wrapperState.wasMultiple;
  14044. node._wrapperState.wasMultiple = !!props.multiple;
  14045. var value = props.value;
  14046. if (value != null) {
  14047. updateOptions(node, !!props.multiple, value, false);
  14048. } else if (wasMultiple !== !!props.multiple) {
  14049. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  14050. if (props.defaultValue != null) {
  14051. updateOptions(node, !!props.multiple, props.defaultValue, true);
  14052. } else {
  14053. // Revert the select back to its default unselected state.
  14054. updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
  14055. }
  14056. }
  14057. }
  14058. function restoreControlledState$1(element, props) {
  14059. var node = element;
  14060. var value = props.value;
  14061. if (value != null) {
  14062. updateOptions(node, !!props.multiple, value, false);
  14063. }
  14064. }
  14065. var didWarnValDefaultVal = false;
  14066. /**
  14067. * Implements a <textarea> host component that allows setting `value`, and
  14068. * `defaultValue`. This differs from the traditional DOM API because value is
  14069. * usually set as PCDATA children.
  14070. *
  14071. * If `value` is not supplied (or null/undefined), user actions that affect the
  14072. * value will trigger updates to the element.
  14073. *
  14074. * If `value` is supplied (and not null/undefined), the rendered element will
  14075. * not trigger updates to the element. Instead, the `value` prop must change in
  14076. * order for the rendered element to be updated.
  14077. *
  14078. * The rendered element will be initialized with an empty value, the prop
  14079. * `defaultValue` if specified, or the children content (deprecated).
  14080. */
  14081. function getHostProps$3(element, props) {
  14082. var node = element;
  14083. if (!(props.dangerouslySetInnerHTML == null)) {
  14084. {
  14085. throw Error( "`dangerouslySetInnerHTML` does not make sense on <textarea>." );
  14086. }
  14087. } // Always set children to the same thing. In IE9, the selection range will
  14088. // get reset if `textContent` is mutated. We could add a check in setTextContent
  14089. // to only set the value if/when the value differs from the node value (which would
  14090. // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
  14091. // solution. The value can be a boolean or object so that's why it's forced
  14092. // to be a string.
  14093. var hostProps = _assign({}, props, {
  14094. value: undefined,
  14095. defaultValue: undefined,
  14096. children: toString(node._wrapperState.initialValue)
  14097. });
  14098. return hostProps;
  14099. }
  14100. function initWrapperState$2(element, props) {
  14101. var node = element;
  14102. {
  14103. ReactControlledValuePropTypes.checkPropTypes('textarea', props);
  14104. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  14105. error('%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
  14106. didWarnValDefaultVal = true;
  14107. }
  14108. }
  14109. var initialValue = props.value; // Only bother fetching default value if we're going to use it
  14110. if (initialValue == null) {
  14111. var children = props.children,
  14112. defaultValue = props.defaultValue;
  14113. if (children != null) {
  14114. {
  14115. error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
  14116. }
  14117. {
  14118. if (!(defaultValue == null)) {
  14119. {
  14120. throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
  14121. }
  14122. }
  14123. if (Array.isArray(children)) {
  14124. if (!(children.length <= 1)) {
  14125. {
  14126. throw Error( "<textarea> can only have at most one child." );
  14127. }
  14128. }
  14129. children = children[0];
  14130. }
  14131. defaultValue = children;
  14132. }
  14133. }
  14134. if (defaultValue == null) {
  14135. defaultValue = '';
  14136. }
  14137. initialValue = defaultValue;
  14138. }
  14139. node._wrapperState = {
  14140. initialValue: getToStringValue(initialValue)
  14141. };
  14142. }
  14143. function updateWrapper$1(element, props) {
  14144. var node = element;
  14145. var value = getToStringValue(props.value);
  14146. var defaultValue = getToStringValue(props.defaultValue);
  14147. if (value != null) {
  14148. // Cast `value` to a string to ensure the value is set correctly. While
  14149. // browsers typically do this as necessary, jsdom doesn't.
  14150. var newValue = toString(value); // To avoid side effects (such as losing text selection), only set value if changed
  14151. if (newValue !== node.value) {
  14152. node.value = newValue;
  14153. }
  14154. if (props.defaultValue == null && node.defaultValue !== newValue) {
  14155. node.defaultValue = newValue;
  14156. }
  14157. }
  14158. if (defaultValue != null) {
  14159. node.defaultValue = toString(defaultValue);
  14160. }
  14161. }
  14162. function postMountWrapper$3(element, props) {
  14163. var node = element; // This is in postMount because we need access to the DOM node, which is not
  14164. // available until after the component has mounted.
  14165. var textContent = node.textContent; // Only set node.value if textContent is equal to the expected
  14166. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  14167. // will populate textContent as well.
  14168. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  14169. if (textContent === node._wrapperState.initialValue) {
  14170. if (textContent !== '' && textContent !== null) {
  14171. node.value = textContent;
  14172. }
  14173. }
  14174. }
  14175. function restoreControlledState$2(element, props) {
  14176. // DOM component is still mounted; update
  14177. updateWrapper$1(element, props);
  14178. }
  14179. var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
  14180. var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
  14181. var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
  14182. var Namespaces = {
  14183. html: HTML_NAMESPACE,
  14184. mathml: MATH_NAMESPACE,
  14185. svg: SVG_NAMESPACE
  14186. }; // Assumes there is no parent namespace.
  14187. function getIntrinsicNamespace(type) {
  14188. switch (type) {
  14189. case 'svg':
  14190. return SVG_NAMESPACE;
  14191. case 'math':
  14192. return MATH_NAMESPACE;
  14193. default:
  14194. return HTML_NAMESPACE;
  14195. }
  14196. }
  14197. function getChildNamespace(parentNamespace, type) {
  14198. if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
  14199. // No (or default) parent namespace: potential entry point.
  14200. return getIntrinsicNamespace(type);
  14201. }
  14202. if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
  14203. // We're leaving SVG.
  14204. return HTML_NAMESPACE;
  14205. } // By default, pass namespace below.
  14206. return parentNamespace;
  14207. }
  14208. /* globals MSApp */
  14209. /**
  14210. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  14211. */
  14212. var createMicrosoftUnsafeLocalFunction = function (func) {
  14213. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  14214. return function (arg0, arg1, arg2, arg3) {
  14215. MSApp.execUnsafeLocalFunction(function () {
  14216. return func(arg0, arg1, arg2, arg3);
  14217. });
  14218. };
  14219. } else {
  14220. return func;
  14221. }
  14222. };
  14223. var reusableSVGContainer;
  14224. /**
  14225. * Set the innerHTML property of a node
  14226. *
  14227. * @param {DOMElement} node
  14228. * @param {string} html
  14229. * @internal
  14230. */
  14231. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  14232. if (node.namespaceURI === Namespaces.svg) {
  14233. if (!('innerHTML' in node)) {
  14234. // IE does not have innerHTML for SVG nodes, so instead we inject the
  14235. // new markup in a temp node and then move the child nodes across into
  14236. // the target node
  14237. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  14238. reusableSVGContainer.innerHTML = '<svg>' + html.valueOf().toString() + '</svg>';
  14239. var svgNode = reusableSVGContainer.firstChild;
  14240. while (node.firstChild) {
  14241. node.removeChild(node.firstChild);
  14242. }
  14243. while (svgNode.firstChild) {
  14244. node.appendChild(svgNode.firstChild);
  14245. }
  14246. return;
  14247. }
  14248. }
  14249. node.innerHTML = html;
  14250. });
  14251. /**
  14252. * HTML nodeType values that represent the type of the node
  14253. */
  14254. var ELEMENT_NODE = 1;
  14255. var TEXT_NODE = 3;
  14256. var COMMENT_NODE = 8;
  14257. var DOCUMENT_NODE = 9;
  14258. var DOCUMENT_FRAGMENT_NODE = 11;
  14259. /**
  14260. * Set the textContent property of a node. For text updates, it's faster
  14261. * to set the `nodeValue` of the Text node directly instead of using
  14262. * `.textContent` which will remove the existing node and create a new one.
  14263. *
  14264. * @param {DOMElement} node
  14265. * @param {string} text
  14266. * @internal
  14267. */
  14268. var setTextContent = function (node, text) {
  14269. if (text) {
  14270. var firstChild = node.firstChild;
  14271. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
  14272. firstChild.nodeValue = text;
  14273. return;
  14274. }
  14275. }
  14276. node.textContent = text;
  14277. };
  14278. // Do not use the below two methods directly!
  14279. // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
  14280. // (It is the only module that is allowed to access these methods.)
  14281. function unsafeCastStringToDOMTopLevelType(topLevelType) {
  14282. return topLevelType;
  14283. }
  14284. function unsafeCastDOMTopLevelTypeToString(topLevelType) {
  14285. return topLevelType;
  14286. }
  14287. /**
  14288. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  14289. *
  14290. * @param {string} styleProp
  14291. * @param {string} eventName
  14292. * @returns {object}
  14293. */
  14294. function makePrefixMap(styleProp, eventName) {
  14295. var prefixes = {};
  14296. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  14297. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  14298. prefixes['Moz' + styleProp] = 'moz' + eventName;
  14299. return prefixes;
  14300. }
  14301. /**
  14302. * A list of event names to a configurable list of vendor prefixes.
  14303. */
  14304. var vendorPrefixes = {
  14305. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  14306. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  14307. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  14308. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  14309. };
  14310. /**
  14311. * Event names that have already been detected and prefixed (if applicable).
  14312. */
  14313. var prefixedEventNames = {};
  14314. /**
  14315. * Element to check for prefixes on.
  14316. */
  14317. var style = {};
  14318. /**
  14319. * Bootstrap if a DOM exists.
  14320. */
  14321. if (canUseDOM) {
  14322. style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x,
  14323. // the un-prefixed "animation" and "transition" properties are defined on the
  14324. // style object but the events that fire will still be prefixed, so we need
  14325. // to check if the un-prefixed events are usable, and if not remove them from the map.
  14326. if (!('AnimationEvent' in window)) {
  14327. delete vendorPrefixes.animationend.animation;
  14328. delete vendorPrefixes.animationiteration.animation;
  14329. delete vendorPrefixes.animationstart.animation;
  14330. } // Same as above
  14331. if (!('TransitionEvent' in window)) {
  14332. delete vendorPrefixes.transitionend.transition;
  14333. }
  14334. }
  14335. /**
  14336. * Attempts to determine the correct vendor prefixed event name.
  14337. *
  14338. * @param {string} eventName
  14339. * @returns {string}
  14340. */
  14341. function getVendorPrefixedEventName(eventName) {
  14342. if (prefixedEventNames[eventName]) {
  14343. return prefixedEventNames[eventName];
  14344. } else if (!vendorPrefixes[eventName]) {
  14345. return eventName;
  14346. }
  14347. var prefixMap = vendorPrefixes[eventName];
  14348. for (var styleProp in prefixMap) {
  14349. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  14350. return prefixedEventNames[eventName] = prefixMap[styleProp];
  14351. }
  14352. }
  14353. return eventName;
  14354. }
  14355. /**
  14356. * To identify top level events in ReactDOM, we use constants defined by this
  14357. * module. This is the only module that uses the unsafe* methods to express
  14358. * that the constants actually correspond to the browser event names. This lets
  14359. * us save some bundle size by avoiding a top level type -> event name map.
  14360. * The rest of ReactDOM code should import top level types from this file.
  14361. */
  14362. var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
  14363. var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
  14364. var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
  14365. var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
  14366. var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
  14367. var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
  14368. var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
  14369. var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
  14370. var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
  14371. var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
  14372. var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
  14373. var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
  14374. var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
  14375. var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
  14376. var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
  14377. var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
  14378. var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
  14379. var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
  14380. var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
  14381. var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
  14382. var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
  14383. var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
  14384. var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
  14385. var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
  14386. var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
  14387. var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
  14388. var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
  14389. var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
  14390. var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
  14391. var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
  14392. var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
  14393. var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
  14394. var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
  14395. var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
  14396. var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
  14397. var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
  14398. var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
  14399. var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
  14400. var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
  14401. var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
  14402. var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
  14403. var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
  14404. var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
  14405. var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
  14406. var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
  14407. var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
  14408. var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
  14409. var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
  14410. var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
  14411. var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
  14412. var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
  14413. var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
  14414. var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
  14415. var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
  14416. var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
  14417. var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
  14418. var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
  14419. var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
  14420. var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
  14421. var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
  14422. var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
  14423. var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
  14424. var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
  14425. var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
  14426. var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
  14427. var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
  14428. var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
  14429. var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
  14430. var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
  14431. var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
  14432. var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
  14433. var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
  14434. var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
  14435. var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
  14436. var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
  14437. var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
  14438. var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
  14439. var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
  14440. var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
  14441. var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements.
  14442. // Note that events in this list will *not* be listened to at the top level
  14443. // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
  14444. var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
  14445. function getRawEventName(topLevelType) {
  14446. return unsafeCastDOMTopLevelTypeToString(topLevelType);
  14447. }
  14448. var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // prettier-ignore
  14449. var elementListenerMap = new PossiblyWeakMap();
  14450. function getListenerMapForElement(element) {
  14451. var listenerMap = elementListenerMap.get(element);
  14452. if (listenerMap === undefined) {
  14453. listenerMap = new Map();
  14454. elementListenerMap.set(element, listenerMap);
  14455. }
  14456. return listenerMap;
  14457. }
  14458. /**
  14459. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  14460. * instance (key) and the internal representation (value). This allows public
  14461. * methods to accept the user facing instance as an argument and map them back
  14462. * to internal methods.
  14463. *
  14464. * Note that this module is currently shared and assumed to be stateless.
  14465. * If this becomes an actual Map, that will break.
  14466. */
  14467. function get(key) {
  14468. return key._reactInternalFiber;
  14469. }
  14470. function has(key) {
  14471. return key._reactInternalFiber !== undefined;
  14472. }
  14473. function set(key, value) {
  14474. key._reactInternalFiber = value;
  14475. }
  14476. // Don't change these two values. They're used by React Dev Tools.
  14477. var NoEffect =
  14478. /* */
  14479. 0;
  14480. var PerformedWork =
  14481. /* */
  14482. 1; // You can change the rest (and add more).
  14483. var Placement =
  14484. /* */
  14485. 2;
  14486. var Update =
  14487. /* */
  14488. 4;
  14489. var PlacementAndUpdate =
  14490. /* */
  14491. 6;
  14492. var Deletion =
  14493. /* */
  14494. 8;
  14495. var ContentReset =
  14496. /* */
  14497. 16;
  14498. var Callback =
  14499. /* */
  14500. 32;
  14501. var DidCapture =
  14502. /* */
  14503. 64;
  14504. var Ref =
  14505. /* */
  14506. 128;
  14507. var Snapshot =
  14508. /* */
  14509. 256;
  14510. var Passive =
  14511. /* */
  14512. 512;
  14513. var Hydrating =
  14514. /* */
  14515. 1024;
  14516. var HydratingAndUpdate =
  14517. /* */
  14518. 1028; // Passive & Update & Callback & Ref & Snapshot
  14519. var LifecycleEffectMask =
  14520. /* */
  14521. 932; // Union of all host effects
  14522. var HostEffectMask =
  14523. /* */
  14524. 2047;
  14525. var Incomplete =
  14526. /* */
  14527. 2048;
  14528. var ShouldCapture =
  14529. /* */
  14530. 4096;
  14531. var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
  14532. function getNearestMountedFiber(fiber) {
  14533. var node = fiber;
  14534. var nearestMounted = fiber;
  14535. if (!fiber.alternate) {
  14536. // If there is no alternate, this might be a new tree that isn't inserted
  14537. // yet. If it is, then it will have a pending insertion effect on it.
  14538. var nextNode = node;
  14539. do {
  14540. node = nextNode;
  14541. if ((node.effectTag & (Placement | Hydrating)) !== NoEffect) {
  14542. // This is an insertion or in-progress hydration. The nearest possible
  14543. // mounted fiber is the parent but we need to continue to figure out
  14544. // if that one is still mounted.
  14545. nearestMounted = node.return;
  14546. }
  14547. nextNode = node.return;
  14548. } while (nextNode);
  14549. } else {
  14550. while (node.return) {
  14551. node = node.return;
  14552. }
  14553. }
  14554. if (node.tag === HostRoot) {
  14555. // TODO: Check if this was a nested HostRoot when used with
  14556. // renderContainerIntoSubtree.
  14557. return nearestMounted;
  14558. } // If we didn't hit the root, that means that we're in an disconnected tree
  14559. // that has been unmounted.
  14560. return null;
  14561. }
  14562. function getSuspenseInstanceFromFiber(fiber) {
  14563. if (fiber.tag === SuspenseComponent) {
  14564. var suspenseState = fiber.memoizedState;
  14565. if (suspenseState === null) {
  14566. var current = fiber.alternate;
  14567. if (current !== null) {
  14568. suspenseState = current.memoizedState;
  14569. }
  14570. }
  14571. if (suspenseState !== null) {
  14572. return suspenseState.dehydrated;
  14573. }
  14574. }
  14575. return null;
  14576. }
  14577. function getContainerFromFiber(fiber) {
  14578. return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null;
  14579. }
  14580. function isFiberMounted(fiber) {
  14581. return getNearestMountedFiber(fiber) === fiber;
  14582. }
  14583. function isMounted(component) {
  14584. {
  14585. var owner = ReactCurrentOwner.current;
  14586. if (owner !== null && owner.tag === ClassComponent) {
  14587. var ownerFiber = owner;
  14588. var instance = ownerFiber.stateNode;
  14589. if (!instance._warnedAboutRefsInRender) {
  14590. error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component');
  14591. }
  14592. instance._warnedAboutRefsInRender = true;
  14593. }
  14594. }
  14595. var fiber = get(component);
  14596. if (!fiber) {
  14597. return false;
  14598. }
  14599. return getNearestMountedFiber(fiber) === fiber;
  14600. }
  14601. function assertIsMounted(fiber) {
  14602. if (!(getNearestMountedFiber(fiber) === fiber)) {
  14603. {
  14604. throw Error( "Unable to find node on an unmounted component." );
  14605. }
  14606. }
  14607. }
  14608. function findCurrentFiberUsingSlowPath(fiber) {
  14609. var alternate = fiber.alternate;
  14610. if (!alternate) {
  14611. // If there is no alternate, then we only need to check if it is mounted.
  14612. var nearestMounted = getNearestMountedFiber(fiber);
  14613. if (!(nearestMounted !== null)) {
  14614. {
  14615. throw Error( "Unable to find node on an unmounted component." );
  14616. }
  14617. }
  14618. if (nearestMounted !== fiber) {
  14619. return null;
  14620. }
  14621. return fiber;
  14622. } // If we have two possible branches, we'll walk backwards up to the root
  14623. // to see what path the root points to. On the way we may hit one of the
  14624. // special cases and we'll deal with them.
  14625. var a = fiber;
  14626. var b = alternate;
  14627. while (true) {
  14628. var parentA = a.return;
  14629. if (parentA === null) {
  14630. // We're at the root.
  14631. break;
  14632. }
  14633. var parentB = parentA.alternate;
  14634. if (parentB === null) {
  14635. // There is no alternate. This is an unusual case. Currently, it only
  14636. // happens when a Suspense component is hidden. An extra fragment fiber
  14637. // is inserted in between the Suspense fiber and its children. Skip
  14638. // over this extra fragment fiber and proceed to the next parent.
  14639. var nextParent = parentA.return;
  14640. if (nextParent !== null) {
  14641. a = b = nextParent;
  14642. continue;
  14643. } // If there's no parent, we're at the root.
  14644. break;
  14645. } // If both copies of the parent fiber point to the same child, we can
  14646. // assume that the child is current. This happens when we bailout on low
  14647. // priority: the bailed out fiber's child reuses the current child.
  14648. if (parentA.child === parentB.child) {
  14649. var child = parentA.child;
  14650. while (child) {
  14651. if (child === a) {
  14652. // We've determined that A is the current branch.
  14653. assertIsMounted(parentA);
  14654. return fiber;
  14655. }
  14656. if (child === b) {
  14657. // We've determined that B is the current branch.
  14658. assertIsMounted(parentA);
  14659. return alternate;
  14660. }
  14661. child = child.sibling;
  14662. } // We should never have an alternate for any mounting node. So the only
  14663. // way this could possibly happen is if this was unmounted, if at all.
  14664. {
  14665. {
  14666. throw Error( "Unable to find node on an unmounted component." );
  14667. }
  14668. }
  14669. }
  14670. if (a.return !== b.return) {
  14671. // The return pointer of A and the return pointer of B point to different
  14672. // fibers. We assume that return pointers never criss-cross, so A must
  14673. // belong to the child set of A.return, and B must belong to the child
  14674. // set of B.return.
  14675. a = parentA;
  14676. b = parentB;
  14677. } else {
  14678. // The return pointers point to the same fiber. We'll have to use the
  14679. // default, slow path: scan the child sets of each parent alternate to see
  14680. // which child belongs to which set.
  14681. //
  14682. // Search parent A's child set
  14683. var didFindChild = false;
  14684. var _child = parentA.child;
  14685. while (_child) {
  14686. if (_child === a) {
  14687. didFindChild = true;
  14688. a = parentA;
  14689. b = parentB;
  14690. break;
  14691. }
  14692. if (_child === b) {
  14693. didFindChild = true;
  14694. b = parentA;
  14695. a = parentB;
  14696. break;
  14697. }
  14698. _child = _child.sibling;
  14699. }
  14700. if (!didFindChild) {
  14701. // Search parent B's child set
  14702. _child = parentB.child;
  14703. while (_child) {
  14704. if (_child === a) {
  14705. didFindChild = true;
  14706. a = parentB;
  14707. b = parentA;
  14708. break;
  14709. }
  14710. if (_child === b) {
  14711. didFindChild = true;
  14712. b = parentB;
  14713. a = parentA;
  14714. break;
  14715. }
  14716. _child = _child.sibling;
  14717. }
  14718. if (!didFindChild) {
  14719. {
  14720. throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." );
  14721. }
  14722. }
  14723. }
  14724. }
  14725. if (!(a.alternate === b)) {
  14726. {
  14727. throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." );
  14728. }
  14729. }
  14730. } // If the root is not a host container, we're in a disconnected tree. I.e.
  14731. // unmounted.
  14732. if (!(a.tag === HostRoot)) {
  14733. {
  14734. throw Error( "Unable to find node on an unmounted component." );
  14735. }
  14736. }
  14737. if (a.stateNode.current === a) {
  14738. // We've determined that A is the current branch.
  14739. return fiber;
  14740. } // Otherwise B has to be current branch.
  14741. return alternate;
  14742. }
  14743. function findCurrentHostFiber(parent) {
  14744. var currentParent = findCurrentFiberUsingSlowPath(parent);
  14745. if (!currentParent) {
  14746. return null;
  14747. } // Next we'll drill down this component to find the first HostComponent/Text.
  14748. var node = currentParent;
  14749. while (true) {
  14750. if (node.tag === HostComponent || node.tag === HostText) {
  14751. return node;
  14752. } else if (node.child) {
  14753. node.child.return = node;
  14754. node = node.child;
  14755. continue;
  14756. }
  14757. if (node === currentParent) {
  14758. return null;
  14759. }
  14760. while (!node.sibling) {
  14761. if (!node.return || node.return === currentParent) {
  14762. return null;
  14763. }
  14764. node = node.return;
  14765. }
  14766. node.sibling.return = node.return;
  14767. node = node.sibling;
  14768. } // Flow needs the return null here, but ESLint complains about it.
  14769. // eslint-disable-next-line no-unreachable
  14770. return null;
  14771. }
  14772. function findCurrentHostFiberWithNoPortals(parent) {
  14773. var currentParent = findCurrentFiberUsingSlowPath(parent);
  14774. if (!currentParent) {
  14775. return null;
  14776. } // Next we'll drill down this component to find the first HostComponent/Text.
  14777. var node = currentParent;
  14778. while (true) {
  14779. if (node.tag === HostComponent || node.tag === HostText || enableFundamentalAPI ) {
  14780. return node;
  14781. } else if (node.child && node.tag !== HostPortal) {
  14782. node.child.return = node;
  14783. node = node.child;
  14784. continue;
  14785. }
  14786. if (node === currentParent) {
  14787. return null;
  14788. }
  14789. while (!node.sibling) {
  14790. if (!node.return || node.return === currentParent) {
  14791. return null;
  14792. }
  14793. node = node.return;
  14794. }
  14795. node.sibling.return = node.return;
  14796. node = node.sibling;
  14797. } // Flow needs the return null here, but ESLint complains about it.
  14798. // eslint-disable-next-line no-unreachable
  14799. return null;
  14800. }
  14801. /**
  14802. * Accumulates items that must not be null or undefined into the first one. This
  14803. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  14804. * API cleanness. Since `current` can be null before being passed in and not
  14805. * null after this function, make sure to assign it back to `current`:
  14806. *
  14807. * `a = accumulateInto(a, b);`
  14808. *
  14809. * This API should be sparingly used. Try `accumulate` for something cleaner.
  14810. *
  14811. * @return {*|array<*>} An accumulation of items.
  14812. */
  14813. function accumulateInto(current, next) {
  14814. if (!(next != null)) {
  14815. {
  14816. throw Error( "accumulateInto(...): Accumulated items must not be null or undefined." );
  14817. }
  14818. }
  14819. if (current == null) {
  14820. return next;
  14821. } // Both are not empty. Warning: Never call x.concat(y) when you are not
  14822. // certain that x is an Array (x could be a string with concat method).
  14823. if (Array.isArray(current)) {
  14824. if (Array.isArray(next)) {
  14825. current.push.apply(current, next);
  14826. return current;
  14827. }
  14828. current.push(next);
  14829. return current;
  14830. }
  14831. if (Array.isArray(next)) {
  14832. // A bit too dangerous to mutate `next`.
  14833. return [current].concat(next);
  14834. }
  14835. return [current, next];
  14836. }
  14837. /**
  14838. * @param {array} arr an "accumulation" of items which is either an Array or
  14839. * a single item. Useful when paired with the `accumulate` module. This is a
  14840. * simple utility that allows us to reason about a collection of items, but
  14841. * handling the case when there is exactly one item (and we do not need to
  14842. * allocate an array).
  14843. * @param {function} cb Callback invoked with each element or a collection.
  14844. * @param {?} [scope] Scope used as `this` in a callback.
  14845. */
  14846. function forEachAccumulated(arr, cb, scope) {
  14847. if (Array.isArray(arr)) {
  14848. arr.forEach(cb, scope);
  14849. } else if (arr) {
  14850. cb.call(scope, arr);
  14851. }
  14852. }
  14853. /**
  14854. * Internal queue of events that have accumulated their dispatches and are
  14855. * waiting to have their dispatches executed.
  14856. */
  14857. var eventQueue = null;
  14858. /**
  14859. * Dispatches an event and releases it back into the pool, unless persistent.
  14860. *
  14861. * @param {?object} event Synthetic event to be dispatched.
  14862. * @private
  14863. */
  14864. var executeDispatchesAndRelease = function (event) {
  14865. if (event) {
  14866. executeDispatchesInOrder(event);
  14867. if (!event.isPersistent()) {
  14868. event.constructor.release(event);
  14869. }
  14870. }
  14871. };
  14872. var executeDispatchesAndReleaseTopLevel = function (e) {
  14873. return executeDispatchesAndRelease(e);
  14874. };
  14875. function runEventsInBatch(events) {
  14876. if (events !== null) {
  14877. eventQueue = accumulateInto(eventQueue, events);
  14878. } // Set `eventQueue` to null before processing it so that we can tell if more
  14879. // events get enqueued while processing.
  14880. var processingEventQueue = eventQueue;
  14881. eventQueue = null;
  14882. if (!processingEventQueue) {
  14883. return;
  14884. }
  14885. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  14886. if (!!eventQueue) {
  14887. {
  14888. throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." );
  14889. }
  14890. } // This would be a good time to rethrow if any of the event handlers threw.
  14891. rethrowCaughtError();
  14892. }
  14893. /**
  14894. * Gets the target node from a native browser event by accounting for
  14895. * inconsistencies in browser DOM APIs.
  14896. *
  14897. * @param {object} nativeEvent Native browser event.
  14898. * @return {DOMEventTarget} Target node.
  14899. */
  14900. function getEventTarget(nativeEvent) {
  14901. // Fallback to nativeEvent.srcElement for IE9
  14902. // https://github.com/facebook/react/issues/12506
  14903. var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963
  14904. if (target.correspondingUseElement) {
  14905. target = target.correspondingUseElement;
  14906. } // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  14907. // @see http://www.quirksmode.org/js/events_properties.html
  14908. return target.nodeType === TEXT_NODE ? target.parentNode : target;
  14909. }
  14910. /**
  14911. * Checks if an event is supported in the current execution environment.
  14912. *
  14913. * NOTE: This will not work correctly for non-generic events such as `change`,
  14914. * `reset`, `load`, `error`, and `select`.
  14915. *
  14916. * Borrows from Modernizr.
  14917. *
  14918. * @param {string} eventNameSuffix Event name, e.g. "click".
  14919. * @return {boolean} True if the event is supported.
  14920. * @internal
  14921. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  14922. */
  14923. function isEventSupported(eventNameSuffix) {
  14924. if (!canUseDOM) {
  14925. return false;
  14926. }
  14927. var eventName = 'on' + eventNameSuffix;
  14928. var isSupported = eventName in document;
  14929. if (!isSupported) {
  14930. var element = document.createElement('div');
  14931. element.setAttribute(eventName, 'return;');
  14932. isSupported = typeof element[eventName] === 'function';
  14933. }
  14934. return isSupported;
  14935. }
  14936. /**
  14937. * Summary of `DOMEventPluginSystem` event handling:
  14938. *
  14939. * - Top-level delegation is used to trap most native browser events. This
  14940. * may only occur in the main thread and is the responsibility of
  14941. * ReactDOMEventListener, which is injected and can therefore support
  14942. * pluggable event sources. This is the only work that occurs in the main
  14943. * thread.
  14944. *
  14945. * - We normalize and de-duplicate events to account for browser quirks. This
  14946. * may be done in the worker thread.
  14947. *
  14948. * - Forward these native events (with the associated top-level type used to
  14949. * trap it) to `EventPluginRegistry`, which in turn will ask plugins if they want
  14950. * to extract any synthetic events.
  14951. *
  14952. * - The `EventPluginRegistry` will then process each event by annotating them with
  14953. * "dispatches", a sequence of listeners and IDs that care about that event.
  14954. *
  14955. * - The `EventPluginRegistry` then dispatches the events.
  14956. *
  14957. * Overview of React and the event system:
  14958. *
  14959. * +------------+ .
  14960. * | DOM | .
  14961. * +------------+ .
  14962. * | .
  14963. * v .
  14964. * +------------+ .
  14965. * | ReactEvent | .
  14966. * | Listener | .
  14967. * +------------+ . +-----------+
  14968. * | . +--------+|SimpleEvent|
  14969. * | . | |Plugin |
  14970. * +-----|------+ . v +-----------+
  14971. * | | | . +--------------+ +------------+
  14972. * | +-----------.--->|PluginRegistry| | Event |
  14973. * | | . | | +-----------+ | Propagators|
  14974. * | ReactEvent | . | | |TapEvent | |------------|
  14975. * | Emitter | . | |<---+|Plugin | |other plugin|
  14976. * | | . | | +-----------+ | utilities |
  14977. * | +-----------.--->| | +------------+
  14978. * | | | . +--------------+
  14979. * +-----|------+ . ^ +-----------+
  14980. * | . | |Enter/Leave|
  14981. * + . +-------+|Plugin |
  14982. * +-------------+ . +-----------+
  14983. * | application | .
  14984. * |-------------| .
  14985. * | | .
  14986. * | | .
  14987. * +-------------+ .
  14988. * .
  14989. * React Core . General Purpose Event Plugin System
  14990. */
  14991. var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
  14992. var callbackBookkeepingPool = [];
  14993. function releaseTopLevelCallbackBookKeeping(instance) {
  14994. instance.topLevelType = null;
  14995. instance.nativeEvent = null;
  14996. instance.targetInst = null;
  14997. instance.ancestors.length = 0;
  14998. if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
  14999. callbackBookkeepingPool.push(instance);
  15000. }
  15001. } // Used to store ancestor hierarchy in top level callback
  15002. function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags) {
  15003. if (callbackBookkeepingPool.length) {
  15004. var instance = callbackBookkeepingPool.pop();
  15005. instance.topLevelType = topLevelType;
  15006. instance.eventSystemFlags = eventSystemFlags;
  15007. instance.nativeEvent = nativeEvent;
  15008. instance.targetInst = targetInst;
  15009. return instance;
  15010. }
  15011. return {
  15012. topLevelType: topLevelType,
  15013. eventSystemFlags: eventSystemFlags,
  15014. nativeEvent: nativeEvent,
  15015. targetInst: targetInst,
  15016. ancestors: []
  15017. };
  15018. }
  15019. /**
  15020. * Find the deepest React component completely containing the root of the
  15021. * passed-in instance (for use when entire React trees are nested within each
  15022. * other). If React trees are not nested, returns null.
  15023. */
  15024. function findRootContainerNode(inst) {
  15025. if (inst.tag === HostRoot) {
  15026. return inst.stateNode.containerInfo;
  15027. } // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  15028. // traversal, but caching is difficult to do correctly without using a
  15029. // mutation observer to listen for all DOM changes.
  15030. while (inst.return) {
  15031. inst = inst.return;
  15032. }
  15033. if (inst.tag !== HostRoot) {
  15034. // This can happen if we're in a detached tree.
  15035. return null;
  15036. }
  15037. return inst.stateNode.containerInfo;
  15038. }
  15039. /**
  15040. * Allows registered plugins an opportunity to extract events from top-level
  15041. * native browser events.
  15042. *
  15043. * @return {*} An accumulation of synthetic events.
  15044. * @internal
  15045. */
  15046. function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  15047. var events = null;
  15048. for (var i = 0; i < plugins.length; i++) {
  15049. // Not every plugin in the ordering may be loaded at runtime.
  15050. var possiblePlugin = plugins[i];
  15051. if (possiblePlugin) {
  15052. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
  15053. if (extractedEvents) {
  15054. events = accumulateInto(events, extractedEvents);
  15055. }
  15056. }
  15057. }
  15058. return events;
  15059. }
  15060. function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  15061. var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
  15062. runEventsInBatch(events);
  15063. }
  15064. function handleTopLevel(bookKeeping) {
  15065. var targetInst = bookKeeping.targetInst; // Loop through the hierarchy, in case there's any nested components.
  15066. // It's important that we build the array of ancestors before calling any
  15067. // event handlers, because event handlers can modify the DOM, leading to
  15068. // inconsistencies with ReactMount's node cache. See #1105.
  15069. var ancestor = targetInst;
  15070. do {
  15071. if (!ancestor) {
  15072. var ancestors = bookKeeping.ancestors;
  15073. ancestors.push(ancestor);
  15074. break;
  15075. }
  15076. var root = findRootContainerNode(ancestor);
  15077. if (!root) {
  15078. break;
  15079. }
  15080. var tag = ancestor.tag;
  15081. if (tag === HostComponent || tag === HostText) {
  15082. bookKeeping.ancestors.push(ancestor);
  15083. }
  15084. ancestor = getClosestInstanceFromNode(root);
  15085. } while (ancestor);
  15086. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  15087. targetInst = bookKeeping.ancestors[i];
  15088. var eventTarget = getEventTarget(bookKeeping.nativeEvent);
  15089. var topLevelType = bookKeeping.topLevelType;
  15090. var nativeEvent = bookKeeping.nativeEvent;
  15091. var eventSystemFlags = bookKeeping.eventSystemFlags; // If this is the first ancestor, we mark it on the system flags
  15092. if (i === 0) {
  15093. eventSystemFlags |= IS_FIRST_ANCESTOR;
  15094. }
  15095. runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, eventTarget, eventSystemFlags);
  15096. }
  15097. }
  15098. function dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) {
  15099. var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags);
  15100. try {
  15101. // Event queue being processed in the same cycle allows
  15102. // `preventDefault`.
  15103. batchedEventUpdates(handleTopLevel, bookKeeping);
  15104. } finally {
  15105. releaseTopLevelCallbackBookKeeping(bookKeeping);
  15106. }
  15107. }
  15108. /**
  15109. * We listen for bubbled touch events on the document object.
  15110. *
  15111. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  15112. * mounting `onmousemove` events at some node that was not the document
  15113. * element. The symptoms were that if your mouse is not moving over something
  15114. * contained within that mount point (for example on the background) the
  15115. * top-level listeners for `onmousemove` won't be called. However, if you
  15116. * register the `mousemove` on the document object, then it will of course
  15117. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  15118. * top-level listeners to the document object only, at least for these
  15119. * movement types of events and possibly all events.
  15120. *
  15121. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  15122. *
  15123. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  15124. * they bubble to document.
  15125. *
  15126. * @param {string} registrationName Name of listener (e.g. `onClick`).
  15127. * @param {object} mountAt Container where to mount the listener
  15128. */
  15129. function legacyListenToEvent(registrationName, mountAt) {
  15130. var listenerMap = getListenerMapForElement(mountAt);
  15131. var dependencies = registrationNameDependencies[registrationName];
  15132. for (var i = 0; i < dependencies.length; i++) {
  15133. var dependency = dependencies[i];
  15134. legacyListenToTopLevelEvent(dependency, mountAt, listenerMap);
  15135. }
  15136. }
  15137. function legacyListenToTopLevelEvent(topLevelType, mountAt, listenerMap) {
  15138. if (!listenerMap.has(topLevelType)) {
  15139. switch (topLevelType) {
  15140. case TOP_SCROLL:
  15141. trapCapturedEvent(TOP_SCROLL, mountAt);
  15142. break;
  15143. case TOP_FOCUS:
  15144. case TOP_BLUR:
  15145. trapCapturedEvent(TOP_FOCUS, mountAt);
  15146. trapCapturedEvent(TOP_BLUR, mountAt); // We set the flag for a single dependency later in this function,
  15147. // but this ensures we mark both as attached rather than just one.
  15148. listenerMap.set(TOP_BLUR, null);
  15149. listenerMap.set(TOP_FOCUS, null);
  15150. break;
  15151. case TOP_CANCEL:
  15152. case TOP_CLOSE:
  15153. if (isEventSupported(getRawEventName(topLevelType))) {
  15154. trapCapturedEvent(topLevelType, mountAt);
  15155. }
  15156. break;
  15157. case TOP_INVALID:
  15158. case TOP_SUBMIT:
  15159. case TOP_RESET:
  15160. // We listen to them on the target DOM elements.
  15161. // Some of them bubble so we don't want them to fire twice.
  15162. break;
  15163. default:
  15164. // By default, listen on the top level to all non-media events.
  15165. // Media events don't bubble so adding the listener wouldn't do anything.
  15166. var isMediaEvent = mediaEventTypes.indexOf(topLevelType) !== -1;
  15167. if (!isMediaEvent) {
  15168. trapBubbledEvent(topLevelType, mountAt);
  15169. }
  15170. break;
  15171. }
  15172. listenerMap.set(topLevelType, null);
  15173. }
  15174. }
  15175. function isListeningToAllDependencies(registrationName, mountAt) {
  15176. var listenerMap = getListenerMapForElement(mountAt);
  15177. var dependencies = registrationNameDependencies[registrationName];
  15178. for (var i = 0; i < dependencies.length; i++) {
  15179. var dependency = dependencies[i];
  15180. if (!listenerMap.has(dependency)) {
  15181. return false;
  15182. }
  15183. }
  15184. return true;
  15185. }
  15186. var attemptUserBlockingHydration;
  15187. function setAttemptUserBlockingHydration(fn) {
  15188. attemptUserBlockingHydration = fn;
  15189. }
  15190. var attemptContinuousHydration;
  15191. function setAttemptContinuousHydration(fn) {
  15192. attemptContinuousHydration = fn;
  15193. }
  15194. var attemptHydrationAtCurrentPriority;
  15195. function setAttemptHydrationAtCurrentPriority(fn) {
  15196. attemptHydrationAtCurrentPriority = fn;
  15197. } // TODO: Upgrade this definition once we're on a newer version of Flow that
  15198. var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed.
  15199. var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout.
  15200. // if the last target was dehydrated.
  15201. var queuedFocus = null;
  15202. var queuedDrag = null;
  15203. var queuedMouse = null; // For pointer events there can be one latest event per pointerId.
  15204. var queuedPointers = new Map();
  15205. var queuedPointerCaptures = new Map(); // We could consider replaying selectionchange and touchmoves too.
  15206. var queuedExplicitHydrationTargets = [];
  15207. function hasQueuedDiscreteEvents() {
  15208. return queuedDiscreteEvents.length > 0;
  15209. }
  15210. var discreteReplayableEvents = [TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_TOUCH_START, TOP_AUX_CLICK, TOP_DOUBLE_CLICK, TOP_POINTER_CANCEL, TOP_POINTER_DOWN, TOP_POINTER_UP, TOP_DRAG_END, TOP_DRAG_START, TOP_DROP, TOP_COMPOSITION_END, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_INPUT, TOP_TEXT_INPUT, TOP_CLOSE, TOP_CANCEL, TOP_COPY, TOP_CUT, TOP_PASTE, TOP_CLICK, TOP_CHANGE, TOP_CONTEXT_MENU, TOP_RESET, TOP_SUBMIT];
  15211. var continuousReplayableEvents = [TOP_FOCUS, TOP_BLUR, TOP_DRAG_ENTER, TOP_DRAG_LEAVE, TOP_MOUSE_OVER, TOP_MOUSE_OUT, TOP_POINTER_OVER, TOP_POINTER_OUT, TOP_GOT_POINTER_CAPTURE, TOP_LOST_POINTER_CAPTURE];
  15212. function isReplayableDiscreteEvent(eventType) {
  15213. return discreteReplayableEvents.indexOf(eventType) > -1;
  15214. }
  15215. function trapReplayableEventForDocument(topLevelType, document, listenerMap) {
  15216. legacyListenToTopLevelEvent(topLevelType, document, listenerMap);
  15217. }
  15218. function eagerlyTrapReplayableEvents(container, document) {
  15219. var listenerMapForDoc = getListenerMapForElement(document); // Discrete
  15220. discreteReplayableEvents.forEach(function (topLevelType) {
  15221. trapReplayableEventForDocument(topLevelType, document, listenerMapForDoc);
  15222. }); // Continuous
  15223. continuousReplayableEvents.forEach(function (topLevelType) {
  15224. trapReplayableEventForDocument(topLevelType, document, listenerMapForDoc);
  15225. });
  15226. }
  15227. function createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
  15228. return {
  15229. blockedOn: blockedOn,
  15230. topLevelType: topLevelType,
  15231. eventSystemFlags: eventSystemFlags | IS_REPLAYED,
  15232. nativeEvent: nativeEvent,
  15233. container: container
  15234. };
  15235. }
  15236. function queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
  15237. var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
  15238. queuedDiscreteEvents.push(queuedEvent);
  15239. } // Resets the replaying for this type of continuous event to no event.
  15240. function clearIfContinuousEvent(topLevelType, nativeEvent) {
  15241. switch (topLevelType) {
  15242. case TOP_FOCUS:
  15243. case TOP_BLUR:
  15244. queuedFocus = null;
  15245. break;
  15246. case TOP_DRAG_ENTER:
  15247. case TOP_DRAG_LEAVE:
  15248. queuedDrag = null;
  15249. break;
  15250. case TOP_MOUSE_OVER:
  15251. case TOP_MOUSE_OUT:
  15252. queuedMouse = null;
  15253. break;
  15254. case TOP_POINTER_OVER:
  15255. case TOP_POINTER_OUT:
  15256. {
  15257. var pointerId = nativeEvent.pointerId;
  15258. queuedPointers.delete(pointerId);
  15259. break;
  15260. }
  15261. case TOP_GOT_POINTER_CAPTURE:
  15262. case TOP_LOST_POINTER_CAPTURE:
  15263. {
  15264. var _pointerId = nativeEvent.pointerId;
  15265. queuedPointerCaptures.delete(_pointerId);
  15266. break;
  15267. }
  15268. }
  15269. }
  15270. function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
  15271. if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
  15272. var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
  15273. if (blockedOn !== null) {
  15274. var _fiber2 = getInstanceFromNode$1(blockedOn);
  15275. if (_fiber2 !== null) {
  15276. // Attempt to increase the priority of this target.
  15277. attemptContinuousHydration(_fiber2);
  15278. }
  15279. }
  15280. return queuedEvent;
  15281. } // If we have already queued this exact event, then it's because
  15282. // the different event systems have different DOM event listeners.
  15283. // We can accumulate the flags and store a single event to be
  15284. // replayed.
  15285. existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
  15286. return existingQueuedEvent;
  15287. }
  15288. function queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
  15289. // These set relatedTarget to null because the replayed event will be treated as if we
  15290. // moved from outside the window (no target) onto the target once it hydrates.
  15291. // Instead of mutating we could clone the event.
  15292. switch (topLevelType) {
  15293. case TOP_FOCUS:
  15294. {
  15295. var focusEvent = nativeEvent;
  15296. queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, topLevelType, eventSystemFlags, container, focusEvent);
  15297. return true;
  15298. }
  15299. case TOP_DRAG_ENTER:
  15300. {
  15301. var dragEvent = nativeEvent;
  15302. queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, topLevelType, eventSystemFlags, container, dragEvent);
  15303. return true;
  15304. }
  15305. case TOP_MOUSE_OVER:
  15306. {
  15307. var mouseEvent = nativeEvent;
  15308. queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, topLevelType, eventSystemFlags, container, mouseEvent);
  15309. return true;
  15310. }
  15311. case TOP_POINTER_OVER:
  15312. {
  15313. var pointerEvent = nativeEvent;
  15314. var pointerId = pointerEvent.pointerId;
  15315. queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, topLevelType, eventSystemFlags, container, pointerEvent));
  15316. return true;
  15317. }
  15318. case TOP_GOT_POINTER_CAPTURE:
  15319. {
  15320. var _pointerEvent = nativeEvent;
  15321. var _pointerId2 = _pointerEvent.pointerId;
  15322. queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, topLevelType, eventSystemFlags, container, _pointerEvent));
  15323. return true;
  15324. }
  15325. }
  15326. return false;
  15327. } // Check if this target is unblocked. Returns true if it's unblocked.
  15328. function attemptExplicitHydrationTarget(queuedTarget) {
  15329. // TODO: This function shares a lot of logic with attemptToDispatchEvent.
  15330. // Try to unify them. It's a bit tricky since it would require two return
  15331. // values.
  15332. var targetInst = getClosestInstanceFromNode(queuedTarget.target);
  15333. if (targetInst !== null) {
  15334. var nearestMounted = getNearestMountedFiber(targetInst);
  15335. if (nearestMounted !== null) {
  15336. var tag = nearestMounted.tag;
  15337. if (tag === SuspenseComponent) {
  15338. var instance = getSuspenseInstanceFromFiber(nearestMounted);
  15339. if (instance !== null) {
  15340. // We're blocked on hydrating this boundary.
  15341. // Increase its priority.
  15342. queuedTarget.blockedOn = instance;
  15343. Scheduler.unstable_runWithPriority(queuedTarget.priority, function () {
  15344. attemptHydrationAtCurrentPriority(nearestMounted);
  15345. });
  15346. return;
  15347. }
  15348. } else if (tag === HostRoot) {
  15349. var root = nearestMounted.stateNode;
  15350. if (root.hydrate) {
  15351. queuedTarget.blockedOn = getContainerFromFiber(nearestMounted); // We don't currently have a way to increase the priority of
  15352. // a root other than sync.
  15353. return;
  15354. }
  15355. }
  15356. }
  15357. }
  15358. queuedTarget.blockedOn = null;
  15359. }
  15360. function attemptReplayContinuousQueuedEvent(queuedEvent) {
  15361. if (queuedEvent.blockedOn !== null) {
  15362. return false;
  15363. }
  15364. var nextBlockedOn = attemptToDispatchEvent(queuedEvent.topLevelType, queuedEvent.eventSystemFlags, queuedEvent.container, queuedEvent.nativeEvent);
  15365. if (nextBlockedOn !== null) {
  15366. // We're still blocked. Try again later.
  15367. var _fiber3 = getInstanceFromNode$1(nextBlockedOn);
  15368. if (_fiber3 !== null) {
  15369. attemptContinuousHydration(_fiber3);
  15370. }
  15371. queuedEvent.blockedOn = nextBlockedOn;
  15372. return false;
  15373. }
  15374. return true;
  15375. }
  15376. function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) {
  15377. if (attemptReplayContinuousQueuedEvent(queuedEvent)) {
  15378. map.delete(key);
  15379. }
  15380. }
  15381. function replayUnblockedEvents() {
  15382. hasScheduledReplayAttempt = false; // First replay discrete events.
  15383. while (queuedDiscreteEvents.length > 0) {
  15384. var nextDiscreteEvent = queuedDiscreteEvents[0];
  15385. if (nextDiscreteEvent.blockedOn !== null) {
  15386. // We're still blocked.
  15387. // Increase the priority of this boundary to unblock
  15388. // the next discrete event.
  15389. var _fiber4 = getInstanceFromNode$1(nextDiscreteEvent.blockedOn);
  15390. if (_fiber4 !== null) {
  15391. attemptUserBlockingHydration(_fiber4);
  15392. }
  15393. break;
  15394. }
  15395. var nextBlockedOn = attemptToDispatchEvent(nextDiscreteEvent.topLevelType, nextDiscreteEvent.eventSystemFlags, nextDiscreteEvent.container, nextDiscreteEvent.nativeEvent);
  15396. if (nextBlockedOn !== null) {
  15397. // We're still blocked. Try again later.
  15398. nextDiscreteEvent.blockedOn = nextBlockedOn;
  15399. } else {
  15400. // We've successfully replayed the first event. Let's try the next one.
  15401. queuedDiscreteEvents.shift();
  15402. }
  15403. } // Next replay any continuous events.
  15404. if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) {
  15405. queuedFocus = null;
  15406. }
  15407. if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) {
  15408. queuedDrag = null;
  15409. }
  15410. if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) {
  15411. queuedMouse = null;
  15412. }
  15413. queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap);
  15414. queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap);
  15415. }
  15416. function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
  15417. if (queuedEvent.blockedOn === unblocked) {
  15418. queuedEvent.blockedOn = null;
  15419. if (!hasScheduledReplayAttempt) {
  15420. hasScheduledReplayAttempt = true; // Schedule a callback to attempt replaying as many events as are
  15421. // now unblocked. This first might not actually be unblocked yet.
  15422. // We could check it early to avoid scheduling an unnecessary callback.
  15423. Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents);
  15424. }
  15425. }
  15426. }
  15427. function retryIfBlockedOn(unblocked) {
  15428. // Mark anything that was blocked on this as no longer blocked
  15429. // and eligible for a replay.
  15430. if (queuedDiscreteEvents.length > 0) {
  15431. scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's
  15432. // worth it because we expect very few discrete events to queue up and once
  15433. // we are actually fully unblocked it will be fast to replay them.
  15434. for (var i = 1; i < queuedDiscreteEvents.length; i++) {
  15435. var queuedEvent = queuedDiscreteEvents[i];
  15436. if (queuedEvent.blockedOn === unblocked) {
  15437. queuedEvent.blockedOn = null;
  15438. }
  15439. }
  15440. }
  15441. if (queuedFocus !== null) {
  15442. scheduleCallbackIfUnblocked(queuedFocus, unblocked);
  15443. }
  15444. if (queuedDrag !== null) {
  15445. scheduleCallbackIfUnblocked(queuedDrag, unblocked);
  15446. }
  15447. if (queuedMouse !== null) {
  15448. scheduleCallbackIfUnblocked(queuedMouse, unblocked);
  15449. }
  15450. var unblock = function (queuedEvent) {
  15451. return scheduleCallbackIfUnblocked(queuedEvent, unblocked);
  15452. };
  15453. queuedPointers.forEach(unblock);
  15454. queuedPointerCaptures.forEach(unblock);
  15455. for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
  15456. var queuedTarget = queuedExplicitHydrationTargets[_i];
  15457. if (queuedTarget.blockedOn === unblocked) {
  15458. queuedTarget.blockedOn = null;
  15459. }
  15460. }
  15461. while (queuedExplicitHydrationTargets.length > 0) {
  15462. var nextExplicitTarget = queuedExplicitHydrationTargets[0];
  15463. if (nextExplicitTarget.blockedOn !== null) {
  15464. // We're still blocked.
  15465. break;
  15466. } else {
  15467. attemptExplicitHydrationTarget(nextExplicitTarget);
  15468. if (nextExplicitTarget.blockedOn === null) {
  15469. // We're unblocked.
  15470. queuedExplicitHydrationTargets.shift();
  15471. }
  15472. }
  15473. }
  15474. }
  15475. function addEventBubbleListener(element, eventType, listener) {
  15476. element.addEventListener(eventType, listener, false);
  15477. }
  15478. function addEventCaptureListener(element, eventType, listener) {
  15479. element.addEventListener(eventType, listener, true);
  15480. }
  15481. // do it in two places, which duplicates logic
  15482. // and increases the bundle size, we do it all
  15483. // here once. If we remove or refactor the
  15484. // SimpleEventPlugin, we should also remove or
  15485. // update the below line.
  15486. var simpleEventPluginEventTypes = {};
  15487. var topLevelEventsToDispatchConfig = new Map();
  15488. var eventPriorities = new Map(); // We store most of the events in this module in pairs of two strings so we can re-use
  15489. // the code required to apply the same logic for event prioritization and that of the
  15490. // SimpleEventPlugin. This complicates things slightly, but the aim is to reduce code
  15491. // duplication (for which there would be quite a bit). For the events that are not needed
  15492. // for the SimpleEventPlugin (otherDiscreteEvents) we process them separately as an
  15493. // array of top level events.
  15494. // Lastly, we ignore prettier so we can keep the formatting sane.
  15495. // prettier-ignore
  15496. var discreteEventPairsForSimpleEventPlugin = [TOP_BLUR, 'blur', TOP_CANCEL, 'cancel', TOP_CLICK, 'click', TOP_CLOSE, 'close', TOP_CONTEXT_MENU, 'contextMenu', TOP_COPY, 'copy', TOP_CUT, 'cut', TOP_AUX_CLICK, 'auxClick', TOP_DOUBLE_CLICK, 'doubleClick', TOP_DRAG_END, 'dragEnd', TOP_DRAG_START, 'dragStart', TOP_DROP, 'drop', TOP_FOCUS, 'focus', TOP_INPUT, 'input', TOP_INVALID, 'invalid', TOP_KEY_DOWN, 'keyDown', TOP_KEY_PRESS, 'keyPress', TOP_KEY_UP, 'keyUp', TOP_MOUSE_DOWN, 'mouseDown', TOP_MOUSE_UP, 'mouseUp', TOP_PASTE, 'paste', TOP_PAUSE, 'pause', TOP_PLAY, 'play', TOP_POINTER_CANCEL, 'pointerCancel', TOP_POINTER_DOWN, 'pointerDown', TOP_POINTER_UP, 'pointerUp', TOP_RATE_CHANGE, 'rateChange', TOP_RESET, 'reset', TOP_SEEKED, 'seeked', TOP_SUBMIT, 'submit', TOP_TOUCH_CANCEL, 'touchCancel', TOP_TOUCH_END, 'touchEnd', TOP_TOUCH_START, 'touchStart', TOP_VOLUME_CHANGE, 'volumeChange'];
  15497. var otherDiscreteEvents = [TOP_CHANGE, TOP_SELECTION_CHANGE, TOP_TEXT_INPUT, TOP_COMPOSITION_START, TOP_COMPOSITION_END, TOP_COMPOSITION_UPDATE]; // prettier-ignore
  15498. var userBlockingPairsForSimpleEventPlugin = [TOP_DRAG, 'drag', TOP_DRAG_ENTER, 'dragEnter', TOP_DRAG_EXIT, 'dragExit', TOP_DRAG_LEAVE, 'dragLeave', TOP_DRAG_OVER, 'dragOver', TOP_MOUSE_MOVE, 'mouseMove', TOP_MOUSE_OUT, 'mouseOut', TOP_MOUSE_OVER, 'mouseOver', TOP_POINTER_MOVE, 'pointerMove', TOP_POINTER_OUT, 'pointerOut', TOP_POINTER_OVER, 'pointerOver', TOP_SCROLL, 'scroll', TOP_TOGGLE, 'toggle', TOP_TOUCH_MOVE, 'touchMove', TOP_WHEEL, 'wheel']; // prettier-ignore
  15499. var continuousPairsForSimpleEventPlugin = [TOP_ABORT, 'abort', TOP_ANIMATION_END, 'animationEnd', TOP_ANIMATION_ITERATION, 'animationIteration', TOP_ANIMATION_START, 'animationStart', TOP_CAN_PLAY, 'canPlay', TOP_CAN_PLAY_THROUGH, 'canPlayThrough', TOP_DURATION_CHANGE, 'durationChange', TOP_EMPTIED, 'emptied', TOP_ENCRYPTED, 'encrypted', TOP_ENDED, 'ended', TOP_ERROR, 'error', TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture', TOP_LOAD, 'load', TOP_LOADED_DATA, 'loadedData', TOP_LOADED_METADATA, 'loadedMetadata', TOP_LOAD_START, 'loadStart', TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture', TOP_PLAYING, 'playing', TOP_PROGRESS, 'progress', TOP_SEEKING, 'seeking', TOP_STALLED, 'stalled', TOP_SUSPEND, 'suspend', TOP_TIME_UPDATE, 'timeUpdate', TOP_TRANSITION_END, 'transitionEnd', TOP_WAITING, 'waiting'];
  15500. /**
  15501. * Turns
  15502. * ['abort', ...]
  15503. * into
  15504. * eventTypes = {
  15505. * 'abort': {
  15506. * phasedRegistrationNames: {
  15507. * bubbled: 'onAbort',
  15508. * captured: 'onAbortCapture',
  15509. * },
  15510. * dependencies: [TOP_ABORT],
  15511. * },
  15512. * ...
  15513. * };
  15514. * topLevelEventsToDispatchConfig = new Map([
  15515. * [TOP_ABORT, { sameConfig }],
  15516. * ]);
  15517. */
  15518. function processSimpleEventPluginPairsByPriority(eventTypes, priority) {
  15519. // As the event types are in pairs of two, we need to iterate
  15520. // through in twos. The events are in pairs of two to save code
  15521. // and improve init perf of processing this array, as it will
  15522. // result in far fewer object allocations and property accesses
  15523. // if we only use three arrays to process all the categories of
  15524. // instead of tuples.
  15525. for (var i = 0; i < eventTypes.length; i += 2) {
  15526. var topEvent = eventTypes[i];
  15527. var event = eventTypes[i + 1];
  15528. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  15529. var onEvent = 'on' + capitalizedEvent;
  15530. var config = {
  15531. phasedRegistrationNames: {
  15532. bubbled: onEvent,
  15533. captured: onEvent + 'Capture'
  15534. },
  15535. dependencies: [topEvent],
  15536. eventPriority: priority
  15537. };
  15538. eventPriorities.set(topEvent, priority);
  15539. topLevelEventsToDispatchConfig.set(topEvent, config);
  15540. simpleEventPluginEventTypes[event] = config;
  15541. }
  15542. }
  15543. function processTopEventPairsByPriority(eventTypes, priority) {
  15544. for (var i = 0; i < eventTypes.length; i++) {
  15545. eventPriorities.set(eventTypes[i], priority);
  15546. }
  15547. } // SimpleEventPlugin
  15548. processSimpleEventPluginPairsByPriority(discreteEventPairsForSimpleEventPlugin, DiscreteEvent);
  15549. processSimpleEventPluginPairsByPriority(userBlockingPairsForSimpleEventPlugin, UserBlockingEvent);
  15550. processSimpleEventPluginPairsByPriority(continuousPairsForSimpleEventPlugin, ContinuousEvent); // Not used by SimpleEventPlugin
  15551. processTopEventPairsByPriority(otherDiscreteEvents, DiscreteEvent);
  15552. function getEventPriorityForPluginSystem(topLevelType) {
  15553. var priority = eventPriorities.get(topLevelType); // Default to a ContinuousEvent. Note: we might
  15554. // want to warn if we can't detect the priority
  15555. // for the event.
  15556. return priority === undefined ? ContinuousEvent : priority;
  15557. }
  15558. // Intentionally not named imports because Rollup would use dynamic dispatch for
  15559. var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority,
  15560. runWithPriority = Scheduler.unstable_runWithPriority; // TODO: can we stop exporting these?
  15561. var _enabled = true;
  15562. function setEnabled(enabled) {
  15563. _enabled = !!enabled;
  15564. }
  15565. function isEnabled() {
  15566. return _enabled;
  15567. }
  15568. function trapBubbledEvent(topLevelType, element) {
  15569. trapEventForPluginEventSystem(element, topLevelType, false);
  15570. }
  15571. function trapCapturedEvent(topLevelType, element) {
  15572. trapEventForPluginEventSystem(element, topLevelType, true);
  15573. }
  15574. function trapEventForPluginEventSystem(container, topLevelType, capture) {
  15575. var listener;
  15576. switch (getEventPriorityForPluginSystem(topLevelType)) {
  15577. case DiscreteEvent:
  15578. listener = dispatchDiscreteEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container);
  15579. break;
  15580. case UserBlockingEvent:
  15581. listener = dispatchUserBlockingUpdate.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container);
  15582. break;
  15583. case ContinuousEvent:
  15584. default:
  15585. listener = dispatchEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container);
  15586. break;
  15587. }
  15588. var rawEventName = getRawEventName(topLevelType);
  15589. if (capture) {
  15590. addEventCaptureListener(container, rawEventName, listener);
  15591. } else {
  15592. addEventBubbleListener(container, rawEventName, listener);
  15593. }
  15594. }
  15595. function dispatchDiscreteEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
  15596. flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp);
  15597. discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, container, nativeEvent);
  15598. }
  15599. function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, container, nativeEvent) {
  15600. runWithPriority(UserBlockingPriority, dispatchEvent.bind(null, topLevelType, eventSystemFlags, container, nativeEvent));
  15601. }
  15602. function dispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
  15603. if (!_enabled) {
  15604. return;
  15605. }
  15606. if (hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(topLevelType)) {
  15607. // If we already have a queue of discrete events, and this is another discrete
  15608. // event, then we can't dispatch it regardless of its target, since they
  15609. // need to dispatch in order.
  15610. queueDiscreteEvent(null, // Flags that we're not actually blocked on anything as far as we know.
  15611. topLevelType, eventSystemFlags, container, nativeEvent);
  15612. return;
  15613. }
  15614. var blockedOn = attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent);
  15615. if (blockedOn === null) {
  15616. // We successfully dispatched this event.
  15617. clearIfContinuousEvent(topLevelType, nativeEvent);
  15618. return;
  15619. }
  15620. if (isReplayableDiscreteEvent(topLevelType)) {
  15621. // This this to be replayed later once the target is available.
  15622. queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
  15623. return;
  15624. }
  15625. if (queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent)) {
  15626. return;
  15627. } // We need to clear only if we didn't queue because
  15628. // queueing is accummulative.
  15629. clearIfContinuousEvent(topLevelType, nativeEvent); // This is not replayable so we'll invoke it but without a target,
  15630. // in case the event system needs to trace it.
  15631. {
  15632. dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null);
  15633. }
  15634. } // Attempt dispatching an event. Returns a SuspenseInstance or Container if it's blocked.
  15635. function attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
  15636. // TODO: Warn if _enabled is false.
  15637. var nativeEventTarget = getEventTarget(nativeEvent);
  15638. var targetInst = getClosestInstanceFromNode(nativeEventTarget);
  15639. if (targetInst !== null) {
  15640. var nearestMounted = getNearestMountedFiber(targetInst);
  15641. if (nearestMounted === null) {
  15642. // This tree has been unmounted already. Dispatch without a target.
  15643. targetInst = null;
  15644. } else {
  15645. var tag = nearestMounted.tag;
  15646. if (tag === SuspenseComponent) {
  15647. var instance = getSuspenseInstanceFromFiber(nearestMounted);
  15648. if (instance !== null) {
  15649. // Queue the event to be replayed later. Abort dispatching since we
  15650. // don't want this event dispatched twice through the event system.
  15651. // TODO: If this is the first discrete event in the queue. Schedule an increased
  15652. // priority for this boundary.
  15653. return instance;
  15654. } // This shouldn't happen, something went wrong but to avoid blocking
  15655. // the whole system, dispatch the event without a target.
  15656. // TODO: Warn.
  15657. targetInst = null;
  15658. } else if (tag === HostRoot) {
  15659. var root = nearestMounted.stateNode;
  15660. if (root.hydrate) {
  15661. // If this happens during a replay something went wrong and it might block
  15662. // the whole system.
  15663. return getContainerFromFiber(nearestMounted);
  15664. }
  15665. targetInst = null;
  15666. } else if (nearestMounted !== targetInst) {
  15667. // If we get an event (ex: img onload) before committing that
  15668. // component's mount, ignore it for now (that is, treat it as if it was an
  15669. // event on a non-React tree). We might also consider queueing events and
  15670. // dispatching them after the mount.
  15671. targetInst = null;
  15672. }
  15673. }
  15674. }
  15675. {
  15676. dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
  15677. } // We're not blocked on anything.
  15678. return null;
  15679. }
  15680. // List derived from Gecko source code:
  15681. // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
  15682. var shorthandToLonghand = {
  15683. animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
  15684. background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
  15685. backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
  15686. border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
  15687. borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
  15688. borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
  15689. borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
  15690. borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
  15691. borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
  15692. borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
  15693. borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
  15694. borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
  15695. borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
  15696. borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
  15697. borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
  15698. borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
  15699. borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
  15700. columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
  15701. columns: ['columnCount', 'columnWidth'],
  15702. flex: ['flexBasis', 'flexGrow', 'flexShrink'],
  15703. flexFlow: ['flexDirection', 'flexWrap'],
  15704. font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
  15705. fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
  15706. gap: ['columnGap', 'rowGap'],
  15707. grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
  15708. gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
  15709. gridColumn: ['gridColumnEnd', 'gridColumnStart'],
  15710. gridColumnGap: ['columnGap'],
  15711. gridGap: ['columnGap', 'rowGap'],
  15712. gridRow: ['gridRowEnd', 'gridRowStart'],
  15713. gridRowGap: ['rowGap'],
  15714. gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
  15715. listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
  15716. margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
  15717. marker: ['markerEnd', 'markerMid', 'markerStart'],
  15718. mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
  15719. maskPosition: ['maskPositionX', 'maskPositionY'],
  15720. outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
  15721. overflow: ['overflowX', 'overflowY'],
  15722. padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
  15723. placeContent: ['alignContent', 'justifyContent'],
  15724. placeItems: ['alignItems', 'justifyItems'],
  15725. placeSelf: ['alignSelf', 'justifySelf'],
  15726. textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
  15727. textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
  15728. transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
  15729. wordWrap: ['overflowWrap']
  15730. };
  15731. /**
  15732. * CSS properties which accept numbers but are not in units of "px".
  15733. */
  15734. var isUnitlessNumber = {
  15735. animationIterationCount: true,
  15736. borderImageOutset: true,
  15737. borderImageSlice: true,
  15738. borderImageWidth: true,
  15739. boxFlex: true,
  15740. boxFlexGroup: true,
  15741. boxOrdinalGroup: true,
  15742. columnCount: true,
  15743. columns: true,
  15744. flex: true,
  15745. flexGrow: true,
  15746. flexPositive: true,
  15747. flexShrink: true,
  15748. flexNegative: true,
  15749. flexOrder: true,
  15750. gridArea: true,
  15751. gridRow: true,
  15752. gridRowEnd: true,
  15753. gridRowSpan: true,
  15754. gridRowStart: true,
  15755. gridColumn: true,
  15756. gridColumnEnd: true,
  15757. gridColumnSpan: true,
  15758. gridColumnStart: true,
  15759. fontWeight: true,
  15760. lineClamp: true,
  15761. lineHeight: true,
  15762. opacity: true,
  15763. order: true,
  15764. orphans: true,
  15765. tabSize: true,
  15766. widows: true,
  15767. zIndex: true,
  15768. zoom: true,
  15769. // SVG-related properties
  15770. fillOpacity: true,
  15771. floodOpacity: true,
  15772. stopOpacity: true,
  15773. strokeDasharray: true,
  15774. strokeDashoffset: true,
  15775. strokeMiterlimit: true,
  15776. strokeOpacity: true,
  15777. strokeWidth: true
  15778. };
  15779. /**
  15780. * @param {string} prefix vendor-specific prefix, eg: Webkit
  15781. * @param {string} key style name, eg: transitionDuration
  15782. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  15783. * WebkitTransitionDuration
  15784. */
  15785. function prefixKey(prefix, key) {
  15786. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  15787. }
  15788. /**
  15789. * Support style names that may come passed in prefixed by adding permutations
  15790. * of vendor prefixes.
  15791. */
  15792. var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  15793. // infinite loop, because it iterates over the newly added props too.
  15794. Object.keys(isUnitlessNumber).forEach(function (prop) {
  15795. prefixes.forEach(function (prefix) {
  15796. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  15797. });
  15798. });
  15799. /**
  15800. * Convert a value into the proper css writable value. The style name `name`
  15801. * should be logical (no hyphens), as specified
  15802. * in `CSSProperty.isUnitlessNumber`.
  15803. *
  15804. * @param {string} name CSS property name such as `topMargin`.
  15805. * @param {*} value CSS property value such as `10px`.
  15806. * @return {string} Normalized style value with dimensions applied.
  15807. */
  15808. function dangerousStyleValue(name, value, isCustomProperty) {
  15809. // Note that we've removed escapeTextForBrowser() calls here since the
  15810. // whole string will be escaped when the attribute is injected into
  15811. // the markup. If you provide unsafe user data here they can inject
  15812. // arbitrary CSS which may be problematic (I couldn't repro this):
  15813. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  15814. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  15815. // This is not an XSS hole but instead a potential CSS injection issue
  15816. // which has lead to a greater discussion about how we're going to
  15817. // trust URLs moving forward. See #2115901
  15818. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  15819. if (isEmpty) {
  15820. return '';
  15821. }
  15822. if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
  15823. return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
  15824. }
  15825. return ('' + value).trim();
  15826. }
  15827. var uppercasePattern = /([A-Z])/g;
  15828. var msPattern = /^ms-/;
  15829. /**
  15830. * Hyphenates a camelcased CSS property name, for example:
  15831. *
  15832. * > hyphenateStyleName('backgroundColor')
  15833. * < "background-color"
  15834. * > hyphenateStyleName('MozTransition')
  15835. * < "-moz-transition"
  15836. * > hyphenateStyleName('msTransition')
  15837. * < "-ms-transition"
  15838. *
  15839. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  15840. * is converted to `-ms-`.
  15841. */
  15842. function hyphenateStyleName(name) {
  15843. return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
  15844. }
  15845. var warnValidStyle = function () {};
  15846. {
  15847. // 'msTransform' is correct, but the other prefixes should be capitalized
  15848. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  15849. var msPattern$1 = /^-ms-/;
  15850. var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
  15851. var badStyleValueWithSemicolonPattern = /;\s*$/;
  15852. var warnedStyleNames = {};
  15853. var warnedStyleValues = {};
  15854. var warnedForNaNValue = false;
  15855. var warnedForInfinityValue = false;
  15856. var camelize = function (string) {
  15857. return string.replace(hyphenPattern, function (_, character) {
  15858. return character.toUpperCase();
  15859. });
  15860. };
  15861. var warnHyphenatedStyleName = function (name) {
  15862. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  15863. return;
  15864. }
  15865. warnedStyleNames[name] = true;
  15866. error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
  15867. // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  15868. // is converted to lowercase `ms`.
  15869. camelize(name.replace(msPattern$1, 'ms-')));
  15870. };
  15871. var warnBadVendoredStyleName = function (name) {
  15872. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  15873. return;
  15874. }
  15875. warnedStyleNames[name] = true;
  15876. error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
  15877. };
  15878. var warnStyleValueWithSemicolon = function (name, value) {
  15879. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  15880. return;
  15881. }
  15882. warnedStyleValues[value] = true;
  15883. error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
  15884. };
  15885. var warnStyleValueIsNaN = function (name, value) {
  15886. if (warnedForNaNValue) {
  15887. return;
  15888. }
  15889. warnedForNaNValue = true;
  15890. error('`NaN` is an invalid value for the `%s` css style property.', name);
  15891. };
  15892. var warnStyleValueIsInfinity = function (name, value) {
  15893. if (warnedForInfinityValue) {
  15894. return;
  15895. }
  15896. warnedForInfinityValue = true;
  15897. error('`Infinity` is an invalid value for the `%s` css style property.', name);
  15898. };
  15899. warnValidStyle = function (name, value) {
  15900. if (name.indexOf('-') > -1) {
  15901. warnHyphenatedStyleName(name);
  15902. } else if (badVendoredStyleNamePattern.test(name)) {
  15903. warnBadVendoredStyleName(name);
  15904. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  15905. warnStyleValueWithSemicolon(name, value);
  15906. }
  15907. if (typeof value === 'number') {
  15908. if (isNaN(value)) {
  15909. warnStyleValueIsNaN(name, value);
  15910. } else if (!isFinite(value)) {
  15911. warnStyleValueIsInfinity(name, value);
  15912. }
  15913. }
  15914. };
  15915. }
  15916. var warnValidStyle$1 = warnValidStyle;
  15917. /**
  15918. * Operations for dealing with CSS properties.
  15919. */
  15920. /**
  15921. * This creates a string that is expected to be equivalent to the style
  15922. * attribute generated by server-side rendering. It by-passes warnings and
  15923. * security checks so it's not safe to use this value for anything other than
  15924. * comparison. It is only used in DEV for SSR validation.
  15925. */
  15926. function createDangerousStringForStyles(styles) {
  15927. {
  15928. var serialized = '';
  15929. var delimiter = '';
  15930. for (var styleName in styles) {
  15931. if (!styles.hasOwnProperty(styleName)) {
  15932. continue;
  15933. }
  15934. var styleValue = styles[styleName];
  15935. if (styleValue != null) {
  15936. var isCustomProperty = styleName.indexOf('--') === 0;
  15937. serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':';
  15938. serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
  15939. delimiter = ';';
  15940. }
  15941. }
  15942. return serialized || null;
  15943. }
  15944. }
  15945. /**
  15946. * Sets the value for multiple styles on a node. If a value is specified as
  15947. * '' (empty string), the corresponding style property will be unset.
  15948. *
  15949. * @param {DOMElement} node
  15950. * @param {object} styles
  15951. */
  15952. function setValueForStyles(node, styles) {
  15953. var style = node.style;
  15954. for (var styleName in styles) {
  15955. if (!styles.hasOwnProperty(styleName)) {
  15956. continue;
  15957. }
  15958. var isCustomProperty = styleName.indexOf('--') === 0;
  15959. {
  15960. if (!isCustomProperty) {
  15961. warnValidStyle$1(styleName, styles[styleName]);
  15962. }
  15963. }
  15964. var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
  15965. if (styleName === 'float') {
  15966. styleName = 'cssFloat';
  15967. }
  15968. if (isCustomProperty) {
  15969. style.setProperty(styleName, styleValue);
  15970. } else {
  15971. style[styleName] = styleValue;
  15972. }
  15973. }
  15974. }
  15975. function isValueEmpty(value) {
  15976. return value == null || typeof value === 'boolean' || value === '';
  15977. }
  15978. /**
  15979. * Given {color: 'red', overflow: 'hidden'} returns {
  15980. * color: 'color',
  15981. * overflowX: 'overflow',
  15982. * overflowY: 'overflow',
  15983. * }. This can be read as "the overflowY property was set by the overflow
  15984. * shorthand". That is, the values are the property that each was derived from.
  15985. */
  15986. function expandShorthandMap(styles) {
  15987. var expanded = {};
  15988. for (var key in styles) {
  15989. var longhands = shorthandToLonghand[key] || [key];
  15990. for (var i = 0; i < longhands.length; i++) {
  15991. expanded[longhands[i]] = key;
  15992. }
  15993. }
  15994. return expanded;
  15995. }
  15996. /**
  15997. * When mixing shorthand and longhand property names, we warn during updates if
  15998. * we expect an incorrect result to occur. In particular, we warn for:
  15999. *
  16000. * Updating a shorthand property (longhand gets overwritten):
  16001. * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
  16002. * becomes .style.font = 'baz'
  16003. * Removing a shorthand property (longhand gets lost too):
  16004. * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
  16005. * becomes .style.font = ''
  16006. * Removing a longhand property (should revert to shorthand; doesn't):
  16007. * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
  16008. * becomes .style.fontVariant = ''
  16009. */
  16010. function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
  16011. {
  16012. if (!nextStyles) {
  16013. return;
  16014. }
  16015. var expandedUpdates = expandShorthandMap(styleUpdates);
  16016. var expandedStyles = expandShorthandMap(nextStyles);
  16017. var warnedAbout = {};
  16018. for (var key in expandedUpdates) {
  16019. var originalKey = expandedUpdates[key];
  16020. var correctOriginalKey = expandedStyles[key];
  16021. if (correctOriginalKey && originalKey !== correctOriginalKey) {
  16022. var warningKey = originalKey + ',' + correctOriginalKey;
  16023. if (warnedAbout[warningKey]) {
  16024. continue;
  16025. }
  16026. warnedAbout[warningKey] = true;
  16027. error('%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
  16028. }
  16029. }
  16030. }
  16031. }
  16032. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  16033. // those special-case tags.
  16034. var omittedCloseTags = {
  16035. area: true,
  16036. base: true,
  16037. br: true,
  16038. col: true,
  16039. embed: true,
  16040. hr: true,
  16041. img: true,
  16042. input: true,
  16043. keygen: true,
  16044. link: true,
  16045. meta: true,
  16046. param: true,
  16047. source: true,
  16048. track: true,
  16049. wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
  16050. };
  16051. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  16052. var voidElementTags = _assign({
  16053. menuitem: true
  16054. }, omittedCloseTags);
  16055. var HTML = '__html';
  16056. var ReactDebugCurrentFrame$3 = null;
  16057. {
  16058. ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
  16059. }
  16060. function assertValidProps(tag, props) {
  16061. if (!props) {
  16062. return;
  16063. } // Note the use of `==` which checks for null or undefined.
  16064. if (voidElementTags[tag]) {
  16065. if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
  16066. {
  16067. throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
  16068. }
  16069. }
  16070. }
  16071. if (props.dangerouslySetInnerHTML != null) {
  16072. if (!(props.children == null)) {
  16073. {
  16074. throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
  16075. }
  16076. }
  16077. if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
  16078. {
  16079. throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information." );
  16080. }
  16081. }
  16082. }
  16083. {
  16084. if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
  16085. error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
  16086. }
  16087. }
  16088. if (!(props.style == null || typeof props.style === 'object')) {
  16089. {
  16090. throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
  16091. }
  16092. }
  16093. }
  16094. function isCustomComponent(tagName, props) {
  16095. if (tagName.indexOf('-') === -1) {
  16096. return typeof props.is === 'string';
  16097. }
  16098. switch (tagName) {
  16099. // These are reserved SVG and MathML elements.
  16100. // We don't mind this whitelist too much because we expect it to never grow.
  16101. // The alternative is to track the namespace in a few places which is convoluted.
  16102. // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
  16103. case 'annotation-xml':
  16104. case 'color-profile':
  16105. case 'font-face':
  16106. case 'font-face-src':
  16107. case 'font-face-uri':
  16108. case 'font-face-format':
  16109. case 'font-face-name':
  16110. case 'missing-glyph':
  16111. return false;
  16112. default:
  16113. return true;
  16114. }
  16115. }
  16116. // When adding attributes to the HTML or SVG whitelist, be sure to
  16117. // also add them to this module to ensure casing and incorrect name
  16118. // warnings.
  16119. var possibleStandardNames = {
  16120. // HTML
  16121. accept: 'accept',
  16122. acceptcharset: 'acceptCharset',
  16123. 'accept-charset': 'acceptCharset',
  16124. accesskey: 'accessKey',
  16125. action: 'action',
  16126. allowfullscreen: 'allowFullScreen',
  16127. alt: 'alt',
  16128. as: 'as',
  16129. async: 'async',
  16130. autocapitalize: 'autoCapitalize',
  16131. autocomplete: 'autoComplete',
  16132. autocorrect: 'autoCorrect',
  16133. autofocus: 'autoFocus',
  16134. autoplay: 'autoPlay',
  16135. autosave: 'autoSave',
  16136. capture: 'capture',
  16137. cellpadding: 'cellPadding',
  16138. cellspacing: 'cellSpacing',
  16139. challenge: 'challenge',
  16140. charset: 'charSet',
  16141. checked: 'checked',
  16142. children: 'children',
  16143. cite: 'cite',
  16144. class: 'className',
  16145. classid: 'classID',
  16146. classname: 'className',
  16147. cols: 'cols',
  16148. colspan: 'colSpan',
  16149. content: 'content',
  16150. contenteditable: 'contentEditable',
  16151. contextmenu: 'contextMenu',
  16152. controls: 'controls',
  16153. controlslist: 'controlsList',
  16154. coords: 'coords',
  16155. crossorigin: 'crossOrigin',
  16156. dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
  16157. data: 'data',
  16158. datetime: 'dateTime',
  16159. default: 'default',
  16160. defaultchecked: 'defaultChecked',
  16161. defaultvalue: 'defaultValue',
  16162. defer: 'defer',
  16163. dir: 'dir',
  16164. disabled: 'disabled',
  16165. disablepictureinpicture: 'disablePictureInPicture',
  16166. download: 'download',
  16167. draggable: 'draggable',
  16168. enctype: 'encType',
  16169. for: 'htmlFor',
  16170. form: 'form',
  16171. formmethod: 'formMethod',
  16172. formaction: 'formAction',
  16173. formenctype: 'formEncType',
  16174. formnovalidate: 'formNoValidate',
  16175. formtarget: 'formTarget',
  16176. frameborder: 'frameBorder',
  16177. headers: 'headers',
  16178. height: 'height',
  16179. hidden: 'hidden',
  16180. high: 'high',
  16181. href: 'href',
  16182. hreflang: 'hrefLang',
  16183. htmlfor: 'htmlFor',
  16184. httpequiv: 'httpEquiv',
  16185. 'http-equiv': 'httpEquiv',
  16186. icon: 'icon',
  16187. id: 'id',
  16188. innerhtml: 'innerHTML',
  16189. inputmode: 'inputMode',
  16190. integrity: 'integrity',
  16191. is: 'is',
  16192. itemid: 'itemID',
  16193. itemprop: 'itemProp',
  16194. itemref: 'itemRef',
  16195. itemscope: 'itemScope',
  16196. itemtype: 'itemType',
  16197. keyparams: 'keyParams',
  16198. keytype: 'keyType',
  16199. kind: 'kind',
  16200. label: 'label',
  16201. lang: 'lang',
  16202. list: 'list',
  16203. loop: 'loop',
  16204. low: 'low',
  16205. manifest: 'manifest',
  16206. marginwidth: 'marginWidth',
  16207. marginheight: 'marginHeight',
  16208. max: 'max',
  16209. maxlength: 'maxLength',
  16210. media: 'media',
  16211. mediagroup: 'mediaGroup',
  16212. method: 'method',
  16213. min: 'min',
  16214. minlength: 'minLength',
  16215. multiple: 'multiple',
  16216. muted: 'muted',
  16217. name: 'name',
  16218. nomodule: 'noModule',
  16219. nonce: 'nonce',
  16220. novalidate: 'noValidate',
  16221. open: 'open',
  16222. optimum: 'optimum',
  16223. pattern: 'pattern',
  16224. placeholder: 'placeholder',
  16225. playsinline: 'playsInline',
  16226. poster: 'poster',
  16227. preload: 'preload',
  16228. profile: 'profile',
  16229. radiogroup: 'radioGroup',
  16230. readonly: 'readOnly',
  16231. referrerpolicy: 'referrerPolicy',
  16232. rel: 'rel',
  16233. required: 'required',
  16234. reversed: 'reversed',
  16235. role: 'role',
  16236. rows: 'rows',
  16237. rowspan: 'rowSpan',
  16238. sandbox: 'sandbox',
  16239. scope: 'scope',
  16240. scoped: 'scoped',
  16241. scrolling: 'scrolling',
  16242. seamless: 'seamless',
  16243. selected: 'selected',
  16244. shape: 'shape',
  16245. size: 'size',
  16246. sizes: 'sizes',
  16247. span: 'span',
  16248. spellcheck: 'spellCheck',
  16249. src: 'src',
  16250. srcdoc: 'srcDoc',
  16251. srclang: 'srcLang',
  16252. srcset: 'srcSet',
  16253. start: 'start',
  16254. step: 'step',
  16255. style: 'style',
  16256. summary: 'summary',
  16257. tabindex: 'tabIndex',
  16258. target: 'target',
  16259. title: 'title',
  16260. type: 'type',
  16261. usemap: 'useMap',
  16262. value: 'value',
  16263. width: 'width',
  16264. wmode: 'wmode',
  16265. wrap: 'wrap',
  16266. // SVG
  16267. about: 'about',
  16268. accentheight: 'accentHeight',
  16269. 'accent-height': 'accentHeight',
  16270. accumulate: 'accumulate',
  16271. additive: 'additive',
  16272. alignmentbaseline: 'alignmentBaseline',
  16273. 'alignment-baseline': 'alignmentBaseline',
  16274. allowreorder: 'allowReorder',
  16275. alphabetic: 'alphabetic',
  16276. amplitude: 'amplitude',
  16277. arabicform: 'arabicForm',
  16278. 'arabic-form': 'arabicForm',
  16279. ascent: 'ascent',
  16280. attributename: 'attributeName',
  16281. attributetype: 'attributeType',
  16282. autoreverse: 'autoReverse',
  16283. azimuth: 'azimuth',
  16284. basefrequency: 'baseFrequency',
  16285. baselineshift: 'baselineShift',
  16286. 'baseline-shift': 'baselineShift',
  16287. baseprofile: 'baseProfile',
  16288. bbox: 'bbox',
  16289. begin: 'begin',
  16290. bias: 'bias',
  16291. by: 'by',
  16292. calcmode: 'calcMode',
  16293. capheight: 'capHeight',
  16294. 'cap-height': 'capHeight',
  16295. clip: 'clip',
  16296. clippath: 'clipPath',
  16297. 'clip-path': 'clipPath',
  16298. clippathunits: 'clipPathUnits',
  16299. cliprule: 'clipRule',
  16300. 'clip-rule': 'clipRule',
  16301. color: 'color',
  16302. colorinterpolation: 'colorInterpolation',
  16303. 'color-interpolation': 'colorInterpolation',
  16304. colorinterpolationfilters: 'colorInterpolationFilters',
  16305. 'color-interpolation-filters': 'colorInterpolationFilters',
  16306. colorprofile: 'colorProfile',
  16307. 'color-profile': 'colorProfile',
  16308. colorrendering: 'colorRendering',
  16309. 'color-rendering': 'colorRendering',
  16310. contentscripttype: 'contentScriptType',
  16311. contentstyletype: 'contentStyleType',
  16312. cursor: 'cursor',
  16313. cx: 'cx',
  16314. cy: 'cy',
  16315. d: 'd',
  16316. datatype: 'datatype',
  16317. decelerate: 'decelerate',
  16318. descent: 'descent',
  16319. diffuseconstant: 'diffuseConstant',
  16320. direction: 'direction',
  16321. display: 'display',
  16322. divisor: 'divisor',
  16323. dominantbaseline: 'dominantBaseline',
  16324. 'dominant-baseline': 'dominantBaseline',
  16325. dur: 'dur',
  16326. dx: 'dx',
  16327. dy: 'dy',
  16328. edgemode: 'edgeMode',
  16329. elevation: 'elevation',
  16330. enablebackground: 'enableBackground',
  16331. 'enable-background': 'enableBackground',
  16332. end: 'end',
  16333. exponent: 'exponent',
  16334. externalresourcesrequired: 'externalResourcesRequired',
  16335. fill: 'fill',
  16336. fillopacity: 'fillOpacity',
  16337. 'fill-opacity': 'fillOpacity',
  16338. fillrule: 'fillRule',
  16339. 'fill-rule': 'fillRule',
  16340. filter: 'filter',
  16341. filterres: 'filterRes',
  16342. filterunits: 'filterUnits',
  16343. floodopacity: 'floodOpacity',
  16344. 'flood-opacity': 'floodOpacity',
  16345. floodcolor: 'floodColor',
  16346. 'flood-color': 'floodColor',
  16347. focusable: 'focusable',
  16348. fontfamily: 'fontFamily',
  16349. 'font-family': 'fontFamily',
  16350. fontsize: 'fontSize',
  16351. 'font-size': 'fontSize',
  16352. fontsizeadjust: 'fontSizeAdjust',
  16353. 'font-size-adjust': 'fontSizeAdjust',
  16354. fontstretch: 'fontStretch',
  16355. 'font-stretch': 'fontStretch',
  16356. fontstyle: 'fontStyle',
  16357. 'font-style': 'fontStyle',
  16358. fontvariant: 'fontVariant',
  16359. 'font-variant': 'fontVariant',
  16360. fontweight: 'fontWeight',
  16361. 'font-weight': 'fontWeight',
  16362. format: 'format',
  16363. from: 'from',
  16364. fx: 'fx',
  16365. fy: 'fy',
  16366. g1: 'g1',
  16367. g2: 'g2',
  16368. glyphname: 'glyphName',
  16369. 'glyph-name': 'glyphName',
  16370. glyphorientationhorizontal: 'glyphOrientationHorizontal',
  16371. 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
  16372. glyphorientationvertical: 'glyphOrientationVertical',
  16373. 'glyph-orientation-vertical': 'glyphOrientationVertical',
  16374. glyphref: 'glyphRef',
  16375. gradienttransform: 'gradientTransform',
  16376. gradientunits: 'gradientUnits',
  16377. hanging: 'hanging',
  16378. horizadvx: 'horizAdvX',
  16379. 'horiz-adv-x': 'horizAdvX',
  16380. horizoriginx: 'horizOriginX',
  16381. 'horiz-origin-x': 'horizOriginX',
  16382. ideographic: 'ideographic',
  16383. imagerendering: 'imageRendering',
  16384. 'image-rendering': 'imageRendering',
  16385. in2: 'in2',
  16386. in: 'in',
  16387. inlist: 'inlist',
  16388. intercept: 'intercept',
  16389. k1: 'k1',
  16390. k2: 'k2',
  16391. k3: 'k3',
  16392. k4: 'k4',
  16393. k: 'k',
  16394. kernelmatrix: 'kernelMatrix',
  16395. kernelunitlength: 'kernelUnitLength',
  16396. kerning: 'kerning',
  16397. keypoints: 'keyPoints',
  16398. keysplines: 'keySplines',
  16399. keytimes: 'keyTimes',
  16400. lengthadjust: 'lengthAdjust',
  16401. letterspacing: 'letterSpacing',
  16402. 'letter-spacing': 'letterSpacing',
  16403. lightingcolor: 'lightingColor',
  16404. 'lighting-color': 'lightingColor',
  16405. limitingconeangle: 'limitingConeAngle',
  16406. local: 'local',
  16407. markerend: 'markerEnd',
  16408. 'marker-end': 'markerEnd',
  16409. markerheight: 'markerHeight',
  16410. markermid: 'markerMid',
  16411. 'marker-mid': 'markerMid',
  16412. markerstart: 'markerStart',
  16413. 'marker-start': 'markerStart',
  16414. markerunits: 'markerUnits',
  16415. markerwidth: 'markerWidth',
  16416. mask: 'mask',
  16417. maskcontentunits: 'maskContentUnits',
  16418. maskunits: 'maskUnits',
  16419. mathematical: 'mathematical',
  16420. mode: 'mode',
  16421. numoctaves: 'numOctaves',
  16422. offset: 'offset',
  16423. opacity: 'opacity',
  16424. operator: 'operator',
  16425. order: 'order',
  16426. orient: 'orient',
  16427. orientation: 'orientation',
  16428. origin: 'origin',
  16429. overflow: 'overflow',
  16430. overlineposition: 'overlinePosition',
  16431. 'overline-position': 'overlinePosition',
  16432. overlinethickness: 'overlineThickness',
  16433. 'overline-thickness': 'overlineThickness',
  16434. paintorder: 'paintOrder',
  16435. 'paint-order': 'paintOrder',
  16436. panose1: 'panose1',
  16437. 'panose-1': 'panose1',
  16438. pathlength: 'pathLength',
  16439. patterncontentunits: 'patternContentUnits',
  16440. patterntransform: 'patternTransform',
  16441. patternunits: 'patternUnits',
  16442. pointerevents: 'pointerEvents',
  16443. 'pointer-events': 'pointerEvents',
  16444. points: 'points',
  16445. pointsatx: 'pointsAtX',
  16446. pointsaty: 'pointsAtY',
  16447. pointsatz: 'pointsAtZ',
  16448. prefix: 'prefix',
  16449. preservealpha: 'preserveAlpha',
  16450. preserveaspectratio: 'preserveAspectRatio',
  16451. primitiveunits: 'primitiveUnits',
  16452. property: 'property',
  16453. r: 'r',
  16454. radius: 'radius',
  16455. refx: 'refX',
  16456. refy: 'refY',
  16457. renderingintent: 'renderingIntent',
  16458. 'rendering-intent': 'renderingIntent',
  16459. repeatcount: 'repeatCount',
  16460. repeatdur: 'repeatDur',
  16461. requiredextensions: 'requiredExtensions',
  16462. requiredfeatures: 'requiredFeatures',
  16463. resource: 'resource',
  16464. restart: 'restart',
  16465. result: 'result',
  16466. results: 'results',
  16467. rotate: 'rotate',
  16468. rx: 'rx',
  16469. ry: 'ry',
  16470. scale: 'scale',
  16471. security: 'security',
  16472. seed: 'seed',
  16473. shaperendering: 'shapeRendering',
  16474. 'shape-rendering': 'shapeRendering',
  16475. slope: 'slope',
  16476. spacing: 'spacing',
  16477. specularconstant: 'specularConstant',
  16478. specularexponent: 'specularExponent',
  16479. speed: 'speed',
  16480. spreadmethod: 'spreadMethod',
  16481. startoffset: 'startOffset',
  16482. stddeviation: 'stdDeviation',
  16483. stemh: 'stemh',
  16484. stemv: 'stemv',
  16485. stitchtiles: 'stitchTiles',
  16486. stopcolor: 'stopColor',
  16487. 'stop-color': 'stopColor',
  16488. stopopacity: 'stopOpacity',
  16489. 'stop-opacity': 'stopOpacity',
  16490. strikethroughposition: 'strikethroughPosition',
  16491. 'strikethrough-position': 'strikethroughPosition',
  16492. strikethroughthickness: 'strikethroughThickness',
  16493. 'strikethrough-thickness': 'strikethroughThickness',
  16494. string: 'string',
  16495. stroke: 'stroke',
  16496. strokedasharray: 'strokeDasharray',
  16497. 'stroke-dasharray': 'strokeDasharray',
  16498. strokedashoffset: 'strokeDashoffset',
  16499. 'stroke-dashoffset': 'strokeDashoffset',
  16500. strokelinecap: 'strokeLinecap',
  16501. 'stroke-linecap': 'strokeLinecap',
  16502. strokelinejoin: 'strokeLinejoin',
  16503. 'stroke-linejoin': 'strokeLinejoin',
  16504. strokemiterlimit: 'strokeMiterlimit',
  16505. 'stroke-miterlimit': 'strokeMiterlimit',
  16506. strokewidth: 'strokeWidth',
  16507. 'stroke-width': 'strokeWidth',
  16508. strokeopacity: 'strokeOpacity',
  16509. 'stroke-opacity': 'strokeOpacity',
  16510. suppresscontenteditablewarning: 'suppressContentEditableWarning',
  16511. suppresshydrationwarning: 'suppressHydrationWarning',
  16512. surfacescale: 'surfaceScale',
  16513. systemlanguage: 'systemLanguage',
  16514. tablevalues: 'tableValues',
  16515. targetx: 'targetX',
  16516. targety: 'targetY',
  16517. textanchor: 'textAnchor',
  16518. 'text-anchor': 'textAnchor',
  16519. textdecoration: 'textDecoration',
  16520. 'text-decoration': 'textDecoration',
  16521. textlength: 'textLength',
  16522. textrendering: 'textRendering',
  16523. 'text-rendering': 'textRendering',
  16524. to: 'to',
  16525. transform: 'transform',
  16526. typeof: 'typeof',
  16527. u1: 'u1',
  16528. u2: 'u2',
  16529. underlineposition: 'underlinePosition',
  16530. 'underline-position': 'underlinePosition',
  16531. underlinethickness: 'underlineThickness',
  16532. 'underline-thickness': 'underlineThickness',
  16533. unicode: 'unicode',
  16534. unicodebidi: 'unicodeBidi',
  16535. 'unicode-bidi': 'unicodeBidi',
  16536. unicoderange: 'unicodeRange',
  16537. 'unicode-range': 'unicodeRange',
  16538. unitsperem: 'unitsPerEm',
  16539. 'units-per-em': 'unitsPerEm',
  16540. unselectable: 'unselectable',
  16541. valphabetic: 'vAlphabetic',
  16542. 'v-alphabetic': 'vAlphabetic',
  16543. values: 'values',
  16544. vectoreffect: 'vectorEffect',
  16545. 'vector-effect': 'vectorEffect',
  16546. version: 'version',
  16547. vertadvy: 'vertAdvY',
  16548. 'vert-adv-y': 'vertAdvY',
  16549. vertoriginx: 'vertOriginX',
  16550. 'vert-origin-x': 'vertOriginX',
  16551. vertoriginy: 'vertOriginY',
  16552. 'vert-origin-y': 'vertOriginY',
  16553. vhanging: 'vHanging',
  16554. 'v-hanging': 'vHanging',
  16555. videographic: 'vIdeographic',
  16556. 'v-ideographic': 'vIdeographic',
  16557. viewbox: 'viewBox',
  16558. viewtarget: 'viewTarget',
  16559. visibility: 'visibility',
  16560. vmathematical: 'vMathematical',
  16561. 'v-mathematical': 'vMathematical',
  16562. vocab: 'vocab',
  16563. widths: 'widths',
  16564. wordspacing: 'wordSpacing',
  16565. 'word-spacing': 'wordSpacing',
  16566. writingmode: 'writingMode',
  16567. 'writing-mode': 'writingMode',
  16568. x1: 'x1',
  16569. x2: 'x2',
  16570. x: 'x',
  16571. xchannelselector: 'xChannelSelector',
  16572. xheight: 'xHeight',
  16573. 'x-height': 'xHeight',
  16574. xlinkactuate: 'xlinkActuate',
  16575. 'xlink:actuate': 'xlinkActuate',
  16576. xlinkarcrole: 'xlinkArcrole',
  16577. 'xlink:arcrole': 'xlinkArcrole',
  16578. xlinkhref: 'xlinkHref',
  16579. 'xlink:href': 'xlinkHref',
  16580. xlinkrole: 'xlinkRole',
  16581. 'xlink:role': 'xlinkRole',
  16582. xlinkshow: 'xlinkShow',
  16583. 'xlink:show': 'xlinkShow',
  16584. xlinktitle: 'xlinkTitle',
  16585. 'xlink:title': 'xlinkTitle',
  16586. xlinktype: 'xlinkType',
  16587. 'xlink:type': 'xlinkType',
  16588. xmlbase: 'xmlBase',
  16589. 'xml:base': 'xmlBase',
  16590. xmllang: 'xmlLang',
  16591. 'xml:lang': 'xmlLang',
  16592. xmlns: 'xmlns',
  16593. 'xml:space': 'xmlSpace',
  16594. xmlnsxlink: 'xmlnsXlink',
  16595. 'xmlns:xlink': 'xmlnsXlink',
  16596. xmlspace: 'xmlSpace',
  16597. y1: 'y1',
  16598. y2: 'y2',
  16599. y: 'y',
  16600. ychannelselector: 'yChannelSelector',
  16601. z: 'z',
  16602. zoomandpan: 'zoomAndPan'
  16603. };
  16604. var ariaProperties = {
  16605. 'aria-current': 0,
  16606. // state
  16607. 'aria-details': 0,
  16608. 'aria-disabled': 0,
  16609. // state
  16610. 'aria-hidden': 0,
  16611. // state
  16612. 'aria-invalid': 0,
  16613. // state
  16614. 'aria-keyshortcuts': 0,
  16615. 'aria-label': 0,
  16616. 'aria-roledescription': 0,
  16617. // Widget Attributes
  16618. 'aria-autocomplete': 0,
  16619. 'aria-checked': 0,
  16620. 'aria-expanded': 0,
  16621. 'aria-haspopup': 0,
  16622. 'aria-level': 0,
  16623. 'aria-modal': 0,
  16624. 'aria-multiline': 0,
  16625. 'aria-multiselectable': 0,
  16626. 'aria-orientation': 0,
  16627. 'aria-placeholder': 0,
  16628. 'aria-pressed': 0,
  16629. 'aria-readonly': 0,
  16630. 'aria-required': 0,
  16631. 'aria-selected': 0,
  16632. 'aria-sort': 0,
  16633. 'aria-valuemax': 0,
  16634. 'aria-valuemin': 0,
  16635. 'aria-valuenow': 0,
  16636. 'aria-valuetext': 0,
  16637. // Live Region Attributes
  16638. 'aria-atomic': 0,
  16639. 'aria-busy': 0,
  16640. 'aria-live': 0,
  16641. 'aria-relevant': 0,
  16642. // Drag-and-Drop Attributes
  16643. 'aria-dropeffect': 0,
  16644. 'aria-grabbed': 0,
  16645. // Relationship Attributes
  16646. 'aria-activedescendant': 0,
  16647. 'aria-colcount': 0,
  16648. 'aria-colindex': 0,
  16649. 'aria-colspan': 0,
  16650. 'aria-controls': 0,
  16651. 'aria-describedby': 0,
  16652. 'aria-errormessage': 0,
  16653. 'aria-flowto': 0,
  16654. 'aria-labelledby': 0,
  16655. 'aria-owns': 0,
  16656. 'aria-posinset': 0,
  16657. 'aria-rowcount': 0,
  16658. 'aria-rowindex': 0,
  16659. 'aria-rowspan': 0,
  16660. 'aria-setsize': 0
  16661. };
  16662. var warnedProperties = {};
  16663. var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  16664. var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  16665. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  16666. function validateProperty(tagName, name) {
  16667. {
  16668. if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
  16669. return true;
  16670. }
  16671. if (rARIACamel.test(name)) {
  16672. var ariaName = 'aria-' + name.slice(4).toLowerCase();
  16673. var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
  16674. // DOM properties, then it is an invalid aria-* attribute.
  16675. if (correctName == null) {
  16676. error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
  16677. warnedProperties[name] = true;
  16678. return true;
  16679. } // aria-* attributes should be lowercase; suggest the lowercase version.
  16680. if (name !== correctName) {
  16681. error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
  16682. warnedProperties[name] = true;
  16683. return true;
  16684. }
  16685. }
  16686. if (rARIA.test(name)) {
  16687. var lowerCasedName = name.toLowerCase();
  16688. var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
  16689. // DOM properties, then it is an invalid aria-* attribute.
  16690. if (standardName == null) {
  16691. warnedProperties[name] = true;
  16692. return false;
  16693. } // aria-* attributes should be lowercase; suggest the lowercase version.
  16694. if (name !== standardName) {
  16695. error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
  16696. warnedProperties[name] = true;
  16697. return true;
  16698. }
  16699. }
  16700. }
  16701. return true;
  16702. }
  16703. function warnInvalidARIAProps(type, props) {
  16704. {
  16705. var invalidProps = [];
  16706. for (var key in props) {
  16707. var isValid = validateProperty(type, key);
  16708. if (!isValid) {
  16709. invalidProps.push(key);
  16710. }
  16711. }
  16712. var unknownPropString = invalidProps.map(function (prop) {
  16713. return '`' + prop + '`';
  16714. }).join(', ');
  16715. if (invalidProps.length === 1) {
  16716. error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  16717. } else if (invalidProps.length > 1) {
  16718. error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  16719. }
  16720. }
  16721. }
  16722. function validateProperties(type, props) {
  16723. if (isCustomComponent(type, props)) {
  16724. return;
  16725. }
  16726. warnInvalidARIAProps(type, props);
  16727. }
  16728. var didWarnValueNull = false;
  16729. function validateProperties$1(type, props) {
  16730. {
  16731. if (type !== 'input' && type !== 'textarea' && type !== 'select') {
  16732. return;
  16733. }
  16734. if (props != null && props.value === null && !didWarnValueNull) {
  16735. didWarnValueNull = true;
  16736. if (type === 'select' && props.multiple) {
  16737. error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
  16738. } else {
  16739. error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
  16740. }
  16741. }
  16742. }
  16743. }
  16744. var validateProperty$1 = function () {};
  16745. {
  16746. var warnedProperties$1 = {};
  16747. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  16748. var EVENT_NAME_REGEX = /^on./;
  16749. var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
  16750. var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  16751. var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  16752. validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
  16753. if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
  16754. return true;
  16755. }
  16756. var lowerCasedName = name.toLowerCase();
  16757. if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
  16758. error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
  16759. warnedProperties$1[name] = true;
  16760. return true;
  16761. } // We can't rely on the event system being injected on the server.
  16762. if (canUseEventSystem) {
  16763. if (registrationNameModules.hasOwnProperty(name)) {
  16764. return true;
  16765. }
  16766. var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
  16767. if (registrationName != null) {
  16768. error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
  16769. warnedProperties$1[name] = true;
  16770. return true;
  16771. }
  16772. if (EVENT_NAME_REGEX.test(name)) {
  16773. error('Unknown event handler property `%s`. It will be ignored.', name);
  16774. warnedProperties$1[name] = true;
  16775. return true;
  16776. }
  16777. } else if (EVENT_NAME_REGEX.test(name)) {
  16778. // If no event plugins have been injected, we are in a server environment.
  16779. // So we can't tell if the event name is correct for sure, but we can filter
  16780. // out known bad ones like `onclick`. We can't suggest a specific replacement though.
  16781. if (INVALID_EVENT_NAME_REGEX.test(name)) {
  16782. error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
  16783. }
  16784. warnedProperties$1[name] = true;
  16785. return true;
  16786. } // Let the ARIA attribute hook validate ARIA attributes
  16787. if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
  16788. return true;
  16789. }
  16790. if (lowerCasedName === 'innerhtml') {
  16791. error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
  16792. warnedProperties$1[name] = true;
  16793. return true;
  16794. }
  16795. if (lowerCasedName === 'aria') {
  16796. error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
  16797. warnedProperties$1[name] = true;
  16798. return true;
  16799. }
  16800. if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
  16801. error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
  16802. warnedProperties$1[name] = true;
  16803. return true;
  16804. }
  16805. if (typeof value === 'number' && isNaN(value)) {
  16806. error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
  16807. warnedProperties$1[name] = true;
  16808. return true;
  16809. }
  16810. var propertyInfo = getPropertyInfo(name);
  16811. var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
  16812. if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
  16813. var standardName = possibleStandardNames[lowerCasedName];
  16814. if (standardName !== name) {
  16815. error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
  16816. warnedProperties$1[name] = true;
  16817. return true;
  16818. }
  16819. } else if (!isReserved && name !== lowerCasedName) {
  16820. // Unknown attributes should have lowercase casing since that's how they
  16821. // will be cased anyway with server rendering.
  16822. error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
  16823. warnedProperties$1[name] = true;
  16824. return true;
  16825. }
  16826. if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
  16827. if (value) {
  16828. error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
  16829. } else {
  16830. error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
  16831. }
  16832. warnedProperties$1[name] = true;
  16833. return true;
  16834. } // Now that we've validated casing, do not validate
  16835. // data types for reserved props
  16836. if (isReserved) {
  16837. return true;
  16838. } // Warn when a known attribute is a bad type
  16839. if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
  16840. warnedProperties$1[name] = true;
  16841. return false;
  16842. } // Warn when passing the strings 'false' or 'true' into a boolean prop
  16843. if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
  16844. error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
  16845. warnedProperties$1[name] = true;
  16846. return true;
  16847. }
  16848. return true;
  16849. };
  16850. }
  16851. var warnUnknownProperties = function (type, props, canUseEventSystem) {
  16852. {
  16853. var unknownProps = [];
  16854. for (var key in props) {
  16855. var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
  16856. if (!isValid) {
  16857. unknownProps.push(key);
  16858. }
  16859. }
  16860. var unknownPropString = unknownProps.map(function (prop) {
  16861. return '`' + prop + '`';
  16862. }).join(', ');
  16863. if (unknownProps.length === 1) {
  16864. error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
  16865. } else if (unknownProps.length > 1) {
  16866. error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
  16867. }
  16868. }
  16869. };
  16870. function validateProperties$2(type, props, canUseEventSystem) {
  16871. if (isCustomComponent(type, props)) {
  16872. return;
  16873. }
  16874. warnUnknownProperties(type, props, canUseEventSystem);
  16875. }
  16876. var didWarnInvalidHydration = false;
  16877. var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
  16878. var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
  16879. var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
  16880. var AUTOFOCUS = 'autoFocus';
  16881. var CHILDREN = 'children';
  16882. var STYLE = 'style';
  16883. var HTML$1 = '__html';
  16884. var HTML_NAMESPACE$1 = Namespaces.html;
  16885. var warnedUnknownTags;
  16886. var suppressHydrationWarning;
  16887. var validatePropertiesInDevelopment;
  16888. var warnForTextDifference;
  16889. var warnForPropDifference;
  16890. var warnForExtraAttributes;
  16891. var warnForInvalidEventListener;
  16892. var canDiffStyleForHydrationWarning;
  16893. var normalizeMarkupForTextOrAttribute;
  16894. var normalizeHTML;
  16895. {
  16896. warnedUnknownTags = {
  16897. // Chrome is the only major browser not shipping <time>. But as of July
  16898. // 2017 it intends to ship it due to widespread usage. We intentionally
  16899. // *don't* warn for <time> even if it's unrecognized by Chrome because
  16900. // it soon will be, and many apps have been using it anyway.
  16901. time: true,
  16902. // There are working polyfills for <dialog>. Let people use it.
  16903. dialog: true,
  16904. // Electron ships a custom <webview> tag to display external web content in
  16905. // an isolated frame and process.
  16906. // This tag is not present in non Electron environments such as JSDom which
  16907. // is often used for testing purposes.
  16908. // @see https://electronjs.org/docs/api/webview-tag
  16909. webview: true
  16910. };
  16911. validatePropertiesInDevelopment = function (type, props) {
  16912. validateProperties(type, props);
  16913. validateProperties$1(type, props);
  16914. validateProperties$2(type, props,
  16915. /* canUseEventSystem */
  16916. true);
  16917. }; // IE 11 parses & normalizes the style attribute as opposed to other
  16918. // browsers. It adds spaces and sorts the properties in some
  16919. // non-alphabetical order. Handling that would require sorting CSS
  16920. // properties in the client & server versions or applying
  16921. // `expectedStyle` to a temporary DOM node to read its `style` attribute
  16922. // normalized. Since it only affects IE, we're skipping style warnings
  16923. // in that browser completely in favor of doing all that work.
  16924. // See https://github.com/facebook/react/issues/11807
  16925. canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode; // HTML parsing normalizes CR and CRLF to LF.
  16926. // It also can turn \u0000 into \uFFFD inside attributes.
  16927. // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
  16928. // If we have a mismatch, it might be caused by that.
  16929. // We will still patch up in this case but not fire the warning.
  16930. var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
  16931. var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
  16932. normalizeMarkupForTextOrAttribute = function (markup) {
  16933. var markupString = typeof markup === 'string' ? markup : '' + markup;
  16934. return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
  16935. };
  16936. warnForTextDifference = function (serverText, clientText) {
  16937. if (didWarnInvalidHydration) {
  16938. return;
  16939. }
  16940. var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
  16941. var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
  16942. if (normalizedServerText === normalizedClientText) {
  16943. return;
  16944. }
  16945. didWarnInvalidHydration = true;
  16946. error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
  16947. };
  16948. warnForPropDifference = function (propName, serverValue, clientValue) {
  16949. if (didWarnInvalidHydration) {
  16950. return;
  16951. }
  16952. var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
  16953. var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
  16954. if (normalizedServerValue === normalizedClientValue) {
  16955. return;
  16956. }
  16957. didWarnInvalidHydration = true;
  16958. error('Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
  16959. };
  16960. warnForExtraAttributes = function (attributeNames) {
  16961. if (didWarnInvalidHydration) {
  16962. return;
  16963. }
  16964. didWarnInvalidHydration = true;
  16965. var names = [];
  16966. attributeNames.forEach(function (name) {
  16967. names.push(name);
  16968. });
  16969. error('Extra attributes from the server: %s', names);
  16970. };
  16971. warnForInvalidEventListener = function (registrationName, listener) {
  16972. if (listener === false) {
  16973. error('Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName);
  16974. } else {
  16975. error('Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
  16976. }
  16977. }; // Parse the HTML and read it back to normalize the HTML string so that it
  16978. // can be used for comparison.
  16979. normalizeHTML = function (parent, html) {
  16980. // We could have created a separate document here to avoid
  16981. // re-initializing custom elements if they exist. But this breaks
  16982. // how <noscript> is being handled. So we use the same document.
  16983. // See the discussion in https://github.com/facebook/react/pull/11157.
  16984. var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
  16985. testElement.innerHTML = html;
  16986. return testElement.innerHTML;
  16987. };
  16988. }
  16989. function ensureListeningTo(rootContainerElement, registrationName) {
  16990. var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
  16991. var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
  16992. legacyListenToEvent(registrationName, doc);
  16993. }
  16994. function getOwnerDocumentFromRootContainer(rootContainerElement) {
  16995. return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
  16996. }
  16997. function noop() {}
  16998. function trapClickOnNonInteractiveElement(node) {
  16999. // Mobile Safari does not fire properly bubble click events on
  17000. // non-interactive elements, which means delegated click listeners do not
  17001. // fire. The workaround for this bug involves attaching an empty click
  17002. // listener on the target node.
  17003. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  17004. // Just set it using the onclick property so that we don't have to manage any
  17005. // bookkeeping for it. Not sure if we need to clear it when the listener is
  17006. // removed.
  17007. // TODO: Only do this for the relevant Safaris maybe?
  17008. node.onclick = noop;
  17009. }
  17010. function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
  17011. for (var propKey in nextProps) {
  17012. if (!nextProps.hasOwnProperty(propKey)) {
  17013. continue;
  17014. }
  17015. var nextProp = nextProps[propKey];
  17016. if (propKey === STYLE) {
  17017. {
  17018. if (nextProp) {
  17019. // Freeze the next style object so that we can assume it won't be
  17020. // mutated. We have already warned for this in the past.
  17021. Object.freeze(nextProp);
  17022. }
  17023. } // Relies on `updateStylesByID` not mutating `styleUpdates`.
  17024. setValueForStyles(domElement, nextProp);
  17025. } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  17026. var nextHtml = nextProp ? nextProp[HTML$1] : undefined;
  17027. if (nextHtml != null) {
  17028. setInnerHTML(domElement, nextHtml);
  17029. }
  17030. } else if (propKey === CHILDREN) {
  17031. if (typeof nextProp === 'string') {
  17032. // Avoid setting initial textContent when the text is empty. In IE11 setting
  17033. // textContent on a <textarea> will cause the placeholder to not
  17034. // show within the <textarea> until it has been focused and blurred again.
  17035. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  17036. var canSetTextContent = tag !== 'textarea' || nextProp !== '';
  17037. if (canSetTextContent) {
  17038. setTextContent(domElement, nextProp);
  17039. }
  17040. } else if (typeof nextProp === 'number') {
  17041. setTextContent(domElement, '' + nextProp);
  17042. }
  17043. } else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameModules.hasOwnProperty(propKey)) {
  17044. if (nextProp != null) {
  17045. if ( typeof nextProp !== 'function') {
  17046. warnForInvalidEventListener(propKey, nextProp);
  17047. }
  17048. ensureListeningTo(rootContainerElement, propKey);
  17049. }
  17050. } else if (nextProp != null) {
  17051. setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
  17052. }
  17053. }
  17054. }
  17055. function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
  17056. // TODO: Handle wasCustomComponentTag
  17057. for (var i = 0; i < updatePayload.length; i += 2) {
  17058. var propKey = updatePayload[i];
  17059. var propValue = updatePayload[i + 1];
  17060. if (propKey === STYLE) {
  17061. setValueForStyles(domElement, propValue);
  17062. } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  17063. setInnerHTML(domElement, propValue);
  17064. } else if (propKey === CHILDREN) {
  17065. setTextContent(domElement, propValue);
  17066. } else {
  17067. setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
  17068. }
  17069. }
  17070. }
  17071. function createElement(type, props, rootContainerElement, parentNamespace) {
  17072. var isCustomComponentTag; // We create tags in the namespace of their parent container, except HTML
  17073. // tags get no namespace.
  17074. var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
  17075. var domElement;
  17076. var namespaceURI = parentNamespace;
  17077. if (namespaceURI === HTML_NAMESPACE$1) {
  17078. namespaceURI = getIntrinsicNamespace(type);
  17079. }
  17080. if (namespaceURI === HTML_NAMESPACE$1) {
  17081. {
  17082. isCustomComponentTag = isCustomComponent(type, props); // Should this check be gated by parent namespace? Not sure we want to
  17083. // allow <SVG> or <mATH>.
  17084. if (!isCustomComponentTag && type !== type.toLowerCase()) {
  17085. error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type);
  17086. }
  17087. }
  17088. if (type === 'script') {
  17089. // Create the script via .innerHTML so its "parser-inserted" flag is
  17090. // set to true and it does not execute
  17091. var div = ownerDocument.createElement('div');
  17092. div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
  17093. // This is guaranteed to yield a script element.
  17094. var firstChild = div.firstChild;
  17095. domElement = div.removeChild(firstChild);
  17096. } else if (typeof props.is === 'string') {
  17097. // $FlowIssue `createElement` should be updated for Web Components
  17098. domElement = ownerDocument.createElement(type, {
  17099. is: props.is
  17100. });
  17101. } else {
  17102. // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
  17103. // See discussion in https://github.com/facebook/react/pull/6896
  17104. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  17105. domElement = ownerDocument.createElement(type); // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size`
  17106. // attributes on `select`s needs to be added before `option`s are inserted.
  17107. // This prevents:
  17108. // - a bug where the `select` does not scroll to the correct option because singular
  17109. // `select` elements automatically pick the first item #13222
  17110. // - a bug where the `select` set the first item as selected despite the `size` attribute #14239
  17111. // See https://github.com/facebook/react/issues/13222
  17112. // and https://github.com/facebook/react/issues/14239
  17113. if (type === 'select') {
  17114. var node = domElement;
  17115. if (props.multiple) {
  17116. node.multiple = true;
  17117. } else if (props.size) {
  17118. // Setting a size greater than 1 causes a select to behave like `multiple=true`, where
  17119. // it is possible that no option is selected.
  17120. //
  17121. // This is only necessary when a select in "single selection mode".
  17122. node.size = props.size;
  17123. }
  17124. }
  17125. }
  17126. } else {
  17127. domElement = ownerDocument.createElementNS(namespaceURI, type);
  17128. }
  17129. {
  17130. if (namespaceURI === HTML_NAMESPACE$1) {
  17131. if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
  17132. warnedUnknownTags[type] = true;
  17133. error('The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
  17134. }
  17135. }
  17136. }
  17137. return domElement;
  17138. }
  17139. function createTextNode(text, rootContainerElement) {
  17140. return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
  17141. }
  17142. function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
  17143. var isCustomComponentTag = isCustomComponent(tag, rawProps);
  17144. {
  17145. validatePropertiesInDevelopment(tag, rawProps);
  17146. } // TODO: Make sure that we check isMounted before firing any of these events.
  17147. var props;
  17148. switch (tag) {
  17149. case 'iframe':
  17150. case 'object':
  17151. case 'embed':
  17152. trapBubbledEvent(TOP_LOAD, domElement);
  17153. props = rawProps;
  17154. break;
  17155. case 'video':
  17156. case 'audio':
  17157. // Create listener for each media event
  17158. for (var i = 0; i < mediaEventTypes.length; i++) {
  17159. trapBubbledEvent(mediaEventTypes[i], domElement);
  17160. }
  17161. props = rawProps;
  17162. break;
  17163. case 'source':
  17164. trapBubbledEvent(TOP_ERROR, domElement);
  17165. props = rawProps;
  17166. break;
  17167. case 'img':
  17168. case 'image':
  17169. case 'link':
  17170. trapBubbledEvent(TOP_ERROR, domElement);
  17171. trapBubbledEvent(TOP_LOAD, domElement);
  17172. props = rawProps;
  17173. break;
  17174. case 'form':
  17175. trapBubbledEvent(TOP_RESET, domElement);
  17176. trapBubbledEvent(TOP_SUBMIT, domElement);
  17177. props = rawProps;
  17178. break;
  17179. case 'details':
  17180. trapBubbledEvent(TOP_TOGGLE, domElement);
  17181. props = rawProps;
  17182. break;
  17183. case 'input':
  17184. initWrapperState(domElement, rawProps);
  17185. props = getHostProps(domElement, rawProps);
  17186. trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  17187. // to onChange. Even if there is no listener.
  17188. ensureListeningTo(rootContainerElement, 'onChange');
  17189. break;
  17190. case 'option':
  17191. validateProps(domElement, rawProps);
  17192. props = getHostProps$1(domElement, rawProps);
  17193. break;
  17194. case 'select':
  17195. initWrapperState$1(domElement, rawProps);
  17196. props = getHostProps$2(domElement, rawProps);
  17197. trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  17198. // to onChange. Even if there is no listener.
  17199. ensureListeningTo(rootContainerElement, 'onChange');
  17200. break;
  17201. case 'textarea':
  17202. initWrapperState$2(domElement, rawProps);
  17203. props = getHostProps$3(domElement, rawProps);
  17204. trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  17205. // to onChange. Even if there is no listener.
  17206. ensureListeningTo(rootContainerElement, 'onChange');
  17207. break;
  17208. default:
  17209. props = rawProps;
  17210. }
  17211. assertValidProps(tag, props);
  17212. setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
  17213. switch (tag) {
  17214. case 'input':
  17215. // TODO: Make sure we check if this is still unmounted or do any clean
  17216. // up necessary since we never stop tracking anymore.
  17217. track(domElement);
  17218. postMountWrapper(domElement, rawProps, false);
  17219. break;
  17220. case 'textarea':
  17221. // TODO: Make sure we check if this is still unmounted or do any clean
  17222. // up necessary since we never stop tracking anymore.
  17223. track(domElement);
  17224. postMountWrapper$3(domElement);
  17225. break;
  17226. case 'option':
  17227. postMountWrapper$1(domElement, rawProps);
  17228. break;
  17229. case 'select':
  17230. postMountWrapper$2(domElement, rawProps);
  17231. break;
  17232. default:
  17233. if (typeof props.onClick === 'function') {
  17234. // TODO: This cast may not be sound for SVG, MathML or custom elements.
  17235. trapClickOnNonInteractiveElement(domElement);
  17236. }
  17237. break;
  17238. }
  17239. } // Calculate the diff between the two objects.
  17240. function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
  17241. {
  17242. validatePropertiesInDevelopment(tag, nextRawProps);
  17243. }
  17244. var updatePayload = null;
  17245. var lastProps;
  17246. var nextProps;
  17247. switch (tag) {
  17248. case 'input':
  17249. lastProps = getHostProps(domElement, lastRawProps);
  17250. nextProps = getHostProps(domElement, nextRawProps);
  17251. updatePayload = [];
  17252. break;
  17253. case 'option':
  17254. lastProps = getHostProps$1(domElement, lastRawProps);
  17255. nextProps = getHostProps$1(domElement, nextRawProps);
  17256. updatePayload = [];
  17257. break;
  17258. case 'select':
  17259. lastProps = getHostProps$2(domElement, lastRawProps);
  17260. nextProps = getHostProps$2(domElement, nextRawProps);
  17261. updatePayload = [];
  17262. break;
  17263. case 'textarea':
  17264. lastProps = getHostProps$3(domElement, lastRawProps);
  17265. nextProps = getHostProps$3(domElement, nextRawProps);
  17266. updatePayload = [];
  17267. break;
  17268. default:
  17269. lastProps = lastRawProps;
  17270. nextProps = nextRawProps;
  17271. if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
  17272. // TODO: This cast may not be sound for SVG, MathML or custom elements.
  17273. trapClickOnNonInteractiveElement(domElement);
  17274. }
  17275. break;
  17276. }
  17277. assertValidProps(tag, nextProps);
  17278. var propKey;
  17279. var styleName;
  17280. var styleUpdates = null;
  17281. for (propKey in lastProps) {
  17282. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  17283. continue;
  17284. }
  17285. if (propKey === STYLE) {
  17286. var lastStyle = lastProps[propKey];
  17287. for (styleName in lastStyle) {
  17288. if (lastStyle.hasOwnProperty(styleName)) {
  17289. if (!styleUpdates) {
  17290. styleUpdates = {};
  17291. }
  17292. styleUpdates[styleName] = '';
  17293. }
  17294. }
  17295. } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) ; else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameModules.hasOwnProperty(propKey)) {
  17296. // This is a special case. If any listener updates we need to ensure
  17297. // that the "current" fiber pointer gets updated so we need a commit
  17298. // to update this element.
  17299. if (!updatePayload) {
  17300. updatePayload = [];
  17301. }
  17302. } else {
  17303. // For all other deleted properties we add it to the queue. We use
  17304. // the whitelist in the commit phase instead.
  17305. (updatePayload = updatePayload || []).push(propKey, null);
  17306. }
  17307. }
  17308. for (propKey in nextProps) {
  17309. var nextProp = nextProps[propKey];
  17310. var lastProp = lastProps != null ? lastProps[propKey] : undefined;
  17311. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  17312. continue;
  17313. }
  17314. if (propKey === STYLE) {
  17315. {
  17316. if (nextProp) {
  17317. // Freeze the next style object so that we can assume it won't be
  17318. // mutated. We have already warned for this in the past.
  17319. Object.freeze(nextProp);
  17320. }
  17321. }
  17322. if (lastProp) {
  17323. // Unset styles on `lastProp` but not on `nextProp`.
  17324. for (styleName in lastProp) {
  17325. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  17326. if (!styleUpdates) {
  17327. styleUpdates = {};
  17328. }
  17329. styleUpdates[styleName] = '';
  17330. }
  17331. } // Update styles that changed since `lastProp`.
  17332. for (styleName in nextProp) {
  17333. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  17334. if (!styleUpdates) {
  17335. styleUpdates = {};
  17336. }
  17337. styleUpdates[styleName] = nextProp[styleName];
  17338. }
  17339. }
  17340. } else {
  17341. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  17342. if (!styleUpdates) {
  17343. if (!updatePayload) {
  17344. updatePayload = [];
  17345. }
  17346. updatePayload.push(propKey, styleUpdates);
  17347. }
  17348. styleUpdates = nextProp;
  17349. }
  17350. } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  17351. var nextHtml = nextProp ? nextProp[HTML$1] : undefined;
  17352. var lastHtml = lastProp ? lastProp[HTML$1] : undefined;
  17353. if (nextHtml != null) {
  17354. if (lastHtml !== nextHtml) {
  17355. (updatePayload = updatePayload || []).push(propKey, nextHtml);
  17356. }
  17357. }
  17358. } else if (propKey === CHILDREN) {
  17359. if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
  17360. (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
  17361. }
  17362. } else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (registrationNameModules.hasOwnProperty(propKey)) {
  17363. if (nextProp != null) {
  17364. // We eagerly listen to this even though we haven't committed yet.
  17365. if ( typeof nextProp !== 'function') {
  17366. warnForInvalidEventListener(propKey, nextProp);
  17367. }
  17368. ensureListeningTo(rootContainerElement, propKey);
  17369. }
  17370. if (!updatePayload && lastProp !== nextProp) {
  17371. // This is a special case. If any listener updates we need to ensure
  17372. // that the "current" props pointer gets updated so we need a commit
  17373. // to update this element.
  17374. updatePayload = [];
  17375. }
  17376. } else {
  17377. // For any other property we always add it to the queue and then we
  17378. // filter it out using the whitelist during the commit.
  17379. (updatePayload = updatePayload || []).push(propKey, nextProp);
  17380. }
  17381. }
  17382. if (styleUpdates) {
  17383. {
  17384. validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]);
  17385. }
  17386. (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
  17387. }
  17388. return updatePayload;
  17389. } // Apply the diff.
  17390. function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
  17391. // Update checked *before* name.
  17392. // In the middle of an update, it is possible to have multiple checked.
  17393. // When a checked radio tries to change name, browser makes another radio's checked false.
  17394. if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
  17395. updateChecked(domElement, nextRawProps);
  17396. }
  17397. var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
  17398. var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff.
  17399. updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag); // TODO: Ensure that an update gets scheduled if any of the special props
  17400. // changed.
  17401. switch (tag) {
  17402. case 'input':
  17403. // Update the wrapper around inputs *after* updating props. This has to
  17404. // happen after `updateDOMProperties`. Otherwise HTML5 input validations
  17405. // raise warnings and prevent the new value from being assigned.
  17406. updateWrapper(domElement, nextRawProps);
  17407. break;
  17408. case 'textarea':
  17409. updateWrapper$1(domElement, nextRawProps);
  17410. break;
  17411. case 'select':
  17412. // <select> value update needs to occur after <option> children
  17413. // reconciliation
  17414. postUpdateWrapper(domElement, nextRawProps);
  17415. break;
  17416. }
  17417. }
  17418. function getPossibleStandardName(propName) {
  17419. {
  17420. var lowerCasedName = propName.toLowerCase();
  17421. if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
  17422. return null;
  17423. }
  17424. return possibleStandardNames[lowerCasedName] || null;
  17425. }
  17426. }
  17427. function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
  17428. var isCustomComponentTag;
  17429. var extraAttributeNames;
  17430. {
  17431. suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING] === true;
  17432. isCustomComponentTag = isCustomComponent(tag, rawProps);
  17433. validatePropertiesInDevelopment(tag, rawProps);
  17434. } // TODO: Make sure that we check isMounted before firing any of these events.
  17435. switch (tag) {
  17436. case 'iframe':
  17437. case 'object':
  17438. case 'embed':
  17439. trapBubbledEvent(TOP_LOAD, domElement);
  17440. break;
  17441. case 'video':
  17442. case 'audio':
  17443. // Create listener for each media event
  17444. for (var i = 0; i < mediaEventTypes.length; i++) {
  17445. trapBubbledEvent(mediaEventTypes[i], domElement);
  17446. }
  17447. break;
  17448. case 'source':
  17449. trapBubbledEvent(TOP_ERROR, domElement);
  17450. break;
  17451. case 'img':
  17452. case 'image':
  17453. case 'link':
  17454. trapBubbledEvent(TOP_ERROR, domElement);
  17455. trapBubbledEvent(TOP_LOAD, domElement);
  17456. break;
  17457. case 'form':
  17458. trapBubbledEvent(TOP_RESET, domElement);
  17459. trapBubbledEvent(TOP_SUBMIT, domElement);
  17460. break;
  17461. case 'details':
  17462. trapBubbledEvent(TOP_TOGGLE, domElement);
  17463. break;
  17464. case 'input':
  17465. initWrapperState(domElement, rawProps);
  17466. trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  17467. // to onChange. Even if there is no listener.
  17468. ensureListeningTo(rootContainerElement, 'onChange');
  17469. break;
  17470. case 'option':
  17471. validateProps(domElement, rawProps);
  17472. break;
  17473. case 'select':
  17474. initWrapperState$1(domElement, rawProps);
  17475. trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  17476. // to onChange. Even if there is no listener.
  17477. ensureListeningTo(rootContainerElement, 'onChange');
  17478. break;
  17479. case 'textarea':
  17480. initWrapperState$2(domElement, rawProps);
  17481. trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  17482. // to onChange. Even if there is no listener.
  17483. ensureListeningTo(rootContainerElement, 'onChange');
  17484. break;
  17485. }
  17486. assertValidProps(tag, rawProps);
  17487. {
  17488. extraAttributeNames = new Set();
  17489. var attributes = domElement.attributes;
  17490. for (var _i = 0; _i < attributes.length; _i++) {
  17491. var name = attributes[_i].name.toLowerCase();
  17492. switch (name) {
  17493. // Built-in SSR attribute is whitelisted
  17494. case 'data-reactroot':
  17495. break;
  17496. // Controlled attributes are not validated
  17497. // TODO: Only ignore them on controlled tags.
  17498. case 'value':
  17499. break;
  17500. case 'checked':
  17501. break;
  17502. case 'selected':
  17503. break;
  17504. default:
  17505. // Intentionally use the original name.
  17506. // See discussion in https://github.com/facebook/react/pull/10676.
  17507. extraAttributeNames.add(attributes[_i].name);
  17508. }
  17509. }
  17510. }
  17511. var updatePayload = null;
  17512. for (var propKey in rawProps) {
  17513. if (!rawProps.hasOwnProperty(propKey)) {
  17514. continue;
  17515. }
  17516. var nextProp = rawProps[propKey];
  17517. if (propKey === CHILDREN) {
  17518. // For text content children we compare against textContent. This
  17519. // might match additional HTML that is hidden when we read it using
  17520. // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
  17521. // satisfies our requirement. Our requirement is not to produce perfect
  17522. // HTML and attributes. Ideally we should preserve structure but it's
  17523. // ok not to if the visible content is still enough to indicate what
  17524. // even listeners these nodes might be wired up to.
  17525. // TODO: Warn if there is more than a single textNode as a child.
  17526. // TODO: Should we use domElement.firstChild.nodeValue to compare?
  17527. if (typeof nextProp === 'string') {
  17528. if (domElement.textContent !== nextProp) {
  17529. if ( !suppressHydrationWarning) {
  17530. warnForTextDifference(domElement.textContent, nextProp);
  17531. }
  17532. updatePayload = [CHILDREN, nextProp];
  17533. }
  17534. } else if (typeof nextProp === 'number') {
  17535. if (domElement.textContent !== '' + nextProp) {
  17536. if ( !suppressHydrationWarning) {
  17537. warnForTextDifference(domElement.textContent, nextProp);
  17538. }
  17539. updatePayload = [CHILDREN, '' + nextProp];
  17540. }
  17541. }
  17542. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  17543. if (nextProp != null) {
  17544. if ( typeof nextProp !== 'function') {
  17545. warnForInvalidEventListener(propKey, nextProp);
  17546. }
  17547. ensureListeningTo(rootContainerElement, propKey);
  17548. }
  17549. } else if ( // Convince Flow we've calculated it (it's DEV-only in this method.)
  17550. typeof isCustomComponentTag === 'boolean') {
  17551. // Validate that the properties correspond to their expected values.
  17552. var serverValue = void 0;
  17553. var propertyInfo = getPropertyInfo(propKey);
  17554. if (suppressHydrationWarning) ; else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated
  17555. // TODO: Only ignore them on controlled tags.
  17556. propKey === 'value' || propKey === 'checked' || propKey === 'selected') ; else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  17557. var serverHTML = domElement.innerHTML;
  17558. var nextHtml = nextProp ? nextProp[HTML$1] : undefined;
  17559. var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
  17560. if (expectedHTML !== serverHTML) {
  17561. warnForPropDifference(propKey, serverHTML, expectedHTML);
  17562. }
  17563. } else if (propKey === STYLE) {
  17564. // $FlowFixMe - Should be inferred as not undefined.
  17565. extraAttributeNames.delete(propKey);
  17566. if (canDiffStyleForHydrationWarning) {
  17567. var expectedStyle = createDangerousStringForStyles(nextProp);
  17568. serverValue = domElement.getAttribute('style');
  17569. if (expectedStyle !== serverValue) {
  17570. warnForPropDifference(propKey, serverValue, expectedStyle);
  17571. }
  17572. }
  17573. } else if (isCustomComponentTag) {
  17574. // $FlowFixMe - Should be inferred as not undefined.
  17575. extraAttributeNames.delete(propKey.toLowerCase());
  17576. serverValue = getValueForAttribute(domElement, propKey, nextProp);
  17577. if (nextProp !== serverValue) {
  17578. warnForPropDifference(propKey, serverValue, nextProp);
  17579. }
  17580. } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
  17581. var isMismatchDueToBadCasing = false;
  17582. if (propertyInfo !== null) {
  17583. // $FlowFixMe - Should be inferred as not undefined.
  17584. extraAttributeNames.delete(propertyInfo.attributeName);
  17585. serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
  17586. } else {
  17587. var ownNamespace = parentNamespace;
  17588. if (ownNamespace === HTML_NAMESPACE$1) {
  17589. ownNamespace = getIntrinsicNamespace(tag);
  17590. }
  17591. if (ownNamespace === HTML_NAMESPACE$1) {
  17592. // $FlowFixMe - Should be inferred as not undefined.
  17593. extraAttributeNames.delete(propKey.toLowerCase());
  17594. } else {
  17595. var standardName = getPossibleStandardName(propKey);
  17596. if (standardName !== null && standardName !== propKey) {
  17597. // If an SVG prop is supplied with bad casing, it will
  17598. // be successfully parsed from HTML, but will produce a mismatch
  17599. // (and would be incorrectly rendered on the client).
  17600. // However, we already warn about bad casing elsewhere.
  17601. // So we'll skip the misleading extra mismatch warning in this case.
  17602. isMismatchDueToBadCasing = true; // $FlowFixMe - Should be inferred as not undefined.
  17603. extraAttributeNames.delete(standardName);
  17604. } // $FlowFixMe - Should be inferred as not undefined.
  17605. extraAttributeNames.delete(propKey);
  17606. }
  17607. serverValue = getValueForAttribute(domElement, propKey, nextProp);
  17608. }
  17609. if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
  17610. warnForPropDifference(propKey, serverValue, nextProp);
  17611. }
  17612. }
  17613. }
  17614. }
  17615. {
  17616. // $FlowFixMe - Should be inferred as not undefined.
  17617. if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
  17618. // $FlowFixMe - Should be inferred as not undefined.
  17619. warnForExtraAttributes(extraAttributeNames);
  17620. }
  17621. }
  17622. switch (tag) {
  17623. case 'input':
  17624. // TODO: Make sure we check if this is still unmounted or do any clean
  17625. // up necessary since we never stop tracking anymore.
  17626. track(domElement);
  17627. postMountWrapper(domElement, rawProps, true);
  17628. break;
  17629. case 'textarea':
  17630. // TODO: Make sure we check if this is still unmounted or do any clean
  17631. // up necessary since we never stop tracking anymore.
  17632. track(domElement);
  17633. postMountWrapper$3(domElement);
  17634. break;
  17635. case 'select':
  17636. case 'option':
  17637. // For input and textarea we current always set the value property at
  17638. // post mount to force it to diverge from attributes. However, for
  17639. // option and select we don't quite do the same thing and select
  17640. // is not resilient to the DOM state changing so we don't do that here.
  17641. // TODO: Consider not doing this for input and textarea.
  17642. break;
  17643. default:
  17644. if (typeof rawProps.onClick === 'function') {
  17645. // TODO: This cast may not be sound for SVG, MathML or custom elements.
  17646. trapClickOnNonInteractiveElement(domElement);
  17647. }
  17648. break;
  17649. }
  17650. return updatePayload;
  17651. }
  17652. function diffHydratedText(textNode, text) {
  17653. var isDifferent = textNode.nodeValue !== text;
  17654. return isDifferent;
  17655. }
  17656. function warnForUnmatchedText(textNode, text) {
  17657. {
  17658. warnForTextDifference(textNode.nodeValue, text);
  17659. }
  17660. }
  17661. function warnForDeletedHydratableElement(parentNode, child) {
  17662. {
  17663. if (didWarnInvalidHydration) {
  17664. return;
  17665. }
  17666. didWarnInvalidHydration = true;
  17667. error('Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
  17668. }
  17669. }
  17670. function warnForDeletedHydratableText(parentNode, child) {
  17671. {
  17672. if (didWarnInvalidHydration) {
  17673. return;
  17674. }
  17675. didWarnInvalidHydration = true;
  17676. error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
  17677. }
  17678. }
  17679. function warnForInsertedHydratedElement(parentNode, tag, props) {
  17680. {
  17681. if (didWarnInvalidHydration) {
  17682. return;
  17683. }
  17684. didWarnInvalidHydration = true;
  17685. error('Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
  17686. }
  17687. }
  17688. function warnForInsertedHydratedText(parentNode, text) {
  17689. {
  17690. if (text === '') {
  17691. // We expect to insert empty text nodes since they're not represented in
  17692. // the HTML.
  17693. // TODO: Remove this special case if we can just avoid inserting empty
  17694. // text nodes.
  17695. return;
  17696. }
  17697. if (didWarnInvalidHydration) {
  17698. return;
  17699. }
  17700. didWarnInvalidHydration = true;
  17701. error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
  17702. }
  17703. }
  17704. function restoreControlledState$3(domElement, tag, props) {
  17705. switch (tag) {
  17706. case 'input':
  17707. restoreControlledState(domElement, props);
  17708. return;
  17709. case 'textarea':
  17710. restoreControlledState$2(domElement, props);
  17711. return;
  17712. case 'select':
  17713. restoreControlledState$1(domElement, props);
  17714. return;
  17715. }
  17716. }
  17717. function getActiveElement(doc) {
  17718. doc = doc || (typeof document !== 'undefined' ? document : undefined);
  17719. if (typeof doc === 'undefined') {
  17720. return null;
  17721. }
  17722. try {
  17723. return doc.activeElement || doc.body;
  17724. } catch (e) {
  17725. return doc.body;
  17726. }
  17727. }
  17728. /**
  17729. * Given any node return the first leaf node without children.
  17730. *
  17731. * @param {DOMElement|DOMTextNode} node
  17732. * @return {DOMElement|DOMTextNode}
  17733. */
  17734. function getLeafNode(node) {
  17735. while (node && node.firstChild) {
  17736. node = node.firstChild;
  17737. }
  17738. return node;
  17739. }
  17740. /**
  17741. * Get the next sibling within a container. This will walk up the
  17742. * DOM if a node's siblings have been exhausted.
  17743. *
  17744. * @param {DOMElement|DOMTextNode} node
  17745. * @return {?DOMElement|DOMTextNode}
  17746. */
  17747. function getSiblingNode(node) {
  17748. while (node) {
  17749. if (node.nextSibling) {
  17750. return node.nextSibling;
  17751. }
  17752. node = node.parentNode;
  17753. }
  17754. }
  17755. /**
  17756. * Get object describing the nodes which contain characters at offset.
  17757. *
  17758. * @param {DOMElement|DOMTextNode} root
  17759. * @param {number} offset
  17760. * @return {?object}
  17761. */
  17762. function getNodeForCharacterOffset(root, offset) {
  17763. var node = getLeafNode(root);
  17764. var nodeStart = 0;
  17765. var nodeEnd = 0;
  17766. while (node) {
  17767. if (node.nodeType === TEXT_NODE) {
  17768. nodeEnd = nodeStart + node.textContent.length;
  17769. if (nodeStart <= offset && nodeEnd >= offset) {
  17770. return {
  17771. node: node,
  17772. offset: offset - nodeStart
  17773. };
  17774. }
  17775. nodeStart = nodeEnd;
  17776. }
  17777. node = getLeafNode(getSiblingNode(node));
  17778. }
  17779. }
  17780. /**
  17781. * @param {DOMElement} outerNode
  17782. * @return {?object}
  17783. */
  17784. function getOffsets(outerNode) {
  17785. var ownerDocument = outerNode.ownerDocument;
  17786. var win = ownerDocument && ownerDocument.defaultView || window;
  17787. var selection = win.getSelection && win.getSelection();
  17788. if (!selection || selection.rangeCount === 0) {
  17789. return null;
  17790. }
  17791. var anchorNode = selection.anchorNode,
  17792. anchorOffset = selection.anchorOffset,
  17793. focusNode = selection.focusNode,
  17794. focusOffset = selection.focusOffset; // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
  17795. // up/down buttons on an <input type="number">. Anonymous divs do not seem to
  17796. // expose properties, triggering a "Permission denied error" if any of its
  17797. // properties are accessed. The only seemingly possible way to avoid erroring
  17798. // is to access a property that typically works for non-anonymous divs and
  17799. // catch any error that may otherwise arise. See
  17800. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  17801. try {
  17802. /* eslint-disable no-unused-expressions */
  17803. anchorNode.nodeType;
  17804. focusNode.nodeType;
  17805. /* eslint-enable no-unused-expressions */
  17806. } catch (e) {
  17807. return null;
  17808. }
  17809. return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
  17810. }
  17811. /**
  17812. * Returns {start, end} where `start` is the character/codepoint index of
  17813. * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
  17814. * `end` is the index of (focusNode, focusOffset).
  17815. *
  17816. * Returns null if you pass in garbage input but we should probably just crash.
  17817. *
  17818. * Exported only for testing.
  17819. */
  17820. function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
  17821. var length = 0;
  17822. var start = -1;
  17823. var end = -1;
  17824. var indexWithinAnchor = 0;
  17825. var indexWithinFocus = 0;
  17826. var node = outerNode;
  17827. var parentNode = null;
  17828. outer: while (true) {
  17829. var next = null;
  17830. while (true) {
  17831. if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
  17832. start = length + anchorOffset;
  17833. }
  17834. if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
  17835. end = length + focusOffset;
  17836. }
  17837. if (node.nodeType === TEXT_NODE) {
  17838. length += node.nodeValue.length;
  17839. }
  17840. if ((next = node.firstChild) === null) {
  17841. break;
  17842. } // Moving from `node` to its first child `next`.
  17843. parentNode = node;
  17844. node = next;
  17845. }
  17846. while (true) {
  17847. if (node === outerNode) {
  17848. // If `outerNode` has children, this is always the second time visiting
  17849. // it. If it has no children, this is still the first loop, and the only
  17850. // valid selection is anchorNode and focusNode both equal to this node
  17851. // and both offsets 0, in which case we will have handled above.
  17852. break outer;
  17853. }
  17854. if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
  17855. start = length;
  17856. }
  17857. if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
  17858. end = length;
  17859. }
  17860. if ((next = node.nextSibling) !== null) {
  17861. break;
  17862. }
  17863. node = parentNode;
  17864. parentNode = node.parentNode;
  17865. } // Moving from `node` to its next sibling `next`.
  17866. node = next;
  17867. }
  17868. if (start === -1 || end === -1) {
  17869. // This should never happen. (Would happen if the anchor/focus nodes aren't
  17870. // actually inside the passed-in node.)
  17871. return null;
  17872. }
  17873. return {
  17874. start: start,
  17875. end: end
  17876. };
  17877. }
  17878. /**
  17879. * In modern non-IE browsers, we can support both forward and backward
  17880. * selections.
  17881. *
  17882. * Note: IE10+ supports the Selection object, but it does not support
  17883. * the `extend` method, which means that even in modern IE, it's not possible
  17884. * to programmatically create a backward selection. Thus, for all IE
  17885. * versions, we use the old IE API to create our selections.
  17886. *
  17887. * @param {DOMElement|DOMTextNode} node
  17888. * @param {object} offsets
  17889. */
  17890. function setOffsets(node, offsets) {
  17891. var doc = node.ownerDocument || document;
  17892. var win = doc && doc.defaultView || window; // Edge fails with "Object expected" in some scenarios.
  17893. // (For instance: TinyMCE editor used in a list component that supports pasting to add more,
  17894. // fails when pasting 100+ items)
  17895. if (!win.getSelection) {
  17896. return;
  17897. }
  17898. var selection = win.getSelection();
  17899. var length = node.textContent.length;
  17900. var start = Math.min(offsets.start, length);
  17901. var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method.
  17902. // Flip backward selections, so we can set with a single range.
  17903. if (!selection.extend && start > end) {
  17904. var temp = end;
  17905. end = start;
  17906. start = temp;
  17907. }
  17908. var startMarker = getNodeForCharacterOffset(node, start);
  17909. var endMarker = getNodeForCharacterOffset(node, end);
  17910. if (startMarker && endMarker) {
  17911. if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
  17912. return;
  17913. }
  17914. var range = doc.createRange();
  17915. range.setStart(startMarker.node, startMarker.offset);
  17916. selection.removeAllRanges();
  17917. if (start > end) {
  17918. selection.addRange(range);
  17919. selection.extend(endMarker.node, endMarker.offset);
  17920. } else {
  17921. range.setEnd(endMarker.node, endMarker.offset);
  17922. selection.addRange(range);
  17923. }
  17924. }
  17925. }
  17926. function isTextNode(node) {
  17927. return node && node.nodeType === TEXT_NODE;
  17928. }
  17929. function containsNode(outerNode, innerNode) {
  17930. if (!outerNode || !innerNode) {
  17931. return false;
  17932. } else if (outerNode === innerNode) {
  17933. return true;
  17934. } else if (isTextNode(outerNode)) {
  17935. return false;
  17936. } else if (isTextNode(innerNode)) {
  17937. return containsNode(outerNode, innerNode.parentNode);
  17938. } else if ('contains' in outerNode) {
  17939. return outerNode.contains(innerNode);
  17940. } else if (outerNode.compareDocumentPosition) {
  17941. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  17942. } else {
  17943. return false;
  17944. }
  17945. }
  17946. function isInDocument(node) {
  17947. return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
  17948. }
  17949. function isSameOriginFrame(iframe) {
  17950. try {
  17951. // Accessing the contentDocument of a HTMLIframeElement can cause the browser
  17952. // to throw, e.g. if it has a cross-origin src attribute.
  17953. // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g:
  17954. // iframe.contentDocument.defaultView;
  17955. // A safety way is to access one of the cross origin properties: Window or Location
  17956. // Which might result in "SecurityError" DOM Exception and it is compatible to Safari.
  17957. // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
  17958. return typeof iframe.contentWindow.location.href === 'string';
  17959. } catch (err) {
  17960. return false;
  17961. }
  17962. }
  17963. function getActiveElementDeep() {
  17964. var win = window;
  17965. var element = getActiveElement();
  17966. while (element instanceof win.HTMLIFrameElement) {
  17967. if (isSameOriginFrame(element)) {
  17968. win = element.contentWindow;
  17969. } else {
  17970. return element;
  17971. }
  17972. element = getActiveElement(win.document);
  17973. }
  17974. return element;
  17975. }
  17976. /**
  17977. * @ReactInputSelection: React input selection module. Based on Selection.js,
  17978. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  17979. * assume buttons have range selections allowed).
  17980. * Input selection module for React.
  17981. */
  17982. /**
  17983. * @hasSelectionCapabilities: we get the element types that support selection
  17984. * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
  17985. * and `selectionEnd` rows.
  17986. */
  17987. function hasSelectionCapabilities(elem) {
  17988. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  17989. return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
  17990. }
  17991. function getSelectionInformation() {
  17992. var focusedElem = getActiveElementDeep();
  17993. return {
  17994. // Used by Flare
  17995. activeElementDetached: null,
  17996. focusedElem: focusedElem,
  17997. selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null
  17998. };
  17999. }
  18000. /**
  18001. * @restoreSelection: If any selection information was potentially lost,
  18002. * restore it. This is useful when performing operations that could remove dom
  18003. * nodes and place them back in, resulting in focus being lost.
  18004. */
  18005. function restoreSelection(priorSelectionInformation) {
  18006. var curFocusedElem = getActiveElementDeep();
  18007. var priorFocusedElem = priorSelectionInformation.focusedElem;
  18008. var priorSelectionRange = priorSelectionInformation.selectionRange;
  18009. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  18010. if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
  18011. setSelection(priorFocusedElem, priorSelectionRange);
  18012. } // Focusing a node can change the scroll position, which is undesirable
  18013. var ancestors = [];
  18014. var ancestor = priorFocusedElem;
  18015. while (ancestor = ancestor.parentNode) {
  18016. if (ancestor.nodeType === ELEMENT_NODE) {
  18017. ancestors.push({
  18018. element: ancestor,
  18019. left: ancestor.scrollLeft,
  18020. top: ancestor.scrollTop
  18021. });
  18022. }
  18023. }
  18024. if (typeof priorFocusedElem.focus === 'function') {
  18025. priorFocusedElem.focus();
  18026. }
  18027. for (var i = 0; i < ancestors.length; i++) {
  18028. var info = ancestors[i];
  18029. info.element.scrollLeft = info.left;
  18030. info.element.scrollTop = info.top;
  18031. }
  18032. }
  18033. }
  18034. /**
  18035. * @getSelection: Gets the selection bounds of a focused textarea, input or
  18036. * contentEditable node.
  18037. * -@input: Look up selection bounds of this input
  18038. * -@return {start: selectionStart, end: selectionEnd}
  18039. */
  18040. function getSelection(input) {
  18041. var selection;
  18042. if ('selectionStart' in input) {
  18043. // Modern browser with input or textarea.
  18044. selection = {
  18045. start: input.selectionStart,
  18046. end: input.selectionEnd
  18047. };
  18048. } else {
  18049. // Content editable or old IE textarea.
  18050. selection = getOffsets(input);
  18051. }
  18052. return selection || {
  18053. start: 0,
  18054. end: 0
  18055. };
  18056. }
  18057. /**
  18058. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  18059. * the input.
  18060. * -@input Set selection bounds of this input or textarea
  18061. * -@offsets Object of same form that is returned from get*
  18062. */
  18063. function setSelection(input, offsets) {
  18064. var start = offsets.start,
  18065. end = offsets.end;
  18066. if (end === undefined) {
  18067. end = start;
  18068. }
  18069. if ('selectionStart' in input) {
  18070. input.selectionStart = start;
  18071. input.selectionEnd = Math.min(end, input.value.length);
  18072. } else {
  18073. setOffsets(input, offsets);
  18074. }
  18075. }
  18076. var validateDOMNesting = function () {};
  18077. var updatedAncestorInfo = function () {};
  18078. {
  18079. // This validation code was written based on the HTML5 parsing spec:
  18080. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  18081. //
  18082. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  18083. // not clear what practical benefit doing so provides); instead, we warn only
  18084. // for cases where the parser will give a parse tree differing from what React
  18085. // intended. For example, <b><div></div></b> is invalid but we don't warn
  18086. // because it still parses correctly; we do warn for other cases like nested
  18087. // <p> tags where the beginning of the second element implicitly closes the
  18088. // first, causing a confusing mess.
  18089. // https://html.spec.whatwg.org/multipage/syntax.html#special
  18090. var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  18091. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  18092. // TODO: Distinguish by namespace here -- for <title>, including it here
  18093. // errs on the side of fewer warnings
  18094. 'foreignObject', 'desc', 'title']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  18095. var buttonScopeTags = inScopeTags.concat(['button']); // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  18096. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  18097. var emptyAncestorInfo = {
  18098. current: null,
  18099. formTag: null,
  18100. aTagInScope: null,
  18101. buttonTagInScope: null,
  18102. nobrTagInScope: null,
  18103. pTagInButtonScope: null,
  18104. listItemTagAutoclosing: null,
  18105. dlItemTagAutoclosing: null
  18106. };
  18107. updatedAncestorInfo = function (oldInfo, tag) {
  18108. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  18109. var info = {
  18110. tag: tag
  18111. };
  18112. if (inScopeTags.indexOf(tag) !== -1) {
  18113. ancestorInfo.aTagInScope = null;
  18114. ancestorInfo.buttonTagInScope = null;
  18115. ancestorInfo.nobrTagInScope = null;
  18116. }
  18117. if (buttonScopeTags.indexOf(tag) !== -1) {
  18118. ancestorInfo.pTagInButtonScope = null;
  18119. } // See rules for 'li', 'dd', 'dt' start tags in
  18120. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  18121. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  18122. ancestorInfo.listItemTagAutoclosing = null;
  18123. ancestorInfo.dlItemTagAutoclosing = null;
  18124. }
  18125. ancestorInfo.current = info;
  18126. if (tag === 'form') {
  18127. ancestorInfo.formTag = info;
  18128. }
  18129. if (tag === 'a') {
  18130. ancestorInfo.aTagInScope = info;
  18131. }
  18132. if (tag === 'button') {
  18133. ancestorInfo.buttonTagInScope = info;
  18134. }
  18135. if (tag === 'nobr') {
  18136. ancestorInfo.nobrTagInScope = info;
  18137. }
  18138. if (tag === 'p') {
  18139. ancestorInfo.pTagInButtonScope = info;
  18140. }
  18141. if (tag === 'li') {
  18142. ancestorInfo.listItemTagAutoclosing = info;
  18143. }
  18144. if (tag === 'dd' || tag === 'dt') {
  18145. ancestorInfo.dlItemTagAutoclosing = info;
  18146. }
  18147. return ancestorInfo;
  18148. };
  18149. /**
  18150. * Returns whether
  18151. */
  18152. var isTagValidWithParent = function (tag, parentTag) {
  18153. // First, let's check if we're in an unusual parsing mode...
  18154. switch (parentTag) {
  18155. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  18156. case 'select':
  18157. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  18158. case 'optgroup':
  18159. return tag === 'option' || tag === '#text';
  18160. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  18161. // but
  18162. case 'option':
  18163. return tag === '#text';
  18164. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  18165. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  18166. // No special behavior since these rules fall back to "in body" mode for
  18167. // all except special table nodes which cause bad parsing behavior anyway.
  18168. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  18169. case 'tr':
  18170. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  18171. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  18172. case 'tbody':
  18173. case 'thead':
  18174. case 'tfoot':
  18175. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  18176. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  18177. case 'colgroup':
  18178. return tag === 'col' || tag === 'template';
  18179. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  18180. case 'table':
  18181. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  18182. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  18183. case 'head':
  18184. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  18185. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  18186. case 'html':
  18187. return tag === 'head' || tag === 'body' || tag === 'frameset';
  18188. case 'frameset':
  18189. return tag === 'frame';
  18190. case '#document':
  18191. return tag === 'html';
  18192. } // Probably in the "in body" parsing mode, so we outlaw only tag combos
  18193. // where the parsing rules cause implicit opens or closes to be added.
  18194. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  18195. switch (tag) {
  18196. case 'h1':
  18197. case 'h2':
  18198. case 'h3':
  18199. case 'h4':
  18200. case 'h5':
  18201. case 'h6':
  18202. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  18203. case 'rp':
  18204. case 'rt':
  18205. return impliedEndTags.indexOf(parentTag) === -1;
  18206. case 'body':
  18207. case 'caption':
  18208. case 'col':
  18209. case 'colgroup':
  18210. case 'frameset':
  18211. case 'frame':
  18212. case 'head':
  18213. case 'html':
  18214. case 'tbody':
  18215. case 'td':
  18216. case 'tfoot':
  18217. case 'th':
  18218. case 'thead':
  18219. case 'tr':
  18220. // These tags are only valid with a few parents that have special child
  18221. // parsing rules -- if we're down here, then none of those matched and
  18222. // so we allow it only if we don't know what the parent is, as all other
  18223. // cases are invalid.
  18224. return parentTag == null;
  18225. }
  18226. return true;
  18227. };
  18228. /**
  18229. * Returns whether
  18230. */
  18231. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  18232. switch (tag) {
  18233. case 'address':
  18234. case 'article':
  18235. case 'aside':
  18236. case 'blockquote':
  18237. case 'center':
  18238. case 'details':
  18239. case 'dialog':
  18240. case 'dir':
  18241. case 'div':
  18242. case 'dl':
  18243. case 'fieldset':
  18244. case 'figcaption':
  18245. case 'figure':
  18246. case 'footer':
  18247. case 'header':
  18248. case 'hgroup':
  18249. case 'main':
  18250. case 'menu':
  18251. case 'nav':
  18252. case 'ol':
  18253. case 'p':
  18254. case 'section':
  18255. case 'summary':
  18256. case 'ul':
  18257. case 'pre':
  18258. case 'listing':
  18259. case 'table':
  18260. case 'hr':
  18261. case 'xmp':
  18262. case 'h1':
  18263. case 'h2':
  18264. case 'h3':
  18265. case 'h4':
  18266. case 'h5':
  18267. case 'h6':
  18268. return ancestorInfo.pTagInButtonScope;
  18269. case 'form':
  18270. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  18271. case 'li':
  18272. return ancestorInfo.listItemTagAutoclosing;
  18273. case 'dd':
  18274. case 'dt':
  18275. return ancestorInfo.dlItemTagAutoclosing;
  18276. case 'button':
  18277. return ancestorInfo.buttonTagInScope;
  18278. case 'a':
  18279. // Spec says something about storing a list of markers, but it sounds
  18280. // equivalent to this check.
  18281. return ancestorInfo.aTagInScope;
  18282. case 'nobr':
  18283. return ancestorInfo.nobrTagInScope;
  18284. }
  18285. return null;
  18286. };
  18287. var didWarn$1 = {};
  18288. validateDOMNesting = function (childTag, childText, ancestorInfo) {
  18289. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  18290. var parentInfo = ancestorInfo.current;
  18291. var parentTag = parentInfo && parentInfo.tag;
  18292. if (childText != null) {
  18293. if (childTag != null) {
  18294. error('validateDOMNesting: when childText is passed, childTag should be null');
  18295. }
  18296. childTag = '#text';
  18297. }
  18298. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  18299. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  18300. var invalidParentOrAncestor = invalidParent || invalidAncestor;
  18301. if (!invalidParentOrAncestor) {
  18302. return;
  18303. }
  18304. var ancestorTag = invalidParentOrAncestor.tag;
  18305. var addendum = getCurrentFiberStackInDev();
  18306. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
  18307. if (didWarn$1[warnKey]) {
  18308. return;
  18309. }
  18310. didWarn$1[warnKey] = true;
  18311. var tagDisplayName = childTag;
  18312. var whitespaceInfo = '';
  18313. if (childTag === '#text') {
  18314. if (/\S/.test(childText)) {
  18315. tagDisplayName = 'Text nodes';
  18316. } else {
  18317. tagDisplayName = 'Whitespace text nodes';
  18318. whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
  18319. }
  18320. } else {
  18321. tagDisplayName = '<' + childTag + '>';
  18322. }
  18323. if (invalidParent) {
  18324. var info = '';
  18325. if (ancestorTag === 'table' && childTag === 'tr') {
  18326. info += ' Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by ' + 'the browser.';
  18327. }
  18328. error('validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info);
  18329. } else {
  18330. error('validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.', tagDisplayName, ancestorTag);
  18331. }
  18332. };
  18333. }
  18334. var SUPPRESS_HYDRATION_WARNING$1;
  18335. {
  18336. SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
  18337. }
  18338. var SUSPENSE_START_DATA = '$';
  18339. var SUSPENSE_END_DATA = '/$';
  18340. var SUSPENSE_PENDING_START_DATA = '$?';
  18341. var SUSPENSE_FALLBACK_START_DATA = '$!';
  18342. var STYLE$1 = 'style';
  18343. var eventsEnabled = null;
  18344. var selectionInformation = null;
  18345. function shouldAutoFocusHostComponent(type, props) {
  18346. switch (type) {
  18347. case 'button':
  18348. case 'input':
  18349. case 'select':
  18350. case 'textarea':
  18351. return !!props.autoFocus;
  18352. }
  18353. return false;
  18354. }
  18355. function getRootHostContext(rootContainerInstance) {
  18356. var type;
  18357. var namespace;
  18358. var nodeType = rootContainerInstance.nodeType;
  18359. switch (nodeType) {
  18360. case DOCUMENT_NODE:
  18361. case DOCUMENT_FRAGMENT_NODE:
  18362. {
  18363. type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
  18364. var root = rootContainerInstance.documentElement;
  18365. namespace = root ? root.namespaceURI : getChildNamespace(null, '');
  18366. break;
  18367. }
  18368. default:
  18369. {
  18370. var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
  18371. var ownNamespace = container.namespaceURI || null;
  18372. type = container.tagName;
  18373. namespace = getChildNamespace(ownNamespace, type);
  18374. break;
  18375. }
  18376. }
  18377. {
  18378. var validatedTag = type.toLowerCase();
  18379. var ancestorInfo = updatedAncestorInfo(null, validatedTag);
  18380. return {
  18381. namespace: namespace,
  18382. ancestorInfo: ancestorInfo
  18383. };
  18384. }
  18385. }
  18386. function getChildHostContext(parentHostContext, type, rootContainerInstance) {
  18387. {
  18388. var parentHostContextDev = parentHostContext;
  18389. var namespace = getChildNamespace(parentHostContextDev.namespace, type);
  18390. var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
  18391. return {
  18392. namespace: namespace,
  18393. ancestorInfo: ancestorInfo
  18394. };
  18395. }
  18396. }
  18397. function getPublicInstance(instance) {
  18398. return instance;
  18399. }
  18400. function prepareForCommit(containerInfo) {
  18401. eventsEnabled = isEnabled();
  18402. selectionInformation = getSelectionInformation();
  18403. setEnabled(false);
  18404. }
  18405. function resetAfterCommit(containerInfo) {
  18406. restoreSelection(selectionInformation);
  18407. setEnabled(eventsEnabled);
  18408. eventsEnabled = null;
  18409. selectionInformation = null;
  18410. }
  18411. function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
  18412. var parentNamespace;
  18413. {
  18414. // TODO: take namespace into account when validating.
  18415. var hostContextDev = hostContext;
  18416. validateDOMNesting(type, null, hostContextDev.ancestorInfo);
  18417. if (typeof props.children === 'string' || typeof props.children === 'number') {
  18418. var string = '' + props.children;
  18419. var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
  18420. validateDOMNesting(null, string, ownAncestorInfo);
  18421. }
  18422. parentNamespace = hostContextDev.namespace;
  18423. }
  18424. var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
  18425. precacheFiberNode(internalInstanceHandle, domElement);
  18426. updateFiberProps(domElement, props);
  18427. return domElement;
  18428. }
  18429. function appendInitialChild(parentInstance, child) {
  18430. parentInstance.appendChild(child);
  18431. }
  18432. function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
  18433. setInitialProperties(domElement, type, props, rootContainerInstance);
  18434. return shouldAutoFocusHostComponent(type, props);
  18435. }
  18436. function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
  18437. {
  18438. var hostContextDev = hostContext;
  18439. if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
  18440. var string = '' + newProps.children;
  18441. var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
  18442. validateDOMNesting(null, string, ownAncestorInfo);
  18443. }
  18444. }
  18445. return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
  18446. }
  18447. function shouldSetTextContent(type, props) {
  18448. return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
  18449. }
  18450. function shouldDeprioritizeSubtree(type, props) {
  18451. return !!props.hidden;
  18452. }
  18453. function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
  18454. {
  18455. var hostContextDev = hostContext;
  18456. validateDOMNesting(null, text, hostContextDev.ancestorInfo);
  18457. }
  18458. var textNode = createTextNode(text, rootContainerInstance);
  18459. precacheFiberNode(internalInstanceHandle, textNode);
  18460. return textNode;
  18461. }
  18462. // if a component just imports ReactDOM (e.g. for findDOMNode).
  18463. // Some environments might not have setTimeout or clearTimeout.
  18464. var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
  18465. var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
  18466. var noTimeout = -1; // -------------------
  18467. function commitMount(domElement, type, newProps, internalInstanceHandle) {
  18468. // Despite the naming that might imply otherwise, this method only
  18469. // fires if there is an `Update` effect scheduled during mounting.
  18470. // This happens if `finalizeInitialChildren` returns `true` (which it
  18471. // does to implement the `autoFocus` attribute on the client). But
  18472. // there are also other cases when this might happen (such as patching
  18473. // up text content during hydration mismatch). So we'll check this again.
  18474. if (shouldAutoFocusHostComponent(type, newProps)) {
  18475. domElement.focus();
  18476. }
  18477. }
  18478. function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
  18479. // Update the props handle so that we know which props are the ones with
  18480. // with current event handlers.
  18481. updateFiberProps(domElement, newProps); // Apply the diff to the DOM node.
  18482. updateProperties(domElement, updatePayload, type, oldProps, newProps);
  18483. }
  18484. function resetTextContent(domElement) {
  18485. setTextContent(domElement, '');
  18486. }
  18487. function commitTextUpdate(textInstance, oldText, newText) {
  18488. textInstance.nodeValue = newText;
  18489. }
  18490. function appendChild(parentInstance, child) {
  18491. parentInstance.appendChild(child);
  18492. }
  18493. function appendChildToContainer(container, child) {
  18494. var parentNode;
  18495. if (container.nodeType === COMMENT_NODE) {
  18496. parentNode = container.parentNode;
  18497. parentNode.insertBefore(child, container);
  18498. } else {
  18499. parentNode = container;
  18500. parentNode.appendChild(child);
  18501. } // This container might be used for a portal.
  18502. // If something inside a portal is clicked, that click should bubble
  18503. // through the React tree. However, on Mobile Safari the click would
  18504. // never bubble through the *DOM* tree unless an ancestor with onclick
  18505. // event exists. So we wouldn't see it and dispatch it.
  18506. // This is why we ensure that non React root containers have inline onclick
  18507. // defined.
  18508. // https://github.com/facebook/react/issues/11918
  18509. var reactRootContainer = container._reactRootContainer;
  18510. if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
  18511. // TODO: This cast may not be sound for SVG, MathML or custom elements.
  18512. trapClickOnNonInteractiveElement(parentNode);
  18513. }
  18514. }
  18515. function insertBefore(parentInstance, child, beforeChild) {
  18516. parentInstance.insertBefore(child, beforeChild);
  18517. }
  18518. function insertInContainerBefore(container, child, beforeChild) {
  18519. if (container.nodeType === COMMENT_NODE) {
  18520. container.parentNode.insertBefore(child, beforeChild);
  18521. } else {
  18522. container.insertBefore(child, beforeChild);
  18523. }
  18524. }
  18525. function removeChild(parentInstance, child) {
  18526. parentInstance.removeChild(child);
  18527. }
  18528. function removeChildFromContainer(container, child) {
  18529. if (container.nodeType === COMMENT_NODE) {
  18530. container.parentNode.removeChild(child);
  18531. } else {
  18532. container.removeChild(child);
  18533. }
  18534. }
  18535. function hideInstance(instance) {
  18536. // pass host context to this method?
  18537. instance = instance;
  18538. var style = instance.style;
  18539. if (typeof style.setProperty === 'function') {
  18540. style.setProperty('display', 'none', 'important');
  18541. } else {
  18542. style.display = 'none';
  18543. }
  18544. }
  18545. function hideTextInstance(textInstance) {
  18546. textInstance.nodeValue = '';
  18547. }
  18548. function unhideInstance(instance, props) {
  18549. instance = instance;
  18550. var styleProp = props[STYLE$1];
  18551. var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
  18552. instance.style.display = dangerousStyleValue('display', display);
  18553. }
  18554. function unhideTextInstance(textInstance, text) {
  18555. textInstance.nodeValue = text;
  18556. } // -------------------
  18557. function canHydrateInstance(instance, type, props) {
  18558. if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
  18559. return null;
  18560. } // This has now been refined to an element node.
  18561. return instance;
  18562. }
  18563. function canHydrateTextInstance(instance, text) {
  18564. if (text === '' || instance.nodeType !== TEXT_NODE) {
  18565. // Empty strings are not parsed by HTML so there won't be a correct match here.
  18566. return null;
  18567. } // This has now been refined to a text node.
  18568. return instance;
  18569. }
  18570. function isSuspenseInstancePending(instance) {
  18571. return instance.data === SUSPENSE_PENDING_START_DATA;
  18572. }
  18573. function isSuspenseInstanceFallback(instance) {
  18574. return instance.data === SUSPENSE_FALLBACK_START_DATA;
  18575. }
  18576. function getNextHydratable(node) {
  18577. // Skip non-hydratable nodes.
  18578. for (; node != null; node = node.nextSibling) {
  18579. var nodeType = node.nodeType;
  18580. if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
  18581. break;
  18582. }
  18583. }
  18584. return node;
  18585. }
  18586. function getNextHydratableSibling(instance) {
  18587. return getNextHydratable(instance.nextSibling);
  18588. }
  18589. function getFirstHydratableChild(parentInstance) {
  18590. return getNextHydratable(parentInstance.firstChild);
  18591. }
  18592. function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
  18593. precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events
  18594. // get attached.
  18595. updateFiberProps(instance, props);
  18596. var parentNamespace;
  18597. {
  18598. var hostContextDev = hostContext;
  18599. parentNamespace = hostContextDev.namespace;
  18600. }
  18601. return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
  18602. }
  18603. function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
  18604. precacheFiberNode(internalInstanceHandle, textInstance);
  18605. return diffHydratedText(textInstance, text);
  18606. }
  18607. function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
  18608. var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary.
  18609. // There might be nested nodes so we need to keep track of how
  18610. // deep we are and only break out when we're back on top.
  18611. var depth = 0;
  18612. while (node) {
  18613. if (node.nodeType === COMMENT_NODE) {
  18614. var data = node.data;
  18615. if (data === SUSPENSE_END_DATA) {
  18616. if (depth === 0) {
  18617. return getNextHydratableSibling(node);
  18618. } else {
  18619. depth--;
  18620. }
  18621. } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
  18622. depth++;
  18623. }
  18624. }
  18625. node = node.nextSibling;
  18626. } // TODO: Warn, we didn't find the end comment boundary.
  18627. return null;
  18628. } // Returns the SuspenseInstance if this node is a direct child of a
  18629. // SuspenseInstance. I.e. if its previous sibling is a Comment with
  18630. // SUSPENSE_x_START_DATA. Otherwise, null.
  18631. function getParentSuspenseInstance(targetInstance) {
  18632. var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary.
  18633. // There might be nested nodes so we need to keep track of how
  18634. // deep we are and only break out when we're back on top.
  18635. var depth = 0;
  18636. while (node) {
  18637. if (node.nodeType === COMMENT_NODE) {
  18638. var data = node.data;
  18639. if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
  18640. if (depth === 0) {
  18641. return node;
  18642. } else {
  18643. depth--;
  18644. }
  18645. } else if (data === SUSPENSE_END_DATA) {
  18646. depth++;
  18647. }
  18648. }
  18649. node = node.previousSibling;
  18650. }
  18651. return null;
  18652. }
  18653. function commitHydratedContainer(container) {
  18654. // Retry if any event replaying was blocked on this.
  18655. retryIfBlockedOn(container);
  18656. }
  18657. function commitHydratedSuspenseInstance(suspenseInstance) {
  18658. // Retry if any event replaying was blocked on this.
  18659. retryIfBlockedOn(suspenseInstance);
  18660. }
  18661. function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
  18662. {
  18663. warnForUnmatchedText(textInstance, text);
  18664. }
  18665. }
  18666. function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
  18667. if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
  18668. warnForUnmatchedText(textInstance, text);
  18669. }
  18670. }
  18671. function didNotHydrateContainerInstance(parentContainer, instance) {
  18672. {
  18673. if (instance.nodeType === ELEMENT_NODE) {
  18674. warnForDeletedHydratableElement(parentContainer, instance);
  18675. } else if (instance.nodeType === COMMENT_NODE) ; else {
  18676. warnForDeletedHydratableText(parentContainer, instance);
  18677. }
  18678. }
  18679. }
  18680. function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
  18681. if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
  18682. if (instance.nodeType === ELEMENT_NODE) {
  18683. warnForDeletedHydratableElement(parentInstance, instance);
  18684. } else if (instance.nodeType === COMMENT_NODE) ; else {
  18685. warnForDeletedHydratableText(parentInstance, instance);
  18686. }
  18687. }
  18688. }
  18689. function didNotFindHydratableContainerInstance(parentContainer, type, props) {
  18690. {
  18691. warnForInsertedHydratedElement(parentContainer, type);
  18692. }
  18693. }
  18694. function didNotFindHydratableContainerTextInstance(parentContainer, text) {
  18695. {
  18696. warnForInsertedHydratedText(parentContainer, text);
  18697. }
  18698. }
  18699. function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
  18700. if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
  18701. warnForInsertedHydratedElement(parentInstance, type);
  18702. }
  18703. }
  18704. function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
  18705. if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
  18706. warnForInsertedHydratedText(parentInstance, text);
  18707. }
  18708. }
  18709. function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
  18710. if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) ;
  18711. }
  18712. var randomKey = Math.random().toString(36).slice(2);
  18713. var internalInstanceKey = '__reactInternalInstance$' + randomKey;
  18714. var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
  18715. var internalContainerInstanceKey = '__reactContainere$' + randomKey;
  18716. function precacheFiberNode(hostInst, node) {
  18717. node[internalInstanceKey] = hostInst;
  18718. }
  18719. function markContainerAsRoot(hostRoot, node) {
  18720. node[internalContainerInstanceKey] = hostRoot;
  18721. }
  18722. function unmarkContainerAsRoot(node) {
  18723. node[internalContainerInstanceKey] = null;
  18724. }
  18725. function isContainerMarkedAsRoot(node) {
  18726. return !!node[internalContainerInstanceKey];
  18727. } // Given a DOM node, return the closest HostComponent or HostText fiber ancestor.
  18728. // If the target node is part of a hydrated or not yet rendered subtree, then
  18729. // this may also return a SuspenseComponent or HostRoot to indicate that.
  18730. // Conceptually the HostRoot fiber is a child of the Container node. So if you
  18731. // pass the Container node as the targetNode, you will not actually get the
  18732. // HostRoot back. To get to the HostRoot, you need to pass a child of it.
  18733. // The same thing applies to Suspense boundaries.
  18734. function getClosestInstanceFromNode(targetNode) {
  18735. var targetInst = targetNode[internalInstanceKey];
  18736. if (targetInst) {
  18737. // Don't return HostRoot or SuspenseComponent here.
  18738. return targetInst;
  18739. } // If the direct event target isn't a React owned DOM node, we need to look
  18740. // to see if one of its parents is a React owned DOM node.
  18741. var parentNode = targetNode.parentNode;
  18742. while (parentNode) {
  18743. // We'll check if this is a container root that could include
  18744. // React nodes in the future. We need to check this first because
  18745. // if we're a child of a dehydrated container, we need to first
  18746. // find that inner container before moving on to finding the parent
  18747. // instance. Note that we don't check this field on the targetNode
  18748. // itself because the fibers are conceptually between the container
  18749. // node and the first child. It isn't surrounding the container node.
  18750. // If it's not a container, we check if it's an instance.
  18751. targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey];
  18752. if (targetInst) {
  18753. // Since this wasn't the direct target of the event, we might have
  18754. // stepped past dehydrated DOM nodes to get here. However they could
  18755. // also have been non-React nodes. We need to answer which one.
  18756. // If we the instance doesn't have any children, then there can't be
  18757. // a nested suspense boundary within it. So we can use this as a fast
  18758. // bailout. Most of the time, when people add non-React children to
  18759. // the tree, it is using a ref to a child-less DOM node.
  18760. // Normally we'd only need to check one of the fibers because if it
  18761. // has ever gone from having children to deleting them or vice versa
  18762. // it would have deleted the dehydrated boundary nested inside already.
  18763. // However, since the HostRoot starts out with an alternate it might
  18764. // have one on the alternate so we need to check in case this was a
  18765. // root.
  18766. var alternate = targetInst.alternate;
  18767. if (targetInst.child !== null || alternate !== null && alternate.child !== null) {
  18768. // Next we need to figure out if the node that skipped past is
  18769. // nested within a dehydrated boundary and if so, which one.
  18770. var suspenseInstance = getParentSuspenseInstance(targetNode);
  18771. while (suspenseInstance !== null) {
  18772. // We found a suspense instance. That means that we haven't
  18773. // hydrated it yet. Even though we leave the comments in the
  18774. // DOM after hydrating, and there are boundaries in the DOM
  18775. // that could already be hydrated, we wouldn't have found them
  18776. // through this pass since if the target is hydrated it would
  18777. // have had an internalInstanceKey on it.
  18778. // Let's get the fiber associated with the SuspenseComponent
  18779. // as the deepest instance.
  18780. var targetSuspenseInst = suspenseInstance[internalInstanceKey];
  18781. if (targetSuspenseInst) {
  18782. return targetSuspenseInst;
  18783. } // If we don't find a Fiber on the comment, it might be because
  18784. // we haven't gotten to hydrate it yet. There might still be a
  18785. // parent boundary that hasn't above this one so we need to find
  18786. // the outer most that is known.
  18787. suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent
  18788. // host component also hasn't hydrated yet. We can return it
  18789. // below since it will bail out on the isMounted check later.
  18790. }
  18791. }
  18792. return targetInst;
  18793. }
  18794. targetNode = parentNode;
  18795. parentNode = targetNode.parentNode;
  18796. }
  18797. return null;
  18798. }
  18799. /**
  18800. * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
  18801. * instance, or null if the node was not rendered by this React.
  18802. */
  18803. function getInstanceFromNode$1(node) {
  18804. var inst = node[internalInstanceKey] || node[internalContainerInstanceKey];
  18805. if (inst) {
  18806. if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) {
  18807. return inst;
  18808. } else {
  18809. return null;
  18810. }
  18811. }
  18812. return null;
  18813. }
  18814. /**
  18815. * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
  18816. * DOM node.
  18817. */
  18818. function getNodeFromInstance$1(inst) {
  18819. if (inst.tag === HostComponent || inst.tag === HostText) {
  18820. // In Fiber this, is just the state node right now. We assume it will be
  18821. // a host component or host text.
  18822. return inst.stateNode;
  18823. } // Without this first invariant, passing a non-DOM-component triggers the next
  18824. // invariant for a missing parent, which is super confusing.
  18825. {
  18826. {
  18827. throw Error( "getNodeFromInstance: Invalid argument." );
  18828. }
  18829. }
  18830. }
  18831. function getFiberCurrentPropsFromNode$1(node) {
  18832. return node[internalEventHandlersKey] || null;
  18833. }
  18834. function updateFiberProps(node, props) {
  18835. node[internalEventHandlersKey] = props;
  18836. }
  18837. function getParent(inst) {
  18838. do {
  18839. inst = inst.return; // TODO: If this is a HostRoot we might want to bail out.
  18840. // That is depending on if we want nested subtrees (layers) to bubble
  18841. // events to their parent. We could also go through parentNode on the
  18842. // host node but that wouldn't work for React Native and doesn't let us
  18843. // do the portal feature.
  18844. } while (inst && inst.tag !== HostComponent);
  18845. if (inst) {
  18846. return inst;
  18847. }
  18848. return null;
  18849. }
  18850. /**
  18851. * Return the lowest common ancestor of A and B, or null if they are in
  18852. * different trees.
  18853. */
  18854. function getLowestCommonAncestor(instA, instB) {
  18855. var depthA = 0;
  18856. for (var tempA = instA; tempA; tempA = getParent(tempA)) {
  18857. depthA++;
  18858. }
  18859. var depthB = 0;
  18860. for (var tempB = instB; tempB; tempB = getParent(tempB)) {
  18861. depthB++;
  18862. } // If A is deeper, crawl up.
  18863. while (depthA - depthB > 0) {
  18864. instA = getParent(instA);
  18865. depthA--;
  18866. } // If B is deeper, crawl up.
  18867. while (depthB - depthA > 0) {
  18868. instB = getParent(instB);
  18869. depthB--;
  18870. } // Walk in lockstep until we find a match.
  18871. var depth = depthA;
  18872. while (depth--) {
  18873. if (instA === instB || instA === instB.alternate) {
  18874. return instA;
  18875. }
  18876. instA = getParent(instA);
  18877. instB = getParent(instB);
  18878. }
  18879. return null;
  18880. }
  18881. /**
  18882. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  18883. */
  18884. function traverseTwoPhase(inst, fn, arg) {
  18885. var path = [];
  18886. while (inst) {
  18887. path.push(inst);
  18888. inst = getParent(inst);
  18889. }
  18890. var i;
  18891. for (i = path.length; i-- > 0;) {
  18892. fn(path[i], 'captured', arg);
  18893. }
  18894. for (i = 0; i < path.length; i++) {
  18895. fn(path[i], 'bubbled', arg);
  18896. }
  18897. }
  18898. /**
  18899. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  18900. * should would receive a `mouseEnter` or `mouseLeave` event.
  18901. *
  18902. * Does not invoke the callback on the nearest common ancestor because nothing
  18903. * "entered" or "left" that element.
  18904. */
  18905. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  18906. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  18907. var pathFrom = [];
  18908. while (true) {
  18909. if (!from) {
  18910. break;
  18911. }
  18912. if (from === common) {
  18913. break;
  18914. }
  18915. var alternate = from.alternate;
  18916. if (alternate !== null && alternate === common) {
  18917. break;
  18918. }
  18919. pathFrom.push(from);
  18920. from = getParent(from);
  18921. }
  18922. var pathTo = [];
  18923. while (true) {
  18924. if (!to) {
  18925. break;
  18926. }
  18927. if (to === common) {
  18928. break;
  18929. }
  18930. var _alternate = to.alternate;
  18931. if (_alternate !== null && _alternate === common) {
  18932. break;
  18933. }
  18934. pathTo.push(to);
  18935. to = getParent(to);
  18936. }
  18937. for (var i = 0; i < pathFrom.length; i++) {
  18938. fn(pathFrom[i], 'bubbled', argFrom);
  18939. }
  18940. for (var _i = pathTo.length; _i-- > 0;) {
  18941. fn(pathTo[_i], 'captured', argTo);
  18942. }
  18943. }
  18944. function isInteractive(tag) {
  18945. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  18946. }
  18947. function shouldPreventMouseEvent(name, type, props) {
  18948. switch (name) {
  18949. case 'onClick':
  18950. case 'onClickCapture':
  18951. case 'onDoubleClick':
  18952. case 'onDoubleClickCapture':
  18953. case 'onMouseDown':
  18954. case 'onMouseDownCapture':
  18955. case 'onMouseMove':
  18956. case 'onMouseMoveCapture':
  18957. case 'onMouseUp':
  18958. case 'onMouseUpCapture':
  18959. case 'onMouseEnter':
  18960. return !!(props.disabled && isInteractive(type));
  18961. default:
  18962. return false;
  18963. }
  18964. }
  18965. /**
  18966. * @param {object} inst The instance, which is the source of events.
  18967. * @param {string} registrationName Name of listener (e.g. `onClick`).
  18968. * @return {?function} The stored callback.
  18969. */
  18970. function getListener(inst, registrationName) {
  18971. var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  18972. // live here; needs to be moved to a better place soon
  18973. var stateNode = inst.stateNode;
  18974. if (!stateNode) {
  18975. // Work in progress (ex: onload events in incremental mode).
  18976. return null;
  18977. }
  18978. var props = getFiberCurrentPropsFromNode(stateNode);
  18979. if (!props) {
  18980. // Work in progress.
  18981. return null;
  18982. }
  18983. listener = props[registrationName];
  18984. if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
  18985. return null;
  18986. }
  18987. if (!(!listener || typeof listener === 'function')) {
  18988. {
  18989. throw Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type." );
  18990. }
  18991. }
  18992. return listener;
  18993. }
  18994. /**
  18995. * Some event types have a notion of different registration names for different
  18996. * "phases" of propagation. This finds listeners by a given phase.
  18997. */
  18998. function listenerAtPhase(inst, event, propagationPhase) {
  18999. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  19000. return getListener(inst, registrationName);
  19001. }
  19002. /**
  19003. * A small set of propagation patterns, each of which will accept a small amount
  19004. * of information, and generate a set of "dispatch ready event objects" - which
  19005. * are sets of events that have already been annotated with a set of dispatched
  19006. * listener functions/ids. The API is designed this way to discourage these
  19007. * propagation strategies from actually executing the dispatches, since we
  19008. * always want to collect the entire set of dispatches before executing even a
  19009. * single one.
  19010. */
  19011. /**
  19012. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  19013. * here, allows us to not have to bind or create functions for each event.
  19014. * Mutating the event's members allows us to not have to create a wrapping
  19015. * "dispatch" object that pairs the event with the listener.
  19016. */
  19017. function accumulateDirectionalDispatches(inst, phase, event) {
  19018. {
  19019. if (!inst) {
  19020. error('Dispatching inst must not be null');
  19021. }
  19022. }
  19023. var listener = listenerAtPhase(inst, event, phase);
  19024. if (listener) {
  19025. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  19026. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  19027. }
  19028. }
  19029. /**
  19030. * Collect dispatches (must be entirely collected before dispatching - see unit
  19031. * tests). Lazily allocate the array to conserve memory. We must loop through
  19032. * each event and perform the traversal for each one. We cannot perform a
  19033. * single traversal for the entire collection of events because each event may
  19034. * have a different target.
  19035. */
  19036. function accumulateTwoPhaseDispatchesSingle(event) {
  19037. if (event && event.dispatchConfig.phasedRegistrationNames) {
  19038. traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  19039. }
  19040. }
  19041. /**
  19042. * Accumulates without regard to direction, does not look for phased
  19043. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  19044. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  19045. */
  19046. function accumulateDispatches(inst, ignoredDirection, event) {
  19047. if (inst && event && event.dispatchConfig.registrationName) {
  19048. var registrationName = event.dispatchConfig.registrationName;
  19049. var listener = getListener(inst, registrationName);
  19050. if (listener) {
  19051. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  19052. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  19053. }
  19054. }
  19055. }
  19056. /**
  19057. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  19058. * `dispatchMarker`.
  19059. * @param {SyntheticEvent} event
  19060. */
  19061. function accumulateDirectDispatchesSingle(event) {
  19062. if (event && event.dispatchConfig.registrationName) {
  19063. accumulateDispatches(event._targetInst, null, event);
  19064. }
  19065. }
  19066. function accumulateTwoPhaseDispatches(events) {
  19067. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  19068. }
  19069. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  19070. traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  19071. }
  19072. function accumulateDirectDispatches(events) {
  19073. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  19074. }
  19075. /**
  19076. * These variables store information about text content of a target node,
  19077. * allowing comparison of content before and after a given event.
  19078. *
  19079. * Identify the node where selection currently begins, then observe
  19080. * both its text content and its current position in the DOM. Since the
  19081. * browser may natively replace the target node during composition, we can
  19082. * use its position to find its replacement.
  19083. *
  19084. *
  19085. */
  19086. var root = null;
  19087. var startText = null;
  19088. var fallbackText = null;
  19089. function initialize(nativeEventTarget) {
  19090. root = nativeEventTarget;
  19091. startText = getText();
  19092. return true;
  19093. }
  19094. function reset() {
  19095. root = null;
  19096. startText = null;
  19097. fallbackText = null;
  19098. }
  19099. function getData() {
  19100. if (fallbackText) {
  19101. return fallbackText;
  19102. }
  19103. var start;
  19104. var startValue = startText;
  19105. var startLength = startValue.length;
  19106. var end;
  19107. var endValue = getText();
  19108. var endLength = endValue.length;
  19109. for (start = 0; start < startLength; start++) {
  19110. if (startValue[start] !== endValue[start]) {
  19111. break;
  19112. }
  19113. }
  19114. var minEnd = startLength - start;
  19115. for (end = 1; end <= minEnd; end++) {
  19116. if (startValue[startLength - end] !== endValue[endLength - end]) {
  19117. break;
  19118. }
  19119. }
  19120. var sliceTail = end > 1 ? 1 - end : undefined;
  19121. fallbackText = endValue.slice(start, sliceTail);
  19122. return fallbackText;
  19123. }
  19124. function getText() {
  19125. if ('value' in root) {
  19126. return root.value;
  19127. }
  19128. return root.textContent;
  19129. }
  19130. var EVENT_POOL_SIZE = 10;
  19131. /**
  19132. * @interface Event
  19133. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  19134. */
  19135. var EventInterface = {
  19136. type: null,
  19137. target: null,
  19138. // currentTarget is set when dispatching; no use in copying it here
  19139. currentTarget: function () {
  19140. return null;
  19141. },
  19142. eventPhase: null,
  19143. bubbles: null,
  19144. cancelable: null,
  19145. timeStamp: function (event) {
  19146. return event.timeStamp || Date.now();
  19147. },
  19148. defaultPrevented: null,
  19149. isTrusted: null
  19150. };
  19151. function functionThatReturnsTrue() {
  19152. return true;
  19153. }
  19154. function functionThatReturnsFalse() {
  19155. return false;
  19156. }
  19157. /**
  19158. * Synthetic events are dispatched by event plugins, typically in response to a
  19159. * top-level event delegation handler.
  19160. *
  19161. * These systems should generally use pooling to reduce the frequency of garbage
  19162. * collection. The system should check `isPersistent` to determine whether the
  19163. * event should be released into the pool after being dispatched. Users that
  19164. * need a persisted event should invoke `persist`.
  19165. *
  19166. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  19167. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  19168. * DOM interface; custom application-specific events can also subclass this.
  19169. *
  19170. * @param {object} dispatchConfig Configuration used to dispatch this event.
  19171. * @param {*} targetInst Marker identifying the event target.
  19172. * @param {object} nativeEvent Native browser event.
  19173. * @param {DOMEventTarget} nativeEventTarget Target node.
  19174. */
  19175. function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
  19176. {
  19177. // these have a getter/setter for warnings
  19178. delete this.nativeEvent;
  19179. delete this.preventDefault;
  19180. delete this.stopPropagation;
  19181. delete this.isDefaultPrevented;
  19182. delete this.isPropagationStopped;
  19183. }
  19184. this.dispatchConfig = dispatchConfig;
  19185. this._targetInst = targetInst;
  19186. this.nativeEvent = nativeEvent;
  19187. var Interface = this.constructor.Interface;
  19188. for (var propName in Interface) {
  19189. if (!Interface.hasOwnProperty(propName)) {
  19190. continue;
  19191. }
  19192. {
  19193. delete this[propName]; // this has a getter/setter for warnings
  19194. }
  19195. var normalize = Interface[propName];
  19196. if (normalize) {
  19197. this[propName] = normalize(nativeEvent);
  19198. } else {
  19199. if (propName === 'target') {
  19200. this.target = nativeEventTarget;
  19201. } else {
  19202. this[propName] = nativeEvent[propName];
  19203. }
  19204. }
  19205. }
  19206. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  19207. if (defaultPrevented) {
  19208. this.isDefaultPrevented = functionThatReturnsTrue;
  19209. } else {
  19210. this.isDefaultPrevented = functionThatReturnsFalse;
  19211. }
  19212. this.isPropagationStopped = functionThatReturnsFalse;
  19213. return this;
  19214. }
  19215. _assign(SyntheticEvent.prototype, {
  19216. preventDefault: function () {
  19217. this.defaultPrevented = true;
  19218. var event = this.nativeEvent;
  19219. if (!event) {
  19220. return;
  19221. }
  19222. if (event.preventDefault) {
  19223. event.preventDefault();
  19224. } else if (typeof event.returnValue !== 'unknown') {
  19225. event.returnValue = false;
  19226. }
  19227. this.isDefaultPrevented = functionThatReturnsTrue;
  19228. },
  19229. stopPropagation: function () {
  19230. var event = this.nativeEvent;
  19231. if (!event) {
  19232. return;
  19233. }
  19234. if (event.stopPropagation) {
  19235. event.stopPropagation();
  19236. } else if (typeof event.cancelBubble !== 'unknown') {
  19237. // The ChangeEventPlugin registers a "propertychange" event for
  19238. // IE. This event does not support bubbling or cancelling, and
  19239. // any references to cancelBubble throw "Member not found". A
  19240. // typeof check of "unknown" circumvents this issue (and is also
  19241. // IE specific).
  19242. event.cancelBubble = true;
  19243. }
  19244. this.isPropagationStopped = functionThatReturnsTrue;
  19245. },
  19246. /**
  19247. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  19248. * them back into the pool. This allows a way to hold onto a reference that
  19249. * won't be added back into the pool.
  19250. */
  19251. persist: function () {
  19252. this.isPersistent = functionThatReturnsTrue;
  19253. },
  19254. /**
  19255. * Checks if this event should be released back into the pool.
  19256. *
  19257. * @return {boolean} True if this should not be released, false otherwise.
  19258. */
  19259. isPersistent: functionThatReturnsFalse,
  19260. /**
  19261. * `PooledClass` looks for `destructor` on each instance it releases.
  19262. */
  19263. destructor: function () {
  19264. var Interface = this.constructor.Interface;
  19265. for (var propName in Interface) {
  19266. {
  19267. Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
  19268. }
  19269. }
  19270. this.dispatchConfig = null;
  19271. this._targetInst = null;
  19272. this.nativeEvent = null;
  19273. this.isDefaultPrevented = functionThatReturnsFalse;
  19274. this.isPropagationStopped = functionThatReturnsFalse;
  19275. this._dispatchListeners = null;
  19276. this._dispatchInstances = null;
  19277. {
  19278. Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
  19279. Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
  19280. Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
  19281. Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
  19282. Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
  19283. }
  19284. }
  19285. });
  19286. SyntheticEvent.Interface = EventInterface;
  19287. /**
  19288. * Helper to reduce boilerplate when creating subclasses.
  19289. */
  19290. SyntheticEvent.extend = function (Interface) {
  19291. var Super = this;
  19292. var E = function () {};
  19293. E.prototype = Super.prototype;
  19294. var prototype = new E();
  19295. function Class() {
  19296. return Super.apply(this, arguments);
  19297. }
  19298. _assign(prototype, Class.prototype);
  19299. Class.prototype = prototype;
  19300. Class.prototype.constructor = Class;
  19301. Class.Interface = _assign({}, Super.Interface, Interface);
  19302. Class.extend = Super.extend;
  19303. addEventPoolingTo(Class);
  19304. return Class;
  19305. };
  19306. addEventPoolingTo(SyntheticEvent);
  19307. /**
  19308. * Helper to nullify syntheticEvent instance properties when destructing
  19309. *
  19310. * @param {String} propName
  19311. * @param {?object} getVal
  19312. * @return {object} defineProperty object
  19313. */
  19314. function getPooledWarningPropertyDefinition(propName, getVal) {
  19315. var isFunction = typeof getVal === 'function';
  19316. return {
  19317. configurable: true,
  19318. set: set,
  19319. get: get
  19320. };
  19321. function set(val) {
  19322. var action = isFunction ? 'setting the method' : 'setting the property';
  19323. warn(action, 'This is effectively a no-op');
  19324. return val;
  19325. }
  19326. function get() {
  19327. var action = isFunction ? 'accessing the method' : 'accessing the property';
  19328. var result = isFunction ? 'This is a no-op function' : 'This is set to null';
  19329. warn(action, result);
  19330. return getVal;
  19331. }
  19332. function warn(action, result) {
  19333. {
  19334. error("This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
  19335. }
  19336. }
  19337. }
  19338. function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
  19339. var EventConstructor = this;
  19340. if (EventConstructor.eventPool.length) {
  19341. var instance = EventConstructor.eventPool.pop();
  19342. EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
  19343. return instance;
  19344. }
  19345. return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
  19346. }
  19347. function releasePooledEvent(event) {
  19348. var EventConstructor = this;
  19349. if (!(event instanceof EventConstructor)) {
  19350. {
  19351. throw Error( "Trying to release an event instance into a pool of a different type." );
  19352. }
  19353. }
  19354. event.destructor();
  19355. if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
  19356. EventConstructor.eventPool.push(event);
  19357. }
  19358. }
  19359. function addEventPoolingTo(EventConstructor) {
  19360. EventConstructor.eventPool = [];
  19361. EventConstructor.getPooled = getPooledEvent;
  19362. EventConstructor.release = releasePooledEvent;
  19363. }
  19364. /**
  19365. * @interface Event
  19366. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  19367. */
  19368. var SyntheticCompositionEvent = SyntheticEvent.extend({
  19369. data: null
  19370. });
  19371. /**
  19372. * @interface Event
  19373. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  19374. * /#events-inputevents
  19375. */
  19376. var SyntheticInputEvent = SyntheticEvent.extend({
  19377. data: null
  19378. });
  19379. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  19380. var START_KEYCODE = 229;
  19381. var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
  19382. var documentMode = null;
  19383. if (canUseDOM && 'documentMode' in document) {
  19384. documentMode = document.documentMode;
  19385. } // Webkit offers a very useful `textInput` event that can be used to
  19386. // directly represent `beforeInput`. The IE `textinput` event is not as
  19387. // useful, so we don't use it.
  19388. var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; // In IE9+, we have access to composition events, but the data supplied
  19389. // by the native compositionend event may be incorrect. Japanese ideographic
  19390. // spaces, for instance (\u3000) are not recorded correctly.
  19391. var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  19392. var SPACEBAR_CODE = 32;
  19393. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); // Events and their corresponding property names.
  19394. var eventTypes = {
  19395. beforeInput: {
  19396. phasedRegistrationNames: {
  19397. bubbled: 'onBeforeInput',
  19398. captured: 'onBeforeInputCapture'
  19399. },
  19400. dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
  19401. },
  19402. compositionEnd: {
  19403. phasedRegistrationNames: {
  19404. bubbled: 'onCompositionEnd',
  19405. captured: 'onCompositionEndCapture'
  19406. },
  19407. dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
  19408. },
  19409. compositionStart: {
  19410. phasedRegistrationNames: {
  19411. bubbled: 'onCompositionStart',
  19412. captured: 'onCompositionStartCapture'
  19413. },
  19414. dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
  19415. },
  19416. compositionUpdate: {
  19417. phasedRegistrationNames: {
  19418. bubbled: 'onCompositionUpdate',
  19419. captured: 'onCompositionUpdateCapture'
  19420. },
  19421. dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
  19422. }
  19423. }; // Track whether we've ever handled a keypress on the space key.
  19424. var hasSpaceKeypress = false;
  19425. /**
  19426. * Return whether a native keypress event is assumed to be a command.
  19427. * This is required because Firefox fires `keypress` events for key commands
  19428. * (cut, copy, select-all, etc.) even though no character is inserted.
  19429. */
  19430. function isKeypressCommand(nativeEvent) {
  19431. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  19432. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  19433. }
  19434. /**
  19435. * Translate native top level events into event types.
  19436. *
  19437. * @param {string} topLevelType
  19438. * @return {object}
  19439. */
  19440. function getCompositionEventType(topLevelType) {
  19441. switch (topLevelType) {
  19442. case TOP_COMPOSITION_START:
  19443. return eventTypes.compositionStart;
  19444. case TOP_COMPOSITION_END:
  19445. return eventTypes.compositionEnd;
  19446. case TOP_COMPOSITION_UPDATE:
  19447. return eventTypes.compositionUpdate;
  19448. }
  19449. }
  19450. /**
  19451. * Does our fallback best-guess model think this event signifies that
  19452. * composition has begun?
  19453. *
  19454. * @param {string} topLevelType
  19455. * @param {object} nativeEvent
  19456. * @return {boolean}
  19457. */
  19458. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  19459. return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
  19460. }
  19461. /**
  19462. * Does our fallback mode think that this event is the end of composition?
  19463. *
  19464. * @param {string} topLevelType
  19465. * @param {object} nativeEvent
  19466. * @return {boolean}
  19467. */
  19468. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  19469. switch (topLevelType) {
  19470. case TOP_KEY_UP:
  19471. // Command keys insert or clear IME input.
  19472. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  19473. case TOP_KEY_DOWN:
  19474. // Expect IME keyCode on each keydown. If we get any other
  19475. // code we must have exited earlier.
  19476. return nativeEvent.keyCode !== START_KEYCODE;
  19477. case TOP_KEY_PRESS:
  19478. case TOP_MOUSE_DOWN:
  19479. case TOP_BLUR:
  19480. // Events are not possible without cancelling IME.
  19481. return true;
  19482. default:
  19483. return false;
  19484. }
  19485. }
  19486. /**
  19487. * Google Input Tools provides composition data via a CustomEvent,
  19488. * with the `data` property populated in the `detail` object. If this
  19489. * is available on the event object, use it. If not, this is a plain
  19490. * composition event and we have nothing special to extract.
  19491. *
  19492. * @param {object} nativeEvent
  19493. * @return {?string}
  19494. */
  19495. function getDataFromCustomEvent(nativeEvent) {
  19496. var detail = nativeEvent.detail;
  19497. if (typeof detail === 'object' && 'data' in detail) {
  19498. return detail.data;
  19499. }
  19500. return null;
  19501. }
  19502. /**
  19503. * Check if a composition event was triggered by Korean IME.
  19504. * Our fallback mode does not work well with IE's Korean IME,
  19505. * so just use native composition events when Korean IME is used.
  19506. * Although CompositionEvent.locale property is deprecated,
  19507. * it is available in IE, where our fallback mode is enabled.
  19508. *
  19509. * @param {object} nativeEvent
  19510. * @return {boolean}
  19511. */
  19512. function isUsingKoreanIME(nativeEvent) {
  19513. return nativeEvent.locale === 'ko';
  19514. } // Track the current IME composition status, if any.
  19515. var isComposing = false;
  19516. /**
  19517. * @return {?object} A SyntheticCompositionEvent.
  19518. */
  19519. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  19520. var eventType;
  19521. var fallbackData;
  19522. if (canUseCompositionEvent) {
  19523. eventType = getCompositionEventType(topLevelType);
  19524. } else if (!isComposing) {
  19525. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  19526. eventType = eventTypes.compositionStart;
  19527. }
  19528. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  19529. eventType = eventTypes.compositionEnd;
  19530. }
  19531. if (!eventType) {
  19532. return null;
  19533. }
  19534. if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
  19535. // The current composition is stored statically and must not be
  19536. // overwritten while composition continues.
  19537. if (!isComposing && eventType === eventTypes.compositionStart) {
  19538. isComposing = initialize(nativeEventTarget);
  19539. } else if (eventType === eventTypes.compositionEnd) {
  19540. if (isComposing) {
  19541. fallbackData = getData();
  19542. }
  19543. }
  19544. }
  19545. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  19546. if (fallbackData) {
  19547. // Inject data generated from fallback path into the synthetic event.
  19548. // This matches the property of native CompositionEventInterface.
  19549. event.data = fallbackData;
  19550. } else {
  19551. var customData = getDataFromCustomEvent(nativeEvent);
  19552. if (customData !== null) {
  19553. event.data = customData;
  19554. }
  19555. }
  19556. accumulateTwoPhaseDispatches(event);
  19557. return event;
  19558. }
  19559. /**
  19560. * @param {TopLevelType} topLevelType Number from `TopLevelType`.
  19561. * @param {object} nativeEvent Native browser event.
  19562. * @return {?string} The string corresponding to this `beforeInput` event.
  19563. */
  19564. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  19565. switch (topLevelType) {
  19566. case TOP_COMPOSITION_END:
  19567. return getDataFromCustomEvent(nativeEvent);
  19568. case TOP_KEY_PRESS:
  19569. /**
  19570. * If native `textInput` events are available, our goal is to make
  19571. * use of them. However, there is a special case: the spacebar key.
  19572. * In Webkit, preventing default on a spacebar `textInput` event
  19573. * cancels character insertion, but it *also* causes the browser
  19574. * to fall back to its default spacebar behavior of scrolling the
  19575. * page.
  19576. *
  19577. * Tracking at:
  19578. * https://code.google.com/p/chromium/issues/detail?id=355103
  19579. *
  19580. * To avoid this issue, use the keypress event as if no `textInput`
  19581. * event is available.
  19582. */
  19583. var which = nativeEvent.which;
  19584. if (which !== SPACEBAR_CODE) {
  19585. return null;
  19586. }
  19587. hasSpaceKeypress = true;
  19588. return SPACEBAR_CHAR;
  19589. case TOP_TEXT_INPUT:
  19590. // Record the characters to be added to the DOM.
  19591. var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled
  19592. // it at the keypress level and bail immediately. Android Chrome
  19593. // doesn't give us keycodes, so we need to ignore it.
  19594. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  19595. return null;
  19596. }
  19597. return chars;
  19598. default:
  19599. // For other native event types, do nothing.
  19600. return null;
  19601. }
  19602. }
  19603. /**
  19604. * For browsers that do not provide the `textInput` event, extract the
  19605. * appropriate string to use for SyntheticInputEvent.
  19606. *
  19607. * @param {number} topLevelType Number from `TopLevelEventTypes`.
  19608. * @param {object} nativeEvent Native browser event.
  19609. * @return {?string} The fallback string for this `beforeInput` event.
  19610. */
  19611. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  19612. // If we are currently composing (IME) and using a fallback to do so,
  19613. // try to extract the composed characters from the fallback object.
  19614. // If composition event is available, we extract a string only at
  19615. // compositionevent, otherwise extract it at fallback events.
  19616. if (isComposing) {
  19617. if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  19618. var chars = getData();
  19619. reset();
  19620. isComposing = false;
  19621. return chars;
  19622. }
  19623. return null;
  19624. }
  19625. switch (topLevelType) {
  19626. case TOP_PASTE:
  19627. // If a paste event occurs after a keypress, throw out the input
  19628. // chars. Paste events should not lead to BeforeInput events.
  19629. return null;
  19630. case TOP_KEY_PRESS:
  19631. /**
  19632. * As of v27, Firefox may fire keypress events even when no character
  19633. * will be inserted. A few possibilities:
  19634. *
  19635. * - `which` is `0`. Arrow keys, Esc key, etc.
  19636. *
  19637. * - `which` is the pressed key code, but no char is available.
  19638. * Ex: 'AltGr + d` in Polish. There is no modified character for
  19639. * this key combination and no character is inserted into the
  19640. * document, but FF fires the keypress for char code `100` anyway.
  19641. * No `input` event will occur.
  19642. *
  19643. * - `which` is the pressed key code, but a command combination is
  19644. * being used. Ex: `Cmd+C`. No character is inserted, and no
  19645. * `input` event will occur.
  19646. */
  19647. if (!isKeypressCommand(nativeEvent)) {
  19648. // IE fires the `keypress` event when a user types an emoji via
  19649. // Touch keyboard of Windows. In such a case, the `char` property
  19650. // holds an emoji character like `\uD83D\uDE0A`. Because its length
  19651. // is 2, the property `which` does not represent an emoji correctly.
  19652. // In such a case, we directly return the `char` property instead of
  19653. // using `which`.
  19654. if (nativeEvent.char && nativeEvent.char.length > 1) {
  19655. return nativeEvent.char;
  19656. } else if (nativeEvent.which) {
  19657. return String.fromCharCode(nativeEvent.which);
  19658. }
  19659. }
  19660. return null;
  19661. case TOP_COMPOSITION_END:
  19662. return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
  19663. default:
  19664. return null;
  19665. }
  19666. }
  19667. /**
  19668. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  19669. * `textInput` or fallback behavior.
  19670. *
  19671. * @return {?object} A SyntheticInputEvent.
  19672. */
  19673. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  19674. var chars;
  19675. if (canUseTextInputEvent) {
  19676. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  19677. } else {
  19678. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  19679. } // If no characters are being inserted, no BeforeInput event should
  19680. // be fired.
  19681. if (!chars) {
  19682. return null;
  19683. }
  19684. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  19685. event.data = chars;
  19686. accumulateTwoPhaseDispatches(event);
  19687. return event;
  19688. }
  19689. /**
  19690. * Create an `onBeforeInput` event to match
  19691. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  19692. *
  19693. * This event plugin is based on the native `textInput` event
  19694. * available in Chrome, Safari, Opera, and IE. This event fires after
  19695. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  19696. *
  19697. * `beforeInput` is spec'd but not implemented in any browsers, and
  19698. * the `input` event does not provide any useful information about what has
  19699. * actually been added, contrary to the spec. Thus, `textInput` is the best
  19700. * available event to identify the characters that have actually been inserted
  19701. * into the target node.
  19702. *
  19703. * This plugin is also responsible for emitting `composition` events, thus
  19704. * allowing us to share composition fallback code for both `beforeInput` and
  19705. * `composition` event types.
  19706. */
  19707. var BeforeInputEventPlugin = {
  19708. eventTypes: eventTypes,
  19709. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  19710. var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  19711. var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  19712. if (composition === null) {
  19713. return beforeInput;
  19714. }
  19715. if (beforeInput === null) {
  19716. return composition;
  19717. }
  19718. return [composition, beforeInput];
  19719. }
  19720. };
  19721. /**
  19722. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  19723. */
  19724. var supportedInputTypes = {
  19725. color: true,
  19726. date: true,
  19727. datetime: true,
  19728. 'datetime-local': true,
  19729. email: true,
  19730. month: true,
  19731. number: true,
  19732. password: true,
  19733. range: true,
  19734. search: true,
  19735. tel: true,
  19736. text: true,
  19737. time: true,
  19738. url: true,
  19739. week: true
  19740. };
  19741. function isTextInputElement(elem) {
  19742. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  19743. if (nodeName === 'input') {
  19744. return !!supportedInputTypes[elem.type];
  19745. }
  19746. if (nodeName === 'textarea') {
  19747. return true;
  19748. }
  19749. return false;
  19750. }
  19751. var eventTypes$1 = {
  19752. change: {
  19753. phasedRegistrationNames: {
  19754. bubbled: 'onChange',
  19755. captured: 'onChangeCapture'
  19756. },
  19757. dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
  19758. }
  19759. };
  19760. function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
  19761. var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
  19762. event.type = 'change'; // Flag this event loop as needing state restore.
  19763. enqueueStateRestore(target);
  19764. accumulateTwoPhaseDispatches(event);
  19765. return event;
  19766. }
  19767. /**
  19768. * For IE shims
  19769. */
  19770. var activeElement = null;
  19771. var activeElementInst = null;
  19772. /**
  19773. * SECTION: handle `change` event
  19774. */
  19775. function shouldUseChangeEvent(elem) {
  19776. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  19777. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  19778. }
  19779. function manualDispatchChangeEvent(nativeEvent) {
  19780. var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); // If change and propertychange bubbled, we'd just bind to it like all the
  19781. // other events and have it go through ReactBrowserEventEmitter. Since it
  19782. // doesn't, we manually listen for the events and so we have to enqueue and
  19783. // process the abstract event manually.
  19784. //
  19785. // Batching is necessary here in order to ensure that all event handlers run
  19786. // before the next rerender (including event handlers attached to ancestor
  19787. // elements instead of directly on the input). Without this, controlled
  19788. // components don't work properly in conjunction with event bubbling because
  19789. // the component is rerendered and the value reverted before all the event
  19790. // handlers can run. See https://github.com/facebook/react/issues/708.
  19791. batchedUpdates(runEventInBatch, event);
  19792. }
  19793. function runEventInBatch(event) {
  19794. runEventsInBatch(event);
  19795. }
  19796. function getInstIfValueChanged(targetInst) {
  19797. var targetNode = getNodeFromInstance$1(targetInst);
  19798. if (updateValueIfChanged(targetNode)) {
  19799. return targetInst;
  19800. }
  19801. }
  19802. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  19803. if (topLevelType === TOP_CHANGE) {
  19804. return targetInst;
  19805. }
  19806. }
  19807. /**
  19808. * SECTION: handle `input` event
  19809. */
  19810. var isInputEventSupported = false;
  19811. if (canUseDOM) {
  19812. // IE9 claims to support the input event but fails to trigger it when
  19813. // deleting text, so we ignore its input events.
  19814. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
  19815. }
  19816. /**
  19817. * (For IE <=9) Starts tracking propertychange events on the passed-in element
  19818. * and override the value property so that we can distinguish user events from
  19819. * value changes in JS.
  19820. */
  19821. function startWatchingForValueChange(target, targetInst) {
  19822. activeElement = target;
  19823. activeElementInst = targetInst;
  19824. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  19825. }
  19826. /**
  19827. * (For IE <=9) Removes the event listeners from the currently-tracked element,
  19828. * if any exists.
  19829. */
  19830. function stopWatchingForValueChange() {
  19831. if (!activeElement) {
  19832. return;
  19833. }
  19834. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  19835. activeElement = null;
  19836. activeElementInst = null;
  19837. }
  19838. /**
  19839. * (For IE <=9) Handles a propertychange event, sending a `change` event if
  19840. * the value of the active element has changed.
  19841. */
  19842. function handlePropertyChange(nativeEvent) {
  19843. if (nativeEvent.propertyName !== 'value') {
  19844. return;
  19845. }
  19846. if (getInstIfValueChanged(activeElementInst)) {
  19847. manualDispatchChangeEvent(nativeEvent);
  19848. }
  19849. }
  19850. function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
  19851. if (topLevelType === TOP_FOCUS) {
  19852. // In IE9, propertychange fires for most input events but is buggy and
  19853. // doesn't fire when text is deleted, but conveniently, selectionchange
  19854. // appears to fire in all of the remaining cases so we catch those and
  19855. // forward the event if the value has changed
  19856. // In either case, we don't want to call the event handler if the value
  19857. // is changed from JS so we redefine a setter for `.value` that updates
  19858. // our activeElementValue variable, allowing us to ignore those changes
  19859. //
  19860. // stopWatching() should be a noop here but we call it just in case we
  19861. // missed a blur event somehow.
  19862. stopWatchingForValueChange();
  19863. startWatchingForValueChange(target, targetInst);
  19864. } else if (topLevelType === TOP_BLUR) {
  19865. stopWatchingForValueChange();
  19866. }
  19867. } // For IE8 and IE9.
  19868. function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
  19869. if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
  19870. // On the selectionchange event, the target is just document which isn't
  19871. // helpful for us so just check activeElement instead.
  19872. //
  19873. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  19874. // propertychange on the first input event after setting `value` from a
  19875. // script and fires only keydown, keypress, keyup. Catching keyup usually
  19876. // gets it and catching keydown lets us fire an event for the first
  19877. // keystroke if user does a key repeat (it'll be a little delayed: right
  19878. // before the second keystroke). Other input methods (e.g., paste) seem to
  19879. // fire selectionchange normally.
  19880. return getInstIfValueChanged(activeElementInst);
  19881. }
  19882. }
  19883. /**
  19884. * SECTION: handle `click` event
  19885. */
  19886. function shouldUseClickEvent(elem) {
  19887. // Use the `click` event to detect changes to checkbox and radio inputs.
  19888. // This approach works across all browsers, whereas `change` does not fire
  19889. // until `blur` in IE8.
  19890. var nodeName = elem.nodeName;
  19891. return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  19892. }
  19893. function getTargetInstForClickEvent(topLevelType, targetInst) {
  19894. if (topLevelType === TOP_CLICK) {
  19895. return getInstIfValueChanged(targetInst);
  19896. }
  19897. }
  19898. function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
  19899. if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
  19900. return getInstIfValueChanged(targetInst);
  19901. }
  19902. }
  19903. function handleControlledInputBlur(node) {
  19904. var state = node._wrapperState;
  19905. if (!state || !state.controlled || node.type !== 'number') {
  19906. return;
  19907. }
  19908. {
  19909. // If controlled, assign the value attribute to the current value on blur
  19910. setDefaultValue(node, 'number', node.value);
  19911. }
  19912. }
  19913. /**
  19914. * This plugin creates an `onChange` event that normalizes change events
  19915. * across form elements. This event fires at a time when it's possible to
  19916. * change the element's value without seeing a flicker.
  19917. *
  19918. * Supported elements are:
  19919. * - input (see `isTextInputElement`)
  19920. * - textarea
  19921. * - select
  19922. */
  19923. var ChangeEventPlugin = {
  19924. eventTypes: eventTypes$1,
  19925. _isInputEventSupported: isInputEventSupported,
  19926. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  19927. var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
  19928. var getTargetInstFunc, handleEventFunc;
  19929. if (shouldUseChangeEvent(targetNode)) {
  19930. getTargetInstFunc = getTargetInstForChangeEvent;
  19931. } else if (isTextInputElement(targetNode)) {
  19932. if (isInputEventSupported) {
  19933. getTargetInstFunc = getTargetInstForInputOrChangeEvent;
  19934. } else {
  19935. getTargetInstFunc = getTargetInstForInputEventPolyfill;
  19936. handleEventFunc = handleEventsForInputEventPolyfill;
  19937. }
  19938. } else if (shouldUseClickEvent(targetNode)) {
  19939. getTargetInstFunc = getTargetInstForClickEvent;
  19940. }
  19941. if (getTargetInstFunc) {
  19942. var inst = getTargetInstFunc(topLevelType, targetInst);
  19943. if (inst) {
  19944. var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
  19945. return event;
  19946. }
  19947. }
  19948. if (handleEventFunc) {
  19949. handleEventFunc(topLevelType, targetNode, targetInst);
  19950. } // When blurring, set the value attribute for number inputs
  19951. if (topLevelType === TOP_BLUR) {
  19952. handleControlledInputBlur(targetNode);
  19953. }
  19954. }
  19955. };
  19956. var SyntheticUIEvent = SyntheticEvent.extend({
  19957. view: null,
  19958. detail: null
  19959. });
  19960. /**
  19961. * Translation from modifier key to the associated property in the event.
  19962. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  19963. */
  19964. var modifierKeyToProp = {
  19965. Alt: 'altKey',
  19966. Control: 'ctrlKey',
  19967. Meta: 'metaKey',
  19968. Shift: 'shiftKey'
  19969. }; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
  19970. // getModifierState. If getModifierState is not supported, we map it to a set of
  19971. // modifier keys exposed by the event. In this case, Lock-keys are not supported.
  19972. function modifierStateGetter(keyArg) {
  19973. var syntheticEvent = this;
  19974. var nativeEvent = syntheticEvent.nativeEvent;
  19975. if (nativeEvent.getModifierState) {
  19976. return nativeEvent.getModifierState(keyArg);
  19977. }
  19978. var keyProp = modifierKeyToProp[keyArg];
  19979. return keyProp ? !!nativeEvent[keyProp] : false;
  19980. }
  19981. function getEventModifierState(nativeEvent) {
  19982. return modifierStateGetter;
  19983. }
  19984. var previousScreenX = 0;
  19985. var previousScreenY = 0; // Use flags to signal movementX/Y has already been set
  19986. var isMovementXSet = false;
  19987. var isMovementYSet = false;
  19988. /**
  19989. * @interface MouseEvent
  19990. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  19991. */
  19992. var SyntheticMouseEvent = SyntheticUIEvent.extend({
  19993. screenX: null,
  19994. screenY: null,
  19995. clientX: null,
  19996. clientY: null,
  19997. pageX: null,
  19998. pageY: null,
  19999. ctrlKey: null,
  20000. shiftKey: null,
  20001. altKey: null,
  20002. metaKey: null,
  20003. getModifierState: getEventModifierState,
  20004. button: null,
  20005. buttons: null,
  20006. relatedTarget: function (event) {
  20007. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  20008. },
  20009. movementX: function (event) {
  20010. if ('movementX' in event) {
  20011. return event.movementX;
  20012. }
  20013. var screenX = previousScreenX;
  20014. previousScreenX = event.screenX;
  20015. if (!isMovementXSet) {
  20016. isMovementXSet = true;
  20017. return 0;
  20018. }
  20019. return event.type === 'mousemove' ? event.screenX - screenX : 0;
  20020. },
  20021. movementY: function (event) {
  20022. if ('movementY' in event) {
  20023. return event.movementY;
  20024. }
  20025. var screenY = previousScreenY;
  20026. previousScreenY = event.screenY;
  20027. if (!isMovementYSet) {
  20028. isMovementYSet = true;
  20029. return 0;
  20030. }
  20031. return event.type === 'mousemove' ? event.screenY - screenY : 0;
  20032. }
  20033. });
  20034. /**
  20035. * @interface PointerEvent
  20036. * @see http://www.w3.org/TR/pointerevents/
  20037. */
  20038. var SyntheticPointerEvent = SyntheticMouseEvent.extend({
  20039. pointerId: null,
  20040. width: null,
  20041. height: null,
  20042. pressure: null,
  20043. tangentialPressure: null,
  20044. tiltX: null,
  20045. tiltY: null,
  20046. twist: null,
  20047. pointerType: null,
  20048. isPrimary: null
  20049. });
  20050. var eventTypes$2 = {
  20051. mouseEnter: {
  20052. registrationName: 'onMouseEnter',
  20053. dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
  20054. },
  20055. mouseLeave: {
  20056. registrationName: 'onMouseLeave',
  20057. dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
  20058. },
  20059. pointerEnter: {
  20060. registrationName: 'onPointerEnter',
  20061. dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
  20062. },
  20063. pointerLeave: {
  20064. registrationName: 'onPointerLeave',
  20065. dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
  20066. }
  20067. };
  20068. var EnterLeaveEventPlugin = {
  20069. eventTypes: eventTypes$2,
  20070. /**
  20071. * For almost every interaction we care about, there will be both a top-level
  20072. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  20073. * we do not extract duplicate events. However, moving the mouse into the
  20074. * browser from outside will not fire a `mouseout` event. In this case, we use
  20075. * the `mouseover` top-level event.
  20076. */
  20077. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  20078. var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
  20079. var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
  20080. if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0 && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  20081. // If this is an over event with a target, then we've already dispatched
  20082. // the event in the out event of the other target. If this is replayed,
  20083. // then it's because we couldn't dispatch against this target previously
  20084. // so we have to do it now instead.
  20085. return null;
  20086. }
  20087. if (!isOutEvent && !isOverEvent) {
  20088. // Must not be a mouse or pointer in or out - ignoring.
  20089. return null;
  20090. }
  20091. var win;
  20092. if (nativeEventTarget.window === nativeEventTarget) {
  20093. // `nativeEventTarget` is probably a window object.
  20094. win = nativeEventTarget;
  20095. } else {
  20096. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  20097. var doc = nativeEventTarget.ownerDocument;
  20098. if (doc) {
  20099. win = doc.defaultView || doc.parentWindow;
  20100. } else {
  20101. win = window;
  20102. }
  20103. }
  20104. var from;
  20105. var to;
  20106. if (isOutEvent) {
  20107. from = targetInst;
  20108. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  20109. to = related ? getClosestInstanceFromNode(related) : null;
  20110. if (to !== null) {
  20111. var nearestMounted = getNearestMountedFiber(to);
  20112. if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) {
  20113. to = null;
  20114. }
  20115. }
  20116. } else {
  20117. // Moving to a node from outside the window.
  20118. from = null;
  20119. to = targetInst;
  20120. }
  20121. if (from === to) {
  20122. // Nothing pertains to our managed components.
  20123. return null;
  20124. }
  20125. var eventInterface, leaveEventType, enterEventType, eventTypePrefix;
  20126. if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
  20127. eventInterface = SyntheticMouseEvent;
  20128. leaveEventType = eventTypes$2.mouseLeave;
  20129. enterEventType = eventTypes$2.mouseEnter;
  20130. eventTypePrefix = 'mouse';
  20131. } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
  20132. eventInterface = SyntheticPointerEvent;
  20133. leaveEventType = eventTypes$2.pointerLeave;
  20134. enterEventType = eventTypes$2.pointerEnter;
  20135. eventTypePrefix = 'pointer';
  20136. }
  20137. var fromNode = from == null ? win : getNodeFromInstance$1(from);
  20138. var toNode = to == null ? win : getNodeFromInstance$1(to);
  20139. var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
  20140. leave.type = eventTypePrefix + 'leave';
  20141. leave.target = fromNode;
  20142. leave.relatedTarget = toNode;
  20143. var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
  20144. enter.type = eventTypePrefix + 'enter';
  20145. enter.target = toNode;
  20146. enter.relatedTarget = fromNode;
  20147. accumulateEnterLeaveDispatches(leave, enter, from, to); // If we are not processing the first ancestor, then we
  20148. // should not process the same nativeEvent again, as we
  20149. // will have already processed it in the first ancestor.
  20150. if ((eventSystemFlags & IS_FIRST_ANCESTOR) === 0) {
  20151. return [leave];
  20152. }
  20153. return [leave, enter];
  20154. }
  20155. };
  20156. /**
  20157. * inlined Object.is polyfill to avoid requiring consumers ship their own
  20158. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  20159. */
  20160. function is(x, y) {
  20161. return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
  20162. ;
  20163. }
  20164. var objectIs = typeof Object.is === 'function' ? Object.is : is;
  20165. var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  20166. /**
  20167. * Performs equality by iterating through keys on an object and returning false
  20168. * when any key has values which are not strictly equal between the arguments.
  20169. * Returns true when the values of all keys are strictly equal.
  20170. */
  20171. function shallowEqual(objA, objB) {
  20172. if (objectIs(objA, objB)) {
  20173. return true;
  20174. }
  20175. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  20176. return false;
  20177. }
  20178. var keysA = Object.keys(objA);
  20179. var keysB = Object.keys(objB);
  20180. if (keysA.length !== keysB.length) {
  20181. return false;
  20182. } // Test for A's keys different from B.
  20183. for (var i = 0; i < keysA.length; i++) {
  20184. if (!hasOwnProperty$2.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
  20185. return false;
  20186. }
  20187. }
  20188. return true;
  20189. }
  20190. var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  20191. var eventTypes$3 = {
  20192. select: {
  20193. phasedRegistrationNames: {
  20194. bubbled: 'onSelect',
  20195. captured: 'onSelectCapture'
  20196. },
  20197. dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
  20198. }
  20199. };
  20200. var activeElement$1 = null;
  20201. var activeElementInst$1 = null;
  20202. var lastSelection = null;
  20203. var mouseDown = false;
  20204. /**
  20205. * Get an object which is a unique representation of the current selection.
  20206. *
  20207. * The return value will not be consistent across nodes or browsers, but
  20208. * two identical selections on the same node will return identical objects.
  20209. *
  20210. * @param {DOMElement} node
  20211. * @return {object}
  20212. */
  20213. function getSelection$1(node) {
  20214. if ('selectionStart' in node && hasSelectionCapabilities(node)) {
  20215. return {
  20216. start: node.selectionStart,
  20217. end: node.selectionEnd
  20218. };
  20219. } else {
  20220. var win = node.ownerDocument && node.ownerDocument.defaultView || window;
  20221. var selection = win.getSelection();
  20222. return {
  20223. anchorNode: selection.anchorNode,
  20224. anchorOffset: selection.anchorOffset,
  20225. focusNode: selection.focusNode,
  20226. focusOffset: selection.focusOffset
  20227. };
  20228. }
  20229. }
  20230. /**
  20231. * Get document associated with the event target.
  20232. *
  20233. * @param {object} nativeEventTarget
  20234. * @return {Document}
  20235. */
  20236. function getEventTargetDocument(eventTarget) {
  20237. return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
  20238. }
  20239. /**
  20240. * Poll selection to see whether it's changed.
  20241. *
  20242. * @param {object} nativeEvent
  20243. * @param {object} nativeEventTarget
  20244. * @return {?SyntheticEvent}
  20245. */
  20246. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  20247. // Ensure we have the right element, and that the user is not dragging a
  20248. // selection (this matches native `select` event behavior). In HTML5, select
  20249. // fires only on input and textarea thus if there's no focused element we
  20250. // won't dispatch.
  20251. var doc = getEventTargetDocument(nativeEventTarget);
  20252. if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
  20253. return null;
  20254. } // Only fire when selection has actually changed.
  20255. var currentSelection = getSelection$1(activeElement$1);
  20256. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  20257. lastSelection = currentSelection;
  20258. var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
  20259. syntheticEvent.type = 'select';
  20260. syntheticEvent.target = activeElement$1;
  20261. accumulateTwoPhaseDispatches(syntheticEvent);
  20262. return syntheticEvent;
  20263. }
  20264. return null;
  20265. }
  20266. /**
  20267. * This plugin creates an `onSelect` event that normalizes select events
  20268. * across form elements.
  20269. *
  20270. * Supported elements are:
  20271. * - input (see `isTextInputElement`)
  20272. * - textarea
  20273. * - contentEditable
  20274. *
  20275. * This differs from native browser implementations in the following ways:
  20276. * - Fires on contentEditable fields as well as inputs.
  20277. * - Fires for collapsed selection.
  20278. * - Fires after user input.
  20279. */
  20280. var SelectEventPlugin = {
  20281. eventTypes: eventTypes$3,
  20282. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, container) {
  20283. var containerOrDoc = container || getEventTargetDocument(nativeEventTarget); // Track whether all listeners exists for this plugin. If none exist, we do
  20284. // not extract events. See #3639.
  20285. if (!containerOrDoc || !isListeningToAllDependencies('onSelect', containerOrDoc)) {
  20286. return null;
  20287. }
  20288. var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
  20289. switch (topLevelType) {
  20290. // Track the input node that has focus.
  20291. case TOP_FOCUS:
  20292. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  20293. activeElement$1 = targetNode;
  20294. activeElementInst$1 = targetInst;
  20295. lastSelection = null;
  20296. }
  20297. break;
  20298. case TOP_BLUR:
  20299. activeElement$1 = null;
  20300. activeElementInst$1 = null;
  20301. lastSelection = null;
  20302. break;
  20303. // Don't fire the event while the user is dragging. This matches the
  20304. // semantics of the native select event.
  20305. case TOP_MOUSE_DOWN:
  20306. mouseDown = true;
  20307. break;
  20308. case TOP_CONTEXT_MENU:
  20309. case TOP_MOUSE_UP:
  20310. case TOP_DRAG_END:
  20311. mouseDown = false;
  20312. return constructSelectEvent(nativeEvent, nativeEventTarget);
  20313. // Chrome and IE fire non-standard event when selection is changed (and
  20314. // sometimes when it hasn't). IE's event fires out of order with respect
  20315. // to key and input events on deletion, so we discard it.
  20316. //
  20317. // Firefox doesn't support selectionchange, so check selection status
  20318. // after each key entry. The selection changes after keydown and before
  20319. // keyup, but we check on keydown as well in the case of holding down a
  20320. // key, when multiple keydown events are fired but only one keyup is.
  20321. // This is also our approach for IE handling, for the reason above.
  20322. case TOP_SELECTION_CHANGE:
  20323. if (skipSelectionChangeEvent) {
  20324. break;
  20325. }
  20326. // falls through
  20327. case TOP_KEY_DOWN:
  20328. case TOP_KEY_UP:
  20329. return constructSelectEvent(nativeEvent, nativeEventTarget);
  20330. }
  20331. return null;
  20332. }
  20333. };
  20334. /**
  20335. * @interface Event
  20336. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  20337. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  20338. */
  20339. var SyntheticAnimationEvent = SyntheticEvent.extend({
  20340. animationName: null,
  20341. elapsedTime: null,
  20342. pseudoElement: null
  20343. });
  20344. /**
  20345. * @interface Event
  20346. * @see http://www.w3.org/TR/clipboard-apis/
  20347. */
  20348. var SyntheticClipboardEvent = SyntheticEvent.extend({
  20349. clipboardData: function (event) {
  20350. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  20351. }
  20352. });
  20353. /**
  20354. * @interface FocusEvent
  20355. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  20356. */
  20357. var SyntheticFocusEvent = SyntheticUIEvent.extend({
  20358. relatedTarget: null
  20359. });
  20360. /**
  20361. * `charCode` represents the actual "character code" and is safe to use with
  20362. * `String.fromCharCode`. As such, only keys that correspond to printable
  20363. * characters produce a valid `charCode`, the only exception to this is Enter.
  20364. * The Tab-key is considered non-printable and does not have a `charCode`,
  20365. * presumably because it does not produce a tab-character in browsers.
  20366. *
  20367. * @param {object} nativeEvent Native browser event.
  20368. * @return {number} Normalized `charCode` property.
  20369. */
  20370. function getEventCharCode(nativeEvent) {
  20371. var charCode;
  20372. var keyCode = nativeEvent.keyCode;
  20373. if ('charCode' in nativeEvent) {
  20374. charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  20375. if (charCode === 0 && keyCode === 13) {
  20376. charCode = 13;
  20377. }
  20378. } else {
  20379. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  20380. charCode = keyCode;
  20381. } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
  20382. // report Enter as charCode 10 when ctrl is pressed.
  20383. if (charCode === 10) {
  20384. charCode = 13;
  20385. } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  20386. // Must not discard the (non-)printable Enter-key.
  20387. if (charCode >= 32 || charCode === 13) {
  20388. return charCode;
  20389. }
  20390. return 0;
  20391. }
  20392. /**
  20393. * Normalization of deprecated HTML5 `key` values
  20394. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  20395. */
  20396. var normalizeKey = {
  20397. Esc: 'Escape',
  20398. Spacebar: ' ',
  20399. Left: 'ArrowLeft',
  20400. Up: 'ArrowUp',
  20401. Right: 'ArrowRight',
  20402. Down: 'ArrowDown',
  20403. Del: 'Delete',
  20404. Win: 'OS',
  20405. Menu: 'ContextMenu',
  20406. Apps: 'ContextMenu',
  20407. Scroll: 'ScrollLock',
  20408. MozPrintableKey: 'Unidentified'
  20409. };
  20410. /**
  20411. * Translation from legacy `keyCode` to HTML5 `key`
  20412. * Only special keys supported, all others depend on keyboard layout or browser
  20413. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  20414. */
  20415. var translateToKey = {
  20416. '8': 'Backspace',
  20417. '9': 'Tab',
  20418. '12': 'Clear',
  20419. '13': 'Enter',
  20420. '16': 'Shift',
  20421. '17': 'Control',
  20422. '18': 'Alt',
  20423. '19': 'Pause',
  20424. '20': 'CapsLock',
  20425. '27': 'Escape',
  20426. '32': ' ',
  20427. '33': 'PageUp',
  20428. '34': 'PageDown',
  20429. '35': 'End',
  20430. '36': 'Home',
  20431. '37': 'ArrowLeft',
  20432. '38': 'ArrowUp',
  20433. '39': 'ArrowRight',
  20434. '40': 'ArrowDown',
  20435. '45': 'Insert',
  20436. '46': 'Delete',
  20437. '112': 'F1',
  20438. '113': 'F2',
  20439. '114': 'F3',
  20440. '115': 'F4',
  20441. '116': 'F5',
  20442. '117': 'F6',
  20443. '118': 'F7',
  20444. '119': 'F8',
  20445. '120': 'F9',
  20446. '121': 'F10',
  20447. '122': 'F11',
  20448. '123': 'F12',
  20449. '144': 'NumLock',
  20450. '145': 'ScrollLock',
  20451. '224': 'Meta'
  20452. };
  20453. /**
  20454. * @param {object} nativeEvent Native browser event.
  20455. * @return {string} Normalized `key` property.
  20456. */
  20457. function getEventKey(nativeEvent) {
  20458. if (nativeEvent.key) {
  20459. // Normalize inconsistent values reported by browsers due to
  20460. // implementations of a working draft specification.
  20461. // FireFox implements `key` but returns `MozPrintableKey` for all
  20462. // printable characters (normalized to `Unidentified`), ignore it.
  20463. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  20464. if (key !== 'Unidentified') {
  20465. return key;
  20466. }
  20467. } // Browser does not implement `key`, polyfill as much of it as we can.
  20468. if (nativeEvent.type === 'keypress') {
  20469. var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can
  20470. // thus be captured by `keypress`, no other non-printable key should.
  20471. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  20472. }
  20473. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  20474. // While user keyboard layout determines the actual meaning of each
  20475. // `keyCode` value, almost all function keys have a universal value.
  20476. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  20477. }
  20478. return '';
  20479. }
  20480. /**
  20481. * @interface KeyboardEvent
  20482. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  20483. */
  20484. var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
  20485. key: getEventKey,
  20486. location: null,
  20487. ctrlKey: null,
  20488. shiftKey: null,
  20489. altKey: null,
  20490. metaKey: null,
  20491. repeat: null,
  20492. locale: null,
  20493. getModifierState: getEventModifierState,
  20494. // Legacy Interface
  20495. charCode: function (event) {
  20496. // `charCode` is the result of a KeyPress event and represents the value of
  20497. // the actual printable character.
  20498. // KeyPress is deprecated, but its replacement is not yet final and not
  20499. // implemented in any major browser. Only KeyPress has charCode.
  20500. if (event.type === 'keypress') {
  20501. return getEventCharCode(event);
  20502. }
  20503. return 0;
  20504. },
  20505. keyCode: function (event) {
  20506. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  20507. // physical keyboard key.
  20508. // The actual meaning of the value depends on the users' keyboard layout
  20509. // which cannot be detected. Assuming that it is a US keyboard layout
  20510. // provides a surprisingly accurate mapping for US and European users.
  20511. // Due to this, it is left to the user to implement at this time.
  20512. if (event.type === 'keydown' || event.type === 'keyup') {
  20513. return event.keyCode;
  20514. }
  20515. return 0;
  20516. },
  20517. which: function (event) {
  20518. // `which` is an alias for either `keyCode` or `charCode` depending on the
  20519. // type of the event.
  20520. if (event.type === 'keypress') {
  20521. return getEventCharCode(event);
  20522. }
  20523. if (event.type === 'keydown' || event.type === 'keyup') {
  20524. return event.keyCode;
  20525. }
  20526. return 0;
  20527. }
  20528. });
  20529. /**
  20530. * @interface DragEvent
  20531. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  20532. */
  20533. var SyntheticDragEvent = SyntheticMouseEvent.extend({
  20534. dataTransfer: null
  20535. });
  20536. /**
  20537. * @interface TouchEvent
  20538. * @see http://www.w3.org/TR/touch-events/
  20539. */
  20540. var SyntheticTouchEvent = SyntheticUIEvent.extend({
  20541. touches: null,
  20542. targetTouches: null,
  20543. changedTouches: null,
  20544. altKey: null,
  20545. metaKey: null,
  20546. ctrlKey: null,
  20547. shiftKey: null,
  20548. getModifierState: getEventModifierState
  20549. });
  20550. /**
  20551. * @interface Event
  20552. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  20553. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  20554. */
  20555. var SyntheticTransitionEvent = SyntheticEvent.extend({
  20556. propertyName: null,
  20557. elapsedTime: null,
  20558. pseudoElement: null
  20559. });
  20560. /**
  20561. * @interface WheelEvent
  20562. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  20563. */
  20564. var SyntheticWheelEvent = SyntheticMouseEvent.extend({
  20565. deltaX: function (event) {
  20566. return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  20567. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  20568. },
  20569. deltaY: function (event) {
  20570. return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  20571. 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  20572. 'wheelDelta' in event ? -event.wheelDelta : 0;
  20573. },
  20574. deltaZ: null,
  20575. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  20576. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  20577. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  20578. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  20579. deltaMode: null
  20580. });
  20581. var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
  20582. var SimpleEventPlugin = {
  20583. // simpleEventPluginEventTypes gets populated from
  20584. // the DOMEventProperties module.
  20585. eventTypes: simpleEventPluginEventTypes,
  20586. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  20587. var dispatchConfig = topLevelEventsToDispatchConfig.get(topLevelType);
  20588. if (!dispatchConfig) {
  20589. return null;
  20590. }
  20591. var EventConstructor;
  20592. switch (topLevelType) {
  20593. case TOP_KEY_PRESS:
  20594. // Firefox creates a keypress event for function keys too. This removes
  20595. // the unwanted keypress events. Enter is however both printable and
  20596. // non-printable. One would expect Tab to be as well (but it isn't).
  20597. if (getEventCharCode(nativeEvent) === 0) {
  20598. return null;
  20599. }
  20600. /* falls through */
  20601. case TOP_KEY_DOWN:
  20602. case TOP_KEY_UP:
  20603. EventConstructor = SyntheticKeyboardEvent;
  20604. break;
  20605. case TOP_BLUR:
  20606. case TOP_FOCUS:
  20607. EventConstructor = SyntheticFocusEvent;
  20608. break;
  20609. case TOP_CLICK:
  20610. // Firefox creates a click event on right mouse clicks. This removes the
  20611. // unwanted click events.
  20612. if (nativeEvent.button === 2) {
  20613. return null;
  20614. }
  20615. /* falls through */
  20616. case TOP_AUX_CLICK:
  20617. case TOP_DOUBLE_CLICK:
  20618. case TOP_MOUSE_DOWN:
  20619. case TOP_MOUSE_MOVE:
  20620. case TOP_MOUSE_UP: // TODO: Disabled elements should not respond to mouse events
  20621. /* falls through */
  20622. case TOP_MOUSE_OUT:
  20623. case TOP_MOUSE_OVER:
  20624. case TOP_CONTEXT_MENU:
  20625. EventConstructor = SyntheticMouseEvent;
  20626. break;
  20627. case TOP_DRAG:
  20628. case TOP_DRAG_END:
  20629. case TOP_DRAG_ENTER:
  20630. case TOP_DRAG_EXIT:
  20631. case TOP_DRAG_LEAVE:
  20632. case TOP_DRAG_OVER:
  20633. case TOP_DRAG_START:
  20634. case TOP_DROP:
  20635. EventConstructor = SyntheticDragEvent;
  20636. break;
  20637. case TOP_TOUCH_CANCEL:
  20638. case TOP_TOUCH_END:
  20639. case TOP_TOUCH_MOVE:
  20640. case TOP_TOUCH_START:
  20641. EventConstructor = SyntheticTouchEvent;
  20642. break;
  20643. case TOP_ANIMATION_END:
  20644. case TOP_ANIMATION_ITERATION:
  20645. case TOP_ANIMATION_START:
  20646. EventConstructor = SyntheticAnimationEvent;
  20647. break;
  20648. case TOP_TRANSITION_END:
  20649. EventConstructor = SyntheticTransitionEvent;
  20650. break;
  20651. case TOP_SCROLL:
  20652. EventConstructor = SyntheticUIEvent;
  20653. break;
  20654. case TOP_WHEEL:
  20655. EventConstructor = SyntheticWheelEvent;
  20656. break;
  20657. case TOP_COPY:
  20658. case TOP_CUT:
  20659. case TOP_PASTE:
  20660. EventConstructor = SyntheticClipboardEvent;
  20661. break;
  20662. case TOP_GOT_POINTER_CAPTURE:
  20663. case TOP_LOST_POINTER_CAPTURE:
  20664. case TOP_POINTER_CANCEL:
  20665. case TOP_POINTER_DOWN:
  20666. case TOP_POINTER_MOVE:
  20667. case TOP_POINTER_OUT:
  20668. case TOP_POINTER_OVER:
  20669. case TOP_POINTER_UP:
  20670. EventConstructor = SyntheticPointerEvent;
  20671. break;
  20672. default:
  20673. {
  20674. if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
  20675. error('SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
  20676. }
  20677. } // HTML Events
  20678. // @see http://www.w3.org/TR/html5/index.html#events-0
  20679. EventConstructor = SyntheticEvent;
  20680. break;
  20681. }
  20682. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  20683. accumulateTwoPhaseDispatches(event);
  20684. return event;
  20685. }
  20686. };
  20687. /**
  20688. * Specifies a deterministic ordering of `EventPlugin`s. A convenient way to
  20689. * reason about plugins, without having to package every one of them. This
  20690. * is better than having plugins be ordered in the same order that they
  20691. * are injected because that ordering would be influenced by the packaging order.
  20692. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  20693. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  20694. */
  20695. var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  20696. /**
  20697. * Inject modules for resolving DOM hierarchy and plugin ordering.
  20698. */
  20699. injectEventPluginOrder(DOMEventPluginOrder);
  20700. setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
  20701. /**
  20702. * Some important event plugins included by default (without having to require
  20703. * them).
  20704. */
  20705. injectEventPluginsByName({
  20706. SimpleEventPlugin: SimpleEventPlugin,
  20707. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  20708. ChangeEventPlugin: ChangeEventPlugin,
  20709. SelectEventPlugin: SelectEventPlugin,
  20710. BeforeInputEventPlugin: BeforeInputEventPlugin
  20711. });
  20712. // Prefix measurements so that it's possible to filter them.
  20713. // Longer prefixes are hard to read in DevTools.
  20714. var reactEmoji = "\u269B";
  20715. var warningEmoji = "\u26D4";
  20716. var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; // Keep track of current fiber so that we know the path to unwind on pause.
  20717. // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them?
  20718. var currentFiber = null; // If we're in the middle of user code, which fiber and method is it?
  20719. // Reusing `currentFiber` would be confusing for this because user code fiber
  20720. // can change during commit phase too, but we don't need to unwind it (since
  20721. // lifecycles in the commit phase don't resemble a tree).
  20722. var currentPhase = null;
  20723. var currentPhaseFiber = null; // Did lifecycle hook schedule an update? This is often a performance problem,
  20724. // so we will keep track of it, and include it in the report.
  20725. // Track commits caused by cascading updates.
  20726. var isCommitting = false;
  20727. var hasScheduledUpdateInCurrentCommit = false;
  20728. var hasScheduledUpdateInCurrentPhase = false;
  20729. var commitCountInCurrentWorkLoop = 0;
  20730. var effectCountInCurrentCommit = 0;
  20731. // to avoid stretch the commit phase with measurement overhead.
  20732. var labelsInCurrentCommit = new Set();
  20733. var formatMarkName = function (markName) {
  20734. return reactEmoji + " " + markName;
  20735. };
  20736. var formatLabel = function (label, warning) {
  20737. var prefix = warning ? warningEmoji + " " : reactEmoji + " ";
  20738. var suffix = warning ? " Warning: " + warning : '';
  20739. return "" + prefix + label + suffix;
  20740. };
  20741. var beginMark = function (markName) {
  20742. performance.mark(formatMarkName(markName));
  20743. };
  20744. var clearMark = function (markName) {
  20745. performance.clearMarks(formatMarkName(markName));
  20746. };
  20747. var endMark = function (label, markName, warning) {
  20748. var formattedMarkName = formatMarkName(markName);
  20749. var formattedLabel = formatLabel(label, warning);
  20750. try {
  20751. performance.measure(formattedLabel, formattedMarkName);
  20752. } catch (err) {} // If previous mark was missing for some reason, this will throw.
  20753. // This could only happen if React crashed in an unexpected place earlier.
  20754. // Don't pile on with more errors.
  20755. // Clear marks immediately to avoid growing buffer.
  20756. performance.clearMarks(formattedMarkName);
  20757. performance.clearMeasures(formattedLabel);
  20758. };
  20759. var getFiberMarkName = function (label, debugID) {
  20760. return label + " (#" + debugID + ")";
  20761. };
  20762. var getFiberLabel = function (componentName, isMounted, phase) {
  20763. if (phase === null) {
  20764. // These are composite component total time measurements.
  20765. return componentName + " [" + (isMounted ? 'update' : 'mount') + "]";
  20766. } else {
  20767. // Composite component methods.
  20768. return componentName + "." + phase;
  20769. }
  20770. };
  20771. var beginFiberMark = function (fiber, phase) {
  20772. var componentName = getComponentName(fiber.type) || 'Unknown';
  20773. var debugID = fiber._debugID;
  20774. var isMounted = fiber.alternate !== null;
  20775. var label = getFiberLabel(componentName, isMounted, phase);
  20776. if (isCommitting && labelsInCurrentCommit.has(label)) {
  20777. // During the commit phase, we don't show duplicate labels because
  20778. // there is a fixed overhead for every measurement, and we don't
  20779. // want to stretch the commit phase beyond necessary.
  20780. return false;
  20781. }
  20782. labelsInCurrentCommit.add(label);
  20783. var markName = getFiberMarkName(label, debugID);
  20784. beginMark(markName);
  20785. return true;
  20786. };
  20787. var clearFiberMark = function (fiber, phase) {
  20788. var componentName = getComponentName(fiber.type) || 'Unknown';
  20789. var debugID = fiber._debugID;
  20790. var isMounted = fiber.alternate !== null;
  20791. var label = getFiberLabel(componentName, isMounted, phase);
  20792. var markName = getFiberMarkName(label, debugID);
  20793. clearMark(markName);
  20794. };
  20795. var endFiberMark = function (fiber, phase, warning) {
  20796. var componentName = getComponentName(fiber.type) || 'Unknown';
  20797. var debugID = fiber._debugID;
  20798. var isMounted = fiber.alternate !== null;
  20799. var label = getFiberLabel(componentName, isMounted, phase);
  20800. var markName = getFiberMarkName(label, debugID);
  20801. endMark(label, markName, warning);
  20802. };
  20803. var shouldIgnoreFiber = function (fiber) {
  20804. // Host components should be skipped in the timeline.
  20805. // We could check typeof fiber.type, but does this work with RN?
  20806. switch (fiber.tag) {
  20807. case HostRoot:
  20808. case HostComponent:
  20809. case HostText:
  20810. case HostPortal:
  20811. case Fragment:
  20812. case ContextProvider:
  20813. case ContextConsumer:
  20814. case Mode:
  20815. return true;
  20816. default:
  20817. return false;
  20818. }
  20819. };
  20820. var clearPendingPhaseMeasurement = function () {
  20821. if (currentPhase !== null && currentPhaseFiber !== null) {
  20822. clearFiberMark(currentPhaseFiber, currentPhase);
  20823. }
  20824. currentPhaseFiber = null;
  20825. currentPhase = null;
  20826. hasScheduledUpdateInCurrentPhase = false;
  20827. };
  20828. var pauseTimers = function () {
  20829. // Stops all currently active measurements so that they can be resumed
  20830. // if we continue in a later deferred loop from the same unit of work.
  20831. var fiber = currentFiber;
  20832. while (fiber) {
  20833. if (fiber._debugIsCurrentlyTiming) {
  20834. endFiberMark(fiber, null, null);
  20835. }
  20836. fiber = fiber.return;
  20837. }
  20838. };
  20839. var resumeTimersRecursively = function (fiber) {
  20840. if (fiber.return !== null) {
  20841. resumeTimersRecursively(fiber.return);
  20842. }
  20843. if (fiber._debugIsCurrentlyTiming) {
  20844. beginFiberMark(fiber, null);
  20845. }
  20846. };
  20847. var resumeTimers = function () {
  20848. // Resumes all measurements that were active during the last deferred loop.
  20849. if (currentFiber !== null) {
  20850. resumeTimersRecursively(currentFiber);
  20851. }
  20852. };
  20853. function recordEffect() {
  20854. {
  20855. effectCountInCurrentCommit++;
  20856. }
  20857. }
  20858. function recordScheduleUpdate() {
  20859. {
  20860. if (isCommitting) {
  20861. hasScheduledUpdateInCurrentCommit = true;
  20862. }
  20863. if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
  20864. hasScheduledUpdateInCurrentPhase = true;
  20865. }
  20866. }
  20867. }
  20868. function startWorkTimer(fiber) {
  20869. {
  20870. if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
  20871. return;
  20872. } // If we pause, this is the fiber to unwind from.
  20873. currentFiber = fiber;
  20874. if (!beginFiberMark(fiber, null)) {
  20875. return;
  20876. }
  20877. fiber._debugIsCurrentlyTiming = true;
  20878. }
  20879. }
  20880. function cancelWorkTimer(fiber) {
  20881. {
  20882. if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
  20883. return;
  20884. } // Remember we shouldn't complete measurement for this fiber.
  20885. // Otherwise flamechart will be deep even for small updates.
  20886. fiber._debugIsCurrentlyTiming = false;
  20887. clearFiberMark(fiber, null);
  20888. }
  20889. }
  20890. function stopWorkTimer(fiber) {
  20891. {
  20892. if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
  20893. return;
  20894. } // If we pause, its parent is the fiber to unwind from.
  20895. currentFiber = fiber.return;
  20896. if (!fiber._debugIsCurrentlyTiming) {
  20897. return;
  20898. }
  20899. fiber._debugIsCurrentlyTiming = false;
  20900. endFiberMark(fiber, null, null);
  20901. }
  20902. }
  20903. function stopFailedWorkTimer(fiber) {
  20904. {
  20905. if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
  20906. return;
  20907. } // If we pause, its parent is the fiber to unwind from.
  20908. currentFiber = fiber.return;
  20909. if (!fiber._debugIsCurrentlyTiming) {
  20910. return;
  20911. }
  20912. fiber._debugIsCurrentlyTiming = false;
  20913. var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
  20914. endFiberMark(fiber, null, warning);
  20915. }
  20916. }
  20917. function startPhaseTimer(fiber, phase) {
  20918. {
  20919. if (!supportsUserTiming) {
  20920. return;
  20921. }
  20922. clearPendingPhaseMeasurement();
  20923. if (!beginFiberMark(fiber, phase)) {
  20924. return;
  20925. }
  20926. currentPhaseFiber = fiber;
  20927. currentPhase = phase;
  20928. }
  20929. }
  20930. function stopPhaseTimer() {
  20931. {
  20932. if (!supportsUserTiming) {
  20933. return;
  20934. }
  20935. if (currentPhase !== null && currentPhaseFiber !== null) {
  20936. var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
  20937. endFiberMark(currentPhaseFiber, currentPhase, warning);
  20938. }
  20939. currentPhase = null;
  20940. currentPhaseFiber = null;
  20941. }
  20942. }
  20943. function startWorkLoopTimer(nextUnitOfWork) {
  20944. {
  20945. currentFiber = nextUnitOfWork;
  20946. if (!supportsUserTiming) {
  20947. return;
  20948. }
  20949. commitCountInCurrentWorkLoop = 0; // This is top level call.
  20950. // Any other measurements are performed within.
  20951. beginMark('(React Tree Reconciliation)'); // Resume any measurements that were in progress during the last loop.
  20952. resumeTimers();
  20953. }
  20954. }
  20955. function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
  20956. {
  20957. if (!supportsUserTiming) {
  20958. return;
  20959. }
  20960. var warning = null;
  20961. if (interruptedBy !== null) {
  20962. if (interruptedBy.tag === HostRoot) {
  20963. warning = 'A top-level update interrupted the previous render';
  20964. } else {
  20965. var componentName = getComponentName(interruptedBy.type) || 'Unknown';
  20966. warning = "An update to " + componentName + " interrupted the previous render";
  20967. }
  20968. } else if (commitCountInCurrentWorkLoop > 1) {
  20969. warning = 'There were cascading updates';
  20970. }
  20971. commitCountInCurrentWorkLoop = 0;
  20972. var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)'; // Pause any measurements until the next loop.
  20973. pauseTimers();
  20974. endMark(label, '(React Tree Reconciliation)', warning);
  20975. }
  20976. }
  20977. function startCommitTimer() {
  20978. {
  20979. if (!supportsUserTiming) {
  20980. return;
  20981. }
  20982. isCommitting = true;
  20983. hasScheduledUpdateInCurrentCommit = false;
  20984. labelsInCurrentCommit.clear();
  20985. beginMark('(Committing Changes)');
  20986. }
  20987. }
  20988. function stopCommitTimer() {
  20989. {
  20990. if (!supportsUserTiming) {
  20991. return;
  20992. }
  20993. var warning = null;
  20994. if (hasScheduledUpdateInCurrentCommit) {
  20995. warning = 'Lifecycle hook scheduled a cascading update';
  20996. } else if (commitCountInCurrentWorkLoop > 0) {
  20997. warning = 'Caused by a cascading update in earlier commit';
  20998. }
  20999. hasScheduledUpdateInCurrentCommit = false;
  21000. commitCountInCurrentWorkLoop++;
  21001. isCommitting = false;
  21002. labelsInCurrentCommit.clear();
  21003. endMark('(Committing Changes)', '(Committing Changes)', warning);
  21004. }
  21005. }
  21006. function startCommitSnapshotEffectsTimer() {
  21007. {
  21008. if (!supportsUserTiming) {
  21009. return;
  21010. }
  21011. effectCountInCurrentCommit = 0;
  21012. beginMark('(Committing Snapshot Effects)');
  21013. }
  21014. }
  21015. function stopCommitSnapshotEffectsTimer() {
  21016. {
  21017. if (!supportsUserTiming) {
  21018. return;
  21019. }
  21020. var count = effectCountInCurrentCommit;
  21021. effectCountInCurrentCommit = 0;
  21022. endMark("(Committing Snapshot Effects: " + count + " Total)", '(Committing Snapshot Effects)', null);
  21023. }
  21024. }
  21025. function startCommitHostEffectsTimer() {
  21026. {
  21027. if (!supportsUserTiming) {
  21028. return;
  21029. }
  21030. effectCountInCurrentCommit = 0;
  21031. beginMark('(Committing Host Effects)');
  21032. }
  21033. }
  21034. function stopCommitHostEffectsTimer() {
  21035. {
  21036. if (!supportsUserTiming) {
  21037. return;
  21038. }
  21039. var count = effectCountInCurrentCommit;
  21040. effectCountInCurrentCommit = 0;
  21041. endMark("(Committing Host Effects: " + count + " Total)", '(Committing Host Effects)', null);
  21042. }
  21043. }
  21044. function startCommitLifeCyclesTimer() {
  21045. {
  21046. if (!supportsUserTiming) {
  21047. return;
  21048. }
  21049. effectCountInCurrentCommit = 0;
  21050. beginMark('(Calling Lifecycle Methods)');
  21051. }
  21052. }
  21053. function stopCommitLifeCyclesTimer() {
  21054. {
  21055. if (!supportsUserTiming) {
  21056. return;
  21057. }
  21058. var count = effectCountInCurrentCommit;
  21059. effectCountInCurrentCommit = 0;
  21060. endMark("(Calling Lifecycle Methods: " + count + " Total)", '(Calling Lifecycle Methods)', null);
  21061. }
  21062. }
  21063. var valueStack = [];
  21064. var fiberStack;
  21065. {
  21066. fiberStack = [];
  21067. }
  21068. var index = -1;
  21069. function createCursor(defaultValue) {
  21070. return {
  21071. current: defaultValue
  21072. };
  21073. }
  21074. function pop(cursor, fiber) {
  21075. if (index < 0) {
  21076. {
  21077. error('Unexpected pop.');
  21078. }
  21079. return;
  21080. }
  21081. {
  21082. if (fiber !== fiberStack[index]) {
  21083. error('Unexpected Fiber popped.');
  21084. }
  21085. }
  21086. cursor.current = valueStack[index];
  21087. valueStack[index] = null;
  21088. {
  21089. fiberStack[index] = null;
  21090. }
  21091. index--;
  21092. }
  21093. function push(cursor, value, fiber) {
  21094. index++;
  21095. valueStack[index] = cursor.current;
  21096. {
  21097. fiberStack[index] = fiber;
  21098. }
  21099. cursor.current = value;
  21100. }
  21101. var warnedAboutMissingGetChildContext;
  21102. {
  21103. warnedAboutMissingGetChildContext = {};
  21104. }
  21105. var emptyContextObject = {};
  21106. {
  21107. Object.freeze(emptyContextObject);
  21108. } // A cursor to the current merged context object on the stack.
  21109. var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed.
  21110. var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack.
  21111. // We use this to get access to the parent context after we have already
  21112. // pushed the next context provider, and now need to merge their contexts.
  21113. var previousContext = emptyContextObject;
  21114. function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
  21115. {
  21116. if (didPushOwnContextIfProvider && isContextProvider(Component)) {
  21117. // If the fiber is a context provider itself, when we read its context
  21118. // we may have already pushed its own child context on the stack. A context
  21119. // provider should not "see" its own child context. Therefore we read the
  21120. // previous (parent) context instead for a context provider.
  21121. return previousContext;
  21122. }
  21123. return contextStackCursor.current;
  21124. }
  21125. }
  21126. function cacheContext(workInProgress, unmaskedContext, maskedContext) {
  21127. {
  21128. var instance = workInProgress.stateNode;
  21129. instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
  21130. instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
  21131. }
  21132. }
  21133. function getMaskedContext(workInProgress, unmaskedContext) {
  21134. {
  21135. var type = workInProgress.type;
  21136. var contextTypes = type.contextTypes;
  21137. if (!contextTypes) {
  21138. return emptyContextObject;
  21139. } // Avoid recreating masked context unless unmasked context has changed.
  21140. // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
  21141. // This may trigger infinite loops if componentWillReceiveProps calls setState.
  21142. var instance = workInProgress.stateNode;
  21143. if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
  21144. return instance.__reactInternalMemoizedMaskedChildContext;
  21145. }
  21146. var context = {};
  21147. for (var key in contextTypes) {
  21148. context[key] = unmaskedContext[key];
  21149. }
  21150. {
  21151. var name = getComponentName(type) || 'Unknown';
  21152. checkPropTypes(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
  21153. } // Cache unmasked context so we can avoid recreating masked context unless necessary.
  21154. // Context is created before the class component is instantiated so check for instance.
  21155. if (instance) {
  21156. cacheContext(workInProgress, unmaskedContext, context);
  21157. }
  21158. return context;
  21159. }
  21160. }
  21161. function hasContextChanged() {
  21162. {
  21163. return didPerformWorkStackCursor.current;
  21164. }
  21165. }
  21166. function isContextProvider(type) {
  21167. {
  21168. var childContextTypes = type.childContextTypes;
  21169. return childContextTypes !== null && childContextTypes !== undefined;
  21170. }
  21171. }
  21172. function popContext(fiber) {
  21173. {
  21174. pop(didPerformWorkStackCursor, fiber);
  21175. pop(contextStackCursor, fiber);
  21176. }
  21177. }
  21178. function popTopLevelContextObject(fiber) {
  21179. {
  21180. pop(didPerformWorkStackCursor, fiber);
  21181. pop(contextStackCursor, fiber);
  21182. }
  21183. }
  21184. function pushTopLevelContextObject(fiber, context, didChange) {
  21185. {
  21186. if (!(contextStackCursor.current === emptyContextObject)) {
  21187. {
  21188. throw Error( "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." );
  21189. }
  21190. }
  21191. push(contextStackCursor, context, fiber);
  21192. push(didPerformWorkStackCursor, didChange, fiber);
  21193. }
  21194. }
  21195. function processChildContext(fiber, type, parentContext) {
  21196. {
  21197. var instance = fiber.stateNode;
  21198. var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future.
  21199. // It has only been added in Fiber to match the (unintentional) behavior in Stack.
  21200. if (typeof instance.getChildContext !== 'function') {
  21201. {
  21202. var componentName = getComponentName(type) || 'Unknown';
  21203. if (!warnedAboutMissingGetChildContext[componentName]) {
  21204. warnedAboutMissingGetChildContext[componentName] = true;
  21205. error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
  21206. }
  21207. }
  21208. return parentContext;
  21209. }
  21210. var childContext;
  21211. startPhaseTimer(fiber, 'getChildContext');
  21212. childContext = instance.getChildContext();
  21213. stopPhaseTimer();
  21214. for (var contextKey in childContext) {
  21215. if (!(contextKey in childContextTypes)) {
  21216. {
  21217. throw Error( (getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." );
  21218. }
  21219. }
  21220. }
  21221. {
  21222. var name = getComponentName(type) || 'Unknown';
  21223. checkPropTypes(childContextTypes, childContext, 'child context', name, // In practice, there is one case in which we won't get a stack. It's when
  21224. // somebody calls unstable_renderSubtreeIntoContainer() and we process
  21225. // context from the parent component instance. The stack will be missing
  21226. // because it's outside of the reconciliation, and so the pointer has not
  21227. // been set. This is rare and doesn't matter. We'll also remove that API.
  21228. getCurrentFiberStackInDev);
  21229. }
  21230. return _assign({}, parentContext, {}, childContext);
  21231. }
  21232. }
  21233. function pushContextProvider(workInProgress) {
  21234. {
  21235. var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity.
  21236. // If the instance does not exist yet, we will push null at first,
  21237. // and replace it on the stack later when invalidating the context.
  21238. var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later.
  21239. // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
  21240. previousContext = contextStackCursor.current;
  21241. push(contextStackCursor, memoizedMergedChildContext, workInProgress);
  21242. push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
  21243. return true;
  21244. }
  21245. }
  21246. function invalidateContextProvider(workInProgress, type, didChange) {
  21247. {
  21248. var instance = workInProgress.stateNode;
  21249. if (!instance) {
  21250. {
  21251. throw Error( "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." );
  21252. }
  21253. }
  21254. if (didChange) {
  21255. // Merge parent and own context.
  21256. // Skip this if we're not updating due to sCU.
  21257. // This avoids unnecessarily recomputing memoized values.
  21258. var mergedContext = processChildContext(workInProgress, type, previousContext);
  21259. instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one.
  21260. // It is important to unwind the context in the reverse order.
  21261. pop(didPerformWorkStackCursor, workInProgress);
  21262. pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed.
  21263. push(contextStackCursor, mergedContext, workInProgress);
  21264. push(didPerformWorkStackCursor, didChange, workInProgress);
  21265. } else {
  21266. pop(didPerformWorkStackCursor, workInProgress);
  21267. push(didPerformWorkStackCursor, didChange, workInProgress);
  21268. }
  21269. }
  21270. }
  21271. function findCurrentUnmaskedContext(fiber) {
  21272. {
  21273. // Currently this is only used with renderSubtreeIntoContainer; not sure if it
  21274. // makes sense elsewhere
  21275. if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
  21276. {
  21277. throw Error( "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." );
  21278. }
  21279. }
  21280. var node = fiber;
  21281. do {
  21282. switch (node.tag) {
  21283. case HostRoot:
  21284. return node.stateNode.context;
  21285. case ClassComponent:
  21286. {
  21287. var Component = node.type;
  21288. if (isContextProvider(Component)) {
  21289. return node.stateNode.__reactInternalMemoizedMergedChildContext;
  21290. }
  21291. break;
  21292. }
  21293. }
  21294. node = node.return;
  21295. } while (node !== null);
  21296. {
  21297. {
  21298. throw Error( "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." );
  21299. }
  21300. }
  21301. }
  21302. }
  21303. var LegacyRoot = 0;
  21304. var BlockingRoot = 1;
  21305. var ConcurrentRoot = 2;
  21306. var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority,
  21307. Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback,
  21308. Scheduler_cancelCallback = Scheduler.unstable_cancelCallback,
  21309. Scheduler_shouldYield = Scheduler.unstable_shouldYield,
  21310. Scheduler_requestPaint = Scheduler.unstable_requestPaint,
  21311. Scheduler_now = Scheduler.unstable_now,
  21312. Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel,
  21313. Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority,
  21314. Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority,
  21315. Scheduler_NormalPriority = Scheduler.unstable_NormalPriority,
  21316. Scheduler_LowPriority = Scheduler.unstable_LowPriority,
  21317. Scheduler_IdlePriority = Scheduler.unstable_IdlePriority;
  21318. {
  21319. // Provide explicit error message when production+profiling bundle of e.g.
  21320. // react-dom is used with production (non-profiling) bundle of
  21321. // scheduler/tracing
  21322. if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
  21323. {
  21324. throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" );
  21325. }
  21326. }
  21327. }
  21328. var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
  21329. // ascending numbers so we can compare them like numbers. They start at 90 to
  21330. // avoid clashing with Scheduler's priorities.
  21331. var ImmediatePriority = 99;
  21332. var UserBlockingPriority$1 = 98;
  21333. var NormalPriority = 97;
  21334. var LowPriority = 96;
  21335. var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only.
  21336. var NoPriority = 90;
  21337. var shouldYield = Scheduler_shouldYield;
  21338. var requestPaint = // Fall back gracefully if we're running an older version of Scheduler.
  21339. Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {};
  21340. var syncQueue = null;
  21341. var immediateQueueCallbackNode = null;
  21342. var isFlushingSyncQueue = false;
  21343. var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly.
  21344. // This will be the case for modern browsers that support `performance.now`. In
  21345. // older browsers, Scheduler falls back to `Date.now`, which returns a Unix
  21346. // timestamp. In that case, subtract the module initialization time to simulate
  21347. // the behavior of performance.now and keep our times small enough to fit
  21348. // within 32 bits.
  21349. // TODO: Consider lifting this into Scheduler.
  21350. var now = initialTimeMs < 10000 ? Scheduler_now : function () {
  21351. return Scheduler_now() - initialTimeMs;
  21352. };
  21353. function getCurrentPriorityLevel() {
  21354. switch (Scheduler_getCurrentPriorityLevel()) {
  21355. case Scheduler_ImmediatePriority:
  21356. return ImmediatePriority;
  21357. case Scheduler_UserBlockingPriority:
  21358. return UserBlockingPriority$1;
  21359. case Scheduler_NormalPriority:
  21360. return NormalPriority;
  21361. case Scheduler_LowPriority:
  21362. return LowPriority;
  21363. case Scheduler_IdlePriority:
  21364. return IdlePriority;
  21365. default:
  21366. {
  21367. {
  21368. throw Error( "Unknown priority level." );
  21369. }
  21370. }
  21371. }
  21372. }
  21373. function reactPriorityToSchedulerPriority(reactPriorityLevel) {
  21374. switch (reactPriorityLevel) {
  21375. case ImmediatePriority:
  21376. return Scheduler_ImmediatePriority;
  21377. case UserBlockingPriority$1:
  21378. return Scheduler_UserBlockingPriority;
  21379. case NormalPriority:
  21380. return Scheduler_NormalPriority;
  21381. case LowPriority:
  21382. return Scheduler_LowPriority;
  21383. case IdlePriority:
  21384. return Scheduler_IdlePriority;
  21385. default:
  21386. {
  21387. {
  21388. throw Error( "Unknown priority level." );
  21389. }
  21390. }
  21391. }
  21392. }
  21393. function runWithPriority$1(reactPriorityLevel, fn) {
  21394. var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
  21395. return Scheduler_runWithPriority(priorityLevel, fn);
  21396. }
  21397. function scheduleCallback(reactPriorityLevel, callback, options) {
  21398. var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
  21399. return Scheduler_scheduleCallback(priorityLevel, callback, options);
  21400. }
  21401. function scheduleSyncCallback(callback) {
  21402. // Push this callback into an internal queue. We'll flush these either in
  21403. // the next tick, or earlier if something calls `flushSyncCallbackQueue`.
  21404. if (syncQueue === null) {
  21405. syncQueue = [callback]; // Flush the queue in the next tick, at the earliest.
  21406. immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
  21407. } else {
  21408. // Push onto existing queue. Don't need to schedule a callback because
  21409. // we already scheduled one when we created the queue.
  21410. syncQueue.push(callback);
  21411. }
  21412. return fakeCallbackNode;
  21413. }
  21414. function cancelCallback(callbackNode) {
  21415. if (callbackNode !== fakeCallbackNode) {
  21416. Scheduler_cancelCallback(callbackNode);
  21417. }
  21418. }
  21419. function flushSyncCallbackQueue() {
  21420. if (immediateQueueCallbackNode !== null) {
  21421. var node = immediateQueueCallbackNode;
  21422. immediateQueueCallbackNode = null;
  21423. Scheduler_cancelCallback(node);
  21424. }
  21425. flushSyncCallbackQueueImpl();
  21426. }
  21427. function flushSyncCallbackQueueImpl() {
  21428. if (!isFlushingSyncQueue && syncQueue !== null) {
  21429. // Prevent re-entrancy.
  21430. isFlushingSyncQueue = true;
  21431. var i = 0;
  21432. try {
  21433. var _isSync = true;
  21434. var queue = syncQueue;
  21435. runWithPriority$1(ImmediatePriority, function () {
  21436. for (; i < queue.length; i++) {
  21437. var callback = queue[i];
  21438. do {
  21439. callback = callback(_isSync);
  21440. } while (callback !== null);
  21441. }
  21442. });
  21443. syncQueue = null;
  21444. } catch (error) {
  21445. // If something throws, leave the remaining callbacks on the queue.
  21446. if (syncQueue !== null) {
  21447. syncQueue = syncQueue.slice(i + 1);
  21448. } // Resume flushing in the next tick
  21449. Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
  21450. throw error;
  21451. } finally {
  21452. isFlushingSyncQueue = false;
  21453. }
  21454. }
  21455. }
  21456. var NoMode = 0;
  21457. var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
  21458. // tag instead
  21459. var BlockingMode = 2;
  21460. var ConcurrentMode = 4;
  21461. var ProfileMode = 8;
  21462. // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
  21463. // Math.pow(2, 30) - 1
  21464. // 0b111111111111111111111111111111
  21465. var MAX_SIGNED_31_BIT_INT = 1073741823;
  21466. var NoWork = 0; // TODO: Think of a better name for Never. The key difference with Idle is that
  21467. // Never work can be committed in an inconsistent state without tearing the UI.
  21468. // The main example is offscreen content, like a hidden subtree. So one possible
  21469. // name is Offscreen. However, it also includes dehydrated Suspense boundaries,
  21470. // which are inconsistent in the sense that they haven't finished yet, but
  21471. // aren't visibly inconsistent because the server rendered HTML matches what the
  21472. // hydrated tree would look like.
  21473. var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
  21474. // order to be consistent.
  21475. var Idle = 2; // Continuous Hydration is slightly higher than Idle and is used to increase
  21476. // priority of hover targets.
  21477. var ContinuousHydration = 3;
  21478. var Sync = MAX_SIGNED_31_BIT_INT;
  21479. var Batched = Sync - 1;
  21480. var UNIT_SIZE = 10;
  21481. var MAGIC_NUMBER_OFFSET = Batched - 1; // 1 unit of expiration time represents 10ms.
  21482. function msToExpirationTime(ms) {
  21483. // Always subtract from the offset so that we don't clash with the magic number for NoWork.
  21484. return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
  21485. }
  21486. function expirationTimeToMs(expirationTime) {
  21487. return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
  21488. }
  21489. function ceiling(num, precision) {
  21490. return ((num / precision | 0) + 1) * precision;
  21491. }
  21492. function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
  21493. return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
  21494. } // TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update
  21495. // the names to reflect.
  21496. var LOW_PRIORITY_EXPIRATION = 5000;
  21497. var LOW_PRIORITY_BATCH_SIZE = 250;
  21498. function computeAsyncExpiration(currentTime) {
  21499. return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
  21500. }
  21501. function computeSuspenseExpiration(currentTime, timeoutMs) {
  21502. // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time?
  21503. return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE);
  21504. } // We intentionally set a higher expiration time for interactive updates in
  21505. // dev than in production.
  21506. //
  21507. // If the main thread is being blocked so long that you hit the expiration,
  21508. // it's a problem that could be solved with better scheduling.
  21509. //
  21510. // People will be more likely to notice this and fix it with the long
  21511. // expiration time in development.
  21512. //
  21513. // In production we opt for better UX at the risk of masking scheduling
  21514. // problems, by expiring fast.
  21515. var HIGH_PRIORITY_EXPIRATION = 500 ;
  21516. var HIGH_PRIORITY_BATCH_SIZE = 100;
  21517. function computeInteractiveExpiration(currentTime) {
  21518. return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
  21519. }
  21520. function inferPriorityFromExpirationTime(currentTime, expirationTime) {
  21521. if (expirationTime === Sync) {
  21522. return ImmediatePriority;
  21523. }
  21524. if (expirationTime === Never || expirationTime === Idle) {
  21525. return IdlePriority;
  21526. }
  21527. var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime);
  21528. if (msUntil <= 0) {
  21529. return ImmediatePriority;
  21530. }
  21531. if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) {
  21532. return UserBlockingPriority$1;
  21533. }
  21534. if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) {
  21535. return NormalPriority;
  21536. } // TODO: Handle LowPriority
  21537. // Assume anything lower has idle priority
  21538. return IdlePriority;
  21539. }
  21540. var ReactStrictModeWarnings = {
  21541. recordUnsafeLifecycleWarnings: function (fiber, instance) {},
  21542. flushPendingUnsafeLifecycleWarnings: function () {},
  21543. recordLegacyContextWarning: function (fiber, instance) {},
  21544. flushLegacyContextWarning: function () {},
  21545. discardPendingWarnings: function () {}
  21546. };
  21547. {
  21548. var findStrictRoot = function (fiber) {
  21549. var maybeStrictRoot = null;
  21550. var node = fiber;
  21551. while (node !== null) {
  21552. if (node.mode & StrictMode) {
  21553. maybeStrictRoot = node;
  21554. }
  21555. node = node.return;
  21556. }
  21557. return maybeStrictRoot;
  21558. };
  21559. var setToSortedString = function (set) {
  21560. var array = [];
  21561. set.forEach(function (value) {
  21562. array.push(value);
  21563. });
  21564. return array.sort().join(', ');
  21565. };
  21566. var pendingComponentWillMountWarnings = [];
  21567. var pendingUNSAFE_ComponentWillMountWarnings = [];
  21568. var pendingComponentWillReceivePropsWarnings = [];
  21569. var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
  21570. var pendingComponentWillUpdateWarnings = [];
  21571. var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about.
  21572. var didWarnAboutUnsafeLifecycles = new Set();
  21573. ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
  21574. // Dedup strategy: Warn once per component.
  21575. if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
  21576. return;
  21577. }
  21578. if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components.
  21579. instance.componentWillMount.__suppressDeprecationWarning !== true) {
  21580. pendingComponentWillMountWarnings.push(fiber);
  21581. }
  21582. if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') {
  21583. pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
  21584. }
  21585. if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
  21586. pendingComponentWillReceivePropsWarnings.push(fiber);
  21587. }
  21588. if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
  21589. pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
  21590. }
  21591. if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
  21592. pendingComponentWillUpdateWarnings.push(fiber);
  21593. }
  21594. if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') {
  21595. pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
  21596. }
  21597. };
  21598. ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
  21599. // We do an initial pass to gather component names
  21600. var componentWillMountUniqueNames = new Set();
  21601. if (pendingComponentWillMountWarnings.length > 0) {
  21602. pendingComponentWillMountWarnings.forEach(function (fiber) {
  21603. componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
  21604. didWarnAboutUnsafeLifecycles.add(fiber.type);
  21605. });
  21606. pendingComponentWillMountWarnings = [];
  21607. }
  21608. var UNSAFE_componentWillMountUniqueNames = new Set();
  21609. if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
  21610. pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) {
  21611. UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
  21612. didWarnAboutUnsafeLifecycles.add(fiber.type);
  21613. });
  21614. pendingUNSAFE_ComponentWillMountWarnings = [];
  21615. }
  21616. var componentWillReceivePropsUniqueNames = new Set();
  21617. if (pendingComponentWillReceivePropsWarnings.length > 0) {
  21618. pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
  21619. componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
  21620. didWarnAboutUnsafeLifecycles.add(fiber.type);
  21621. });
  21622. pendingComponentWillReceivePropsWarnings = [];
  21623. }
  21624. var UNSAFE_componentWillReceivePropsUniqueNames = new Set();
  21625. if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
  21626. pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) {
  21627. UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
  21628. didWarnAboutUnsafeLifecycles.add(fiber.type);
  21629. });
  21630. pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
  21631. }
  21632. var componentWillUpdateUniqueNames = new Set();
  21633. if (pendingComponentWillUpdateWarnings.length > 0) {
  21634. pendingComponentWillUpdateWarnings.forEach(function (fiber) {
  21635. componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
  21636. didWarnAboutUnsafeLifecycles.add(fiber.type);
  21637. });
  21638. pendingComponentWillUpdateWarnings = [];
  21639. }
  21640. var UNSAFE_componentWillUpdateUniqueNames = new Set();
  21641. if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
  21642. pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) {
  21643. UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
  21644. didWarnAboutUnsafeLifecycles.add(fiber.type);
  21645. });
  21646. pendingUNSAFE_ComponentWillUpdateWarnings = [];
  21647. } // Finally, we flush all the warnings
  21648. // UNSAFE_ ones before the deprecated ones, since they'll be 'louder'
  21649. if (UNSAFE_componentWillMountUniqueNames.size > 0) {
  21650. var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
  21651. error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames);
  21652. }
  21653. if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
  21654. var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
  21655. error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames);
  21656. }
  21657. if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
  21658. var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
  21659. error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2);
  21660. }
  21661. if (componentWillMountUniqueNames.size > 0) {
  21662. var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
  21663. warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3);
  21664. }
  21665. if (componentWillReceivePropsUniqueNames.size > 0) {
  21666. var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
  21667. warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4);
  21668. }
  21669. if (componentWillUpdateUniqueNames.size > 0) {
  21670. var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
  21671. warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5);
  21672. }
  21673. };
  21674. var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about.
  21675. var didWarnAboutLegacyContext = new Set();
  21676. ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
  21677. var strictRoot = findStrictRoot(fiber);
  21678. if (strictRoot === null) {
  21679. error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
  21680. return;
  21681. } // Dedup strategy: Warn once per component.
  21682. if (didWarnAboutLegacyContext.has(fiber.type)) {
  21683. return;
  21684. }
  21685. var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
  21686. if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
  21687. if (warningsForRoot === undefined) {
  21688. warningsForRoot = [];
  21689. pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
  21690. }
  21691. warningsForRoot.push(fiber);
  21692. }
  21693. };
  21694. ReactStrictModeWarnings.flushLegacyContextWarning = function () {
  21695. pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
  21696. if (fiberArray.length === 0) {
  21697. return;
  21698. }
  21699. var firstFiber = fiberArray[0];
  21700. var uniqueNames = new Set();
  21701. fiberArray.forEach(function (fiber) {
  21702. uniqueNames.add(getComponentName(fiber.type) || 'Component');
  21703. didWarnAboutLegacyContext.add(fiber.type);
  21704. });
  21705. var sortedNames = setToSortedString(uniqueNames);
  21706. var firstComponentStack = getStackByFiberInDevAndProd(firstFiber);
  21707. error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://fb.me/react-legacy-context' + '%s', sortedNames, firstComponentStack);
  21708. });
  21709. };
  21710. ReactStrictModeWarnings.discardPendingWarnings = function () {
  21711. pendingComponentWillMountWarnings = [];
  21712. pendingUNSAFE_ComponentWillMountWarnings = [];
  21713. pendingComponentWillReceivePropsWarnings = [];
  21714. pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
  21715. pendingComponentWillUpdateWarnings = [];
  21716. pendingUNSAFE_ComponentWillUpdateWarnings = [];
  21717. pendingLegacyContextWarning = new Map();
  21718. };
  21719. }
  21720. var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below.
  21721. var failedBoundaries = null;
  21722. var setRefreshHandler = function (handler) {
  21723. {
  21724. resolveFamily = handler;
  21725. }
  21726. };
  21727. function resolveFunctionForHotReloading(type) {
  21728. {
  21729. if (resolveFamily === null) {
  21730. // Hot reloading is disabled.
  21731. return type;
  21732. }
  21733. var family = resolveFamily(type);
  21734. if (family === undefined) {
  21735. return type;
  21736. } // Use the latest known implementation.
  21737. return family.current;
  21738. }
  21739. }
  21740. function resolveClassForHotReloading(type) {
  21741. // No implementation differences.
  21742. return resolveFunctionForHotReloading(type);
  21743. }
  21744. function resolveForwardRefForHotReloading(type) {
  21745. {
  21746. if (resolveFamily === null) {
  21747. // Hot reloading is disabled.
  21748. return type;
  21749. }
  21750. var family = resolveFamily(type);
  21751. if (family === undefined) {
  21752. // Check if we're dealing with a real forwardRef. Don't want to crash early.
  21753. if (type !== null && type !== undefined && typeof type.render === 'function') {
  21754. // ForwardRef is special because its resolved .type is an object,
  21755. // but it's possible that we only have its inner render function in the map.
  21756. // If that inner render function is different, we'll build a new forwardRef type.
  21757. var currentRender = resolveFunctionForHotReloading(type.render);
  21758. if (type.render !== currentRender) {
  21759. var syntheticType = {
  21760. $$typeof: REACT_FORWARD_REF_TYPE,
  21761. render: currentRender
  21762. };
  21763. if (type.displayName !== undefined) {
  21764. syntheticType.displayName = type.displayName;
  21765. }
  21766. return syntheticType;
  21767. }
  21768. }
  21769. return type;
  21770. } // Use the latest known implementation.
  21771. return family.current;
  21772. }
  21773. }
  21774. function isCompatibleFamilyForHotReloading(fiber, element) {
  21775. {
  21776. if (resolveFamily === null) {
  21777. // Hot reloading is disabled.
  21778. return false;
  21779. }
  21780. var prevType = fiber.elementType;
  21781. var nextType = element.type; // If we got here, we know types aren't === equal.
  21782. var needsCompareFamilies = false;
  21783. var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
  21784. switch (fiber.tag) {
  21785. case ClassComponent:
  21786. {
  21787. if (typeof nextType === 'function') {
  21788. needsCompareFamilies = true;
  21789. }
  21790. break;
  21791. }
  21792. case FunctionComponent:
  21793. {
  21794. if (typeof nextType === 'function') {
  21795. needsCompareFamilies = true;
  21796. } else if ($$typeofNextType === REACT_LAZY_TYPE) {
  21797. // We don't know the inner type yet.
  21798. // We're going to assume that the lazy inner type is stable,
  21799. // and so it is sufficient to avoid reconciling it away.
  21800. // We're not going to unwrap or actually use the new lazy type.
  21801. needsCompareFamilies = true;
  21802. }
  21803. break;
  21804. }
  21805. case ForwardRef:
  21806. {
  21807. if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
  21808. needsCompareFamilies = true;
  21809. } else if ($$typeofNextType === REACT_LAZY_TYPE) {
  21810. needsCompareFamilies = true;
  21811. }
  21812. break;
  21813. }
  21814. case MemoComponent:
  21815. case SimpleMemoComponent:
  21816. {
  21817. if ($$typeofNextType === REACT_MEMO_TYPE) {
  21818. // TODO: if it was but can no longer be simple,
  21819. // we shouldn't set this.
  21820. needsCompareFamilies = true;
  21821. } else if ($$typeofNextType === REACT_LAZY_TYPE) {
  21822. needsCompareFamilies = true;
  21823. }
  21824. break;
  21825. }
  21826. default:
  21827. return false;
  21828. } // Check if both types have a family and it's the same one.
  21829. if (needsCompareFamilies) {
  21830. // Note: memo() and forwardRef() we'll compare outer rather than inner type.
  21831. // This means both of them need to be registered to preserve state.
  21832. // If we unwrapped and compared the inner types for wrappers instead,
  21833. // then we would risk falsely saying two separate memo(Foo)
  21834. // calls are equivalent because they wrap the same Foo function.
  21835. var prevFamily = resolveFamily(prevType);
  21836. if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
  21837. return true;
  21838. }
  21839. }
  21840. return false;
  21841. }
  21842. }
  21843. function markFailedErrorBoundaryForHotReloading(fiber) {
  21844. {
  21845. if (resolveFamily === null) {
  21846. // Hot reloading is disabled.
  21847. return;
  21848. }
  21849. if (typeof WeakSet !== 'function') {
  21850. return;
  21851. }
  21852. if (failedBoundaries === null) {
  21853. failedBoundaries = new WeakSet();
  21854. }
  21855. failedBoundaries.add(fiber);
  21856. }
  21857. }
  21858. var scheduleRefresh = function (root, update) {
  21859. {
  21860. if (resolveFamily === null) {
  21861. // Hot reloading is disabled.
  21862. return;
  21863. }
  21864. var staleFamilies = update.staleFamilies,
  21865. updatedFamilies = update.updatedFamilies;
  21866. flushPassiveEffects();
  21867. flushSync(function () {
  21868. scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies);
  21869. });
  21870. }
  21871. };
  21872. var scheduleRoot = function (root, element) {
  21873. {
  21874. if (root.context !== emptyContextObject) {
  21875. // Super edge case: root has a legacy _renderSubtree context
  21876. // but we don't know the parentComponent so we can't pass it.
  21877. // Just ignore. We'll delete this with _renderSubtree code path later.
  21878. return;
  21879. }
  21880. flushPassiveEffects();
  21881. syncUpdates(function () {
  21882. updateContainer(element, root, null, null);
  21883. });
  21884. }
  21885. };
  21886. function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
  21887. {
  21888. var alternate = fiber.alternate,
  21889. child = fiber.child,
  21890. sibling = fiber.sibling,
  21891. tag = fiber.tag,
  21892. type = fiber.type;
  21893. var candidateType = null;
  21894. switch (tag) {
  21895. case FunctionComponent:
  21896. case SimpleMemoComponent:
  21897. case ClassComponent:
  21898. candidateType = type;
  21899. break;
  21900. case ForwardRef:
  21901. candidateType = type.render;
  21902. break;
  21903. }
  21904. if (resolveFamily === null) {
  21905. throw new Error('Expected resolveFamily to be set during hot reload.');
  21906. }
  21907. var needsRender = false;
  21908. var needsRemount = false;
  21909. if (candidateType !== null) {
  21910. var family = resolveFamily(candidateType);
  21911. if (family !== undefined) {
  21912. if (staleFamilies.has(family)) {
  21913. needsRemount = true;
  21914. } else if (updatedFamilies.has(family)) {
  21915. if (tag === ClassComponent) {
  21916. needsRemount = true;
  21917. } else {
  21918. needsRender = true;
  21919. }
  21920. }
  21921. }
  21922. }
  21923. if (failedBoundaries !== null) {
  21924. if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
  21925. needsRemount = true;
  21926. }
  21927. }
  21928. if (needsRemount) {
  21929. fiber._debugNeedsRemount = true;
  21930. }
  21931. if (needsRemount || needsRender) {
  21932. scheduleWork(fiber, Sync);
  21933. }
  21934. if (child !== null && !needsRemount) {
  21935. scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
  21936. }
  21937. if (sibling !== null) {
  21938. scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
  21939. }
  21940. }
  21941. }
  21942. var findHostInstancesForRefresh = function (root, families) {
  21943. {
  21944. var hostInstances = new Set();
  21945. var types = new Set(families.map(function (family) {
  21946. return family.current;
  21947. }));
  21948. findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances);
  21949. return hostInstances;
  21950. }
  21951. };
  21952. function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
  21953. {
  21954. var child = fiber.child,
  21955. sibling = fiber.sibling,
  21956. tag = fiber.tag,
  21957. type = fiber.type;
  21958. var candidateType = null;
  21959. switch (tag) {
  21960. case FunctionComponent:
  21961. case SimpleMemoComponent:
  21962. case ClassComponent:
  21963. candidateType = type;
  21964. break;
  21965. case ForwardRef:
  21966. candidateType = type.render;
  21967. break;
  21968. }
  21969. var didMatch = false;
  21970. if (candidateType !== null) {
  21971. if (types.has(candidateType)) {
  21972. didMatch = true;
  21973. }
  21974. }
  21975. if (didMatch) {
  21976. // We have a match. This only drills down to the closest host components.
  21977. // There's no need to search deeper because for the purpose of giving
  21978. // visual feedback, "flashing" outermost parent rectangles is sufficient.
  21979. findHostInstancesForFiberShallowly(fiber, hostInstances);
  21980. } else {
  21981. // If there's no match, maybe there will be one further down in the child tree.
  21982. if (child !== null) {
  21983. findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
  21984. }
  21985. }
  21986. if (sibling !== null) {
  21987. findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
  21988. }
  21989. }
  21990. }
  21991. function findHostInstancesForFiberShallowly(fiber, hostInstances) {
  21992. {
  21993. var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
  21994. if (foundHostInstances) {
  21995. return;
  21996. } // If we didn't find any host children, fallback to closest host parent.
  21997. var node = fiber;
  21998. while (true) {
  21999. switch (node.tag) {
  22000. case HostComponent:
  22001. hostInstances.add(node.stateNode);
  22002. return;
  22003. case HostPortal:
  22004. hostInstances.add(node.stateNode.containerInfo);
  22005. return;
  22006. case HostRoot:
  22007. hostInstances.add(node.stateNode.containerInfo);
  22008. return;
  22009. }
  22010. if (node.return === null) {
  22011. throw new Error('Expected to reach root first.');
  22012. }
  22013. node = node.return;
  22014. }
  22015. }
  22016. }
  22017. function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
  22018. {
  22019. var node = fiber;
  22020. var foundHostInstances = false;
  22021. while (true) {
  22022. if (node.tag === HostComponent) {
  22023. // We got a match.
  22024. foundHostInstances = true;
  22025. hostInstances.add(node.stateNode); // There may still be more, so keep searching.
  22026. } else if (node.child !== null) {
  22027. node.child.return = node;
  22028. node = node.child;
  22029. continue;
  22030. }
  22031. if (node === fiber) {
  22032. return foundHostInstances;
  22033. }
  22034. while (node.sibling === null) {
  22035. if (node.return === null || node.return === fiber) {
  22036. return foundHostInstances;
  22037. }
  22038. node = node.return;
  22039. }
  22040. node.sibling.return = node.return;
  22041. node = node.sibling;
  22042. }
  22043. }
  22044. return false;
  22045. }
  22046. function resolveDefaultProps(Component, baseProps) {
  22047. if (Component && Component.defaultProps) {
  22048. // Resolve default props. Taken from ReactElement
  22049. var props = _assign({}, baseProps);
  22050. var defaultProps = Component.defaultProps;
  22051. for (var propName in defaultProps) {
  22052. if (props[propName] === undefined) {
  22053. props[propName] = defaultProps[propName];
  22054. }
  22055. }
  22056. return props;
  22057. }
  22058. return baseProps;
  22059. }
  22060. function readLazyComponentType(lazyComponent) {
  22061. initializeLazyComponentType(lazyComponent);
  22062. if (lazyComponent._status !== Resolved) {
  22063. throw lazyComponent._result;
  22064. }
  22065. return lazyComponent._result;
  22066. }
  22067. var valueCursor = createCursor(null);
  22068. var rendererSigil;
  22069. {
  22070. // Use this to detect multiple renderers using the same context
  22071. rendererSigil = {};
  22072. }
  22073. var currentlyRenderingFiber = null;
  22074. var lastContextDependency = null;
  22075. var lastContextWithAllBitsObserved = null;
  22076. var isDisallowedContextReadInDEV = false;
  22077. function resetContextDependencies() {
  22078. // This is called right before React yields execution, to ensure `readContext`
  22079. // cannot be called outside the render phase.
  22080. currentlyRenderingFiber = null;
  22081. lastContextDependency = null;
  22082. lastContextWithAllBitsObserved = null;
  22083. {
  22084. isDisallowedContextReadInDEV = false;
  22085. }
  22086. }
  22087. function enterDisallowedContextReadInDEV() {
  22088. {
  22089. isDisallowedContextReadInDEV = true;
  22090. }
  22091. }
  22092. function exitDisallowedContextReadInDEV() {
  22093. {
  22094. isDisallowedContextReadInDEV = false;
  22095. }
  22096. }
  22097. function pushProvider(providerFiber, nextValue) {
  22098. var context = providerFiber.type._context;
  22099. {
  22100. push(valueCursor, context._currentValue, providerFiber);
  22101. context._currentValue = nextValue;
  22102. {
  22103. if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
  22104. error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
  22105. }
  22106. context._currentRenderer = rendererSigil;
  22107. }
  22108. }
  22109. }
  22110. function popProvider(providerFiber) {
  22111. var currentValue = valueCursor.current;
  22112. pop(valueCursor, providerFiber);
  22113. var context = providerFiber.type._context;
  22114. {
  22115. context._currentValue = currentValue;
  22116. }
  22117. }
  22118. function calculateChangedBits(context, newValue, oldValue) {
  22119. if (objectIs(oldValue, newValue)) {
  22120. // No change
  22121. return 0;
  22122. } else {
  22123. var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
  22124. {
  22125. if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) {
  22126. error('calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits);
  22127. }
  22128. }
  22129. return changedBits | 0;
  22130. }
  22131. }
  22132. function scheduleWorkOnParentPath(parent, renderExpirationTime) {
  22133. // Update the child expiration time of all the ancestors, including
  22134. // the alternates.
  22135. var node = parent;
  22136. while (node !== null) {
  22137. var alternate = node.alternate;
  22138. if (node.childExpirationTime < renderExpirationTime) {
  22139. node.childExpirationTime = renderExpirationTime;
  22140. if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
  22141. alternate.childExpirationTime = renderExpirationTime;
  22142. }
  22143. } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
  22144. alternate.childExpirationTime = renderExpirationTime;
  22145. } else {
  22146. // Neither alternate was updated, which means the rest of the
  22147. // ancestor path already has sufficient priority.
  22148. break;
  22149. }
  22150. node = node.return;
  22151. }
  22152. }
  22153. function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
  22154. var fiber = workInProgress.child;
  22155. if (fiber !== null) {
  22156. // Set the return pointer of the child to the work-in-progress fiber.
  22157. fiber.return = workInProgress;
  22158. }
  22159. while (fiber !== null) {
  22160. var nextFiber = void 0; // Visit this fiber.
  22161. var list = fiber.dependencies;
  22162. if (list !== null) {
  22163. nextFiber = fiber.child;
  22164. var dependency = list.firstContext;
  22165. while (dependency !== null) {
  22166. // Check if the context matches.
  22167. if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
  22168. // Match! Schedule an update on this fiber.
  22169. if (fiber.tag === ClassComponent) {
  22170. // Schedule a force update on the work-in-progress.
  22171. var update = createUpdate(renderExpirationTime, null);
  22172. update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the
  22173. // update to the current fiber, too, which means it will persist even if
  22174. // this render is thrown away. Since it's a race condition, not sure it's
  22175. // worth fixing.
  22176. enqueueUpdate(fiber, update);
  22177. }
  22178. if (fiber.expirationTime < renderExpirationTime) {
  22179. fiber.expirationTime = renderExpirationTime;
  22180. }
  22181. var alternate = fiber.alternate;
  22182. if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
  22183. alternate.expirationTime = renderExpirationTime;
  22184. }
  22185. scheduleWorkOnParentPath(fiber.return, renderExpirationTime); // Mark the expiration time on the list, too.
  22186. if (list.expirationTime < renderExpirationTime) {
  22187. list.expirationTime = renderExpirationTime;
  22188. } // Since we already found a match, we can stop traversing the
  22189. // dependency list.
  22190. break;
  22191. }
  22192. dependency = dependency.next;
  22193. }
  22194. } else if (fiber.tag === ContextProvider) {
  22195. // Don't scan deeper if this is a matching provider
  22196. nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
  22197. } else {
  22198. // Traverse down.
  22199. nextFiber = fiber.child;
  22200. }
  22201. if (nextFiber !== null) {
  22202. // Set the return pointer of the child to the work-in-progress fiber.
  22203. nextFiber.return = fiber;
  22204. } else {
  22205. // No child. Traverse to next sibling.
  22206. nextFiber = fiber;
  22207. while (nextFiber !== null) {
  22208. if (nextFiber === workInProgress) {
  22209. // We're back to the root of this subtree. Exit.
  22210. nextFiber = null;
  22211. break;
  22212. }
  22213. var sibling = nextFiber.sibling;
  22214. if (sibling !== null) {
  22215. // Set the return pointer of the sibling to the work-in-progress fiber.
  22216. sibling.return = nextFiber.return;
  22217. nextFiber = sibling;
  22218. break;
  22219. } // No more siblings. Traverse up.
  22220. nextFiber = nextFiber.return;
  22221. }
  22222. }
  22223. fiber = nextFiber;
  22224. }
  22225. }
  22226. function prepareToReadContext(workInProgress, renderExpirationTime) {
  22227. currentlyRenderingFiber = workInProgress;
  22228. lastContextDependency = null;
  22229. lastContextWithAllBitsObserved = null;
  22230. var dependencies = workInProgress.dependencies;
  22231. if (dependencies !== null) {
  22232. var firstContext = dependencies.firstContext;
  22233. if (firstContext !== null) {
  22234. if (dependencies.expirationTime >= renderExpirationTime) {
  22235. // Context list has a pending update. Mark that this fiber performed work.
  22236. markWorkInProgressReceivedUpdate();
  22237. } // Reset the work-in-progress list
  22238. dependencies.firstContext = null;
  22239. }
  22240. }
  22241. }
  22242. function readContext(context, observedBits) {
  22243. {
  22244. // This warning would fire if you read context inside a Hook like useMemo.
  22245. // Unlike the class check below, it's not enforced in production for perf.
  22246. if (isDisallowedContextReadInDEV) {
  22247. error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
  22248. }
  22249. }
  22250. if (lastContextWithAllBitsObserved === context) ; else if (observedBits === false || observedBits === 0) ; else {
  22251. var resolvedObservedBits; // Avoid deopting on observable arguments or heterogeneous types.
  22252. if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) {
  22253. // Observe all updates.
  22254. lastContextWithAllBitsObserved = context;
  22255. resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
  22256. } else {
  22257. resolvedObservedBits = observedBits;
  22258. }
  22259. var contextItem = {
  22260. context: context,
  22261. observedBits: resolvedObservedBits,
  22262. next: null
  22263. };
  22264. if (lastContextDependency === null) {
  22265. if (!(currentlyRenderingFiber !== null)) {
  22266. {
  22267. throw Error( "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." );
  22268. }
  22269. } // This is the first dependency for this component. Create a new list.
  22270. lastContextDependency = contextItem;
  22271. currentlyRenderingFiber.dependencies = {
  22272. expirationTime: NoWork,
  22273. firstContext: contextItem,
  22274. responders: null
  22275. };
  22276. } else {
  22277. // Append a new context item.
  22278. lastContextDependency = lastContextDependency.next = contextItem;
  22279. }
  22280. }
  22281. return context._currentValue ;
  22282. }
  22283. var UpdateState = 0;
  22284. var ReplaceState = 1;
  22285. var ForceUpdate = 2;
  22286. var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`.
  22287. // It should only be read right after calling `processUpdateQueue`, via
  22288. // `checkHasForceUpdateAfterProcessing`.
  22289. var hasForceUpdate = false;
  22290. var didWarnUpdateInsideUpdate;
  22291. var currentlyProcessingQueue;
  22292. {
  22293. didWarnUpdateInsideUpdate = false;
  22294. currentlyProcessingQueue = null;
  22295. }
  22296. function initializeUpdateQueue(fiber) {
  22297. var queue = {
  22298. baseState: fiber.memoizedState,
  22299. baseQueue: null,
  22300. shared: {
  22301. pending: null
  22302. },
  22303. effects: null
  22304. };
  22305. fiber.updateQueue = queue;
  22306. }
  22307. function cloneUpdateQueue(current, workInProgress) {
  22308. // Clone the update queue from current. Unless it's already a clone.
  22309. var queue = workInProgress.updateQueue;
  22310. var currentQueue = current.updateQueue;
  22311. if (queue === currentQueue) {
  22312. var clone = {
  22313. baseState: currentQueue.baseState,
  22314. baseQueue: currentQueue.baseQueue,
  22315. shared: currentQueue.shared,
  22316. effects: currentQueue.effects
  22317. };
  22318. workInProgress.updateQueue = clone;
  22319. }
  22320. }
  22321. function createUpdate(expirationTime, suspenseConfig) {
  22322. var update = {
  22323. expirationTime: expirationTime,
  22324. suspenseConfig: suspenseConfig,
  22325. tag: UpdateState,
  22326. payload: null,
  22327. callback: null,
  22328. next: null
  22329. };
  22330. update.next = update;
  22331. {
  22332. update.priority = getCurrentPriorityLevel();
  22333. }
  22334. return update;
  22335. }
  22336. function enqueueUpdate(fiber, update) {
  22337. var updateQueue = fiber.updateQueue;
  22338. if (updateQueue === null) {
  22339. // Only occurs if the fiber has been unmounted.
  22340. return;
  22341. }
  22342. var sharedQueue = updateQueue.shared;
  22343. var pending = sharedQueue.pending;
  22344. if (pending === null) {
  22345. // This is the first update. Create a circular list.
  22346. update.next = update;
  22347. } else {
  22348. update.next = pending.next;
  22349. pending.next = update;
  22350. }
  22351. sharedQueue.pending = update;
  22352. {
  22353. if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) {
  22354. error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
  22355. didWarnUpdateInsideUpdate = true;
  22356. }
  22357. }
  22358. }
  22359. function enqueueCapturedUpdate(workInProgress, update) {
  22360. var current = workInProgress.alternate;
  22361. if (current !== null) {
  22362. // Ensure the work-in-progress queue is a clone
  22363. cloneUpdateQueue(current, workInProgress);
  22364. } // Captured updates go only on the work-in-progress queue.
  22365. var queue = workInProgress.updateQueue; // Append the update to the end of the list.
  22366. var last = queue.baseQueue;
  22367. if (last === null) {
  22368. queue.baseQueue = update.next = update;
  22369. update.next = update;
  22370. } else {
  22371. update.next = last.next;
  22372. last.next = update;
  22373. }
  22374. }
  22375. function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
  22376. switch (update.tag) {
  22377. case ReplaceState:
  22378. {
  22379. var payload = update.payload;
  22380. if (typeof payload === 'function') {
  22381. // Updater function
  22382. {
  22383. enterDisallowedContextReadInDEV();
  22384. if ( workInProgress.mode & StrictMode) {
  22385. payload.call(instance, prevState, nextProps);
  22386. }
  22387. }
  22388. var nextState = payload.call(instance, prevState, nextProps);
  22389. {
  22390. exitDisallowedContextReadInDEV();
  22391. }
  22392. return nextState;
  22393. } // State object
  22394. return payload;
  22395. }
  22396. case CaptureUpdate:
  22397. {
  22398. workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
  22399. }
  22400. // Intentional fallthrough
  22401. case UpdateState:
  22402. {
  22403. var _payload = update.payload;
  22404. var partialState;
  22405. if (typeof _payload === 'function') {
  22406. // Updater function
  22407. {
  22408. enterDisallowedContextReadInDEV();
  22409. if ( workInProgress.mode & StrictMode) {
  22410. _payload.call(instance, prevState, nextProps);
  22411. }
  22412. }
  22413. partialState = _payload.call(instance, prevState, nextProps);
  22414. {
  22415. exitDisallowedContextReadInDEV();
  22416. }
  22417. } else {
  22418. // Partial state object
  22419. partialState = _payload;
  22420. }
  22421. if (partialState === null || partialState === undefined) {
  22422. // Null and undefined are treated as no-ops.
  22423. return prevState;
  22424. } // Merge the partial state and the previous state.
  22425. return _assign({}, prevState, partialState);
  22426. }
  22427. case ForceUpdate:
  22428. {
  22429. hasForceUpdate = true;
  22430. return prevState;
  22431. }
  22432. }
  22433. return prevState;
  22434. }
  22435. function processUpdateQueue(workInProgress, props, instance, renderExpirationTime) {
  22436. // This is always non-null on a ClassComponent or HostRoot
  22437. var queue = workInProgress.updateQueue;
  22438. hasForceUpdate = false;
  22439. {
  22440. currentlyProcessingQueue = queue.shared;
  22441. } // The last rebase update that is NOT part of the base state.
  22442. var baseQueue = queue.baseQueue; // The last pending update that hasn't been processed yet.
  22443. var pendingQueue = queue.shared.pending;
  22444. if (pendingQueue !== null) {
  22445. // We have new updates that haven't been processed yet.
  22446. // We'll add them to the base queue.
  22447. if (baseQueue !== null) {
  22448. // Merge the pending queue and the base queue.
  22449. var baseFirst = baseQueue.next;
  22450. var pendingFirst = pendingQueue.next;
  22451. baseQueue.next = pendingFirst;
  22452. pendingQueue.next = baseFirst;
  22453. }
  22454. baseQueue = pendingQueue;
  22455. queue.shared.pending = null; // TODO: Pass `current` as argument
  22456. var current = workInProgress.alternate;
  22457. if (current !== null) {
  22458. var currentQueue = current.updateQueue;
  22459. if (currentQueue !== null) {
  22460. currentQueue.baseQueue = pendingQueue;
  22461. }
  22462. }
  22463. } // These values may change as we process the queue.
  22464. if (baseQueue !== null) {
  22465. var first = baseQueue.next; // Iterate through the list of updates to compute the result.
  22466. var newState = queue.baseState;
  22467. var newExpirationTime = NoWork;
  22468. var newBaseState = null;
  22469. var newBaseQueueFirst = null;
  22470. var newBaseQueueLast = null;
  22471. if (first !== null) {
  22472. var update = first;
  22473. do {
  22474. var updateExpirationTime = update.expirationTime;
  22475. if (updateExpirationTime < renderExpirationTime) {
  22476. // Priority is insufficient. Skip this update. If this is the first
  22477. // skipped update, the previous update/state is the new base
  22478. // update/state.
  22479. var clone = {
  22480. expirationTime: update.expirationTime,
  22481. suspenseConfig: update.suspenseConfig,
  22482. tag: update.tag,
  22483. payload: update.payload,
  22484. callback: update.callback,
  22485. next: null
  22486. };
  22487. if (newBaseQueueLast === null) {
  22488. newBaseQueueFirst = newBaseQueueLast = clone;
  22489. newBaseState = newState;
  22490. } else {
  22491. newBaseQueueLast = newBaseQueueLast.next = clone;
  22492. } // Update the remaining priority in the queue.
  22493. if (updateExpirationTime > newExpirationTime) {
  22494. newExpirationTime = updateExpirationTime;
  22495. }
  22496. } else {
  22497. // This update does have sufficient priority.
  22498. if (newBaseQueueLast !== null) {
  22499. var _clone = {
  22500. expirationTime: Sync,
  22501. // This update is going to be committed so we never want uncommit it.
  22502. suspenseConfig: update.suspenseConfig,
  22503. tag: update.tag,
  22504. payload: update.payload,
  22505. callback: update.callback,
  22506. next: null
  22507. };
  22508. newBaseQueueLast = newBaseQueueLast.next = _clone;
  22509. } // Mark the event time of this update as relevant to this render pass.
  22510. // TODO: This should ideally use the true event time of this update rather than
  22511. // its priority which is a derived and not reverseable value.
  22512. // TODO: We should skip this update if it was already committed but currently
  22513. // we have no way of detecting the difference between a committed and suspended
  22514. // update here.
  22515. markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process this update.
  22516. newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance);
  22517. var callback = update.callback;
  22518. if (callback !== null) {
  22519. workInProgress.effectTag |= Callback;
  22520. var effects = queue.effects;
  22521. if (effects === null) {
  22522. queue.effects = [update];
  22523. } else {
  22524. effects.push(update);
  22525. }
  22526. }
  22527. }
  22528. update = update.next;
  22529. if (update === null || update === first) {
  22530. pendingQueue = queue.shared.pending;
  22531. if (pendingQueue === null) {
  22532. break;
  22533. } else {
  22534. // An update was scheduled from inside a reducer. Add the new
  22535. // pending updates to the end of the list and keep processing.
  22536. update = baseQueue.next = pendingQueue.next;
  22537. pendingQueue.next = first;
  22538. queue.baseQueue = baseQueue = pendingQueue;
  22539. queue.shared.pending = null;
  22540. }
  22541. }
  22542. } while (true);
  22543. }
  22544. if (newBaseQueueLast === null) {
  22545. newBaseState = newState;
  22546. } else {
  22547. newBaseQueueLast.next = newBaseQueueFirst;
  22548. }
  22549. queue.baseState = newBaseState;
  22550. queue.baseQueue = newBaseQueueLast; // Set the remaining expiration time to be whatever is remaining in the queue.
  22551. // This should be fine because the only two other things that contribute to
  22552. // expiration time are props and context. We're already in the middle of the
  22553. // begin phase by the time we start processing the queue, so we've already
  22554. // dealt with the props. Context in components that specify
  22555. // shouldComponentUpdate is tricky; but we'll have to account for
  22556. // that regardless.
  22557. markUnprocessedUpdateTime(newExpirationTime);
  22558. workInProgress.expirationTime = newExpirationTime;
  22559. workInProgress.memoizedState = newState;
  22560. }
  22561. {
  22562. currentlyProcessingQueue = null;
  22563. }
  22564. }
  22565. function callCallback(callback, context) {
  22566. if (!(typeof callback === 'function')) {
  22567. {
  22568. throw Error( "Invalid argument passed as callback. Expected a function. Instead received: " + callback );
  22569. }
  22570. }
  22571. callback.call(context);
  22572. }
  22573. function resetHasForceUpdateBeforeProcessing() {
  22574. hasForceUpdate = false;
  22575. }
  22576. function checkHasForceUpdateAfterProcessing() {
  22577. return hasForceUpdate;
  22578. }
  22579. function commitUpdateQueue(finishedWork, finishedQueue, instance) {
  22580. // Commit the effects
  22581. var effects = finishedQueue.effects;
  22582. finishedQueue.effects = null;
  22583. if (effects !== null) {
  22584. for (var i = 0; i < effects.length; i++) {
  22585. var effect = effects[i];
  22586. var callback = effect.callback;
  22587. if (callback !== null) {
  22588. effect.callback = null;
  22589. callCallback(callback, instance);
  22590. }
  22591. }
  22592. }
  22593. }
  22594. var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
  22595. function requestCurrentSuspenseConfig() {
  22596. return ReactCurrentBatchConfig.suspense;
  22597. }
  22598. var fakeInternalInstance = {};
  22599. var isArray = Array.isArray; // React.Component uses a shared frozen object by default.
  22600. // We'll use it to determine whether we need to initialize legacy refs.
  22601. var emptyRefsObject = new React.Component().refs;
  22602. var didWarnAboutStateAssignmentForComponent;
  22603. var didWarnAboutUninitializedState;
  22604. var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
  22605. var didWarnAboutLegacyLifecyclesAndDerivedState;
  22606. var didWarnAboutUndefinedDerivedState;
  22607. var warnOnUndefinedDerivedState;
  22608. var warnOnInvalidCallback;
  22609. var didWarnAboutDirectlyAssigningPropsToState;
  22610. var didWarnAboutContextTypeAndContextTypes;
  22611. var didWarnAboutInvalidateContextType;
  22612. {
  22613. didWarnAboutStateAssignmentForComponent = new Set();
  22614. didWarnAboutUninitializedState = new Set();
  22615. didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
  22616. didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
  22617. didWarnAboutDirectlyAssigningPropsToState = new Set();
  22618. didWarnAboutUndefinedDerivedState = new Set();
  22619. didWarnAboutContextTypeAndContextTypes = new Set();
  22620. didWarnAboutInvalidateContextType = new Set();
  22621. var didWarnOnInvalidCallback = new Set();
  22622. warnOnInvalidCallback = function (callback, callerName) {
  22623. if (callback === null || typeof callback === 'function') {
  22624. return;
  22625. }
  22626. var key = callerName + "_" + callback;
  22627. if (!didWarnOnInvalidCallback.has(key)) {
  22628. didWarnOnInvalidCallback.add(key);
  22629. error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
  22630. }
  22631. };
  22632. warnOnUndefinedDerivedState = function (type, partialState) {
  22633. if (partialState === undefined) {
  22634. var componentName = getComponentName(type) || 'Component';
  22635. if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
  22636. didWarnAboutUndefinedDerivedState.add(componentName);
  22637. error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
  22638. }
  22639. }
  22640. }; // This is so gross but it's at least non-critical and can be removed if
  22641. // it causes problems. This is meant to give a nicer error message for
  22642. // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
  22643. // ...)) which otherwise throws a "_processChildContext is not a function"
  22644. // exception.
  22645. Object.defineProperty(fakeInternalInstance, '_processChildContext', {
  22646. enumerable: false,
  22647. value: function () {
  22648. {
  22649. {
  22650. throw Error( "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." );
  22651. }
  22652. }
  22653. }
  22654. });
  22655. Object.freeze(fakeInternalInstance);
  22656. }
  22657. function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
  22658. var prevState = workInProgress.memoizedState;
  22659. {
  22660. if ( workInProgress.mode & StrictMode) {
  22661. // Invoke the function an extra time to help detect side-effects.
  22662. getDerivedStateFromProps(nextProps, prevState);
  22663. }
  22664. }
  22665. var partialState = getDerivedStateFromProps(nextProps, prevState);
  22666. {
  22667. warnOnUndefinedDerivedState(ctor, partialState);
  22668. } // Merge the partial state and the previous state.
  22669. var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
  22670. workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the
  22671. // base state.
  22672. if (workInProgress.expirationTime === NoWork) {
  22673. // Queue is always non-null for classes
  22674. var updateQueue = workInProgress.updateQueue;
  22675. updateQueue.baseState = memoizedState;
  22676. }
  22677. }
  22678. var classComponentUpdater = {
  22679. isMounted: isMounted,
  22680. enqueueSetState: function (inst, payload, callback) {
  22681. var fiber = get(inst);
  22682. var currentTime = requestCurrentTimeForUpdate();
  22683. var suspenseConfig = requestCurrentSuspenseConfig();
  22684. var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
  22685. var update = createUpdate(expirationTime, suspenseConfig);
  22686. update.payload = payload;
  22687. if (callback !== undefined && callback !== null) {
  22688. {
  22689. warnOnInvalidCallback(callback, 'setState');
  22690. }
  22691. update.callback = callback;
  22692. }
  22693. enqueueUpdate(fiber, update);
  22694. scheduleWork(fiber, expirationTime);
  22695. },
  22696. enqueueReplaceState: function (inst, payload, callback) {
  22697. var fiber = get(inst);
  22698. var currentTime = requestCurrentTimeForUpdate();
  22699. var suspenseConfig = requestCurrentSuspenseConfig();
  22700. var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
  22701. var update = createUpdate(expirationTime, suspenseConfig);
  22702. update.tag = ReplaceState;
  22703. update.payload = payload;
  22704. if (callback !== undefined && callback !== null) {
  22705. {
  22706. warnOnInvalidCallback(callback, 'replaceState');
  22707. }
  22708. update.callback = callback;
  22709. }
  22710. enqueueUpdate(fiber, update);
  22711. scheduleWork(fiber, expirationTime);
  22712. },
  22713. enqueueForceUpdate: function (inst, callback) {
  22714. var fiber = get(inst);
  22715. var currentTime = requestCurrentTimeForUpdate();
  22716. var suspenseConfig = requestCurrentSuspenseConfig();
  22717. var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
  22718. var update = createUpdate(expirationTime, suspenseConfig);
  22719. update.tag = ForceUpdate;
  22720. if (callback !== undefined && callback !== null) {
  22721. {
  22722. warnOnInvalidCallback(callback, 'forceUpdate');
  22723. }
  22724. update.callback = callback;
  22725. }
  22726. enqueueUpdate(fiber, update);
  22727. scheduleWork(fiber, expirationTime);
  22728. }
  22729. };
  22730. function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
  22731. var instance = workInProgress.stateNode;
  22732. if (typeof instance.shouldComponentUpdate === 'function') {
  22733. {
  22734. if ( workInProgress.mode & StrictMode) {
  22735. // Invoke the function an extra time to help detect side-effects.
  22736. instance.shouldComponentUpdate(newProps, newState, nextContext);
  22737. }
  22738. }
  22739. startPhaseTimer(workInProgress, 'shouldComponentUpdate');
  22740. var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
  22741. stopPhaseTimer();
  22742. {
  22743. if (shouldUpdate === undefined) {
  22744. error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component');
  22745. }
  22746. }
  22747. return shouldUpdate;
  22748. }
  22749. if (ctor.prototype && ctor.prototype.isPureReactComponent) {
  22750. return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
  22751. }
  22752. return true;
  22753. }
  22754. function checkClassInstance(workInProgress, ctor, newProps) {
  22755. var instance = workInProgress.stateNode;
  22756. {
  22757. var name = getComponentName(ctor) || 'Component';
  22758. var renderPresent = instance.render;
  22759. if (!renderPresent) {
  22760. if (ctor.prototype && typeof ctor.prototype.render === 'function') {
  22761. error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
  22762. } else {
  22763. error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
  22764. }
  22765. }
  22766. if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) {
  22767. error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name);
  22768. }
  22769. if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) {
  22770. error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name);
  22771. }
  22772. if (instance.propTypes) {
  22773. error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name);
  22774. }
  22775. if (instance.contextType) {
  22776. error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name);
  22777. }
  22778. {
  22779. if (instance.contextTypes) {
  22780. error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name);
  22781. }
  22782. if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
  22783. didWarnAboutContextTypeAndContextTypes.add(ctor);
  22784. error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
  22785. }
  22786. }
  22787. if (typeof instance.componentShouldUpdate === 'function') {
  22788. error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name);
  22789. }
  22790. if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
  22791. error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
  22792. }
  22793. if (typeof instance.componentDidUnmount === 'function') {
  22794. error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name);
  22795. }
  22796. if (typeof instance.componentDidReceiveProps === 'function') {
  22797. error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name);
  22798. }
  22799. if (typeof instance.componentWillRecieveProps === 'function') {
  22800. error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name);
  22801. }
  22802. if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') {
  22803. error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name);
  22804. }
  22805. var hasMutatedProps = instance.props !== newProps;
  22806. if (instance.props !== undefined && hasMutatedProps) {
  22807. error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name);
  22808. }
  22809. if (instance.defaultProps) {
  22810. error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name);
  22811. }
  22812. if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
  22813. didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
  22814. error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
  22815. }
  22816. if (typeof instance.getDerivedStateFromProps === 'function') {
  22817. error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
  22818. }
  22819. if (typeof instance.getDerivedStateFromError === 'function') {
  22820. error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
  22821. }
  22822. if (typeof ctor.getSnapshotBeforeUpdate === 'function') {
  22823. error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name);
  22824. }
  22825. var _state = instance.state;
  22826. if (_state && (typeof _state !== 'object' || isArray(_state))) {
  22827. error('%s.state: must be set to an object or null', name);
  22828. }
  22829. if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') {
  22830. error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name);
  22831. }
  22832. }
  22833. }
  22834. function adoptClassInstance(workInProgress, instance) {
  22835. instance.updater = classComponentUpdater;
  22836. workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates
  22837. set(instance, workInProgress);
  22838. {
  22839. instance._reactInternalInstance = fakeInternalInstance;
  22840. }
  22841. }
  22842. function constructClassInstance(workInProgress, ctor, props) {
  22843. var isLegacyContextConsumer = false;
  22844. var unmaskedContext = emptyContextObject;
  22845. var context = emptyContextObject;
  22846. var contextType = ctor.contextType;
  22847. {
  22848. if ('contextType' in ctor) {
  22849. var isValid = // Allow null for conditional declaration
  22850. contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
  22851. if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
  22852. didWarnAboutInvalidateContextType.add(ctor);
  22853. var addendum = '';
  22854. if (contextType === undefined) {
  22855. addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
  22856. } else if (typeof contextType !== 'object') {
  22857. addendum = ' However, it is set to a ' + typeof contextType + '.';
  22858. } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
  22859. addendum = ' Did you accidentally pass the Context.Provider instead?';
  22860. } else if (contextType._context !== undefined) {
  22861. // <Context.Consumer>
  22862. addendum = ' Did you accidentally pass the Context.Consumer instead?';
  22863. } else {
  22864. addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
  22865. }
  22866. error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
  22867. }
  22868. }
  22869. }
  22870. if (typeof contextType === 'object' && contextType !== null) {
  22871. context = readContext(contextType);
  22872. } else {
  22873. unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
  22874. var contextTypes = ctor.contextTypes;
  22875. isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
  22876. context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
  22877. } // Instantiate twice to help detect side-effects.
  22878. {
  22879. if ( workInProgress.mode & StrictMode) {
  22880. new ctor(props, context); // eslint-disable-line no-new
  22881. }
  22882. }
  22883. var instance = new ctor(props, context);
  22884. var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
  22885. adoptClassInstance(workInProgress, instance);
  22886. {
  22887. if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
  22888. var componentName = getComponentName(ctor) || 'Component';
  22889. if (!didWarnAboutUninitializedState.has(componentName)) {
  22890. didWarnAboutUninitializedState.add(componentName);
  22891. error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
  22892. }
  22893. } // If new component APIs are defined, "unsafe" lifecycles won't be called.
  22894. // Warn about these lifecycles if they are present.
  22895. // Don't warn about react-lifecycles-compat polyfilled methods though.
  22896. if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
  22897. var foundWillMountName = null;
  22898. var foundWillReceivePropsName = null;
  22899. var foundWillUpdateName = null;
  22900. if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
  22901. foundWillMountName = 'componentWillMount';
  22902. } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
  22903. foundWillMountName = 'UNSAFE_componentWillMount';
  22904. }
  22905. if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
  22906. foundWillReceivePropsName = 'componentWillReceiveProps';
  22907. } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
  22908. foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
  22909. }
  22910. if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
  22911. foundWillUpdateName = 'componentWillUpdate';
  22912. } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
  22913. foundWillUpdateName = 'UNSAFE_componentWillUpdate';
  22914. }
  22915. if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
  22916. var _componentName = getComponentName(ctor) || 'Component';
  22917. var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
  22918. if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
  22919. didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
  22920. error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : '');
  22921. }
  22922. }
  22923. }
  22924. } // Cache unmasked context so we can avoid recreating masked context unless necessary.
  22925. // ReactFiberContext usually updates this cache but can't for newly-created instances.
  22926. if (isLegacyContextConsumer) {
  22927. cacheContext(workInProgress, unmaskedContext, context);
  22928. }
  22929. return instance;
  22930. }
  22931. function callComponentWillMount(workInProgress, instance) {
  22932. startPhaseTimer(workInProgress, 'componentWillMount');
  22933. var oldState = instance.state;
  22934. if (typeof instance.componentWillMount === 'function') {
  22935. instance.componentWillMount();
  22936. }
  22937. if (typeof instance.UNSAFE_componentWillMount === 'function') {
  22938. instance.UNSAFE_componentWillMount();
  22939. }
  22940. stopPhaseTimer();
  22941. if (oldState !== instance.state) {
  22942. {
  22943. error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
  22944. }
  22945. classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
  22946. }
  22947. }
  22948. function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
  22949. var oldState = instance.state;
  22950. startPhaseTimer(workInProgress, 'componentWillReceiveProps');
  22951. if (typeof instance.componentWillReceiveProps === 'function') {
  22952. instance.componentWillReceiveProps(newProps, nextContext);
  22953. }
  22954. if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
  22955. instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
  22956. }
  22957. stopPhaseTimer();
  22958. if (instance.state !== oldState) {
  22959. {
  22960. var componentName = getComponentName(workInProgress.type) || 'Component';
  22961. if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
  22962. didWarnAboutStateAssignmentForComponent.add(componentName);
  22963. error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
  22964. }
  22965. }
  22966. classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
  22967. }
  22968. } // Invokes the mount life-cycles on a previously never rendered instance.
  22969. function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
  22970. {
  22971. checkClassInstance(workInProgress, ctor, newProps);
  22972. }
  22973. var instance = workInProgress.stateNode;
  22974. instance.props = newProps;
  22975. instance.state = workInProgress.memoizedState;
  22976. instance.refs = emptyRefsObject;
  22977. initializeUpdateQueue(workInProgress);
  22978. var contextType = ctor.contextType;
  22979. if (typeof contextType === 'object' && contextType !== null) {
  22980. instance.context = readContext(contextType);
  22981. } else {
  22982. var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
  22983. instance.context = getMaskedContext(workInProgress, unmaskedContext);
  22984. }
  22985. {
  22986. if (instance.state === newProps) {
  22987. var componentName = getComponentName(ctor) || 'Component';
  22988. if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
  22989. didWarnAboutDirectlyAssigningPropsToState.add(componentName);
  22990. error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
  22991. }
  22992. }
  22993. if (workInProgress.mode & StrictMode) {
  22994. ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
  22995. }
  22996. {
  22997. ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
  22998. }
  22999. }
  23000. processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
  23001. instance.state = workInProgress.memoizedState;
  23002. var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
  23003. if (typeof getDerivedStateFromProps === 'function') {
  23004. applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
  23005. instance.state = workInProgress.memoizedState;
  23006. } // In order to support react-lifecycles-compat polyfilled components,
  23007. // Unsafe lifecycles should not be invoked for components using the new APIs.
  23008. if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
  23009. callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's
  23010. // process them now.
  23011. processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
  23012. instance.state = workInProgress.memoizedState;
  23013. }
  23014. if (typeof instance.componentDidMount === 'function') {
  23015. workInProgress.effectTag |= Update;
  23016. }
  23017. }
  23018. function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
  23019. var instance = workInProgress.stateNode;
  23020. var oldProps = workInProgress.memoizedProps;
  23021. instance.props = oldProps;
  23022. var oldContext = instance.context;
  23023. var contextType = ctor.contextType;
  23024. var nextContext = emptyContextObject;
  23025. if (typeof contextType === 'object' && contextType !== null) {
  23026. nextContext = readContext(contextType);
  23027. } else {
  23028. var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
  23029. nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
  23030. }
  23031. var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
  23032. var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what
  23033. // ever the previously attempted to render - not the "current". However,
  23034. // during componentDidUpdate we pass the "current" props.
  23035. // In order to support react-lifecycles-compat polyfilled components,
  23036. // Unsafe lifecycles should not be invoked for components using the new APIs.
  23037. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
  23038. if (oldProps !== newProps || oldContext !== nextContext) {
  23039. callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
  23040. }
  23041. }
  23042. resetHasForceUpdateBeforeProcessing();
  23043. var oldState = workInProgress.memoizedState;
  23044. var newState = instance.state = oldState;
  23045. processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
  23046. newState = workInProgress.memoizedState;
  23047. if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
  23048. // If an update was already in progress, we should schedule an Update
  23049. // effect even though we're bailing out, so that cWU/cDU are called.
  23050. if (typeof instance.componentDidMount === 'function') {
  23051. workInProgress.effectTag |= Update;
  23052. }
  23053. return false;
  23054. }
  23055. if (typeof getDerivedStateFromProps === 'function') {
  23056. applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
  23057. newState = workInProgress.memoizedState;
  23058. }
  23059. var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
  23060. if (shouldUpdate) {
  23061. // In order to support react-lifecycles-compat polyfilled components,
  23062. // Unsafe lifecycles should not be invoked for components using the new APIs.
  23063. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
  23064. startPhaseTimer(workInProgress, 'componentWillMount');
  23065. if (typeof instance.componentWillMount === 'function') {
  23066. instance.componentWillMount();
  23067. }
  23068. if (typeof instance.UNSAFE_componentWillMount === 'function') {
  23069. instance.UNSAFE_componentWillMount();
  23070. }
  23071. stopPhaseTimer();
  23072. }
  23073. if (typeof instance.componentDidMount === 'function') {
  23074. workInProgress.effectTag |= Update;
  23075. }
  23076. } else {
  23077. // If an update was already in progress, we should schedule an Update
  23078. // effect even though we're bailing out, so that cWU/cDU are called.
  23079. if (typeof instance.componentDidMount === 'function') {
  23080. workInProgress.effectTag |= Update;
  23081. } // If shouldComponentUpdate returned false, we should still update the
  23082. // memoized state to indicate that this work can be reused.
  23083. workInProgress.memoizedProps = newProps;
  23084. workInProgress.memoizedState = newState;
  23085. } // Update the existing instance's state, props, and context pointers even
  23086. // if shouldComponentUpdate returns false.
  23087. instance.props = newProps;
  23088. instance.state = newState;
  23089. instance.context = nextContext;
  23090. return shouldUpdate;
  23091. } // Invokes the update life-cycles and returns false if it shouldn't rerender.
  23092. function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
  23093. var instance = workInProgress.stateNode;
  23094. cloneUpdateQueue(current, workInProgress);
  23095. var oldProps = workInProgress.memoizedProps;
  23096. instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
  23097. var oldContext = instance.context;
  23098. var contextType = ctor.contextType;
  23099. var nextContext = emptyContextObject;
  23100. if (typeof contextType === 'object' && contextType !== null) {
  23101. nextContext = readContext(contextType);
  23102. } else {
  23103. var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
  23104. nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
  23105. }
  23106. var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
  23107. var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what
  23108. // ever the previously attempted to render - not the "current". However,
  23109. // during componentDidUpdate we pass the "current" props.
  23110. // In order to support react-lifecycles-compat polyfilled components,
  23111. // Unsafe lifecycles should not be invoked for components using the new APIs.
  23112. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
  23113. if (oldProps !== newProps || oldContext !== nextContext) {
  23114. callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
  23115. }
  23116. }
  23117. resetHasForceUpdateBeforeProcessing();
  23118. var oldState = workInProgress.memoizedState;
  23119. var newState = instance.state = oldState;
  23120. processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
  23121. newState = workInProgress.memoizedState;
  23122. if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
  23123. // If an update was already in progress, we should schedule an Update
  23124. // effect even though we're bailing out, so that cWU/cDU are called.
  23125. if (typeof instance.componentDidUpdate === 'function') {
  23126. if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
  23127. workInProgress.effectTag |= Update;
  23128. }
  23129. }
  23130. if (typeof instance.getSnapshotBeforeUpdate === 'function') {
  23131. if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
  23132. workInProgress.effectTag |= Snapshot;
  23133. }
  23134. }
  23135. return false;
  23136. }
  23137. if (typeof getDerivedStateFromProps === 'function') {
  23138. applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
  23139. newState = workInProgress.memoizedState;
  23140. }
  23141. var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
  23142. if (shouldUpdate) {
  23143. // In order to support react-lifecycles-compat polyfilled components,
  23144. // Unsafe lifecycles should not be invoked for components using the new APIs.
  23145. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
  23146. startPhaseTimer(workInProgress, 'componentWillUpdate');
  23147. if (typeof instance.componentWillUpdate === 'function') {
  23148. instance.componentWillUpdate(newProps, newState, nextContext);
  23149. }
  23150. if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
  23151. instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
  23152. }
  23153. stopPhaseTimer();
  23154. }
  23155. if (typeof instance.componentDidUpdate === 'function') {
  23156. workInProgress.effectTag |= Update;
  23157. }
  23158. if (typeof instance.getSnapshotBeforeUpdate === 'function') {
  23159. workInProgress.effectTag |= Snapshot;
  23160. }
  23161. } else {
  23162. // If an update was already in progress, we should schedule an Update
  23163. // effect even though we're bailing out, so that cWU/cDU are called.
  23164. if (typeof instance.componentDidUpdate === 'function') {
  23165. if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
  23166. workInProgress.effectTag |= Update;
  23167. }
  23168. }
  23169. if (typeof instance.getSnapshotBeforeUpdate === 'function') {
  23170. if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
  23171. workInProgress.effectTag |= Snapshot;
  23172. }
  23173. } // If shouldComponentUpdate returned false, we should still update the
  23174. // memoized props/state to indicate that this work can be reused.
  23175. workInProgress.memoizedProps = newProps;
  23176. workInProgress.memoizedState = newState;
  23177. } // Update the existing instance's state, props, and context pointers even
  23178. // if shouldComponentUpdate returns false.
  23179. instance.props = newProps;
  23180. instance.state = newState;
  23181. instance.context = nextContext;
  23182. return shouldUpdate;
  23183. }
  23184. var didWarnAboutMaps;
  23185. var didWarnAboutGenerators;
  23186. var didWarnAboutStringRefs;
  23187. var ownerHasKeyUseWarning;
  23188. var ownerHasFunctionTypeWarning;
  23189. var warnForMissingKey = function (child) {};
  23190. {
  23191. didWarnAboutMaps = false;
  23192. didWarnAboutGenerators = false;
  23193. didWarnAboutStringRefs = {};
  23194. /**
  23195. * Warn if there's no key explicitly set on dynamic arrays of children or
  23196. * object keys are not valid. This allows us to keep track of children between
  23197. * updates.
  23198. */
  23199. ownerHasKeyUseWarning = {};
  23200. ownerHasFunctionTypeWarning = {};
  23201. warnForMissingKey = function (child) {
  23202. if (child === null || typeof child !== 'object') {
  23203. return;
  23204. }
  23205. if (!child._store || child._store.validated || child.key != null) {
  23206. return;
  23207. }
  23208. if (!(typeof child._store === 'object')) {
  23209. {
  23210. throw Error( "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." );
  23211. }
  23212. }
  23213. child._store.validated = true;
  23214. var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
  23215. if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
  23216. return;
  23217. }
  23218. ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
  23219. error('Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
  23220. };
  23221. }
  23222. var isArray$1 = Array.isArray;
  23223. function coerceRef(returnFiber, current, element) {
  23224. var mixedRef = element.ref;
  23225. if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
  23226. {
  23227. // TODO: Clean this up once we turn on the string ref warning for
  23228. // everyone, because the strict mode case will no longer be relevant
  23229. if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs
  23230. // because these cannot be automatically converted to an arrow function
  23231. // using a codemod. Therefore, we don't have to warn about string refs again.
  23232. !(element._owner && element._self && element._owner.stateNode !== element._self)) {
  23233. var componentName = getComponentName(returnFiber.type) || 'Component';
  23234. if (!didWarnAboutStringRefs[componentName]) {
  23235. {
  23236. error('A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref%s', mixedRef, getStackByFiberInDevAndProd(returnFiber));
  23237. }
  23238. didWarnAboutStringRefs[componentName] = true;
  23239. }
  23240. }
  23241. }
  23242. if (element._owner) {
  23243. var owner = element._owner;
  23244. var inst;
  23245. if (owner) {
  23246. var ownerFiber = owner;
  23247. if (!(ownerFiber.tag === ClassComponent)) {
  23248. {
  23249. throw Error( "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref" );
  23250. }
  23251. }
  23252. inst = ownerFiber.stateNode;
  23253. }
  23254. if (!inst) {
  23255. {
  23256. throw Error( "Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue." );
  23257. }
  23258. }
  23259. var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
  23260. if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) {
  23261. return current.ref;
  23262. }
  23263. var ref = function (value) {
  23264. var refs = inst.refs;
  23265. if (refs === emptyRefsObject) {
  23266. // This is a lazy pooled frozen object, so we need to initialize.
  23267. refs = inst.refs = {};
  23268. }
  23269. if (value === null) {
  23270. delete refs[stringRef];
  23271. } else {
  23272. refs[stringRef] = value;
  23273. }
  23274. };
  23275. ref._stringRef = stringRef;
  23276. return ref;
  23277. } else {
  23278. if (!(typeof mixedRef === 'string')) {
  23279. {
  23280. throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." );
  23281. }
  23282. }
  23283. if (!element._owner) {
  23284. {
  23285. throw Error( "Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." );
  23286. }
  23287. }
  23288. }
  23289. }
  23290. return mixedRef;
  23291. }
  23292. function throwOnInvalidObjectType(returnFiber, newChild) {
  23293. if (returnFiber.type !== 'textarea') {
  23294. var addendum = '';
  23295. {
  23296. addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
  23297. }
  23298. {
  23299. {
  23300. throw Error( "Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ")." + addendum );
  23301. }
  23302. }
  23303. }
  23304. }
  23305. function warnOnFunctionType() {
  23306. {
  23307. var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
  23308. if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
  23309. return;
  23310. }
  23311. ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
  23312. error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
  23313. }
  23314. } // This wrapper function exists because I expect to clone the code in each path
  23315. // to be able to optimize each path individually by branching early. This needs
  23316. // a compiler or we can do it manually. Helpers that don't need this branching
  23317. // live outside of this function.
  23318. function ChildReconciler(shouldTrackSideEffects) {
  23319. function deleteChild(returnFiber, childToDelete) {
  23320. if (!shouldTrackSideEffects) {
  23321. // Noop.
  23322. return;
  23323. } // Deletions are added in reversed order so we add it to the front.
  23324. // At this point, the return fiber's effect list is empty except for
  23325. // deletions, so we can just append the deletion to the list. The remaining
  23326. // effects aren't added until the complete phase. Once we implement
  23327. // resuming, this may not be true.
  23328. var last = returnFiber.lastEffect;
  23329. if (last !== null) {
  23330. last.nextEffect = childToDelete;
  23331. returnFiber.lastEffect = childToDelete;
  23332. } else {
  23333. returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
  23334. }
  23335. childToDelete.nextEffect = null;
  23336. childToDelete.effectTag = Deletion;
  23337. }
  23338. function deleteRemainingChildren(returnFiber, currentFirstChild) {
  23339. if (!shouldTrackSideEffects) {
  23340. // Noop.
  23341. return null;
  23342. } // TODO: For the shouldClone case, this could be micro-optimized a bit by
  23343. // assuming that after the first child we've already added everything.
  23344. var childToDelete = currentFirstChild;
  23345. while (childToDelete !== null) {
  23346. deleteChild(returnFiber, childToDelete);
  23347. childToDelete = childToDelete.sibling;
  23348. }
  23349. return null;
  23350. }
  23351. function mapRemainingChildren(returnFiber, currentFirstChild) {
  23352. // Add the remaining children to a temporary map so that we can find them by
  23353. // keys quickly. Implicit (null) keys get added to this set with their index
  23354. // instead.
  23355. var existingChildren = new Map();
  23356. var existingChild = currentFirstChild;
  23357. while (existingChild !== null) {
  23358. if (existingChild.key !== null) {
  23359. existingChildren.set(existingChild.key, existingChild);
  23360. } else {
  23361. existingChildren.set(existingChild.index, existingChild);
  23362. }
  23363. existingChild = existingChild.sibling;
  23364. }
  23365. return existingChildren;
  23366. }
  23367. function useFiber(fiber, pendingProps) {
  23368. // We currently set sibling to null and index to 0 here because it is easy
  23369. // to forget to do before returning it. E.g. for the single child case.
  23370. var clone = createWorkInProgress(fiber, pendingProps);
  23371. clone.index = 0;
  23372. clone.sibling = null;
  23373. return clone;
  23374. }
  23375. function placeChild(newFiber, lastPlacedIndex, newIndex) {
  23376. newFiber.index = newIndex;
  23377. if (!shouldTrackSideEffects) {
  23378. // Noop.
  23379. return lastPlacedIndex;
  23380. }
  23381. var current = newFiber.alternate;
  23382. if (current !== null) {
  23383. var oldIndex = current.index;
  23384. if (oldIndex < lastPlacedIndex) {
  23385. // This is a move.
  23386. newFiber.effectTag = Placement;
  23387. return lastPlacedIndex;
  23388. } else {
  23389. // This item can stay in place.
  23390. return oldIndex;
  23391. }
  23392. } else {
  23393. // This is an insertion.
  23394. newFiber.effectTag = Placement;
  23395. return lastPlacedIndex;
  23396. }
  23397. }
  23398. function placeSingleChild(newFiber) {
  23399. // This is simpler for the single child case. We only need to do a
  23400. // placement for inserting new children.
  23401. if (shouldTrackSideEffects && newFiber.alternate === null) {
  23402. newFiber.effectTag = Placement;
  23403. }
  23404. return newFiber;
  23405. }
  23406. function updateTextNode(returnFiber, current, textContent, expirationTime) {
  23407. if (current === null || current.tag !== HostText) {
  23408. // Insert
  23409. var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
  23410. created.return = returnFiber;
  23411. return created;
  23412. } else {
  23413. // Update
  23414. var existing = useFiber(current, textContent);
  23415. existing.return = returnFiber;
  23416. return existing;
  23417. }
  23418. }
  23419. function updateElement(returnFiber, current, element, expirationTime) {
  23420. if (current !== null) {
  23421. if (current.elementType === element.type || ( // Keep this check inline so it only runs on the false path:
  23422. isCompatibleFamilyForHotReloading(current, element) )) {
  23423. // Move based on index
  23424. var existing = useFiber(current, element.props);
  23425. existing.ref = coerceRef(returnFiber, current, element);
  23426. existing.return = returnFiber;
  23427. {
  23428. existing._debugSource = element._source;
  23429. existing._debugOwner = element._owner;
  23430. }
  23431. return existing;
  23432. }
  23433. } // Insert
  23434. var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
  23435. created.ref = coerceRef(returnFiber, current, element);
  23436. created.return = returnFiber;
  23437. return created;
  23438. }
  23439. function updatePortal(returnFiber, current, portal, expirationTime) {
  23440. if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) {
  23441. // Insert
  23442. var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
  23443. created.return = returnFiber;
  23444. return created;
  23445. } else {
  23446. // Update
  23447. var existing = useFiber(current, portal.children || []);
  23448. existing.return = returnFiber;
  23449. return existing;
  23450. }
  23451. }
  23452. function updateFragment(returnFiber, current, fragment, expirationTime, key) {
  23453. if (current === null || current.tag !== Fragment) {
  23454. // Insert
  23455. var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
  23456. created.return = returnFiber;
  23457. return created;
  23458. } else {
  23459. // Update
  23460. var existing = useFiber(current, fragment);
  23461. existing.return = returnFiber;
  23462. return existing;
  23463. }
  23464. }
  23465. function createChild(returnFiber, newChild, expirationTime) {
  23466. if (typeof newChild === 'string' || typeof newChild === 'number') {
  23467. // Text nodes don't have keys. If the previous node is implicitly keyed
  23468. // we can continue to replace it without aborting even if it is not a text
  23469. // node.
  23470. var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
  23471. created.return = returnFiber;
  23472. return created;
  23473. }
  23474. if (typeof newChild === 'object' && newChild !== null) {
  23475. switch (newChild.$$typeof) {
  23476. case REACT_ELEMENT_TYPE:
  23477. {
  23478. var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
  23479. _created.ref = coerceRef(returnFiber, null, newChild);
  23480. _created.return = returnFiber;
  23481. return _created;
  23482. }
  23483. case REACT_PORTAL_TYPE:
  23484. {
  23485. var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
  23486. _created2.return = returnFiber;
  23487. return _created2;
  23488. }
  23489. }
  23490. if (isArray$1(newChild) || getIteratorFn(newChild)) {
  23491. var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
  23492. _created3.return = returnFiber;
  23493. return _created3;
  23494. }
  23495. throwOnInvalidObjectType(returnFiber, newChild);
  23496. }
  23497. {
  23498. if (typeof newChild === 'function') {
  23499. warnOnFunctionType();
  23500. }
  23501. }
  23502. return null;
  23503. }
  23504. function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
  23505. // Update the fiber if the keys match, otherwise return null.
  23506. var key = oldFiber !== null ? oldFiber.key : null;
  23507. if (typeof newChild === 'string' || typeof newChild === 'number') {
  23508. // Text nodes don't have keys. If the previous node is implicitly keyed
  23509. // we can continue to replace it without aborting even if it is not a text
  23510. // node.
  23511. if (key !== null) {
  23512. return null;
  23513. }
  23514. return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
  23515. }
  23516. if (typeof newChild === 'object' && newChild !== null) {
  23517. switch (newChild.$$typeof) {
  23518. case REACT_ELEMENT_TYPE:
  23519. {
  23520. if (newChild.key === key) {
  23521. if (newChild.type === REACT_FRAGMENT_TYPE) {
  23522. return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
  23523. }
  23524. return updateElement(returnFiber, oldFiber, newChild, expirationTime);
  23525. } else {
  23526. return null;
  23527. }
  23528. }
  23529. case REACT_PORTAL_TYPE:
  23530. {
  23531. if (newChild.key === key) {
  23532. return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
  23533. } else {
  23534. return null;
  23535. }
  23536. }
  23537. }
  23538. if (isArray$1(newChild) || getIteratorFn(newChild)) {
  23539. if (key !== null) {
  23540. return null;
  23541. }
  23542. return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
  23543. }
  23544. throwOnInvalidObjectType(returnFiber, newChild);
  23545. }
  23546. {
  23547. if (typeof newChild === 'function') {
  23548. warnOnFunctionType();
  23549. }
  23550. }
  23551. return null;
  23552. }
  23553. function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
  23554. if (typeof newChild === 'string' || typeof newChild === 'number') {
  23555. // Text nodes don't have keys, so we neither have to check the old nor
  23556. // new node for the key. If both are text nodes, they match.
  23557. var matchedFiber = existingChildren.get(newIdx) || null;
  23558. return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
  23559. }
  23560. if (typeof newChild === 'object' && newChild !== null) {
  23561. switch (newChild.$$typeof) {
  23562. case REACT_ELEMENT_TYPE:
  23563. {
  23564. var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
  23565. if (newChild.type === REACT_FRAGMENT_TYPE) {
  23566. return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
  23567. }
  23568. return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
  23569. }
  23570. case REACT_PORTAL_TYPE:
  23571. {
  23572. var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
  23573. return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
  23574. }
  23575. }
  23576. if (isArray$1(newChild) || getIteratorFn(newChild)) {
  23577. var _matchedFiber3 = existingChildren.get(newIdx) || null;
  23578. return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
  23579. }
  23580. throwOnInvalidObjectType(returnFiber, newChild);
  23581. }
  23582. {
  23583. if (typeof newChild === 'function') {
  23584. warnOnFunctionType();
  23585. }
  23586. }
  23587. return null;
  23588. }
  23589. /**
  23590. * Warns if there is a duplicate or missing key
  23591. */
  23592. function warnOnInvalidKey(child, knownKeys) {
  23593. {
  23594. if (typeof child !== 'object' || child === null) {
  23595. return knownKeys;
  23596. }
  23597. switch (child.$$typeof) {
  23598. case REACT_ELEMENT_TYPE:
  23599. case REACT_PORTAL_TYPE:
  23600. warnForMissingKey(child);
  23601. var key = child.key;
  23602. if (typeof key !== 'string') {
  23603. break;
  23604. }
  23605. if (knownKeys === null) {
  23606. knownKeys = new Set();
  23607. knownKeys.add(key);
  23608. break;
  23609. }
  23610. if (!knownKeys.has(key)) {
  23611. knownKeys.add(key);
  23612. break;
  23613. }
  23614. error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
  23615. break;
  23616. }
  23617. }
  23618. return knownKeys;
  23619. }
  23620. function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
  23621. // This algorithm can't optimize by searching from both ends since we
  23622. // don't have backpointers on fibers. I'm trying to see how far we can get
  23623. // with that model. If it ends up not being worth the tradeoffs, we can
  23624. // add it later.
  23625. // Even with a two ended optimization, we'd want to optimize for the case
  23626. // where there are few changes and brute force the comparison instead of
  23627. // going for the Map. It'd like to explore hitting that path first in
  23628. // forward-only mode and only go for the Map once we notice that we need
  23629. // lots of look ahead. This doesn't handle reversal as well as two ended
  23630. // search but that's unusual. Besides, for the two ended optimization to
  23631. // work on Iterables, we'd need to copy the whole set.
  23632. // In this first iteration, we'll just live with hitting the bad case
  23633. // (adding everything to a Map) in for every insert/move.
  23634. // If you change this code, also update reconcileChildrenIterator() which
  23635. // uses the same algorithm.
  23636. {
  23637. // First, validate keys.
  23638. var knownKeys = null;
  23639. for (var i = 0; i < newChildren.length; i++) {
  23640. var child = newChildren[i];
  23641. knownKeys = warnOnInvalidKey(child, knownKeys);
  23642. }
  23643. }
  23644. var resultingFirstChild = null;
  23645. var previousNewFiber = null;
  23646. var oldFiber = currentFirstChild;
  23647. var lastPlacedIndex = 0;
  23648. var newIdx = 0;
  23649. var nextOldFiber = null;
  23650. for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
  23651. if (oldFiber.index > newIdx) {
  23652. nextOldFiber = oldFiber;
  23653. oldFiber = null;
  23654. } else {
  23655. nextOldFiber = oldFiber.sibling;
  23656. }
  23657. var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
  23658. if (newFiber === null) {
  23659. // TODO: This breaks on empty slots like null children. That's
  23660. // unfortunate because it triggers the slow path all the time. We need
  23661. // a better way to communicate whether this was a miss or null,
  23662. // boolean, undefined, etc.
  23663. if (oldFiber === null) {
  23664. oldFiber = nextOldFiber;
  23665. }
  23666. break;
  23667. }
  23668. if (shouldTrackSideEffects) {
  23669. if (oldFiber && newFiber.alternate === null) {
  23670. // We matched the slot, but we didn't reuse the existing fiber, so we
  23671. // need to delete the existing child.
  23672. deleteChild(returnFiber, oldFiber);
  23673. }
  23674. }
  23675. lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
  23676. if (previousNewFiber === null) {
  23677. // TODO: Move out of the loop. This only happens for the first run.
  23678. resultingFirstChild = newFiber;
  23679. } else {
  23680. // TODO: Defer siblings if we're not at the right index for this slot.
  23681. // I.e. if we had null values before, then we want to defer this
  23682. // for each null value. However, we also don't want to call updateSlot
  23683. // with the previous one.
  23684. previousNewFiber.sibling = newFiber;
  23685. }
  23686. previousNewFiber = newFiber;
  23687. oldFiber = nextOldFiber;
  23688. }
  23689. if (newIdx === newChildren.length) {
  23690. // We've reached the end of the new children. We can delete the rest.
  23691. deleteRemainingChildren(returnFiber, oldFiber);
  23692. return resultingFirstChild;
  23693. }
  23694. if (oldFiber === null) {
  23695. // If we don't have any more existing children we can choose a fast path
  23696. // since the rest will all be insertions.
  23697. for (; newIdx < newChildren.length; newIdx++) {
  23698. var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
  23699. if (_newFiber === null) {
  23700. continue;
  23701. }
  23702. lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
  23703. if (previousNewFiber === null) {
  23704. // TODO: Move out of the loop. This only happens for the first run.
  23705. resultingFirstChild = _newFiber;
  23706. } else {
  23707. previousNewFiber.sibling = _newFiber;
  23708. }
  23709. previousNewFiber = _newFiber;
  23710. }
  23711. return resultingFirstChild;
  23712. } // Add all children to a key map for quick lookups.
  23713. var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves.
  23714. for (; newIdx < newChildren.length; newIdx++) {
  23715. var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
  23716. if (_newFiber2 !== null) {
  23717. if (shouldTrackSideEffects) {
  23718. if (_newFiber2.alternate !== null) {
  23719. // The new fiber is a work in progress, but if there exists a
  23720. // current, that means that we reused the fiber. We need to delete
  23721. // it from the child list so that we don't add it to the deletion
  23722. // list.
  23723. existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
  23724. }
  23725. }
  23726. lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
  23727. if (previousNewFiber === null) {
  23728. resultingFirstChild = _newFiber2;
  23729. } else {
  23730. previousNewFiber.sibling = _newFiber2;
  23731. }
  23732. previousNewFiber = _newFiber2;
  23733. }
  23734. }
  23735. if (shouldTrackSideEffects) {
  23736. // Any existing children that weren't consumed above were deleted. We need
  23737. // to add them to the deletion list.
  23738. existingChildren.forEach(function (child) {
  23739. return deleteChild(returnFiber, child);
  23740. });
  23741. }
  23742. return resultingFirstChild;
  23743. }
  23744. function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
  23745. // This is the same implementation as reconcileChildrenArray(),
  23746. // but using the iterator instead.
  23747. var iteratorFn = getIteratorFn(newChildrenIterable);
  23748. if (!(typeof iteratorFn === 'function')) {
  23749. {
  23750. throw Error( "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." );
  23751. }
  23752. }
  23753. {
  23754. // We don't support rendering Generators because it's a mutation.
  23755. // See https://github.com/facebook/react/issues/12995
  23756. if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag
  23757. newChildrenIterable[Symbol.toStringTag] === 'Generator') {
  23758. if (!didWarnAboutGenerators) {
  23759. error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.');
  23760. }
  23761. didWarnAboutGenerators = true;
  23762. } // Warn about using Maps as children
  23763. if (newChildrenIterable.entries === iteratorFn) {
  23764. if (!didWarnAboutMaps) {
  23765. error('Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.');
  23766. }
  23767. didWarnAboutMaps = true;
  23768. } // First, validate keys.
  23769. // We'll get a different iterator later for the main pass.
  23770. var _newChildren = iteratorFn.call(newChildrenIterable);
  23771. if (_newChildren) {
  23772. var knownKeys = null;
  23773. var _step = _newChildren.next();
  23774. for (; !_step.done; _step = _newChildren.next()) {
  23775. var child = _step.value;
  23776. knownKeys = warnOnInvalidKey(child, knownKeys);
  23777. }
  23778. }
  23779. }
  23780. var newChildren = iteratorFn.call(newChildrenIterable);
  23781. if (!(newChildren != null)) {
  23782. {
  23783. throw Error( "An iterable object provided no iterator." );
  23784. }
  23785. }
  23786. var resultingFirstChild = null;
  23787. var previousNewFiber = null;
  23788. var oldFiber = currentFirstChild;
  23789. var lastPlacedIndex = 0;
  23790. var newIdx = 0;
  23791. var nextOldFiber = null;
  23792. var step = newChildren.next();
  23793. for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
  23794. if (oldFiber.index > newIdx) {
  23795. nextOldFiber = oldFiber;
  23796. oldFiber = null;
  23797. } else {
  23798. nextOldFiber = oldFiber.sibling;
  23799. }
  23800. var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
  23801. if (newFiber === null) {
  23802. // TODO: This breaks on empty slots like null children. That's
  23803. // unfortunate because it triggers the slow path all the time. We need
  23804. // a better way to communicate whether this was a miss or null,
  23805. // boolean, undefined, etc.
  23806. if (oldFiber === null) {
  23807. oldFiber = nextOldFiber;
  23808. }
  23809. break;
  23810. }
  23811. if (shouldTrackSideEffects) {
  23812. if (oldFiber && newFiber.alternate === null) {
  23813. // We matched the slot, but we didn't reuse the existing fiber, so we
  23814. // need to delete the existing child.
  23815. deleteChild(returnFiber, oldFiber);
  23816. }
  23817. }
  23818. lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
  23819. if (previousNewFiber === null) {
  23820. // TODO: Move out of the loop. This only happens for the first run.
  23821. resultingFirstChild = newFiber;
  23822. } else {
  23823. // TODO: Defer siblings if we're not at the right index for this slot.
  23824. // I.e. if we had null values before, then we want to defer this
  23825. // for each null value. However, we also don't want to call updateSlot
  23826. // with the previous one.
  23827. previousNewFiber.sibling = newFiber;
  23828. }
  23829. previousNewFiber = newFiber;
  23830. oldFiber = nextOldFiber;
  23831. }
  23832. if (step.done) {
  23833. // We've reached the end of the new children. We can delete the rest.
  23834. deleteRemainingChildren(returnFiber, oldFiber);
  23835. return resultingFirstChild;
  23836. }
  23837. if (oldFiber === null) {
  23838. // If we don't have any more existing children we can choose a fast path
  23839. // since the rest will all be insertions.
  23840. for (; !step.done; newIdx++, step = newChildren.next()) {
  23841. var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
  23842. if (_newFiber3 === null) {
  23843. continue;
  23844. }
  23845. lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
  23846. if (previousNewFiber === null) {
  23847. // TODO: Move out of the loop. This only happens for the first run.
  23848. resultingFirstChild = _newFiber3;
  23849. } else {
  23850. previousNewFiber.sibling = _newFiber3;
  23851. }
  23852. previousNewFiber = _newFiber3;
  23853. }
  23854. return resultingFirstChild;
  23855. } // Add all children to a key map for quick lookups.
  23856. var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves.
  23857. for (; !step.done; newIdx++, step = newChildren.next()) {
  23858. var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
  23859. if (_newFiber4 !== null) {
  23860. if (shouldTrackSideEffects) {
  23861. if (_newFiber4.alternate !== null) {
  23862. // The new fiber is a work in progress, but if there exists a
  23863. // current, that means that we reused the fiber. We need to delete
  23864. // it from the child list so that we don't add it to the deletion
  23865. // list.
  23866. existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
  23867. }
  23868. }
  23869. lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
  23870. if (previousNewFiber === null) {
  23871. resultingFirstChild = _newFiber4;
  23872. } else {
  23873. previousNewFiber.sibling = _newFiber4;
  23874. }
  23875. previousNewFiber = _newFiber4;
  23876. }
  23877. }
  23878. if (shouldTrackSideEffects) {
  23879. // Any existing children that weren't consumed above were deleted. We need
  23880. // to add them to the deletion list.
  23881. existingChildren.forEach(function (child) {
  23882. return deleteChild(returnFiber, child);
  23883. });
  23884. }
  23885. return resultingFirstChild;
  23886. }
  23887. function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
  23888. // There's no need to check for keys on text nodes since we don't have a
  23889. // way to define them.
  23890. if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
  23891. // We already have an existing node so let's just update it and delete
  23892. // the rest.
  23893. deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
  23894. var existing = useFiber(currentFirstChild, textContent);
  23895. existing.return = returnFiber;
  23896. return existing;
  23897. } // The existing first child is not a text node so we need to create one
  23898. // and delete the existing ones.
  23899. deleteRemainingChildren(returnFiber, currentFirstChild);
  23900. var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
  23901. created.return = returnFiber;
  23902. return created;
  23903. }
  23904. function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
  23905. var key = element.key;
  23906. var child = currentFirstChild;
  23907. while (child !== null) {
  23908. // TODO: If key === null and child.key === null, then this only applies to
  23909. // the first item in the list.
  23910. if (child.key === key) {
  23911. switch (child.tag) {
  23912. case Fragment:
  23913. {
  23914. if (element.type === REACT_FRAGMENT_TYPE) {
  23915. deleteRemainingChildren(returnFiber, child.sibling);
  23916. var existing = useFiber(child, element.props.children);
  23917. existing.return = returnFiber;
  23918. {
  23919. existing._debugSource = element._source;
  23920. existing._debugOwner = element._owner;
  23921. }
  23922. return existing;
  23923. }
  23924. break;
  23925. }
  23926. case Block:
  23927. // We intentionally fallthrough here if enableBlocksAPI is not on.
  23928. // eslint-disable-next-lined no-fallthrough
  23929. default:
  23930. {
  23931. if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path:
  23932. isCompatibleFamilyForHotReloading(child, element) )) {
  23933. deleteRemainingChildren(returnFiber, child.sibling);
  23934. var _existing3 = useFiber(child, element.props);
  23935. _existing3.ref = coerceRef(returnFiber, child, element);
  23936. _existing3.return = returnFiber;
  23937. {
  23938. _existing3._debugSource = element._source;
  23939. _existing3._debugOwner = element._owner;
  23940. }
  23941. return _existing3;
  23942. }
  23943. break;
  23944. }
  23945. } // Didn't match.
  23946. deleteRemainingChildren(returnFiber, child);
  23947. break;
  23948. } else {
  23949. deleteChild(returnFiber, child);
  23950. }
  23951. child = child.sibling;
  23952. }
  23953. if (element.type === REACT_FRAGMENT_TYPE) {
  23954. var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
  23955. created.return = returnFiber;
  23956. return created;
  23957. } else {
  23958. var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
  23959. _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
  23960. _created4.return = returnFiber;
  23961. return _created4;
  23962. }
  23963. }
  23964. function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
  23965. var key = portal.key;
  23966. var child = currentFirstChild;
  23967. while (child !== null) {
  23968. // TODO: If key === null and child.key === null, then this only applies to
  23969. // the first item in the list.
  23970. if (child.key === key) {
  23971. if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
  23972. deleteRemainingChildren(returnFiber, child.sibling);
  23973. var existing = useFiber(child, portal.children || []);
  23974. existing.return = returnFiber;
  23975. return existing;
  23976. } else {
  23977. deleteRemainingChildren(returnFiber, child);
  23978. break;
  23979. }
  23980. } else {
  23981. deleteChild(returnFiber, child);
  23982. }
  23983. child = child.sibling;
  23984. }
  23985. var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
  23986. created.return = returnFiber;
  23987. return created;
  23988. } // This API will tag the children with the side-effect of the reconciliation
  23989. // itself. They will be added to the side-effect list as we pass through the
  23990. // children and the parent.
  23991. function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
  23992. // This function is not recursive.
  23993. // If the top level item is an array, we treat it as a set of children,
  23994. // not as a fragment. Nested arrays on the other hand will be treated as
  23995. // fragment nodes. Recursion happens at the normal flow.
  23996. // Handle top level unkeyed fragments as if they were arrays.
  23997. // This leads to an ambiguity between <>{[...]}</> and <>...</>.
  23998. // We treat the ambiguous cases above the same.
  23999. var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
  24000. if (isUnkeyedTopLevelFragment) {
  24001. newChild = newChild.props.children;
  24002. } // Handle object types
  24003. var isObject = typeof newChild === 'object' && newChild !== null;
  24004. if (isObject) {
  24005. switch (newChild.$$typeof) {
  24006. case REACT_ELEMENT_TYPE:
  24007. return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
  24008. case REACT_PORTAL_TYPE:
  24009. return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
  24010. }
  24011. }
  24012. if (typeof newChild === 'string' || typeof newChild === 'number') {
  24013. return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
  24014. }
  24015. if (isArray$1(newChild)) {
  24016. return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
  24017. }
  24018. if (getIteratorFn(newChild)) {
  24019. return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
  24020. }
  24021. if (isObject) {
  24022. throwOnInvalidObjectType(returnFiber, newChild);
  24023. }
  24024. {
  24025. if (typeof newChild === 'function') {
  24026. warnOnFunctionType();
  24027. }
  24028. }
  24029. if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
  24030. // If the new child is undefined, and the return fiber is a composite
  24031. // component, throw an error. If Fiber return types are disabled,
  24032. // we already threw above.
  24033. switch (returnFiber.tag) {
  24034. case ClassComponent:
  24035. {
  24036. {
  24037. var instance = returnFiber.stateNode;
  24038. if (instance.render._isMockFunction) {
  24039. // We allow auto-mocks to proceed as if they're returning null.
  24040. break;
  24041. }
  24042. }
  24043. }
  24044. // Intentionally fall through to the next case, which handles both
  24045. // functions and classes
  24046. // eslint-disable-next-lined no-fallthrough
  24047. case FunctionComponent:
  24048. {
  24049. var Component = returnFiber.type;
  24050. {
  24051. {
  24052. throw Error( (Component.displayName || Component.name || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." );
  24053. }
  24054. }
  24055. }
  24056. }
  24057. } // Remaining cases are all treated as empty.
  24058. return deleteRemainingChildren(returnFiber, currentFirstChild);
  24059. }
  24060. return reconcileChildFibers;
  24061. }
  24062. var reconcileChildFibers = ChildReconciler(true);
  24063. var mountChildFibers = ChildReconciler(false);
  24064. function cloneChildFibers(current, workInProgress) {
  24065. if (!(current === null || workInProgress.child === current.child)) {
  24066. {
  24067. throw Error( "Resuming work not yet implemented." );
  24068. }
  24069. }
  24070. if (workInProgress.child === null) {
  24071. return;
  24072. }
  24073. var currentChild = workInProgress.child;
  24074. var newChild = createWorkInProgress(currentChild, currentChild.pendingProps);
  24075. workInProgress.child = newChild;
  24076. newChild.return = workInProgress;
  24077. while (currentChild.sibling !== null) {
  24078. currentChild = currentChild.sibling;
  24079. newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps);
  24080. newChild.return = workInProgress;
  24081. }
  24082. newChild.sibling = null;
  24083. } // Reset a workInProgress child set to prepare it for a second pass.
  24084. function resetChildFibers(workInProgress, renderExpirationTime) {
  24085. var child = workInProgress.child;
  24086. while (child !== null) {
  24087. resetWorkInProgress(child, renderExpirationTime);
  24088. child = child.sibling;
  24089. }
  24090. }
  24091. var NO_CONTEXT = {};
  24092. var contextStackCursor$1 = createCursor(NO_CONTEXT);
  24093. var contextFiberStackCursor = createCursor(NO_CONTEXT);
  24094. var rootInstanceStackCursor = createCursor(NO_CONTEXT);
  24095. function requiredContext(c) {
  24096. if (!(c !== NO_CONTEXT)) {
  24097. {
  24098. throw Error( "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." );
  24099. }
  24100. }
  24101. return c;
  24102. }
  24103. function getRootHostContainer() {
  24104. var rootInstance = requiredContext(rootInstanceStackCursor.current);
  24105. return rootInstance;
  24106. }
  24107. function pushHostContainer(fiber, nextRootInstance) {
  24108. // Push current root instance onto the stack;
  24109. // This allows us to reset root when portals are popped.
  24110. push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it.
  24111. // This enables us to pop only Fibers that provide unique contexts.
  24112. push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack.
  24113. // However, we can't just call getRootHostContext() and push it because
  24114. // we'd have a different number of entries on the stack depending on
  24115. // whether getRootHostContext() throws somewhere in renderer code or not.
  24116. // So we push an empty value first. This lets us safely unwind on errors.
  24117. push(contextStackCursor$1, NO_CONTEXT, fiber);
  24118. var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it.
  24119. pop(contextStackCursor$1, fiber);
  24120. push(contextStackCursor$1, nextRootContext, fiber);
  24121. }
  24122. function popHostContainer(fiber) {
  24123. pop(contextStackCursor$1, fiber);
  24124. pop(contextFiberStackCursor, fiber);
  24125. pop(rootInstanceStackCursor, fiber);
  24126. }
  24127. function getHostContext() {
  24128. var context = requiredContext(contextStackCursor$1.current);
  24129. return context;
  24130. }
  24131. function pushHostContext(fiber) {
  24132. var rootInstance = requiredContext(rootInstanceStackCursor.current);
  24133. var context = requiredContext(contextStackCursor$1.current);
  24134. var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique.
  24135. if (context === nextContext) {
  24136. return;
  24137. } // Track the context and the Fiber that provided it.
  24138. // This enables us to pop only Fibers that provide unique contexts.
  24139. push(contextFiberStackCursor, fiber, fiber);
  24140. push(contextStackCursor$1, nextContext, fiber);
  24141. }
  24142. function popHostContext(fiber) {
  24143. // Do not pop unless this Fiber provided the current context.
  24144. // pushHostContext() only pushes Fibers that provide unique contexts.
  24145. if (contextFiberStackCursor.current !== fiber) {
  24146. return;
  24147. }
  24148. pop(contextStackCursor$1, fiber);
  24149. pop(contextFiberStackCursor, fiber);
  24150. }
  24151. var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is
  24152. // inherited deeply down the subtree. The upper bits only affect
  24153. // this immediate suspense boundary and gets reset each new
  24154. // boundary or suspense list.
  24155. var SubtreeSuspenseContextMask = 1; // Subtree Flags:
  24156. // InvisibleParentSuspenseContext indicates that one of our parent Suspense
  24157. // boundaries is not currently showing visible main content.
  24158. // Either because it is already showing a fallback or is not mounted at all.
  24159. // We can use this to determine if it is desirable to trigger a fallback at
  24160. // the parent. If not, then we might need to trigger undesirable boundaries
  24161. // and/or suspend the commit to avoid hiding the parent content.
  24162. var InvisibleParentSuspenseContext = 1; // Shallow Flags:
  24163. // ForceSuspenseFallback can be used by SuspenseList to force newly added
  24164. // items into their fallback state during one of the render passes.
  24165. var ForceSuspenseFallback = 2;
  24166. var suspenseStackCursor = createCursor(DefaultSuspenseContext);
  24167. function hasSuspenseContext(parentContext, flag) {
  24168. return (parentContext & flag) !== 0;
  24169. }
  24170. function setDefaultShallowSuspenseContext(parentContext) {
  24171. return parentContext & SubtreeSuspenseContextMask;
  24172. }
  24173. function setShallowSuspenseContext(parentContext, shallowContext) {
  24174. return parentContext & SubtreeSuspenseContextMask | shallowContext;
  24175. }
  24176. function addSubtreeSuspenseContext(parentContext, subtreeContext) {
  24177. return parentContext | subtreeContext;
  24178. }
  24179. function pushSuspenseContext(fiber, newContext) {
  24180. push(suspenseStackCursor, newContext, fiber);
  24181. }
  24182. function popSuspenseContext(fiber) {
  24183. pop(suspenseStackCursor, fiber);
  24184. }
  24185. function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
  24186. // If it was the primary children that just suspended, capture and render the
  24187. // fallback. Otherwise, don't capture and bubble to the next boundary.
  24188. var nextState = workInProgress.memoizedState;
  24189. if (nextState !== null) {
  24190. if (nextState.dehydrated !== null) {
  24191. // A dehydrated boundary always captures.
  24192. return true;
  24193. }
  24194. return false;
  24195. }
  24196. var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop.
  24197. if (props.fallback === undefined) {
  24198. return false;
  24199. } // Regular boundaries always capture.
  24200. if (props.unstable_avoidThisFallback !== true) {
  24201. return true;
  24202. } // If it's a boundary we should avoid, then we prefer to bubble up to the
  24203. // parent boundary if it is currently invisible.
  24204. if (hasInvisibleParent) {
  24205. return false;
  24206. } // If the parent is not able to handle it, we must handle it.
  24207. return true;
  24208. }
  24209. function findFirstSuspended(row) {
  24210. var node = row;
  24211. while (node !== null) {
  24212. if (node.tag === SuspenseComponent) {
  24213. var state = node.memoizedState;
  24214. if (state !== null) {
  24215. var dehydrated = state.dehydrated;
  24216. if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) {
  24217. return node;
  24218. }
  24219. }
  24220. } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't
  24221. // keep track of whether it suspended or not.
  24222. node.memoizedProps.revealOrder !== undefined) {
  24223. var didSuspend = (node.effectTag & DidCapture) !== NoEffect;
  24224. if (didSuspend) {
  24225. return node;
  24226. }
  24227. } else if (node.child !== null) {
  24228. node.child.return = node;
  24229. node = node.child;
  24230. continue;
  24231. }
  24232. if (node === row) {
  24233. return null;
  24234. }
  24235. while (node.sibling === null) {
  24236. if (node.return === null || node.return === row) {
  24237. return null;
  24238. }
  24239. node = node.return;
  24240. }
  24241. node.sibling.return = node.return;
  24242. node = node.sibling;
  24243. }
  24244. return null;
  24245. }
  24246. function createDeprecatedResponderListener(responder, props) {
  24247. var eventResponderListener = {
  24248. responder: responder,
  24249. props: props
  24250. };
  24251. {
  24252. Object.freeze(eventResponderListener);
  24253. }
  24254. return eventResponderListener;
  24255. }
  24256. var HasEffect =
  24257. /* */
  24258. 1; // Represents the phase in which the effect (not the clean-up) fires.
  24259. var Layout =
  24260. /* */
  24261. 2;
  24262. var Passive$1 =
  24263. /* */
  24264. 4;
  24265. var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher,
  24266. ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
  24267. var didWarnAboutMismatchedHooksForComponent;
  24268. {
  24269. didWarnAboutMismatchedHooksForComponent = new Set();
  24270. }
  24271. // These are set right before calling the component.
  24272. var renderExpirationTime = NoWork; // The work-in-progress fiber. I've named it differently to distinguish it from
  24273. // the work-in-progress hook.
  24274. var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The
  24275. // current hook list is the list that belongs to the current fiber. The
  24276. // work-in-progress hook list is a new list that will be added to the
  24277. // work-in-progress fiber.
  24278. var currentHook = null;
  24279. var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This
  24280. // does not get reset if we do another render pass; only when we're completely
  24281. // finished evaluating this component. This is an optimization so we know
  24282. // whether we need to clear render phase updates after a throw.
  24283. var didScheduleRenderPhaseUpdate = false;
  24284. var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook
  24285. var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders.
  24286. // The list stores the order of hooks used during the initial render (mount).
  24287. // Subsequent renders (updates) reference this list.
  24288. var hookTypesDev = null;
  24289. var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore
  24290. // the dependencies for Hooks that need them (e.g. useEffect or useMemo).
  24291. // When true, such Hooks will always be "remounted". Only used during hot reload.
  24292. var ignorePreviousDependencies = false;
  24293. function mountHookTypesDev() {
  24294. {
  24295. var hookName = currentHookNameInDev;
  24296. if (hookTypesDev === null) {
  24297. hookTypesDev = [hookName];
  24298. } else {
  24299. hookTypesDev.push(hookName);
  24300. }
  24301. }
  24302. }
  24303. function updateHookTypesDev() {
  24304. {
  24305. var hookName = currentHookNameInDev;
  24306. if (hookTypesDev !== null) {
  24307. hookTypesUpdateIndexDev++;
  24308. if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
  24309. warnOnHookMismatchInDev(hookName);
  24310. }
  24311. }
  24312. }
  24313. }
  24314. function checkDepsAreArrayDev(deps) {
  24315. {
  24316. if (deps !== undefined && deps !== null && !Array.isArray(deps)) {
  24317. // Verify deps, but only on mount to avoid extra checks.
  24318. // It's unlikely their type would change as usually you define them inline.
  24319. error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps);
  24320. }
  24321. }
  24322. }
  24323. function warnOnHookMismatchInDev(currentHookName) {
  24324. {
  24325. var componentName = getComponentName(currentlyRenderingFiber$1.type);
  24326. if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
  24327. didWarnAboutMismatchedHooksForComponent.add(componentName);
  24328. if (hookTypesDev !== null) {
  24329. var table = '';
  24330. var secondColumnStart = 30;
  24331. for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
  24332. var oldHookName = hookTypesDev[i];
  24333. var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
  24334. var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up
  24335. // lol @ IE not supporting String#repeat
  24336. while (row.length < secondColumnStart) {
  24337. row += ' ';
  24338. }
  24339. row += newHookName + '\n';
  24340. table += row;
  24341. }
  24342. error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
  24343. }
  24344. }
  24345. }
  24346. }
  24347. function throwInvalidHookError() {
  24348. {
  24349. {
  24350. throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
  24351. }
  24352. }
  24353. }
  24354. function areHookInputsEqual(nextDeps, prevDeps) {
  24355. {
  24356. if (ignorePreviousDependencies) {
  24357. // Only true when this component is being hot reloaded.
  24358. return false;
  24359. }
  24360. }
  24361. if (prevDeps === null) {
  24362. {
  24363. error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
  24364. }
  24365. return false;
  24366. }
  24367. {
  24368. // Don't bother comparing lengths in prod because these arrays should be
  24369. // passed inline.
  24370. if (nextDeps.length !== prevDeps.length) {
  24371. error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]");
  24372. }
  24373. }
  24374. for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
  24375. if (objectIs(nextDeps[i], prevDeps[i])) {
  24376. continue;
  24377. }
  24378. return false;
  24379. }
  24380. return true;
  24381. }
  24382. function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderExpirationTime) {
  24383. renderExpirationTime = nextRenderExpirationTime;
  24384. currentlyRenderingFiber$1 = workInProgress;
  24385. {
  24386. hookTypesDev = current !== null ? current._debugHookTypes : null;
  24387. hookTypesUpdateIndexDev = -1; // Used for hot reloading:
  24388. ignorePreviousDependencies = current !== null && current.type !== workInProgress.type;
  24389. }
  24390. workInProgress.memoizedState = null;
  24391. workInProgress.updateQueue = null;
  24392. workInProgress.expirationTime = NoWork; // The following should have already been reset
  24393. // currentHook = null;
  24394. // workInProgressHook = null;
  24395. // didScheduleRenderPhaseUpdate = false;
  24396. // TODO Warn if no hooks are used at all during mount, then some are used during update.
  24397. // Currently we will identify the update render as a mount because memoizedState === null.
  24398. // This is tricky because it's valid for certain types of components (e.g. React.lazy)
  24399. // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used.
  24400. // Non-stateful hooks (e.g. context) don't get added to memoizedState,
  24401. // so memoizedState would be null during updates and mounts.
  24402. {
  24403. if (current !== null && current.memoizedState !== null) {
  24404. ReactCurrentDispatcher.current = HooksDispatcherOnUpdateInDEV;
  24405. } else if (hookTypesDev !== null) {
  24406. // This dispatcher handles an edge case where a component is updating,
  24407. // but no stateful hooks have been used.
  24408. // We want to match the production code behavior (which will use HooksDispatcherOnMount),
  24409. // but with the extra DEV validation to ensure hooks ordering hasn't changed.
  24410. // This dispatcher does that.
  24411. ReactCurrentDispatcher.current = HooksDispatcherOnMountWithHookTypesInDEV;
  24412. } else {
  24413. ReactCurrentDispatcher.current = HooksDispatcherOnMountInDEV;
  24414. }
  24415. }
  24416. var children = Component(props, secondArg); // Check if there was a render phase update
  24417. if (workInProgress.expirationTime === renderExpirationTime) {
  24418. // Keep rendering in a loop for as long as render phase updates continue to
  24419. // be scheduled. Use a counter to prevent infinite loops.
  24420. var numberOfReRenders = 0;
  24421. do {
  24422. workInProgress.expirationTime = NoWork;
  24423. if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
  24424. {
  24425. throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
  24426. }
  24427. }
  24428. numberOfReRenders += 1;
  24429. {
  24430. // Even when hot reloading, allow dependencies to stabilize
  24431. // after first render to prevent infinite render phase updates.
  24432. ignorePreviousDependencies = false;
  24433. } // Start over from the beginning of the list
  24434. currentHook = null;
  24435. workInProgressHook = null;
  24436. workInProgress.updateQueue = null;
  24437. {
  24438. // Also validate hook order for cascading updates.
  24439. hookTypesUpdateIndexDev = -1;
  24440. }
  24441. ReactCurrentDispatcher.current = HooksDispatcherOnRerenderInDEV ;
  24442. children = Component(props, secondArg);
  24443. } while (workInProgress.expirationTime === renderExpirationTime);
  24444. } // We can assume the previous dispatcher is always this one, since we set it
  24445. // at the beginning of the render phase and there's no re-entrancy.
  24446. ReactCurrentDispatcher.current = ContextOnlyDispatcher;
  24447. {
  24448. workInProgress._debugHookTypes = hookTypesDev;
  24449. } // This check uses currentHook so that it works the same in DEV and prod bundles.
  24450. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
  24451. var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
  24452. renderExpirationTime = NoWork;
  24453. currentlyRenderingFiber$1 = null;
  24454. currentHook = null;
  24455. workInProgressHook = null;
  24456. {
  24457. currentHookNameInDev = null;
  24458. hookTypesDev = null;
  24459. hookTypesUpdateIndexDev = -1;
  24460. }
  24461. didScheduleRenderPhaseUpdate = false;
  24462. if (!!didRenderTooFewHooks) {
  24463. {
  24464. throw Error( "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." );
  24465. }
  24466. }
  24467. return children;
  24468. }
  24469. function bailoutHooks(current, workInProgress, expirationTime) {
  24470. workInProgress.updateQueue = current.updateQueue;
  24471. workInProgress.effectTag &= ~(Passive | Update);
  24472. if (current.expirationTime <= expirationTime) {
  24473. current.expirationTime = NoWork;
  24474. }
  24475. }
  24476. function resetHooksAfterThrow() {
  24477. // We can assume the previous dispatcher is always this one, since we set it
  24478. // at the beginning of the render phase and there's no re-entrancy.
  24479. ReactCurrentDispatcher.current = ContextOnlyDispatcher;
  24480. if (didScheduleRenderPhaseUpdate) {
  24481. // There were render phase updates. These are only valid for this render
  24482. // phase, which we are now aborting. Remove the updates from the queues so
  24483. // they do not persist to the next render. Do not remove updates from hooks
  24484. // that weren't processed.
  24485. //
  24486. // Only reset the updates from the queue if it has a clone. If it does
  24487. // not have a clone, that means it wasn't processed, and the updates were
  24488. // scheduled before we entered the render phase.
  24489. var hook = currentlyRenderingFiber$1.memoizedState;
  24490. while (hook !== null) {
  24491. var queue = hook.queue;
  24492. if (queue !== null) {
  24493. queue.pending = null;
  24494. }
  24495. hook = hook.next;
  24496. }
  24497. }
  24498. renderExpirationTime = NoWork;
  24499. currentlyRenderingFiber$1 = null;
  24500. currentHook = null;
  24501. workInProgressHook = null;
  24502. {
  24503. hookTypesDev = null;
  24504. hookTypesUpdateIndexDev = -1;
  24505. currentHookNameInDev = null;
  24506. }
  24507. didScheduleRenderPhaseUpdate = false;
  24508. }
  24509. function mountWorkInProgressHook() {
  24510. var hook = {
  24511. memoizedState: null,
  24512. baseState: null,
  24513. baseQueue: null,
  24514. queue: null,
  24515. next: null
  24516. };
  24517. if (workInProgressHook === null) {
  24518. // This is the first hook in the list
  24519. currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook;
  24520. } else {
  24521. // Append to the end of the list
  24522. workInProgressHook = workInProgressHook.next = hook;
  24523. }
  24524. return workInProgressHook;
  24525. }
  24526. function updateWorkInProgressHook() {
  24527. // This function is used both for updates and for re-renders triggered by a
  24528. // render phase update. It assumes there is either a current hook we can
  24529. // clone, or a work-in-progress hook from a previous render pass that we can
  24530. // use as a base. When we reach the end of the base list, we must switch to
  24531. // the dispatcher used for mounts.
  24532. var nextCurrentHook;
  24533. if (currentHook === null) {
  24534. var current = currentlyRenderingFiber$1.alternate;
  24535. if (current !== null) {
  24536. nextCurrentHook = current.memoizedState;
  24537. } else {
  24538. nextCurrentHook = null;
  24539. }
  24540. } else {
  24541. nextCurrentHook = currentHook.next;
  24542. }
  24543. var nextWorkInProgressHook;
  24544. if (workInProgressHook === null) {
  24545. nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState;
  24546. } else {
  24547. nextWorkInProgressHook = workInProgressHook.next;
  24548. }
  24549. if (nextWorkInProgressHook !== null) {
  24550. // There's already a work-in-progress. Reuse it.
  24551. workInProgressHook = nextWorkInProgressHook;
  24552. nextWorkInProgressHook = workInProgressHook.next;
  24553. currentHook = nextCurrentHook;
  24554. } else {
  24555. // Clone from the current hook.
  24556. if (!(nextCurrentHook !== null)) {
  24557. {
  24558. throw Error( "Rendered more hooks than during the previous render." );
  24559. }
  24560. }
  24561. currentHook = nextCurrentHook;
  24562. var newHook = {
  24563. memoizedState: currentHook.memoizedState,
  24564. baseState: currentHook.baseState,
  24565. baseQueue: currentHook.baseQueue,
  24566. queue: currentHook.queue,
  24567. next: null
  24568. };
  24569. if (workInProgressHook === null) {
  24570. // This is the first hook in the list.
  24571. currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook;
  24572. } else {
  24573. // Append to the end of the list.
  24574. workInProgressHook = workInProgressHook.next = newHook;
  24575. }
  24576. }
  24577. return workInProgressHook;
  24578. }
  24579. function createFunctionComponentUpdateQueue() {
  24580. return {
  24581. lastEffect: null
  24582. };
  24583. }
  24584. function basicStateReducer(state, action) {
  24585. // $FlowFixMe: Flow doesn't like mixed types
  24586. return typeof action === 'function' ? action(state) : action;
  24587. }
  24588. function mountReducer(reducer, initialArg, init) {
  24589. var hook = mountWorkInProgressHook();
  24590. var initialState;
  24591. if (init !== undefined) {
  24592. initialState = init(initialArg);
  24593. } else {
  24594. initialState = initialArg;
  24595. }
  24596. hook.memoizedState = hook.baseState = initialState;
  24597. var queue = hook.queue = {
  24598. pending: null,
  24599. dispatch: null,
  24600. lastRenderedReducer: reducer,
  24601. lastRenderedState: initialState
  24602. };
  24603. var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
  24604. return [hook.memoizedState, dispatch];
  24605. }
  24606. function updateReducer(reducer, initialArg, init) {
  24607. var hook = updateWorkInProgressHook();
  24608. var queue = hook.queue;
  24609. if (!(queue !== null)) {
  24610. {
  24611. throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." );
  24612. }
  24613. }
  24614. queue.lastRenderedReducer = reducer;
  24615. var current = currentHook; // The last rebase update that is NOT part of the base state.
  24616. var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet.
  24617. var pendingQueue = queue.pending;
  24618. if (pendingQueue !== null) {
  24619. // We have new updates that haven't been processed yet.
  24620. // We'll add them to the base queue.
  24621. if (baseQueue !== null) {
  24622. // Merge the pending queue and the base queue.
  24623. var baseFirst = baseQueue.next;
  24624. var pendingFirst = pendingQueue.next;
  24625. baseQueue.next = pendingFirst;
  24626. pendingQueue.next = baseFirst;
  24627. }
  24628. current.baseQueue = baseQueue = pendingQueue;
  24629. queue.pending = null;
  24630. }
  24631. if (baseQueue !== null) {
  24632. // We have a queue to process.
  24633. var first = baseQueue.next;
  24634. var newState = current.baseState;
  24635. var newBaseState = null;
  24636. var newBaseQueueFirst = null;
  24637. var newBaseQueueLast = null;
  24638. var update = first;
  24639. do {
  24640. var updateExpirationTime = update.expirationTime;
  24641. if (updateExpirationTime < renderExpirationTime) {
  24642. // Priority is insufficient. Skip this update. If this is the first
  24643. // skipped update, the previous update/state is the new base
  24644. // update/state.
  24645. var clone = {
  24646. expirationTime: update.expirationTime,
  24647. suspenseConfig: update.suspenseConfig,
  24648. action: update.action,
  24649. eagerReducer: update.eagerReducer,
  24650. eagerState: update.eagerState,
  24651. next: null
  24652. };
  24653. if (newBaseQueueLast === null) {
  24654. newBaseQueueFirst = newBaseQueueLast = clone;
  24655. newBaseState = newState;
  24656. } else {
  24657. newBaseQueueLast = newBaseQueueLast.next = clone;
  24658. } // Update the remaining priority in the queue.
  24659. if (updateExpirationTime > currentlyRenderingFiber$1.expirationTime) {
  24660. currentlyRenderingFiber$1.expirationTime = updateExpirationTime;
  24661. markUnprocessedUpdateTime(updateExpirationTime);
  24662. }
  24663. } else {
  24664. // This update does have sufficient priority.
  24665. if (newBaseQueueLast !== null) {
  24666. var _clone = {
  24667. expirationTime: Sync,
  24668. // This update is going to be committed so we never want uncommit it.
  24669. suspenseConfig: update.suspenseConfig,
  24670. action: update.action,
  24671. eagerReducer: update.eagerReducer,
  24672. eagerState: update.eagerState,
  24673. next: null
  24674. };
  24675. newBaseQueueLast = newBaseQueueLast.next = _clone;
  24676. } // Mark the event time of this update as relevant to this render pass.
  24677. // TODO: This should ideally use the true event time of this update rather than
  24678. // its priority which is a derived and not reverseable value.
  24679. // TODO: We should skip this update if it was already committed but currently
  24680. // we have no way of detecting the difference between a committed and suspended
  24681. // update here.
  24682. markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process this update.
  24683. if (update.eagerReducer === reducer) {
  24684. // If this update was processed eagerly, and its reducer matches the
  24685. // current reducer, we can use the eagerly computed state.
  24686. newState = update.eagerState;
  24687. } else {
  24688. var action = update.action;
  24689. newState = reducer(newState, action);
  24690. }
  24691. }
  24692. update = update.next;
  24693. } while (update !== null && update !== first);
  24694. if (newBaseQueueLast === null) {
  24695. newBaseState = newState;
  24696. } else {
  24697. newBaseQueueLast.next = newBaseQueueFirst;
  24698. } // Mark that the fiber performed work, but only if the new state is
  24699. // different from the current state.
  24700. if (!objectIs(newState, hook.memoizedState)) {
  24701. markWorkInProgressReceivedUpdate();
  24702. }
  24703. hook.memoizedState = newState;
  24704. hook.baseState = newBaseState;
  24705. hook.baseQueue = newBaseQueueLast;
  24706. queue.lastRenderedState = newState;
  24707. }
  24708. var dispatch = queue.dispatch;
  24709. return [hook.memoizedState, dispatch];
  24710. }
  24711. function rerenderReducer(reducer, initialArg, init) {
  24712. var hook = updateWorkInProgressHook();
  24713. var queue = hook.queue;
  24714. if (!(queue !== null)) {
  24715. {
  24716. throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." );
  24717. }
  24718. }
  24719. queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous
  24720. // work-in-progress hook.
  24721. var dispatch = queue.dispatch;
  24722. var lastRenderPhaseUpdate = queue.pending;
  24723. var newState = hook.memoizedState;
  24724. if (lastRenderPhaseUpdate !== null) {
  24725. // The queue doesn't persist past this render pass.
  24726. queue.pending = null;
  24727. var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next;
  24728. var update = firstRenderPhaseUpdate;
  24729. do {
  24730. // Process this render phase update. We don't have to check the
  24731. // priority because it will always be the same as the current
  24732. // render's.
  24733. var action = update.action;
  24734. newState = reducer(newState, action);
  24735. update = update.next;
  24736. } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is
  24737. // different from the current state.
  24738. if (!objectIs(newState, hook.memoizedState)) {
  24739. markWorkInProgressReceivedUpdate();
  24740. }
  24741. hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to
  24742. // the base state unless the queue is empty.
  24743. // TODO: Not sure if this is the desired semantics, but it's what we
  24744. // do for gDSFP. I can't remember why.
  24745. if (hook.baseQueue === null) {
  24746. hook.baseState = newState;
  24747. }
  24748. queue.lastRenderedState = newState;
  24749. }
  24750. return [newState, dispatch];
  24751. }
  24752. function mountState(initialState) {
  24753. var hook = mountWorkInProgressHook();
  24754. if (typeof initialState === 'function') {
  24755. // $FlowFixMe: Flow doesn't like mixed types
  24756. initialState = initialState();
  24757. }
  24758. hook.memoizedState = hook.baseState = initialState;
  24759. var queue = hook.queue = {
  24760. pending: null,
  24761. dispatch: null,
  24762. lastRenderedReducer: basicStateReducer,
  24763. lastRenderedState: initialState
  24764. };
  24765. var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
  24766. return [hook.memoizedState, dispatch];
  24767. }
  24768. function updateState(initialState) {
  24769. return updateReducer(basicStateReducer);
  24770. }
  24771. function rerenderState(initialState) {
  24772. return rerenderReducer(basicStateReducer);
  24773. }
  24774. function pushEffect(tag, create, destroy, deps) {
  24775. var effect = {
  24776. tag: tag,
  24777. create: create,
  24778. destroy: destroy,
  24779. deps: deps,
  24780. // Circular
  24781. next: null
  24782. };
  24783. var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
  24784. if (componentUpdateQueue === null) {
  24785. componentUpdateQueue = createFunctionComponentUpdateQueue();
  24786. currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
  24787. componentUpdateQueue.lastEffect = effect.next = effect;
  24788. } else {
  24789. var lastEffect = componentUpdateQueue.lastEffect;
  24790. if (lastEffect === null) {
  24791. componentUpdateQueue.lastEffect = effect.next = effect;
  24792. } else {
  24793. var firstEffect = lastEffect.next;
  24794. lastEffect.next = effect;
  24795. effect.next = firstEffect;
  24796. componentUpdateQueue.lastEffect = effect;
  24797. }
  24798. }
  24799. return effect;
  24800. }
  24801. function mountRef(initialValue) {
  24802. var hook = mountWorkInProgressHook();
  24803. var ref = {
  24804. current: initialValue
  24805. };
  24806. {
  24807. Object.seal(ref);
  24808. }
  24809. hook.memoizedState = ref;
  24810. return ref;
  24811. }
  24812. function updateRef(initialValue) {
  24813. var hook = updateWorkInProgressHook();
  24814. return hook.memoizedState;
  24815. }
  24816. function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
  24817. var hook = mountWorkInProgressHook();
  24818. var nextDeps = deps === undefined ? null : deps;
  24819. currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
  24820. hook.memoizedState = pushEffect(HasEffect | hookEffectTag, create, undefined, nextDeps);
  24821. }
  24822. function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
  24823. var hook = updateWorkInProgressHook();
  24824. var nextDeps = deps === undefined ? null : deps;
  24825. var destroy = undefined;
  24826. if (currentHook !== null) {
  24827. var prevEffect = currentHook.memoizedState;
  24828. destroy = prevEffect.destroy;
  24829. if (nextDeps !== null) {
  24830. var prevDeps = prevEffect.deps;
  24831. if (areHookInputsEqual(nextDeps, prevDeps)) {
  24832. pushEffect(hookEffectTag, create, destroy, nextDeps);
  24833. return;
  24834. }
  24835. }
  24836. }
  24837. currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
  24838. hook.memoizedState = pushEffect(HasEffect | hookEffectTag, create, destroy, nextDeps);
  24839. }
  24840. function mountEffect(create, deps) {
  24841. {
  24842. // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
  24843. if ('undefined' !== typeof jest) {
  24844. warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
  24845. }
  24846. }
  24847. return mountEffectImpl(Update | Passive, Passive$1, create, deps);
  24848. }
  24849. function updateEffect(create, deps) {
  24850. {
  24851. // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
  24852. if ('undefined' !== typeof jest) {
  24853. warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
  24854. }
  24855. }
  24856. return updateEffectImpl(Update | Passive, Passive$1, create, deps);
  24857. }
  24858. function mountLayoutEffect(create, deps) {
  24859. return mountEffectImpl(Update, Layout, create, deps);
  24860. }
  24861. function updateLayoutEffect(create, deps) {
  24862. return updateEffectImpl(Update, Layout, create, deps);
  24863. }
  24864. function imperativeHandleEffect(create, ref) {
  24865. if (typeof ref === 'function') {
  24866. var refCallback = ref;
  24867. var _inst = create();
  24868. refCallback(_inst);
  24869. return function () {
  24870. refCallback(null);
  24871. };
  24872. } else if (ref !== null && ref !== undefined) {
  24873. var refObject = ref;
  24874. {
  24875. if (!refObject.hasOwnProperty('current')) {
  24876. error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}');
  24877. }
  24878. }
  24879. var _inst2 = create();
  24880. refObject.current = _inst2;
  24881. return function () {
  24882. refObject.current = null;
  24883. };
  24884. }
  24885. }
  24886. function mountImperativeHandle(ref, create, deps) {
  24887. {
  24888. if (typeof create !== 'function') {
  24889. error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null');
  24890. }
  24891. } // TODO: If deps are provided, should we skip comparing the ref itself?
  24892. var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
  24893. return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
  24894. }
  24895. function updateImperativeHandle(ref, create, deps) {
  24896. {
  24897. if (typeof create !== 'function') {
  24898. error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null');
  24899. }
  24900. } // TODO: If deps are provided, should we skip comparing the ref itself?
  24901. var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
  24902. return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
  24903. }
  24904. function mountDebugValue(value, formatterFn) {// This hook is normally a no-op.
  24905. // The react-debug-hooks package injects its own implementation
  24906. // so that e.g. DevTools can display custom hook values.
  24907. }
  24908. var updateDebugValue = mountDebugValue;
  24909. function mountCallback(callback, deps) {
  24910. var hook = mountWorkInProgressHook();
  24911. var nextDeps = deps === undefined ? null : deps;
  24912. hook.memoizedState = [callback, nextDeps];
  24913. return callback;
  24914. }
  24915. function updateCallback(callback, deps) {
  24916. var hook = updateWorkInProgressHook();
  24917. var nextDeps = deps === undefined ? null : deps;
  24918. var prevState = hook.memoizedState;
  24919. if (prevState !== null) {
  24920. if (nextDeps !== null) {
  24921. var prevDeps = prevState[1];
  24922. if (areHookInputsEqual(nextDeps, prevDeps)) {
  24923. return prevState[0];
  24924. }
  24925. }
  24926. }
  24927. hook.memoizedState = [callback, nextDeps];
  24928. return callback;
  24929. }
  24930. function mountMemo(nextCreate, deps) {
  24931. var hook = mountWorkInProgressHook();
  24932. var nextDeps = deps === undefined ? null : deps;
  24933. var nextValue = nextCreate();
  24934. hook.memoizedState = [nextValue, nextDeps];
  24935. return nextValue;
  24936. }
  24937. function updateMemo(nextCreate, deps) {
  24938. var hook = updateWorkInProgressHook();
  24939. var nextDeps = deps === undefined ? null : deps;
  24940. var prevState = hook.memoizedState;
  24941. if (prevState !== null) {
  24942. // Assume these are defined. If they're not, areHookInputsEqual will warn.
  24943. if (nextDeps !== null) {
  24944. var prevDeps = prevState[1];
  24945. if (areHookInputsEqual(nextDeps, prevDeps)) {
  24946. return prevState[0];
  24947. }
  24948. }
  24949. }
  24950. var nextValue = nextCreate();
  24951. hook.memoizedState = [nextValue, nextDeps];
  24952. return nextValue;
  24953. }
  24954. function mountDeferredValue(value, config) {
  24955. var _mountState = mountState(value),
  24956. prevValue = _mountState[0],
  24957. setValue = _mountState[1];
  24958. mountEffect(function () {
  24959. var previousConfig = ReactCurrentBatchConfig$1.suspense;
  24960. ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
  24961. try {
  24962. setValue(value);
  24963. } finally {
  24964. ReactCurrentBatchConfig$1.suspense = previousConfig;
  24965. }
  24966. }, [value, config]);
  24967. return prevValue;
  24968. }
  24969. function updateDeferredValue(value, config) {
  24970. var _updateState = updateState(),
  24971. prevValue = _updateState[0],
  24972. setValue = _updateState[1];
  24973. updateEffect(function () {
  24974. var previousConfig = ReactCurrentBatchConfig$1.suspense;
  24975. ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
  24976. try {
  24977. setValue(value);
  24978. } finally {
  24979. ReactCurrentBatchConfig$1.suspense = previousConfig;
  24980. }
  24981. }, [value, config]);
  24982. return prevValue;
  24983. }
  24984. function rerenderDeferredValue(value, config) {
  24985. var _rerenderState = rerenderState(),
  24986. prevValue = _rerenderState[0],
  24987. setValue = _rerenderState[1];
  24988. updateEffect(function () {
  24989. var previousConfig = ReactCurrentBatchConfig$1.suspense;
  24990. ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
  24991. try {
  24992. setValue(value);
  24993. } finally {
  24994. ReactCurrentBatchConfig$1.suspense = previousConfig;
  24995. }
  24996. }, [value, config]);
  24997. return prevValue;
  24998. }
  24999. function startTransition(setPending, config, callback) {
  25000. var priorityLevel = getCurrentPriorityLevel();
  25001. runWithPriority$1(priorityLevel < UserBlockingPriority$1 ? UserBlockingPriority$1 : priorityLevel, function () {
  25002. setPending(true);
  25003. });
  25004. runWithPriority$1(priorityLevel > NormalPriority ? NormalPriority : priorityLevel, function () {
  25005. var previousConfig = ReactCurrentBatchConfig$1.suspense;
  25006. ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
  25007. try {
  25008. setPending(false);
  25009. callback();
  25010. } finally {
  25011. ReactCurrentBatchConfig$1.suspense = previousConfig;
  25012. }
  25013. });
  25014. }
  25015. function mountTransition(config) {
  25016. var _mountState2 = mountState(false),
  25017. isPending = _mountState2[0],
  25018. setPending = _mountState2[1];
  25019. var start = mountCallback(startTransition.bind(null, setPending, config), [setPending, config]);
  25020. return [start, isPending];
  25021. }
  25022. function updateTransition(config) {
  25023. var _updateState2 = updateState(),
  25024. isPending = _updateState2[0],
  25025. setPending = _updateState2[1];
  25026. var start = updateCallback(startTransition.bind(null, setPending, config), [setPending, config]);
  25027. return [start, isPending];
  25028. }
  25029. function rerenderTransition(config) {
  25030. var _rerenderState2 = rerenderState(),
  25031. isPending = _rerenderState2[0],
  25032. setPending = _rerenderState2[1];
  25033. var start = updateCallback(startTransition.bind(null, setPending, config), [setPending, config]);
  25034. return [start, isPending];
  25035. }
  25036. function dispatchAction(fiber, queue, action) {
  25037. {
  25038. if (typeof arguments[3] === 'function') {
  25039. error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().');
  25040. }
  25041. }
  25042. var currentTime = requestCurrentTimeForUpdate();
  25043. var suspenseConfig = requestCurrentSuspenseConfig();
  25044. var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
  25045. var update = {
  25046. expirationTime: expirationTime,
  25047. suspenseConfig: suspenseConfig,
  25048. action: action,
  25049. eagerReducer: null,
  25050. eagerState: null,
  25051. next: null
  25052. };
  25053. {
  25054. update.priority = getCurrentPriorityLevel();
  25055. } // Append the update to the end of the list.
  25056. var pending = queue.pending;
  25057. if (pending === null) {
  25058. // This is the first update. Create a circular list.
  25059. update.next = update;
  25060. } else {
  25061. update.next = pending.next;
  25062. pending.next = update;
  25063. }
  25064. queue.pending = update;
  25065. var alternate = fiber.alternate;
  25066. if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
  25067. // This is a render phase update. Stash it in a lazily-created map of
  25068. // queue -> linked list of updates. After this render pass, we'll restart
  25069. // and apply the stashed updates on top of the work-in-progress hook.
  25070. didScheduleRenderPhaseUpdate = true;
  25071. update.expirationTime = renderExpirationTime;
  25072. currentlyRenderingFiber$1.expirationTime = renderExpirationTime;
  25073. } else {
  25074. if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
  25075. // The queue is currently empty, which means we can eagerly compute the
  25076. // next state before entering the render phase. If the new state is the
  25077. // same as the current state, we may be able to bail out entirely.
  25078. var lastRenderedReducer = queue.lastRenderedReducer;
  25079. if (lastRenderedReducer !== null) {
  25080. var prevDispatcher;
  25081. {
  25082. prevDispatcher = ReactCurrentDispatcher.current;
  25083. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25084. }
  25085. try {
  25086. var currentState = queue.lastRenderedState;
  25087. var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute
  25088. // it, on the update object. If the reducer hasn't changed by the
  25089. // time we enter the render phase, then the eager state can be used
  25090. // without calling the reducer again.
  25091. update.eagerReducer = lastRenderedReducer;
  25092. update.eagerState = eagerState;
  25093. if (objectIs(eagerState, currentState)) {
  25094. // Fast path. We can bail out without scheduling React to re-render.
  25095. // It's still possible that we'll need to rebase this update later,
  25096. // if the component re-renders for a different reason and by that
  25097. // time the reducer has changed.
  25098. return;
  25099. }
  25100. } catch (error) {// Suppress the error. It will throw again in the render phase.
  25101. } finally {
  25102. {
  25103. ReactCurrentDispatcher.current = prevDispatcher;
  25104. }
  25105. }
  25106. }
  25107. }
  25108. {
  25109. // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
  25110. if ('undefined' !== typeof jest) {
  25111. warnIfNotScopedWithMatchingAct(fiber);
  25112. warnIfNotCurrentlyActingUpdatesInDev(fiber);
  25113. }
  25114. }
  25115. scheduleWork(fiber, expirationTime);
  25116. }
  25117. }
  25118. var ContextOnlyDispatcher = {
  25119. readContext: readContext,
  25120. useCallback: throwInvalidHookError,
  25121. useContext: throwInvalidHookError,
  25122. useEffect: throwInvalidHookError,
  25123. useImperativeHandle: throwInvalidHookError,
  25124. useLayoutEffect: throwInvalidHookError,
  25125. useMemo: throwInvalidHookError,
  25126. useReducer: throwInvalidHookError,
  25127. useRef: throwInvalidHookError,
  25128. useState: throwInvalidHookError,
  25129. useDebugValue: throwInvalidHookError,
  25130. useResponder: throwInvalidHookError,
  25131. useDeferredValue: throwInvalidHookError,
  25132. useTransition: throwInvalidHookError
  25133. };
  25134. var HooksDispatcherOnMountInDEV = null;
  25135. var HooksDispatcherOnMountWithHookTypesInDEV = null;
  25136. var HooksDispatcherOnUpdateInDEV = null;
  25137. var HooksDispatcherOnRerenderInDEV = null;
  25138. var InvalidNestedHooksDispatcherOnMountInDEV = null;
  25139. var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
  25140. var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
  25141. {
  25142. var warnInvalidContextAccess = function () {
  25143. error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
  25144. };
  25145. var warnInvalidHookAccess = function () {
  25146. error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
  25147. };
  25148. HooksDispatcherOnMountInDEV = {
  25149. readContext: function (context, observedBits) {
  25150. return readContext(context, observedBits);
  25151. },
  25152. useCallback: function (callback, deps) {
  25153. currentHookNameInDev = 'useCallback';
  25154. mountHookTypesDev();
  25155. checkDepsAreArrayDev(deps);
  25156. return mountCallback(callback, deps);
  25157. },
  25158. useContext: function (context, observedBits) {
  25159. currentHookNameInDev = 'useContext';
  25160. mountHookTypesDev();
  25161. return readContext(context, observedBits);
  25162. },
  25163. useEffect: function (create, deps) {
  25164. currentHookNameInDev = 'useEffect';
  25165. mountHookTypesDev();
  25166. checkDepsAreArrayDev(deps);
  25167. return mountEffect(create, deps);
  25168. },
  25169. useImperativeHandle: function (ref, create, deps) {
  25170. currentHookNameInDev = 'useImperativeHandle';
  25171. mountHookTypesDev();
  25172. checkDepsAreArrayDev(deps);
  25173. return mountImperativeHandle(ref, create, deps);
  25174. },
  25175. useLayoutEffect: function (create, deps) {
  25176. currentHookNameInDev = 'useLayoutEffect';
  25177. mountHookTypesDev();
  25178. checkDepsAreArrayDev(deps);
  25179. return mountLayoutEffect(create, deps);
  25180. },
  25181. useMemo: function (create, deps) {
  25182. currentHookNameInDev = 'useMemo';
  25183. mountHookTypesDev();
  25184. checkDepsAreArrayDev(deps);
  25185. var prevDispatcher = ReactCurrentDispatcher.current;
  25186. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25187. try {
  25188. return mountMemo(create, deps);
  25189. } finally {
  25190. ReactCurrentDispatcher.current = prevDispatcher;
  25191. }
  25192. },
  25193. useReducer: function (reducer, initialArg, init) {
  25194. currentHookNameInDev = 'useReducer';
  25195. mountHookTypesDev();
  25196. var prevDispatcher = ReactCurrentDispatcher.current;
  25197. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25198. try {
  25199. return mountReducer(reducer, initialArg, init);
  25200. } finally {
  25201. ReactCurrentDispatcher.current = prevDispatcher;
  25202. }
  25203. },
  25204. useRef: function (initialValue) {
  25205. currentHookNameInDev = 'useRef';
  25206. mountHookTypesDev();
  25207. return mountRef(initialValue);
  25208. },
  25209. useState: function (initialState) {
  25210. currentHookNameInDev = 'useState';
  25211. mountHookTypesDev();
  25212. var prevDispatcher = ReactCurrentDispatcher.current;
  25213. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25214. try {
  25215. return mountState(initialState);
  25216. } finally {
  25217. ReactCurrentDispatcher.current = prevDispatcher;
  25218. }
  25219. },
  25220. useDebugValue: function (value, formatterFn) {
  25221. currentHookNameInDev = 'useDebugValue';
  25222. mountHookTypesDev();
  25223. return mountDebugValue();
  25224. },
  25225. useResponder: function (responder, props) {
  25226. currentHookNameInDev = 'useResponder';
  25227. mountHookTypesDev();
  25228. return createDeprecatedResponderListener(responder, props);
  25229. },
  25230. useDeferredValue: function (value, config) {
  25231. currentHookNameInDev = 'useDeferredValue';
  25232. mountHookTypesDev();
  25233. return mountDeferredValue(value, config);
  25234. },
  25235. useTransition: function (config) {
  25236. currentHookNameInDev = 'useTransition';
  25237. mountHookTypesDev();
  25238. return mountTransition(config);
  25239. }
  25240. };
  25241. HooksDispatcherOnMountWithHookTypesInDEV = {
  25242. readContext: function (context, observedBits) {
  25243. return readContext(context, observedBits);
  25244. },
  25245. useCallback: function (callback, deps) {
  25246. currentHookNameInDev = 'useCallback';
  25247. updateHookTypesDev();
  25248. return mountCallback(callback, deps);
  25249. },
  25250. useContext: function (context, observedBits) {
  25251. currentHookNameInDev = 'useContext';
  25252. updateHookTypesDev();
  25253. return readContext(context, observedBits);
  25254. },
  25255. useEffect: function (create, deps) {
  25256. currentHookNameInDev = 'useEffect';
  25257. updateHookTypesDev();
  25258. return mountEffect(create, deps);
  25259. },
  25260. useImperativeHandle: function (ref, create, deps) {
  25261. currentHookNameInDev = 'useImperativeHandle';
  25262. updateHookTypesDev();
  25263. return mountImperativeHandle(ref, create, deps);
  25264. },
  25265. useLayoutEffect: function (create, deps) {
  25266. currentHookNameInDev = 'useLayoutEffect';
  25267. updateHookTypesDev();
  25268. return mountLayoutEffect(create, deps);
  25269. },
  25270. useMemo: function (create, deps) {
  25271. currentHookNameInDev = 'useMemo';
  25272. updateHookTypesDev();
  25273. var prevDispatcher = ReactCurrentDispatcher.current;
  25274. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25275. try {
  25276. return mountMemo(create, deps);
  25277. } finally {
  25278. ReactCurrentDispatcher.current = prevDispatcher;
  25279. }
  25280. },
  25281. useReducer: function (reducer, initialArg, init) {
  25282. currentHookNameInDev = 'useReducer';
  25283. updateHookTypesDev();
  25284. var prevDispatcher = ReactCurrentDispatcher.current;
  25285. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25286. try {
  25287. return mountReducer(reducer, initialArg, init);
  25288. } finally {
  25289. ReactCurrentDispatcher.current = prevDispatcher;
  25290. }
  25291. },
  25292. useRef: function (initialValue) {
  25293. currentHookNameInDev = 'useRef';
  25294. updateHookTypesDev();
  25295. return mountRef(initialValue);
  25296. },
  25297. useState: function (initialState) {
  25298. currentHookNameInDev = 'useState';
  25299. updateHookTypesDev();
  25300. var prevDispatcher = ReactCurrentDispatcher.current;
  25301. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25302. try {
  25303. return mountState(initialState);
  25304. } finally {
  25305. ReactCurrentDispatcher.current = prevDispatcher;
  25306. }
  25307. },
  25308. useDebugValue: function (value, formatterFn) {
  25309. currentHookNameInDev = 'useDebugValue';
  25310. updateHookTypesDev();
  25311. return mountDebugValue();
  25312. },
  25313. useResponder: function (responder, props) {
  25314. currentHookNameInDev = 'useResponder';
  25315. updateHookTypesDev();
  25316. return createDeprecatedResponderListener(responder, props);
  25317. },
  25318. useDeferredValue: function (value, config) {
  25319. currentHookNameInDev = 'useDeferredValue';
  25320. updateHookTypesDev();
  25321. return mountDeferredValue(value, config);
  25322. },
  25323. useTransition: function (config) {
  25324. currentHookNameInDev = 'useTransition';
  25325. updateHookTypesDev();
  25326. return mountTransition(config);
  25327. }
  25328. };
  25329. HooksDispatcherOnUpdateInDEV = {
  25330. readContext: function (context, observedBits) {
  25331. return readContext(context, observedBits);
  25332. },
  25333. useCallback: function (callback, deps) {
  25334. currentHookNameInDev = 'useCallback';
  25335. updateHookTypesDev();
  25336. return updateCallback(callback, deps);
  25337. },
  25338. useContext: function (context, observedBits) {
  25339. currentHookNameInDev = 'useContext';
  25340. updateHookTypesDev();
  25341. return readContext(context, observedBits);
  25342. },
  25343. useEffect: function (create, deps) {
  25344. currentHookNameInDev = 'useEffect';
  25345. updateHookTypesDev();
  25346. return updateEffect(create, deps);
  25347. },
  25348. useImperativeHandle: function (ref, create, deps) {
  25349. currentHookNameInDev = 'useImperativeHandle';
  25350. updateHookTypesDev();
  25351. return updateImperativeHandle(ref, create, deps);
  25352. },
  25353. useLayoutEffect: function (create, deps) {
  25354. currentHookNameInDev = 'useLayoutEffect';
  25355. updateHookTypesDev();
  25356. return updateLayoutEffect(create, deps);
  25357. },
  25358. useMemo: function (create, deps) {
  25359. currentHookNameInDev = 'useMemo';
  25360. updateHookTypesDev();
  25361. var prevDispatcher = ReactCurrentDispatcher.current;
  25362. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25363. try {
  25364. return updateMemo(create, deps);
  25365. } finally {
  25366. ReactCurrentDispatcher.current = prevDispatcher;
  25367. }
  25368. },
  25369. useReducer: function (reducer, initialArg, init) {
  25370. currentHookNameInDev = 'useReducer';
  25371. updateHookTypesDev();
  25372. var prevDispatcher = ReactCurrentDispatcher.current;
  25373. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25374. try {
  25375. return updateReducer(reducer, initialArg, init);
  25376. } finally {
  25377. ReactCurrentDispatcher.current = prevDispatcher;
  25378. }
  25379. },
  25380. useRef: function (initialValue) {
  25381. currentHookNameInDev = 'useRef';
  25382. updateHookTypesDev();
  25383. return updateRef();
  25384. },
  25385. useState: function (initialState) {
  25386. currentHookNameInDev = 'useState';
  25387. updateHookTypesDev();
  25388. var prevDispatcher = ReactCurrentDispatcher.current;
  25389. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25390. try {
  25391. return updateState(initialState);
  25392. } finally {
  25393. ReactCurrentDispatcher.current = prevDispatcher;
  25394. }
  25395. },
  25396. useDebugValue: function (value, formatterFn) {
  25397. currentHookNameInDev = 'useDebugValue';
  25398. updateHookTypesDev();
  25399. return updateDebugValue();
  25400. },
  25401. useResponder: function (responder, props) {
  25402. currentHookNameInDev = 'useResponder';
  25403. updateHookTypesDev();
  25404. return createDeprecatedResponderListener(responder, props);
  25405. },
  25406. useDeferredValue: function (value, config) {
  25407. currentHookNameInDev = 'useDeferredValue';
  25408. updateHookTypesDev();
  25409. return updateDeferredValue(value, config);
  25410. },
  25411. useTransition: function (config) {
  25412. currentHookNameInDev = 'useTransition';
  25413. updateHookTypesDev();
  25414. return updateTransition(config);
  25415. }
  25416. };
  25417. HooksDispatcherOnRerenderInDEV = {
  25418. readContext: function (context, observedBits) {
  25419. return readContext(context, observedBits);
  25420. },
  25421. useCallback: function (callback, deps) {
  25422. currentHookNameInDev = 'useCallback';
  25423. updateHookTypesDev();
  25424. return updateCallback(callback, deps);
  25425. },
  25426. useContext: function (context, observedBits) {
  25427. currentHookNameInDev = 'useContext';
  25428. updateHookTypesDev();
  25429. return readContext(context, observedBits);
  25430. },
  25431. useEffect: function (create, deps) {
  25432. currentHookNameInDev = 'useEffect';
  25433. updateHookTypesDev();
  25434. return updateEffect(create, deps);
  25435. },
  25436. useImperativeHandle: function (ref, create, deps) {
  25437. currentHookNameInDev = 'useImperativeHandle';
  25438. updateHookTypesDev();
  25439. return updateImperativeHandle(ref, create, deps);
  25440. },
  25441. useLayoutEffect: function (create, deps) {
  25442. currentHookNameInDev = 'useLayoutEffect';
  25443. updateHookTypesDev();
  25444. return updateLayoutEffect(create, deps);
  25445. },
  25446. useMemo: function (create, deps) {
  25447. currentHookNameInDev = 'useMemo';
  25448. updateHookTypesDev();
  25449. var prevDispatcher = ReactCurrentDispatcher.current;
  25450. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
  25451. try {
  25452. return updateMemo(create, deps);
  25453. } finally {
  25454. ReactCurrentDispatcher.current = prevDispatcher;
  25455. }
  25456. },
  25457. useReducer: function (reducer, initialArg, init) {
  25458. currentHookNameInDev = 'useReducer';
  25459. updateHookTypesDev();
  25460. var prevDispatcher = ReactCurrentDispatcher.current;
  25461. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
  25462. try {
  25463. return rerenderReducer(reducer, initialArg, init);
  25464. } finally {
  25465. ReactCurrentDispatcher.current = prevDispatcher;
  25466. }
  25467. },
  25468. useRef: function (initialValue) {
  25469. currentHookNameInDev = 'useRef';
  25470. updateHookTypesDev();
  25471. return updateRef();
  25472. },
  25473. useState: function (initialState) {
  25474. currentHookNameInDev = 'useState';
  25475. updateHookTypesDev();
  25476. var prevDispatcher = ReactCurrentDispatcher.current;
  25477. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
  25478. try {
  25479. return rerenderState(initialState);
  25480. } finally {
  25481. ReactCurrentDispatcher.current = prevDispatcher;
  25482. }
  25483. },
  25484. useDebugValue: function (value, formatterFn) {
  25485. currentHookNameInDev = 'useDebugValue';
  25486. updateHookTypesDev();
  25487. return updateDebugValue();
  25488. },
  25489. useResponder: function (responder, props) {
  25490. currentHookNameInDev = 'useResponder';
  25491. updateHookTypesDev();
  25492. return createDeprecatedResponderListener(responder, props);
  25493. },
  25494. useDeferredValue: function (value, config) {
  25495. currentHookNameInDev = 'useDeferredValue';
  25496. updateHookTypesDev();
  25497. return rerenderDeferredValue(value, config);
  25498. },
  25499. useTransition: function (config) {
  25500. currentHookNameInDev = 'useTransition';
  25501. updateHookTypesDev();
  25502. return rerenderTransition(config);
  25503. }
  25504. };
  25505. InvalidNestedHooksDispatcherOnMountInDEV = {
  25506. readContext: function (context, observedBits) {
  25507. warnInvalidContextAccess();
  25508. return readContext(context, observedBits);
  25509. },
  25510. useCallback: function (callback, deps) {
  25511. currentHookNameInDev = 'useCallback';
  25512. warnInvalidHookAccess();
  25513. mountHookTypesDev();
  25514. return mountCallback(callback, deps);
  25515. },
  25516. useContext: function (context, observedBits) {
  25517. currentHookNameInDev = 'useContext';
  25518. warnInvalidHookAccess();
  25519. mountHookTypesDev();
  25520. return readContext(context, observedBits);
  25521. },
  25522. useEffect: function (create, deps) {
  25523. currentHookNameInDev = 'useEffect';
  25524. warnInvalidHookAccess();
  25525. mountHookTypesDev();
  25526. return mountEffect(create, deps);
  25527. },
  25528. useImperativeHandle: function (ref, create, deps) {
  25529. currentHookNameInDev = 'useImperativeHandle';
  25530. warnInvalidHookAccess();
  25531. mountHookTypesDev();
  25532. return mountImperativeHandle(ref, create, deps);
  25533. },
  25534. useLayoutEffect: function (create, deps) {
  25535. currentHookNameInDev = 'useLayoutEffect';
  25536. warnInvalidHookAccess();
  25537. mountHookTypesDev();
  25538. return mountLayoutEffect(create, deps);
  25539. },
  25540. useMemo: function (create, deps) {
  25541. currentHookNameInDev = 'useMemo';
  25542. warnInvalidHookAccess();
  25543. mountHookTypesDev();
  25544. var prevDispatcher = ReactCurrentDispatcher.current;
  25545. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25546. try {
  25547. return mountMemo(create, deps);
  25548. } finally {
  25549. ReactCurrentDispatcher.current = prevDispatcher;
  25550. }
  25551. },
  25552. useReducer: function (reducer, initialArg, init) {
  25553. currentHookNameInDev = 'useReducer';
  25554. warnInvalidHookAccess();
  25555. mountHookTypesDev();
  25556. var prevDispatcher = ReactCurrentDispatcher.current;
  25557. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25558. try {
  25559. return mountReducer(reducer, initialArg, init);
  25560. } finally {
  25561. ReactCurrentDispatcher.current = prevDispatcher;
  25562. }
  25563. },
  25564. useRef: function (initialValue) {
  25565. currentHookNameInDev = 'useRef';
  25566. warnInvalidHookAccess();
  25567. mountHookTypesDev();
  25568. return mountRef(initialValue);
  25569. },
  25570. useState: function (initialState) {
  25571. currentHookNameInDev = 'useState';
  25572. warnInvalidHookAccess();
  25573. mountHookTypesDev();
  25574. var prevDispatcher = ReactCurrentDispatcher.current;
  25575. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
  25576. try {
  25577. return mountState(initialState);
  25578. } finally {
  25579. ReactCurrentDispatcher.current = prevDispatcher;
  25580. }
  25581. },
  25582. useDebugValue: function (value, formatterFn) {
  25583. currentHookNameInDev = 'useDebugValue';
  25584. warnInvalidHookAccess();
  25585. mountHookTypesDev();
  25586. return mountDebugValue();
  25587. },
  25588. useResponder: function (responder, props) {
  25589. currentHookNameInDev = 'useResponder';
  25590. warnInvalidHookAccess();
  25591. mountHookTypesDev();
  25592. return createDeprecatedResponderListener(responder, props);
  25593. },
  25594. useDeferredValue: function (value, config) {
  25595. currentHookNameInDev = 'useDeferredValue';
  25596. warnInvalidHookAccess();
  25597. mountHookTypesDev();
  25598. return mountDeferredValue(value, config);
  25599. },
  25600. useTransition: function (config) {
  25601. currentHookNameInDev = 'useTransition';
  25602. warnInvalidHookAccess();
  25603. mountHookTypesDev();
  25604. return mountTransition(config);
  25605. }
  25606. };
  25607. InvalidNestedHooksDispatcherOnUpdateInDEV = {
  25608. readContext: function (context, observedBits) {
  25609. warnInvalidContextAccess();
  25610. return readContext(context, observedBits);
  25611. },
  25612. useCallback: function (callback, deps) {
  25613. currentHookNameInDev = 'useCallback';
  25614. warnInvalidHookAccess();
  25615. updateHookTypesDev();
  25616. return updateCallback(callback, deps);
  25617. },
  25618. useContext: function (context, observedBits) {
  25619. currentHookNameInDev = 'useContext';
  25620. warnInvalidHookAccess();
  25621. updateHookTypesDev();
  25622. return readContext(context, observedBits);
  25623. },
  25624. useEffect: function (create, deps) {
  25625. currentHookNameInDev = 'useEffect';
  25626. warnInvalidHookAccess();
  25627. updateHookTypesDev();
  25628. return updateEffect(create, deps);
  25629. },
  25630. useImperativeHandle: function (ref, create, deps) {
  25631. currentHookNameInDev = 'useImperativeHandle';
  25632. warnInvalidHookAccess();
  25633. updateHookTypesDev();
  25634. return updateImperativeHandle(ref, create, deps);
  25635. },
  25636. useLayoutEffect: function (create, deps) {
  25637. currentHookNameInDev = 'useLayoutEffect';
  25638. warnInvalidHookAccess();
  25639. updateHookTypesDev();
  25640. return updateLayoutEffect(create, deps);
  25641. },
  25642. useMemo: function (create, deps) {
  25643. currentHookNameInDev = 'useMemo';
  25644. warnInvalidHookAccess();
  25645. updateHookTypesDev();
  25646. var prevDispatcher = ReactCurrentDispatcher.current;
  25647. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25648. try {
  25649. return updateMemo(create, deps);
  25650. } finally {
  25651. ReactCurrentDispatcher.current = prevDispatcher;
  25652. }
  25653. },
  25654. useReducer: function (reducer, initialArg, init) {
  25655. currentHookNameInDev = 'useReducer';
  25656. warnInvalidHookAccess();
  25657. updateHookTypesDev();
  25658. var prevDispatcher = ReactCurrentDispatcher.current;
  25659. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25660. try {
  25661. return updateReducer(reducer, initialArg, init);
  25662. } finally {
  25663. ReactCurrentDispatcher.current = prevDispatcher;
  25664. }
  25665. },
  25666. useRef: function (initialValue) {
  25667. currentHookNameInDev = 'useRef';
  25668. warnInvalidHookAccess();
  25669. updateHookTypesDev();
  25670. return updateRef();
  25671. },
  25672. useState: function (initialState) {
  25673. currentHookNameInDev = 'useState';
  25674. warnInvalidHookAccess();
  25675. updateHookTypesDev();
  25676. var prevDispatcher = ReactCurrentDispatcher.current;
  25677. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25678. try {
  25679. return updateState(initialState);
  25680. } finally {
  25681. ReactCurrentDispatcher.current = prevDispatcher;
  25682. }
  25683. },
  25684. useDebugValue: function (value, formatterFn) {
  25685. currentHookNameInDev = 'useDebugValue';
  25686. warnInvalidHookAccess();
  25687. updateHookTypesDev();
  25688. return updateDebugValue();
  25689. },
  25690. useResponder: function (responder, props) {
  25691. currentHookNameInDev = 'useResponder';
  25692. warnInvalidHookAccess();
  25693. updateHookTypesDev();
  25694. return createDeprecatedResponderListener(responder, props);
  25695. },
  25696. useDeferredValue: function (value, config) {
  25697. currentHookNameInDev = 'useDeferredValue';
  25698. warnInvalidHookAccess();
  25699. updateHookTypesDev();
  25700. return updateDeferredValue(value, config);
  25701. },
  25702. useTransition: function (config) {
  25703. currentHookNameInDev = 'useTransition';
  25704. warnInvalidHookAccess();
  25705. updateHookTypesDev();
  25706. return updateTransition(config);
  25707. }
  25708. };
  25709. InvalidNestedHooksDispatcherOnRerenderInDEV = {
  25710. readContext: function (context, observedBits) {
  25711. warnInvalidContextAccess();
  25712. return readContext(context, observedBits);
  25713. },
  25714. useCallback: function (callback, deps) {
  25715. currentHookNameInDev = 'useCallback';
  25716. warnInvalidHookAccess();
  25717. updateHookTypesDev();
  25718. return updateCallback(callback, deps);
  25719. },
  25720. useContext: function (context, observedBits) {
  25721. currentHookNameInDev = 'useContext';
  25722. warnInvalidHookAccess();
  25723. updateHookTypesDev();
  25724. return readContext(context, observedBits);
  25725. },
  25726. useEffect: function (create, deps) {
  25727. currentHookNameInDev = 'useEffect';
  25728. warnInvalidHookAccess();
  25729. updateHookTypesDev();
  25730. return updateEffect(create, deps);
  25731. },
  25732. useImperativeHandle: function (ref, create, deps) {
  25733. currentHookNameInDev = 'useImperativeHandle';
  25734. warnInvalidHookAccess();
  25735. updateHookTypesDev();
  25736. return updateImperativeHandle(ref, create, deps);
  25737. },
  25738. useLayoutEffect: function (create, deps) {
  25739. currentHookNameInDev = 'useLayoutEffect';
  25740. warnInvalidHookAccess();
  25741. updateHookTypesDev();
  25742. return updateLayoutEffect(create, deps);
  25743. },
  25744. useMemo: function (create, deps) {
  25745. currentHookNameInDev = 'useMemo';
  25746. warnInvalidHookAccess();
  25747. updateHookTypesDev();
  25748. var prevDispatcher = ReactCurrentDispatcher.current;
  25749. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25750. try {
  25751. return updateMemo(create, deps);
  25752. } finally {
  25753. ReactCurrentDispatcher.current = prevDispatcher;
  25754. }
  25755. },
  25756. useReducer: function (reducer, initialArg, init) {
  25757. currentHookNameInDev = 'useReducer';
  25758. warnInvalidHookAccess();
  25759. updateHookTypesDev();
  25760. var prevDispatcher = ReactCurrentDispatcher.current;
  25761. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25762. try {
  25763. return rerenderReducer(reducer, initialArg, init);
  25764. } finally {
  25765. ReactCurrentDispatcher.current = prevDispatcher;
  25766. }
  25767. },
  25768. useRef: function (initialValue) {
  25769. currentHookNameInDev = 'useRef';
  25770. warnInvalidHookAccess();
  25771. updateHookTypesDev();
  25772. return updateRef();
  25773. },
  25774. useState: function (initialState) {
  25775. currentHookNameInDev = 'useState';
  25776. warnInvalidHookAccess();
  25777. updateHookTypesDev();
  25778. var prevDispatcher = ReactCurrentDispatcher.current;
  25779. ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
  25780. try {
  25781. return rerenderState(initialState);
  25782. } finally {
  25783. ReactCurrentDispatcher.current = prevDispatcher;
  25784. }
  25785. },
  25786. useDebugValue: function (value, formatterFn) {
  25787. currentHookNameInDev = 'useDebugValue';
  25788. warnInvalidHookAccess();
  25789. updateHookTypesDev();
  25790. return updateDebugValue();
  25791. },
  25792. useResponder: function (responder, props) {
  25793. currentHookNameInDev = 'useResponder';
  25794. warnInvalidHookAccess();
  25795. updateHookTypesDev();
  25796. return createDeprecatedResponderListener(responder, props);
  25797. },
  25798. useDeferredValue: function (value, config) {
  25799. currentHookNameInDev = 'useDeferredValue';
  25800. warnInvalidHookAccess();
  25801. updateHookTypesDev();
  25802. return rerenderDeferredValue(value, config);
  25803. },
  25804. useTransition: function (config) {
  25805. currentHookNameInDev = 'useTransition';
  25806. warnInvalidHookAccess();
  25807. updateHookTypesDev();
  25808. return rerenderTransition(config);
  25809. }
  25810. };
  25811. }
  25812. var now$1 = Scheduler.unstable_now;
  25813. var commitTime = 0;
  25814. var profilerStartTime = -1;
  25815. function getCommitTime() {
  25816. return commitTime;
  25817. }
  25818. function recordCommitTime() {
  25819. commitTime = now$1();
  25820. }
  25821. function startProfilerTimer(fiber) {
  25822. profilerStartTime = now$1();
  25823. if (fiber.actualStartTime < 0) {
  25824. fiber.actualStartTime = now$1();
  25825. }
  25826. }
  25827. function stopProfilerTimerIfRunning(fiber) {
  25828. profilerStartTime = -1;
  25829. }
  25830. function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
  25831. if (profilerStartTime >= 0) {
  25832. var elapsedTime = now$1() - profilerStartTime;
  25833. fiber.actualDuration += elapsedTime;
  25834. if (overrideBaseTime) {
  25835. fiber.selfBaseDuration = elapsedTime;
  25836. }
  25837. profilerStartTime = -1;
  25838. }
  25839. }
  25840. // This may have been an insertion or a hydration.
  25841. var hydrationParentFiber = null;
  25842. var nextHydratableInstance = null;
  25843. var isHydrating = false;
  25844. function enterHydrationState(fiber) {
  25845. var parentInstance = fiber.stateNode.containerInfo;
  25846. nextHydratableInstance = getFirstHydratableChild(parentInstance);
  25847. hydrationParentFiber = fiber;
  25848. isHydrating = true;
  25849. return true;
  25850. }
  25851. function deleteHydratableInstance(returnFiber, instance) {
  25852. {
  25853. switch (returnFiber.tag) {
  25854. case HostRoot:
  25855. didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
  25856. break;
  25857. case HostComponent:
  25858. didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
  25859. break;
  25860. }
  25861. }
  25862. var childToDelete = createFiberFromHostInstanceForDeletion();
  25863. childToDelete.stateNode = instance;
  25864. childToDelete.return = returnFiber;
  25865. childToDelete.effectTag = Deletion; // This might seem like it belongs on progressedFirstDeletion. However,
  25866. // these children are not part of the reconciliation list of children.
  25867. // Even if we abort and rereconcile the children, that will try to hydrate
  25868. // again and the nodes are still in the host tree so these will be
  25869. // recreated.
  25870. if (returnFiber.lastEffect !== null) {
  25871. returnFiber.lastEffect.nextEffect = childToDelete;
  25872. returnFiber.lastEffect = childToDelete;
  25873. } else {
  25874. returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
  25875. }
  25876. }
  25877. function insertNonHydratedInstance(returnFiber, fiber) {
  25878. fiber.effectTag = fiber.effectTag & ~Hydrating | Placement;
  25879. {
  25880. switch (returnFiber.tag) {
  25881. case HostRoot:
  25882. {
  25883. var parentContainer = returnFiber.stateNode.containerInfo;
  25884. switch (fiber.tag) {
  25885. case HostComponent:
  25886. var type = fiber.type;
  25887. var props = fiber.pendingProps;
  25888. didNotFindHydratableContainerInstance(parentContainer, type);
  25889. break;
  25890. case HostText:
  25891. var text = fiber.pendingProps;
  25892. didNotFindHydratableContainerTextInstance(parentContainer, text);
  25893. break;
  25894. }
  25895. break;
  25896. }
  25897. case HostComponent:
  25898. {
  25899. var parentType = returnFiber.type;
  25900. var parentProps = returnFiber.memoizedProps;
  25901. var parentInstance = returnFiber.stateNode;
  25902. switch (fiber.tag) {
  25903. case HostComponent:
  25904. var _type = fiber.type;
  25905. var _props = fiber.pendingProps;
  25906. didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type);
  25907. break;
  25908. case HostText:
  25909. var _text = fiber.pendingProps;
  25910. didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
  25911. break;
  25912. case SuspenseComponent:
  25913. didNotFindHydratableSuspenseInstance(parentType, parentProps);
  25914. break;
  25915. }
  25916. break;
  25917. }
  25918. default:
  25919. return;
  25920. }
  25921. }
  25922. }
  25923. function tryHydrate(fiber, nextInstance) {
  25924. switch (fiber.tag) {
  25925. case HostComponent:
  25926. {
  25927. var type = fiber.type;
  25928. var props = fiber.pendingProps;
  25929. var instance = canHydrateInstance(nextInstance, type);
  25930. if (instance !== null) {
  25931. fiber.stateNode = instance;
  25932. return true;
  25933. }
  25934. return false;
  25935. }
  25936. case HostText:
  25937. {
  25938. var text = fiber.pendingProps;
  25939. var textInstance = canHydrateTextInstance(nextInstance, text);
  25940. if (textInstance !== null) {
  25941. fiber.stateNode = textInstance;
  25942. return true;
  25943. }
  25944. return false;
  25945. }
  25946. case SuspenseComponent:
  25947. {
  25948. return false;
  25949. }
  25950. default:
  25951. return false;
  25952. }
  25953. }
  25954. function tryToClaimNextHydratableInstance(fiber) {
  25955. if (!isHydrating) {
  25956. return;
  25957. }
  25958. var nextInstance = nextHydratableInstance;
  25959. if (!nextInstance) {
  25960. // Nothing to hydrate. Make it an insertion.
  25961. insertNonHydratedInstance(hydrationParentFiber, fiber);
  25962. isHydrating = false;
  25963. hydrationParentFiber = fiber;
  25964. return;
  25965. }
  25966. var firstAttemptedInstance = nextInstance;
  25967. if (!tryHydrate(fiber, nextInstance)) {
  25968. // If we can't hydrate this instance let's try the next one.
  25969. // We use this as a heuristic. It's based on intuition and not data so it
  25970. // might be flawed or unnecessary.
  25971. nextInstance = getNextHydratableSibling(firstAttemptedInstance);
  25972. if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
  25973. // Nothing to hydrate. Make it an insertion.
  25974. insertNonHydratedInstance(hydrationParentFiber, fiber);
  25975. isHydrating = false;
  25976. hydrationParentFiber = fiber;
  25977. return;
  25978. } // We matched the next one, we'll now assume that the first one was
  25979. // superfluous and we'll delete it. Since we can't eagerly delete it
  25980. // we'll have to schedule a deletion. To do that, this node needs a dummy
  25981. // fiber associated with it.
  25982. deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
  25983. }
  25984. hydrationParentFiber = fiber;
  25985. nextHydratableInstance = getFirstHydratableChild(nextInstance);
  25986. }
  25987. function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
  25988. var instance = fiber.stateNode;
  25989. var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber); // TODO: Type this specific to this type of component.
  25990. fiber.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there
  25991. // is a new ref we mark this as an update.
  25992. if (updatePayload !== null) {
  25993. return true;
  25994. }
  25995. return false;
  25996. }
  25997. function prepareToHydrateHostTextInstance(fiber) {
  25998. var textInstance = fiber.stateNode;
  25999. var textContent = fiber.memoizedProps;
  26000. var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
  26001. {
  26002. if (shouldUpdate) {
  26003. // We assume that prepareToHydrateHostTextInstance is called in a context where the
  26004. // hydration parent is the parent host component of this host text.
  26005. var returnFiber = hydrationParentFiber;
  26006. if (returnFiber !== null) {
  26007. switch (returnFiber.tag) {
  26008. case HostRoot:
  26009. {
  26010. var parentContainer = returnFiber.stateNode.containerInfo;
  26011. didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
  26012. break;
  26013. }
  26014. case HostComponent:
  26015. {
  26016. var parentType = returnFiber.type;
  26017. var parentProps = returnFiber.memoizedProps;
  26018. var parentInstance = returnFiber.stateNode;
  26019. didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
  26020. break;
  26021. }
  26022. }
  26023. }
  26024. }
  26025. }
  26026. return shouldUpdate;
  26027. }
  26028. function skipPastDehydratedSuspenseInstance(fiber) {
  26029. var suspenseState = fiber.memoizedState;
  26030. var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
  26031. if (!suspenseInstance) {
  26032. {
  26033. throw Error( "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." );
  26034. }
  26035. }
  26036. return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
  26037. }
  26038. function popToNextHostParent(fiber) {
  26039. var parent = fiber.return;
  26040. while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
  26041. parent = parent.return;
  26042. }
  26043. hydrationParentFiber = parent;
  26044. }
  26045. function popHydrationState(fiber) {
  26046. if (fiber !== hydrationParentFiber) {
  26047. // We're deeper than the current hydration context, inside an inserted
  26048. // tree.
  26049. return false;
  26050. }
  26051. if (!isHydrating) {
  26052. // If we're not currently hydrating but we're in a hydration context, then
  26053. // we were an insertion and now need to pop up reenter hydration of our
  26054. // siblings.
  26055. popToNextHostParent(fiber);
  26056. isHydrating = true;
  26057. return false;
  26058. }
  26059. var type = fiber.type; // If we have any remaining hydratable nodes, we need to delete them now.
  26060. // We only do this deeper than head and body since they tend to have random
  26061. // other nodes in them. We also ignore components with pure text content in
  26062. // side of them.
  26063. // TODO: Better heuristic.
  26064. if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
  26065. var nextInstance = nextHydratableInstance;
  26066. while (nextInstance) {
  26067. deleteHydratableInstance(fiber, nextInstance);
  26068. nextInstance = getNextHydratableSibling(nextInstance);
  26069. }
  26070. }
  26071. popToNextHostParent(fiber);
  26072. if (fiber.tag === SuspenseComponent) {
  26073. nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
  26074. } else {
  26075. nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
  26076. }
  26077. return true;
  26078. }
  26079. function resetHydrationState() {
  26080. hydrationParentFiber = null;
  26081. nextHydratableInstance = null;
  26082. isHydrating = false;
  26083. }
  26084. var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
  26085. var didReceiveUpdate = false;
  26086. var didWarnAboutBadClass;
  26087. var didWarnAboutModulePatternComponent;
  26088. var didWarnAboutContextTypeOnFunctionComponent;
  26089. var didWarnAboutGetDerivedStateOnFunctionComponent;
  26090. var didWarnAboutFunctionRefs;
  26091. var didWarnAboutReassigningProps;
  26092. var didWarnAboutRevealOrder;
  26093. var didWarnAboutTailOptions;
  26094. {
  26095. didWarnAboutBadClass = {};
  26096. didWarnAboutModulePatternComponent = {};
  26097. didWarnAboutContextTypeOnFunctionComponent = {};
  26098. didWarnAboutGetDerivedStateOnFunctionComponent = {};
  26099. didWarnAboutFunctionRefs = {};
  26100. didWarnAboutReassigningProps = false;
  26101. didWarnAboutRevealOrder = {};
  26102. didWarnAboutTailOptions = {};
  26103. }
  26104. function reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime) {
  26105. if (current === null) {
  26106. // If this is a fresh new component that hasn't been rendered yet, we
  26107. // won't update its child set by applying minimal side-effects. Instead,
  26108. // we will add them all to the child before it gets rendered. That means
  26109. // we can optimize this reconciliation pass by not tracking side-effects.
  26110. workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
  26111. } else {
  26112. // If the current child is the same as the work in progress, it means that
  26113. // we haven't yet started any work on these children. Therefore, we use
  26114. // the clone algorithm to create a copy of all the current children.
  26115. // If we had any progressed work already, that is invalid at this point so
  26116. // let's throw it out.
  26117. workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
  26118. }
  26119. }
  26120. function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime) {
  26121. // This function is fork of reconcileChildren. It's used in cases where we
  26122. // want to reconcile without matching against the existing set. This has the
  26123. // effect of all current children being unmounted; even if the type and key
  26124. // are the same, the old child is unmounted and a new child is created.
  26125. //
  26126. // To do this, we're going to go through the reconcile algorithm twice. In
  26127. // the first pass, we schedule a deletion for all the current children by
  26128. // passing null.
  26129. workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderExpirationTime); // In the second pass, we mount the new children. The trick here is that we
  26130. // pass null in place of where we usually pass the current child set. This has
  26131. // the effect of remounting all children regardless of whether their
  26132. // identities match.
  26133. workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
  26134. }
  26135. function updateForwardRef(current, workInProgress, Component, nextProps, renderExpirationTime) {
  26136. // TODO: current can be non-null here even if the component
  26137. // hasn't yet mounted. This happens after the first render suspends.
  26138. // We'll need to figure out if this is fine or can cause issues.
  26139. {
  26140. if (workInProgress.type !== workInProgress.elementType) {
  26141. // Lazy component props can't be validated in createElement
  26142. // because they're only guaranteed to be resolved here.
  26143. var innerPropTypes = Component.propTypes;
  26144. if (innerPropTypes) {
  26145. checkPropTypes(innerPropTypes, nextProps, // Resolved props
  26146. 'prop', getComponentName(Component), getCurrentFiberStackInDev);
  26147. }
  26148. }
  26149. }
  26150. var render = Component.render;
  26151. var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent
  26152. var nextChildren;
  26153. prepareToReadContext(workInProgress, renderExpirationTime);
  26154. {
  26155. ReactCurrentOwner$1.current = workInProgress;
  26156. setIsRendering(true);
  26157. nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime);
  26158. if ( workInProgress.mode & StrictMode) {
  26159. // Only double-render components with Hooks
  26160. if (workInProgress.memoizedState !== null) {
  26161. nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime);
  26162. }
  26163. }
  26164. setIsRendering(false);
  26165. }
  26166. if (current !== null && !didReceiveUpdate) {
  26167. bailoutHooks(current, workInProgress, renderExpirationTime);
  26168. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  26169. } // React DevTools reads this flag.
  26170. workInProgress.effectTag |= PerformedWork;
  26171. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26172. return workInProgress.child;
  26173. }
  26174. function updateMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
  26175. if (current === null) {
  26176. var type = Component.type;
  26177. if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
  26178. Component.defaultProps === undefined) {
  26179. var resolvedType = type;
  26180. {
  26181. resolvedType = resolveFunctionForHotReloading(type);
  26182. } // If this is a plain function component without default props,
  26183. // and with only the default shallow comparison, we upgrade it
  26184. // to a SimpleMemoComponent to allow fast path updates.
  26185. workInProgress.tag = SimpleMemoComponent;
  26186. workInProgress.type = resolvedType;
  26187. {
  26188. validateFunctionComponentInDev(workInProgress, type);
  26189. }
  26190. return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
  26191. }
  26192. {
  26193. var innerPropTypes = type.propTypes;
  26194. if (innerPropTypes) {
  26195. // Inner memo component props aren't currently validated in createElement.
  26196. // We could move it there, but we'd still need this for lazy code path.
  26197. checkPropTypes(innerPropTypes, nextProps, // Resolved props
  26198. 'prop', getComponentName(type), getCurrentFiberStackInDev);
  26199. }
  26200. }
  26201. var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
  26202. child.ref = workInProgress.ref;
  26203. child.return = workInProgress;
  26204. workInProgress.child = child;
  26205. return child;
  26206. }
  26207. {
  26208. var _type = Component.type;
  26209. var _innerPropTypes = _type.propTypes;
  26210. if (_innerPropTypes) {
  26211. // Inner memo component props aren't currently validated in createElement.
  26212. // We could move it there, but we'd still need this for lazy code path.
  26213. checkPropTypes(_innerPropTypes, nextProps, // Resolved props
  26214. 'prop', getComponentName(_type), getCurrentFiberStackInDev);
  26215. }
  26216. }
  26217. var currentChild = current.child; // This is always exactly one child
  26218. if (updateExpirationTime < renderExpirationTime) {
  26219. // This will be the props with resolved defaultProps,
  26220. // unlike current.memoizedProps which will be the unresolved ones.
  26221. var prevProps = currentChild.memoizedProps; // Default to shallow comparison
  26222. var compare = Component.compare;
  26223. compare = compare !== null ? compare : shallowEqual;
  26224. if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) {
  26225. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  26226. }
  26227. } // React DevTools reads this flag.
  26228. workInProgress.effectTag |= PerformedWork;
  26229. var newChild = createWorkInProgress(currentChild, nextProps);
  26230. newChild.ref = workInProgress.ref;
  26231. newChild.return = workInProgress;
  26232. workInProgress.child = newChild;
  26233. return newChild;
  26234. }
  26235. function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
  26236. // TODO: current can be non-null here even if the component
  26237. // hasn't yet mounted. This happens when the inner render suspends.
  26238. // We'll need to figure out if this is fine or can cause issues.
  26239. {
  26240. if (workInProgress.type !== workInProgress.elementType) {
  26241. // Lazy component props can't be validated in createElement
  26242. // because they're only guaranteed to be resolved here.
  26243. var outerMemoType = workInProgress.elementType;
  26244. if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
  26245. // We warn when you define propTypes on lazy()
  26246. // so let's just skip over it to find memo() outer wrapper.
  26247. // Inner props for memo are validated later.
  26248. outerMemoType = refineResolvedLazyComponent(outerMemoType);
  26249. }
  26250. var outerPropTypes = outerMemoType && outerMemoType.propTypes;
  26251. if (outerPropTypes) {
  26252. checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
  26253. 'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
  26254. } // Inner propTypes will be validated in the function component path.
  26255. }
  26256. }
  26257. if (current !== null) {
  26258. var prevProps = current.memoizedProps;
  26259. if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload.
  26260. workInProgress.type === current.type )) {
  26261. didReceiveUpdate = false;
  26262. if (updateExpirationTime < renderExpirationTime) {
  26263. // The pending update priority was cleared at the beginning of
  26264. // beginWork. We're about to bail out, but there might be additional
  26265. // updates at a lower priority. Usually, the priority level of the
  26266. // remaining updates is accumlated during the evaluation of the
  26267. // component (i.e. when processing the update queue). But since since
  26268. // we're bailing out early *without* evaluating the component, we need
  26269. // to account for it here, too. Reset to the value of the current fiber.
  26270. // NOTE: This only applies to SimpleMemoComponent, not MemoComponent,
  26271. // because a MemoComponent fiber does not have hooks or an update queue;
  26272. // rather, it wraps around an inner component, which may or may not
  26273. // contains hooks.
  26274. // TODO: Move the reset at in beginWork out of the common path so that
  26275. // this is no longer necessary.
  26276. workInProgress.expirationTime = current.expirationTime;
  26277. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  26278. }
  26279. }
  26280. }
  26281. return updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime);
  26282. }
  26283. function updateFragment(current, workInProgress, renderExpirationTime) {
  26284. var nextChildren = workInProgress.pendingProps;
  26285. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26286. return workInProgress.child;
  26287. }
  26288. function updateMode(current, workInProgress, renderExpirationTime) {
  26289. var nextChildren = workInProgress.pendingProps.children;
  26290. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26291. return workInProgress.child;
  26292. }
  26293. function updateProfiler(current, workInProgress, renderExpirationTime) {
  26294. {
  26295. workInProgress.effectTag |= Update;
  26296. }
  26297. var nextProps = workInProgress.pendingProps;
  26298. var nextChildren = nextProps.children;
  26299. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26300. return workInProgress.child;
  26301. }
  26302. function markRef(current, workInProgress) {
  26303. var ref = workInProgress.ref;
  26304. if (current === null && ref !== null || current !== null && current.ref !== ref) {
  26305. // Schedule a Ref effect
  26306. workInProgress.effectTag |= Ref;
  26307. }
  26308. }
  26309. function updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
  26310. {
  26311. if (workInProgress.type !== workInProgress.elementType) {
  26312. // Lazy component props can't be validated in createElement
  26313. // because they're only guaranteed to be resolved here.
  26314. var innerPropTypes = Component.propTypes;
  26315. if (innerPropTypes) {
  26316. checkPropTypes(innerPropTypes, nextProps, // Resolved props
  26317. 'prop', getComponentName(Component), getCurrentFiberStackInDev);
  26318. }
  26319. }
  26320. }
  26321. var context;
  26322. {
  26323. var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
  26324. context = getMaskedContext(workInProgress, unmaskedContext);
  26325. }
  26326. var nextChildren;
  26327. prepareToReadContext(workInProgress, renderExpirationTime);
  26328. {
  26329. ReactCurrentOwner$1.current = workInProgress;
  26330. setIsRendering(true);
  26331. nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime);
  26332. if ( workInProgress.mode & StrictMode) {
  26333. // Only double-render components with Hooks
  26334. if (workInProgress.memoizedState !== null) {
  26335. nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime);
  26336. }
  26337. }
  26338. setIsRendering(false);
  26339. }
  26340. if (current !== null && !didReceiveUpdate) {
  26341. bailoutHooks(current, workInProgress, renderExpirationTime);
  26342. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  26343. } // React DevTools reads this flag.
  26344. workInProgress.effectTag |= PerformedWork;
  26345. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26346. return workInProgress.child;
  26347. }
  26348. function updateClassComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
  26349. {
  26350. if (workInProgress.type !== workInProgress.elementType) {
  26351. // Lazy component props can't be validated in createElement
  26352. // because they're only guaranteed to be resolved here.
  26353. var innerPropTypes = Component.propTypes;
  26354. if (innerPropTypes) {
  26355. checkPropTypes(innerPropTypes, nextProps, // Resolved props
  26356. 'prop', getComponentName(Component), getCurrentFiberStackInDev);
  26357. }
  26358. }
  26359. } // Push context providers early to prevent context stack mismatches.
  26360. // During mounting we don't know the child context yet as the instance doesn't exist.
  26361. // We will invalidate the child context in finishClassComponent() right after rendering.
  26362. var hasContext;
  26363. if (isContextProvider(Component)) {
  26364. hasContext = true;
  26365. pushContextProvider(workInProgress);
  26366. } else {
  26367. hasContext = false;
  26368. }
  26369. prepareToReadContext(workInProgress, renderExpirationTime);
  26370. var instance = workInProgress.stateNode;
  26371. var shouldUpdate;
  26372. if (instance === null) {
  26373. if (current !== null) {
  26374. // A class component without an instance only mounts if it suspended
  26375. // inside a non-concurrent tree, in an inconsistent state. We want to
  26376. // treat it like a new mount, even though an empty version of it already
  26377. // committed. Disconnect the alternate pointers.
  26378. current.alternate = null;
  26379. workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
  26380. workInProgress.effectTag |= Placement;
  26381. } // In the initial pass we might need to construct the instance.
  26382. constructClassInstance(workInProgress, Component, nextProps);
  26383. mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
  26384. shouldUpdate = true;
  26385. } else if (current === null) {
  26386. // In a resume, we'll already have an instance we can reuse.
  26387. shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
  26388. } else {
  26389. shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderExpirationTime);
  26390. }
  26391. var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
  26392. {
  26393. var inst = workInProgress.stateNode;
  26394. if (inst.props !== nextProps) {
  26395. if (!didWarnAboutReassigningProps) {
  26396. error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component');
  26397. }
  26398. didWarnAboutReassigningProps = true;
  26399. }
  26400. }
  26401. return nextUnitOfWork;
  26402. }
  26403. function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
  26404. // Refs should update even if shouldComponentUpdate returns false
  26405. markRef(current, workInProgress);
  26406. var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
  26407. if (!shouldUpdate && !didCaptureError) {
  26408. // Context providers should defer to sCU for rendering
  26409. if (hasContext) {
  26410. invalidateContextProvider(workInProgress, Component, false);
  26411. }
  26412. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  26413. }
  26414. var instance = workInProgress.stateNode; // Rerender
  26415. ReactCurrentOwner$1.current = workInProgress;
  26416. var nextChildren;
  26417. if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
  26418. // If we captured an error, but getDerivedStateFromError is not defined,
  26419. // unmount all the children. componentDidCatch will schedule an update to
  26420. // re-render a fallback. This is temporary until we migrate everyone to
  26421. // the new API.
  26422. // TODO: Warn in a future release.
  26423. nextChildren = null;
  26424. {
  26425. stopProfilerTimerIfRunning();
  26426. }
  26427. } else {
  26428. {
  26429. setIsRendering(true);
  26430. nextChildren = instance.render();
  26431. if ( workInProgress.mode & StrictMode) {
  26432. instance.render();
  26433. }
  26434. setIsRendering(false);
  26435. }
  26436. } // React DevTools reads this flag.
  26437. workInProgress.effectTag |= PerformedWork;
  26438. if (current !== null && didCaptureError) {
  26439. // If we're recovering from an error, reconcile without reusing any of
  26440. // the existing children. Conceptually, the normal children and the children
  26441. // that are shown on error are two different sets, so we shouldn't reuse
  26442. // normal children even if their identities match.
  26443. forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime);
  26444. } else {
  26445. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26446. } // Memoize state using the values we just used to render.
  26447. // TODO: Restructure so we never read values from the instance.
  26448. workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it.
  26449. if (hasContext) {
  26450. invalidateContextProvider(workInProgress, Component, true);
  26451. }
  26452. return workInProgress.child;
  26453. }
  26454. function pushHostRootContext(workInProgress) {
  26455. var root = workInProgress.stateNode;
  26456. if (root.pendingContext) {
  26457. pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
  26458. } else if (root.context) {
  26459. // Should always be set
  26460. pushTopLevelContextObject(workInProgress, root.context, false);
  26461. }
  26462. pushHostContainer(workInProgress, root.containerInfo);
  26463. }
  26464. function updateHostRoot(current, workInProgress, renderExpirationTime) {
  26465. pushHostRootContext(workInProgress);
  26466. var updateQueue = workInProgress.updateQueue;
  26467. if (!(current !== null && updateQueue !== null)) {
  26468. {
  26469. throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." );
  26470. }
  26471. }
  26472. var nextProps = workInProgress.pendingProps;
  26473. var prevState = workInProgress.memoizedState;
  26474. var prevChildren = prevState !== null ? prevState.element : null;
  26475. cloneUpdateQueue(current, workInProgress);
  26476. processUpdateQueue(workInProgress, nextProps, null, renderExpirationTime);
  26477. var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property
  26478. // being called "element".
  26479. var nextChildren = nextState.element;
  26480. if (nextChildren === prevChildren) {
  26481. // If the state is the same as before, that's a bailout because we had
  26482. // no work that expires at this time.
  26483. resetHydrationState();
  26484. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  26485. }
  26486. var root = workInProgress.stateNode;
  26487. if (root.hydrate && enterHydrationState(workInProgress)) {
  26488. // If we don't have any current children this might be the first pass.
  26489. // We always try to hydrate. If this isn't a hydration pass there won't
  26490. // be any children to hydrate which is effectively the same thing as
  26491. // not hydrating.
  26492. var child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
  26493. workInProgress.child = child;
  26494. var node = child;
  26495. while (node) {
  26496. // Mark each child as hydrating. This is a fast path to know whether this
  26497. // tree is part of a hydrating tree. This is used to determine if a child
  26498. // node has fully mounted yet, and for scheduling event replaying.
  26499. // Conceptually this is similar to Placement in that a new subtree is
  26500. // inserted into the React tree here. It just happens to not need DOM
  26501. // mutations because it already exists.
  26502. node.effectTag = node.effectTag & ~Placement | Hydrating;
  26503. node = node.sibling;
  26504. }
  26505. } else {
  26506. // Otherwise reset hydration state in case we aborted and resumed another
  26507. // root.
  26508. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26509. resetHydrationState();
  26510. }
  26511. return workInProgress.child;
  26512. }
  26513. function updateHostComponent(current, workInProgress, renderExpirationTime) {
  26514. pushHostContext(workInProgress);
  26515. if (current === null) {
  26516. tryToClaimNextHydratableInstance(workInProgress);
  26517. }
  26518. var type = workInProgress.type;
  26519. var nextProps = workInProgress.pendingProps;
  26520. var prevProps = current !== null ? current.memoizedProps : null;
  26521. var nextChildren = nextProps.children;
  26522. var isDirectTextChild = shouldSetTextContent(type, nextProps);
  26523. if (isDirectTextChild) {
  26524. // We special case a direct text child of a host node. This is a common
  26525. // case. We won't handle it as a reified child. We will instead handle
  26526. // this in the host environment that also has access to this prop. That
  26527. // avoids allocating another HostText fiber and traversing it.
  26528. nextChildren = null;
  26529. } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
  26530. // If we're switching from a direct text child to a normal child, or to
  26531. // empty, we need to schedule the text content to be reset.
  26532. workInProgress.effectTag |= ContentReset;
  26533. }
  26534. markRef(current, workInProgress); // Check the host config to see if the children are offscreen/hidden.
  26535. if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
  26536. {
  26537. markSpawnedWork(Never);
  26538. } // Schedule this fiber to re-render at offscreen priority. Then bailout.
  26539. workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
  26540. return null;
  26541. }
  26542. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  26543. return workInProgress.child;
  26544. }
  26545. function updateHostText(current, workInProgress) {
  26546. if (current === null) {
  26547. tryToClaimNextHydratableInstance(workInProgress);
  26548. } // Nothing to do here. This is terminal. We'll do the completion step
  26549. // immediately after.
  26550. return null;
  26551. }
  26552. function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
  26553. if (_current !== null) {
  26554. // A lazy component only mounts if it suspended inside a non-
  26555. // concurrent tree, in an inconsistent state. We want to treat it like
  26556. // a new mount, even though an empty version of it already committed.
  26557. // Disconnect the alternate pointers.
  26558. _current.alternate = null;
  26559. workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
  26560. workInProgress.effectTag |= Placement;
  26561. }
  26562. var props = workInProgress.pendingProps; // We can't start a User Timing measurement with correct label yet.
  26563. // Cancel and resume right after we know the tag.
  26564. cancelWorkTimer(workInProgress);
  26565. var Component = readLazyComponentType(elementType); // Store the unwrapped component in the type.
  26566. workInProgress.type = Component;
  26567. var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
  26568. startWorkTimer(workInProgress);
  26569. var resolvedProps = resolveDefaultProps(Component, props);
  26570. var child;
  26571. switch (resolvedTag) {
  26572. case FunctionComponent:
  26573. {
  26574. {
  26575. validateFunctionComponentInDev(workInProgress, Component);
  26576. workInProgress.type = Component = resolveFunctionForHotReloading(Component);
  26577. }
  26578. child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
  26579. return child;
  26580. }
  26581. case ClassComponent:
  26582. {
  26583. {
  26584. workInProgress.type = Component = resolveClassForHotReloading(Component);
  26585. }
  26586. child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
  26587. return child;
  26588. }
  26589. case ForwardRef:
  26590. {
  26591. {
  26592. workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
  26593. }
  26594. child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
  26595. return child;
  26596. }
  26597. case MemoComponent:
  26598. {
  26599. {
  26600. if (workInProgress.type !== workInProgress.elementType) {
  26601. var outerPropTypes = Component.propTypes;
  26602. if (outerPropTypes) {
  26603. checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only
  26604. 'prop', getComponentName(Component), getCurrentFiberStackInDev);
  26605. }
  26606. }
  26607. }
  26608. child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
  26609. updateExpirationTime, renderExpirationTime);
  26610. return child;
  26611. }
  26612. }
  26613. var hint = '';
  26614. {
  26615. if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
  26616. hint = ' Did you wrap a component in React.lazy() more than once?';
  26617. }
  26618. } // This message intentionally doesn't mention ForwardRef or MemoComponent
  26619. // because the fact that it's a separate type of work is an
  26620. // implementation detail.
  26621. {
  26622. {
  26623. throw Error( "Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint );
  26624. }
  26625. }
  26626. }
  26627. function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
  26628. if (_current !== null) {
  26629. // An incomplete component only mounts if it suspended inside a non-
  26630. // concurrent tree, in an inconsistent state. We want to treat it like
  26631. // a new mount, even though an empty version of it already committed.
  26632. // Disconnect the alternate pointers.
  26633. _current.alternate = null;
  26634. workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
  26635. workInProgress.effectTag |= Placement;
  26636. } // Promote the fiber to a class and try rendering again.
  26637. workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent`
  26638. // Push context providers early to prevent context stack mismatches.
  26639. // During mounting we don't know the child context yet as the instance doesn't exist.
  26640. // We will invalidate the child context in finishClassComponent() right after rendering.
  26641. var hasContext;
  26642. if (isContextProvider(Component)) {
  26643. hasContext = true;
  26644. pushContextProvider(workInProgress);
  26645. } else {
  26646. hasContext = false;
  26647. }
  26648. prepareToReadContext(workInProgress, renderExpirationTime);
  26649. constructClassInstance(workInProgress, Component, nextProps);
  26650. mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
  26651. return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
  26652. }
  26653. function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
  26654. if (_current !== null) {
  26655. // An indeterminate component only mounts if it suspended inside a non-
  26656. // concurrent tree, in an inconsistent state. We want to treat it like
  26657. // a new mount, even though an empty version of it already committed.
  26658. // Disconnect the alternate pointers.
  26659. _current.alternate = null;
  26660. workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
  26661. workInProgress.effectTag |= Placement;
  26662. }
  26663. var props = workInProgress.pendingProps;
  26664. var context;
  26665. {
  26666. var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
  26667. context = getMaskedContext(workInProgress, unmaskedContext);
  26668. }
  26669. prepareToReadContext(workInProgress, renderExpirationTime);
  26670. var value;
  26671. {
  26672. if (Component.prototype && typeof Component.prototype.render === 'function') {
  26673. var componentName = getComponentName(Component) || 'Unknown';
  26674. if (!didWarnAboutBadClass[componentName]) {
  26675. error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
  26676. didWarnAboutBadClass[componentName] = true;
  26677. }
  26678. }
  26679. if (workInProgress.mode & StrictMode) {
  26680. ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
  26681. }
  26682. setIsRendering(true);
  26683. ReactCurrentOwner$1.current = workInProgress;
  26684. value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
  26685. setIsRendering(false);
  26686. } // React DevTools reads this flag.
  26687. workInProgress.effectTag |= PerformedWork;
  26688. if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
  26689. {
  26690. var _componentName = getComponentName(Component) || 'Unknown';
  26691. if (!didWarnAboutModulePatternComponent[_componentName]) {
  26692. error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
  26693. didWarnAboutModulePatternComponent[_componentName] = true;
  26694. }
  26695. } // Proceed under the assumption that this is a class instance
  26696. workInProgress.tag = ClassComponent; // Throw out any hooks that were used.
  26697. workInProgress.memoizedState = null;
  26698. workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches.
  26699. // During mounting we don't know the child context yet as the instance doesn't exist.
  26700. // We will invalidate the child context in finishClassComponent() right after rendering.
  26701. var hasContext = false;
  26702. if (isContextProvider(Component)) {
  26703. hasContext = true;
  26704. pushContextProvider(workInProgress);
  26705. } else {
  26706. hasContext = false;
  26707. }
  26708. workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
  26709. initializeUpdateQueue(workInProgress);
  26710. var getDerivedStateFromProps = Component.getDerivedStateFromProps;
  26711. if (typeof getDerivedStateFromProps === 'function') {
  26712. applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
  26713. }
  26714. adoptClassInstance(workInProgress, value);
  26715. mountClassInstance(workInProgress, Component, props, renderExpirationTime);
  26716. return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
  26717. } else {
  26718. // Proceed under the assumption that this is a function component
  26719. workInProgress.tag = FunctionComponent;
  26720. {
  26721. if ( workInProgress.mode & StrictMode) {
  26722. // Only double-render components with Hooks
  26723. if (workInProgress.memoizedState !== null) {
  26724. value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
  26725. }
  26726. }
  26727. }
  26728. reconcileChildren(null, workInProgress, value, renderExpirationTime);
  26729. {
  26730. validateFunctionComponentInDev(workInProgress, Component);
  26731. }
  26732. return workInProgress.child;
  26733. }
  26734. }
  26735. function validateFunctionComponentInDev(workInProgress, Component) {
  26736. {
  26737. if (Component) {
  26738. if (Component.childContextTypes) {
  26739. error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component');
  26740. }
  26741. }
  26742. if (workInProgress.ref !== null) {
  26743. var info = '';
  26744. var ownerName = getCurrentFiberOwnerNameInDevOrNull();
  26745. if (ownerName) {
  26746. info += '\n\nCheck the render method of `' + ownerName + '`.';
  26747. }
  26748. var warningKey = ownerName || workInProgress._debugID || '';
  26749. var debugSource = workInProgress._debugSource;
  26750. if (debugSource) {
  26751. warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
  26752. }
  26753. if (!didWarnAboutFunctionRefs[warningKey]) {
  26754. didWarnAboutFunctionRefs[warningKey] = true;
  26755. error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
  26756. }
  26757. }
  26758. if (typeof Component.getDerivedStateFromProps === 'function') {
  26759. var _componentName2 = getComponentName(Component) || 'Unknown';
  26760. if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) {
  26761. error('%s: Function components do not support getDerivedStateFromProps.', _componentName2);
  26762. didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true;
  26763. }
  26764. }
  26765. if (typeof Component.contextType === 'object' && Component.contextType !== null) {
  26766. var _componentName3 = getComponentName(Component) || 'Unknown';
  26767. if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) {
  26768. error('%s: Function components do not support contextType.', _componentName3);
  26769. didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true;
  26770. }
  26771. }
  26772. }
  26773. }
  26774. var SUSPENDED_MARKER = {
  26775. dehydrated: null,
  26776. retryTime: NoWork
  26777. };
  26778. function shouldRemainOnFallback(suspenseContext, current, workInProgress) {
  26779. // If the context is telling us that we should show a fallback, and we're not
  26780. // already showing content, then we should show the fallback instead.
  26781. return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current === null || current.memoizedState !== null);
  26782. }
  26783. function updateSuspenseComponent(current, workInProgress, renderExpirationTime) {
  26784. var mode = workInProgress.mode;
  26785. var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend.
  26786. {
  26787. if (shouldSuspend(workInProgress)) {
  26788. workInProgress.effectTag |= DidCapture;
  26789. }
  26790. }
  26791. var suspenseContext = suspenseStackCursor.current;
  26792. var nextDidTimeout = false;
  26793. var didSuspend = (workInProgress.effectTag & DidCapture) !== NoEffect;
  26794. if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) {
  26795. // Something in this boundary's subtree already suspended. Switch to
  26796. // rendering the fallback children.
  26797. nextDidTimeout = true;
  26798. workInProgress.effectTag &= ~DidCapture;
  26799. } else {
  26800. // Attempting the main content
  26801. if (current === null || current.memoizedState !== null) {
  26802. // This is a new mount or this boundary is already showing a fallback state.
  26803. // Mark this subtree context as having at least one invisible parent that could
  26804. // handle the fallback state.
  26805. // Boundaries without fallbacks or should be avoided are not considered since
  26806. // they cannot handle preferred fallback states.
  26807. if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
  26808. suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
  26809. }
  26810. }
  26811. }
  26812. suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
  26813. pushSuspenseContext(workInProgress, suspenseContext); // This next part is a bit confusing. If the children timeout, we switch to
  26814. // showing the fallback children in place of the "primary" children.
  26815. // However, we don't want to delete the primary children because then their
  26816. // state will be lost (both the React state and the host state, e.g.
  26817. // uncontrolled form inputs). Instead we keep them mounted and hide them.
  26818. // Both the fallback children AND the primary children are rendered at the
  26819. // same time. Once the primary children are un-suspended, we can delete
  26820. // the fallback children — don't need to preserve their state.
  26821. //
  26822. // The two sets of children are siblings in the host environment, but
  26823. // semantically, for purposes of reconciliation, they are two separate sets.
  26824. // So we store them using two fragment fibers.
  26825. //
  26826. // However, we want to avoid allocating extra fibers for every placeholder.
  26827. // They're only necessary when the children time out, because that's the
  26828. // only time when both sets are mounted.
  26829. //
  26830. // So, the extra fragment fibers are only used if the children time out.
  26831. // Otherwise, we render the primary children directly. This requires some
  26832. // custom reconciliation logic to preserve the state of the primary
  26833. // children. It's essentially a very basic form of re-parenting.
  26834. if (current === null) {
  26835. // If we're currently hydrating, try to hydrate this boundary.
  26836. // But only if this has a fallback.
  26837. if (nextProps.fallback !== undefined) {
  26838. tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
  26839. } // This is the initial mount. This branch is pretty simple because there's
  26840. // no previous state that needs to be preserved.
  26841. if (nextDidTimeout) {
  26842. // Mount separate fragments for primary and fallback children.
  26843. var nextFallbackChildren = nextProps.fallback;
  26844. var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
  26845. primaryChildFragment.return = workInProgress;
  26846. if ((workInProgress.mode & BlockingMode) === NoMode) {
  26847. // Outside of blocking mode, we commit the effects from the
  26848. // partially completed, timed-out tree, too.
  26849. var progressedState = workInProgress.memoizedState;
  26850. var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
  26851. primaryChildFragment.child = progressedPrimaryChild;
  26852. var progressedChild = progressedPrimaryChild;
  26853. while (progressedChild !== null) {
  26854. progressedChild.return = primaryChildFragment;
  26855. progressedChild = progressedChild.sibling;
  26856. }
  26857. }
  26858. var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
  26859. fallbackChildFragment.return = workInProgress;
  26860. primaryChildFragment.sibling = fallbackChildFragment; // Skip the primary children, and continue working on the
  26861. // fallback children.
  26862. workInProgress.memoizedState = SUSPENDED_MARKER;
  26863. workInProgress.child = primaryChildFragment;
  26864. return fallbackChildFragment;
  26865. } else {
  26866. // Mount the primary children without an intermediate fragment fiber.
  26867. var nextPrimaryChildren = nextProps.children;
  26868. workInProgress.memoizedState = null;
  26869. return workInProgress.child = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
  26870. }
  26871. } else {
  26872. // This is an update. This branch is more complicated because we need to
  26873. // ensure the state of the primary children is preserved.
  26874. var prevState = current.memoizedState;
  26875. if (prevState !== null) {
  26876. // wrapped in a fragment fiber.
  26877. var currentPrimaryChildFragment = current.child;
  26878. var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
  26879. if (nextDidTimeout) {
  26880. // Still timed out. Reuse the current primary children by cloning
  26881. // its fragment. We're going to skip over these entirely.
  26882. var _nextFallbackChildren2 = nextProps.fallback;
  26883. var _primaryChildFragment2 = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps);
  26884. _primaryChildFragment2.return = workInProgress;
  26885. if ((workInProgress.mode & BlockingMode) === NoMode) {
  26886. // Outside of blocking mode, we commit the effects from the
  26887. // partially completed, timed-out tree, too.
  26888. var _progressedState = workInProgress.memoizedState;
  26889. var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
  26890. if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
  26891. _primaryChildFragment2.child = _progressedPrimaryChild;
  26892. var _progressedChild2 = _progressedPrimaryChild;
  26893. while (_progressedChild2 !== null) {
  26894. _progressedChild2.return = _primaryChildFragment2;
  26895. _progressedChild2 = _progressedChild2.sibling;
  26896. }
  26897. }
  26898. } // Because primaryChildFragment is a new fiber that we're inserting as the
  26899. // parent of a new tree, we need to set its treeBaseDuration.
  26900. if ( workInProgress.mode & ProfileMode) {
  26901. // treeBaseDuration is the sum of all the child tree base durations.
  26902. var _treeBaseDuration = 0;
  26903. var _hiddenChild = _primaryChildFragment2.child;
  26904. while (_hiddenChild !== null) {
  26905. _treeBaseDuration += _hiddenChild.treeBaseDuration;
  26906. _hiddenChild = _hiddenChild.sibling;
  26907. }
  26908. _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
  26909. } // Clone the fallback child fragment, too. These we'll continue
  26910. // working on.
  26911. var _fallbackChildFragment2 = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren2);
  26912. _fallbackChildFragment2.return = workInProgress;
  26913. _primaryChildFragment2.sibling = _fallbackChildFragment2;
  26914. _primaryChildFragment2.childExpirationTime = NoWork; // Skip the primary children, and continue working on the
  26915. // fallback children.
  26916. workInProgress.memoizedState = SUSPENDED_MARKER;
  26917. workInProgress.child = _primaryChildFragment2;
  26918. return _fallbackChildFragment2;
  26919. } else {
  26920. // No longer suspended. Switch back to showing the primary children,
  26921. // and remove the intermediate fragment fiber.
  26922. var _nextPrimaryChildren = nextProps.children;
  26923. var currentPrimaryChild = currentPrimaryChildFragment.child;
  26924. var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime); // If this render doesn't suspend, we need to delete the fallback
  26925. // children. Wait until the complete phase, after we've confirmed the
  26926. // fallback is no longer needed.
  26927. // TODO: Would it be better to store the fallback fragment on
  26928. // the stateNode?
  26929. // Continue rendering the children, like we normally do.
  26930. workInProgress.memoizedState = null;
  26931. return workInProgress.child = primaryChild;
  26932. }
  26933. } else {
  26934. // The current tree has not already timed out. That means the primary
  26935. // children are not wrapped in a fragment fiber.
  26936. var _currentPrimaryChild = current.child;
  26937. if (nextDidTimeout) {
  26938. // Timed out. Wrap the children in a fragment fiber to keep them
  26939. // separate from the fallback children.
  26940. var _nextFallbackChildren3 = nextProps.fallback;
  26941. var _primaryChildFragment3 = createFiberFromFragment( // It shouldn't matter what the pending props are because we aren't
  26942. // going to render this fragment.
  26943. null, mode, NoWork, null);
  26944. _primaryChildFragment3.return = workInProgress;
  26945. _primaryChildFragment3.child = _currentPrimaryChild;
  26946. if (_currentPrimaryChild !== null) {
  26947. _currentPrimaryChild.return = _primaryChildFragment3;
  26948. } // Even though we're creating a new fiber, there are no new children,
  26949. // because we're reusing an already mounted tree. So we don't need to
  26950. // schedule a placement.
  26951. // primaryChildFragment.effectTag |= Placement;
  26952. if ((workInProgress.mode & BlockingMode) === NoMode) {
  26953. // Outside of blocking mode, we commit the effects from the
  26954. // partially completed, timed-out tree, too.
  26955. var _progressedState2 = workInProgress.memoizedState;
  26956. var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
  26957. _primaryChildFragment3.child = _progressedPrimaryChild2;
  26958. var _progressedChild3 = _progressedPrimaryChild2;
  26959. while (_progressedChild3 !== null) {
  26960. _progressedChild3.return = _primaryChildFragment3;
  26961. _progressedChild3 = _progressedChild3.sibling;
  26962. }
  26963. } // Because primaryChildFragment is a new fiber that we're inserting as the
  26964. // parent of a new tree, we need to set its treeBaseDuration.
  26965. if ( workInProgress.mode & ProfileMode) {
  26966. // treeBaseDuration is the sum of all the child tree base durations.
  26967. var _treeBaseDuration2 = 0;
  26968. var _hiddenChild2 = _primaryChildFragment3.child;
  26969. while (_hiddenChild2 !== null) {
  26970. _treeBaseDuration2 += _hiddenChild2.treeBaseDuration;
  26971. _hiddenChild2 = _hiddenChild2.sibling;
  26972. }
  26973. _primaryChildFragment3.treeBaseDuration = _treeBaseDuration2;
  26974. } // Create a fragment from the fallback children, too.
  26975. var _fallbackChildFragment3 = createFiberFromFragment(_nextFallbackChildren3, mode, renderExpirationTime, null);
  26976. _fallbackChildFragment3.return = workInProgress;
  26977. _primaryChildFragment3.sibling = _fallbackChildFragment3;
  26978. _fallbackChildFragment3.effectTag |= Placement;
  26979. _primaryChildFragment3.childExpirationTime = NoWork; // Skip the primary children, and continue working on the
  26980. // fallback children.
  26981. workInProgress.memoizedState = SUSPENDED_MARKER;
  26982. workInProgress.child = _primaryChildFragment3;
  26983. return _fallbackChildFragment3;
  26984. } else {
  26985. // Still haven't timed out. Continue rendering the children, like we
  26986. // normally do.
  26987. workInProgress.memoizedState = null;
  26988. var _nextPrimaryChildren2 = nextProps.children;
  26989. return workInProgress.child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
  26990. }
  26991. }
  26992. }
  26993. }
  26994. function scheduleWorkOnFiber(fiber, renderExpirationTime) {
  26995. if (fiber.expirationTime < renderExpirationTime) {
  26996. fiber.expirationTime = renderExpirationTime;
  26997. }
  26998. var alternate = fiber.alternate;
  26999. if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
  27000. alternate.expirationTime = renderExpirationTime;
  27001. }
  27002. scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
  27003. }
  27004. function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
  27005. // Mark any Suspense boundaries with fallbacks as having work to do.
  27006. // If they were previously forced into fallbacks, they may now be able
  27007. // to unblock.
  27008. var node = firstChild;
  27009. while (node !== null) {
  27010. if (node.tag === SuspenseComponent) {
  27011. var state = node.memoizedState;
  27012. if (state !== null) {
  27013. scheduleWorkOnFiber(node, renderExpirationTime);
  27014. }
  27015. } else if (node.tag === SuspenseListComponent) {
  27016. // If the tail is hidden there might not be an Suspense boundaries
  27017. // to schedule work on. In this case we have to schedule it on the
  27018. // list itself.
  27019. // We don't have to traverse to the children of the list since
  27020. // the list will propagate the change when it rerenders.
  27021. scheduleWorkOnFiber(node, renderExpirationTime);
  27022. } else if (node.child !== null) {
  27023. node.child.return = node;
  27024. node = node.child;
  27025. continue;
  27026. }
  27027. if (node === workInProgress) {
  27028. return;
  27029. }
  27030. while (node.sibling === null) {
  27031. if (node.return === null || node.return === workInProgress) {
  27032. return;
  27033. }
  27034. node = node.return;
  27035. }
  27036. node.sibling.return = node.return;
  27037. node = node.sibling;
  27038. }
  27039. }
  27040. function findLastContentRow(firstChild) {
  27041. // This is going to find the last row among these children that is already
  27042. // showing content on the screen, as opposed to being in fallback state or
  27043. // new. If a row has multiple Suspense boundaries, any of them being in the
  27044. // fallback state, counts as the whole row being in a fallback state.
  27045. // Note that the "rows" will be workInProgress, but any nested children
  27046. // will still be current since we haven't rendered them yet. The mounted
  27047. // order may not be the same as the new order. We use the new order.
  27048. var row = firstChild;
  27049. var lastContentRow = null;
  27050. while (row !== null) {
  27051. var currentRow = row.alternate; // New rows can't be content rows.
  27052. if (currentRow !== null && findFirstSuspended(currentRow) === null) {
  27053. lastContentRow = row;
  27054. }
  27055. row = row.sibling;
  27056. }
  27057. return lastContentRow;
  27058. }
  27059. function validateRevealOrder(revealOrder) {
  27060. {
  27061. if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
  27062. didWarnAboutRevealOrder[revealOrder] = true;
  27063. if (typeof revealOrder === 'string') {
  27064. switch (revealOrder.toLowerCase()) {
  27065. case 'together':
  27066. case 'forwards':
  27067. case 'backwards':
  27068. {
  27069. error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
  27070. break;
  27071. }
  27072. case 'forward':
  27073. case 'backward':
  27074. {
  27075. error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
  27076. break;
  27077. }
  27078. default:
  27079. error('"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
  27080. break;
  27081. }
  27082. } else {
  27083. error('%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
  27084. }
  27085. }
  27086. }
  27087. }
  27088. function validateTailOptions(tailMode, revealOrder) {
  27089. {
  27090. if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
  27091. if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
  27092. didWarnAboutTailOptions[tailMode] = true;
  27093. error('"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
  27094. } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
  27095. didWarnAboutTailOptions[tailMode] = true;
  27096. error('<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
  27097. }
  27098. }
  27099. }
  27100. }
  27101. function validateSuspenseListNestedChild(childSlot, index) {
  27102. {
  27103. var isArray = Array.isArray(childSlot);
  27104. var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
  27105. if (isArray || isIterable) {
  27106. var type = isArray ? 'array' : 'iterable';
  27107. error('A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
  27108. return false;
  27109. }
  27110. }
  27111. return true;
  27112. }
  27113. function validateSuspenseListChildren(children, revealOrder) {
  27114. {
  27115. if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
  27116. if (Array.isArray(children)) {
  27117. for (var i = 0; i < children.length; i++) {
  27118. if (!validateSuspenseListNestedChild(children[i], i)) {
  27119. return;
  27120. }
  27121. }
  27122. } else {
  27123. var iteratorFn = getIteratorFn(children);
  27124. if (typeof iteratorFn === 'function') {
  27125. var childrenIterator = iteratorFn.call(children);
  27126. if (childrenIterator) {
  27127. var step = childrenIterator.next();
  27128. var _i = 0;
  27129. for (; !step.done; step = childrenIterator.next()) {
  27130. if (!validateSuspenseListNestedChild(step.value, _i)) {
  27131. return;
  27132. }
  27133. _i++;
  27134. }
  27135. }
  27136. } else {
  27137. error('A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
  27138. }
  27139. }
  27140. }
  27141. }
  27142. }
  27143. function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
  27144. var renderState = workInProgress.memoizedState;
  27145. if (renderState === null) {
  27146. workInProgress.memoizedState = {
  27147. isBackwards: isBackwards,
  27148. rendering: null,
  27149. renderingStartTime: 0,
  27150. last: lastContentRow,
  27151. tail: tail,
  27152. tailExpiration: 0,
  27153. tailMode: tailMode,
  27154. lastEffect: lastEffectBeforeRendering
  27155. };
  27156. } else {
  27157. // We can reuse the existing object from previous renders.
  27158. renderState.isBackwards = isBackwards;
  27159. renderState.rendering = null;
  27160. renderState.renderingStartTime = 0;
  27161. renderState.last = lastContentRow;
  27162. renderState.tail = tail;
  27163. renderState.tailExpiration = 0;
  27164. renderState.tailMode = tailMode;
  27165. renderState.lastEffect = lastEffectBeforeRendering;
  27166. }
  27167. } // This can end up rendering this component multiple passes.
  27168. // The first pass splits the children fibers into two sets. A head and tail.
  27169. // We first render the head. If anything is in fallback state, we do another
  27170. // pass through beginWork to rerender all children (including the tail) with
  27171. // the force suspend context. If the first render didn't have anything in
  27172. // in fallback state. Then we render each row in the tail one-by-one.
  27173. // That happens in the completeWork phase without going back to beginWork.
  27174. function updateSuspenseListComponent(current, workInProgress, renderExpirationTime) {
  27175. var nextProps = workInProgress.pendingProps;
  27176. var revealOrder = nextProps.revealOrder;
  27177. var tailMode = nextProps.tail;
  27178. var newChildren = nextProps.children;
  27179. validateRevealOrder(revealOrder);
  27180. validateTailOptions(tailMode, revealOrder);
  27181. validateSuspenseListChildren(newChildren, revealOrder);
  27182. reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
  27183. var suspenseContext = suspenseStackCursor.current;
  27184. var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
  27185. if (shouldForceFallback) {
  27186. suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
  27187. workInProgress.effectTag |= DidCapture;
  27188. } else {
  27189. var didSuspendBefore = current !== null && (current.effectTag & DidCapture) !== NoEffect;
  27190. if (didSuspendBefore) {
  27191. // If we previously forced a fallback, we need to schedule work
  27192. // on any nested boundaries to let them know to try to render
  27193. // again. This is the same as context updating.
  27194. propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime);
  27195. }
  27196. suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
  27197. }
  27198. pushSuspenseContext(workInProgress, suspenseContext);
  27199. if ((workInProgress.mode & BlockingMode) === NoMode) {
  27200. // Outside of blocking mode, SuspenseList doesn't work so we just
  27201. // use make it a noop by treating it as the default revealOrder.
  27202. workInProgress.memoizedState = null;
  27203. } else {
  27204. switch (revealOrder) {
  27205. case 'forwards':
  27206. {
  27207. var lastContentRow = findLastContentRow(workInProgress.child);
  27208. var tail;
  27209. if (lastContentRow === null) {
  27210. // The whole list is part of the tail.
  27211. // TODO: We could fast path by just rendering the tail now.
  27212. tail = workInProgress.child;
  27213. workInProgress.child = null;
  27214. } else {
  27215. // Disconnect the tail rows after the content row.
  27216. // We're going to render them separately later.
  27217. tail = lastContentRow.sibling;
  27218. lastContentRow.sibling = null;
  27219. }
  27220. initSuspenseListRenderState(workInProgress, false, // isBackwards
  27221. tail, lastContentRow, tailMode, workInProgress.lastEffect);
  27222. break;
  27223. }
  27224. case 'backwards':
  27225. {
  27226. // We're going to find the first row that has existing content.
  27227. // At the same time we're going to reverse the list of everything
  27228. // we pass in the meantime. That's going to be our tail in reverse
  27229. // order.
  27230. var _tail = null;
  27231. var row = workInProgress.child;
  27232. workInProgress.child = null;
  27233. while (row !== null) {
  27234. var currentRow = row.alternate; // New rows can't be content rows.
  27235. if (currentRow !== null && findFirstSuspended(currentRow) === null) {
  27236. // This is the beginning of the main content.
  27237. workInProgress.child = row;
  27238. break;
  27239. }
  27240. var nextRow = row.sibling;
  27241. row.sibling = _tail;
  27242. _tail = row;
  27243. row = nextRow;
  27244. } // TODO: If workInProgress.child is null, we can continue on the tail immediately.
  27245. initSuspenseListRenderState(workInProgress, true, // isBackwards
  27246. _tail, null, // last
  27247. tailMode, workInProgress.lastEffect);
  27248. break;
  27249. }
  27250. case 'together':
  27251. {
  27252. initSuspenseListRenderState(workInProgress, false, // isBackwards
  27253. null, // tail
  27254. null, // last
  27255. undefined, workInProgress.lastEffect);
  27256. break;
  27257. }
  27258. default:
  27259. {
  27260. // The default reveal order is the same as not having
  27261. // a boundary.
  27262. workInProgress.memoizedState = null;
  27263. }
  27264. }
  27265. }
  27266. return workInProgress.child;
  27267. }
  27268. function updatePortalComponent(current, workInProgress, renderExpirationTime) {
  27269. pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
  27270. var nextChildren = workInProgress.pendingProps;
  27271. if (current === null) {
  27272. // Portals are special because we don't append the children during mount
  27273. // but at commit. Therefore we need to track insertions which the normal
  27274. // flow doesn't do during mount. This doesn't happen at the root because
  27275. // the root always starts with a "current" with a null child.
  27276. // TODO: Consider unifying this with how the root works.
  27277. workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
  27278. } else {
  27279. reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
  27280. }
  27281. return workInProgress.child;
  27282. }
  27283. function updateContextProvider(current, workInProgress, renderExpirationTime) {
  27284. var providerType = workInProgress.type;
  27285. var context = providerType._context;
  27286. var newProps = workInProgress.pendingProps;
  27287. var oldProps = workInProgress.memoizedProps;
  27288. var newValue = newProps.value;
  27289. {
  27290. var providerPropTypes = workInProgress.type.propTypes;
  27291. if (providerPropTypes) {
  27292. checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
  27293. }
  27294. }
  27295. pushProvider(workInProgress, newValue);
  27296. if (oldProps !== null) {
  27297. var oldValue = oldProps.value;
  27298. var changedBits = calculateChangedBits(context, newValue, oldValue);
  27299. if (changedBits === 0) {
  27300. // No change. Bailout early if children are the same.
  27301. if (oldProps.children === newProps.children && !hasContextChanged()) {
  27302. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  27303. }
  27304. } else {
  27305. // The context value changed. Search for matching consumers and schedule
  27306. // them to update.
  27307. propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
  27308. }
  27309. }
  27310. var newChildren = newProps.children;
  27311. reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
  27312. return workInProgress.child;
  27313. }
  27314. var hasWarnedAboutUsingContextAsConsumer = false;
  27315. function updateContextConsumer(current, workInProgress, renderExpirationTime) {
  27316. var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In
  27317. // DEV mode, we create a separate object for Context.Consumer that acts
  27318. // like a proxy to Context. This proxy object adds unnecessary code in PROD
  27319. // so we use the old behaviour (Context.Consumer references Context) to
  27320. // reduce size and overhead. The separate object references context via
  27321. // a property called "_context", which also gives us the ability to check
  27322. // in DEV mode if this property exists or not and warn if it does not.
  27323. {
  27324. if (context._context === undefined) {
  27325. // This may be because it's a Context (rather than a Consumer).
  27326. // Or it may be because it's older React where they're the same thing.
  27327. // We only want to warn if we're sure it's a new React.
  27328. if (context !== context.Consumer) {
  27329. if (!hasWarnedAboutUsingContextAsConsumer) {
  27330. hasWarnedAboutUsingContextAsConsumer = true;
  27331. error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
  27332. }
  27333. }
  27334. } else {
  27335. context = context._context;
  27336. }
  27337. }
  27338. var newProps = workInProgress.pendingProps;
  27339. var render = newProps.children;
  27340. {
  27341. if (typeof render !== 'function') {
  27342. error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.');
  27343. }
  27344. }
  27345. prepareToReadContext(workInProgress, renderExpirationTime);
  27346. var newValue = readContext(context, newProps.unstable_observedBits);
  27347. var newChildren;
  27348. {
  27349. ReactCurrentOwner$1.current = workInProgress;
  27350. setIsRendering(true);
  27351. newChildren = render(newValue);
  27352. setIsRendering(false);
  27353. } // React DevTools reads this flag.
  27354. workInProgress.effectTag |= PerformedWork;
  27355. reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
  27356. return workInProgress.child;
  27357. }
  27358. function markWorkInProgressReceivedUpdate() {
  27359. didReceiveUpdate = true;
  27360. }
  27361. function bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime) {
  27362. cancelWorkTimer(workInProgress);
  27363. if (current !== null) {
  27364. // Reuse previous dependencies
  27365. workInProgress.dependencies = current.dependencies;
  27366. }
  27367. {
  27368. // Don't update "base" render times for bailouts.
  27369. stopProfilerTimerIfRunning();
  27370. }
  27371. var updateExpirationTime = workInProgress.expirationTime;
  27372. if (updateExpirationTime !== NoWork) {
  27373. markUnprocessedUpdateTime(updateExpirationTime);
  27374. } // Check if the children have any pending work.
  27375. var childExpirationTime = workInProgress.childExpirationTime;
  27376. if (childExpirationTime < renderExpirationTime) {
  27377. // The children don't have any work either. We can skip them.
  27378. // TODO: Once we add back resuming, we should check if the children are
  27379. // a work-in-progress set. If so, we need to transfer their effects.
  27380. return null;
  27381. } else {
  27382. // This fiber doesn't have work, but its subtree does. Clone the child
  27383. // fibers and continue.
  27384. cloneChildFibers(current, workInProgress);
  27385. return workInProgress.child;
  27386. }
  27387. }
  27388. function remountFiber(current, oldWorkInProgress, newWorkInProgress) {
  27389. {
  27390. var returnFiber = oldWorkInProgress.return;
  27391. if (returnFiber === null) {
  27392. throw new Error('Cannot swap the root fiber.');
  27393. } // Disconnect from the old current.
  27394. // It will get deleted.
  27395. current.alternate = null;
  27396. oldWorkInProgress.alternate = null; // Connect to the new tree.
  27397. newWorkInProgress.index = oldWorkInProgress.index;
  27398. newWorkInProgress.sibling = oldWorkInProgress.sibling;
  27399. newWorkInProgress.return = oldWorkInProgress.return;
  27400. newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it.
  27401. if (oldWorkInProgress === returnFiber.child) {
  27402. returnFiber.child = newWorkInProgress;
  27403. } else {
  27404. var prevSibling = returnFiber.child;
  27405. if (prevSibling === null) {
  27406. throw new Error('Expected parent to have a child.');
  27407. }
  27408. while (prevSibling.sibling !== oldWorkInProgress) {
  27409. prevSibling = prevSibling.sibling;
  27410. if (prevSibling === null) {
  27411. throw new Error('Expected to find the previous sibling.');
  27412. }
  27413. }
  27414. prevSibling.sibling = newWorkInProgress;
  27415. } // Delete the old fiber and place the new one.
  27416. // Since the old fiber is disconnected, we have to schedule it manually.
  27417. var last = returnFiber.lastEffect;
  27418. if (last !== null) {
  27419. last.nextEffect = current;
  27420. returnFiber.lastEffect = current;
  27421. } else {
  27422. returnFiber.firstEffect = returnFiber.lastEffect = current;
  27423. }
  27424. current.nextEffect = null;
  27425. current.effectTag = Deletion;
  27426. newWorkInProgress.effectTag |= Placement; // Restart work from the new fiber.
  27427. return newWorkInProgress;
  27428. }
  27429. }
  27430. function beginWork(current, workInProgress, renderExpirationTime) {
  27431. var updateExpirationTime = workInProgress.expirationTime;
  27432. {
  27433. if (workInProgress._debugNeedsRemount && current !== null) {
  27434. // This will restart the begin phase with a new fiber.
  27435. return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
  27436. }
  27437. }
  27438. if (current !== null) {
  27439. var oldProps = current.memoizedProps;
  27440. var newProps = workInProgress.pendingProps;
  27441. if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload:
  27442. workInProgress.type !== current.type )) {
  27443. // If props or context changed, mark the fiber as having performed work.
  27444. // This may be unset if the props are determined to be equal later (memo).
  27445. didReceiveUpdate = true;
  27446. } else if (updateExpirationTime < renderExpirationTime) {
  27447. didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering
  27448. // the begin phase. There's still some bookkeeping we that needs to be done
  27449. // in this optimized path, mostly pushing stuff onto the stack.
  27450. switch (workInProgress.tag) {
  27451. case HostRoot:
  27452. pushHostRootContext(workInProgress);
  27453. resetHydrationState();
  27454. break;
  27455. case HostComponent:
  27456. pushHostContext(workInProgress);
  27457. if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
  27458. {
  27459. markSpawnedWork(Never);
  27460. } // Schedule this fiber to re-render at offscreen priority. Then bailout.
  27461. workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
  27462. return null;
  27463. }
  27464. break;
  27465. case ClassComponent:
  27466. {
  27467. var Component = workInProgress.type;
  27468. if (isContextProvider(Component)) {
  27469. pushContextProvider(workInProgress);
  27470. }
  27471. break;
  27472. }
  27473. case HostPortal:
  27474. pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
  27475. break;
  27476. case ContextProvider:
  27477. {
  27478. var newValue = workInProgress.memoizedProps.value;
  27479. pushProvider(workInProgress, newValue);
  27480. break;
  27481. }
  27482. case Profiler:
  27483. {
  27484. // Profiler should only call onRender when one of its descendants actually rendered.
  27485. var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
  27486. if (hasChildWork) {
  27487. workInProgress.effectTag |= Update;
  27488. }
  27489. }
  27490. break;
  27491. case SuspenseComponent:
  27492. {
  27493. var state = workInProgress.memoizedState;
  27494. if (state !== null) {
  27495. // whether to retry the primary children, or to skip over it and
  27496. // go straight to the fallback. Check the priority of the primary
  27497. // child fragment.
  27498. var primaryChildFragment = workInProgress.child;
  27499. var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
  27500. if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
  27501. // The primary children have pending work. Use the normal path
  27502. // to attempt to render the primary children again.
  27503. return updateSuspenseComponent(current, workInProgress, renderExpirationTime);
  27504. } else {
  27505. pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient
  27506. // priority. Bailout.
  27507. var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  27508. if (child !== null) {
  27509. // The fallback children have pending work. Skip over the
  27510. // primary children and work on the fallback.
  27511. return child.sibling;
  27512. } else {
  27513. return null;
  27514. }
  27515. }
  27516. } else {
  27517. pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
  27518. }
  27519. break;
  27520. }
  27521. case SuspenseListComponent:
  27522. {
  27523. var didSuspendBefore = (current.effectTag & DidCapture) !== NoEffect;
  27524. var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
  27525. if (didSuspendBefore) {
  27526. if (_hasChildWork) {
  27527. // If something was in fallback state last time, and we have all the
  27528. // same children then we're still in progressive loading state.
  27529. // Something might get unblocked by state updates or retries in the
  27530. // tree which will affect the tail. So we need to use the normal
  27531. // path to compute the correct tail.
  27532. return updateSuspenseListComponent(current, workInProgress, renderExpirationTime);
  27533. } // If none of the children had any work, that means that none of
  27534. // them got retried so they'll still be blocked in the same way
  27535. // as before. We can fast bail out.
  27536. workInProgress.effectTag |= DidCapture;
  27537. } // If nothing suspended before and we're rendering the same children,
  27538. // then the tail doesn't matter. Anything new that suspends will work
  27539. // in the "together" mode, so we can continue from the state we had.
  27540. var renderState = workInProgress.memoizedState;
  27541. if (renderState !== null) {
  27542. // Reset to the "together" mode in case we've started a different
  27543. // update in the past but didn't complete it.
  27544. renderState.rendering = null;
  27545. renderState.tail = null;
  27546. }
  27547. pushSuspenseContext(workInProgress, suspenseStackCursor.current);
  27548. if (_hasChildWork) {
  27549. break;
  27550. } else {
  27551. // If none of the children had any work, that means that none of
  27552. // them got retried so they'll still be blocked in the same way
  27553. // as before. We can fast bail out.
  27554. return null;
  27555. }
  27556. }
  27557. }
  27558. return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
  27559. } else {
  27560. // An update was scheduled on this fiber, but there are no new props
  27561. // nor legacy context. Set this to false. If an update queue or context
  27562. // consumer produces a changed value, it will set this to true. Otherwise,
  27563. // the component will assume the children have not changed and bail out.
  27564. didReceiveUpdate = false;
  27565. }
  27566. } else {
  27567. didReceiveUpdate = false;
  27568. } // Before entering the begin phase, clear pending update priority.
  27569. // TODO: This assumes that we're about to evaluate the component and process
  27570. // the update queue. However, there's an exception: SimpleMemoComponent
  27571. // sometimes bails out later in the begin phase. This indicates that we should
  27572. // move this assignment out of the common path and into each branch.
  27573. workInProgress.expirationTime = NoWork;
  27574. switch (workInProgress.tag) {
  27575. case IndeterminateComponent:
  27576. {
  27577. return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderExpirationTime);
  27578. }
  27579. case LazyComponent:
  27580. {
  27581. var elementType = workInProgress.elementType;
  27582. return mountLazyComponent(current, workInProgress, elementType, updateExpirationTime, renderExpirationTime);
  27583. }
  27584. case FunctionComponent:
  27585. {
  27586. var _Component = workInProgress.type;
  27587. var unresolvedProps = workInProgress.pendingProps;
  27588. var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
  27589. return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderExpirationTime);
  27590. }
  27591. case ClassComponent:
  27592. {
  27593. var _Component2 = workInProgress.type;
  27594. var _unresolvedProps = workInProgress.pendingProps;
  27595. var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
  27596. return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
  27597. }
  27598. case HostRoot:
  27599. return updateHostRoot(current, workInProgress, renderExpirationTime);
  27600. case HostComponent:
  27601. return updateHostComponent(current, workInProgress, renderExpirationTime);
  27602. case HostText:
  27603. return updateHostText(current, workInProgress);
  27604. case SuspenseComponent:
  27605. return updateSuspenseComponent(current, workInProgress, renderExpirationTime);
  27606. case HostPortal:
  27607. return updatePortalComponent(current, workInProgress, renderExpirationTime);
  27608. case ForwardRef:
  27609. {
  27610. var type = workInProgress.type;
  27611. var _unresolvedProps2 = workInProgress.pendingProps;
  27612. var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
  27613. return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderExpirationTime);
  27614. }
  27615. case Fragment:
  27616. return updateFragment(current, workInProgress, renderExpirationTime);
  27617. case Mode:
  27618. return updateMode(current, workInProgress, renderExpirationTime);
  27619. case Profiler:
  27620. return updateProfiler(current, workInProgress, renderExpirationTime);
  27621. case ContextProvider:
  27622. return updateContextProvider(current, workInProgress, renderExpirationTime);
  27623. case ContextConsumer:
  27624. return updateContextConsumer(current, workInProgress, renderExpirationTime);
  27625. case MemoComponent:
  27626. {
  27627. var _type2 = workInProgress.type;
  27628. var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props.
  27629. var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
  27630. {
  27631. if (workInProgress.type !== workInProgress.elementType) {
  27632. var outerPropTypes = _type2.propTypes;
  27633. if (outerPropTypes) {
  27634. checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only
  27635. 'prop', getComponentName(_type2), getCurrentFiberStackInDev);
  27636. }
  27637. }
  27638. }
  27639. _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
  27640. return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
  27641. }
  27642. case SimpleMemoComponent:
  27643. {
  27644. return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
  27645. }
  27646. case IncompleteClassComponent:
  27647. {
  27648. var _Component3 = workInProgress.type;
  27649. var _unresolvedProps4 = workInProgress.pendingProps;
  27650. var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
  27651. return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
  27652. }
  27653. case SuspenseListComponent:
  27654. {
  27655. return updateSuspenseListComponent(current, workInProgress, renderExpirationTime);
  27656. }
  27657. }
  27658. {
  27659. {
  27660. throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
  27661. }
  27662. }
  27663. }
  27664. function markUpdate(workInProgress) {
  27665. // Tag the fiber with an update effect. This turns a Placement into
  27666. // a PlacementAndUpdate.
  27667. workInProgress.effectTag |= Update;
  27668. }
  27669. function markRef$1(workInProgress) {
  27670. workInProgress.effectTag |= Ref;
  27671. }
  27672. var appendAllChildren;
  27673. var updateHostContainer;
  27674. var updateHostComponent$1;
  27675. var updateHostText$1;
  27676. {
  27677. // Mutation mode
  27678. appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
  27679. // We only have the top Fiber that was created but we need recurse down its
  27680. // children to find all the terminal nodes.
  27681. var node = workInProgress.child;
  27682. while (node !== null) {
  27683. if (node.tag === HostComponent || node.tag === HostText) {
  27684. appendInitialChild(parent, node.stateNode);
  27685. } else if (node.tag === HostPortal) ; else if (node.child !== null) {
  27686. node.child.return = node;
  27687. node = node.child;
  27688. continue;
  27689. }
  27690. if (node === workInProgress) {
  27691. return;
  27692. }
  27693. while (node.sibling === null) {
  27694. if (node.return === null || node.return === workInProgress) {
  27695. return;
  27696. }
  27697. node = node.return;
  27698. }
  27699. node.sibling.return = node.return;
  27700. node = node.sibling;
  27701. }
  27702. };
  27703. updateHostContainer = function (workInProgress) {// Noop
  27704. };
  27705. updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
  27706. // If we have an alternate, that means this is an update and we need to
  27707. // schedule a side-effect to do the updates.
  27708. var oldProps = current.memoizedProps;
  27709. if (oldProps === newProps) {
  27710. // In mutation mode, this is sufficient for a bailout because
  27711. // we won't touch this node even if children changed.
  27712. return;
  27713. } // If we get updated because one of our children updated, we don't
  27714. // have newProps so we'll have to reuse them.
  27715. // TODO: Split the update API as separate for the props vs. children.
  27716. // Even better would be if children weren't special cased at all tho.
  27717. var instance = workInProgress.stateNode;
  27718. var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host
  27719. // component is hitting the resume path. Figure out why. Possibly
  27720. // related to `hidden`.
  27721. var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component.
  27722. workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there
  27723. // is a new ref we mark this as an update. All the work is done in commitWork.
  27724. if (updatePayload) {
  27725. markUpdate(workInProgress);
  27726. }
  27727. };
  27728. updateHostText$1 = function (current, workInProgress, oldText, newText) {
  27729. // If the text differs, mark it as an update. All the work in done in commitWork.
  27730. if (oldText !== newText) {
  27731. markUpdate(workInProgress);
  27732. }
  27733. };
  27734. }
  27735. function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
  27736. switch (renderState.tailMode) {
  27737. case 'hidden':
  27738. {
  27739. // Any insertions at the end of the tail list after this point
  27740. // should be invisible. If there are already mounted boundaries
  27741. // anything before them are not considered for collapsing.
  27742. // Therefore we need to go through the whole tail to find if
  27743. // there are any.
  27744. var tailNode = renderState.tail;
  27745. var lastTailNode = null;
  27746. while (tailNode !== null) {
  27747. if (tailNode.alternate !== null) {
  27748. lastTailNode = tailNode;
  27749. }
  27750. tailNode = tailNode.sibling;
  27751. } // Next we're simply going to delete all insertions after the
  27752. // last rendered item.
  27753. if (lastTailNode === null) {
  27754. // All remaining items in the tail are insertions.
  27755. renderState.tail = null;
  27756. } else {
  27757. // Detach the insertion after the last node that was already
  27758. // inserted.
  27759. lastTailNode.sibling = null;
  27760. }
  27761. break;
  27762. }
  27763. case 'collapsed':
  27764. {
  27765. // Any insertions at the end of the tail list after this point
  27766. // should be invisible. If there are already mounted boundaries
  27767. // anything before them are not considered for collapsing.
  27768. // Therefore we need to go through the whole tail to find if
  27769. // there are any.
  27770. var _tailNode = renderState.tail;
  27771. var _lastTailNode = null;
  27772. while (_tailNode !== null) {
  27773. if (_tailNode.alternate !== null) {
  27774. _lastTailNode = _tailNode;
  27775. }
  27776. _tailNode = _tailNode.sibling;
  27777. } // Next we're simply going to delete all insertions after the
  27778. // last rendered item.
  27779. if (_lastTailNode === null) {
  27780. // All remaining items in the tail are insertions.
  27781. if (!hasRenderedATailFallback && renderState.tail !== null) {
  27782. // We suspended during the head. We want to show at least one
  27783. // row at the tail. So we'll keep on and cut off the rest.
  27784. renderState.tail.sibling = null;
  27785. } else {
  27786. renderState.tail = null;
  27787. }
  27788. } else {
  27789. // Detach the insertion after the last node that was already
  27790. // inserted.
  27791. _lastTailNode.sibling = null;
  27792. }
  27793. break;
  27794. }
  27795. }
  27796. }
  27797. function completeWork(current, workInProgress, renderExpirationTime) {
  27798. var newProps = workInProgress.pendingProps;
  27799. switch (workInProgress.tag) {
  27800. case IndeterminateComponent:
  27801. case LazyComponent:
  27802. case SimpleMemoComponent:
  27803. case FunctionComponent:
  27804. case ForwardRef:
  27805. case Fragment:
  27806. case Mode:
  27807. case Profiler:
  27808. case ContextConsumer:
  27809. case MemoComponent:
  27810. return null;
  27811. case ClassComponent:
  27812. {
  27813. var Component = workInProgress.type;
  27814. if (isContextProvider(Component)) {
  27815. popContext(workInProgress);
  27816. }
  27817. return null;
  27818. }
  27819. case HostRoot:
  27820. {
  27821. popHostContainer(workInProgress);
  27822. popTopLevelContextObject(workInProgress);
  27823. var fiberRoot = workInProgress.stateNode;
  27824. if (fiberRoot.pendingContext) {
  27825. fiberRoot.context = fiberRoot.pendingContext;
  27826. fiberRoot.pendingContext = null;
  27827. }
  27828. if (current === null || current.child === null) {
  27829. // If we hydrated, pop so that we can delete any remaining children
  27830. // that weren't hydrated.
  27831. var wasHydrated = popHydrationState(workInProgress);
  27832. if (wasHydrated) {
  27833. // If we hydrated, then we'll need to schedule an update for
  27834. // the commit side-effects on the root.
  27835. markUpdate(workInProgress);
  27836. }
  27837. }
  27838. updateHostContainer(workInProgress);
  27839. return null;
  27840. }
  27841. case HostComponent:
  27842. {
  27843. popHostContext(workInProgress);
  27844. var rootContainerInstance = getRootHostContainer();
  27845. var type = workInProgress.type;
  27846. if (current !== null && workInProgress.stateNode != null) {
  27847. updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
  27848. if (current.ref !== workInProgress.ref) {
  27849. markRef$1(workInProgress);
  27850. }
  27851. } else {
  27852. if (!newProps) {
  27853. if (!(workInProgress.stateNode !== null)) {
  27854. {
  27855. throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
  27856. }
  27857. } // This can happen when we abort work.
  27858. return null;
  27859. }
  27860. var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
  27861. // "stack" as the parent. Then append children as we go in beginWork
  27862. // or completeWork depending on whether we want to add them top->down or
  27863. // bottom->up. Top->down is faster in IE11.
  27864. var _wasHydrated = popHydrationState(workInProgress);
  27865. if (_wasHydrated) {
  27866. // TODO: Move this and createInstance step into the beginPhase
  27867. // to consolidate.
  27868. if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
  27869. // If changes to the hydrated node need to be applied at the
  27870. // commit-phase we mark this as such.
  27871. markUpdate(workInProgress);
  27872. }
  27873. } else {
  27874. var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
  27875. appendAllChildren(instance, workInProgress, false, false); // This needs to be set before we mount Flare event listeners
  27876. workInProgress.stateNode = instance;
  27877. // (eg DOM renderer supports auto-focus for certain elements).
  27878. // Make sure such renderers get scheduled for later work.
  27879. if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) {
  27880. markUpdate(workInProgress);
  27881. }
  27882. }
  27883. if (workInProgress.ref !== null) {
  27884. // If there is a ref on a host node we need to schedule a callback
  27885. markRef$1(workInProgress);
  27886. }
  27887. }
  27888. return null;
  27889. }
  27890. case HostText:
  27891. {
  27892. var newText = newProps;
  27893. if (current && workInProgress.stateNode != null) {
  27894. var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need
  27895. // to schedule a side-effect to do the updates.
  27896. updateHostText$1(current, workInProgress, oldText, newText);
  27897. } else {
  27898. if (typeof newText !== 'string') {
  27899. if (!(workInProgress.stateNode !== null)) {
  27900. {
  27901. throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
  27902. }
  27903. } // This can happen when we abort work.
  27904. }
  27905. var _rootContainerInstance = getRootHostContainer();
  27906. var _currentHostContext = getHostContext();
  27907. var _wasHydrated2 = popHydrationState(workInProgress);
  27908. if (_wasHydrated2) {
  27909. if (prepareToHydrateHostTextInstance(workInProgress)) {
  27910. markUpdate(workInProgress);
  27911. }
  27912. } else {
  27913. workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
  27914. }
  27915. }
  27916. return null;
  27917. }
  27918. case SuspenseComponent:
  27919. {
  27920. popSuspenseContext(workInProgress);
  27921. var nextState = workInProgress.memoizedState;
  27922. if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
  27923. // Something suspended. Re-render with the fallback children.
  27924. workInProgress.expirationTime = renderExpirationTime; // Do not reset the effect list.
  27925. return workInProgress;
  27926. }
  27927. var nextDidTimeout = nextState !== null;
  27928. var prevDidTimeout = false;
  27929. if (current === null) {
  27930. if (workInProgress.memoizedProps.fallback !== undefined) {
  27931. popHydrationState(workInProgress);
  27932. }
  27933. } else {
  27934. var prevState = current.memoizedState;
  27935. prevDidTimeout = prevState !== null;
  27936. if (!nextDidTimeout && prevState !== null) {
  27937. // We just switched from the fallback to the normal children.
  27938. // Delete the fallback.
  27939. // TODO: Would it be better to store the fallback fragment on
  27940. // the stateNode during the begin phase?
  27941. var currentFallbackChild = current.child.sibling;
  27942. if (currentFallbackChild !== null) {
  27943. // Deletions go at the beginning of the return fiber's effect list
  27944. var first = workInProgress.firstEffect;
  27945. if (first !== null) {
  27946. workInProgress.firstEffect = currentFallbackChild;
  27947. currentFallbackChild.nextEffect = first;
  27948. } else {
  27949. workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
  27950. currentFallbackChild.nextEffect = null;
  27951. }
  27952. currentFallbackChild.effectTag = Deletion;
  27953. }
  27954. }
  27955. }
  27956. if (nextDidTimeout && !prevDidTimeout) {
  27957. // If this subtreee is running in blocking mode we can suspend,
  27958. // otherwise we won't suspend.
  27959. // TODO: This will still suspend a synchronous tree if anything
  27960. // in the concurrent tree already suspended during this render.
  27961. // This is a known bug.
  27962. if ((workInProgress.mode & BlockingMode) !== NoMode) {
  27963. // TODO: Move this back to throwException because this is too late
  27964. // if this is a large tree which is common for initial loads. We
  27965. // don't know if we should restart a render or not until we get
  27966. // this marker, and this is too late.
  27967. // If this render already had a ping or lower pri updates,
  27968. // and this is the first time we know we're going to suspend we
  27969. // should be able to immediately restart from within throwException.
  27970. var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
  27971. if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
  27972. // If this was in an invisible tree or a new render, then showing
  27973. // this boundary is ok.
  27974. renderDidSuspend();
  27975. } else {
  27976. // Otherwise, we're going to have to hide content so we should
  27977. // suspend for longer if possible.
  27978. renderDidSuspendDelayIfPossible();
  27979. }
  27980. }
  27981. }
  27982. {
  27983. // TODO: Only schedule updates if these values are non equal, i.e. it changed.
  27984. if (nextDidTimeout || prevDidTimeout) {
  27985. // If this boundary just timed out, schedule an effect to attach a
  27986. // retry listener to the promise. This flag is also used to hide the
  27987. // primary children. In mutation mode, we also need the flag to
  27988. // *unhide* children that were previously hidden, so check if this
  27989. // is currently timed out, too.
  27990. workInProgress.effectTag |= Update;
  27991. }
  27992. }
  27993. return null;
  27994. }
  27995. case HostPortal:
  27996. popHostContainer(workInProgress);
  27997. updateHostContainer(workInProgress);
  27998. return null;
  27999. case ContextProvider:
  28000. // Pop provider fiber
  28001. popProvider(workInProgress);
  28002. return null;
  28003. case IncompleteClassComponent:
  28004. {
  28005. // Same as class component case. I put it down here so that the tags are
  28006. // sequential to ensure this switch is compiled to a jump table.
  28007. var _Component = workInProgress.type;
  28008. if (isContextProvider(_Component)) {
  28009. popContext(workInProgress);
  28010. }
  28011. return null;
  28012. }
  28013. case SuspenseListComponent:
  28014. {
  28015. popSuspenseContext(workInProgress);
  28016. var renderState = workInProgress.memoizedState;
  28017. if (renderState === null) {
  28018. // We're running in the default, "independent" mode.
  28019. // We don't do anything in this mode.
  28020. return null;
  28021. }
  28022. var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect;
  28023. var renderedTail = renderState.rendering;
  28024. if (renderedTail === null) {
  28025. // We just rendered the head.
  28026. if (!didSuspendAlready) {
  28027. // This is the first pass. We need to figure out if anything is still
  28028. // suspended in the rendered set.
  28029. // If new content unsuspended, but there's still some content that
  28030. // didn't. Then we need to do a second pass that forces everything
  28031. // to keep showing their fallbacks.
  28032. // We might be suspended if something in this render pass suspended, or
  28033. // something in the previous committed pass suspended. Otherwise,
  28034. // there's no chance so we can skip the expensive call to
  28035. // findFirstSuspended.
  28036. var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect);
  28037. if (!cannotBeSuspended) {
  28038. var row = workInProgress.child;
  28039. while (row !== null) {
  28040. var suspended = findFirstSuspended(row);
  28041. if (suspended !== null) {
  28042. didSuspendAlready = true;
  28043. workInProgress.effectTag |= DidCapture;
  28044. cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
  28045. // part of the second pass. In that case nothing will subscribe to
  28046. // its thennables. Instead, we'll transfer its thennables to the
  28047. // SuspenseList so that it can retry if they resolve.
  28048. // There might be multiple of these in the list but since we're
  28049. // going to wait for all of them anyway, it doesn't really matter
  28050. // which ones gets to ping. In theory we could get clever and keep
  28051. // track of how many dependencies remain but it gets tricky because
  28052. // in the meantime, we can add/remove/change items and dependencies.
  28053. // We might bail out of the loop before finding any but that
  28054. // doesn't matter since that means that the other boundaries that
  28055. // we did find already has their listeners attached.
  28056. var newThennables = suspended.updateQueue;
  28057. if (newThennables !== null) {
  28058. workInProgress.updateQueue = newThennables;
  28059. workInProgress.effectTag |= Update;
  28060. } // Rerender the whole list, but this time, we'll force fallbacks
  28061. // to stay in place.
  28062. // Reset the effect list before doing the second pass since that's now invalid.
  28063. if (renderState.lastEffect === null) {
  28064. workInProgress.firstEffect = null;
  28065. }
  28066. workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
  28067. resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
  28068. // rerender the children.
  28069. pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
  28070. return workInProgress.child;
  28071. }
  28072. row = row.sibling;
  28073. }
  28074. }
  28075. } else {
  28076. cutOffTailIfNeeded(renderState, false);
  28077. } // Next we're going to render the tail.
  28078. } else {
  28079. // Append the rendered row to the child list.
  28080. if (!didSuspendAlready) {
  28081. var _suspended = findFirstSuspended(renderedTail);
  28082. if (_suspended !== null) {
  28083. workInProgress.effectTag |= DidCapture;
  28084. didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
  28085. // get lost if this row ends up dropped during a second pass.
  28086. var _newThennables = _suspended.updateQueue;
  28087. if (_newThennables !== null) {
  28088. workInProgress.updateQueue = _newThennables;
  28089. workInProgress.effectTag |= Update;
  28090. }
  28091. cutOffTailIfNeeded(renderState, true); // This might have been modified.
  28092. if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
  28093. // We need to delete the row we just rendered.
  28094. // Reset the effect list to what it was before we rendered this
  28095. // child. The nested children have already appended themselves.
  28096. var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
  28097. if (lastEffect !== null) {
  28098. lastEffect.nextEffect = null;
  28099. } // We're done.
  28100. return null;
  28101. }
  28102. } else if ( // The time it took to render last row is greater than time until
  28103. // the expiration.
  28104. now() * 2 - renderState.renderingStartTime > renderState.tailExpiration && renderExpirationTime > Never) {
  28105. // We have now passed our CPU deadline and we'll just give up further
  28106. // attempts to render the main content and only render fallbacks.
  28107. // The assumption is that this is usually faster.
  28108. workInProgress.effectTag |= DidCapture;
  28109. didSuspendAlready = true;
  28110. cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
  28111. // to get it started back up to attempt the next item. If we can show
  28112. // them, then they really have the same priority as this render.
  28113. // So we'll pick it back up the very next render pass once we've had
  28114. // an opportunity to yield for paint.
  28115. var nextPriority = renderExpirationTime - 1;
  28116. workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority;
  28117. {
  28118. markSpawnedWork(nextPriority);
  28119. }
  28120. }
  28121. }
  28122. if (renderState.isBackwards) {
  28123. // The effect list of the backwards tail will have been added
  28124. // to the end. This breaks the guarantee that life-cycles fire in
  28125. // sibling order but that isn't a strong guarantee promised by React.
  28126. // Especially since these might also just pop in during future commits.
  28127. // Append to the beginning of the list.
  28128. renderedTail.sibling = workInProgress.child;
  28129. workInProgress.child = renderedTail;
  28130. } else {
  28131. var previousSibling = renderState.last;
  28132. if (previousSibling !== null) {
  28133. previousSibling.sibling = renderedTail;
  28134. } else {
  28135. workInProgress.child = renderedTail;
  28136. }
  28137. renderState.last = renderedTail;
  28138. }
  28139. }
  28140. if (renderState.tail !== null) {
  28141. // We still have tail rows to render.
  28142. if (renderState.tailExpiration === 0) {
  28143. // Heuristic for how long we're willing to spend rendering rows
  28144. // until we just give up and show what we have so far.
  28145. var TAIL_EXPIRATION_TIMEOUT_MS = 500;
  28146. renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; // TODO: This is meant to mimic the train model or JND but this
  28147. // is a per component value. It should really be since the start
  28148. // of the total render or last commit. Consider using something like
  28149. // globalMostRecentFallbackTime. That doesn't account for being
  28150. // suspended for part of the time or when it's a new render.
  28151. // It should probably use a global start time value instead.
  28152. } // Pop a row.
  28153. var next = renderState.tail;
  28154. renderState.rendering = next;
  28155. renderState.tail = next.sibling;
  28156. renderState.lastEffect = workInProgress.lastEffect;
  28157. renderState.renderingStartTime = now();
  28158. next.sibling = null; // Restore the context.
  28159. // TODO: We can probably just avoid popping it instead and only
  28160. // setting it the first time we go from not suspended to suspended.
  28161. var suspenseContext = suspenseStackCursor.current;
  28162. if (didSuspendAlready) {
  28163. suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
  28164. } else {
  28165. suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
  28166. }
  28167. pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row.
  28168. return next;
  28169. }
  28170. return null;
  28171. }
  28172. }
  28173. {
  28174. {
  28175. throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
  28176. }
  28177. }
  28178. }
  28179. function unwindWork(workInProgress, renderExpirationTime) {
  28180. switch (workInProgress.tag) {
  28181. case ClassComponent:
  28182. {
  28183. var Component = workInProgress.type;
  28184. if (isContextProvider(Component)) {
  28185. popContext(workInProgress);
  28186. }
  28187. var effectTag = workInProgress.effectTag;
  28188. if (effectTag & ShouldCapture) {
  28189. workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
  28190. return workInProgress;
  28191. }
  28192. return null;
  28193. }
  28194. case HostRoot:
  28195. {
  28196. popHostContainer(workInProgress);
  28197. popTopLevelContextObject(workInProgress);
  28198. var _effectTag = workInProgress.effectTag;
  28199. if (!((_effectTag & DidCapture) === NoEffect)) {
  28200. {
  28201. throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." );
  28202. }
  28203. }
  28204. workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
  28205. return workInProgress;
  28206. }
  28207. case HostComponent:
  28208. {
  28209. // TODO: popHydrationState
  28210. popHostContext(workInProgress);
  28211. return null;
  28212. }
  28213. case SuspenseComponent:
  28214. {
  28215. popSuspenseContext(workInProgress);
  28216. var _effectTag2 = workInProgress.effectTag;
  28217. if (_effectTag2 & ShouldCapture) {
  28218. workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
  28219. return workInProgress;
  28220. }
  28221. return null;
  28222. }
  28223. case SuspenseListComponent:
  28224. {
  28225. popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been
  28226. // caught by a nested boundary. If not, it should bubble through.
  28227. return null;
  28228. }
  28229. case HostPortal:
  28230. popHostContainer(workInProgress);
  28231. return null;
  28232. case ContextProvider:
  28233. popProvider(workInProgress);
  28234. return null;
  28235. default:
  28236. return null;
  28237. }
  28238. }
  28239. function unwindInterruptedWork(interruptedWork) {
  28240. switch (interruptedWork.tag) {
  28241. case ClassComponent:
  28242. {
  28243. var childContextTypes = interruptedWork.type.childContextTypes;
  28244. if (childContextTypes !== null && childContextTypes !== undefined) {
  28245. popContext(interruptedWork);
  28246. }
  28247. break;
  28248. }
  28249. case HostRoot:
  28250. {
  28251. popHostContainer(interruptedWork);
  28252. popTopLevelContextObject(interruptedWork);
  28253. break;
  28254. }
  28255. case HostComponent:
  28256. {
  28257. popHostContext(interruptedWork);
  28258. break;
  28259. }
  28260. case HostPortal:
  28261. popHostContainer(interruptedWork);
  28262. break;
  28263. case SuspenseComponent:
  28264. popSuspenseContext(interruptedWork);
  28265. break;
  28266. case SuspenseListComponent:
  28267. popSuspenseContext(interruptedWork);
  28268. break;
  28269. case ContextProvider:
  28270. popProvider(interruptedWork);
  28271. break;
  28272. }
  28273. }
  28274. function createCapturedValue(value, source) {
  28275. // If the value is an error, call this function immediately after it is thrown
  28276. // so the stack is accurate.
  28277. return {
  28278. value: value,
  28279. source: source,
  28280. stack: getStackByFiberInDevAndProd(source)
  28281. };
  28282. }
  28283. function logCapturedError(capturedError) {
  28284. var error = capturedError.error;
  28285. {
  28286. var componentName = capturedError.componentName,
  28287. componentStack = capturedError.componentStack,
  28288. errorBoundaryName = capturedError.errorBoundaryName,
  28289. errorBoundaryFound = capturedError.errorBoundaryFound,
  28290. willRetry = capturedError.willRetry; // Browsers support silencing uncaught errors by calling
  28291. // `preventDefault()` in window `error` handler.
  28292. // We record this information as an expando on the error.
  28293. if (error != null && error._suppressLogging) {
  28294. if (errorBoundaryFound && willRetry) {
  28295. // The error is recoverable and was silenced.
  28296. // Ignore it and don't print the stack addendum.
  28297. // This is handy for testing error boundaries without noise.
  28298. return;
  28299. } // The error is fatal. Since the silencing might have
  28300. // been accidental, we'll surface it anyway.
  28301. // However, the browser would have silenced the original error
  28302. // so we'll print it first, and then print the stack addendum.
  28303. console['error'](error); // Don't transform to our wrapper
  28304. // For a more detailed description of this block, see:
  28305. // https://github.com/facebook/react/pull/13384
  28306. }
  28307. var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:';
  28308. var errorBoundaryMessage; // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
  28309. if (errorBoundaryFound && errorBoundaryName) {
  28310. if (willRetry) {
  28311. errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
  28312. } else {
  28313. errorBoundaryMessage = "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree.";
  28314. }
  28315. } else {
  28316. errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
  28317. }
  28318. var combinedMessage = "" + componentNameMessage + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack.
  28319. // We don't include the original error message and JS stack because the browser
  28320. // has already printed it. Even if the application swallows the error, it is still
  28321. // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
  28322. console['error'](combinedMessage); // Don't transform to our wrapper
  28323. }
  28324. }
  28325. var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
  28326. {
  28327. didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
  28328. }
  28329. var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
  28330. function logError(boundary, errorInfo) {
  28331. var source = errorInfo.source;
  28332. var stack = errorInfo.stack;
  28333. if (stack === null && source !== null) {
  28334. stack = getStackByFiberInDevAndProd(source);
  28335. }
  28336. var capturedError = {
  28337. componentName: source !== null ? getComponentName(source.type) : null,
  28338. componentStack: stack !== null ? stack : '',
  28339. error: errorInfo.value,
  28340. errorBoundary: null,
  28341. errorBoundaryName: null,
  28342. errorBoundaryFound: false,
  28343. willRetry: false
  28344. };
  28345. if (boundary !== null && boundary.tag === ClassComponent) {
  28346. capturedError.errorBoundary = boundary.stateNode;
  28347. capturedError.errorBoundaryName = getComponentName(boundary.type);
  28348. capturedError.errorBoundaryFound = true;
  28349. capturedError.willRetry = true;
  28350. }
  28351. try {
  28352. logCapturedError(capturedError);
  28353. } catch (e) {
  28354. // This method must not throw, or React internal state will get messed up.
  28355. // If console.error is overridden, or logCapturedError() shows a dialog that throws,
  28356. // we want to report this error outside of the normal stack as a last resort.
  28357. // https://github.com/facebook/react/issues/13188
  28358. setTimeout(function () {
  28359. throw e;
  28360. });
  28361. }
  28362. }
  28363. var callComponentWillUnmountWithTimer = function (current, instance) {
  28364. startPhaseTimer(current, 'componentWillUnmount');
  28365. instance.props = current.memoizedProps;
  28366. instance.state = current.memoizedState;
  28367. instance.componentWillUnmount();
  28368. stopPhaseTimer();
  28369. }; // Capture errors so they don't interrupt unmounting.
  28370. function safelyCallComponentWillUnmount(current, instance) {
  28371. {
  28372. invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance);
  28373. if (hasCaughtError()) {
  28374. var unmountError = clearCaughtError();
  28375. captureCommitPhaseError(current, unmountError);
  28376. }
  28377. }
  28378. }
  28379. function safelyDetachRef(current) {
  28380. var ref = current.ref;
  28381. if (ref !== null) {
  28382. if (typeof ref === 'function') {
  28383. {
  28384. invokeGuardedCallback(null, ref, null, null);
  28385. if (hasCaughtError()) {
  28386. var refError = clearCaughtError();
  28387. captureCommitPhaseError(current, refError);
  28388. }
  28389. }
  28390. } else {
  28391. ref.current = null;
  28392. }
  28393. }
  28394. }
  28395. function safelyCallDestroy(current, destroy) {
  28396. {
  28397. invokeGuardedCallback(null, destroy, null);
  28398. if (hasCaughtError()) {
  28399. var error = clearCaughtError();
  28400. captureCommitPhaseError(current, error);
  28401. }
  28402. }
  28403. }
  28404. function commitBeforeMutationLifeCycles(current, finishedWork) {
  28405. switch (finishedWork.tag) {
  28406. case FunctionComponent:
  28407. case ForwardRef:
  28408. case SimpleMemoComponent:
  28409. case Block:
  28410. {
  28411. return;
  28412. }
  28413. case ClassComponent:
  28414. {
  28415. if (finishedWork.effectTag & Snapshot) {
  28416. if (current !== null) {
  28417. var prevProps = current.memoizedProps;
  28418. var prevState = current.memoizedState;
  28419. startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
  28420. var instance = finishedWork.stateNode; // We could update instance props and state here,
  28421. // but instead we rely on them being set during last render.
  28422. // TODO: revisit this when we implement resuming.
  28423. {
  28424. if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
  28425. if (instance.props !== finishedWork.memoizedProps) {
  28426. error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28427. }
  28428. if (instance.state !== finishedWork.memoizedState) {
  28429. error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28430. }
  28431. }
  28432. }
  28433. var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
  28434. {
  28435. var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
  28436. if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
  28437. didWarnSet.add(finishedWork.type);
  28438. error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
  28439. }
  28440. }
  28441. instance.__reactInternalSnapshotBeforeUpdate = snapshot;
  28442. stopPhaseTimer();
  28443. }
  28444. }
  28445. return;
  28446. }
  28447. case HostRoot:
  28448. case HostComponent:
  28449. case HostText:
  28450. case HostPortal:
  28451. case IncompleteClassComponent:
  28452. // Nothing to do for these component types
  28453. return;
  28454. }
  28455. {
  28456. {
  28457. throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
  28458. }
  28459. }
  28460. }
  28461. function commitHookEffectListUnmount(tag, finishedWork) {
  28462. var updateQueue = finishedWork.updateQueue;
  28463. var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
  28464. if (lastEffect !== null) {
  28465. var firstEffect = lastEffect.next;
  28466. var effect = firstEffect;
  28467. do {
  28468. if ((effect.tag & tag) === tag) {
  28469. // Unmount
  28470. var destroy = effect.destroy;
  28471. effect.destroy = undefined;
  28472. if (destroy !== undefined) {
  28473. destroy();
  28474. }
  28475. }
  28476. effect = effect.next;
  28477. } while (effect !== firstEffect);
  28478. }
  28479. }
  28480. function commitHookEffectListMount(tag, finishedWork) {
  28481. var updateQueue = finishedWork.updateQueue;
  28482. var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
  28483. if (lastEffect !== null) {
  28484. var firstEffect = lastEffect.next;
  28485. var effect = firstEffect;
  28486. do {
  28487. if ((effect.tag & tag) === tag) {
  28488. // Mount
  28489. var create = effect.create;
  28490. effect.destroy = create();
  28491. {
  28492. var destroy = effect.destroy;
  28493. if (destroy !== undefined && typeof destroy !== 'function') {
  28494. var addendum = void 0;
  28495. if (destroy === null) {
  28496. addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
  28497. } else if (typeof destroy.then === 'function') {
  28498. addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
  28499. } else {
  28500. addendum = ' You returned: ' + destroy;
  28501. }
  28502. error('An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
  28503. }
  28504. }
  28505. }
  28506. effect = effect.next;
  28507. } while (effect !== firstEffect);
  28508. }
  28509. }
  28510. function commitPassiveHookEffects(finishedWork) {
  28511. if ((finishedWork.effectTag & Passive) !== NoEffect) {
  28512. switch (finishedWork.tag) {
  28513. case FunctionComponent:
  28514. case ForwardRef:
  28515. case SimpleMemoComponent:
  28516. case Block:
  28517. {
  28518. // TODO (#17945) We should call all passive destroy functions (for all fibers)
  28519. // before calling any create functions. The current approach only serializes
  28520. // these for a single fiber.
  28521. commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork);
  28522. commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
  28523. break;
  28524. }
  28525. }
  28526. }
  28527. }
  28528. function commitLifeCycles(finishedRoot, current, finishedWork, committedExpirationTime) {
  28529. switch (finishedWork.tag) {
  28530. case FunctionComponent:
  28531. case ForwardRef:
  28532. case SimpleMemoComponent:
  28533. case Block:
  28534. {
  28535. // At this point layout effects have already been destroyed (during mutation phase).
  28536. // This is done to prevent sibling component effects from interfering with each other,
  28537. // e.g. a destroy function in one component should never override a ref set
  28538. // by a create function in another component during the same commit.
  28539. commitHookEffectListMount(Layout | HasEffect, finishedWork);
  28540. return;
  28541. }
  28542. case ClassComponent:
  28543. {
  28544. var instance = finishedWork.stateNode;
  28545. if (finishedWork.effectTag & Update) {
  28546. if (current === null) {
  28547. startPhaseTimer(finishedWork, 'componentDidMount'); // We could update instance props and state here,
  28548. // but instead we rely on them being set during last render.
  28549. // TODO: revisit this when we implement resuming.
  28550. {
  28551. if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
  28552. if (instance.props !== finishedWork.memoizedProps) {
  28553. error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28554. }
  28555. if (instance.state !== finishedWork.memoizedState) {
  28556. error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28557. }
  28558. }
  28559. }
  28560. instance.componentDidMount();
  28561. stopPhaseTimer();
  28562. } else {
  28563. var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps);
  28564. var prevState = current.memoizedState;
  28565. startPhaseTimer(finishedWork, 'componentDidUpdate'); // We could update instance props and state here,
  28566. // but instead we rely on them being set during last render.
  28567. // TODO: revisit this when we implement resuming.
  28568. {
  28569. if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
  28570. if (instance.props !== finishedWork.memoizedProps) {
  28571. error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28572. }
  28573. if (instance.state !== finishedWork.memoizedState) {
  28574. error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28575. }
  28576. }
  28577. }
  28578. instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
  28579. stopPhaseTimer();
  28580. }
  28581. }
  28582. var updateQueue = finishedWork.updateQueue;
  28583. if (updateQueue !== null) {
  28584. {
  28585. if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
  28586. if (instance.props !== finishedWork.memoizedProps) {
  28587. error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28588. }
  28589. if (instance.state !== finishedWork.memoizedState) {
  28590. error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
  28591. }
  28592. }
  28593. } // We could update instance props and state here,
  28594. // but instead we rely on them being set during last render.
  28595. // TODO: revisit this when we implement resuming.
  28596. commitUpdateQueue(finishedWork, updateQueue, instance);
  28597. }
  28598. return;
  28599. }
  28600. case HostRoot:
  28601. {
  28602. var _updateQueue = finishedWork.updateQueue;
  28603. if (_updateQueue !== null) {
  28604. var _instance = null;
  28605. if (finishedWork.child !== null) {
  28606. switch (finishedWork.child.tag) {
  28607. case HostComponent:
  28608. _instance = getPublicInstance(finishedWork.child.stateNode);
  28609. break;
  28610. case ClassComponent:
  28611. _instance = finishedWork.child.stateNode;
  28612. break;
  28613. }
  28614. }
  28615. commitUpdateQueue(finishedWork, _updateQueue, _instance);
  28616. }
  28617. return;
  28618. }
  28619. case HostComponent:
  28620. {
  28621. var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted
  28622. // (eg DOM renderer may schedule auto-focus for inputs and form controls).
  28623. // These effects should only be committed when components are first mounted,
  28624. // aka when there is no current/alternate.
  28625. if (current === null && finishedWork.effectTag & Update) {
  28626. var type = finishedWork.type;
  28627. var props = finishedWork.memoizedProps;
  28628. commitMount(_instance2, type, props);
  28629. }
  28630. return;
  28631. }
  28632. case HostText:
  28633. {
  28634. // We have no life-cycles associated with text.
  28635. return;
  28636. }
  28637. case HostPortal:
  28638. {
  28639. // We have no life-cycles associated with portals.
  28640. return;
  28641. }
  28642. case Profiler:
  28643. {
  28644. {
  28645. var onRender = finishedWork.memoizedProps.onRender;
  28646. if (typeof onRender === 'function') {
  28647. {
  28648. onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
  28649. }
  28650. }
  28651. }
  28652. return;
  28653. }
  28654. case SuspenseComponent:
  28655. {
  28656. commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
  28657. return;
  28658. }
  28659. case SuspenseListComponent:
  28660. case IncompleteClassComponent:
  28661. case FundamentalComponent:
  28662. case ScopeComponent:
  28663. return;
  28664. }
  28665. {
  28666. {
  28667. throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
  28668. }
  28669. }
  28670. }
  28671. function hideOrUnhideAllChildren(finishedWork, isHidden) {
  28672. {
  28673. // We only have the top Fiber that was inserted but we need to recurse down its
  28674. // children to find all the terminal nodes.
  28675. var node = finishedWork;
  28676. while (true) {
  28677. if (node.tag === HostComponent) {
  28678. var instance = node.stateNode;
  28679. if (isHidden) {
  28680. hideInstance(instance);
  28681. } else {
  28682. unhideInstance(node.stateNode, node.memoizedProps);
  28683. }
  28684. } else if (node.tag === HostText) {
  28685. var _instance3 = node.stateNode;
  28686. if (isHidden) {
  28687. hideTextInstance(_instance3);
  28688. } else {
  28689. unhideTextInstance(_instance3, node.memoizedProps);
  28690. }
  28691. } else if (node.tag === SuspenseComponent && node.memoizedState !== null && node.memoizedState.dehydrated === null) {
  28692. // Found a nested Suspense component that timed out. Skip over the
  28693. // primary child fragment, which should remain hidden.
  28694. var fallbackChildFragment = node.child.sibling;
  28695. fallbackChildFragment.return = node;
  28696. node = fallbackChildFragment;
  28697. continue;
  28698. } else if (node.child !== null) {
  28699. node.child.return = node;
  28700. node = node.child;
  28701. continue;
  28702. }
  28703. if (node === finishedWork) {
  28704. return;
  28705. }
  28706. while (node.sibling === null) {
  28707. if (node.return === null || node.return === finishedWork) {
  28708. return;
  28709. }
  28710. node = node.return;
  28711. }
  28712. node.sibling.return = node.return;
  28713. node = node.sibling;
  28714. }
  28715. }
  28716. }
  28717. function commitAttachRef(finishedWork) {
  28718. var ref = finishedWork.ref;
  28719. if (ref !== null) {
  28720. var instance = finishedWork.stateNode;
  28721. var instanceToUse;
  28722. switch (finishedWork.tag) {
  28723. case HostComponent:
  28724. instanceToUse = getPublicInstance(instance);
  28725. break;
  28726. default:
  28727. instanceToUse = instance;
  28728. } // Moved outside to ensure DCE works with this flag
  28729. if (typeof ref === 'function') {
  28730. ref(instanceToUse);
  28731. } else {
  28732. {
  28733. if (!ref.hasOwnProperty('current')) {
  28734. error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
  28735. }
  28736. }
  28737. ref.current = instanceToUse;
  28738. }
  28739. }
  28740. }
  28741. function commitDetachRef(current) {
  28742. var currentRef = current.ref;
  28743. if (currentRef !== null) {
  28744. if (typeof currentRef === 'function') {
  28745. currentRef(null);
  28746. } else {
  28747. currentRef.current = null;
  28748. }
  28749. }
  28750. } // User-originating errors (lifecycles and refs) should not interrupt
  28751. // deletion, so don't let them throw. Host-originating errors should
  28752. // interrupt deletion, so it's okay
  28753. function commitUnmount(finishedRoot, current, renderPriorityLevel) {
  28754. onCommitUnmount(current);
  28755. switch (current.tag) {
  28756. case FunctionComponent:
  28757. case ForwardRef:
  28758. case MemoComponent:
  28759. case SimpleMemoComponent:
  28760. case Block:
  28761. {
  28762. var updateQueue = current.updateQueue;
  28763. if (updateQueue !== null) {
  28764. var lastEffect = updateQueue.lastEffect;
  28765. if (lastEffect !== null) {
  28766. var firstEffect = lastEffect.next;
  28767. {
  28768. // When the owner fiber is deleted, the destroy function of a passive
  28769. // effect hook is called during the synchronous commit phase. This is
  28770. // a concession to implementation complexity. Calling it in the
  28771. // passive effect phase (like they usually are, when dependencies
  28772. // change during an update) would require either traversing the
  28773. // children of the deleted fiber again, or including unmount effects
  28774. // as part of the fiber effect list.
  28775. //
  28776. // Because this is during the sync commit phase, we need to change
  28777. // the priority.
  28778. //
  28779. // TODO: Reconsider this implementation trade off.
  28780. var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
  28781. runWithPriority$1(priorityLevel, function () {
  28782. var effect = firstEffect;
  28783. do {
  28784. var _destroy = effect.destroy;
  28785. if (_destroy !== undefined) {
  28786. safelyCallDestroy(current, _destroy);
  28787. }
  28788. effect = effect.next;
  28789. } while (effect !== firstEffect);
  28790. });
  28791. }
  28792. }
  28793. }
  28794. return;
  28795. }
  28796. case ClassComponent:
  28797. {
  28798. safelyDetachRef(current);
  28799. var instance = current.stateNode;
  28800. if (typeof instance.componentWillUnmount === 'function') {
  28801. safelyCallComponentWillUnmount(current, instance);
  28802. }
  28803. return;
  28804. }
  28805. case HostComponent:
  28806. {
  28807. safelyDetachRef(current);
  28808. return;
  28809. }
  28810. case HostPortal:
  28811. {
  28812. // TODO: this is recursive.
  28813. // We are also not using this parent because
  28814. // the portal will get pushed immediately.
  28815. {
  28816. unmountHostComponents(finishedRoot, current, renderPriorityLevel);
  28817. }
  28818. return;
  28819. }
  28820. case FundamentalComponent:
  28821. {
  28822. return;
  28823. }
  28824. case DehydratedFragment:
  28825. {
  28826. return;
  28827. }
  28828. case ScopeComponent:
  28829. {
  28830. return;
  28831. }
  28832. }
  28833. }
  28834. function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
  28835. // While we're inside a removed host node we don't want to call
  28836. // removeChild on the inner nodes because they're removed by the top
  28837. // call anyway. We also want to call componentWillUnmount on all
  28838. // composites before this host node is removed from the tree. Therefore
  28839. // we do an inner loop while we're still inside the host node.
  28840. var node = root;
  28841. while (true) {
  28842. commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes.
  28843. // Skip portals because commitUnmount() currently visits them recursively.
  28844. if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
  28845. // If we don't use mutation we drill down into portals here instead.
  28846. node.tag !== HostPortal)) {
  28847. node.child.return = node;
  28848. node = node.child;
  28849. continue;
  28850. }
  28851. if (node === root) {
  28852. return;
  28853. }
  28854. while (node.sibling === null) {
  28855. if (node.return === null || node.return === root) {
  28856. return;
  28857. }
  28858. node = node.return;
  28859. }
  28860. node.sibling.return = node.return;
  28861. node = node.sibling;
  28862. }
  28863. }
  28864. function detachFiber(current) {
  28865. var alternate = current.alternate; // Cut off the return pointers to disconnect it from the tree. Ideally, we
  28866. // should clear the child pointer of the parent alternate to let this
  28867. // get GC:ed but we don't know which for sure which parent is the current
  28868. // one so we'll settle for GC:ing the subtree of this child. This child
  28869. // itself will be GC:ed when the parent updates the next time.
  28870. current.return = null;
  28871. current.child = null;
  28872. current.memoizedState = null;
  28873. current.updateQueue = null;
  28874. current.dependencies = null;
  28875. current.alternate = null;
  28876. current.firstEffect = null;
  28877. current.lastEffect = null;
  28878. current.pendingProps = null;
  28879. current.memoizedProps = null;
  28880. current.stateNode = null;
  28881. if (alternate !== null) {
  28882. detachFiber(alternate);
  28883. }
  28884. }
  28885. function getHostParentFiber(fiber) {
  28886. var parent = fiber.return;
  28887. while (parent !== null) {
  28888. if (isHostParent(parent)) {
  28889. return parent;
  28890. }
  28891. parent = parent.return;
  28892. }
  28893. {
  28894. {
  28895. throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
  28896. }
  28897. }
  28898. }
  28899. function isHostParent(fiber) {
  28900. return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
  28901. }
  28902. function getHostSibling(fiber) {
  28903. // We're going to search forward into the tree until we find a sibling host
  28904. // node. Unfortunately, if multiple insertions are done in a row we have to
  28905. // search past them. This leads to exponential search for the next sibling.
  28906. // TODO: Find a more efficient way to do this.
  28907. var node = fiber;
  28908. siblings: while (true) {
  28909. // If we didn't find anything, let's try the next sibling.
  28910. while (node.sibling === null) {
  28911. if (node.return === null || isHostParent(node.return)) {
  28912. // If we pop out of the root or hit the parent the fiber we are the
  28913. // last sibling.
  28914. return null;
  28915. }
  28916. node = node.return;
  28917. }
  28918. node.sibling.return = node.return;
  28919. node = node.sibling;
  28920. while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
  28921. // If it is not host node and, we might have a host node inside it.
  28922. // Try to search down until we find one.
  28923. if (node.effectTag & Placement) {
  28924. // If we don't have a child, try the siblings instead.
  28925. continue siblings;
  28926. } // If we don't have a child, try the siblings instead.
  28927. // We also skip portals because they are not part of this host tree.
  28928. if (node.child === null || node.tag === HostPortal) {
  28929. continue siblings;
  28930. } else {
  28931. node.child.return = node;
  28932. node = node.child;
  28933. }
  28934. } // Check if this host node is stable or about to be placed.
  28935. if (!(node.effectTag & Placement)) {
  28936. // Found it!
  28937. return node.stateNode;
  28938. }
  28939. }
  28940. }
  28941. function commitPlacement(finishedWork) {
  28942. var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together.
  28943. var parent;
  28944. var isContainer;
  28945. var parentStateNode = parentFiber.stateNode;
  28946. switch (parentFiber.tag) {
  28947. case HostComponent:
  28948. parent = parentStateNode;
  28949. isContainer = false;
  28950. break;
  28951. case HostRoot:
  28952. parent = parentStateNode.containerInfo;
  28953. isContainer = true;
  28954. break;
  28955. case HostPortal:
  28956. parent = parentStateNode.containerInfo;
  28957. isContainer = true;
  28958. break;
  28959. case FundamentalComponent:
  28960. // eslint-disable-next-line-no-fallthrough
  28961. default:
  28962. {
  28963. {
  28964. throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." );
  28965. }
  28966. }
  28967. }
  28968. if (parentFiber.effectTag & ContentReset) {
  28969. // Reset the text content of the parent before doing any insertions
  28970. resetTextContent(parent); // Clear ContentReset from the effect tag
  28971. parentFiber.effectTag &= ~ContentReset;
  28972. }
  28973. var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
  28974. // children to find all the terminal nodes.
  28975. if (isContainer) {
  28976. insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
  28977. } else {
  28978. insertOrAppendPlacementNode(finishedWork, before, parent);
  28979. }
  28980. }
  28981. function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
  28982. var tag = node.tag;
  28983. var isHost = tag === HostComponent || tag === HostText;
  28984. if (isHost || enableFundamentalAPI ) {
  28985. var stateNode = isHost ? node.stateNode : node.stateNode.instance;
  28986. if (before) {
  28987. insertInContainerBefore(parent, stateNode, before);
  28988. } else {
  28989. appendChildToContainer(parent, stateNode);
  28990. }
  28991. } else if (tag === HostPortal) ; else {
  28992. var child = node.child;
  28993. if (child !== null) {
  28994. insertOrAppendPlacementNodeIntoContainer(child, before, parent);
  28995. var sibling = child.sibling;
  28996. while (sibling !== null) {
  28997. insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
  28998. sibling = sibling.sibling;
  28999. }
  29000. }
  29001. }
  29002. }
  29003. function insertOrAppendPlacementNode(node, before, parent) {
  29004. var tag = node.tag;
  29005. var isHost = tag === HostComponent || tag === HostText;
  29006. if (isHost || enableFundamentalAPI ) {
  29007. var stateNode = isHost ? node.stateNode : node.stateNode.instance;
  29008. if (before) {
  29009. insertBefore(parent, stateNode, before);
  29010. } else {
  29011. appendChild(parent, stateNode);
  29012. }
  29013. } else if (tag === HostPortal) ; else {
  29014. var child = node.child;
  29015. if (child !== null) {
  29016. insertOrAppendPlacementNode(child, before, parent);
  29017. var sibling = child.sibling;
  29018. while (sibling !== null) {
  29019. insertOrAppendPlacementNode(sibling, before, parent);
  29020. sibling = sibling.sibling;
  29021. }
  29022. }
  29023. }
  29024. }
  29025. function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
  29026. // We only have the top Fiber that was deleted but we need to recurse down its
  29027. // children to find all the terminal nodes.
  29028. var node = current; // Each iteration, currentParent is populated with node's host parent if not
  29029. // currentParentIsValid.
  29030. var currentParentIsValid = false; // Note: these two variables *must* always be updated together.
  29031. var currentParent;
  29032. var currentParentIsContainer;
  29033. while (true) {
  29034. if (!currentParentIsValid) {
  29035. var parent = node.return;
  29036. findParent: while (true) {
  29037. if (!(parent !== null)) {
  29038. {
  29039. throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
  29040. }
  29041. }
  29042. var parentStateNode = parent.stateNode;
  29043. switch (parent.tag) {
  29044. case HostComponent:
  29045. currentParent = parentStateNode;
  29046. currentParentIsContainer = false;
  29047. break findParent;
  29048. case HostRoot:
  29049. currentParent = parentStateNode.containerInfo;
  29050. currentParentIsContainer = true;
  29051. break findParent;
  29052. case HostPortal:
  29053. currentParent = parentStateNode.containerInfo;
  29054. currentParentIsContainer = true;
  29055. break findParent;
  29056. }
  29057. parent = parent.return;
  29058. }
  29059. currentParentIsValid = true;
  29060. }
  29061. if (node.tag === HostComponent || node.tag === HostText) {
  29062. commitNestedUnmounts(finishedRoot, node, renderPriorityLevel); // After all the children have unmounted, it is now safe to remove the
  29063. // node from the tree.
  29064. if (currentParentIsContainer) {
  29065. removeChildFromContainer(currentParent, node.stateNode);
  29066. } else {
  29067. removeChild(currentParent, node.stateNode);
  29068. } // Don't visit children because we already visited them.
  29069. } else if (node.tag === HostPortal) {
  29070. if (node.child !== null) {
  29071. // When we go into a portal, it becomes the parent to remove from.
  29072. // We will reassign it back when we pop the portal on the way up.
  29073. currentParent = node.stateNode.containerInfo;
  29074. currentParentIsContainer = true; // Visit children because portals might contain host components.
  29075. node.child.return = node;
  29076. node = node.child;
  29077. continue;
  29078. }
  29079. } else {
  29080. commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because we may find more host components below.
  29081. if (node.child !== null) {
  29082. node.child.return = node;
  29083. node = node.child;
  29084. continue;
  29085. }
  29086. }
  29087. if (node === current) {
  29088. return;
  29089. }
  29090. while (node.sibling === null) {
  29091. if (node.return === null || node.return === current) {
  29092. return;
  29093. }
  29094. node = node.return;
  29095. if (node.tag === HostPortal) {
  29096. // When we go out of the portal, we need to restore the parent.
  29097. // Since we don't keep a stack of them, we will search for it.
  29098. currentParentIsValid = false;
  29099. }
  29100. }
  29101. node.sibling.return = node.return;
  29102. node = node.sibling;
  29103. }
  29104. }
  29105. function commitDeletion(finishedRoot, current, renderPriorityLevel) {
  29106. {
  29107. // Recursively delete all host nodes from the parent.
  29108. // Detach refs and call componentWillUnmount() on the whole subtree.
  29109. unmountHostComponents(finishedRoot, current, renderPriorityLevel);
  29110. }
  29111. detachFiber(current);
  29112. }
  29113. function commitWork(current, finishedWork) {
  29114. switch (finishedWork.tag) {
  29115. case FunctionComponent:
  29116. case ForwardRef:
  29117. case MemoComponent:
  29118. case SimpleMemoComponent:
  29119. case Block:
  29120. {
  29121. // Layout effects are destroyed during the mutation phase so that all
  29122. // destroy functions for all fibers are called before any create functions.
  29123. // This prevents sibling component effects from interfering with each other,
  29124. // e.g. a destroy function in one component should never override a ref set
  29125. // by a create function in another component during the same commit.
  29126. commitHookEffectListUnmount(Layout | HasEffect, finishedWork);
  29127. return;
  29128. }
  29129. case ClassComponent:
  29130. {
  29131. return;
  29132. }
  29133. case HostComponent:
  29134. {
  29135. var instance = finishedWork.stateNode;
  29136. if (instance != null) {
  29137. // Commit the work prepared earlier.
  29138. var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
  29139. // as the newProps. The updatePayload will contain the real change in
  29140. // this case.
  29141. var oldProps = current !== null ? current.memoizedProps : newProps;
  29142. var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components.
  29143. var updatePayload = finishedWork.updateQueue;
  29144. finishedWork.updateQueue = null;
  29145. if (updatePayload !== null) {
  29146. commitUpdate(instance, updatePayload, type, oldProps, newProps);
  29147. }
  29148. }
  29149. return;
  29150. }
  29151. case HostText:
  29152. {
  29153. if (!(finishedWork.stateNode !== null)) {
  29154. {
  29155. throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." );
  29156. }
  29157. }
  29158. var textInstance = finishedWork.stateNode;
  29159. var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
  29160. // as the newProps. The updatePayload will contain the real change in
  29161. // this case.
  29162. var oldText = current !== null ? current.memoizedProps : newText;
  29163. commitTextUpdate(textInstance, oldText, newText);
  29164. return;
  29165. }
  29166. case HostRoot:
  29167. {
  29168. {
  29169. var _root = finishedWork.stateNode;
  29170. if (_root.hydrate) {
  29171. // We've just hydrated. No need to hydrate again.
  29172. _root.hydrate = false;
  29173. commitHydratedContainer(_root.containerInfo);
  29174. }
  29175. }
  29176. return;
  29177. }
  29178. case Profiler:
  29179. {
  29180. return;
  29181. }
  29182. case SuspenseComponent:
  29183. {
  29184. commitSuspenseComponent(finishedWork);
  29185. attachSuspenseRetryListeners(finishedWork);
  29186. return;
  29187. }
  29188. case SuspenseListComponent:
  29189. {
  29190. attachSuspenseRetryListeners(finishedWork);
  29191. return;
  29192. }
  29193. case IncompleteClassComponent:
  29194. {
  29195. return;
  29196. }
  29197. }
  29198. {
  29199. {
  29200. throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
  29201. }
  29202. }
  29203. }
  29204. function commitSuspenseComponent(finishedWork) {
  29205. var newState = finishedWork.memoizedState;
  29206. var newDidTimeout;
  29207. var primaryChildParent = finishedWork;
  29208. if (newState === null) {
  29209. newDidTimeout = false;
  29210. } else {
  29211. newDidTimeout = true;
  29212. primaryChildParent = finishedWork.child;
  29213. markCommitTimeOfFallback();
  29214. }
  29215. if ( primaryChildParent !== null) {
  29216. hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
  29217. }
  29218. }
  29219. function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
  29220. var newState = finishedWork.memoizedState;
  29221. if (newState === null) {
  29222. var current = finishedWork.alternate;
  29223. if (current !== null) {
  29224. var prevState = current.memoizedState;
  29225. if (prevState !== null) {
  29226. var suspenseInstance = prevState.dehydrated;
  29227. if (suspenseInstance !== null) {
  29228. commitHydratedSuspenseInstance(suspenseInstance);
  29229. }
  29230. }
  29231. }
  29232. }
  29233. }
  29234. function attachSuspenseRetryListeners(finishedWork) {
  29235. // If this boundary just timed out, then it will have a set of thenables.
  29236. // For each thenable, attach a listener so that when it resolves, React
  29237. // attempts to re-render the boundary in the primary (pre-timeout) state.
  29238. var thenables = finishedWork.updateQueue;
  29239. if (thenables !== null) {
  29240. finishedWork.updateQueue = null;
  29241. var retryCache = finishedWork.stateNode;
  29242. if (retryCache === null) {
  29243. retryCache = finishedWork.stateNode = new PossiblyWeakSet();
  29244. }
  29245. thenables.forEach(function (thenable) {
  29246. // Memoize using the boundary fiber to prevent redundant listeners.
  29247. var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
  29248. if (!retryCache.has(thenable)) {
  29249. {
  29250. if (thenable.__reactDoNotTraceInteractions !== true) {
  29251. retry = tracing.unstable_wrap(retry);
  29252. }
  29253. }
  29254. retryCache.add(thenable);
  29255. thenable.then(retry, retry);
  29256. }
  29257. });
  29258. }
  29259. }
  29260. function commitResetTextContent(current) {
  29261. resetTextContent(current.stateNode);
  29262. }
  29263. var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map;
  29264. function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
  29265. var update = createUpdate(expirationTime, null); // Unmount the root by rendering null.
  29266. update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property
  29267. // being called "element".
  29268. update.payload = {
  29269. element: null
  29270. };
  29271. var error = errorInfo.value;
  29272. update.callback = function () {
  29273. onUncaughtError(error);
  29274. logError(fiber, errorInfo);
  29275. };
  29276. return update;
  29277. }
  29278. function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
  29279. var update = createUpdate(expirationTime, null);
  29280. update.tag = CaptureUpdate;
  29281. var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
  29282. if (typeof getDerivedStateFromError === 'function') {
  29283. var error$1 = errorInfo.value;
  29284. update.payload = function () {
  29285. logError(fiber, errorInfo);
  29286. return getDerivedStateFromError(error$1);
  29287. };
  29288. }
  29289. var inst = fiber.stateNode;
  29290. if (inst !== null && typeof inst.componentDidCatch === 'function') {
  29291. update.callback = function callback() {
  29292. {
  29293. markFailedErrorBoundaryForHotReloading(fiber);
  29294. }
  29295. if (typeof getDerivedStateFromError !== 'function') {
  29296. // To preserve the preexisting retry behavior of error boundaries,
  29297. // we keep track of which ones already failed during this batch.
  29298. // This gets reset before we yield back to the browser.
  29299. // TODO: Warn in strict mode if getDerivedStateFromError is
  29300. // not defined.
  29301. markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined
  29302. logError(fiber, errorInfo);
  29303. }
  29304. var error$1 = errorInfo.value;
  29305. var stack = errorInfo.stack;
  29306. this.componentDidCatch(error$1, {
  29307. componentStack: stack !== null ? stack : ''
  29308. });
  29309. {
  29310. if (typeof getDerivedStateFromError !== 'function') {
  29311. // If componentDidCatch is the only error boundary method defined,
  29312. // then it needs to call setState to recover from errors.
  29313. // If no state update is scheduled then the boundary will swallow the error.
  29314. if (fiber.expirationTime !== Sync) {
  29315. error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown');
  29316. }
  29317. }
  29318. }
  29319. };
  29320. } else {
  29321. update.callback = function () {
  29322. markFailedErrorBoundaryForHotReloading(fiber);
  29323. };
  29324. }
  29325. return update;
  29326. }
  29327. function attachPingListener(root, renderExpirationTime, thenable) {
  29328. // Attach a listener to the promise to "ping" the root and retry. But
  29329. // only if one does not already exist for the current render expiration
  29330. // time (which acts like a "thread ID" here).
  29331. var pingCache = root.pingCache;
  29332. var threadIDs;
  29333. if (pingCache === null) {
  29334. pingCache = root.pingCache = new PossiblyWeakMap$1();
  29335. threadIDs = new Set();
  29336. pingCache.set(thenable, threadIDs);
  29337. } else {
  29338. threadIDs = pingCache.get(thenable);
  29339. if (threadIDs === undefined) {
  29340. threadIDs = new Set();
  29341. pingCache.set(thenable, threadIDs);
  29342. }
  29343. }
  29344. if (!threadIDs.has(renderExpirationTime)) {
  29345. // Memoize using the thread ID to prevent redundant listeners.
  29346. threadIDs.add(renderExpirationTime);
  29347. var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
  29348. thenable.then(ping, ping);
  29349. }
  29350. }
  29351. function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
  29352. // The source fiber did not complete.
  29353. sourceFiber.effectTag |= Incomplete; // Its effect list is no longer valid.
  29354. sourceFiber.firstEffect = sourceFiber.lastEffect = null;
  29355. if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
  29356. // This is a thenable.
  29357. var thenable = value;
  29358. if ((sourceFiber.mode & BlockingMode) === NoMode) {
  29359. // Reset the memoizedState to what it was before we attempted
  29360. // to render it.
  29361. var currentSource = sourceFiber.alternate;
  29362. if (currentSource) {
  29363. sourceFiber.updateQueue = currentSource.updateQueue;
  29364. sourceFiber.memoizedState = currentSource.memoizedState;
  29365. sourceFiber.expirationTime = currentSource.expirationTime;
  29366. } else {
  29367. sourceFiber.updateQueue = null;
  29368. sourceFiber.memoizedState = null;
  29369. }
  29370. }
  29371. var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view.
  29372. var _workInProgress = returnFiber;
  29373. do {
  29374. if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
  29375. // Found the nearest boundary.
  29376. // Stash the promise on the boundary fiber. If the boundary times out, we'll
  29377. // attach another listener to flip the boundary back to its normal state.
  29378. var thenables = _workInProgress.updateQueue;
  29379. if (thenables === null) {
  29380. var updateQueue = new Set();
  29381. updateQueue.add(thenable);
  29382. _workInProgress.updateQueue = updateQueue;
  29383. } else {
  29384. thenables.add(thenable);
  29385. } // If the boundary is outside of blocking mode, we should *not*
  29386. // suspend the commit. Pretend as if the suspended component rendered
  29387. // null and keep rendering. In the commit phase, we'll schedule a
  29388. // subsequent synchronous update to re-render the Suspense.
  29389. //
  29390. // Note: It doesn't matter whether the component that suspended was
  29391. // inside a blocking mode tree. If the Suspense is outside of it, we
  29392. // should *not* suspend the commit.
  29393. if ((_workInProgress.mode & BlockingMode) === NoMode) {
  29394. _workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
  29395. // But we shouldn't call any lifecycle methods or callbacks. Remove
  29396. // all lifecycle effect tags.
  29397. sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
  29398. if (sourceFiber.tag === ClassComponent) {
  29399. var currentSourceFiber = sourceFiber.alternate;
  29400. if (currentSourceFiber === null) {
  29401. // This is a new mount. Change the tag so it's not mistaken for a
  29402. // completed class component. For example, we should not call
  29403. // componentWillUnmount if it is deleted.
  29404. sourceFiber.tag = IncompleteClassComponent;
  29405. } else {
  29406. // When we try rendering again, we should not reuse the current fiber,
  29407. // since it's known to be in an inconsistent state. Use a force update to
  29408. // prevent a bail out.
  29409. var update = createUpdate(Sync, null);
  29410. update.tag = ForceUpdate;
  29411. enqueueUpdate(sourceFiber, update);
  29412. }
  29413. } // The source fiber did not complete. Mark it with Sync priority to
  29414. // indicate that it still has pending work.
  29415. sourceFiber.expirationTime = Sync; // Exit without suspending.
  29416. return;
  29417. } // Confirmed that the boundary is in a concurrent mode tree. Continue
  29418. // with the normal suspend path.
  29419. //
  29420. // After this we'll use a set of heuristics to determine whether this
  29421. // render pass will run to completion or restart or "suspend" the commit.
  29422. // The actual logic for this is spread out in different places.
  29423. //
  29424. // This first principle is that if we're going to suspend when we complete
  29425. // a root, then we should also restart if we get an update or ping that
  29426. // might unsuspend it, and vice versa. The only reason to suspend is
  29427. // because you think you might want to restart before committing. However,
  29428. // it doesn't make sense to restart only while in the period we're suspended.
  29429. //
  29430. // Restarting too aggressively is also not good because it starves out any
  29431. // intermediate loading state. So we use heuristics to determine when.
  29432. // Suspense Heuristics
  29433. //
  29434. // If nothing threw a Promise or all the same fallbacks are already showing,
  29435. // then don't suspend/restart.
  29436. //
  29437. // If this is an initial render of a new tree of Suspense boundaries and
  29438. // those trigger a fallback, then don't suspend/restart. We want to ensure
  29439. // that we can show the initial loading state as quickly as possible.
  29440. //
  29441. // If we hit a "Delayed" case, such as when we'd switch from content back into
  29442. // a fallback, then we should always suspend/restart. SuspenseConfig applies to
  29443. // this case. If none is defined, JND is used instead.
  29444. //
  29445. // If we're already showing a fallback and it gets "retried", allowing us to show
  29446. // another level, but there's still an inner boundary that would show a fallback,
  29447. // then we suspend/restart for 500ms since the last time we showed a fallback
  29448. // anywhere in the tree. This effectively throttles progressive loading into a
  29449. // consistent train of commits. This also gives us an opportunity to restart to
  29450. // get to the completed state slightly earlier.
  29451. //
  29452. // If there's ambiguity due to batching it's resolved in preference of:
  29453. // 1) "delayed", 2) "initial render", 3) "retry".
  29454. //
  29455. // We want to ensure that a "busy" state doesn't get force committed. We want to
  29456. // ensure that new initial loading states can commit as soon as possible.
  29457. attachPingListener(root, renderExpirationTime, thenable);
  29458. _workInProgress.effectTag |= ShouldCapture;
  29459. _workInProgress.expirationTime = renderExpirationTime;
  29460. return;
  29461. } // This boundary already captured during this render. Continue to the next
  29462. // boundary.
  29463. _workInProgress = _workInProgress.return;
  29464. } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode.
  29465. // TODO: Use invariant so the message is stripped in prod?
  29466. value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber));
  29467. } // We didn't find a boundary that could handle this type of exception. Start
  29468. // over and traverse parent path again, this time treating the exception
  29469. // as an error.
  29470. renderDidError();
  29471. value = createCapturedValue(value, sourceFiber);
  29472. var workInProgress = returnFiber;
  29473. do {
  29474. switch (workInProgress.tag) {
  29475. case HostRoot:
  29476. {
  29477. var _errorInfo = value;
  29478. workInProgress.effectTag |= ShouldCapture;
  29479. workInProgress.expirationTime = renderExpirationTime;
  29480. var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
  29481. enqueueCapturedUpdate(workInProgress, _update);
  29482. return;
  29483. }
  29484. case ClassComponent:
  29485. // Capture and retry
  29486. var errorInfo = value;
  29487. var ctor = workInProgress.type;
  29488. var instance = workInProgress.stateNode;
  29489. if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
  29490. workInProgress.effectTag |= ShouldCapture;
  29491. workInProgress.expirationTime = renderExpirationTime; // Schedule the error boundary to re-render using updated state
  29492. var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
  29493. enqueueCapturedUpdate(workInProgress, _update2);
  29494. return;
  29495. }
  29496. break;
  29497. }
  29498. workInProgress = workInProgress.return;
  29499. } while (workInProgress !== null);
  29500. }
  29501. var ceil = Math.ceil;
  29502. var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
  29503. ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner,
  29504. IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
  29505. var NoContext =
  29506. /* */
  29507. 0;
  29508. var BatchedContext =
  29509. /* */
  29510. 1;
  29511. var EventContext =
  29512. /* */
  29513. 2;
  29514. var DiscreteEventContext =
  29515. /* */
  29516. 4;
  29517. var LegacyUnbatchedContext =
  29518. /* */
  29519. 8;
  29520. var RenderContext =
  29521. /* */
  29522. 16;
  29523. var CommitContext =
  29524. /* */
  29525. 32;
  29526. var RootIncomplete = 0;
  29527. var RootFatalErrored = 1;
  29528. var RootErrored = 2;
  29529. var RootSuspended = 3;
  29530. var RootSuspendedWithDelay = 4;
  29531. var RootCompleted = 5;
  29532. // Describes where we are in the React execution stack
  29533. var executionContext = NoContext; // The root we're working on
  29534. var workInProgressRoot = null; // The fiber we're working on
  29535. var workInProgress = null; // The expiration time we're rendering
  29536. var renderExpirationTime$1 = NoWork; // Whether to root completed, errored, suspended, etc.
  29537. var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown
  29538. var workInProgressRootFatalError = null; // Most recent event time among processed updates during this render.
  29539. // This is conceptually a time stamp but expressed in terms of an ExpirationTime
  29540. // because we deal mostly with expiration times in the hot path, so this avoids
  29541. // the conversion happening in the hot path.
  29542. var workInProgressRootLatestProcessedExpirationTime = Sync;
  29543. var workInProgressRootLatestSuspenseTimeout = Sync;
  29544. var workInProgressRootCanSuspendUsingConfig = null; // The work left over by components that were visited during this render. Only
  29545. // includes unprocessed updates, not work in bailed out children.
  29546. var workInProgressRootNextUnprocessedUpdateTime = NoWork; // If we're pinged while rendering we don't always restart immediately.
  29547. // This flag determines if it might be worthwhile to restart if an opportunity
  29548. // happens latere.
  29549. var workInProgressRootHasPendingPing = false; // The most recent time we committed a fallback. This lets us ensure a train
  29550. // model where we don't commit new loading states in too quick succession.
  29551. var globalMostRecentFallbackTime = 0;
  29552. var FALLBACK_THROTTLE_MS = 500;
  29553. var nextEffect = null;
  29554. var hasUncaughtError = false;
  29555. var firstUncaughtError = null;
  29556. var legacyErrorBoundariesThatAlreadyFailed = null;
  29557. var rootDoesHavePassiveEffects = false;
  29558. var rootWithPendingPassiveEffects = null;
  29559. var pendingPassiveEffectsRenderPriority = NoPriority;
  29560. var pendingPassiveEffectsExpirationTime = NoWork;
  29561. var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates
  29562. var NESTED_UPDATE_LIMIT = 50;
  29563. var nestedUpdateCount = 0;
  29564. var rootWithNestedUpdates = null;
  29565. var NESTED_PASSIVE_UPDATE_LIMIT = 50;
  29566. var nestedPassiveUpdateCount = 0;
  29567. var interruptedBy = null; // Marks the need to reschedule pending interactions at these expiration times
  29568. // during the commit phase. This enables them to be traced across components
  29569. // that spawn new work during render. E.g. hidden boundaries, suspended SSR
  29570. // hydration or SuspenseList.
  29571. var spawnedWorkDuringRender = null; // Expiration times are computed by adding to the current time (the start
  29572. // time). However, if two updates are scheduled within the same event, we
  29573. // should treat their start times as simultaneous, even if the actual clock
  29574. // time has advanced between the first and second call.
  29575. // In other words, because expiration times determine how updates are batched,
  29576. // we want all updates of like priority that occur within the same event to
  29577. // receive the same expiration time. Otherwise we get tearing.
  29578. var currentEventTime = NoWork;
  29579. function requestCurrentTimeForUpdate() {
  29580. if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
  29581. // We're inside React, so it's fine to read the actual time.
  29582. return msToExpirationTime(now());
  29583. } // We're not inside React, so we may be in the middle of a browser event.
  29584. if (currentEventTime !== NoWork) {
  29585. // Use the same start time for all updates until we enter React again.
  29586. return currentEventTime;
  29587. } // This is the first update since React yielded. Compute a new start time.
  29588. currentEventTime = msToExpirationTime(now());
  29589. return currentEventTime;
  29590. }
  29591. function getCurrentTime() {
  29592. return msToExpirationTime(now());
  29593. }
  29594. function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
  29595. var mode = fiber.mode;
  29596. if ((mode & BlockingMode) === NoMode) {
  29597. return Sync;
  29598. }
  29599. var priorityLevel = getCurrentPriorityLevel();
  29600. if ((mode & ConcurrentMode) === NoMode) {
  29601. return priorityLevel === ImmediatePriority ? Sync : Batched;
  29602. }
  29603. if ((executionContext & RenderContext) !== NoContext) {
  29604. // Use whatever time we're already rendering
  29605. // TODO: Should there be a way to opt out, like with `runWithPriority`?
  29606. return renderExpirationTime$1;
  29607. }
  29608. var expirationTime;
  29609. if (suspenseConfig !== null) {
  29610. // Compute an expiration time based on the Suspense timeout.
  29611. expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
  29612. } else {
  29613. // Compute an expiration time based on the Scheduler priority.
  29614. switch (priorityLevel) {
  29615. case ImmediatePriority:
  29616. expirationTime = Sync;
  29617. break;
  29618. case UserBlockingPriority$1:
  29619. // TODO: Rename this to computeUserBlockingExpiration
  29620. expirationTime = computeInteractiveExpiration(currentTime);
  29621. break;
  29622. case NormalPriority:
  29623. case LowPriority:
  29624. // TODO: Handle LowPriority
  29625. // TODO: Rename this to... something better.
  29626. expirationTime = computeAsyncExpiration(currentTime);
  29627. break;
  29628. case IdlePriority:
  29629. expirationTime = Idle;
  29630. break;
  29631. default:
  29632. {
  29633. {
  29634. throw Error( "Expected a valid priority level" );
  29635. }
  29636. }
  29637. }
  29638. } // If we're in the middle of rendering a tree, do not update at the same
  29639. // expiration time that is already rendering.
  29640. // TODO: We shouldn't have to do this if the update is on a different root.
  29641. // Refactor computeExpirationForFiber + scheduleUpdate so we have access to
  29642. // the root when we check for this condition.
  29643. if (workInProgressRoot !== null && expirationTime === renderExpirationTime$1) {
  29644. // This is a trick to move this update into a separate batch
  29645. expirationTime -= 1;
  29646. }
  29647. return expirationTime;
  29648. }
  29649. function scheduleUpdateOnFiber(fiber, expirationTime) {
  29650. checkForNestedUpdates();
  29651. warnAboutRenderPhaseUpdatesInDEV(fiber);
  29652. var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime);
  29653. if (root === null) {
  29654. warnAboutUpdateOnUnmountedFiberInDEV(fiber);
  29655. return;
  29656. }
  29657. checkForInterruption(fiber, expirationTime);
  29658. recordScheduleUpdate(); // TODO: computeExpirationForFiber also reads the priority. Pass the
  29659. // priority as an argument to that function and this one.
  29660. var priorityLevel = getCurrentPriorityLevel();
  29661. if (expirationTime === Sync) {
  29662. if ( // Check if we're inside unbatchedUpdates
  29663. (executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering
  29664. (executionContext & (RenderContext | CommitContext)) === NoContext) {
  29665. // Register pending interactions on the root to avoid losing traced interaction data.
  29666. schedulePendingInteractions(root, expirationTime); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed
  29667. // root inside of batchedUpdates should be synchronous, but layout updates
  29668. // should be deferred until the end of the batch.
  29669. performSyncWorkOnRoot(root);
  29670. } else {
  29671. ensureRootIsScheduled(root);
  29672. schedulePendingInteractions(root, expirationTime);
  29673. if (executionContext === NoContext) {
  29674. // Flush the synchronous work now, unless we're already working or inside
  29675. // a batch. This is intentionally inside scheduleUpdateOnFiber instead of
  29676. // scheduleCallbackForFiber to preserve the ability to schedule a callback
  29677. // without immediately flushing it. We only do this for user-initiated
  29678. // updates, to preserve historical behavior of legacy mode.
  29679. flushSyncCallbackQueue();
  29680. }
  29681. }
  29682. } else {
  29683. ensureRootIsScheduled(root);
  29684. schedulePendingInteractions(root, expirationTime);
  29685. }
  29686. if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered
  29687. // discrete, even inside a discrete event.
  29688. priorityLevel === UserBlockingPriority$1 || priorityLevel === ImmediatePriority)) {
  29689. // This is the result of a discrete event. Track the lowest priority
  29690. // discrete update per root so we can flush them early, if needed.
  29691. if (rootsWithPendingDiscreteUpdates === null) {
  29692. rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]);
  29693. } else {
  29694. var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root);
  29695. if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) {
  29696. rootsWithPendingDiscreteUpdates.set(root, expirationTime);
  29697. }
  29698. }
  29699. }
  29700. }
  29701. var scheduleWork = scheduleUpdateOnFiber; // This is split into a separate function so we can mark a fiber with pending
  29702. // work without treating it as a typical update that originates from an event;
  29703. // e.g. retrying a Suspense boundary isn't an update, but it does schedule work
  29704. // on a fiber.
  29705. function markUpdateTimeFromFiberToRoot(fiber, expirationTime) {
  29706. // Update the source fiber's expiration time
  29707. if (fiber.expirationTime < expirationTime) {
  29708. fiber.expirationTime = expirationTime;
  29709. }
  29710. var alternate = fiber.alternate;
  29711. if (alternate !== null && alternate.expirationTime < expirationTime) {
  29712. alternate.expirationTime = expirationTime;
  29713. } // Walk the parent path to the root and update the child expiration time.
  29714. var node = fiber.return;
  29715. var root = null;
  29716. if (node === null && fiber.tag === HostRoot) {
  29717. root = fiber.stateNode;
  29718. } else {
  29719. while (node !== null) {
  29720. alternate = node.alternate;
  29721. if (node.childExpirationTime < expirationTime) {
  29722. node.childExpirationTime = expirationTime;
  29723. if (alternate !== null && alternate.childExpirationTime < expirationTime) {
  29724. alternate.childExpirationTime = expirationTime;
  29725. }
  29726. } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
  29727. alternate.childExpirationTime = expirationTime;
  29728. }
  29729. if (node.return === null && node.tag === HostRoot) {
  29730. root = node.stateNode;
  29731. break;
  29732. }
  29733. node = node.return;
  29734. }
  29735. }
  29736. if (root !== null) {
  29737. if (workInProgressRoot === root) {
  29738. // Received an update to a tree that's in the middle of rendering. Mark
  29739. // that's unprocessed work on this root.
  29740. markUnprocessedUpdateTime(expirationTime);
  29741. if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
  29742. // The root already suspended with a delay, which means this render
  29743. // definitely won't finish. Since we have a new update, let's mark it as
  29744. // suspended now, right before marking the incoming update. This has the
  29745. // effect of interrupting the current render and switching to the update.
  29746. // TODO: This happens to work when receiving an update during the render
  29747. // phase, because of the trick inside computeExpirationForFiber to
  29748. // subtract 1 from `renderExpirationTime` to move it into a
  29749. // separate bucket. But we should probably model it with an exception,
  29750. // using the same mechanism we use to force hydration of a subtree.
  29751. // TODO: This does not account for low pri updates that were already
  29752. // scheduled before the root started rendering. Need to track the next
  29753. // pending expiration time (perhaps by backtracking the return path) and
  29754. // then trigger a restart in the `renderDidSuspendDelayIfPossible` path.
  29755. markRootSuspendedAtTime(root, renderExpirationTime$1);
  29756. }
  29757. } // Mark that the root has a pending update.
  29758. markRootUpdatedAtTime(root, expirationTime);
  29759. }
  29760. return root;
  29761. }
  29762. function getNextRootExpirationTimeToWorkOn(root) {
  29763. // Determines the next expiration time that the root should render, taking
  29764. // into account levels that may be suspended, or levels that may have
  29765. // received a ping.
  29766. var lastExpiredTime = root.lastExpiredTime;
  29767. if (lastExpiredTime !== NoWork) {
  29768. return lastExpiredTime;
  29769. } // "Pending" refers to any update that hasn't committed yet, including if it
  29770. // suspended. The "suspended" range is therefore a subset.
  29771. var firstPendingTime = root.firstPendingTime;
  29772. if (!isRootSuspendedAtTime(root, firstPendingTime)) {
  29773. // The highest priority pending time is not suspended. Let's work on that.
  29774. return firstPendingTime;
  29775. } // If the first pending time is suspended, check if there's a lower priority
  29776. // pending level that we know about. Or check if we received a ping. Work
  29777. // on whichever is higher priority.
  29778. var lastPingedTime = root.lastPingedTime;
  29779. var nextKnownPendingLevel = root.nextKnownPendingLevel;
  29780. var nextLevel = lastPingedTime > nextKnownPendingLevel ? lastPingedTime : nextKnownPendingLevel;
  29781. if ( nextLevel <= Idle && firstPendingTime !== nextLevel) {
  29782. // Don't work on Idle/Never priority unless everything else is committed.
  29783. return NoWork;
  29784. }
  29785. return nextLevel;
  29786. } // Use this function to schedule a task for a root. There's only one task per
  29787. // root; if a task was already scheduled, we'll check to make sure the
  29788. // expiration time of the existing task is the same as the expiration time of
  29789. // the next level that the root has work on. This function is called on every
  29790. // update, and right before exiting a task.
  29791. function ensureRootIsScheduled(root) {
  29792. var lastExpiredTime = root.lastExpiredTime;
  29793. if (lastExpiredTime !== NoWork) {
  29794. // Special case: Expired work should flush synchronously.
  29795. root.callbackExpirationTime = Sync;
  29796. root.callbackPriority = ImmediatePriority;
  29797. root.callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
  29798. return;
  29799. }
  29800. var expirationTime = getNextRootExpirationTimeToWorkOn(root);
  29801. var existingCallbackNode = root.callbackNode;
  29802. if (expirationTime === NoWork) {
  29803. // There's nothing to work on.
  29804. if (existingCallbackNode !== null) {
  29805. root.callbackNode = null;
  29806. root.callbackExpirationTime = NoWork;
  29807. root.callbackPriority = NoPriority;
  29808. }
  29809. return;
  29810. } // TODO: If this is an update, we already read the current time. Pass the
  29811. // time as an argument.
  29812. var currentTime = requestCurrentTimeForUpdate();
  29813. var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
  29814. // expiration time. Otherwise, we'll cancel it and schedule a new one.
  29815. if (existingCallbackNode !== null) {
  29816. var existingCallbackPriority = root.callbackPriority;
  29817. var existingCallbackExpirationTime = root.callbackExpirationTime;
  29818. if ( // Callback must have the exact same expiration time.
  29819. existingCallbackExpirationTime === expirationTime && // Callback must have greater or equal priority.
  29820. existingCallbackPriority >= priorityLevel) {
  29821. // Existing callback is sufficient.
  29822. return;
  29823. } // Need to schedule a new task.
  29824. // TODO: Instead of scheduling a new task, we should be able to change the
  29825. // priority of the existing one.
  29826. cancelCallback(existingCallbackNode);
  29827. }
  29828. root.callbackExpirationTime = expirationTime;
  29829. root.callbackPriority = priorityLevel;
  29830. var callbackNode;
  29831. if (expirationTime === Sync) {
  29832. // Sync React callbacks are scheduled on a special internal queue
  29833. callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
  29834. } else {
  29835. callbackNode = scheduleCallback(priorityLevel, performConcurrentWorkOnRoot.bind(null, root), // Compute a task timeout based on the expiration time. This also affects
  29836. // ordering because tasks are processed in timeout order.
  29837. {
  29838. timeout: expirationTimeToMs(expirationTime) - now()
  29839. });
  29840. }
  29841. root.callbackNode = callbackNode;
  29842. } // This is the entry point for every concurrent task, i.e. anything that
  29843. // goes through Scheduler.
  29844. function performConcurrentWorkOnRoot(root, didTimeout) {
  29845. // Since we know we're in a React event, we can clear the current
  29846. // event time. The next update will compute a new event time.
  29847. currentEventTime = NoWork;
  29848. if (didTimeout) {
  29849. // The render task took too long to complete. Mark the current time as
  29850. // expired to synchronously render all expired work in a single batch.
  29851. var currentTime = requestCurrentTimeForUpdate();
  29852. markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
  29853. ensureRootIsScheduled(root);
  29854. return null;
  29855. } // Determine the next expiration time to work on, using the fields stored
  29856. // on the root.
  29857. var expirationTime = getNextRootExpirationTimeToWorkOn(root);
  29858. if (expirationTime !== NoWork) {
  29859. var originalCallbackNode = root.callbackNode;
  29860. if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
  29861. {
  29862. throw Error( "Should not already be working." );
  29863. }
  29864. }
  29865. flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
  29866. // and prepare a fresh one. Otherwise we'll continue where we left off.
  29867. if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) {
  29868. prepareFreshStack(root, expirationTime);
  29869. startWorkOnPendingInteractions(root, expirationTime);
  29870. } // If we have a work-in-progress fiber, it means there's still work to do
  29871. // in this root.
  29872. if (workInProgress !== null) {
  29873. var prevExecutionContext = executionContext;
  29874. executionContext |= RenderContext;
  29875. var prevDispatcher = pushDispatcher();
  29876. var prevInteractions = pushInteractions(root);
  29877. startWorkLoopTimer(workInProgress);
  29878. do {
  29879. try {
  29880. workLoopConcurrent();
  29881. break;
  29882. } catch (thrownValue) {
  29883. handleError(root, thrownValue);
  29884. }
  29885. } while (true);
  29886. resetContextDependencies();
  29887. executionContext = prevExecutionContext;
  29888. popDispatcher(prevDispatcher);
  29889. {
  29890. popInteractions(prevInteractions);
  29891. }
  29892. if (workInProgressRootExitStatus === RootFatalErrored) {
  29893. var fatalError = workInProgressRootFatalError;
  29894. stopInterruptedWorkLoopTimer();
  29895. prepareFreshStack(root, expirationTime);
  29896. markRootSuspendedAtTime(root, expirationTime);
  29897. ensureRootIsScheduled(root);
  29898. throw fatalError;
  29899. }
  29900. if (workInProgress !== null) {
  29901. // There's still work left over. Exit without committing.
  29902. stopInterruptedWorkLoopTimer();
  29903. } else {
  29904. // We now have a consistent tree. The next step is either to commit it,
  29905. // or, if something suspended, wait to commit it after a timeout.
  29906. stopFinishedWorkLoopTimer();
  29907. var finishedWork = root.finishedWork = root.current.alternate;
  29908. root.finishedExpirationTime = expirationTime;
  29909. finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
  29910. }
  29911. ensureRootIsScheduled(root);
  29912. if (root.callbackNode === originalCallbackNode) {
  29913. // The task node scheduled for this root is the same one that's
  29914. // currently executed. Need to return a continuation.
  29915. return performConcurrentWorkOnRoot.bind(null, root);
  29916. }
  29917. }
  29918. }
  29919. return null;
  29920. }
  29921. function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime) {
  29922. // Set this to null to indicate there's no in-progress render.
  29923. workInProgressRoot = null;
  29924. switch (exitStatus) {
  29925. case RootIncomplete:
  29926. case RootFatalErrored:
  29927. {
  29928. {
  29929. {
  29930. throw Error( "Root did not complete. This is a bug in React." );
  29931. }
  29932. }
  29933. }
  29934. // Flow knows about invariant, so it complains if I add a break
  29935. // statement, but eslint doesn't know about invariant, so it complains
  29936. // if I do. eslint-disable-next-line no-fallthrough
  29937. case RootErrored:
  29938. {
  29939. // If this was an async render, the error may have happened due to
  29940. // a mutation in a concurrent event. Try rendering one more time,
  29941. // synchronously, to see if the error goes away. If there are
  29942. // lower priority updates, let's include those, too, in case they
  29943. // fix the inconsistency. Render at Idle to include all updates.
  29944. // If it was Idle or Never or some not-yet-invented time, render
  29945. // at that time.
  29946. markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
  29947. // and therefore not hit this path again.
  29948. break;
  29949. }
  29950. case RootSuspended:
  29951. {
  29952. markRootSuspendedAtTime(root, expirationTime);
  29953. var lastSuspendedTime = root.lastSuspendedTime;
  29954. if (expirationTime === lastSuspendedTime) {
  29955. root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork);
  29956. } // We have an acceptable loading state. We need to figure out if we
  29957. // should immediately commit it or wait a bit.
  29958. // If we have processed new updates during this render, we may now
  29959. // have a new loading state ready. We want to ensure that we commit
  29960. // that as soon as possible.
  29961. var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync;
  29962. if (hasNotProcessedNewUpdates && // do not delay if we're inside an act() scope
  29963. !( IsThisRendererActing.current)) {
  29964. // If we have not processed any new updates during this pass, then
  29965. // this is either a retry of an existing fallback state or a
  29966. // hidden tree. Hidden trees shouldn't be batched with other work
  29967. // and after that's fixed it can only be a retry. We're going to
  29968. // throttle committing retries so that we don't show too many
  29969. // loading states too quickly.
  29970. var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time.
  29971. if (msUntilTimeout > 10) {
  29972. if (workInProgressRootHasPendingPing) {
  29973. var lastPingedTime = root.lastPingedTime;
  29974. if (lastPingedTime === NoWork || lastPingedTime >= expirationTime) {
  29975. // This render was pinged but we didn't get to restart
  29976. // earlier so try restarting now instead.
  29977. root.lastPingedTime = expirationTime;
  29978. prepareFreshStack(root, expirationTime);
  29979. break;
  29980. }
  29981. }
  29982. var nextTime = getNextRootExpirationTimeToWorkOn(root);
  29983. if (nextTime !== NoWork && nextTime !== expirationTime) {
  29984. // There's additional work on this root.
  29985. break;
  29986. }
  29987. if (lastSuspendedTime !== NoWork && lastSuspendedTime !== expirationTime) {
  29988. // We should prefer to render the fallback of at the last
  29989. // suspended level. Ping the last suspended level to try
  29990. // rendering it again.
  29991. root.lastPingedTime = lastSuspendedTime;
  29992. break;
  29993. } // The render is suspended, it hasn't timed out, and there's no
  29994. // lower priority work to do. Instead of committing the fallback
  29995. // immediately, wait for more data to arrive.
  29996. root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
  29997. break;
  29998. }
  29999. } // The work expired. Commit immediately.
  30000. commitRoot(root);
  30001. break;
  30002. }
  30003. case RootSuspendedWithDelay:
  30004. {
  30005. markRootSuspendedAtTime(root, expirationTime);
  30006. var _lastSuspendedTime = root.lastSuspendedTime;
  30007. if (expirationTime === _lastSuspendedTime) {
  30008. root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork);
  30009. }
  30010. if ( // do not delay if we're inside an act() scope
  30011. !( IsThisRendererActing.current)) {
  30012. // We're suspended in a state that should be avoided. We'll try to
  30013. // avoid committing it for as long as the timeouts let us.
  30014. if (workInProgressRootHasPendingPing) {
  30015. var _lastPingedTime = root.lastPingedTime;
  30016. if (_lastPingedTime === NoWork || _lastPingedTime >= expirationTime) {
  30017. // This render was pinged but we didn't get to restart earlier
  30018. // so try restarting now instead.
  30019. root.lastPingedTime = expirationTime;
  30020. prepareFreshStack(root, expirationTime);
  30021. break;
  30022. }
  30023. }
  30024. var _nextTime = getNextRootExpirationTimeToWorkOn(root);
  30025. if (_nextTime !== NoWork && _nextTime !== expirationTime) {
  30026. // There's additional work on this root.
  30027. break;
  30028. }
  30029. if (_lastSuspendedTime !== NoWork && _lastSuspendedTime !== expirationTime) {
  30030. // We should prefer to render the fallback of at the last
  30031. // suspended level. Ping the last suspended level to try
  30032. // rendering it again.
  30033. root.lastPingedTime = _lastSuspendedTime;
  30034. break;
  30035. }
  30036. var _msUntilTimeout;
  30037. if (workInProgressRootLatestSuspenseTimeout !== Sync) {
  30038. // We have processed a suspense config whose expiration time we
  30039. // can use as the timeout.
  30040. _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now();
  30041. } else if (workInProgressRootLatestProcessedExpirationTime === Sync) {
  30042. // This should never normally happen because only new updates
  30043. // cause delayed states, so we should have processed something.
  30044. // However, this could also happen in an offscreen tree.
  30045. _msUntilTimeout = 0;
  30046. } else {
  30047. // If we don't have a suspense config, we're going to use a
  30048. // heuristic to determine how long we can suspend.
  30049. var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime);
  30050. var currentTimeMs = now();
  30051. var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs;
  30052. var timeElapsed = currentTimeMs - eventTimeMs;
  30053. if (timeElapsed < 0) {
  30054. // We get this wrong some time since we estimate the time.
  30055. timeElapsed = 0;
  30056. }
  30057. _msUntilTimeout = jnd(timeElapsed) - timeElapsed; // Clamp the timeout to the expiration time. TODO: Once the
  30058. // event time is exact instead of inferred from expiration time
  30059. // we don't need this.
  30060. if (timeUntilExpirationMs < _msUntilTimeout) {
  30061. _msUntilTimeout = timeUntilExpirationMs;
  30062. }
  30063. } // Don't bother with a very short suspense time.
  30064. if (_msUntilTimeout > 10) {
  30065. // The render is suspended, it hasn't timed out, and there's no
  30066. // lower priority work to do. Instead of committing the fallback
  30067. // immediately, wait for more data to arrive.
  30068. root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
  30069. break;
  30070. }
  30071. } // The work expired. Commit immediately.
  30072. commitRoot(root);
  30073. break;
  30074. }
  30075. case RootCompleted:
  30076. {
  30077. // The work completed. Ready to commit.
  30078. if ( // do not delay if we're inside an act() scope
  30079. !( IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) {
  30080. // If we have exceeded the minimum loading delay, which probably
  30081. // means we have shown a spinner already, we might have to suspend
  30082. // a bit longer to ensure that the spinner is shown for
  30083. // enough time.
  30084. var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig);
  30085. if (_msUntilTimeout2 > 10) {
  30086. markRootSuspendedAtTime(root, expirationTime);
  30087. root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2);
  30088. break;
  30089. }
  30090. }
  30091. commitRoot(root);
  30092. break;
  30093. }
  30094. default:
  30095. {
  30096. {
  30097. {
  30098. throw Error( "Unknown root exit status." );
  30099. }
  30100. }
  30101. }
  30102. }
  30103. } // This is the entry point for synchronous tasks that don't go
  30104. // through Scheduler
  30105. function performSyncWorkOnRoot(root) {
  30106. // Check if there's expired work on this root. Otherwise, render at Sync.
  30107. var lastExpiredTime = root.lastExpiredTime;
  30108. var expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync;
  30109. if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
  30110. {
  30111. throw Error( "Should not already be working." );
  30112. }
  30113. }
  30114. flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
  30115. // and prepare a fresh one. Otherwise we'll continue where we left off.
  30116. if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) {
  30117. prepareFreshStack(root, expirationTime);
  30118. startWorkOnPendingInteractions(root, expirationTime);
  30119. } // If we have a work-in-progress fiber, it means there's still work to do
  30120. // in this root.
  30121. if (workInProgress !== null) {
  30122. var prevExecutionContext = executionContext;
  30123. executionContext |= RenderContext;
  30124. var prevDispatcher = pushDispatcher();
  30125. var prevInteractions = pushInteractions(root);
  30126. startWorkLoopTimer(workInProgress);
  30127. do {
  30128. try {
  30129. workLoopSync();
  30130. break;
  30131. } catch (thrownValue) {
  30132. handleError(root, thrownValue);
  30133. }
  30134. } while (true);
  30135. resetContextDependencies();
  30136. executionContext = prevExecutionContext;
  30137. popDispatcher(prevDispatcher);
  30138. {
  30139. popInteractions(prevInteractions);
  30140. }
  30141. if (workInProgressRootExitStatus === RootFatalErrored) {
  30142. var fatalError = workInProgressRootFatalError;
  30143. stopInterruptedWorkLoopTimer();
  30144. prepareFreshStack(root, expirationTime);
  30145. markRootSuspendedAtTime(root, expirationTime);
  30146. ensureRootIsScheduled(root);
  30147. throw fatalError;
  30148. }
  30149. if (workInProgress !== null) {
  30150. // This is a sync render, so we should have finished the whole tree.
  30151. {
  30152. {
  30153. throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." );
  30154. }
  30155. }
  30156. } else {
  30157. // We now have a consistent tree. Because this is a sync render, we
  30158. // will commit it even if something suspended.
  30159. stopFinishedWorkLoopTimer();
  30160. root.finishedWork = root.current.alternate;
  30161. root.finishedExpirationTime = expirationTime;
  30162. finishSyncRender(root);
  30163. } // Before exiting, make sure there's a callback scheduled for the next
  30164. // pending level.
  30165. ensureRootIsScheduled(root);
  30166. }
  30167. return null;
  30168. }
  30169. function finishSyncRender(root) {
  30170. // Set this to null to indicate there's no in-progress render.
  30171. workInProgressRoot = null;
  30172. commitRoot(root);
  30173. }
  30174. function flushDiscreteUpdates() {
  30175. // TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
  30176. // However, `act` uses `batchedUpdates`, so there's no way to distinguish
  30177. // those two cases. Need to fix this before exposing flushDiscreteUpdates
  30178. // as a public API.
  30179. if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
  30180. {
  30181. if ((executionContext & RenderContext) !== NoContext) {
  30182. error('unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
  30183. }
  30184. } // We're already rendering, so we can't synchronously flush pending work.
  30185. // This is probably a nested event dispatch triggered by a lifecycle/effect,
  30186. // like `el.focus()`. Exit.
  30187. return;
  30188. }
  30189. flushPendingDiscreteUpdates(); // If the discrete updates scheduled passive effects, flush them now so that
  30190. // they fire before the next serial event.
  30191. flushPassiveEffects();
  30192. }
  30193. function syncUpdates(fn, a, b, c) {
  30194. return runWithPriority$1(ImmediatePriority, fn.bind(null, a, b, c));
  30195. }
  30196. function flushPendingDiscreteUpdates() {
  30197. if (rootsWithPendingDiscreteUpdates !== null) {
  30198. // For each root with pending discrete updates, schedule a callback to
  30199. // immediately flush them.
  30200. var roots = rootsWithPendingDiscreteUpdates;
  30201. rootsWithPendingDiscreteUpdates = null;
  30202. roots.forEach(function (expirationTime, root) {
  30203. markRootExpiredAtTime(root, expirationTime);
  30204. ensureRootIsScheduled(root);
  30205. }); // Now flush the immediate queue.
  30206. flushSyncCallbackQueue();
  30207. }
  30208. }
  30209. function batchedUpdates$1(fn, a) {
  30210. var prevExecutionContext = executionContext;
  30211. executionContext |= BatchedContext;
  30212. try {
  30213. return fn(a);
  30214. } finally {
  30215. executionContext = prevExecutionContext;
  30216. if (executionContext === NoContext) {
  30217. // Flush the immediate callbacks that were scheduled during this batch
  30218. flushSyncCallbackQueue();
  30219. }
  30220. }
  30221. }
  30222. function batchedEventUpdates$1(fn, a) {
  30223. var prevExecutionContext = executionContext;
  30224. executionContext |= EventContext;
  30225. try {
  30226. return fn(a);
  30227. } finally {
  30228. executionContext = prevExecutionContext;
  30229. if (executionContext === NoContext) {
  30230. // Flush the immediate callbacks that were scheduled during this batch
  30231. flushSyncCallbackQueue();
  30232. }
  30233. }
  30234. }
  30235. function discreteUpdates$1(fn, a, b, c, d) {
  30236. var prevExecutionContext = executionContext;
  30237. executionContext |= DiscreteEventContext;
  30238. try {
  30239. // Should this
  30240. return runWithPriority$1(UserBlockingPriority$1, fn.bind(null, a, b, c, d));
  30241. } finally {
  30242. executionContext = prevExecutionContext;
  30243. if (executionContext === NoContext) {
  30244. // Flush the immediate callbacks that were scheduled during this batch
  30245. flushSyncCallbackQueue();
  30246. }
  30247. }
  30248. }
  30249. function unbatchedUpdates(fn, a) {
  30250. var prevExecutionContext = executionContext;
  30251. executionContext &= ~BatchedContext;
  30252. executionContext |= LegacyUnbatchedContext;
  30253. try {
  30254. return fn(a);
  30255. } finally {
  30256. executionContext = prevExecutionContext;
  30257. if (executionContext === NoContext) {
  30258. // Flush the immediate callbacks that were scheduled during this batch
  30259. flushSyncCallbackQueue();
  30260. }
  30261. }
  30262. }
  30263. function flushSync(fn, a) {
  30264. if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
  30265. {
  30266. {
  30267. throw Error( "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." );
  30268. }
  30269. }
  30270. }
  30271. var prevExecutionContext = executionContext;
  30272. executionContext |= BatchedContext;
  30273. try {
  30274. return runWithPriority$1(ImmediatePriority, fn.bind(null, a));
  30275. } finally {
  30276. executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch.
  30277. // Note that this will happen even if batchedUpdates is higher up
  30278. // the stack.
  30279. flushSyncCallbackQueue();
  30280. }
  30281. }
  30282. function prepareFreshStack(root, expirationTime) {
  30283. root.finishedWork = null;
  30284. root.finishedExpirationTime = NoWork;
  30285. var timeoutHandle = root.timeoutHandle;
  30286. if (timeoutHandle !== noTimeout) {
  30287. // The root previous suspended and scheduled a timeout to commit a fallback
  30288. // state. Now that we have additional work, cancel the timeout.
  30289. root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
  30290. cancelTimeout(timeoutHandle);
  30291. }
  30292. if (workInProgress !== null) {
  30293. var interruptedWork = workInProgress.return;
  30294. while (interruptedWork !== null) {
  30295. unwindInterruptedWork(interruptedWork);
  30296. interruptedWork = interruptedWork.return;
  30297. }
  30298. }
  30299. workInProgressRoot = root;
  30300. workInProgress = createWorkInProgress(root.current, null);
  30301. renderExpirationTime$1 = expirationTime;
  30302. workInProgressRootExitStatus = RootIncomplete;
  30303. workInProgressRootFatalError = null;
  30304. workInProgressRootLatestProcessedExpirationTime = Sync;
  30305. workInProgressRootLatestSuspenseTimeout = Sync;
  30306. workInProgressRootCanSuspendUsingConfig = null;
  30307. workInProgressRootNextUnprocessedUpdateTime = NoWork;
  30308. workInProgressRootHasPendingPing = false;
  30309. {
  30310. spawnedWorkDuringRender = null;
  30311. }
  30312. {
  30313. ReactStrictModeWarnings.discardPendingWarnings();
  30314. }
  30315. }
  30316. function handleError(root, thrownValue) {
  30317. do {
  30318. try {
  30319. // Reset module-level state that was set during the render phase.
  30320. resetContextDependencies();
  30321. resetHooksAfterThrow();
  30322. resetCurrentFiber();
  30323. if (workInProgress === null || workInProgress.return === null) {
  30324. // Expected to be working on a non-root fiber. This is a fatal error
  30325. // because there's no ancestor that can handle it; the root is
  30326. // supposed to capture all errors that weren't caught by an error
  30327. // boundary.
  30328. workInProgressRootExitStatus = RootFatalErrored;
  30329. workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next
  30330. // sibling, or the parent if there are no siblings. But since the root
  30331. // has no siblings nor a parent, we set it to null. Usually this is
  30332. // handled by `completeUnitOfWork` or `unwindWork`, but since we're
  30333. // interntionally not calling those, we need set it here.
  30334. // TODO: Consider calling `unwindWork` to pop the contexts.
  30335. workInProgress = null;
  30336. return null;
  30337. }
  30338. if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
  30339. // Record the time spent rendering before an error was thrown. This
  30340. // avoids inaccurate Profiler durations in the case of a
  30341. // suspended render.
  30342. stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
  30343. }
  30344. throwException(root, workInProgress.return, workInProgress, thrownValue, renderExpirationTime$1);
  30345. workInProgress = completeUnitOfWork(workInProgress);
  30346. } catch (yetAnotherThrownValue) {
  30347. // Something in the return path also threw.
  30348. thrownValue = yetAnotherThrownValue;
  30349. continue;
  30350. } // Return to the normal work loop.
  30351. return;
  30352. } while (true);
  30353. }
  30354. function pushDispatcher(root) {
  30355. var prevDispatcher = ReactCurrentDispatcher$1.current;
  30356. ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
  30357. if (prevDispatcher === null) {
  30358. // The React isomorphic package does not include a default dispatcher.
  30359. // Instead the first renderer will lazily attach one, in order to give
  30360. // nicer error messages.
  30361. return ContextOnlyDispatcher;
  30362. } else {
  30363. return prevDispatcher;
  30364. }
  30365. }
  30366. function popDispatcher(prevDispatcher) {
  30367. ReactCurrentDispatcher$1.current = prevDispatcher;
  30368. }
  30369. function pushInteractions(root) {
  30370. {
  30371. var prevInteractions = tracing.__interactionsRef.current;
  30372. tracing.__interactionsRef.current = root.memoizedInteractions;
  30373. return prevInteractions;
  30374. }
  30375. }
  30376. function popInteractions(prevInteractions) {
  30377. {
  30378. tracing.__interactionsRef.current = prevInteractions;
  30379. }
  30380. }
  30381. function markCommitTimeOfFallback() {
  30382. globalMostRecentFallbackTime = now();
  30383. }
  30384. function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) {
  30385. if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Idle) {
  30386. workInProgressRootLatestProcessedExpirationTime = expirationTime;
  30387. }
  30388. if (suspenseConfig !== null) {
  30389. if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Idle) {
  30390. workInProgressRootLatestSuspenseTimeout = expirationTime; // Most of the time we only have one config and getting wrong is not bad.
  30391. workInProgressRootCanSuspendUsingConfig = suspenseConfig;
  30392. }
  30393. }
  30394. }
  30395. function markUnprocessedUpdateTime(expirationTime) {
  30396. if (expirationTime > workInProgressRootNextUnprocessedUpdateTime) {
  30397. workInProgressRootNextUnprocessedUpdateTime = expirationTime;
  30398. }
  30399. }
  30400. function renderDidSuspend() {
  30401. if (workInProgressRootExitStatus === RootIncomplete) {
  30402. workInProgressRootExitStatus = RootSuspended;
  30403. }
  30404. }
  30405. function renderDidSuspendDelayIfPossible() {
  30406. if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
  30407. workInProgressRootExitStatus = RootSuspendedWithDelay;
  30408. } // Check if there's a lower priority update somewhere else in the tree.
  30409. if (workInProgressRootNextUnprocessedUpdateTime !== NoWork && workInProgressRoot !== null) {
  30410. // Mark the current render as suspended, and then mark that there's a
  30411. // pending update.
  30412. // TODO: This should immediately interrupt the current render, instead
  30413. // of waiting until the next time we yield.
  30414. markRootSuspendedAtTime(workInProgressRoot, renderExpirationTime$1);
  30415. markRootUpdatedAtTime(workInProgressRoot, workInProgressRootNextUnprocessedUpdateTime);
  30416. }
  30417. }
  30418. function renderDidError() {
  30419. if (workInProgressRootExitStatus !== RootCompleted) {
  30420. workInProgressRootExitStatus = RootErrored;
  30421. }
  30422. } // Called during render to determine if anything has suspended.
  30423. // Returns false if we're not sure.
  30424. function renderHasNotSuspendedYet() {
  30425. // If something errored or completed, we can't really be sure,
  30426. // so those are false.
  30427. return workInProgressRootExitStatus === RootIncomplete;
  30428. }
  30429. function inferTimeFromExpirationTime(expirationTime) {
  30430. // We don't know exactly when the update was scheduled, but we can infer an
  30431. // approximate start time from the expiration time.
  30432. var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
  30433. return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
  30434. }
  30435. function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) {
  30436. // We don't know exactly when the update was scheduled, but we can infer an
  30437. // approximate start time from the expiration time by subtracting the timeout
  30438. // that was added to the event time.
  30439. var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
  30440. return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
  30441. } // The work loop is an extremely hot path. Tell Closure not to inline it.
  30442. /** @noinline */
  30443. function workLoopSync() {
  30444. // Already timed out, so perform work without checking if we need to yield.
  30445. while (workInProgress !== null) {
  30446. workInProgress = performUnitOfWork(workInProgress);
  30447. }
  30448. }
  30449. /** @noinline */
  30450. function workLoopConcurrent() {
  30451. // Perform work until Scheduler asks us to yield
  30452. while (workInProgress !== null && !shouldYield()) {
  30453. workInProgress = performUnitOfWork(workInProgress);
  30454. }
  30455. }
  30456. function performUnitOfWork(unitOfWork) {
  30457. // The current, flushed, state of this fiber is the alternate. Ideally
  30458. // nothing should rely on this, but relying on it here means that we don't
  30459. // need an additional field on the work in progress.
  30460. var current = unitOfWork.alternate;
  30461. startWorkTimer(unitOfWork);
  30462. setCurrentFiber(unitOfWork);
  30463. var next;
  30464. if ( (unitOfWork.mode & ProfileMode) !== NoMode) {
  30465. startProfilerTimer(unitOfWork);
  30466. next = beginWork$1(current, unitOfWork, renderExpirationTime$1);
  30467. stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
  30468. } else {
  30469. next = beginWork$1(current, unitOfWork, renderExpirationTime$1);
  30470. }
  30471. resetCurrentFiber();
  30472. unitOfWork.memoizedProps = unitOfWork.pendingProps;
  30473. if (next === null) {
  30474. // If this doesn't spawn new work, complete the current work.
  30475. next = completeUnitOfWork(unitOfWork);
  30476. }
  30477. ReactCurrentOwner$2.current = null;
  30478. return next;
  30479. }
  30480. function completeUnitOfWork(unitOfWork) {
  30481. // Attempt to complete the current unit of work, then move to the next
  30482. // sibling. If there are no more siblings, return to the parent fiber.
  30483. workInProgress = unitOfWork;
  30484. do {
  30485. // The current, flushed, state of this fiber is the alternate. Ideally
  30486. // nothing should rely on this, but relying on it here means that we don't
  30487. // need an additional field on the work in progress.
  30488. var current = workInProgress.alternate;
  30489. var returnFiber = workInProgress.return; // Check if the work completed or if something threw.
  30490. if ((workInProgress.effectTag & Incomplete) === NoEffect) {
  30491. setCurrentFiber(workInProgress);
  30492. var next = void 0;
  30493. if ( (workInProgress.mode & ProfileMode) === NoMode) {
  30494. next = completeWork(current, workInProgress, renderExpirationTime$1);
  30495. } else {
  30496. startProfilerTimer(workInProgress);
  30497. next = completeWork(current, workInProgress, renderExpirationTime$1); // Update render duration assuming we didn't error.
  30498. stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
  30499. }
  30500. stopWorkTimer(workInProgress);
  30501. resetCurrentFiber();
  30502. resetChildExpirationTime(workInProgress);
  30503. if (next !== null) {
  30504. // Completing this fiber spawned new work. Work on that next.
  30505. return next;
  30506. }
  30507. if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
  30508. (returnFiber.effectTag & Incomplete) === NoEffect) {
  30509. // Append all the effects of the subtree and this fiber onto the effect
  30510. // list of the parent. The completion order of the children affects the
  30511. // side-effect order.
  30512. if (returnFiber.firstEffect === null) {
  30513. returnFiber.firstEffect = workInProgress.firstEffect;
  30514. }
  30515. if (workInProgress.lastEffect !== null) {
  30516. if (returnFiber.lastEffect !== null) {
  30517. returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
  30518. }
  30519. returnFiber.lastEffect = workInProgress.lastEffect;
  30520. } // If this fiber had side-effects, we append it AFTER the children's
  30521. // side-effects. We can perform certain side-effects earlier if needed,
  30522. // by doing multiple passes over the effect list. We don't want to
  30523. // schedule our own side-effect on our own list because if end up
  30524. // reusing children we'll schedule this effect onto itself since we're
  30525. // at the end.
  30526. var effectTag = workInProgress.effectTag; // Skip both NoWork and PerformedWork tags when creating the effect
  30527. // list. PerformedWork effect is read by React DevTools but shouldn't be
  30528. // committed.
  30529. if (effectTag > PerformedWork) {
  30530. if (returnFiber.lastEffect !== null) {
  30531. returnFiber.lastEffect.nextEffect = workInProgress;
  30532. } else {
  30533. returnFiber.firstEffect = workInProgress;
  30534. }
  30535. returnFiber.lastEffect = workInProgress;
  30536. }
  30537. }
  30538. } else {
  30539. // This fiber did not complete because something threw. Pop values off
  30540. // the stack without entering the complete phase. If this is a boundary,
  30541. // capture values if possible.
  30542. var _next = unwindWork(workInProgress); // Because this fiber did not complete, don't reset its expiration time.
  30543. if ( (workInProgress.mode & ProfileMode) !== NoMode) {
  30544. // Record the render duration for the fiber that errored.
  30545. stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); // Include the time spent working on failed children before continuing.
  30546. var actualDuration = workInProgress.actualDuration;
  30547. var child = workInProgress.child;
  30548. while (child !== null) {
  30549. actualDuration += child.actualDuration;
  30550. child = child.sibling;
  30551. }
  30552. workInProgress.actualDuration = actualDuration;
  30553. }
  30554. if (_next !== null) {
  30555. // If completing this work spawned new work, do that next. We'll come
  30556. // back here again.
  30557. // Since we're restarting, remove anything that is not a host effect
  30558. // from the effect tag.
  30559. // TODO: The name stopFailedWorkTimer is misleading because Suspense
  30560. // also captures and restarts.
  30561. stopFailedWorkTimer(workInProgress);
  30562. _next.effectTag &= HostEffectMask;
  30563. return _next;
  30564. }
  30565. stopWorkTimer(workInProgress);
  30566. if (returnFiber !== null) {
  30567. // Mark the parent fiber as incomplete and clear its effect list.
  30568. returnFiber.firstEffect = returnFiber.lastEffect = null;
  30569. returnFiber.effectTag |= Incomplete;
  30570. }
  30571. }
  30572. var siblingFiber = workInProgress.sibling;
  30573. if (siblingFiber !== null) {
  30574. // If there is more work to do in this returnFiber, do that next.
  30575. return siblingFiber;
  30576. } // Otherwise, return to the parent
  30577. workInProgress = returnFiber;
  30578. } while (workInProgress !== null); // We've reached the root.
  30579. if (workInProgressRootExitStatus === RootIncomplete) {
  30580. workInProgressRootExitStatus = RootCompleted;
  30581. }
  30582. return null;
  30583. }
  30584. function getRemainingExpirationTime(fiber) {
  30585. var updateExpirationTime = fiber.expirationTime;
  30586. var childExpirationTime = fiber.childExpirationTime;
  30587. return updateExpirationTime > childExpirationTime ? updateExpirationTime : childExpirationTime;
  30588. }
  30589. function resetChildExpirationTime(completedWork) {
  30590. if (renderExpirationTime$1 !== Never && completedWork.childExpirationTime === Never) {
  30591. // The children of this component are hidden. Don't bubble their
  30592. // expiration times.
  30593. return;
  30594. }
  30595. var newChildExpirationTime = NoWork; // Bubble up the earliest expiration time.
  30596. if ( (completedWork.mode & ProfileMode) !== NoMode) {
  30597. // In profiling mode, resetChildExpirationTime is also used to reset
  30598. // profiler durations.
  30599. var actualDuration = completedWork.actualDuration;
  30600. var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will
  30601. // only be updated if work is done on the fiber (i.e. it doesn't bailout).
  30602. // When work is done, it should bubble to the parent's actualDuration. If
  30603. // the fiber has not been cloned though, (meaning no work was done), then
  30604. // this value will reflect the amount of time spent working on a previous
  30605. // render. In that case it should not bubble. We determine whether it was
  30606. // cloned by comparing the child pointer.
  30607. var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
  30608. var child = completedWork.child;
  30609. while (child !== null) {
  30610. var childUpdateExpirationTime = child.expirationTime;
  30611. var childChildExpirationTime = child.childExpirationTime;
  30612. if (childUpdateExpirationTime > newChildExpirationTime) {
  30613. newChildExpirationTime = childUpdateExpirationTime;
  30614. }
  30615. if (childChildExpirationTime > newChildExpirationTime) {
  30616. newChildExpirationTime = childChildExpirationTime;
  30617. }
  30618. if (shouldBubbleActualDurations) {
  30619. actualDuration += child.actualDuration;
  30620. }
  30621. treeBaseDuration += child.treeBaseDuration;
  30622. child = child.sibling;
  30623. }
  30624. completedWork.actualDuration = actualDuration;
  30625. completedWork.treeBaseDuration = treeBaseDuration;
  30626. } else {
  30627. var _child = completedWork.child;
  30628. while (_child !== null) {
  30629. var _childUpdateExpirationTime = _child.expirationTime;
  30630. var _childChildExpirationTime = _child.childExpirationTime;
  30631. if (_childUpdateExpirationTime > newChildExpirationTime) {
  30632. newChildExpirationTime = _childUpdateExpirationTime;
  30633. }
  30634. if (_childChildExpirationTime > newChildExpirationTime) {
  30635. newChildExpirationTime = _childChildExpirationTime;
  30636. }
  30637. _child = _child.sibling;
  30638. }
  30639. }
  30640. completedWork.childExpirationTime = newChildExpirationTime;
  30641. }
  30642. function commitRoot(root) {
  30643. var renderPriorityLevel = getCurrentPriorityLevel();
  30644. runWithPriority$1(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel));
  30645. return null;
  30646. }
  30647. function commitRootImpl(root, renderPriorityLevel) {
  30648. do {
  30649. // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
  30650. // means `flushPassiveEffects` will sometimes result in additional
  30651. // passive effects. So we need to keep flushing in a loop until there are
  30652. // no more pending effects.
  30653. // TODO: Might be better if `flushPassiveEffects` did not automatically
  30654. // flush synchronous work at the end, to avoid factoring hazards like this.
  30655. flushPassiveEffects();
  30656. } while (rootWithPendingPassiveEffects !== null);
  30657. flushRenderPhaseStrictModeWarningsInDEV();
  30658. if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
  30659. {
  30660. throw Error( "Should not already be working." );
  30661. }
  30662. }
  30663. var finishedWork = root.finishedWork;
  30664. var expirationTime = root.finishedExpirationTime;
  30665. if (finishedWork === null) {
  30666. return null;
  30667. }
  30668. root.finishedWork = null;
  30669. root.finishedExpirationTime = NoWork;
  30670. if (!(finishedWork !== root.current)) {
  30671. {
  30672. throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." );
  30673. }
  30674. } // commitRoot never returns a continuation; it always finishes synchronously.
  30675. // So we can clear these now to allow a new callback to be scheduled.
  30676. root.callbackNode = null;
  30677. root.callbackExpirationTime = NoWork;
  30678. root.callbackPriority = NoPriority;
  30679. root.nextKnownPendingLevel = NoWork;
  30680. startCommitTimer(); // Update the first and last pending times on this root. The new first
  30681. // pending time is whatever is left on the root fiber.
  30682. var remainingExpirationTimeBeforeCommit = getRemainingExpirationTime(finishedWork);
  30683. markRootFinishedAtTime(root, expirationTime, remainingExpirationTimeBeforeCommit);
  30684. if (root === workInProgressRoot) {
  30685. // We can reset these now that they are finished.
  30686. workInProgressRoot = null;
  30687. workInProgress = null;
  30688. renderExpirationTime$1 = NoWork;
  30689. } // This indicates that the last root we worked on is not the same one that
  30690. // we're committing now. This most commonly happens when a suspended root
  30691. // times out.
  30692. // Get the list of effects.
  30693. var firstEffect;
  30694. if (finishedWork.effectTag > PerformedWork) {
  30695. // A fiber's effect list consists only of its children, not itself. So if
  30696. // the root has an effect, we need to add it to the end of the list. The
  30697. // resulting list is the set that would belong to the root's parent, if it
  30698. // had one; that is, all the effects in the tree including the root.
  30699. if (finishedWork.lastEffect !== null) {
  30700. finishedWork.lastEffect.nextEffect = finishedWork;
  30701. firstEffect = finishedWork.firstEffect;
  30702. } else {
  30703. firstEffect = finishedWork;
  30704. }
  30705. } else {
  30706. // There is no effect on the root.
  30707. firstEffect = finishedWork.firstEffect;
  30708. }
  30709. if (firstEffect !== null) {
  30710. var prevExecutionContext = executionContext;
  30711. executionContext |= CommitContext;
  30712. var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles
  30713. ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass
  30714. // of the effect list for each phase: all mutation effects come before all
  30715. // layout effects, and so on.
  30716. // The first phase a "before mutation" phase. We use this phase to read the
  30717. // state of the host tree right before we mutate it. This is where
  30718. // getSnapshotBeforeUpdate is called.
  30719. startCommitSnapshotEffectsTimer();
  30720. prepareForCommit(root.containerInfo);
  30721. nextEffect = firstEffect;
  30722. do {
  30723. {
  30724. invokeGuardedCallback(null, commitBeforeMutationEffects, null);
  30725. if (hasCaughtError()) {
  30726. if (!(nextEffect !== null)) {
  30727. {
  30728. throw Error( "Should be working on an effect." );
  30729. }
  30730. }
  30731. var error = clearCaughtError();
  30732. captureCommitPhaseError(nextEffect, error);
  30733. nextEffect = nextEffect.nextEffect;
  30734. }
  30735. }
  30736. } while (nextEffect !== null);
  30737. stopCommitSnapshotEffectsTimer();
  30738. {
  30739. // Mark the current commit time to be shared by all Profilers in this
  30740. // batch. This enables them to be grouped later.
  30741. recordCommitTime();
  30742. } // The next phase is the mutation phase, where we mutate the host tree.
  30743. startCommitHostEffectsTimer();
  30744. nextEffect = firstEffect;
  30745. do {
  30746. {
  30747. invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
  30748. if (hasCaughtError()) {
  30749. if (!(nextEffect !== null)) {
  30750. {
  30751. throw Error( "Should be working on an effect." );
  30752. }
  30753. }
  30754. var _error = clearCaughtError();
  30755. captureCommitPhaseError(nextEffect, _error);
  30756. nextEffect = nextEffect.nextEffect;
  30757. }
  30758. }
  30759. } while (nextEffect !== null);
  30760. stopCommitHostEffectsTimer();
  30761. resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after
  30762. // the mutation phase, so that the previous tree is still current during
  30763. // componentWillUnmount, but before the layout phase, so that the finished
  30764. // work is current during componentDidMount/Update.
  30765. root.current = finishedWork; // The next phase is the layout phase, where we call effects that read
  30766. // the host tree after it's been mutated. The idiomatic use case for this is
  30767. // layout, but class component lifecycles also fire here for legacy reasons.
  30768. startCommitLifeCyclesTimer();
  30769. nextEffect = firstEffect;
  30770. do {
  30771. {
  30772. invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
  30773. if (hasCaughtError()) {
  30774. if (!(nextEffect !== null)) {
  30775. {
  30776. throw Error( "Should be working on an effect." );
  30777. }
  30778. }
  30779. var _error2 = clearCaughtError();
  30780. captureCommitPhaseError(nextEffect, _error2);
  30781. nextEffect = nextEffect.nextEffect;
  30782. }
  30783. }
  30784. } while (nextEffect !== null);
  30785. stopCommitLifeCyclesTimer();
  30786. nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an
  30787. // opportunity to paint.
  30788. requestPaint();
  30789. {
  30790. popInteractions(prevInteractions);
  30791. }
  30792. executionContext = prevExecutionContext;
  30793. } else {
  30794. // No effects.
  30795. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were
  30796. // no effects.
  30797. // TODO: Maybe there's a better way to report this.
  30798. startCommitSnapshotEffectsTimer();
  30799. stopCommitSnapshotEffectsTimer();
  30800. {
  30801. recordCommitTime();
  30802. }
  30803. startCommitHostEffectsTimer();
  30804. stopCommitHostEffectsTimer();
  30805. startCommitLifeCyclesTimer();
  30806. stopCommitLifeCyclesTimer();
  30807. }
  30808. stopCommitTimer();
  30809. var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
  30810. if (rootDoesHavePassiveEffects) {
  30811. // This commit has passive effects. Stash a reference to them. But don't
  30812. // schedule a callback until after flushing layout work.
  30813. rootDoesHavePassiveEffects = false;
  30814. rootWithPendingPassiveEffects = root;
  30815. pendingPassiveEffectsExpirationTime = expirationTime;
  30816. pendingPassiveEffectsRenderPriority = renderPriorityLevel;
  30817. } else {
  30818. // We are done with the effect chain at this point so let's clear the
  30819. // nextEffect pointers to assist with GC. If we have passive effects, we'll
  30820. // clear this in flushPassiveEffects.
  30821. nextEffect = firstEffect;
  30822. while (nextEffect !== null) {
  30823. var nextNextEffect = nextEffect.nextEffect;
  30824. nextEffect.nextEffect = null;
  30825. nextEffect = nextNextEffect;
  30826. }
  30827. } // Check if there's remaining work on this root
  30828. var remainingExpirationTime = root.firstPendingTime;
  30829. if (remainingExpirationTime !== NoWork) {
  30830. {
  30831. if (spawnedWorkDuringRender !== null) {
  30832. var expirationTimes = spawnedWorkDuringRender;
  30833. spawnedWorkDuringRender = null;
  30834. for (var i = 0; i < expirationTimes.length; i++) {
  30835. scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
  30836. }
  30837. }
  30838. schedulePendingInteractions(root, remainingExpirationTime);
  30839. }
  30840. } else {
  30841. // If there's no remaining work, we can clear the set of already failed
  30842. // error boundaries.
  30843. legacyErrorBoundariesThatAlreadyFailed = null;
  30844. }
  30845. {
  30846. if (!rootDidHavePassiveEffects) {
  30847. // If there are no passive effects, then we can complete the pending interactions.
  30848. // Otherwise, we'll wait until after the passive effects are flushed.
  30849. // Wait to do this until after remaining work has been scheduled,
  30850. // so that we don't prematurely signal complete for interactions when there's e.g. hidden work.
  30851. finishPendingInteractions(root, expirationTime);
  30852. }
  30853. }
  30854. if (remainingExpirationTime === Sync) {
  30855. // Count the number of times the root synchronously re-renders without
  30856. // finishing. If there are too many, it indicates an infinite update loop.
  30857. if (root === rootWithNestedUpdates) {
  30858. nestedUpdateCount++;
  30859. } else {
  30860. nestedUpdateCount = 0;
  30861. rootWithNestedUpdates = root;
  30862. }
  30863. } else {
  30864. nestedUpdateCount = 0;
  30865. }
  30866. onCommitRoot(finishedWork.stateNode, expirationTime); // Always call this before exiting `commitRoot`, to ensure that any
  30867. // additional work on this root is scheduled.
  30868. ensureRootIsScheduled(root);
  30869. if (hasUncaughtError) {
  30870. hasUncaughtError = false;
  30871. var _error3 = firstUncaughtError;
  30872. firstUncaughtError = null;
  30873. throw _error3;
  30874. }
  30875. if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
  30876. // This is a legacy edge case. We just committed the initial mount of
  30877. // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
  30878. // synchronously, but layout updates should be deferred until the end
  30879. // of the batch.
  30880. return null;
  30881. } // If layout work was scheduled, flush it now.
  30882. flushSyncCallbackQueue();
  30883. return null;
  30884. }
  30885. function commitBeforeMutationEffects() {
  30886. while (nextEffect !== null) {
  30887. var effectTag = nextEffect.effectTag;
  30888. if ((effectTag & Snapshot) !== NoEffect) {
  30889. setCurrentFiber(nextEffect);
  30890. recordEffect();
  30891. var current = nextEffect.alternate;
  30892. commitBeforeMutationLifeCycles(current, nextEffect);
  30893. resetCurrentFiber();
  30894. }
  30895. if ((effectTag & Passive) !== NoEffect) {
  30896. // If there are passive effects, schedule a callback to flush at
  30897. // the earliest opportunity.
  30898. if (!rootDoesHavePassiveEffects) {
  30899. rootDoesHavePassiveEffects = true;
  30900. scheduleCallback(NormalPriority, function () {
  30901. flushPassiveEffects();
  30902. return null;
  30903. });
  30904. }
  30905. }
  30906. nextEffect = nextEffect.nextEffect;
  30907. }
  30908. }
  30909. function commitMutationEffects(root, renderPriorityLevel) {
  30910. // TODO: Should probably move the bulk of this function to commitWork.
  30911. while (nextEffect !== null) {
  30912. setCurrentFiber(nextEffect);
  30913. var effectTag = nextEffect.effectTag;
  30914. if (effectTag & ContentReset) {
  30915. commitResetTextContent(nextEffect);
  30916. }
  30917. if (effectTag & Ref) {
  30918. var current = nextEffect.alternate;
  30919. if (current !== null) {
  30920. commitDetachRef(current);
  30921. }
  30922. } // The following switch statement is only concerned about placement,
  30923. // updates, and deletions. To avoid needing to add a case for every possible
  30924. // bitmap value, we remove the secondary effects from the effect tag and
  30925. // switch on that value.
  30926. var primaryEffectTag = effectTag & (Placement | Update | Deletion | Hydrating);
  30927. switch (primaryEffectTag) {
  30928. case Placement:
  30929. {
  30930. commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
  30931. // inserted, before any life-cycles like componentDidMount gets called.
  30932. // TODO: findDOMNode doesn't rely on this any more but isMounted does
  30933. // and isMounted is deprecated anyway so we should be able to kill this.
  30934. nextEffect.effectTag &= ~Placement;
  30935. break;
  30936. }
  30937. case PlacementAndUpdate:
  30938. {
  30939. // Placement
  30940. commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
  30941. // inserted, before any life-cycles like componentDidMount gets called.
  30942. nextEffect.effectTag &= ~Placement; // Update
  30943. var _current = nextEffect.alternate;
  30944. commitWork(_current, nextEffect);
  30945. break;
  30946. }
  30947. case Hydrating:
  30948. {
  30949. nextEffect.effectTag &= ~Hydrating;
  30950. break;
  30951. }
  30952. case HydratingAndUpdate:
  30953. {
  30954. nextEffect.effectTag &= ~Hydrating; // Update
  30955. var _current2 = nextEffect.alternate;
  30956. commitWork(_current2, nextEffect);
  30957. break;
  30958. }
  30959. case Update:
  30960. {
  30961. var _current3 = nextEffect.alternate;
  30962. commitWork(_current3, nextEffect);
  30963. break;
  30964. }
  30965. case Deletion:
  30966. {
  30967. commitDeletion(root, nextEffect, renderPriorityLevel);
  30968. break;
  30969. }
  30970. } // TODO: Only record a mutation effect if primaryEffectTag is non-zero.
  30971. recordEffect();
  30972. resetCurrentFiber();
  30973. nextEffect = nextEffect.nextEffect;
  30974. }
  30975. }
  30976. function commitLayoutEffects(root, committedExpirationTime) {
  30977. // TODO: Should probably move the bulk of this function to commitWork.
  30978. while (nextEffect !== null) {
  30979. setCurrentFiber(nextEffect);
  30980. var effectTag = nextEffect.effectTag;
  30981. if (effectTag & (Update | Callback)) {
  30982. recordEffect();
  30983. var current = nextEffect.alternate;
  30984. commitLifeCycles(root, current, nextEffect);
  30985. }
  30986. if (effectTag & Ref) {
  30987. recordEffect();
  30988. commitAttachRef(nextEffect);
  30989. }
  30990. resetCurrentFiber();
  30991. nextEffect = nextEffect.nextEffect;
  30992. }
  30993. }
  30994. function flushPassiveEffects() {
  30995. if (pendingPassiveEffectsRenderPriority !== NoPriority) {
  30996. var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority ? NormalPriority : pendingPassiveEffectsRenderPriority;
  30997. pendingPassiveEffectsRenderPriority = NoPriority;
  30998. return runWithPriority$1(priorityLevel, flushPassiveEffectsImpl);
  30999. }
  31000. }
  31001. function flushPassiveEffectsImpl() {
  31002. if (rootWithPendingPassiveEffects === null) {
  31003. return false;
  31004. }
  31005. var root = rootWithPendingPassiveEffects;
  31006. var expirationTime = pendingPassiveEffectsExpirationTime;
  31007. rootWithPendingPassiveEffects = null;
  31008. pendingPassiveEffectsExpirationTime = NoWork;
  31009. if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
  31010. {
  31011. throw Error( "Cannot flush passive effects while already rendering." );
  31012. }
  31013. }
  31014. var prevExecutionContext = executionContext;
  31015. executionContext |= CommitContext;
  31016. var prevInteractions = pushInteractions(root);
  31017. {
  31018. // Note: This currently assumes there are no passive effects on the root fiber
  31019. // because the root is not part of its own effect list.
  31020. // This could change in the future.
  31021. var _effect2 = root.current.firstEffect;
  31022. while (_effect2 !== null) {
  31023. {
  31024. setCurrentFiber(_effect2);
  31025. invokeGuardedCallback(null, commitPassiveHookEffects, null, _effect2);
  31026. if (hasCaughtError()) {
  31027. if (!(_effect2 !== null)) {
  31028. {
  31029. throw Error( "Should be working on an effect." );
  31030. }
  31031. }
  31032. var _error5 = clearCaughtError();
  31033. captureCommitPhaseError(_effect2, _error5);
  31034. }
  31035. resetCurrentFiber();
  31036. }
  31037. var nextNextEffect = _effect2.nextEffect; // Remove nextEffect pointer to assist GC
  31038. _effect2.nextEffect = null;
  31039. _effect2 = nextNextEffect;
  31040. }
  31041. }
  31042. {
  31043. popInteractions(prevInteractions);
  31044. finishPendingInteractions(root, expirationTime);
  31045. }
  31046. executionContext = prevExecutionContext;
  31047. flushSyncCallbackQueue(); // If additional passive effects were scheduled, increment a counter. If this
  31048. // exceeds the limit, we'll fire a warning.
  31049. nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
  31050. return true;
  31051. }
  31052. function isAlreadyFailedLegacyErrorBoundary(instance) {
  31053. return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
  31054. }
  31055. function markLegacyErrorBoundaryAsFailed(instance) {
  31056. if (legacyErrorBoundariesThatAlreadyFailed === null) {
  31057. legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
  31058. } else {
  31059. legacyErrorBoundariesThatAlreadyFailed.add(instance);
  31060. }
  31061. }
  31062. function prepareToThrowUncaughtError(error) {
  31063. if (!hasUncaughtError) {
  31064. hasUncaughtError = true;
  31065. firstUncaughtError = error;
  31066. }
  31067. }
  31068. var onUncaughtError = prepareToThrowUncaughtError;
  31069. function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
  31070. var errorInfo = createCapturedValue(error, sourceFiber);
  31071. var update = createRootErrorUpdate(rootFiber, errorInfo, Sync);
  31072. enqueueUpdate(rootFiber, update);
  31073. var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync);
  31074. if (root !== null) {
  31075. ensureRootIsScheduled(root);
  31076. schedulePendingInteractions(root, Sync);
  31077. }
  31078. }
  31079. function captureCommitPhaseError(sourceFiber, error) {
  31080. if (sourceFiber.tag === HostRoot) {
  31081. // Error was thrown at the root. There is no parent, so the root
  31082. // itself should capture it.
  31083. captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
  31084. return;
  31085. }
  31086. var fiber = sourceFiber.return;
  31087. while (fiber !== null) {
  31088. if (fiber.tag === HostRoot) {
  31089. captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
  31090. return;
  31091. } else if (fiber.tag === ClassComponent) {
  31092. var ctor = fiber.type;
  31093. var instance = fiber.stateNode;
  31094. if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
  31095. var errorInfo = createCapturedValue(error, sourceFiber);
  31096. var update = createClassErrorUpdate(fiber, errorInfo, // TODO: This is always sync
  31097. Sync);
  31098. enqueueUpdate(fiber, update);
  31099. var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
  31100. if (root !== null) {
  31101. ensureRootIsScheduled(root);
  31102. schedulePendingInteractions(root, Sync);
  31103. }
  31104. return;
  31105. }
  31106. }
  31107. fiber = fiber.return;
  31108. }
  31109. }
  31110. function pingSuspendedRoot(root, thenable, suspendedTime) {
  31111. var pingCache = root.pingCache;
  31112. if (pingCache !== null) {
  31113. // The thenable resolved, so we no longer need to memoize, because it will
  31114. // never be thrown again.
  31115. pingCache.delete(thenable);
  31116. }
  31117. if (workInProgressRoot === root && renderExpirationTime$1 === suspendedTime) {
  31118. // Received a ping at the same priority level at which we're currently
  31119. // rendering. We might want to restart this render. This should mirror
  31120. // the logic of whether or not a root suspends once it completes.
  31121. // TODO: If we're rendering sync either due to Sync, Batched or expired,
  31122. // we should probably never restart.
  31123. // If we're suspended with delay, we'll always suspend so we can always
  31124. // restart. If we're suspended without any updates, it might be a retry.
  31125. // If it's early in the retry we can restart. We can't know for sure
  31126. // whether we'll eventually process an update during this render pass,
  31127. // but it's somewhat unlikely that we get to a ping before that, since
  31128. // getting to the root most update is usually very fast.
  31129. if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
  31130. // Restart from the root. Don't need to schedule a ping because
  31131. // we're already working on this tree.
  31132. prepareFreshStack(root, renderExpirationTime$1);
  31133. } else {
  31134. // Even though we can't restart right now, we might get an
  31135. // opportunity later. So we mark this render as having a ping.
  31136. workInProgressRootHasPendingPing = true;
  31137. }
  31138. return;
  31139. }
  31140. if (!isRootSuspendedAtTime(root, suspendedTime)) {
  31141. // The root is no longer suspended at this time.
  31142. return;
  31143. }
  31144. var lastPingedTime = root.lastPingedTime;
  31145. if (lastPingedTime !== NoWork && lastPingedTime < suspendedTime) {
  31146. // There's already a lower priority ping scheduled.
  31147. return;
  31148. } // Mark the time at which this ping was scheduled.
  31149. root.lastPingedTime = suspendedTime;
  31150. ensureRootIsScheduled(root);
  31151. schedulePendingInteractions(root, suspendedTime);
  31152. }
  31153. function retryTimedOutBoundary(boundaryFiber, retryTime) {
  31154. // The boundary fiber (a Suspense component or SuspenseList component)
  31155. // previously was rendered in its fallback state. One of the promises that
  31156. // suspended it has resolved, which means at least part of the tree was
  31157. // likely unblocked. Try rendering again, at a new expiration time.
  31158. if (retryTime === NoWork) {
  31159. var suspenseConfig = null; // Retries don't carry over the already committed update.
  31160. var currentTime = requestCurrentTimeForUpdate();
  31161. retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
  31162. } // TODO: Special case idle priority?
  31163. var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime);
  31164. if (root !== null) {
  31165. ensureRootIsScheduled(root);
  31166. schedulePendingInteractions(root, retryTime);
  31167. }
  31168. }
  31169. function resolveRetryThenable(boundaryFiber, thenable) {
  31170. var retryTime = NoWork; // Default
  31171. var retryCache;
  31172. {
  31173. retryCache = boundaryFiber.stateNode;
  31174. }
  31175. if (retryCache !== null) {
  31176. // The thenable resolved, so we no longer need to memoize, because it will
  31177. // never be thrown again.
  31178. retryCache.delete(thenable);
  31179. }
  31180. retryTimedOutBoundary(boundaryFiber, retryTime);
  31181. } // Computes the next Just Noticeable Difference (JND) boundary.
  31182. // The theory is that a person can't tell the difference between small differences in time.
  31183. // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable
  31184. // difference in the experience. However, waiting for longer might mean that we can avoid
  31185. // showing an intermediate loading state. The longer we have already waited, the harder it
  31186. // is to tell small differences in time. Therefore, the longer we've already waited,
  31187. // the longer we can wait additionally. At some point we have to give up though.
  31188. // We pick a train model where the next boundary commits at a consistent schedule.
  31189. // These particular numbers are vague estimates. We expect to adjust them based on research.
  31190. function jnd(timeElapsed) {
  31191. return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
  31192. }
  31193. function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) {
  31194. var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0;
  31195. if (busyMinDurationMs <= 0) {
  31196. return 0;
  31197. }
  31198. var busyDelayMs = suspenseConfig.busyDelayMs | 0; // Compute the time until this render pass would expire.
  31199. var currentTimeMs = now();
  31200. var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig);
  31201. var timeElapsed = currentTimeMs - eventTimeMs;
  31202. if (timeElapsed <= busyDelayMs) {
  31203. // If we haven't yet waited longer than the initial delay, we don't
  31204. // have to wait any additional time.
  31205. return 0;
  31206. }
  31207. var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; // This is the value that is passed to `setTimeout`.
  31208. return msUntilTimeout;
  31209. }
  31210. function checkForNestedUpdates() {
  31211. if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
  31212. nestedUpdateCount = 0;
  31213. rootWithNestedUpdates = null;
  31214. {
  31215. {
  31216. throw Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." );
  31217. }
  31218. }
  31219. }
  31220. {
  31221. if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
  31222. nestedPassiveUpdateCount = 0;
  31223. error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.');
  31224. }
  31225. }
  31226. }
  31227. function flushRenderPhaseStrictModeWarningsInDEV() {
  31228. {
  31229. ReactStrictModeWarnings.flushLegacyContextWarning();
  31230. {
  31231. ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
  31232. }
  31233. }
  31234. }
  31235. function stopFinishedWorkLoopTimer() {
  31236. var didCompleteRoot = true;
  31237. stopWorkLoopTimer(interruptedBy, didCompleteRoot);
  31238. interruptedBy = null;
  31239. }
  31240. function stopInterruptedWorkLoopTimer() {
  31241. // TODO: Track which fiber caused the interruption.
  31242. var didCompleteRoot = false;
  31243. stopWorkLoopTimer(interruptedBy, didCompleteRoot);
  31244. interruptedBy = null;
  31245. }
  31246. function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) {
  31247. if ( workInProgressRoot !== null && updateExpirationTime > renderExpirationTime$1) {
  31248. interruptedBy = fiberThatReceivedUpdate;
  31249. }
  31250. }
  31251. var didWarnStateUpdateForUnmountedComponent = null;
  31252. function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
  31253. {
  31254. var tag = fiber.tag;
  31255. if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) {
  31256. // Only warn for user-defined components, not internal ones like Suspense.
  31257. return;
  31258. }
  31259. // the problematic code almost always lies inside that component.
  31260. var componentName = getComponentName(fiber.type) || 'ReactComponent';
  31261. if (didWarnStateUpdateForUnmountedComponent !== null) {
  31262. if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
  31263. return;
  31264. }
  31265. didWarnStateUpdateForUnmountedComponent.add(componentName);
  31266. } else {
  31267. didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
  31268. }
  31269. error("Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
  31270. }
  31271. }
  31272. var beginWork$1;
  31273. {
  31274. var dummyFiber = null;
  31275. beginWork$1 = function (current, unitOfWork, expirationTime) {
  31276. // If a component throws an error, we replay it again in a synchronously
  31277. // dispatched event, so that the debugger will treat it as an uncaught
  31278. // error See ReactErrorUtils for more information.
  31279. // Before entering the begin phase, copy the work-in-progress onto a dummy
  31280. // fiber. If beginWork throws, we'll use this to reset the state.
  31281. var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
  31282. try {
  31283. return beginWork(current, unitOfWork, expirationTime);
  31284. } catch (originalError) {
  31285. if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
  31286. // Don't replay promises. Treat everything else like an error.
  31287. throw originalError;
  31288. } // Keep this code in sync with handleError; any changes here must have
  31289. // corresponding changes there.
  31290. resetContextDependencies();
  31291. resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the
  31292. // same fiber again.
  31293. // Unwind the failed stack frame
  31294. unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
  31295. assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
  31296. if ( unitOfWork.mode & ProfileMode) {
  31297. // Reset the profiler timer.
  31298. startProfilerTimer(unitOfWork);
  31299. } // Run beginWork again.
  31300. invokeGuardedCallback(null, beginWork, null, current, unitOfWork, expirationTime);
  31301. if (hasCaughtError()) {
  31302. var replayError = clearCaughtError(); // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`.
  31303. // Rethrow this error instead of the original one.
  31304. throw replayError;
  31305. } else {
  31306. // This branch is reachable if the render phase is impure.
  31307. throw originalError;
  31308. }
  31309. }
  31310. };
  31311. }
  31312. var didWarnAboutUpdateInRender = false;
  31313. var didWarnAboutUpdateInRenderForAnotherComponent;
  31314. {
  31315. didWarnAboutUpdateInRenderForAnotherComponent = new Set();
  31316. }
  31317. function warnAboutRenderPhaseUpdatesInDEV(fiber) {
  31318. {
  31319. if (isRendering && (executionContext & RenderContext) !== NoContext) {
  31320. switch (fiber.tag) {
  31321. case FunctionComponent:
  31322. case ForwardRef:
  31323. case SimpleMemoComponent:
  31324. {
  31325. var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed.
  31326. var dedupeKey = renderingComponentName;
  31327. if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) {
  31328. didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey);
  31329. var setStateComponentName = getComponentName(fiber.type) || 'Unknown';
  31330. error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://fb.me/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName);
  31331. }
  31332. break;
  31333. }
  31334. case ClassComponent:
  31335. {
  31336. if (!didWarnAboutUpdateInRender) {
  31337. error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.');
  31338. didWarnAboutUpdateInRender = true;
  31339. }
  31340. break;
  31341. }
  31342. }
  31343. }
  31344. }
  31345. } // a 'shared' variable that changes when act() opens/closes in tests.
  31346. var IsThisRendererActing = {
  31347. current: false
  31348. };
  31349. function warnIfNotScopedWithMatchingAct(fiber) {
  31350. {
  31351. if ( IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
  31352. error("It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '// ...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '// ...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber));
  31353. }
  31354. }
  31355. }
  31356. function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
  31357. {
  31358. if ( (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
  31359. error('An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
  31360. }
  31361. }
  31362. }
  31363. function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
  31364. {
  31365. if ( executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
  31366. error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
  31367. }
  31368. }
  31369. }
  31370. var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; // In tests, we want to enforce a mocked scheduler.
  31371. var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent mode, revisit this and decide whether a mocked
  31372. // scheduler is the actual recommendation. The alternative could be a testing build,
  31373. // a new lib, or whatever; we dunno just yet. This message is for early adopters
  31374. // to get their tests right.
  31375. function warnIfUnmockedScheduler(fiber) {
  31376. {
  31377. if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {
  31378. if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
  31379. didWarnAboutUnmockedScheduler = true;
  31380. error('In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
  31381. }
  31382. }
  31383. }
  31384. }
  31385. function computeThreadID(root, expirationTime) {
  31386. // Interaction threads are unique per root and expiration time.
  31387. return expirationTime * 1000 + root.interactionThreadID;
  31388. }
  31389. function markSpawnedWork(expirationTime) {
  31390. if (spawnedWorkDuringRender === null) {
  31391. spawnedWorkDuringRender = [expirationTime];
  31392. } else {
  31393. spawnedWorkDuringRender.push(expirationTime);
  31394. }
  31395. }
  31396. function scheduleInteractions(root, expirationTime, interactions) {
  31397. if (interactions.size > 0) {
  31398. var pendingInteractionMap = root.pendingInteractionMap;
  31399. var pendingInteractions = pendingInteractionMap.get(expirationTime);
  31400. if (pendingInteractions != null) {
  31401. interactions.forEach(function (interaction) {
  31402. if (!pendingInteractions.has(interaction)) {
  31403. // Update the pending async work count for previously unscheduled interaction.
  31404. interaction.__count++;
  31405. }
  31406. pendingInteractions.add(interaction);
  31407. });
  31408. } else {
  31409. pendingInteractionMap.set(expirationTime, new Set(interactions)); // Update the pending async work count for the current interactions.
  31410. interactions.forEach(function (interaction) {
  31411. interaction.__count++;
  31412. });
  31413. }
  31414. var subscriber = tracing.__subscriberRef.current;
  31415. if (subscriber !== null) {
  31416. var threadID = computeThreadID(root, expirationTime);
  31417. subscriber.onWorkScheduled(interactions, threadID);
  31418. }
  31419. }
  31420. }
  31421. function schedulePendingInteractions(root, expirationTime) {
  31422. scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current);
  31423. }
  31424. function startWorkOnPendingInteractions(root, expirationTime) {
  31425. // we can accurately attribute time spent working on it, And so that cascading
  31426. // work triggered during the render phase will be associated with it.
  31427. var interactions = new Set();
  31428. root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
  31429. if (scheduledExpirationTime >= expirationTime) {
  31430. scheduledInteractions.forEach(function (interaction) {
  31431. return interactions.add(interaction);
  31432. });
  31433. }
  31434. }); // Store the current set of interactions on the FiberRoot for a few reasons:
  31435. // We can re-use it in hot functions like performConcurrentWorkOnRoot()
  31436. // without having to recalculate it. We will also use it in commitWork() to
  31437. // pass to any Profiler onRender() hooks. This also provides DevTools with a
  31438. // way to access it when the onCommitRoot() hook is called.
  31439. root.memoizedInteractions = interactions;
  31440. if (interactions.size > 0) {
  31441. var subscriber = tracing.__subscriberRef.current;
  31442. if (subscriber !== null) {
  31443. var threadID = computeThreadID(root, expirationTime);
  31444. try {
  31445. subscriber.onWorkStarted(interactions, threadID);
  31446. } catch (error) {
  31447. // If the subscriber throws, rethrow it in a separate task
  31448. scheduleCallback(ImmediatePriority, function () {
  31449. throw error;
  31450. });
  31451. }
  31452. }
  31453. }
  31454. }
  31455. function finishPendingInteractions(root, committedExpirationTime) {
  31456. var earliestRemainingTimeAfterCommit = root.firstPendingTime;
  31457. var subscriber;
  31458. try {
  31459. subscriber = tracing.__subscriberRef.current;
  31460. if (subscriber !== null && root.memoizedInteractions.size > 0) {
  31461. var threadID = computeThreadID(root, committedExpirationTime);
  31462. subscriber.onWorkStopped(root.memoizedInteractions, threadID);
  31463. }
  31464. } catch (error) {
  31465. // If the subscriber throws, rethrow it in a separate task
  31466. scheduleCallback(ImmediatePriority, function () {
  31467. throw error;
  31468. });
  31469. } finally {
  31470. // Clear completed interactions from the pending Map.
  31471. // Unless the render was suspended or cascading work was scheduled,
  31472. // In which case– leave pending interactions until the subsequent render.
  31473. var pendingInteractionMap = root.pendingInteractionMap;
  31474. pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
  31475. // Only decrement the pending interaction count if we're done.
  31476. // If there's still work at the current priority,
  31477. // That indicates that we are waiting for suspense data.
  31478. if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
  31479. pendingInteractionMap.delete(scheduledExpirationTime);
  31480. scheduledInteractions.forEach(function (interaction) {
  31481. interaction.__count--;
  31482. if (subscriber !== null && interaction.__count === 0) {
  31483. try {
  31484. subscriber.onInteractionScheduledWorkCompleted(interaction);
  31485. } catch (error) {
  31486. // If the subscriber throws, rethrow it in a separate task
  31487. scheduleCallback(ImmediatePriority, function () {
  31488. throw error;
  31489. });
  31490. }
  31491. }
  31492. });
  31493. }
  31494. });
  31495. }
  31496. }
  31497. var onScheduleFiberRoot = null;
  31498. var onCommitFiberRoot = null;
  31499. var onCommitFiberUnmount = null;
  31500. var hasLoggedError = false;
  31501. var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
  31502. function injectInternals(internals) {
  31503. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  31504. // No DevTools
  31505. return false;
  31506. }
  31507. var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
  31508. if (hook.isDisabled) {
  31509. // This isn't a real property on the hook, but it can be set to opt out
  31510. // of DevTools integration and associated warnings and logs.
  31511. // https://github.com/facebook/react/issues/3877
  31512. return true;
  31513. }
  31514. if (!hook.supportsFiber) {
  31515. {
  31516. error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
  31517. } // DevTools exists, even though it doesn't support Fiber.
  31518. return true;
  31519. }
  31520. try {
  31521. var rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks.
  31522. if (true) {
  31523. // Only used by Fast Refresh
  31524. if (typeof hook.onScheduleFiberRoot === 'function') {
  31525. onScheduleFiberRoot = function (root, children) {
  31526. try {
  31527. hook.onScheduleFiberRoot(rendererID, root, children);
  31528. } catch (err) {
  31529. if ( true && !hasLoggedError) {
  31530. hasLoggedError = true;
  31531. error('React instrumentation encountered an error: %s', err);
  31532. }
  31533. }
  31534. };
  31535. }
  31536. }
  31537. onCommitFiberRoot = function (root, expirationTime) {
  31538. try {
  31539. var didError = (root.current.effectTag & DidCapture) === DidCapture;
  31540. if (enableProfilerTimer) {
  31541. var currentTime = getCurrentTime();
  31542. var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
  31543. hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
  31544. } else {
  31545. hook.onCommitFiberRoot(rendererID, root, undefined, didError);
  31546. }
  31547. } catch (err) {
  31548. if (true) {
  31549. if (!hasLoggedError) {
  31550. hasLoggedError = true;
  31551. error('React instrumentation encountered an error: %s', err);
  31552. }
  31553. }
  31554. }
  31555. };
  31556. onCommitFiberUnmount = function (fiber) {
  31557. try {
  31558. hook.onCommitFiberUnmount(rendererID, fiber);
  31559. } catch (err) {
  31560. if (true) {
  31561. if (!hasLoggedError) {
  31562. hasLoggedError = true;
  31563. error('React instrumentation encountered an error: %s', err);
  31564. }
  31565. }
  31566. }
  31567. };
  31568. } catch (err) {
  31569. // Catch all errors because it is unsafe to throw during initialization.
  31570. {
  31571. error('React instrumentation encountered an error: %s.', err);
  31572. }
  31573. } // DevTools exists
  31574. return true;
  31575. }
  31576. function onScheduleRoot(root, children) {
  31577. if (typeof onScheduleFiberRoot === 'function') {
  31578. onScheduleFiberRoot(root, children);
  31579. }
  31580. }
  31581. function onCommitRoot(root, expirationTime) {
  31582. if (typeof onCommitFiberRoot === 'function') {
  31583. onCommitFiberRoot(root, expirationTime);
  31584. }
  31585. }
  31586. function onCommitUnmount(fiber) {
  31587. if (typeof onCommitFiberUnmount === 'function') {
  31588. onCommitFiberUnmount(fiber);
  31589. }
  31590. }
  31591. var hasBadMapPolyfill;
  31592. {
  31593. hasBadMapPolyfill = false;
  31594. try {
  31595. var nonExtensibleObject = Object.preventExtensions({});
  31596. var testMap = new Map([[nonExtensibleObject, null]]);
  31597. var testSet = new Set([nonExtensibleObject]); // This is necessary for Rollup to not consider these unused.
  31598. // https://github.com/rollup/rollup/issues/1771
  31599. // TODO: we can remove these if Rollup fixes the bug.
  31600. testMap.set(0, 0);
  31601. testSet.add(0);
  31602. } catch (e) {
  31603. // TODO: Consider warning about bad polyfills
  31604. hasBadMapPolyfill = true;
  31605. }
  31606. }
  31607. var debugCounter = 1;
  31608. function FiberNode(tag, pendingProps, key, mode) {
  31609. // Instance
  31610. this.tag = tag;
  31611. this.key = key;
  31612. this.elementType = null;
  31613. this.type = null;
  31614. this.stateNode = null; // Fiber
  31615. this.return = null;
  31616. this.child = null;
  31617. this.sibling = null;
  31618. this.index = 0;
  31619. this.ref = null;
  31620. this.pendingProps = pendingProps;
  31621. this.memoizedProps = null;
  31622. this.updateQueue = null;
  31623. this.memoizedState = null;
  31624. this.dependencies = null;
  31625. this.mode = mode; // Effects
  31626. this.effectTag = NoEffect;
  31627. this.nextEffect = null;
  31628. this.firstEffect = null;
  31629. this.lastEffect = null;
  31630. this.expirationTime = NoWork;
  31631. this.childExpirationTime = NoWork;
  31632. this.alternate = null;
  31633. {
  31634. // Note: The following is done to avoid a v8 performance cliff.
  31635. //
  31636. // Initializing the fields below to smis and later updating them with
  31637. // double values will cause Fibers to end up having separate shapes.
  31638. // This behavior/bug has something to do with Object.preventExtension().
  31639. // Fortunately this only impacts DEV builds.
  31640. // Unfortunately it makes React unusably slow for some applications.
  31641. // To work around this, initialize the fields below with doubles.
  31642. //
  31643. // Learn more about this here:
  31644. // https://github.com/facebook/react/issues/14365
  31645. // https://bugs.chromium.org/p/v8/issues/detail?id=8538
  31646. this.actualDuration = Number.NaN;
  31647. this.actualStartTime = Number.NaN;
  31648. this.selfBaseDuration = Number.NaN;
  31649. this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization.
  31650. // This won't trigger the performance cliff mentioned above,
  31651. // and it simplifies other profiler code (including DevTools).
  31652. this.actualDuration = 0;
  31653. this.actualStartTime = -1;
  31654. this.selfBaseDuration = 0;
  31655. this.treeBaseDuration = 0;
  31656. } // This is normally DEV-only except www when it adds listeners.
  31657. // TODO: remove the User Timing integration in favor of Root Events.
  31658. {
  31659. this._debugID = debugCounter++;
  31660. this._debugIsCurrentlyTiming = false;
  31661. }
  31662. {
  31663. this._debugSource = null;
  31664. this._debugOwner = null;
  31665. this._debugNeedsRemount = false;
  31666. this._debugHookTypes = null;
  31667. if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
  31668. Object.preventExtensions(this);
  31669. }
  31670. }
  31671. } // This is a constructor function, rather than a POJO constructor, still
  31672. // please ensure we do the following:
  31673. // 1) Nobody should add any instance methods on this. Instance methods can be
  31674. // more difficult to predict when they get optimized and they are almost
  31675. // never inlined properly in static compilers.
  31676. // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
  31677. // always know when it is a fiber.
  31678. // 3) We might want to experiment with using numeric keys since they are easier
  31679. // to optimize in a non-JIT environment.
  31680. // 4) We can easily go from a constructor to a createFiber object literal if that
  31681. // is faster.
  31682. // 5) It should be easy to port this to a C struct and keep a C implementation
  31683. // compatible.
  31684. var createFiber = function (tag, pendingProps, key, mode) {
  31685. // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
  31686. return new FiberNode(tag, pendingProps, key, mode);
  31687. };
  31688. function shouldConstruct(Component) {
  31689. var prototype = Component.prototype;
  31690. return !!(prototype && prototype.isReactComponent);
  31691. }
  31692. function isSimpleFunctionComponent(type) {
  31693. return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
  31694. }
  31695. function resolveLazyComponentTag(Component) {
  31696. if (typeof Component === 'function') {
  31697. return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
  31698. } else if (Component !== undefined && Component !== null) {
  31699. var $$typeof = Component.$$typeof;
  31700. if ($$typeof === REACT_FORWARD_REF_TYPE) {
  31701. return ForwardRef;
  31702. }
  31703. if ($$typeof === REACT_MEMO_TYPE) {
  31704. return MemoComponent;
  31705. }
  31706. }
  31707. return IndeterminateComponent;
  31708. } // This is used to create an alternate fiber to do work on.
  31709. function createWorkInProgress(current, pendingProps) {
  31710. var workInProgress = current.alternate;
  31711. if (workInProgress === null) {
  31712. // We use a double buffering pooling technique because we know that we'll
  31713. // only ever need at most two versions of a tree. We pool the "other" unused
  31714. // node that we're free to reuse. This is lazily created to avoid allocating
  31715. // extra objects for things that are never updated. It also allow us to
  31716. // reclaim the extra memory if needed.
  31717. workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
  31718. workInProgress.elementType = current.elementType;
  31719. workInProgress.type = current.type;
  31720. workInProgress.stateNode = current.stateNode;
  31721. {
  31722. // DEV-only fields
  31723. {
  31724. workInProgress._debugID = current._debugID;
  31725. }
  31726. workInProgress._debugSource = current._debugSource;
  31727. workInProgress._debugOwner = current._debugOwner;
  31728. workInProgress._debugHookTypes = current._debugHookTypes;
  31729. }
  31730. workInProgress.alternate = current;
  31731. current.alternate = workInProgress;
  31732. } else {
  31733. workInProgress.pendingProps = pendingProps; // We already have an alternate.
  31734. // Reset the effect tag.
  31735. workInProgress.effectTag = NoEffect; // The effect list is no longer valid.
  31736. workInProgress.nextEffect = null;
  31737. workInProgress.firstEffect = null;
  31738. workInProgress.lastEffect = null;
  31739. {
  31740. // We intentionally reset, rather than copy, actualDuration & actualStartTime.
  31741. // This prevents time from endlessly accumulating in new commits.
  31742. // This has the downside of resetting values for different priority renders,
  31743. // But works for yielding (the common case) and should support resuming.
  31744. workInProgress.actualDuration = 0;
  31745. workInProgress.actualStartTime = -1;
  31746. }
  31747. }
  31748. workInProgress.childExpirationTime = current.childExpirationTime;
  31749. workInProgress.expirationTime = current.expirationTime;
  31750. workInProgress.child = current.child;
  31751. workInProgress.memoizedProps = current.memoizedProps;
  31752. workInProgress.memoizedState = current.memoizedState;
  31753. workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so
  31754. // it cannot be shared with the current fiber.
  31755. var currentDependencies = current.dependencies;
  31756. workInProgress.dependencies = currentDependencies === null ? null : {
  31757. expirationTime: currentDependencies.expirationTime,
  31758. firstContext: currentDependencies.firstContext,
  31759. responders: currentDependencies.responders
  31760. }; // These will be overridden during the parent's reconciliation
  31761. workInProgress.sibling = current.sibling;
  31762. workInProgress.index = current.index;
  31763. workInProgress.ref = current.ref;
  31764. {
  31765. workInProgress.selfBaseDuration = current.selfBaseDuration;
  31766. workInProgress.treeBaseDuration = current.treeBaseDuration;
  31767. }
  31768. {
  31769. workInProgress._debugNeedsRemount = current._debugNeedsRemount;
  31770. switch (workInProgress.tag) {
  31771. case IndeterminateComponent:
  31772. case FunctionComponent:
  31773. case SimpleMemoComponent:
  31774. workInProgress.type = resolveFunctionForHotReloading(current.type);
  31775. break;
  31776. case ClassComponent:
  31777. workInProgress.type = resolveClassForHotReloading(current.type);
  31778. break;
  31779. case ForwardRef:
  31780. workInProgress.type = resolveForwardRefForHotReloading(current.type);
  31781. break;
  31782. }
  31783. }
  31784. return workInProgress;
  31785. } // Used to reuse a Fiber for a second pass.
  31786. function resetWorkInProgress(workInProgress, renderExpirationTime) {
  31787. // This resets the Fiber to what createFiber or createWorkInProgress would
  31788. // have set the values to before during the first pass. Ideally this wouldn't
  31789. // be necessary but unfortunately many code paths reads from the workInProgress
  31790. // when they should be reading from current and writing to workInProgress.
  31791. // We assume pendingProps, index, key, ref, return are still untouched to
  31792. // avoid doing another reconciliation.
  31793. // Reset the effect tag but keep any Placement tags, since that's something
  31794. // that child fiber is setting, not the reconciliation.
  31795. workInProgress.effectTag &= Placement; // The effect list is no longer valid.
  31796. workInProgress.nextEffect = null;
  31797. workInProgress.firstEffect = null;
  31798. workInProgress.lastEffect = null;
  31799. var current = workInProgress.alternate;
  31800. if (current === null) {
  31801. // Reset to createFiber's initial values.
  31802. workInProgress.childExpirationTime = NoWork;
  31803. workInProgress.expirationTime = renderExpirationTime;
  31804. workInProgress.child = null;
  31805. workInProgress.memoizedProps = null;
  31806. workInProgress.memoizedState = null;
  31807. workInProgress.updateQueue = null;
  31808. workInProgress.dependencies = null;
  31809. {
  31810. // Note: We don't reset the actualTime counts. It's useful to accumulate
  31811. // actual time across multiple render passes.
  31812. workInProgress.selfBaseDuration = 0;
  31813. workInProgress.treeBaseDuration = 0;
  31814. }
  31815. } else {
  31816. // Reset to the cloned values that createWorkInProgress would've.
  31817. workInProgress.childExpirationTime = current.childExpirationTime;
  31818. workInProgress.expirationTime = current.expirationTime;
  31819. workInProgress.child = current.child;
  31820. workInProgress.memoizedProps = current.memoizedProps;
  31821. workInProgress.memoizedState = current.memoizedState;
  31822. workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so
  31823. // it cannot be shared with the current fiber.
  31824. var currentDependencies = current.dependencies;
  31825. workInProgress.dependencies = currentDependencies === null ? null : {
  31826. expirationTime: currentDependencies.expirationTime,
  31827. firstContext: currentDependencies.firstContext,
  31828. responders: currentDependencies.responders
  31829. };
  31830. {
  31831. // Note: We don't reset the actualTime counts. It's useful to accumulate
  31832. // actual time across multiple render passes.
  31833. workInProgress.selfBaseDuration = current.selfBaseDuration;
  31834. workInProgress.treeBaseDuration = current.treeBaseDuration;
  31835. }
  31836. }
  31837. return workInProgress;
  31838. }
  31839. function createHostRootFiber(tag) {
  31840. var mode;
  31841. if (tag === ConcurrentRoot) {
  31842. mode = ConcurrentMode | BlockingMode | StrictMode;
  31843. } else if (tag === BlockingRoot) {
  31844. mode = BlockingMode | StrictMode;
  31845. } else {
  31846. mode = NoMode;
  31847. }
  31848. if ( isDevToolsPresent) {
  31849. // Always collect profile timings when DevTools are present.
  31850. // This enables DevTools to start capturing timing at any point–
  31851. // Without some nodes in the tree having empty base times.
  31852. mode |= ProfileMode;
  31853. }
  31854. return createFiber(HostRoot, null, null, mode);
  31855. }
  31856. function createFiberFromTypeAndProps(type, // React$ElementType
  31857. key, pendingProps, owner, mode, expirationTime) {
  31858. var fiber;
  31859. var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
  31860. var resolvedType = type;
  31861. if (typeof type === 'function') {
  31862. if (shouldConstruct(type)) {
  31863. fiberTag = ClassComponent;
  31864. {
  31865. resolvedType = resolveClassForHotReloading(resolvedType);
  31866. }
  31867. } else {
  31868. {
  31869. resolvedType = resolveFunctionForHotReloading(resolvedType);
  31870. }
  31871. }
  31872. } else if (typeof type === 'string') {
  31873. fiberTag = HostComponent;
  31874. } else {
  31875. getTag: switch (type) {
  31876. case REACT_FRAGMENT_TYPE:
  31877. return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
  31878. case REACT_CONCURRENT_MODE_TYPE:
  31879. fiberTag = Mode;
  31880. mode |= ConcurrentMode | BlockingMode | StrictMode;
  31881. break;
  31882. case REACT_STRICT_MODE_TYPE:
  31883. fiberTag = Mode;
  31884. mode |= StrictMode;
  31885. break;
  31886. case REACT_PROFILER_TYPE:
  31887. return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
  31888. case REACT_SUSPENSE_TYPE:
  31889. return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
  31890. case REACT_SUSPENSE_LIST_TYPE:
  31891. return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key);
  31892. default:
  31893. {
  31894. if (typeof type === 'object' && type !== null) {
  31895. switch (type.$$typeof) {
  31896. case REACT_PROVIDER_TYPE:
  31897. fiberTag = ContextProvider;
  31898. break getTag;
  31899. case REACT_CONTEXT_TYPE:
  31900. // This is a consumer
  31901. fiberTag = ContextConsumer;
  31902. break getTag;
  31903. case REACT_FORWARD_REF_TYPE:
  31904. fiberTag = ForwardRef;
  31905. {
  31906. resolvedType = resolveForwardRefForHotReloading(resolvedType);
  31907. }
  31908. break getTag;
  31909. case REACT_MEMO_TYPE:
  31910. fiberTag = MemoComponent;
  31911. break getTag;
  31912. case REACT_LAZY_TYPE:
  31913. fiberTag = LazyComponent;
  31914. resolvedType = null;
  31915. break getTag;
  31916. case REACT_BLOCK_TYPE:
  31917. fiberTag = Block;
  31918. break getTag;
  31919. }
  31920. }
  31921. var info = '';
  31922. {
  31923. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  31924. info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
  31925. }
  31926. var ownerName = owner ? getComponentName(owner.type) : null;
  31927. if (ownerName) {
  31928. info += '\n\nCheck the render method of `' + ownerName + '`.';
  31929. }
  31930. }
  31931. {
  31932. {
  31933. throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info );
  31934. }
  31935. }
  31936. }
  31937. }
  31938. }
  31939. fiber = createFiber(fiberTag, pendingProps, key, mode);
  31940. fiber.elementType = type;
  31941. fiber.type = resolvedType;
  31942. fiber.expirationTime = expirationTime;
  31943. return fiber;
  31944. }
  31945. function createFiberFromElement(element, mode, expirationTime) {
  31946. var owner = null;
  31947. {
  31948. owner = element._owner;
  31949. }
  31950. var type = element.type;
  31951. var key = element.key;
  31952. var pendingProps = element.props;
  31953. var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
  31954. {
  31955. fiber._debugSource = element._source;
  31956. fiber._debugOwner = element._owner;
  31957. }
  31958. return fiber;
  31959. }
  31960. function createFiberFromFragment(elements, mode, expirationTime, key) {
  31961. var fiber = createFiber(Fragment, elements, key, mode);
  31962. fiber.expirationTime = expirationTime;
  31963. return fiber;
  31964. }
  31965. function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
  31966. {
  31967. if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
  31968. error('Profiler must specify an "id" string and "onRender" function as props');
  31969. }
  31970. }
  31971. var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); // TODO: The Profiler fiber shouldn't have a type. It has a tag.
  31972. fiber.elementType = REACT_PROFILER_TYPE;
  31973. fiber.type = REACT_PROFILER_TYPE;
  31974. fiber.expirationTime = expirationTime;
  31975. return fiber;
  31976. }
  31977. function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
  31978. var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
  31979. // This needs to be fixed in getComponentName so that it relies on the tag
  31980. // instead.
  31981. fiber.type = REACT_SUSPENSE_TYPE;
  31982. fiber.elementType = REACT_SUSPENSE_TYPE;
  31983. fiber.expirationTime = expirationTime;
  31984. return fiber;
  31985. }
  31986. function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) {
  31987. var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
  31988. {
  31989. // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag.
  31990. // This needs to be fixed in getComponentName so that it relies on the tag
  31991. // instead.
  31992. fiber.type = REACT_SUSPENSE_LIST_TYPE;
  31993. }
  31994. fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
  31995. fiber.expirationTime = expirationTime;
  31996. return fiber;
  31997. }
  31998. function createFiberFromText(content, mode, expirationTime) {
  31999. var fiber = createFiber(HostText, content, null, mode);
  32000. fiber.expirationTime = expirationTime;
  32001. return fiber;
  32002. }
  32003. function createFiberFromHostInstanceForDeletion() {
  32004. var fiber = createFiber(HostComponent, null, null, NoMode); // TODO: These should not need a type.
  32005. fiber.elementType = 'DELETED';
  32006. fiber.type = 'DELETED';
  32007. return fiber;
  32008. }
  32009. function createFiberFromPortal(portal, mode, expirationTime) {
  32010. var pendingProps = portal.children !== null ? portal.children : [];
  32011. var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
  32012. fiber.expirationTime = expirationTime;
  32013. fiber.stateNode = {
  32014. containerInfo: portal.containerInfo,
  32015. pendingChildren: null,
  32016. // Used by persistent updates
  32017. implementation: portal.implementation
  32018. };
  32019. return fiber;
  32020. } // Used for stashing WIP properties to replay failed work in DEV.
  32021. function assignFiberPropertiesInDEV(target, source) {
  32022. if (target === null) {
  32023. // This Fiber's initial properties will always be overwritten.
  32024. // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
  32025. target = createFiber(IndeterminateComponent, null, null, NoMode);
  32026. } // This is intentionally written as a list of all properties.
  32027. // We tried to use Object.assign() instead but this is called in
  32028. // the hottest path, and Object.assign() was too slow:
  32029. // https://github.com/facebook/react/issues/12502
  32030. // This code is DEV-only so size is not a concern.
  32031. target.tag = source.tag;
  32032. target.key = source.key;
  32033. target.elementType = source.elementType;
  32034. target.type = source.type;
  32035. target.stateNode = source.stateNode;
  32036. target.return = source.return;
  32037. target.child = source.child;
  32038. target.sibling = source.sibling;
  32039. target.index = source.index;
  32040. target.ref = source.ref;
  32041. target.pendingProps = source.pendingProps;
  32042. target.memoizedProps = source.memoizedProps;
  32043. target.updateQueue = source.updateQueue;
  32044. target.memoizedState = source.memoizedState;
  32045. target.dependencies = source.dependencies;
  32046. target.mode = source.mode;
  32047. target.effectTag = source.effectTag;
  32048. target.nextEffect = source.nextEffect;
  32049. target.firstEffect = source.firstEffect;
  32050. target.lastEffect = source.lastEffect;
  32051. target.expirationTime = source.expirationTime;
  32052. target.childExpirationTime = source.childExpirationTime;
  32053. target.alternate = source.alternate;
  32054. {
  32055. target.actualDuration = source.actualDuration;
  32056. target.actualStartTime = source.actualStartTime;
  32057. target.selfBaseDuration = source.selfBaseDuration;
  32058. target.treeBaseDuration = source.treeBaseDuration;
  32059. }
  32060. {
  32061. target._debugID = source._debugID;
  32062. }
  32063. target._debugSource = source._debugSource;
  32064. target._debugOwner = source._debugOwner;
  32065. target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
  32066. target._debugNeedsRemount = source._debugNeedsRemount;
  32067. target._debugHookTypes = source._debugHookTypes;
  32068. return target;
  32069. }
  32070. function FiberRootNode(containerInfo, tag, hydrate) {
  32071. this.tag = tag;
  32072. this.current = null;
  32073. this.containerInfo = containerInfo;
  32074. this.pendingChildren = null;
  32075. this.pingCache = null;
  32076. this.finishedExpirationTime = NoWork;
  32077. this.finishedWork = null;
  32078. this.timeoutHandle = noTimeout;
  32079. this.context = null;
  32080. this.pendingContext = null;
  32081. this.hydrate = hydrate;
  32082. this.callbackNode = null;
  32083. this.callbackPriority = NoPriority;
  32084. this.firstPendingTime = NoWork;
  32085. this.firstSuspendedTime = NoWork;
  32086. this.lastSuspendedTime = NoWork;
  32087. this.nextKnownPendingLevel = NoWork;
  32088. this.lastPingedTime = NoWork;
  32089. this.lastExpiredTime = NoWork;
  32090. {
  32091. this.interactionThreadID = tracing.unstable_getThreadID();
  32092. this.memoizedInteractions = new Set();
  32093. this.pendingInteractionMap = new Map();
  32094. }
  32095. }
  32096. function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) {
  32097. var root = new FiberRootNode(containerInfo, tag, hydrate);
  32098. // stateNode is any.
  32099. var uninitializedFiber = createHostRootFiber(tag);
  32100. root.current = uninitializedFiber;
  32101. uninitializedFiber.stateNode = root;
  32102. initializeUpdateQueue(uninitializedFiber);
  32103. return root;
  32104. }
  32105. function isRootSuspendedAtTime(root, expirationTime) {
  32106. var firstSuspendedTime = root.firstSuspendedTime;
  32107. var lastSuspendedTime = root.lastSuspendedTime;
  32108. return firstSuspendedTime !== NoWork && firstSuspendedTime >= expirationTime && lastSuspendedTime <= expirationTime;
  32109. }
  32110. function markRootSuspendedAtTime(root, expirationTime) {
  32111. var firstSuspendedTime = root.firstSuspendedTime;
  32112. var lastSuspendedTime = root.lastSuspendedTime;
  32113. if (firstSuspendedTime < expirationTime) {
  32114. root.firstSuspendedTime = expirationTime;
  32115. }
  32116. if (lastSuspendedTime > expirationTime || firstSuspendedTime === NoWork) {
  32117. root.lastSuspendedTime = expirationTime;
  32118. }
  32119. if (expirationTime <= root.lastPingedTime) {
  32120. root.lastPingedTime = NoWork;
  32121. }
  32122. if (expirationTime <= root.lastExpiredTime) {
  32123. root.lastExpiredTime = NoWork;
  32124. }
  32125. }
  32126. function markRootUpdatedAtTime(root, expirationTime) {
  32127. // Update the range of pending times
  32128. var firstPendingTime = root.firstPendingTime;
  32129. if (expirationTime > firstPendingTime) {
  32130. root.firstPendingTime = expirationTime;
  32131. } // Update the range of suspended times. Treat everything lower priority or
  32132. // equal to this update as unsuspended.
  32133. var firstSuspendedTime = root.firstSuspendedTime;
  32134. if (firstSuspendedTime !== NoWork) {
  32135. if (expirationTime >= firstSuspendedTime) {
  32136. // The entire suspended range is now unsuspended.
  32137. root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork;
  32138. } else if (expirationTime >= root.lastSuspendedTime) {
  32139. root.lastSuspendedTime = expirationTime + 1;
  32140. } // This is a pending level. Check if it's higher priority than the next
  32141. // known pending level.
  32142. if (expirationTime > root.nextKnownPendingLevel) {
  32143. root.nextKnownPendingLevel = expirationTime;
  32144. }
  32145. }
  32146. }
  32147. function markRootFinishedAtTime(root, finishedExpirationTime, remainingExpirationTime) {
  32148. // Update the range of pending times
  32149. root.firstPendingTime = remainingExpirationTime; // Update the range of suspended times. Treat everything higher priority or
  32150. // equal to this update as unsuspended.
  32151. if (finishedExpirationTime <= root.lastSuspendedTime) {
  32152. // The entire suspended range is now unsuspended.
  32153. root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork;
  32154. } else if (finishedExpirationTime <= root.firstSuspendedTime) {
  32155. // Part of the suspended range is now unsuspended. Narrow the range to
  32156. // include everything between the unsuspended time (non-inclusive) and the
  32157. // last suspended time.
  32158. root.firstSuspendedTime = finishedExpirationTime - 1;
  32159. }
  32160. if (finishedExpirationTime <= root.lastPingedTime) {
  32161. // Clear the pinged time
  32162. root.lastPingedTime = NoWork;
  32163. }
  32164. if (finishedExpirationTime <= root.lastExpiredTime) {
  32165. // Clear the expired time
  32166. root.lastExpiredTime = NoWork;
  32167. }
  32168. }
  32169. function markRootExpiredAtTime(root, expirationTime) {
  32170. var lastExpiredTime = root.lastExpiredTime;
  32171. if (lastExpiredTime === NoWork || lastExpiredTime > expirationTime) {
  32172. root.lastExpiredTime = expirationTime;
  32173. }
  32174. }
  32175. var didWarnAboutNestedUpdates;
  32176. var didWarnAboutFindNodeInStrictMode;
  32177. {
  32178. didWarnAboutNestedUpdates = false;
  32179. didWarnAboutFindNodeInStrictMode = {};
  32180. }
  32181. function getContextForSubtree(parentComponent) {
  32182. if (!parentComponent) {
  32183. return emptyContextObject;
  32184. }
  32185. var fiber = get(parentComponent);
  32186. var parentContext = findCurrentUnmaskedContext(fiber);
  32187. if (fiber.tag === ClassComponent) {
  32188. var Component = fiber.type;
  32189. if (isContextProvider(Component)) {
  32190. return processChildContext(fiber, Component, parentContext);
  32191. }
  32192. }
  32193. return parentContext;
  32194. }
  32195. function findHostInstanceWithWarning(component, methodName) {
  32196. {
  32197. var fiber = get(component);
  32198. if (fiber === undefined) {
  32199. if (typeof component.render === 'function') {
  32200. {
  32201. {
  32202. throw Error( "Unable to find node on an unmounted component." );
  32203. }
  32204. }
  32205. } else {
  32206. {
  32207. {
  32208. throw Error( "Argument appears to not be a ReactComponent. Keys: " + Object.keys(component) );
  32209. }
  32210. }
  32211. }
  32212. }
  32213. var hostFiber = findCurrentHostFiber(fiber);
  32214. if (hostFiber === null) {
  32215. return null;
  32216. }
  32217. if (hostFiber.mode & StrictMode) {
  32218. var componentName = getComponentName(fiber.type) || 'Component';
  32219. if (!didWarnAboutFindNodeInStrictMode[componentName]) {
  32220. didWarnAboutFindNodeInStrictMode[componentName] = true;
  32221. if (fiber.mode & StrictMode) {
  32222. error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
  32223. } else {
  32224. error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
  32225. }
  32226. }
  32227. }
  32228. return hostFiber.stateNode;
  32229. }
  32230. }
  32231. function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
  32232. return createFiberRoot(containerInfo, tag, hydrate);
  32233. }
  32234. function updateContainer(element, container, parentComponent, callback) {
  32235. {
  32236. onScheduleRoot(container, element);
  32237. }
  32238. var current$1 = container.current;
  32239. var currentTime = requestCurrentTimeForUpdate();
  32240. {
  32241. // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
  32242. if ('undefined' !== typeof jest) {
  32243. warnIfUnmockedScheduler(current$1);
  32244. warnIfNotScopedWithMatchingAct(current$1);
  32245. }
  32246. }
  32247. var suspenseConfig = requestCurrentSuspenseConfig();
  32248. var expirationTime = computeExpirationForFiber(currentTime, current$1, suspenseConfig);
  32249. var context = getContextForSubtree(parentComponent);
  32250. if (container.context === null) {
  32251. container.context = context;
  32252. } else {
  32253. container.pendingContext = context;
  32254. }
  32255. {
  32256. if (isRendering && current !== null && !didWarnAboutNestedUpdates) {
  32257. didWarnAboutNestedUpdates = true;
  32258. error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
  32259. }
  32260. }
  32261. var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
  32262. // being called "element".
  32263. update.payload = {
  32264. element: element
  32265. };
  32266. callback = callback === undefined ? null : callback;
  32267. if (callback !== null) {
  32268. {
  32269. if (typeof callback !== 'function') {
  32270. error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback);
  32271. }
  32272. }
  32273. update.callback = callback;
  32274. }
  32275. enqueueUpdate(current$1, update);
  32276. scheduleWork(current$1, expirationTime);
  32277. return expirationTime;
  32278. }
  32279. function getPublicRootInstance(container) {
  32280. var containerFiber = container.current;
  32281. if (!containerFiber.child) {
  32282. return null;
  32283. }
  32284. switch (containerFiber.child.tag) {
  32285. case HostComponent:
  32286. return getPublicInstance(containerFiber.child.stateNode);
  32287. default:
  32288. return containerFiber.child.stateNode;
  32289. }
  32290. }
  32291. function markRetryTimeImpl(fiber, retryTime) {
  32292. var suspenseState = fiber.memoizedState;
  32293. if (suspenseState !== null && suspenseState.dehydrated !== null) {
  32294. if (suspenseState.retryTime < retryTime) {
  32295. suspenseState.retryTime = retryTime;
  32296. }
  32297. }
  32298. } // Increases the priority of thennables when they resolve within this boundary.
  32299. function markRetryTimeIfNotHydrated(fiber, retryTime) {
  32300. markRetryTimeImpl(fiber, retryTime);
  32301. var alternate = fiber.alternate;
  32302. if (alternate) {
  32303. markRetryTimeImpl(alternate, retryTime);
  32304. }
  32305. }
  32306. function attemptUserBlockingHydration$1(fiber) {
  32307. if (fiber.tag !== SuspenseComponent) {
  32308. // We ignore HostRoots here because we can't increase
  32309. // their priority and they should not suspend on I/O,
  32310. // since you have to wrap anything that might suspend in
  32311. // Suspense.
  32312. return;
  32313. }
  32314. var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
  32315. scheduleWork(fiber, expTime);
  32316. markRetryTimeIfNotHydrated(fiber, expTime);
  32317. }
  32318. function attemptContinuousHydration$1(fiber) {
  32319. if (fiber.tag !== SuspenseComponent) {
  32320. // We ignore HostRoots here because we can't increase
  32321. // their priority and they should not suspend on I/O,
  32322. // since you have to wrap anything that might suspend in
  32323. // Suspense.
  32324. return;
  32325. }
  32326. scheduleWork(fiber, ContinuousHydration);
  32327. markRetryTimeIfNotHydrated(fiber, ContinuousHydration);
  32328. }
  32329. function attemptHydrationAtCurrentPriority$1(fiber) {
  32330. if (fiber.tag !== SuspenseComponent) {
  32331. // We ignore HostRoots here because we can't increase
  32332. // their priority other than synchronously flush it.
  32333. return;
  32334. }
  32335. var currentTime = requestCurrentTimeForUpdate();
  32336. var expTime = computeExpirationForFiber(currentTime, fiber, null);
  32337. scheduleWork(fiber, expTime);
  32338. markRetryTimeIfNotHydrated(fiber, expTime);
  32339. }
  32340. function findHostInstanceWithNoPortals(fiber) {
  32341. var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
  32342. if (hostFiber === null) {
  32343. return null;
  32344. }
  32345. if (hostFiber.tag === FundamentalComponent) {
  32346. return hostFiber.stateNode.instance;
  32347. }
  32348. return hostFiber.stateNode;
  32349. }
  32350. var shouldSuspendImpl = function (fiber) {
  32351. return false;
  32352. };
  32353. function shouldSuspend(fiber) {
  32354. return shouldSuspendImpl(fiber);
  32355. }
  32356. var overrideHookState = null;
  32357. var overrideProps = null;
  32358. var scheduleUpdate = null;
  32359. var setSuspenseHandler = null;
  32360. {
  32361. var copyWithSetImpl = function (obj, path, idx, value) {
  32362. if (idx >= path.length) {
  32363. return value;
  32364. }
  32365. var key = path[idx];
  32366. var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here
  32367. updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
  32368. return updated;
  32369. };
  32370. var copyWithSet = function (obj, path, value) {
  32371. return copyWithSetImpl(obj, path, 0, value);
  32372. }; // Support DevTools editable values for useState and useReducer.
  32373. overrideHookState = function (fiber, id, path, value) {
  32374. // For now, the "id" of stateful hooks is just the stateful hook index.
  32375. // This may change in the future with e.g. nested hooks.
  32376. var currentHook = fiber.memoizedState;
  32377. while (currentHook !== null && id > 0) {
  32378. currentHook = currentHook.next;
  32379. id--;
  32380. }
  32381. if (currentHook !== null) {
  32382. var newState = copyWithSet(currentHook.memoizedState, path, value);
  32383. currentHook.memoizedState = newState;
  32384. currentHook.baseState = newState; // We aren't actually adding an update to the queue,
  32385. // because there is no update we can add for useReducer hooks that won't trigger an error.
  32386. // (There's no appropriate action type for DevTools overrides.)
  32387. // As a result though, React will see the scheduled update as a noop and bailout.
  32388. // Shallow cloning props works as a workaround for now to bypass the bailout check.
  32389. fiber.memoizedProps = _assign({}, fiber.memoizedProps);
  32390. scheduleWork(fiber, Sync);
  32391. }
  32392. }; // Support DevTools props for function components, forwardRef, memo, host components, etc.
  32393. overrideProps = function (fiber, path, value) {
  32394. fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
  32395. if (fiber.alternate) {
  32396. fiber.alternate.pendingProps = fiber.pendingProps;
  32397. }
  32398. scheduleWork(fiber, Sync);
  32399. };
  32400. scheduleUpdate = function (fiber) {
  32401. scheduleWork(fiber, Sync);
  32402. };
  32403. setSuspenseHandler = function (newShouldSuspendImpl) {
  32404. shouldSuspendImpl = newShouldSuspendImpl;
  32405. };
  32406. }
  32407. function injectIntoDevTools(devToolsConfig) {
  32408. var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
  32409. var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
  32410. return injectInternals(_assign({}, devToolsConfig, {
  32411. overrideHookState: overrideHookState,
  32412. overrideProps: overrideProps,
  32413. setSuspenseHandler: setSuspenseHandler,
  32414. scheduleUpdate: scheduleUpdate,
  32415. currentDispatcherRef: ReactCurrentDispatcher,
  32416. findHostInstanceByFiber: function (fiber) {
  32417. var hostFiber = findCurrentHostFiber(fiber);
  32418. if (hostFiber === null) {
  32419. return null;
  32420. }
  32421. return hostFiber.stateNode;
  32422. },
  32423. findFiberByHostInstance: function (instance) {
  32424. if (!findFiberByHostInstance) {
  32425. // Might not be implemented by the renderer.
  32426. return null;
  32427. }
  32428. return findFiberByHostInstance(instance);
  32429. },
  32430. // React Refresh
  32431. findHostInstancesForRefresh: findHostInstancesForRefresh ,
  32432. scheduleRefresh: scheduleRefresh ,
  32433. scheduleRoot: scheduleRoot ,
  32434. setRefreshHandler: setRefreshHandler ,
  32435. // Enables DevTools to append owner stacks to error messages in DEV mode.
  32436. getCurrentFiber: function () {
  32437. return current;
  32438. }
  32439. }));
  32440. }
  32441. var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing;
  32442. function ReactDOMRoot(container, options) {
  32443. this._internalRoot = createRootImpl(container, ConcurrentRoot, options);
  32444. }
  32445. function ReactDOMBlockingRoot(container, tag, options) {
  32446. this._internalRoot = createRootImpl(container, tag, options);
  32447. }
  32448. ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function (children) {
  32449. var root = this._internalRoot;
  32450. {
  32451. if (typeof arguments[1] === 'function') {
  32452. error('render(...): does not support the second callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().');
  32453. }
  32454. var container = root.containerInfo;
  32455. if (container.nodeType !== COMMENT_NODE) {
  32456. var hostInstance = findHostInstanceWithNoPortals(root.current);
  32457. if (hostInstance) {
  32458. if (hostInstance.parentNode !== container) {
  32459. error('render(...): It looks like the React-rendered content of the ' + 'root container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + "root.unmount() to empty a root's container.");
  32460. }
  32461. }
  32462. }
  32463. }
  32464. updateContainer(children, root, null, null);
  32465. };
  32466. ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function () {
  32467. {
  32468. if (typeof arguments[0] === 'function') {
  32469. error('unmount(...): does not support a callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().');
  32470. }
  32471. }
  32472. var root = this._internalRoot;
  32473. var container = root.containerInfo;
  32474. updateContainer(null, root, null, function () {
  32475. unmarkContainerAsRoot(container);
  32476. });
  32477. };
  32478. function createRootImpl(container, tag, options) {
  32479. // Tag is either LegacyRoot or Concurrent Root
  32480. var hydrate = options != null && options.hydrate === true;
  32481. var hydrationCallbacks = options != null && options.hydrationOptions || null;
  32482. var root = createContainer(container, tag, hydrate);
  32483. markContainerAsRoot(root.current, container);
  32484. if (hydrate && tag !== LegacyRoot) {
  32485. var doc = container.nodeType === DOCUMENT_NODE ? container : container.ownerDocument;
  32486. eagerlyTrapReplayableEvents(container, doc);
  32487. }
  32488. return root;
  32489. }
  32490. function createLegacyRoot(container, options) {
  32491. return new ReactDOMBlockingRoot(container, LegacyRoot, options);
  32492. }
  32493. function isValidContainer(node) {
  32494. return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
  32495. }
  32496. var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
  32497. var topLevelUpdateWarnings;
  32498. var warnedAboutHydrateAPI = false;
  32499. {
  32500. topLevelUpdateWarnings = function (container) {
  32501. if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
  32502. var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
  32503. if (hostInstance) {
  32504. if (hostInstance.parentNode !== container) {
  32505. error('render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.');
  32506. }
  32507. }
  32508. }
  32509. var isRootRenderedBySomeReact = !!container._reactRootContainer;
  32510. var rootEl = getReactRootElementInContainer(container);
  32511. var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
  32512. if (hasNonRootReactChild && !isRootRenderedBySomeReact) {
  32513. error('render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.');
  32514. }
  32515. if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') {
  32516. error('render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.');
  32517. }
  32518. };
  32519. }
  32520. function getReactRootElementInContainer(container) {
  32521. if (!container) {
  32522. return null;
  32523. }
  32524. if (container.nodeType === DOCUMENT_NODE) {
  32525. return container.documentElement;
  32526. } else {
  32527. return container.firstChild;
  32528. }
  32529. }
  32530. function shouldHydrateDueToLegacyHeuristic(container) {
  32531. var rootElement = getReactRootElementInContainer(container);
  32532. return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
  32533. }
  32534. function legacyCreateRootFromDOMContainer(container, forceHydrate) {
  32535. var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container); // First clear any existing content.
  32536. if (!shouldHydrate) {
  32537. var warned = false;
  32538. var rootSibling;
  32539. while (rootSibling = container.lastChild) {
  32540. {
  32541. if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
  32542. warned = true;
  32543. error('render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
  32544. }
  32545. }
  32546. container.removeChild(rootSibling);
  32547. }
  32548. }
  32549. {
  32550. if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
  32551. warnedAboutHydrateAPI = true;
  32552. warn('render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
  32553. }
  32554. }
  32555. return createLegacyRoot(container, shouldHydrate ? {
  32556. hydrate: true
  32557. } : undefined);
  32558. }
  32559. function warnOnInvalidCallback$1(callback, callerName) {
  32560. {
  32561. if (callback !== null && typeof callback !== 'function') {
  32562. error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
  32563. }
  32564. }
  32565. }
  32566. function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
  32567. {
  32568. topLevelUpdateWarnings(container);
  32569. warnOnInvalidCallback$1(callback === undefined ? null : callback, 'render');
  32570. } // TODO: Without `any` type, Flow says "Property cannot be accessed on any
  32571. // member of intersection type." Whyyyyyy.
  32572. var root = container._reactRootContainer;
  32573. var fiberRoot;
  32574. if (!root) {
  32575. // Initial mount
  32576. root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
  32577. fiberRoot = root._internalRoot;
  32578. if (typeof callback === 'function') {
  32579. var originalCallback = callback;
  32580. callback = function () {
  32581. var instance = getPublicRootInstance(fiberRoot);
  32582. originalCallback.call(instance);
  32583. };
  32584. } // Initial mount should not be batched.
  32585. unbatchedUpdates(function () {
  32586. updateContainer(children, fiberRoot, parentComponent, callback);
  32587. });
  32588. } else {
  32589. fiberRoot = root._internalRoot;
  32590. if (typeof callback === 'function') {
  32591. var _originalCallback = callback;
  32592. callback = function () {
  32593. var instance = getPublicRootInstance(fiberRoot);
  32594. _originalCallback.call(instance);
  32595. };
  32596. } // Update
  32597. updateContainer(children, fiberRoot, parentComponent, callback);
  32598. }
  32599. return getPublicRootInstance(fiberRoot);
  32600. }
  32601. function findDOMNode(componentOrElement) {
  32602. {
  32603. var owner = ReactCurrentOwner$3.current;
  32604. if (owner !== null && owner.stateNode !== null) {
  32605. var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
  32606. if (!warnedAboutRefsInRender) {
  32607. error('%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component');
  32608. }
  32609. owner.stateNode._warnedAboutRefsInRender = true;
  32610. }
  32611. }
  32612. if (componentOrElement == null) {
  32613. return null;
  32614. }
  32615. if (componentOrElement.nodeType === ELEMENT_NODE) {
  32616. return componentOrElement;
  32617. }
  32618. {
  32619. return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
  32620. }
  32621. }
  32622. function hydrate(element, container, callback) {
  32623. if (!isValidContainer(container)) {
  32624. {
  32625. throw Error( "Target container is not a DOM element." );
  32626. }
  32627. }
  32628. {
  32629. var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
  32630. if (isModernRoot) {
  32631. error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?');
  32632. }
  32633. } // TODO: throw or warn if we couldn't hydrate?
  32634. return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
  32635. }
  32636. function render(element, container, callback) {
  32637. if (!isValidContainer(container)) {
  32638. {
  32639. throw Error( "Target container is not a DOM element." );
  32640. }
  32641. }
  32642. {
  32643. var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
  32644. if (isModernRoot) {
  32645. error('You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?');
  32646. }
  32647. }
  32648. return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
  32649. }
  32650. function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
  32651. if (!isValidContainer(containerNode)) {
  32652. {
  32653. throw Error( "Target container is not a DOM element." );
  32654. }
  32655. }
  32656. if (!(parentComponent != null && has(parentComponent))) {
  32657. {
  32658. throw Error( "parentComponent must be a valid React Component" );
  32659. }
  32660. }
  32661. return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
  32662. }
  32663. function unmountComponentAtNode(container) {
  32664. if (!isValidContainer(container)) {
  32665. {
  32666. throw Error( "unmountComponentAtNode(...): Target container is not a DOM element." );
  32667. }
  32668. }
  32669. {
  32670. var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
  32671. if (isModernRoot) {
  32672. error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?');
  32673. }
  32674. }
  32675. if (container._reactRootContainer) {
  32676. {
  32677. var rootEl = getReactRootElementInContainer(container);
  32678. var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
  32679. if (renderedByDifferentReact) {
  32680. error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.');
  32681. }
  32682. } // Unmount should not be batched.
  32683. unbatchedUpdates(function () {
  32684. legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
  32685. // $FlowFixMe This should probably use `delete container._reactRootContainer`
  32686. container._reactRootContainer = null;
  32687. unmarkContainerAsRoot(container);
  32688. });
  32689. }); // If you call unmountComponentAtNode twice in quick succession, you'll
  32690. // get `true` twice. That's probably fine?
  32691. return true;
  32692. } else {
  32693. {
  32694. var _rootEl = getReactRootElementInContainer(container);
  32695. var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl)); // Check if the container itself is a React root node.
  32696. var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
  32697. if (hasNonRootReactChild) {
  32698. error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.');
  32699. }
  32700. }
  32701. return false;
  32702. }
  32703. }
  32704. function createPortal(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
  32705. implementation) {
  32706. var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  32707. return {
  32708. // This tag allow us to uniquely identify this as a React Portal
  32709. $$typeof: REACT_PORTAL_TYPE,
  32710. key: key == null ? null : '' + key,
  32711. children: children,
  32712. containerInfo: containerInfo,
  32713. implementation: implementation
  32714. };
  32715. }
  32716. var ReactVersion = '16.13.1';
  32717. setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
  32718. setAttemptContinuousHydration(attemptContinuousHydration$1);
  32719. setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
  32720. var didWarnAboutUnstableCreatePortal = false;
  32721. {
  32722. if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype
  32723. Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype
  32724. Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
  32725. error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
  32726. }
  32727. }
  32728. setRestoreImplementation(restoreControlledState$3);
  32729. setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
  32730. function createPortal$1(children, container) {
  32731. var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  32732. if (!isValidContainer(container)) {
  32733. {
  32734. throw Error( "Target container is not a DOM element." );
  32735. }
  32736. } // TODO: pass ReactDOM portal implementation as third argument
  32737. // $FlowFixMe The Flow type is opaque but there's no way to actually create it.
  32738. return createPortal(children, container, null, key);
  32739. }
  32740. function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
  32741. return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
  32742. }
  32743. function unstable_createPortal(children, container) {
  32744. var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  32745. {
  32746. if (!didWarnAboutUnstableCreatePortal) {
  32747. didWarnAboutUnstableCreatePortal = true;
  32748. warn('The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
  32749. }
  32750. }
  32751. return createPortal$1(children, container, key);
  32752. }
  32753. var Internals = {
  32754. // Keep in sync with ReactDOMUnstableNativeDependencies.js
  32755. // ReactTestUtils.js, and ReactTestUtilsAct.js. This is an array for better minification.
  32756. Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch, flushPassiveEffects, IsThisRendererActing]
  32757. };
  32758. var foundDevTools = injectIntoDevTools({
  32759. findFiberByHostInstance: getClosestInstanceFromNode,
  32760. bundleType: 1 ,
  32761. version: ReactVersion,
  32762. rendererPackageName: 'react-dom'
  32763. });
  32764. {
  32765. if (!foundDevTools && canUseDOM && window.top === window.self) {
  32766. // If we're in Chrome or Firefox, provide a download link if not installed.
  32767. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  32768. var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://.
  32769. if (/^(https?|file):$/.test(protocol)) {
  32770. // eslint-disable-next-line react-internal/no-production-logging
  32771. console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://fb.me/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://fb.me/react-devtools-faq' : ''), 'font-weight:bold');
  32772. }
  32773. }
  32774. }
  32775. }
  32776. exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
  32777. exports.createPortal = createPortal$1;
  32778. exports.findDOMNode = findDOMNode;
  32779. exports.flushSync = flushSync;
  32780. exports.hydrate = hydrate;
  32781. exports.render = render;
  32782. exports.unmountComponentAtNode = unmountComponentAtNode;
  32783. exports.unstable_batchedUpdates = batchedUpdates$1;
  32784. exports.unstable_createPortal = unstable_createPortal;
  32785. exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
  32786. exports.version = ReactVersion;
  32787. })();
  32788. }
  32789. /***/ }),
  32790. /***/ "../../node_modules/react-dom/index.js":
  32791. /*!***********************************************************************!*\
  32792. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/react-dom/index.js ***!
  32793. \***********************************************************************/
  32794. /*! no static exports found */
  32795. /***/ (function(module, exports, __webpack_require__) {
  32796. "use strict";
  32797. function checkDCE() {
  32798. /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
  32799. if (
  32800. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
  32801. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
  32802. ) {
  32803. return;
  32804. }
  32805. if (true) {
  32806. // This branch is unreachable because this function is only called
  32807. // in production, but the condition is true only in development.
  32808. // Therefore if the branch is still here, dead code elimination wasn't
  32809. // properly applied.
  32810. // Don't change the message. React DevTools relies on it. Also make sure
  32811. // this message doesn't occur elsewhere in this function, or it will cause
  32812. // a false positive.
  32813. throw new Error('^_^');
  32814. }
  32815. try {
  32816. // Verify that the code above has been dead code eliminated (DCE'd).
  32817. __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
  32818. } catch (err) {
  32819. // DevTools shouldn't crash React, no matter what.
  32820. // We should still report in case we break this code.
  32821. console.error(err);
  32822. }
  32823. }
  32824. if (false) {} else {
  32825. module.exports = __webpack_require__(/*! ./cjs/react-dom.development.js */ "../../node_modules/react-dom/cjs/react-dom.development.js");
  32826. }
  32827. /***/ }),
  32828. /***/ "../../node_modules/react/cjs/react.development.js":
  32829. /*!***********************************************************************************!*\
  32830. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/react/cjs/react.development.js ***!
  32831. \***********************************************************************************/
  32832. /*! no static exports found */
  32833. /***/ (function(module, exports, __webpack_require__) {
  32834. "use strict";
  32835. /** @license React v16.13.1
  32836. * react.development.js
  32837. *
  32838. * Copyright (c) Facebook, Inc. and its affiliates.
  32839. *
  32840. * This source code is licensed under the MIT license found in the
  32841. * LICENSE file in the root directory of this source tree.
  32842. */
  32843. if (true) {
  32844. (function() {
  32845. 'use strict';
  32846. var _assign = __webpack_require__(/*! object-assign */ "../../node_modules/object-assign/index.js");
  32847. var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "../../node_modules/prop-types/checkPropTypes.js");
  32848. var ReactVersion = '16.13.1';
  32849. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  32850. // nor polyfill, then a plain number is used for performance.
  32851. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  32852. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  32853. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  32854. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  32855. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  32856. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  32857. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  32858. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  32859. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  32860. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  32861. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  32862. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  32863. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  32864. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  32865. var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  32866. var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
  32867. var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
  32868. var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
  32869. var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  32870. var FAUX_ITERATOR_SYMBOL = '@@iterator';
  32871. function getIteratorFn(maybeIterable) {
  32872. if (maybeIterable === null || typeof maybeIterable !== 'object') {
  32873. return null;
  32874. }
  32875. var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  32876. if (typeof maybeIterator === 'function') {
  32877. return maybeIterator;
  32878. }
  32879. return null;
  32880. }
  32881. /**
  32882. * Keeps track of the current dispatcher.
  32883. */
  32884. var ReactCurrentDispatcher = {
  32885. /**
  32886. * @internal
  32887. * @type {ReactComponent}
  32888. */
  32889. current: null
  32890. };
  32891. /**
  32892. * Keeps track of the current batch's configuration such as how long an update
  32893. * should suspend for if it needs to.
  32894. */
  32895. var ReactCurrentBatchConfig = {
  32896. suspense: null
  32897. };
  32898. /**
  32899. * Keeps track of the current owner.
  32900. *
  32901. * The current owner is the component who should own any components that are
  32902. * currently being constructed.
  32903. */
  32904. var ReactCurrentOwner = {
  32905. /**
  32906. * @internal
  32907. * @type {ReactComponent}
  32908. */
  32909. current: null
  32910. };
  32911. var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  32912. function describeComponentFrame (name, source, ownerName) {
  32913. var sourceInfo = '';
  32914. if (source) {
  32915. var path = source.fileName;
  32916. var fileName = path.replace(BEFORE_SLASH_RE, '');
  32917. {
  32918. // In DEV, include code for a common special case:
  32919. // prefer "folder/index.js" instead of just "index.js".
  32920. if (/^index\./.test(fileName)) {
  32921. var match = path.match(BEFORE_SLASH_RE);
  32922. if (match) {
  32923. var pathBeforeSlash = match[1];
  32924. if (pathBeforeSlash) {
  32925. var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
  32926. fileName = folderName + '/' + fileName;
  32927. }
  32928. }
  32929. }
  32930. }
  32931. sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
  32932. } else if (ownerName) {
  32933. sourceInfo = ' (created by ' + ownerName + ')';
  32934. }
  32935. return '\n in ' + (name || 'Unknown') + sourceInfo;
  32936. }
  32937. var Resolved = 1;
  32938. function refineResolvedLazyComponent(lazyComponent) {
  32939. return lazyComponent._status === Resolved ? lazyComponent._result : null;
  32940. }
  32941. function getWrappedName(outerType, innerType, wrapperName) {
  32942. var functionName = innerType.displayName || innerType.name || '';
  32943. return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
  32944. }
  32945. function getComponentName(type) {
  32946. if (type == null) {
  32947. // Host root, text node or just invalid type.
  32948. return null;
  32949. }
  32950. {
  32951. if (typeof type.tag === 'number') {
  32952. error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
  32953. }
  32954. }
  32955. if (typeof type === 'function') {
  32956. return type.displayName || type.name || null;
  32957. }
  32958. if (typeof type === 'string') {
  32959. return type;
  32960. }
  32961. switch (type) {
  32962. case REACT_FRAGMENT_TYPE:
  32963. return 'Fragment';
  32964. case REACT_PORTAL_TYPE:
  32965. return 'Portal';
  32966. case REACT_PROFILER_TYPE:
  32967. return "Profiler";
  32968. case REACT_STRICT_MODE_TYPE:
  32969. return 'StrictMode';
  32970. case REACT_SUSPENSE_TYPE:
  32971. return 'Suspense';
  32972. case REACT_SUSPENSE_LIST_TYPE:
  32973. return 'SuspenseList';
  32974. }
  32975. if (typeof type === 'object') {
  32976. switch (type.$$typeof) {
  32977. case REACT_CONTEXT_TYPE:
  32978. return 'Context.Consumer';
  32979. case REACT_PROVIDER_TYPE:
  32980. return 'Context.Provider';
  32981. case REACT_FORWARD_REF_TYPE:
  32982. return getWrappedName(type, type.render, 'ForwardRef');
  32983. case REACT_MEMO_TYPE:
  32984. return getComponentName(type.type);
  32985. case REACT_BLOCK_TYPE:
  32986. return getComponentName(type.render);
  32987. case REACT_LAZY_TYPE:
  32988. {
  32989. var thenable = type;
  32990. var resolvedThenable = refineResolvedLazyComponent(thenable);
  32991. if (resolvedThenable) {
  32992. return getComponentName(resolvedThenable);
  32993. }
  32994. break;
  32995. }
  32996. }
  32997. }
  32998. return null;
  32999. }
  33000. var ReactDebugCurrentFrame = {};
  33001. var currentlyValidatingElement = null;
  33002. function setCurrentlyValidatingElement(element) {
  33003. {
  33004. currentlyValidatingElement = element;
  33005. }
  33006. }
  33007. {
  33008. // Stack implementation injected by the current renderer.
  33009. ReactDebugCurrentFrame.getCurrentStack = null;
  33010. ReactDebugCurrentFrame.getStackAddendum = function () {
  33011. var stack = ''; // Add an extra top frame while an element is being validated
  33012. if (currentlyValidatingElement) {
  33013. var name = getComponentName(currentlyValidatingElement.type);
  33014. var owner = currentlyValidatingElement._owner;
  33015. stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
  33016. } // Delegate to the injected renderer-specific implementation
  33017. var impl = ReactDebugCurrentFrame.getCurrentStack;
  33018. if (impl) {
  33019. stack += impl() || '';
  33020. }
  33021. return stack;
  33022. };
  33023. }
  33024. /**
  33025. * Used by act() to track whether you're inside an act() scope.
  33026. */
  33027. var IsSomeRendererActing = {
  33028. current: false
  33029. };
  33030. var ReactSharedInternals = {
  33031. ReactCurrentDispatcher: ReactCurrentDispatcher,
  33032. ReactCurrentBatchConfig: ReactCurrentBatchConfig,
  33033. ReactCurrentOwner: ReactCurrentOwner,
  33034. IsSomeRendererActing: IsSomeRendererActing,
  33035. // Used by renderers to avoid bundling object-assign twice in UMD bundles:
  33036. assign: _assign
  33037. };
  33038. {
  33039. _assign(ReactSharedInternals, {
  33040. // These should not be included in production.
  33041. ReactDebugCurrentFrame: ReactDebugCurrentFrame,
  33042. // Shim for React DOM 16.0.0 which still destructured (but not used) this.
  33043. // TODO: remove in React 17.0.
  33044. ReactComponentTreeHook: {}
  33045. });
  33046. }
  33047. // by calls to these methods by a Babel plugin.
  33048. //
  33049. // In PROD (or in packages without access to React internals),
  33050. // they are left as they are instead.
  33051. function warn(format) {
  33052. {
  33053. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  33054. args[_key - 1] = arguments[_key];
  33055. }
  33056. printWarning('warn', format, args);
  33057. }
  33058. }
  33059. function error(format) {
  33060. {
  33061. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  33062. args[_key2 - 1] = arguments[_key2];
  33063. }
  33064. printWarning('error', format, args);
  33065. }
  33066. }
  33067. function printWarning(level, format, args) {
  33068. // When changing this logic, you might want to also
  33069. // update consoleWithStackDev.www.js as well.
  33070. {
  33071. var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
  33072. if (!hasExistingStack) {
  33073. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  33074. var stack = ReactDebugCurrentFrame.getStackAddendum();
  33075. if (stack !== '') {
  33076. format += '%s';
  33077. args = args.concat([stack]);
  33078. }
  33079. }
  33080. var argsWithFormat = args.map(function (item) {
  33081. return '' + item;
  33082. }); // Careful: RN currently depends on this prefix
  33083. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  33084. // breaks IE9: https://github.com/facebook/react/issues/13610
  33085. // eslint-disable-next-line react-internal/no-production-logging
  33086. Function.prototype.apply.call(console[level], console, argsWithFormat);
  33087. try {
  33088. // --- Welcome to debugging React ---
  33089. // This error was thrown as a convenience so that you can use this stack
  33090. // to find the callsite that caused this warning to fire.
  33091. var argIndex = 0;
  33092. var message = 'Warning: ' + format.replace(/%s/g, function () {
  33093. return args[argIndex++];
  33094. });
  33095. throw new Error(message);
  33096. } catch (x) {}
  33097. }
  33098. }
  33099. var didWarnStateUpdateForUnmountedComponent = {};
  33100. function warnNoop(publicInstance, callerName) {
  33101. {
  33102. var _constructor = publicInstance.constructor;
  33103. var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
  33104. var warningKey = componentName + "." + callerName;
  33105. if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
  33106. return;
  33107. }
  33108. error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
  33109. didWarnStateUpdateForUnmountedComponent[warningKey] = true;
  33110. }
  33111. }
  33112. /**
  33113. * This is the abstract API for an update queue.
  33114. */
  33115. var ReactNoopUpdateQueue = {
  33116. /**
  33117. * Checks whether or not this composite component is mounted.
  33118. * @param {ReactClass} publicInstance The instance we want to test.
  33119. * @return {boolean} True if mounted, false otherwise.
  33120. * @protected
  33121. * @final
  33122. */
  33123. isMounted: function (publicInstance) {
  33124. return false;
  33125. },
  33126. /**
  33127. * Forces an update. This should only be invoked when it is known with
  33128. * certainty that we are **not** in a DOM transaction.
  33129. *
  33130. * You may want to call this when you know that some deeper aspect of the
  33131. * component's state has changed but `setState` was not called.
  33132. *
  33133. * This will not invoke `shouldComponentUpdate`, but it will invoke
  33134. * `componentWillUpdate` and `componentDidUpdate`.
  33135. *
  33136. * @param {ReactClass} publicInstance The instance that should rerender.
  33137. * @param {?function} callback Called after component is updated.
  33138. * @param {?string} callerName name of the calling function in the public API.
  33139. * @internal
  33140. */
  33141. enqueueForceUpdate: function (publicInstance, callback, callerName) {
  33142. warnNoop(publicInstance, 'forceUpdate');
  33143. },
  33144. /**
  33145. * Replaces all of the state. Always use this or `setState` to mutate state.
  33146. * You should treat `this.state` as immutable.
  33147. *
  33148. * There is no guarantee that `this.state` will be immediately updated, so
  33149. * accessing `this.state` after calling this method may return the old value.
  33150. *
  33151. * @param {ReactClass} publicInstance The instance that should rerender.
  33152. * @param {object} completeState Next state.
  33153. * @param {?function} callback Called after component is updated.
  33154. * @param {?string} callerName name of the calling function in the public API.
  33155. * @internal
  33156. */
  33157. enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
  33158. warnNoop(publicInstance, 'replaceState');
  33159. },
  33160. /**
  33161. * Sets a subset of the state. This only exists because _pendingState is
  33162. * internal. This provides a merging strategy that is not available to deep
  33163. * properties which is confusing. TODO: Expose pendingState or don't use it
  33164. * during the merge.
  33165. *
  33166. * @param {ReactClass} publicInstance The instance that should rerender.
  33167. * @param {object} partialState Next partial state to be merged with state.
  33168. * @param {?function} callback Called after component is updated.
  33169. * @param {?string} Name of the calling function in the public API.
  33170. * @internal
  33171. */
  33172. enqueueSetState: function (publicInstance, partialState, callback, callerName) {
  33173. warnNoop(publicInstance, 'setState');
  33174. }
  33175. };
  33176. var emptyObject = {};
  33177. {
  33178. Object.freeze(emptyObject);
  33179. }
  33180. /**
  33181. * Base class helpers for the updating state of a component.
  33182. */
  33183. function Component(props, context, updater) {
  33184. this.props = props;
  33185. this.context = context; // If a component has string refs, we will assign a different object later.
  33186. this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
  33187. // renderer.
  33188. this.updater = updater || ReactNoopUpdateQueue;
  33189. }
  33190. Component.prototype.isReactComponent = {};
  33191. /**
  33192. * Sets a subset of the state. Always use this to mutate
  33193. * state. You should treat `this.state` as immutable.
  33194. *
  33195. * There is no guarantee that `this.state` will be immediately updated, so
  33196. * accessing `this.state` after calling this method may return the old value.
  33197. *
  33198. * There is no guarantee that calls to `setState` will run synchronously,
  33199. * as they may eventually be batched together. You can provide an optional
  33200. * callback that will be executed when the call to setState is actually
  33201. * completed.
  33202. *
  33203. * When a function is provided to setState, it will be called at some point in
  33204. * the future (not synchronously). It will be called with the up to date
  33205. * component arguments (state, props, context). These values can be different
  33206. * from this.* because your function may be called after receiveProps but before
  33207. * shouldComponentUpdate, and this new state, props, and context will not yet be
  33208. * assigned to this.
  33209. *
  33210. * @param {object|function} partialState Next partial state or function to
  33211. * produce next partial state to be merged with current state.
  33212. * @param {?function} callback Called after state is updated.
  33213. * @final
  33214. * @protected
  33215. */
  33216. Component.prototype.setState = function (partialState, callback) {
  33217. if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
  33218. {
  33219. throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
  33220. }
  33221. }
  33222. this.updater.enqueueSetState(this, partialState, callback, 'setState');
  33223. };
  33224. /**
  33225. * Forces an update. This should only be invoked when it is known with
  33226. * certainty that we are **not** in a DOM transaction.
  33227. *
  33228. * You may want to call this when you know that some deeper aspect of the
  33229. * component's state has changed but `setState` was not called.
  33230. *
  33231. * This will not invoke `shouldComponentUpdate`, but it will invoke
  33232. * `componentWillUpdate` and `componentDidUpdate`.
  33233. *
  33234. * @param {?function} callback Called after update is complete.
  33235. * @final
  33236. * @protected
  33237. */
  33238. Component.prototype.forceUpdate = function (callback) {
  33239. this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
  33240. };
  33241. /**
  33242. * Deprecated APIs. These APIs used to exist on classic React classes but since
  33243. * we would like to deprecate them, we're not going to move them over to this
  33244. * modern base class. Instead, we define a getter that warns if it's accessed.
  33245. */
  33246. {
  33247. var deprecatedAPIs = {
  33248. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  33249. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  33250. };
  33251. var defineDeprecationWarning = function (methodName, info) {
  33252. Object.defineProperty(Component.prototype, methodName, {
  33253. get: function () {
  33254. warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
  33255. return undefined;
  33256. }
  33257. });
  33258. };
  33259. for (var fnName in deprecatedAPIs) {
  33260. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  33261. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  33262. }
  33263. }
  33264. }
  33265. function ComponentDummy() {}
  33266. ComponentDummy.prototype = Component.prototype;
  33267. /**
  33268. * Convenience component with default shallow equality check for sCU.
  33269. */
  33270. function PureComponent(props, context, updater) {
  33271. this.props = props;
  33272. this.context = context; // If a component has string refs, we will assign a different object later.
  33273. this.refs = emptyObject;
  33274. this.updater = updater || ReactNoopUpdateQueue;
  33275. }
  33276. var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
  33277. pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
  33278. _assign(pureComponentPrototype, Component.prototype);
  33279. pureComponentPrototype.isPureReactComponent = true;
  33280. // an immutable object with a single mutable value
  33281. function createRef() {
  33282. var refObject = {
  33283. current: null
  33284. };
  33285. {
  33286. Object.seal(refObject);
  33287. }
  33288. return refObject;
  33289. }
  33290. var hasOwnProperty = Object.prototype.hasOwnProperty;
  33291. var RESERVED_PROPS = {
  33292. key: true,
  33293. ref: true,
  33294. __self: true,
  33295. __source: true
  33296. };
  33297. var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
  33298. {
  33299. didWarnAboutStringRefs = {};
  33300. }
  33301. function hasValidRef(config) {
  33302. {
  33303. if (hasOwnProperty.call(config, 'ref')) {
  33304. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  33305. if (getter && getter.isReactWarning) {
  33306. return false;
  33307. }
  33308. }
  33309. }
  33310. return config.ref !== undefined;
  33311. }
  33312. function hasValidKey(config) {
  33313. {
  33314. if (hasOwnProperty.call(config, 'key')) {
  33315. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  33316. if (getter && getter.isReactWarning) {
  33317. return false;
  33318. }
  33319. }
  33320. }
  33321. return config.key !== undefined;
  33322. }
  33323. function defineKeyPropWarningGetter(props, displayName) {
  33324. var warnAboutAccessingKey = function () {
  33325. {
  33326. if (!specialPropKeyWarningShown) {
  33327. specialPropKeyWarningShown = true;
  33328. error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
  33329. }
  33330. }
  33331. };
  33332. warnAboutAccessingKey.isReactWarning = true;
  33333. Object.defineProperty(props, 'key', {
  33334. get: warnAboutAccessingKey,
  33335. configurable: true
  33336. });
  33337. }
  33338. function defineRefPropWarningGetter(props, displayName) {
  33339. var warnAboutAccessingRef = function () {
  33340. {
  33341. if (!specialPropRefWarningShown) {
  33342. specialPropRefWarningShown = true;
  33343. error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
  33344. }
  33345. }
  33346. };
  33347. warnAboutAccessingRef.isReactWarning = true;
  33348. Object.defineProperty(props, 'ref', {
  33349. get: warnAboutAccessingRef,
  33350. configurable: true
  33351. });
  33352. }
  33353. function warnIfStringRefCannotBeAutoConverted(config) {
  33354. {
  33355. if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
  33356. var componentName = getComponentName(ReactCurrentOwner.current.type);
  33357. if (!didWarnAboutStringRefs[componentName]) {
  33358. error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
  33359. didWarnAboutStringRefs[componentName] = true;
  33360. }
  33361. }
  33362. }
  33363. }
  33364. /**
  33365. * Factory method to create a new React element. This no longer adheres to
  33366. * the class pattern, so do not use new to call it. Also, instanceof check
  33367. * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
  33368. * if something is a React Element.
  33369. *
  33370. * @param {*} type
  33371. * @param {*} props
  33372. * @param {*} key
  33373. * @param {string|object} ref
  33374. * @param {*} owner
  33375. * @param {*} self A *temporary* helper to detect places where `this` is
  33376. * different from the `owner` when React.createElement is called, so that we
  33377. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  33378. * functions, and as long as `this` and owner are the same, there will be no
  33379. * change in behavior.
  33380. * @param {*} source An annotation object (added by a transpiler or otherwise)
  33381. * indicating filename, line number, and/or other information.
  33382. * @internal
  33383. */
  33384. var ReactElement = function (type, key, ref, self, source, owner, props) {
  33385. var element = {
  33386. // This tag allows us to uniquely identify this as a React Element
  33387. $$typeof: REACT_ELEMENT_TYPE,
  33388. // Built-in properties that belong on the element
  33389. type: type,
  33390. key: key,
  33391. ref: ref,
  33392. props: props,
  33393. // Record the component responsible for creating this element.
  33394. _owner: owner
  33395. };
  33396. {
  33397. // The validation flag is currently mutative. We put it on
  33398. // an external backing store so that we can freeze the whole object.
  33399. // This can be replaced with a WeakMap once they are implemented in
  33400. // commonly used development environments.
  33401. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
  33402. // the validation flag non-enumerable (where possible, which should
  33403. // include every environment we run tests in), so the test framework
  33404. // ignores it.
  33405. Object.defineProperty(element._store, 'validated', {
  33406. configurable: false,
  33407. enumerable: false,
  33408. writable: true,
  33409. value: false
  33410. }); // self and source are DEV only properties.
  33411. Object.defineProperty(element, '_self', {
  33412. configurable: false,
  33413. enumerable: false,
  33414. writable: false,
  33415. value: self
  33416. }); // Two elements created in two different places should be considered
  33417. // equal for testing purposes and therefore we hide it from enumeration.
  33418. Object.defineProperty(element, '_source', {
  33419. configurable: false,
  33420. enumerable: false,
  33421. writable: false,
  33422. value: source
  33423. });
  33424. if (Object.freeze) {
  33425. Object.freeze(element.props);
  33426. Object.freeze(element);
  33427. }
  33428. }
  33429. return element;
  33430. };
  33431. /**
  33432. * Create and return a new ReactElement of the given type.
  33433. * See https://reactjs.org/docs/react-api.html#createelement
  33434. */
  33435. function createElement(type, config, children) {
  33436. var propName; // Reserved names are extracted
  33437. var props = {};
  33438. var key = null;
  33439. var ref = null;
  33440. var self = null;
  33441. var source = null;
  33442. if (config != null) {
  33443. if (hasValidRef(config)) {
  33444. ref = config.ref;
  33445. {
  33446. warnIfStringRefCannotBeAutoConverted(config);
  33447. }
  33448. }
  33449. if (hasValidKey(config)) {
  33450. key = '' + config.key;
  33451. }
  33452. self = config.__self === undefined ? null : config.__self;
  33453. source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
  33454. for (propName in config) {
  33455. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  33456. props[propName] = config[propName];
  33457. }
  33458. }
  33459. } // Children can be more than one argument, and those are transferred onto
  33460. // the newly allocated props object.
  33461. var childrenLength = arguments.length - 2;
  33462. if (childrenLength === 1) {
  33463. props.children = children;
  33464. } else if (childrenLength > 1) {
  33465. var childArray = Array(childrenLength);
  33466. for (var i = 0; i < childrenLength; i++) {
  33467. childArray[i] = arguments[i + 2];
  33468. }
  33469. {
  33470. if (Object.freeze) {
  33471. Object.freeze(childArray);
  33472. }
  33473. }
  33474. props.children = childArray;
  33475. } // Resolve default props
  33476. if (type && type.defaultProps) {
  33477. var defaultProps = type.defaultProps;
  33478. for (propName in defaultProps) {
  33479. if (props[propName] === undefined) {
  33480. props[propName] = defaultProps[propName];
  33481. }
  33482. }
  33483. }
  33484. {
  33485. if (key || ref) {
  33486. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  33487. if (key) {
  33488. defineKeyPropWarningGetter(props, displayName);
  33489. }
  33490. if (ref) {
  33491. defineRefPropWarningGetter(props, displayName);
  33492. }
  33493. }
  33494. }
  33495. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  33496. }
  33497. function cloneAndReplaceKey(oldElement, newKey) {
  33498. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  33499. return newElement;
  33500. }
  33501. /**
  33502. * Clone and return a new ReactElement using element as the starting point.
  33503. * See https://reactjs.org/docs/react-api.html#cloneelement
  33504. */
  33505. function cloneElement(element, config, children) {
  33506. if (!!(element === null || element === undefined)) {
  33507. {
  33508. throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
  33509. }
  33510. }
  33511. var propName; // Original props are copied
  33512. var props = _assign({}, element.props); // Reserved names are extracted
  33513. var key = element.key;
  33514. var ref = element.ref; // Self is preserved since the owner is preserved.
  33515. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
  33516. // transpiler, and the original source is probably a better indicator of the
  33517. // true owner.
  33518. var source = element._source; // Owner will be preserved, unless ref is overridden
  33519. var owner = element._owner;
  33520. if (config != null) {
  33521. if (hasValidRef(config)) {
  33522. // Silently steal the ref from the parent.
  33523. ref = config.ref;
  33524. owner = ReactCurrentOwner.current;
  33525. }
  33526. if (hasValidKey(config)) {
  33527. key = '' + config.key;
  33528. } // Remaining properties override existing props
  33529. var defaultProps;
  33530. if (element.type && element.type.defaultProps) {
  33531. defaultProps = element.type.defaultProps;
  33532. }
  33533. for (propName in config) {
  33534. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  33535. if (config[propName] === undefined && defaultProps !== undefined) {
  33536. // Resolve default props
  33537. props[propName] = defaultProps[propName];
  33538. } else {
  33539. props[propName] = config[propName];
  33540. }
  33541. }
  33542. }
  33543. } // Children can be more than one argument, and those are transferred onto
  33544. // the newly allocated props object.
  33545. var childrenLength = arguments.length - 2;
  33546. if (childrenLength === 1) {
  33547. props.children = children;
  33548. } else if (childrenLength > 1) {
  33549. var childArray = Array(childrenLength);
  33550. for (var i = 0; i < childrenLength; i++) {
  33551. childArray[i] = arguments[i + 2];
  33552. }
  33553. props.children = childArray;
  33554. }
  33555. return ReactElement(element.type, key, ref, self, source, owner, props);
  33556. }
  33557. /**
  33558. * Verifies the object is a ReactElement.
  33559. * See https://reactjs.org/docs/react-api.html#isvalidelement
  33560. * @param {?object} object
  33561. * @return {boolean} True if `object` is a ReactElement.
  33562. * @final
  33563. */
  33564. function isValidElement(object) {
  33565. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  33566. }
  33567. var SEPARATOR = '.';
  33568. var SUBSEPARATOR = ':';
  33569. /**
  33570. * Escape and wrap key so it is safe to use as a reactid
  33571. *
  33572. * @param {string} key to be escaped.
  33573. * @return {string} the escaped key.
  33574. */
  33575. function escape(key) {
  33576. var escapeRegex = /[=:]/g;
  33577. var escaperLookup = {
  33578. '=': '=0',
  33579. ':': '=2'
  33580. };
  33581. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  33582. return escaperLookup[match];
  33583. });
  33584. return '$' + escapedString;
  33585. }
  33586. /**
  33587. * TODO: Test that a single child and an array with one item have the same key
  33588. * pattern.
  33589. */
  33590. var didWarnAboutMaps = false;
  33591. var userProvidedKeyEscapeRegex = /\/+/g;
  33592. function escapeUserProvidedKey(text) {
  33593. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  33594. }
  33595. var POOL_SIZE = 10;
  33596. var traverseContextPool = [];
  33597. function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
  33598. if (traverseContextPool.length) {
  33599. var traverseContext = traverseContextPool.pop();
  33600. traverseContext.result = mapResult;
  33601. traverseContext.keyPrefix = keyPrefix;
  33602. traverseContext.func = mapFunction;
  33603. traverseContext.context = mapContext;
  33604. traverseContext.count = 0;
  33605. return traverseContext;
  33606. } else {
  33607. return {
  33608. result: mapResult,
  33609. keyPrefix: keyPrefix,
  33610. func: mapFunction,
  33611. context: mapContext,
  33612. count: 0
  33613. };
  33614. }
  33615. }
  33616. function releaseTraverseContext(traverseContext) {
  33617. traverseContext.result = null;
  33618. traverseContext.keyPrefix = null;
  33619. traverseContext.func = null;
  33620. traverseContext.context = null;
  33621. traverseContext.count = 0;
  33622. if (traverseContextPool.length < POOL_SIZE) {
  33623. traverseContextPool.push(traverseContext);
  33624. }
  33625. }
  33626. /**
  33627. * @param {?*} children Children tree container.
  33628. * @param {!string} nameSoFar Name of the key path so far.
  33629. * @param {!function} callback Callback to invoke with each child found.
  33630. * @param {?*} traverseContext Used to pass information throughout the traversal
  33631. * process.
  33632. * @return {!number} The number of children in this subtree.
  33633. */
  33634. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  33635. var type = typeof children;
  33636. if (type === 'undefined' || type === 'boolean') {
  33637. // All of the above are perceived as null.
  33638. children = null;
  33639. }
  33640. var invokeCallback = false;
  33641. if (children === null) {
  33642. invokeCallback = true;
  33643. } else {
  33644. switch (type) {
  33645. case 'string':
  33646. case 'number':
  33647. invokeCallback = true;
  33648. break;
  33649. case 'object':
  33650. switch (children.$$typeof) {
  33651. case REACT_ELEMENT_TYPE:
  33652. case REACT_PORTAL_TYPE:
  33653. invokeCallback = true;
  33654. }
  33655. }
  33656. }
  33657. if (invokeCallback) {
  33658. callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
  33659. // so that it's consistent if the number of children grows.
  33660. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  33661. return 1;
  33662. }
  33663. var child;
  33664. var nextName;
  33665. var subtreeCount = 0; // Count of children found in the current subtree.
  33666. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  33667. if (Array.isArray(children)) {
  33668. for (var i = 0; i < children.length; i++) {
  33669. child = children[i];
  33670. nextName = nextNamePrefix + getComponentKey(child, i);
  33671. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  33672. }
  33673. } else {
  33674. var iteratorFn = getIteratorFn(children);
  33675. if (typeof iteratorFn === 'function') {
  33676. {
  33677. // Warn about using Maps as children
  33678. if (iteratorFn === children.entries) {
  33679. if (!didWarnAboutMaps) {
  33680. warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
  33681. }
  33682. didWarnAboutMaps = true;
  33683. }
  33684. }
  33685. var iterator = iteratorFn.call(children);
  33686. var step;
  33687. var ii = 0;
  33688. while (!(step = iterator.next()).done) {
  33689. child = step.value;
  33690. nextName = nextNamePrefix + getComponentKey(child, ii++);
  33691. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  33692. }
  33693. } else if (type === 'object') {
  33694. var addendum = '';
  33695. {
  33696. addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
  33697. }
  33698. var childrenString = '' + children;
  33699. {
  33700. {
  33701. throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum );
  33702. }
  33703. }
  33704. }
  33705. }
  33706. return subtreeCount;
  33707. }
  33708. /**
  33709. * Traverses children that are typically specified as `props.children`, but
  33710. * might also be specified through attributes:
  33711. *
  33712. * - `traverseAllChildren(this.props.children, ...)`
  33713. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  33714. *
  33715. * The `traverseContext` is an optional argument that is passed through the
  33716. * entire traversal. It can be used to store accumulations or anything else that
  33717. * the callback might find relevant.
  33718. *
  33719. * @param {?*} children Children tree object.
  33720. * @param {!function} callback To invoke upon traversing each child.
  33721. * @param {?*} traverseContext Context for traversal.
  33722. * @return {!number} The number of children in this subtree.
  33723. */
  33724. function traverseAllChildren(children, callback, traverseContext) {
  33725. if (children == null) {
  33726. return 0;
  33727. }
  33728. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  33729. }
  33730. /**
  33731. * Generate a key string that identifies a component within a set.
  33732. *
  33733. * @param {*} component A component that could contain a manual key.
  33734. * @param {number} index Index that is used if a manual key is not provided.
  33735. * @return {string}
  33736. */
  33737. function getComponentKey(component, index) {
  33738. // Do some typechecking here since we call this blindly. We want to ensure
  33739. // that we don't block potential future ES APIs.
  33740. if (typeof component === 'object' && component !== null && component.key != null) {
  33741. // Explicit key
  33742. return escape(component.key);
  33743. } // Implicit key determined by the index in the set
  33744. return index.toString(36);
  33745. }
  33746. function forEachSingleChild(bookKeeping, child, name) {
  33747. var func = bookKeeping.func,
  33748. context = bookKeeping.context;
  33749. func.call(context, child, bookKeeping.count++);
  33750. }
  33751. /**
  33752. * Iterates through children that are typically specified as `props.children`.
  33753. *
  33754. * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
  33755. *
  33756. * The provided forEachFunc(child, index) will be called for each
  33757. * leaf child.
  33758. *
  33759. * @param {?*} children Children tree container.
  33760. * @param {function(*, int)} forEachFunc
  33761. * @param {*} forEachContext Context for forEachContext.
  33762. */
  33763. function forEachChildren(children, forEachFunc, forEachContext) {
  33764. if (children == null) {
  33765. return children;
  33766. }
  33767. var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
  33768. traverseAllChildren(children, forEachSingleChild, traverseContext);
  33769. releaseTraverseContext(traverseContext);
  33770. }
  33771. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  33772. var result = bookKeeping.result,
  33773. keyPrefix = bookKeeping.keyPrefix,
  33774. func = bookKeeping.func,
  33775. context = bookKeeping.context;
  33776. var mappedChild = func.call(context, child, bookKeeping.count++);
  33777. if (Array.isArray(mappedChild)) {
  33778. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
  33779. return c;
  33780. });
  33781. } else if (mappedChild != null) {
  33782. if (isValidElement(mappedChild)) {
  33783. mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
  33784. // traverseAllChildren used to do for objects as children
  33785. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  33786. }
  33787. result.push(mappedChild);
  33788. }
  33789. }
  33790. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  33791. var escapedPrefix = '';
  33792. if (prefix != null) {
  33793. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  33794. }
  33795. var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
  33796. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  33797. releaseTraverseContext(traverseContext);
  33798. }
  33799. /**
  33800. * Maps children that are typically specified as `props.children`.
  33801. *
  33802. * See https://reactjs.org/docs/react-api.html#reactchildrenmap
  33803. *
  33804. * The provided mapFunction(child, key, index) will be called for each
  33805. * leaf child.
  33806. *
  33807. * @param {?*} children Children tree container.
  33808. * @param {function(*, int)} func The map function.
  33809. * @param {*} context Context for mapFunction.
  33810. * @return {object} Object containing the ordered map of results.
  33811. */
  33812. function mapChildren(children, func, context) {
  33813. if (children == null) {
  33814. return children;
  33815. }
  33816. var result = [];
  33817. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  33818. return result;
  33819. }
  33820. /**
  33821. * Count the number of children that are typically specified as
  33822. * `props.children`.
  33823. *
  33824. * See https://reactjs.org/docs/react-api.html#reactchildrencount
  33825. *
  33826. * @param {?*} children Children tree container.
  33827. * @return {number} The number of children.
  33828. */
  33829. function countChildren(children) {
  33830. return traverseAllChildren(children, function () {
  33831. return null;
  33832. }, null);
  33833. }
  33834. /**
  33835. * Flatten a children object (typically specified as `props.children`) and
  33836. * return an array with appropriately re-keyed children.
  33837. *
  33838. * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
  33839. */
  33840. function toArray(children) {
  33841. var result = [];
  33842. mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
  33843. return child;
  33844. });
  33845. return result;
  33846. }
  33847. /**
  33848. * Returns the first child in a collection of children and verifies that there
  33849. * is only one child in the collection.
  33850. *
  33851. * See https://reactjs.org/docs/react-api.html#reactchildrenonly
  33852. *
  33853. * The current implementation of this function assumes that a single child gets
  33854. * passed without a wrapper, but the purpose of this helper function is to
  33855. * abstract away the particular structure of children.
  33856. *
  33857. * @param {?object} children Child collection structure.
  33858. * @return {ReactElement} The first and only `ReactElement` contained in the
  33859. * structure.
  33860. */
  33861. function onlyChild(children) {
  33862. if (!isValidElement(children)) {
  33863. {
  33864. throw Error( "React.Children.only expected to receive a single React element child." );
  33865. }
  33866. }
  33867. return children;
  33868. }
  33869. function createContext(defaultValue, calculateChangedBits) {
  33870. if (calculateChangedBits === undefined) {
  33871. calculateChangedBits = null;
  33872. } else {
  33873. {
  33874. if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
  33875. error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
  33876. }
  33877. }
  33878. }
  33879. var context = {
  33880. $$typeof: REACT_CONTEXT_TYPE,
  33881. _calculateChangedBits: calculateChangedBits,
  33882. // As a workaround to support multiple concurrent renderers, we categorize
  33883. // some renderers as primary and others as secondary. We only expect
  33884. // there to be two concurrent renderers at most: React Native (primary) and
  33885. // Fabric (secondary); React DOM (primary) and React ART (secondary).
  33886. // Secondary renderers store their context values on separate fields.
  33887. _currentValue: defaultValue,
  33888. _currentValue2: defaultValue,
  33889. // Used to track how many concurrent renderers this context currently
  33890. // supports within in a single renderer. Such as parallel server rendering.
  33891. _threadCount: 0,
  33892. // These are circular
  33893. Provider: null,
  33894. Consumer: null
  33895. };
  33896. context.Provider = {
  33897. $$typeof: REACT_PROVIDER_TYPE,
  33898. _context: context
  33899. };
  33900. var hasWarnedAboutUsingNestedContextConsumers = false;
  33901. var hasWarnedAboutUsingConsumerProvider = false;
  33902. {
  33903. // A separate object, but proxies back to the original context object for
  33904. // backwards compatibility. It has a different $$typeof, so we can properly
  33905. // warn for the incorrect usage of Context as a Consumer.
  33906. var Consumer = {
  33907. $$typeof: REACT_CONTEXT_TYPE,
  33908. _context: context,
  33909. _calculateChangedBits: context._calculateChangedBits
  33910. }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
  33911. Object.defineProperties(Consumer, {
  33912. Provider: {
  33913. get: function () {
  33914. if (!hasWarnedAboutUsingConsumerProvider) {
  33915. hasWarnedAboutUsingConsumerProvider = true;
  33916. error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
  33917. }
  33918. return context.Provider;
  33919. },
  33920. set: function (_Provider) {
  33921. context.Provider = _Provider;
  33922. }
  33923. },
  33924. _currentValue: {
  33925. get: function () {
  33926. return context._currentValue;
  33927. },
  33928. set: function (_currentValue) {
  33929. context._currentValue = _currentValue;
  33930. }
  33931. },
  33932. _currentValue2: {
  33933. get: function () {
  33934. return context._currentValue2;
  33935. },
  33936. set: function (_currentValue2) {
  33937. context._currentValue2 = _currentValue2;
  33938. }
  33939. },
  33940. _threadCount: {
  33941. get: function () {
  33942. return context._threadCount;
  33943. },
  33944. set: function (_threadCount) {
  33945. context._threadCount = _threadCount;
  33946. }
  33947. },
  33948. Consumer: {
  33949. get: function () {
  33950. if (!hasWarnedAboutUsingNestedContextConsumers) {
  33951. hasWarnedAboutUsingNestedContextConsumers = true;
  33952. error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
  33953. }
  33954. return context.Consumer;
  33955. }
  33956. }
  33957. }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
  33958. context.Consumer = Consumer;
  33959. }
  33960. {
  33961. context._currentRenderer = null;
  33962. context._currentRenderer2 = null;
  33963. }
  33964. return context;
  33965. }
  33966. function lazy(ctor) {
  33967. var lazyType = {
  33968. $$typeof: REACT_LAZY_TYPE,
  33969. _ctor: ctor,
  33970. // React uses these fields to store the result.
  33971. _status: -1,
  33972. _result: null
  33973. };
  33974. {
  33975. // In production, this would just set it on the object.
  33976. var defaultProps;
  33977. var propTypes;
  33978. Object.defineProperties(lazyType, {
  33979. defaultProps: {
  33980. configurable: true,
  33981. get: function () {
  33982. return defaultProps;
  33983. },
  33984. set: function (newDefaultProps) {
  33985. error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
  33986. defaultProps = newDefaultProps; // Match production behavior more closely:
  33987. Object.defineProperty(lazyType, 'defaultProps', {
  33988. enumerable: true
  33989. });
  33990. }
  33991. },
  33992. propTypes: {
  33993. configurable: true,
  33994. get: function () {
  33995. return propTypes;
  33996. },
  33997. set: function (newPropTypes) {
  33998. error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
  33999. propTypes = newPropTypes; // Match production behavior more closely:
  34000. Object.defineProperty(lazyType, 'propTypes', {
  34001. enumerable: true
  34002. });
  34003. }
  34004. }
  34005. });
  34006. }
  34007. return lazyType;
  34008. }
  34009. function forwardRef(render) {
  34010. {
  34011. if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
  34012. error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
  34013. } else if (typeof render !== 'function') {
  34014. error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
  34015. } else {
  34016. if (render.length !== 0 && render.length !== 2) {
  34017. error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
  34018. }
  34019. }
  34020. if (render != null) {
  34021. if (render.defaultProps != null || render.propTypes != null) {
  34022. error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
  34023. }
  34024. }
  34025. }
  34026. return {
  34027. $$typeof: REACT_FORWARD_REF_TYPE,
  34028. render: render
  34029. };
  34030. }
  34031. function isValidElementType(type) {
  34032. return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
  34033. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
  34034. }
  34035. function memo(type, compare) {
  34036. {
  34037. if (!isValidElementType(type)) {
  34038. error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
  34039. }
  34040. }
  34041. return {
  34042. $$typeof: REACT_MEMO_TYPE,
  34043. type: type,
  34044. compare: compare === undefined ? null : compare
  34045. };
  34046. }
  34047. function resolveDispatcher() {
  34048. var dispatcher = ReactCurrentDispatcher.current;
  34049. if (!(dispatcher !== null)) {
  34050. {
  34051. throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
  34052. }
  34053. }
  34054. return dispatcher;
  34055. }
  34056. function useContext(Context, unstable_observedBits) {
  34057. var dispatcher = resolveDispatcher();
  34058. {
  34059. if (unstable_observedBits !== undefined) {
  34060. error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
  34061. } // TODO: add a more generic warning for invalid values.
  34062. if (Context._context !== undefined) {
  34063. var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
  34064. // and nobody should be using this in existing code.
  34065. if (realContext.Consumer === Context) {
  34066. error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
  34067. } else if (realContext.Provider === Context) {
  34068. error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
  34069. }
  34070. }
  34071. }
  34072. return dispatcher.useContext(Context, unstable_observedBits);
  34073. }
  34074. function useState(initialState) {
  34075. var dispatcher = resolveDispatcher();
  34076. return dispatcher.useState(initialState);
  34077. }
  34078. function useReducer(reducer, initialArg, init) {
  34079. var dispatcher = resolveDispatcher();
  34080. return dispatcher.useReducer(reducer, initialArg, init);
  34081. }
  34082. function useRef(initialValue) {
  34083. var dispatcher = resolveDispatcher();
  34084. return dispatcher.useRef(initialValue);
  34085. }
  34086. function useEffect(create, deps) {
  34087. var dispatcher = resolveDispatcher();
  34088. return dispatcher.useEffect(create, deps);
  34089. }
  34090. function useLayoutEffect(create, deps) {
  34091. var dispatcher = resolveDispatcher();
  34092. return dispatcher.useLayoutEffect(create, deps);
  34093. }
  34094. function useCallback(callback, deps) {
  34095. var dispatcher = resolveDispatcher();
  34096. return dispatcher.useCallback(callback, deps);
  34097. }
  34098. function useMemo(create, deps) {
  34099. var dispatcher = resolveDispatcher();
  34100. return dispatcher.useMemo(create, deps);
  34101. }
  34102. function useImperativeHandle(ref, create, deps) {
  34103. var dispatcher = resolveDispatcher();
  34104. return dispatcher.useImperativeHandle(ref, create, deps);
  34105. }
  34106. function useDebugValue(value, formatterFn) {
  34107. {
  34108. var dispatcher = resolveDispatcher();
  34109. return dispatcher.useDebugValue(value, formatterFn);
  34110. }
  34111. }
  34112. var propTypesMisspellWarningShown;
  34113. {
  34114. propTypesMisspellWarningShown = false;
  34115. }
  34116. function getDeclarationErrorAddendum() {
  34117. if (ReactCurrentOwner.current) {
  34118. var name = getComponentName(ReactCurrentOwner.current.type);
  34119. if (name) {
  34120. return '\n\nCheck the render method of `' + name + '`.';
  34121. }
  34122. }
  34123. return '';
  34124. }
  34125. function getSourceInfoErrorAddendum(source) {
  34126. if (source !== undefined) {
  34127. var fileName = source.fileName.replace(/^.*[\\\/]/, '');
  34128. var lineNumber = source.lineNumber;
  34129. return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
  34130. }
  34131. return '';
  34132. }
  34133. function getSourceInfoErrorAddendumForProps(elementProps) {
  34134. if (elementProps !== null && elementProps !== undefined) {
  34135. return getSourceInfoErrorAddendum(elementProps.__source);
  34136. }
  34137. return '';
  34138. }
  34139. /**
  34140. * Warn if there's no key explicitly set on dynamic arrays of children or
  34141. * object keys are not valid. This allows us to keep track of children between
  34142. * updates.
  34143. */
  34144. var ownerHasKeyUseWarning = {};
  34145. function getCurrentComponentErrorInfo(parentType) {
  34146. var info = getDeclarationErrorAddendum();
  34147. if (!info) {
  34148. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  34149. if (parentName) {
  34150. info = "\n\nCheck the top-level render call using <" + parentName + ">.";
  34151. }
  34152. }
  34153. return info;
  34154. }
  34155. /**
  34156. * Warn if the element doesn't have an explicit key assigned to it.
  34157. * This element is in an array. The array could grow and shrink or be
  34158. * reordered. All children that haven't already been validated are required to
  34159. * have a "key" property assigned to it. Error statuses are cached so a warning
  34160. * will only be shown once.
  34161. *
  34162. * @internal
  34163. * @param {ReactElement} element Element that requires a key.
  34164. * @param {*} parentType element's parent's type.
  34165. */
  34166. function validateExplicitKey(element, parentType) {
  34167. if (!element._store || element._store.validated || element.key != null) {
  34168. return;
  34169. }
  34170. element._store.validated = true;
  34171. var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
  34172. if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
  34173. return;
  34174. }
  34175. ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
  34176. // property, it may be the creator of the child that's responsible for
  34177. // assigning it a key.
  34178. var childOwner = '';
  34179. if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
  34180. // Give the component that originally created this child.
  34181. childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
  34182. }
  34183. setCurrentlyValidatingElement(element);
  34184. {
  34185. error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
  34186. }
  34187. setCurrentlyValidatingElement(null);
  34188. }
  34189. /**
  34190. * Ensure that every element either is passed in a static location, in an
  34191. * array with an explicit keys property defined, or in an object literal
  34192. * with valid key property.
  34193. *
  34194. * @internal
  34195. * @param {ReactNode} node Statically passed child of any type.
  34196. * @param {*} parentType node's parent's type.
  34197. */
  34198. function validateChildKeys(node, parentType) {
  34199. if (typeof node !== 'object') {
  34200. return;
  34201. }
  34202. if (Array.isArray(node)) {
  34203. for (var i = 0; i < node.length; i++) {
  34204. var child = node[i];
  34205. if (isValidElement(child)) {
  34206. validateExplicitKey(child, parentType);
  34207. }
  34208. }
  34209. } else if (isValidElement(node)) {
  34210. // This element was passed in a valid location.
  34211. if (node._store) {
  34212. node._store.validated = true;
  34213. }
  34214. } else if (node) {
  34215. var iteratorFn = getIteratorFn(node);
  34216. if (typeof iteratorFn === 'function') {
  34217. // Entry iterators used to provide implicit keys,
  34218. // but now we print a separate warning for them later.
  34219. if (iteratorFn !== node.entries) {
  34220. var iterator = iteratorFn.call(node);
  34221. var step;
  34222. while (!(step = iterator.next()).done) {
  34223. if (isValidElement(step.value)) {
  34224. validateExplicitKey(step.value, parentType);
  34225. }
  34226. }
  34227. }
  34228. }
  34229. }
  34230. }
  34231. /**
  34232. * Given an element, validate that its props follow the propTypes definition,
  34233. * provided by the type.
  34234. *
  34235. * @param {ReactElement} element
  34236. */
  34237. function validatePropTypes(element) {
  34238. {
  34239. var type = element.type;
  34240. if (type === null || type === undefined || typeof type === 'string') {
  34241. return;
  34242. }
  34243. var name = getComponentName(type);
  34244. var propTypes;
  34245. if (typeof type === 'function') {
  34246. propTypes = type.propTypes;
  34247. } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
  34248. // Inner props are checked in the reconciler.
  34249. type.$$typeof === REACT_MEMO_TYPE)) {
  34250. propTypes = type.propTypes;
  34251. } else {
  34252. return;
  34253. }
  34254. if (propTypes) {
  34255. setCurrentlyValidatingElement(element);
  34256. checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
  34257. setCurrentlyValidatingElement(null);
  34258. } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
  34259. propTypesMisspellWarningShown = true;
  34260. error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
  34261. }
  34262. if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
  34263. error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
  34264. }
  34265. }
  34266. }
  34267. /**
  34268. * Given a fragment, validate that it can only be provided with fragment props
  34269. * @param {ReactElement} fragment
  34270. */
  34271. function validateFragmentProps(fragment) {
  34272. {
  34273. setCurrentlyValidatingElement(fragment);
  34274. var keys = Object.keys(fragment.props);
  34275. for (var i = 0; i < keys.length; i++) {
  34276. var key = keys[i];
  34277. if (key !== 'children' && key !== 'key') {
  34278. error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
  34279. break;
  34280. }
  34281. }
  34282. if (fragment.ref !== null) {
  34283. error('Invalid attribute `ref` supplied to `React.Fragment`.');
  34284. }
  34285. setCurrentlyValidatingElement(null);
  34286. }
  34287. }
  34288. function createElementWithValidation(type, props, children) {
  34289. var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
  34290. // succeed and there will likely be errors in render.
  34291. if (!validType) {
  34292. var info = '';
  34293. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  34294. info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
  34295. }
  34296. var sourceInfo = getSourceInfoErrorAddendumForProps(props);
  34297. if (sourceInfo) {
  34298. info += sourceInfo;
  34299. } else {
  34300. info += getDeclarationErrorAddendum();
  34301. }
  34302. var typeString;
  34303. if (type === null) {
  34304. typeString = 'null';
  34305. } else if (Array.isArray(type)) {
  34306. typeString = 'array';
  34307. } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
  34308. typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
  34309. info = ' Did you accidentally export a JSX literal instead of a component?';
  34310. } else {
  34311. typeString = typeof type;
  34312. }
  34313. {
  34314. error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
  34315. }
  34316. }
  34317. var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
  34318. // TODO: Drop this when these are no longer allowed as the type argument.
  34319. if (element == null) {
  34320. return element;
  34321. } // Skip key warning if the type isn't valid since our key validation logic
  34322. // doesn't expect a non-string/function type and can throw confusing errors.
  34323. // We don't want exception behavior to differ between dev and prod.
  34324. // (Rendering will throw with a helpful message and as soon as the type is
  34325. // fixed, the key warnings will appear.)
  34326. if (validType) {
  34327. for (var i = 2; i < arguments.length; i++) {
  34328. validateChildKeys(arguments[i], type);
  34329. }
  34330. }
  34331. if (type === REACT_FRAGMENT_TYPE) {
  34332. validateFragmentProps(element);
  34333. } else {
  34334. validatePropTypes(element);
  34335. }
  34336. return element;
  34337. }
  34338. var didWarnAboutDeprecatedCreateFactory = false;
  34339. function createFactoryWithValidation(type) {
  34340. var validatedFactory = createElementWithValidation.bind(null, type);
  34341. validatedFactory.type = type;
  34342. {
  34343. if (!didWarnAboutDeprecatedCreateFactory) {
  34344. didWarnAboutDeprecatedCreateFactory = true;
  34345. warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
  34346. } // Legacy hook: remove it
  34347. Object.defineProperty(validatedFactory, 'type', {
  34348. enumerable: false,
  34349. get: function () {
  34350. warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
  34351. Object.defineProperty(this, 'type', {
  34352. value: type
  34353. });
  34354. return type;
  34355. }
  34356. });
  34357. }
  34358. return validatedFactory;
  34359. }
  34360. function cloneElementWithValidation(element, props, children) {
  34361. var newElement = cloneElement.apply(this, arguments);
  34362. for (var i = 2; i < arguments.length; i++) {
  34363. validateChildKeys(arguments[i], newElement.type);
  34364. }
  34365. validatePropTypes(newElement);
  34366. return newElement;
  34367. }
  34368. {
  34369. try {
  34370. var frozenObject = Object.freeze({});
  34371. var testMap = new Map([[frozenObject, null]]);
  34372. var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
  34373. // https://github.com/rollup/rollup/issues/1771
  34374. // TODO: we can remove these if Rollup fixes the bug.
  34375. testMap.set(0, 0);
  34376. testSet.add(0);
  34377. } catch (e) {
  34378. }
  34379. }
  34380. var createElement$1 = createElementWithValidation ;
  34381. var cloneElement$1 = cloneElementWithValidation ;
  34382. var createFactory = createFactoryWithValidation ;
  34383. var Children = {
  34384. map: mapChildren,
  34385. forEach: forEachChildren,
  34386. count: countChildren,
  34387. toArray: toArray,
  34388. only: onlyChild
  34389. };
  34390. exports.Children = Children;
  34391. exports.Component = Component;
  34392. exports.Fragment = REACT_FRAGMENT_TYPE;
  34393. exports.Profiler = REACT_PROFILER_TYPE;
  34394. exports.PureComponent = PureComponent;
  34395. exports.StrictMode = REACT_STRICT_MODE_TYPE;
  34396. exports.Suspense = REACT_SUSPENSE_TYPE;
  34397. exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
  34398. exports.cloneElement = cloneElement$1;
  34399. exports.createContext = createContext;
  34400. exports.createElement = createElement$1;
  34401. exports.createFactory = createFactory;
  34402. exports.createRef = createRef;
  34403. exports.forwardRef = forwardRef;
  34404. exports.isValidElement = isValidElement;
  34405. exports.lazy = lazy;
  34406. exports.memo = memo;
  34407. exports.useCallback = useCallback;
  34408. exports.useContext = useContext;
  34409. exports.useDebugValue = useDebugValue;
  34410. exports.useEffect = useEffect;
  34411. exports.useImperativeHandle = useImperativeHandle;
  34412. exports.useLayoutEffect = useLayoutEffect;
  34413. exports.useMemo = useMemo;
  34414. exports.useReducer = useReducer;
  34415. exports.useRef = useRef;
  34416. exports.useState = useState;
  34417. exports.version = ReactVersion;
  34418. })();
  34419. }
  34420. /***/ }),
  34421. /***/ "../../node_modules/react/index.js":
  34422. /*!*******************************************************************!*\
  34423. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/react/index.js ***!
  34424. \*******************************************************************/
  34425. /*! no static exports found */
  34426. /***/ (function(module, exports, __webpack_require__) {
  34427. "use strict";
  34428. if (false) {} else {
  34429. module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "../../node_modules/react/cjs/react.development.js");
  34430. }
  34431. /***/ }),
  34432. /***/ "../../node_modules/scheduler/cjs/scheduler-tracing.development.js":
  34433. /*!***************************************************************************************************!*\
  34434. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/scheduler/cjs/scheduler-tracing.development.js ***!
  34435. \***************************************************************************************************/
  34436. /*! no static exports found */
  34437. /***/ (function(module, exports, __webpack_require__) {
  34438. "use strict";
  34439. /** @license React v0.19.1
  34440. * scheduler-tracing.development.js
  34441. *
  34442. * Copyright (c) Facebook, Inc. and its affiliates.
  34443. *
  34444. * This source code is licensed under the MIT license found in the
  34445. * LICENSE file in the root directory of this source tree.
  34446. */
  34447. if (true) {
  34448. (function() {
  34449. 'use strict';
  34450. var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs.
  34451. var interactionIDCounter = 0;
  34452. var threadIDCounter = 0; // Set of currently traced interactions.
  34453. // Interactions "stack"–
  34454. // Meaning that newly traced interactions are appended to the previously active set.
  34455. // When an interaction goes out of scope, the previous set (if any) is restored.
  34456. exports.__interactionsRef = null; // Listener(s) to notify when interactions begin and end.
  34457. exports.__subscriberRef = null;
  34458. {
  34459. exports.__interactionsRef = {
  34460. current: new Set()
  34461. };
  34462. exports.__subscriberRef = {
  34463. current: null
  34464. };
  34465. }
  34466. function unstable_clear(callback) {
  34467. var prevInteractions = exports.__interactionsRef.current;
  34468. exports.__interactionsRef.current = new Set();
  34469. try {
  34470. return callback();
  34471. } finally {
  34472. exports.__interactionsRef.current = prevInteractions;
  34473. }
  34474. }
  34475. function unstable_getCurrent() {
  34476. {
  34477. return exports.__interactionsRef.current;
  34478. }
  34479. }
  34480. function unstable_getThreadID() {
  34481. return ++threadIDCounter;
  34482. }
  34483. function unstable_trace(name, timestamp, callback) {
  34484. var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
  34485. var interaction = {
  34486. __count: 1,
  34487. id: interactionIDCounter++,
  34488. name: name,
  34489. timestamp: timestamp
  34490. };
  34491. var prevInteractions = exports.__interactionsRef.current; // Traced interactions should stack/accumulate.
  34492. // To do that, clone the current interactions.
  34493. // The previous set will be restored upon completion.
  34494. var interactions = new Set(prevInteractions);
  34495. interactions.add(interaction);
  34496. exports.__interactionsRef.current = interactions;
  34497. var subscriber = exports.__subscriberRef.current;
  34498. var returnValue;
  34499. try {
  34500. if (subscriber !== null) {
  34501. subscriber.onInteractionTraced(interaction);
  34502. }
  34503. } finally {
  34504. try {
  34505. if (subscriber !== null) {
  34506. subscriber.onWorkStarted(interactions, threadID);
  34507. }
  34508. } finally {
  34509. try {
  34510. returnValue = callback();
  34511. } finally {
  34512. exports.__interactionsRef.current = prevInteractions;
  34513. try {
  34514. if (subscriber !== null) {
  34515. subscriber.onWorkStopped(interactions, threadID);
  34516. }
  34517. } finally {
  34518. interaction.__count--; // If no async work was scheduled for this interaction,
  34519. // Notify subscribers that it's completed.
  34520. if (subscriber !== null && interaction.__count === 0) {
  34521. subscriber.onInteractionScheduledWorkCompleted(interaction);
  34522. }
  34523. }
  34524. }
  34525. }
  34526. }
  34527. return returnValue;
  34528. }
  34529. function unstable_wrap(callback) {
  34530. var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
  34531. var wrappedInteractions = exports.__interactionsRef.current;
  34532. var subscriber = exports.__subscriberRef.current;
  34533. if (subscriber !== null) {
  34534. subscriber.onWorkScheduled(wrappedInteractions, threadID);
  34535. } // Update the pending async work count for the current interactions.
  34536. // Update after calling subscribers in case of error.
  34537. wrappedInteractions.forEach(function (interaction) {
  34538. interaction.__count++;
  34539. });
  34540. var hasRun = false;
  34541. function wrapped() {
  34542. var prevInteractions = exports.__interactionsRef.current;
  34543. exports.__interactionsRef.current = wrappedInteractions;
  34544. subscriber = exports.__subscriberRef.current;
  34545. try {
  34546. var returnValue;
  34547. try {
  34548. if (subscriber !== null) {
  34549. subscriber.onWorkStarted(wrappedInteractions, threadID);
  34550. }
  34551. } finally {
  34552. try {
  34553. returnValue = callback.apply(undefined, arguments);
  34554. } finally {
  34555. exports.__interactionsRef.current = prevInteractions;
  34556. if (subscriber !== null) {
  34557. subscriber.onWorkStopped(wrappedInteractions, threadID);
  34558. }
  34559. }
  34560. }
  34561. return returnValue;
  34562. } finally {
  34563. if (!hasRun) {
  34564. // We only expect a wrapped function to be executed once,
  34565. // But in the event that it's executed more than once–
  34566. // Only decrement the outstanding interaction counts once.
  34567. hasRun = true; // Update pending async counts for all wrapped interactions.
  34568. // If this was the last scheduled async work for any of them,
  34569. // Mark them as completed.
  34570. wrappedInteractions.forEach(function (interaction) {
  34571. interaction.__count--;
  34572. if (subscriber !== null && interaction.__count === 0) {
  34573. subscriber.onInteractionScheduledWorkCompleted(interaction);
  34574. }
  34575. });
  34576. }
  34577. }
  34578. }
  34579. wrapped.cancel = function cancel() {
  34580. subscriber = exports.__subscriberRef.current;
  34581. try {
  34582. if (subscriber !== null) {
  34583. subscriber.onWorkCanceled(wrappedInteractions, threadID);
  34584. }
  34585. } finally {
  34586. // Update pending async counts for all wrapped interactions.
  34587. // If this was the last scheduled async work for any of them,
  34588. // Mark them as completed.
  34589. wrappedInteractions.forEach(function (interaction) {
  34590. interaction.__count--;
  34591. if (subscriber && interaction.__count === 0) {
  34592. subscriber.onInteractionScheduledWorkCompleted(interaction);
  34593. }
  34594. });
  34595. }
  34596. };
  34597. return wrapped;
  34598. }
  34599. var subscribers = null;
  34600. {
  34601. subscribers = new Set();
  34602. }
  34603. function unstable_subscribe(subscriber) {
  34604. {
  34605. subscribers.add(subscriber);
  34606. if (subscribers.size === 1) {
  34607. exports.__subscriberRef.current = {
  34608. onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
  34609. onInteractionTraced: onInteractionTraced,
  34610. onWorkCanceled: onWorkCanceled,
  34611. onWorkScheduled: onWorkScheduled,
  34612. onWorkStarted: onWorkStarted,
  34613. onWorkStopped: onWorkStopped
  34614. };
  34615. }
  34616. }
  34617. }
  34618. function unstable_unsubscribe(subscriber) {
  34619. {
  34620. subscribers.delete(subscriber);
  34621. if (subscribers.size === 0) {
  34622. exports.__subscriberRef.current = null;
  34623. }
  34624. }
  34625. }
  34626. function onInteractionTraced(interaction) {
  34627. var didCatchError = false;
  34628. var caughtError = null;
  34629. subscribers.forEach(function (subscriber) {
  34630. try {
  34631. subscriber.onInteractionTraced(interaction);
  34632. } catch (error) {
  34633. if (!didCatchError) {
  34634. didCatchError = true;
  34635. caughtError = error;
  34636. }
  34637. }
  34638. });
  34639. if (didCatchError) {
  34640. throw caughtError;
  34641. }
  34642. }
  34643. function onInteractionScheduledWorkCompleted(interaction) {
  34644. var didCatchError = false;
  34645. var caughtError = null;
  34646. subscribers.forEach(function (subscriber) {
  34647. try {
  34648. subscriber.onInteractionScheduledWorkCompleted(interaction);
  34649. } catch (error) {
  34650. if (!didCatchError) {
  34651. didCatchError = true;
  34652. caughtError = error;
  34653. }
  34654. }
  34655. });
  34656. if (didCatchError) {
  34657. throw caughtError;
  34658. }
  34659. }
  34660. function onWorkScheduled(interactions, threadID) {
  34661. var didCatchError = false;
  34662. var caughtError = null;
  34663. subscribers.forEach(function (subscriber) {
  34664. try {
  34665. subscriber.onWorkScheduled(interactions, threadID);
  34666. } catch (error) {
  34667. if (!didCatchError) {
  34668. didCatchError = true;
  34669. caughtError = error;
  34670. }
  34671. }
  34672. });
  34673. if (didCatchError) {
  34674. throw caughtError;
  34675. }
  34676. }
  34677. function onWorkStarted(interactions, threadID) {
  34678. var didCatchError = false;
  34679. var caughtError = null;
  34680. subscribers.forEach(function (subscriber) {
  34681. try {
  34682. subscriber.onWorkStarted(interactions, threadID);
  34683. } catch (error) {
  34684. if (!didCatchError) {
  34685. didCatchError = true;
  34686. caughtError = error;
  34687. }
  34688. }
  34689. });
  34690. if (didCatchError) {
  34691. throw caughtError;
  34692. }
  34693. }
  34694. function onWorkStopped(interactions, threadID) {
  34695. var didCatchError = false;
  34696. var caughtError = null;
  34697. subscribers.forEach(function (subscriber) {
  34698. try {
  34699. subscriber.onWorkStopped(interactions, threadID);
  34700. } catch (error) {
  34701. if (!didCatchError) {
  34702. didCatchError = true;
  34703. caughtError = error;
  34704. }
  34705. }
  34706. });
  34707. if (didCatchError) {
  34708. throw caughtError;
  34709. }
  34710. }
  34711. function onWorkCanceled(interactions, threadID) {
  34712. var didCatchError = false;
  34713. var caughtError = null;
  34714. subscribers.forEach(function (subscriber) {
  34715. try {
  34716. subscriber.onWorkCanceled(interactions, threadID);
  34717. } catch (error) {
  34718. if (!didCatchError) {
  34719. didCatchError = true;
  34720. caughtError = error;
  34721. }
  34722. }
  34723. });
  34724. if (didCatchError) {
  34725. throw caughtError;
  34726. }
  34727. }
  34728. exports.unstable_clear = unstable_clear;
  34729. exports.unstable_getCurrent = unstable_getCurrent;
  34730. exports.unstable_getThreadID = unstable_getThreadID;
  34731. exports.unstable_subscribe = unstable_subscribe;
  34732. exports.unstable_trace = unstable_trace;
  34733. exports.unstable_unsubscribe = unstable_unsubscribe;
  34734. exports.unstable_wrap = unstable_wrap;
  34735. })();
  34736. }
  34737. /***/ }),
  34738. /***/ "../../node_modules/scheduler/cjs/scheduler.development.js":
  34739. /*!*******************************************************************************************!*\
  34740. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/scheduler/cjs/scheduler.development.js ***!
  34741. \*******************************************************************************************/
  34742. /*! no static exports found */
  34743. /***/ (function(module, exports, __webpack_require__) {
  34744. "use strict";
  34745. /** @license React v0.19.1
  34746. * scheduler.development.js
  34747. *
  34748. * Copyright (c) Facebook, Inc. and its affiliates.
  34749. *
  34750. * This source code is licensed under the MIT license found in the
  34751. * LICENSE file in the root directory of this source tree.
  34752. */
  34753. if (true) {
  34754. (function() {
  34755. 'use strict';
  34756. var enableSchedulerDebugging = false;
  34757. var enableProfiling = true;
  34758. var requestHostCallback;
  34759. var requestHostTimeout;
  34760. var cancelHostTimeout;
  34761. var shouldYieldToHost;
  34762. var requestPaint;
  34763. if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive
  34764. // implementation using setTimeout.
  34765. typeof window === 'undefined' || // Check if MessageChannel is supported, too.
  34766. typeof MessageChannel !== 'function') {
  34767. // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
  34768. // fallback to a naive implementation.
  34769. var _callback = null;
  34770. var _timeoutID = null;
  34771. var _flushCallback = function () {
  34772. if (_callback !== null) {
  34773. try {
  34774. var currentTime = exports.unstable_now();
  34775. var hasRemainingTime = true;
  34776. _callback(hasRemainingTime, currentTime);
  34777. _callback = null;
  34778. } catch (e) {
  34779. setTimeout(_flushCallback, 0);
  34780. throw e;
  34781. }
  34782. }
  34783. };
  34784. var initialTime = Date.now();
  34785. exports.unstable_now = function () {
  34786. return Date.now() - initialTime;
  34787. };
  34788. requestHostCallback = function (cb) {
  34789. if (_callback !== null) {
  34790. // Protect against re-entrancy.
  34791. setTimeout(requestHostCallback, 0, cb);
  34792. } else {
  34793. _callback = cb;
  34794. setTimeout(_flushCallback, 0);
  34795. }
  34796. };
  34797. requestHostTimeout = function (cb, ms) {
  34798. _timeoutID = setTimeout(cb, ms);
  34799. };
  34800. cancelHostTimeout = function () {
  34801. clearTimeout(_timeoutID);
  34802. };
  34803. shouldYieldToHost = function () {
  34804. return false;
  34805. };
  34806. requestPaint = exports.unstable_forceFrameRate = function () {};
  34807. } else {
  34808. // Capture local references to native APIs, in case a polyfill overrides them.
  34809. var performance = window.performance;
  34810. var _Date = window.Date;
  34811. var _setTimeout = window.setTimeout;
  34812. var _clearTimeout = window.clearTimeout;
  34813. if (typeof console !== 'undefined') {
  34814. // TODO: Scheduler no longer requires these methods to be polyfilled. But
  34815. // maybe we want to continue warning if they don't exist, to preserve the
  34816. // option to rely on it in the future?
  34817. var requestAnimationFrame = window.requestAnimationFrame;
  34818. var cancelAnimationFrame = window.cancelAnimationFrame; // TODO: Remove fb.me link
  34819. if (typeof requestAnimationFrame !== 'function') {
  34820. // Using console['error'] to evade Babel and ESLint
  34821. console['error']("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
  34822. }
  34823. if (typeof cancelAnimationFrame !== 'function') {
  34824. // Using console['error'] to evade Babel and ESLint
  34825. console['error']("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
  34826. }
  34827. }
  34828. if (typeof performance === 'object' && typeof performance.now === 'function') {
  34829. exports.unstable_now = function () {
  34830. return performance.now();
  34831. };
  34832. } else {
  34833. var _initialTime = _Date.now();
  34834. exports.unstable_now = function () {
  34835. return _Date.now() - _initialTime;
  34836. };
  34837. }
  34838. var isMessageLoopRunning = false;
  34839. var scheduledHostCallback = null;
  34840. var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
  34841. // thread, like user events. By default, it yields multiple times per frame.
  34842. // It does not attempt to align with frame boundaries, since most tasks don't
  34843. // need to be frame aligned; for those that do, use requestAnimationFrame.
  34844. var yieldInterval = 5;
  34845. var deadline = 0; // TODO: Make this configurable
  34846. {
  34847. // `isInputPending` is not available. Since we have no way of knowing if
  34848. // there's pending input, always yield at the end of the frame.
  34849. shouldYieldToHost = function () {
  34850. return exports.unstable_now() >= deadline;
  34851. }; // Since we yield every frame regardless, `requestPaint` has no effect.
  34852. requestPaint = function () {};
  34853. }
  34854. exports.unstable_forceFrameRate = function (fps) {
  34855. if (fps < 0 || fps > 125) {
  34856. // Using console['error'] to evade Babel and ESLint
  34857. console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported');
  34858. return;
  34859. }
  34860. if (fps > 0) {
  34861. yieldInterval = Math.floor(1000 / fps);
  34862. } else {
  34863. // reset the framerate
  34864. yieldInterval = 5;
  34865. }
  34866. };
  34867. var performWorkUntilDeadline = function () {
  34868. if (scheduledHostCallback !== null) {
  34869. var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync
  34870. // cycle. This means there's always time remaining at the beginning of
  34871. // the message event.
  34872. deadline = currentTime + yieldInterval;
  34873. var hasTimeRemaining = true;
  34874. try {
  34875. var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
  34876. if (!hasMoreWork) {
  34877. isMessageLoopRunning = false;
  34878. scheduledHostCallback = null;
  34879. } else {
  34880. // If there's more work, schedule the next message event at the end
  34881. // of the preceding one.
  34882. port.postMessage(null);
  34883. }
  34884. } catch (error) {
  34885. // If a scheduler task throws, exit the current browser task so the
  34886. // error can be observed.
  34887. port.postMessage(null);
  34888. throw error;
  34889. }
  34890. } else {
  34891. isMessageLoopRunning = false;
  34892. } // Yielding to the browser will give it a chance to paint, so we can
  34893. };
  34894. var channel = new MessageChannel();
  34895. var port = channel.port2;
  34896. channel.port1.onmessage = performWorkUntilDeadline;
  34897. requestHostCallback = function (callback) {
  34898. scheduledHostCallback = callback;
  34899. if (!isMessageLoopRunning) {
  34900. isMessageLoopRunning = true;
  34901. port.postMessage(null);
  34902. }
  34903. };
  34904. requestHostTimeout = function (callback, ms) {
  34905. taskTimeoutID = _setTimeout(function () {
  34906. callback(exports.unstable_now());
  34907. }, ms);
  34908. };
  34909. cancelHostTimeout = function () {
  34910. _clearTimeout(taskTimeoutID);
  34911. taskTimeoutID = -1;
  34912. };
  34913. }
  34914. function push(heap, node) {
  34915. var index = heap.length;
  34916. heap.push(node);
  34917. siftUp(heap, node, index);
  34918. }
  34919. function peek(heap) {
  34920. var first = heap[0];
  34921. return first === undefined ? null : first;
  34922. }
  34923. function pop(heap) {
  34924. var first = heap[0];
  34925. if (first !== undefined) {
  34926. var last = heap.pop();
  34927. if (last !== first) {
  34928. heap[0] = last;
  34929. siftDown(heap, last, 0);
  34930. }
  34931. return first;
  34932. } else {
  34933. return null;
  34934. }
  34935. }
  34936. function siftUp(heap, node, i) {
  34937. var index = i;
  34938. while (true) {
  34939. var parentIndex = index - 1 >>> 1;
  34940. var parent = heap[parentIndex];
  34941. if (parent !== undefined && compare(parent, node) > 0) {
  34942. // The parent is larger. Swap positions.
  34943. heap[parentIndex] = node;
  34944. heap[index] = parent;
  34945. index = parentIndex;
  34946. } else {
  34947. // The parent is smaller. Exit.
  34948. return;
  34949. }
  34950. }
  34951. }
  34952. function siftDown(heap, node, i) {
  34953. var index = i;
  34954. var length = heap.length;
  34955. while (index < length) {
  34956. var leftIndex = (index + 1) * 2 - 1;
  34957. var left = heap[leftIndex];
  34958. var rightIndex = leftIndex + 1;
  34959. var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
  34960. if (left !== undefined && compare(left, node) < 0) {
  34961. if (right !== undefined && compare(right, left) < 0) {
  34962. heap[index] = right;
  34963. heap[rightIndex] = node;
  34964. index = rightIndex;
  34965. } else {
  34966. heap[index] = left;
  34967. heap[leftIndex] = node;
  34968. index = leftIndex;
  34969. }
  34970. } else if (right !== undefined && compare(right, node) < 0) {
  34971. heap[index] = right;
  34972. heap[rightIndex] = node;
  34973. index = rightIndex;
  34974. } else {
  34975. // Neither child is smaller. Exit.
  34976. return;
  34977. }
  34978. }
  34979. }
  34980. function compare(a, b) {
  34981. // Compare sort index first, then task id.
  34982. var diff = a.sortIndex - b.sortIndex;
  34983. return diff !== 0 ? diff : a.id - b.id;
  34984. }
  34985. // TODO: Use symbols?
  34986. var NoPriority = 0;
  34987. var ImmediatePriority = 1;
  34988. var UserBlockingPriority = 2;
  34989. var NormalPriority = 3;
  34990. var LowPriority = 4;
  34991. var IdlePriority = 5;
  34992. var runIdCounter = 0;
  34993. var mainThreadIdCounter = 0;
  34994. var profilingStateSize = 4;
  34995. var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer
  34996. typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer
  34997. typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9
  34998. ;
  34999. var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks
  35000. var PRIORITY = 0;
  35001. var CURRENT_TASK_ID = 1;
  35002. var CURRENT_RUN_ID = 2;
  35003. var QUEUE_SIZE = 3;
  35004. {
  35005. profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue
  35006. // array might include canceled tasks.
  35007. profilingState[QUEUE_SIZE] = 0;
  35008. profilingState[CURRENT_TASK_ID] = 0;
  35009. } // Bytes per element is 4
  35010. var INITIAL_EVENT_LOG_SIZE = 131072;
  35011. var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes
  35012. var eventLogSize = 0;
  35013. var eventLogBuffer = null;
  35014. var eventLog = null;
  35015. var eventLogIndex = 0;
  35016. var TaskStartEvent = 1;
  35017. var TaskCompleteEvent = 2;
  35018. var TaskErrorEvent = 3;
  35019. var TaskCancelEvent = 4;
  35020. var TaskRunEvent = 5;
  35021. var TaskYieldEvent = 6;
  35022. var SchedulerSuspendEvent = 7;
  35023. var SchedulerResumeEvent = 8;
  35024. function logEvent(entries) {
  35025. if (eventLog !== null) {
  35026. var offset = eventLogIndex;
  35027. eventLogIndex += entries.length;
  35028. if (eventLogIndex + 1 > eventLogSize) {
  35029. eventLogSize *= 2;
  35030. if (eventLogSize > MAX_EVENT_LOG_SIZE) {
  35031. // Using console['error'] to evade Babel and ESLint
  35032. console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.');
  35033. stopLoggingProfilingEvents();
  35034. return;
  35035. }
  35036. var newEventLog = new Int32Array(eventLogSize * 4);
  35037. newEventLog.set(eventLog);
  35038. eventLogBuffer = newEventLog.buffer;
  35039. eventLog = newEventLog;
  35040. }
  35041. eventLog.set(entries, offset);
  35042. }
  35043. }
  35044. function startLoggingProfilingEvents() {
  35045. eventLogSize = INITIAL_EVENT_LOG_SIZE;
  35046. eventLogBuffer = new ArrayBuffer(eventLogSize * 4);
  35047. eventLog = new Int32Array(eventLogBuffer);
  35048. eventLogIndex = 0;
  35049. }
  35050. function stopLoggingProfilingEvents() {
  35051. var buffer = eventLogBuffer;
  35052. eventLogSize = 0;
  35053. eventLogBuffer = null;
  35054. eventLog = null;
  35055. eventLogIndex = 0;
  35056. return buffer;
  35057. }
  35058. function markTaskStart(task, ms) {
  35059. {
  35060. profilingState[QUEUE_SIZE]++;
  35061. if (eventLog !== null) {
  35062. // performance.now returns a float, representing milliseconds. When the
  35063. // event is logged, it's coerced to an int. Convert to microseconds to
  35064. // maintain extra degrees of precision.
  35065. logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]);
  35066. }
  35067. }
  35068. }
  35069. function markTaskCompleted(task, ms) {
  35070. {
  35071. profilingState[PRIORITY] = NoPriority;
  35072. profilingState[CURRENT_TASK_ID] = 0;
  35073. profilingState[QUEUE_SIZE]--;
  35074. if (eventLog !== null) {
  35075. logEvent([TaskCompleteEvent, ms * 1000, task.id]);
  35076. }
  35077. }
  35078. }
  35079. function markTaskCanceled(task, ms) {
  35080. {
  35081. profilingState[QUEUE_SIZE]--;
  35082. if (eventLog !== null) {
  35083. logEvent([TaskCancelEvent, ms * 1000, task.id]);
  35084. }
  35085. }
  35086. }
  35087. function markTaskErrored(task, ms) {
  35088. {
  35089. profilingState[PRIORITY] = NoPriority;
  35090. profilingState[CURRENT_TASK_ID] = 0;
  35091. profilingState[QUEUE_SIZE]--;
  35092. if (eventLog !== null) {
  35093. logEvent([TaskErrorEvent, ms * 1000, task.id]);
  35094. }
  35095. }
  35096. }
  35097. function markTaskRun(task, ms) {
  35098. {
  35099. runIdCounter++;
  35100. profilingState[PRIORITY] = task.priorityLevel;
  35101. profilingState[CURRENT_TASK_ID] = task.id;
  35102. profilingState[CURRENT_RUN_ID] = runIdCounter;
  35103. if (eventLog !== null) {
  35104. logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]);
  35105. }
  35106. }
  35107. }
  35108. function markTaskYield(task, ms) {
  35109. {
  35110. profilingState[PRIORITY] = NoPriority;
  35111. profilingState[CURRENT_TASK_ID] = 0;
  35112. profilingState[CURRENT_RUN_ID] = 0;
  35113. if (eventLog !== null) {
  35114. logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
  35115. }
  35116. }
  35117. }
  35118. function markSchedulerSuspended(ms) {
  35119. {
  35120. mainThreadIdCounter++;
  35121. if (eventLog !== null) {
  35122. logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]);
  35123. }
  35124. }
  35125. }
  35126. function markSchedulerUnsuspended(ms) {
  35127. {
  35128. if (eventLog !== null) {
  35129. logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
  35130. }
  35131. }
  35132. }
  35133. /* eslint-disable no-var */
  35134. // Math.pow(2, 30) - 1
  35135. // 0b111111111111111111111111111111
  35136. var maxSigned31BitInt = 1073741823; // Times out immediately
  35137. var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
  35138. var USER_BLOCKING_PRIORITY = 250;
  35139. var NORMAL_PRIORITY_TIMEOUT = 5000;
  35140. var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
  35141. var IDLE_PRIORITY = maxSigned31BitInt; // Tasks are stored on a min heap
  35142. var taskQueue = [];
  35143. var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
  35144. var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
  35145. var currentTask = null;
  35146. var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
  35147. var isPerformingWork = false;
  35148. var isHostCallbackScheduled = false;
  35149. var isHostTimeoutScheduled = false;
  35150. function advanceTimers(currentTime) {
  35151. // Check for tasks that are no longer delayed and add them to the queue.
  35152. var timer = peek(timerQueue);
  35153. while (timer !== null) {
  35154. if (timer.callback === null) {
  35155. // Timer was cancelled.
  35156. pop(timerQueue);
  35157. } else if (timer.startTime <= currentTime) {
  35158. // Timer fired. Transfer to the task queue.
  35159. pop(timerQueue);
  35160. timer.sortIndex = timer.expirationTime;
  35161. push(taskQueue, timer);
  35162. {
  35163. markTaskStart(timer, currentTime);
  35164. timer.isQueued = true;
  35165. }
  35166. } else {
  35167. // Remaining timers are pending.
  35168. return;
  35169. }
  35170. timer = peek(timerQueue);
  35171. }
  35172. }
  35173. function handleTimeout(currentTime) {
  35174. isHostTimeoutScheduled = false;
  35175. advanceTimers(currentTime);
  35176. if (!isHostCallbackScheduled) {
  35177. if (peek(taskQueue) !== null) {
  35178. isHostCallbackScheduled = true;
  35179. requestHostCallback(flushWork);
  35180. } else {
  35181. var firstTimer = peek(timerQueue);
  35182. if (firstTimer !== null) {
  35183. requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
  35184. }
  35185. }
  35186. }
  35187. }
  35188. function flushWork(hasTimeRemaining, initialTime) {
  35189. {
  35190. markSchedulerUnsuspended(initialTime);
  35191. } // We'll need a host callback the next time work is scheduled.
  35192. isHostCallbackScheduled = false;
  35193. if (isHostTimeoutScheduled) {
  35194. // We scheduled a timeout but it's no longer needed. Cancel it.
  35195. isHostTimeoutScheduled = false;
  35196. cancelHostTimeout();
  35197. }
  35198. isPerformingWork = true;
  35199. var previousPriorityLevel = currentPriorityLevel;
  35200. try {
  35201. if (enableProfiling) {
  35202. try {
  35203. return workLoop(hasTimeRemaining, initialTime);
  35204. } catch (error) {
  35205. if (currentTask !== null) {
  35206. var currentTime = exports.unstable_now();
  35207. markTaskErrored(currentTask, currentTime);
  35208. currentTask.isQueued = false;
  35209. }
  35210. throw error;
  35211. }
  35212. } else {
  35213. // No catch in prod codepath.
  35214. return workLoop(hasTimeRemaining, initialTime);
  35215. }
  35216. } finally {
  35217. currentTask = null;
  35218. currentPriorityLevel = previousPriorityLevel;
  35219. isPerformingWork = false;
  35220. {
  35221. var _currentTime = exports.unstable_now();
  35222. markSchedulerSuspended(_currentTime);
  35223. }
  35224. }
  35225. }
  35226. function workLoop(hasTimeRemaining, initialTime) {
  35227. var currentTime = initialTime;
  35228. advanceTimers(currentTime);
  35229. currentTask = peek(taskQueue);
  35230. while (currentTask !== null && !(enableSchedulerDebugging )) {
  35231. if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
  35232. // This currentTask hasn't expired, and we've reached the deadline.
  35233. break;
  35234. }
  35235. var callback = currentTask.callback;
  35236. if (callback !== null) {
  35237. currentTask.callback = null;
  35238. currentPriorityLevel = currentTask.priorityLevel;
  35239. var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
  35240. markTaskRun(currentTask, currentTime);
  35241. var continuationCallback = callback(didUserCallbackTimeout);
  35242. currentTime = exports.unstable_now();
  35243. if (typeof continuationCallback === 'function') {
  35244. currentTask.callback = continuationCallback;
  35245. markTaskYield(currentTask, currentTime);
  35246. } else {
  35247. {
  35248. markTaskCompleted(currentTask, currentTime);
  35249. currentTask.isQueued = false;
  35250. }
  35251. if (currentTask === peek(taskQueue)) {
  35252. pop(taskQueue);
  35253. }
  35254. }
  35255. advanceTimers(currentTime);
  35256. } else {
  35257. pop(taskQueue);
  35258. }
  35259. currentTask = peek(taskQueue);
  35260. } // Return whether there's additional work
  35261. if (currentTask !== null) {
  35262. return true;
  35263. } else {
  35264. var firstTimer = peek(timerQueue);
  35265. if (firstTimer !== null) {
  35266. requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
  35267. }
  35268. return false;
  35269. }
  35270. }
  35271. function unstable_runWithPriority(priorityLevel, eventHandler) {
  35272. switch (priorityLevel) {
  35273. case ImmediatePriority:
  35274. case UserBlockingPriority:
  35275. case NormalPriority:
  35276. case LowPriority:
  35277. case IdlePriority:
  35278. break;
  35279. default:
  35280. priorityLevel = NormalPriority;
  35281. }
  35282. var previousPriorityLevel = currentPriorityLevel;
  35283. currentPriorityLevel = priorityLevel;
  35284. try {
  35285. return eventHandler();
  35286. } finally {
  35287. currentPriorityLevel = previousPriorityLevel;
  35288. }
  35289. }
  35290. function unstable_next(eventHandler) {
  35291. var priorityLevel;
  35292. switch (currentPriorityLevel) {
  35293. case ImmediatePriority:
  35294. case UserBlockingPriority:
  35295. case NormalPriority:
  35296. // Shift down to normal priority
  35297. priorityLevel = NormalPriority;
  35298. break;
  35299. default:
  35300. // Anything lower than normal priority should remain at the current level.
  35301. priorityLevel = currentPriorityLevel;
  35302. break;
  35303. }
  35304. var previousPriorityLevel = currentPriorityLevel;
  35305. currentPriorityLevel = priorityLevel;
  35306. try {
  35307. return eventHandler();
  35308. } finally {
  35309. currentPriorityLevel = previousPriorityLevel;
  35310. }
  35311. }
  35312. function unstable_wrapCallback(callback) {
  35313. var parentPriorityLevel = currentPriorityLevel;
  35314. return function () {
  35315. // This is a fork of runWithPriority, inlined for performance.
  35316. var previousPriorityLevel = currentPriorityLevel;
  35317. currentPriorityLevel = parentPriorityLevel;
  35318. try {
  35319. return callback.apply(this, arguments);
  35320. } finally {
  35321. currentPriorityLevel = previousPriorityLevel;
  35322. }
  35323. };
  35324. }
  35325. function timeoutForPriorityLevel(priorityLevel) {
  35326. switch (priorityLevel) {
  35327. case ImmediatePriority:
  35328. return IMMEDIATE_PRIORITY_TIMEOUT;
  35329. case UserBlockingPriority:
  35330. return USER_BLOCKING_PRIORITY;
  35331. case IdlePriority:
  35332. return IDLE_PRIORITY;
  35333. case LowPriority:
  35334. return LOW_PRIORITY_TIMEOUT;
  35335. case NormalPriority:
  35336. default:
  35337. return NORMAL_PRIORITY_TIMEOUT;
  35338. }
  35339. }
  35340. function unstable_scheduleCallback(priorityLevel, callback, options) {
  35341. var currentTime = exports.unstable_now();
  35342. var startTime;
  35343. var timeout;
  35344. if (typeof options === 'object' && options !== null) {
  35345. var delay = options.delay;
  35346. if (typeof delay === 'number' && delay > 0) {
  35347. startTime = currentTime + delay;
  35348. } else {
  35349. startTime = currentTime;
  35350. }
  35351. timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel);
  35352. } else {
  35353. timeout = timeoutForPriorityLevel(priorityLevel);
  35354. startTime = currentTime;
  35355. }
  35356. var expirationTime = startTime + timeout;
  35357. var newTask = {
  35358. id: taskIdCounter++,
  35359. callback: callback,
  35360. priorityLevel: priorityLevel,
  35361. startTime: startTime,
  35362. expirationTime: expirationTime,
  35363. sortIndex: -1
  35364. };
  35365. {
  35366. newTask.isQueued = false;
  35367. }
  35368. if (startTime > currentTime) {
  35369. // This is a delayed task.
  35370. newTask.sortIndex = startTime;
  35371. push(timerQueue, newTask);
  35372. if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
  35373. // All tasks are delayed, and this is the task with the earliest delay.
  35374. if (isHostTimeoutScheduled) {
  35375. // Cancel an existing timeout.
  35376. cancelHostTimeout();
  35377. } else {
  35378. isHostTimeoutScheduled = true;
  35379. } // Schedule a timeout.
  35380. requestHostTimeout(handleTimeout, startTime - currentTime);
  35381. }
  35382. } else {
  35383. newTask.sortIndex = expirationTime;
  35384. push(taskQueue, newTask);
  35385. {
  35386. markTaskStart(newTask, currentTime);
  35387. newTask.isQueued = true;
  35388. } // Schedule a host callback, if needed. If we're already performing work,
  35389. // wait until the next time we yield.
  35390. if (!isHostCallbackScheduled && !isPerformingWork) {
  35391. isHostCallbackScheduled = true;
  35392. requestHostCallback(flushWork);
  35393. }
  35394. }
  35395. return newTask;
  35396. }
  35397. function unstable_pauseExecution() {
  35398. }
  35399. function unstable_continueExecution() {
  35400. if (!isHostCallbackScheduled && !isPerformingWork) {
  35401. isHostCallbackScheduled = true;
  35402. requestHostCallback(flushWork);
  35403. }
  35404. }
  35405. function unstable_getFirstCallbackNode() {
  35406. return peek(taskQueue);
  35407. }
  35408. function unstable_cancelCallback(task) {
  35409. {
  35410. if (task.isQueued) {
  35411. var currentTime = exports.unstable_now();
  35412. markTaskCanceled(task, currentTime);
  35413. task.isQueued = false;
  35414. }
  35415. } // Null out the callback to indicate the task has been canceled. (Can't
  35416. // remove from the queue because you can't remove arbitrary nodes from an
  35417. // array based heap, only the first one.)
  35418. task.callback = null;
  35419. }
  35420. function unstable_getCurrentPriorityLevel() {
  35421. return currentPriorityLevel;
  35422. }
  35423. function unstable_shouldYield() {
  35424. var currentTime = exports.unstable_now();
  35425. advanceTimers(currentTime);
  35426. var firstTask = peek(taskQueue);
  35427. return firstTask !== currentTask && currentTask !== null && firstTask !== null && firstTask.callback !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost();
  35428. }
  35429. var unstable_requestPaint = requestPaint;
  35430. var unstable_Profiling = {
  35431. startLoggingProfilingEvents: startLoggingProfilingEvents,
  35432. stopLoggingProfilingEvents: stopLoggingProfilingEvents,
  35433. sharedProfilingBuffer: sharedProfilingBuffer
  35434. } ;
  35435. exports.unstable_IdlePriority = IdlePriority;
  35436. exports.unstable_ImmediatePriority = ImmediatePriority;
  35437. exports.unstable_LowPriority = LowPriority;
  35438. exports.unstable_NormalPriority = NormalPriority;
  35439. exports.unstable_Profiling = unstable_Profiling;
  35440. exports.unstable_UserBlockingPriority = UserBlockingPriority;
  35441. exports.unstable_cancelCallback = unstable_cancelCallback;
  35442. exports.unstable_continueExecution = unstable_continueExecution;
  35443. exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
  35444. exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
  35445. exports.unstable_next = unstable_next;
  35446. exports.unstable_pauseExecution = unstable_pauseExecution;
  35447. exports.unstable_requestPaint = unstable_requestPaint;
  35448. exports.unstable_runWithPriority = unstable_runWithPriority;
  35449. exports.unstable_scheduleCallback = unstable_scheduleCallback;
  35450. exports.unstable_shouldYield = unstable_shouldYield;
  35451. exports.unstable_wrapCallback = unstable_wrapCallback;
  35452. })();
  35453. }
  35454. /***/ }),
  35455. /***/ "../../node_modules/scheduler/index.js":
  35456. /*!***********************************************************************!*\
  35457. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/scheduler/index.js ***!
  35458. \***********************************************************************/
  35459. /*! no static exports found */
  35460. /***/ (function(module, exports, __webpack_require__) {
  35461. "use strict";
  35462. if (false) {} else {
  35463. module.exports = __webpack_require__(/*! ./cjs/scheduler.development.js */ "../../node_modules/scheduler/cjs/scheduler.development.js");
  35464. }
  35465. /***/ }),
  35466. /***/ "../../node_modules/scheduler/tracing.js":
  35467. /*!*************************************************************************!*\
  35468. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/scheduler/tracing.js ***!
  35469. \*************************************************************************/
  35470. /*! no static exports found */
  35471. /***/ (function(module, exports, __webpack_require__) {
  35472. "use strict";
  35473. if (false) {} else {
  35474. module.exports = __webpack_require__(/*! ./cjs/scheduler-tracing.development.js */ "../../node_modules/scheduler/cjs/scheduler-tracing.development.js");
  35475. }
  35476. /***/ }),
  35477. /***/ "../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
  35478. /*!**********************************************************************************************************!*\
  35479. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
  35480. \**********************************************************************************************************/
  35481. /*! no static exports found */
  35482. /***/ (function(module, exports, __webpack_require__) {
  35483. "use strict";
  35484. var isOldIE = function isOldIE() {
  35485. var memo;
  35486. return function memorize() {
  35487. if (typeof memo === 'undefined') {
  35488. // Test for IE <= 9 as proposed by Browserhacks
  35489. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  35490. // Tests for existence of standard globals is to allow style-loader
  35491. // to operate correctly into non-standard environments
  35492. // @see https://github.com/webpack-contrib/style-loader/issues/177
  35493. memo = Boolean(window && document && document.all && !window.atob);
  35494. }
  35495. return memo;
  35496. };
  35497. }();
  35498. var getTarget = function getTarget() {
  35499. var memo = {};
  35500. return function memorize(target) {
  35501. if (typeof memo[target] === 'undefined') {
  35502. var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
  35503. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  35504. try {
  35505. // This will throw an exception if access to iframe is blocked
  35506. // due to cross-origin restrictions
  35507. styleTarget = styleTarget.contentDocument.head;
  35508. } catch (e) {
  35509. // istanbul ignore next
  35510. styleTarget = null;
  35511. }
  35512. }
  35513. memo[target] = styleTarget;
  35514. }
  35515. return memo[target];
  35516. };
  35517. }();
  35518. var stylesInDom = [];
  35519. function getIndexByIdentifier(identifier) {
  35520. var result = -1;
  35521. for (var i = 0; i < stylesInDom.length; i++) {
  35522. if (stylesInDom[i].identifier === identifier) {
  35523. result = i;
  35524. break;
  35525. }
  35526. }
  35527. return result;
  35528. }
  35529. function modulesToDom(list, options) {
  35530. var idCountMap = {};
  35531. var identifiers = [];
  35532. for (var i = 0; i < list.length; i++) {
  35533. var item = list[i];
  35534. var id = options.base ? item[0] + options.base : item[0];
  35535. var count = idCountMap[id] || 0;
  35536. var identifier = "".concat(id, " ").concat(count);
  35537. idCountMap[id] = count + 1;
  35538. var index = getIndexByIdentifier(identifier);
  35539. var obj = {
  35540. css: item[1],
  35541. media: item[2],
  35542. sourceMap: item[3]
  35543. };
  35544. if (index !== -1) {
  35545. stylesInDom[index].references++;
  35546. stylesInDom[index].updater(obj);
  35547. } else {
  35548. stylesInDom.push({
  35549. identifier: identifier,
  35550. updater: addStyle(obj, options),
  35551. references: 1
  35552. });
  35553. }
  35554. identifiers.push(identifier);
  35555. }
  35556. return identifiers;
  35557. }
  35558. function insertStyleElement(options) {
  35559. var style = document.createElement('style');
  35560. var attributes = options.attributes || {};
  35561. if (typeof attributes.nonce === 'undefined') {
  35562. var nonce = true ? __webpack_require__.nc : undefined;
  35563. if (nonce) {
  35564. attributes.nonce = nonce;
  35565. }
  35566. }
  35567. Object.keys(attributes).forEach(function (key) {
  35568. style.setAttribute(key, attributes[key]);
  35569. });
  35570. if (typeof options.insert === 'function') {
  35571. options.insert(style);
  35572. } else {
  35573. var target = getTarget(options.insert || 'head');
  35574. if (!target) {
  35575. throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  35576. }
  35577. target.appendChild(style);
  35578. }
  35579. return style;
  35580. }
  35581. function removeStyleElement(style) {
  35582. // istanbul ignore if
  35583. if (style.parentNode === null) {
  35584. return false;
  35585. }
  35586. style.parentNode.removeChild(style);
  35587. }
  35588. /* istanbul ignore next */
  35589. var replaceText = function replaceText() {
  35590. var textStore = [];
  35591. return function replace(index, replacement) {
  35592. textStore[index] = replacement;
  35593. return textStore.filter(Boolean).join('\n');
  35594. };
  35595. }();
  35596. function applyToSingletonTag(style, index, remove, obj) {
  35597. var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE
  35598. /* istanbul ignore if */
  35599. if (style.styleSheet) {
  35600. style.styleSheet.cssText = replaceText(index, css);
  35601. } else {
  35602. var cssNode = document.createTextNode(css);
  35603. var childNodes = style.childNodes;
  35604. if (childNodes[index]) {
  35605. style.removeChild(childNodes[index]);
  35606. }
  35607. if (childNodes.length) {
  35608. style.insertBefore(cssNode, childNodes[index]);
  35609. } else {
  35610. style.appendChild(cssNode);
  35611. }
  35612. }
  35613. }
  35614. function applyToTag(style, options, obj) {
  35615. var css = obj.css;
  35616. var media = obj.media;
  35617. var sourceMap = obj.sourceMap;
  35618. if (media) {
  35619. style.setAttribute('media', media);
  35620. } else {
  35621. style.removeAttribute('media');
  35622. }
  35623. if (sourceMap && btoa) {
  35624. css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
  35625. } // For old IE
  35626. /* istanbul ignore if */
  35627. if (style.styleSheet) {
  35628. style.styleSheet.cssText = css;
  35629. } else {
  35630. while (style.firstChild) {
  35631. style.removeChild(style.firstChild);
  35632. }
  35633. style.appendChild(document.createTextNode(css));
  35634. }
  35635. }
  35636. var singleton = null;
  35637. var singletonCounter = 0;
  35638. function addStyle(obj, options) {
  35639. var style;
  35640. var update;
  35641. var remove;
  35642. if (options.singleton) {
  35643. var styleIndex = singletonCounter++;
  35644. style = singleton || (singleton = insertStyleElement(options));
  35645. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  35646. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  35647. } else {
  35648. style = insertStyleElement(options);
  35649. update = applyToTag.bind(null, style, options);
  35650. remove = function remove() {
  35651. removeStyleElement(style);
  35652. };
  35653. }
  35654. update(obj);
  35655. return function updateStyle(newObj) {
  35656. if (newObj) {
  35657. if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
  35658. return;
  35659. }
  35660. update(obj = newObj);
  35661. } else {
  35662. remove();
  35663. }
  35664. };
  35665. }
  35666. module.exports = function (list, options) {
  35667. options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  35668. // tags it will allow on a page
  35669. if (!options.singleton && typeof options.singleton !== 'boolean') {
  35670. options.singleton = isOldIE();
  35671. }
  35672. list = list || [];
  35673. var lastIdentifiers = modulesToDom(list, options);
  35674. return function update(newList) {
  35675. newList = newList || [];
  35676. if (Object.prototype.toString.call(newList) !== '[object Array]') {
  35677. return;
  35678. }
  35679. for (var i = 0; i < lastIdentifiers.length; i++) {
  35680. var identifier = lastIdentifiers[i];
  35681. var index = getIndexByIdentifier(identifier);
  35682. stylesInDom[index].references--;
  35683. }
  35684. var newLastIdentifiers = modulesToDom(newList, options);
  35685. for (var _i = 0; _i < lastIdentifiers.length; _i++) {
  35686. var _identifier = lastIdentifiers[_i];
  35687. var _index = getIndexByIdentifier(_identifier);
  35688. if (stylesInDom[_index].references === 0) {
  35689. stylesInDom[_index].updater();
  35690. stylesInDom.splice(_index, 1);
  35691. }
  35692. }
  35693. lastIdentifiers = newLastIdentifiers;
  35694. };
  35695. };
  35696. /***/ }),
  35697. /***/ "../../node_modules/tslib/tslib.es6.js":
  35698. /*!***********************************************************************!*\
  35699. !*** C:/Microsoft/Babylon/Babylon.js/node_modules/tslib/tslib.es6.js ***!
  35700. \***********************************************************************/
  35701. /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  35702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35703. "use strict";
  35704. __webpack_require__.r(__webpack_exports__);
  35705. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  35706. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  35707. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  35708. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  35709. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  35710. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  35711. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  35712. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  35713. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
  35714. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  35715. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  35716. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  35717. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  35718. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  35719. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  35720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  35721. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  35722. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  35723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  35724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  35725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  35726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  35727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  35728. /*! *****************************************************************************
  35729. Copyright (c) Microsoft Corporation.
  35730. Permission to use, copy, modify, and/or distribute this software for any
  35731. purpose with or without fee is hereby granted.
  35732. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  35733. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  35734. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  35735. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  35736. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  35737. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  35738. PERFORMANCE OF THIS SOFTWARE.
  35739. ***************************************************************************** */
  35740. /* global Reflect, Promise */
  35741. var extendStatics = function(d, b) {
  35742. extendStatics = Object.setPrototypeOf ||
  35743. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  35744. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  35745. return extendStatics(d, b);
  35746. };
  35747. function __extends(d, b) {
  35748. extendStatics(d, b);
  35749. function __() { this.constructor = d; }
  35750. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  35751. }
  35752. var __assign = function() {
  35753. __assign = Object.assign || function __assign(t) {
  35754. for (var s, i = 1, n = arguments.length; i < n; i++) {
  35755. s = arguments[i];
  35756. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  35757. }
  35758. return t;
  35759. }
  35760. return __assign.apply(this, arguments);
  35761. }
  35762. function __rest(s, e) {
  35763. var t = {};
  35764. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  35765. t[p] = s[p];
  35766. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  35767. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  35768. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  35769. t[p[i]] = s[p[i]];
  35770. }
  35771. return t;
  35772. }
  35773. function __decorate(decorators, target, key, desc) {
  35774. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  35775. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  35776. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  35777. return c > 3 && r && Object.defineProperty(target, key, r), r;
  35778. }
  35779. function __param(paramIndex, decorator) {
  35780. return function (target, key) { decorator(target, key, paramIndex); }
  35781. }
  35782. function __metadata(metadataKey, metadataValue) {
  35783. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  35784. }
  35785. function __awaiter(thisArg, _arguments, P, generator) {
  35786. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  35787. return new (P || (P = Promise))(function (resolve, reject) {
  35788. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  35789. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  35790. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  35791. step((generator = generator.apply(thisArg, _arguments || [])).next());
  35792. });
  35793. }
  35794. function __generator(thisArg, body) {
  35795. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  35796. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  35797. function verb(n) { return function (v) { return step([n, v]); }; }
  35798. function step(op) {
  35799. if (f) throw new TypeError("Generator is already executing.");
  35800. while (_) try {
  35801. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  35802. if (y = 0, t) op = [op[0] & 2, t.value];
  35803. switch (op[0]) {
  35804. case 0: case 1: t = op; break;
  35805. case 4: _.label++; return { value: op[1], done: false };
  35806. case 5: _.label++; y = op[1]; op = [0]; continue;
  35807. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  35808. default:
  35809. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  35810. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  35811. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  35812. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  35813. if (t[2]) _.ops.pop();
  35814. _.trys.pop(); continue;
  35815. }
  35816. op = body.call(thisArg, _);
  35817. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  35818. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  35819. }
  35820. }
  35821. var __createBinding = Object.create ? (function(o, m, k, k2) {
  35822. if (k2 === undefined) k2 = k;
  35823. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  35824. }) : (function(o, m, k, k2) {
  35825. if (k2 === undefined) k2 = k;
  35826. o[k2] = m[k];
  35827. });
  35828. function __exportStar(m, exports) {
  35829. for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
  35830. }
  35831. function __values(o) {
  35832. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  35833. if (m) return m.call(o);
  35834. if (o && typeof o.length === "number") return {
  35835. next: function () {
  35836. if (o && i >= o.length) o = void 0;
  35837. return { value: o && o[i++], done: !o };
  35838. }
  35839. };
  35840. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  35841. }
  35842. function __read(o, n) {
  35843. var m = typeof Symbol === "function" && o[Symbol.iterator];
  35844. if (!m) return o;
  35845. var i = m.call(o), r, ar = [], e;
  35846. try {
  35847. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  35848. }
  35849. catch (error) { e = { error: error }; }
  35850. finally {
  35851. try {
  35852. if (r && !r.done && (m = i["return"])) m.call(i);
  35853. }
  35854. finally { if (e) throw e.error; }
  35855. }
  35856. return ar;
  35857. }
  35858. function __spread() {
  35859. for (var ar = [], i = 0; i < arguments.length; i++)
  35860. ar = ar.concat(__read(arguments[i]));
  35861. return ar;
  35862. }
  35863. function __spreadArrays() {
  35864. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  35865. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  35866. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  35867. r[k] = a[j];
  35868. return r;
  35869. };
  35870. function __await(v) {
  35871. return this instanceof __await ? (this.v = v, this) : new __await(v);
  35872. }
  35873. function __asyncGenerator(thisArg, _arguments, generator) {
  35874. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  35875. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  35876. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  35877. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  35878. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  35879. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  35880. function fulfill(value) { resume("next", value); }
  35881. function reject(value) { resume("throw", value); }
  35882. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  35883. }
  35884. function __asyncDelegator(o) {
  35885. var i, p;
  35886. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  35887. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  35888. }
  35889. function __asyncValues(o) {
  35890. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  35891. var m = o[Symbol.asyncIterator], i;
  35892. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
  35893. function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
  35894. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  35895. }
  35896. function __makeTemplateObject(cooked, raw) {
  35897. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  35898. return cooked;
  35899. };
  35900. var __setModuleDefault = Object.create ? (function(o, v) {
  35901. Object.defineProperty(o, "default", { enumerable: true, value: v });
  35902. }) : function(o, v) {
  35903. o["default"] = v;
  35904. };
  35905. function __importStar(mod) {
  35906. if (mod && mod.__esModule) return mod;
  35907. var result = {};
  35908. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  35909. __setModuleDefault(result, mod);
  35910. return result;
  35911. }
  35912. function __importDefault(mod) {
  35913. return (mod && mod.__esModule) ? mod : { default: mod };
  35914. }
  35915. function __classPrivateFieldGet(receiver, privateMap) {
  35916. if (!privateMap.has(receiver)) {
  35917. throw new TypeError("attempted to get private field on non-instance");
  35918. }
  35919. return privateMap.get(receiver);
  35920. }
  35921. function __classPrivateFieldSet(receiver, privateMap, value) {
  35922. if (!privateMap.has(receiver)) {
  35923. throw new TypeError("attempted to set private field on non-instance");
  35924. }
  35925. privateMap.set(receiver, value);
  35926. return value;
  35927. }
  35928. /***/ }),
  35929. /***/ "../../node_modules/webpack/buildin/global.js":
  35930. /*!***********************************!*\
  35931. !*** (webpack)/buildin/global.js ***!
  35932. \***********************************/
  35933. /*! no static exports found */
  35934. /***/ (function(module, exports) {
  35935. var g;
  35936. // This works in non-strict mode
  35937. g = (function() {
  35938. return this;
  35939. })();
  35940. try {
  35941. // This works if eval is allowed (see CSP)
  35942. g = g || new Function("return this")();
  35943. } catch (e) {
  35944. // This works if the window reference is available
  35945. if (typeof window === "object") g = window;
  35946. }
  35947. // g can still be undefined, but nothing to do about it...
  35948. // We return undefined, instead of nothing here, so it's
  35949. // easier to handle this case. if(!global) { ...}
  35950. module.exports = g;
  35951. /***/ }),
  35952. /***/ "../../node_modules/webpack/buildin/module.js":
  35953. /*!***********************************!*\
  35954. !*** (webpack)/buildin/module.js ***!
  35955. \***********************************/
  35956. /*! no static exports found */
  35957. /***/ (function(module, exports) {
  35958. module.exports = function(module) {
  35959. if (!module.webpackPolyfill) {
  35960. module.deprecate = function() {};
  35961. module.paths = [];
  35962. // module.parent = undefined by default
  35963. if (!module.children) module.children = [];
  35964. Object.defineProperty(module, "loaded", {
  35965. enumerable: true,
  35966. get: function() {
  35967. return module.l;
  35968. }
  35969. });
  35970. Object.defineProperty(module, "id", {
  35971. enumerable: true,
  35972. get: function() {
  35973. return module.i;
  35974. }
  35975. });
  35976. module.webpackPolyfill = 1;
  35977. }
  35978. return module;
  35979. };
  35980. /***/ }),
  35981. /***/ "../imgs/downArrow.svg":
  35982. /*!*****************************!*\
  35983. !*** ../imgs/downArrow.svg ***!
  35984. \*****************************/
  35985. /*! no static exports found */
  35986. /***/ (function(module, exports) {
  35987. module.exports = "data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' width='17' height='17'%3E %3Cpath d='M4.21967 8.46967C4.51256 8.17678 4.98744 8.17678 5.28033 8.46967L12 15.1893L18.7197 8.46967C19.0126 8.17678 19.4874 8.17678 19.7803 8.46967C20.0732 8.76256 20.0732 9.23744 19.7803 9.53033L12.5303 16.7803C12.2374 17.0732 11.7626 17.0732 11.4697 16.7803L4.21967 9.53033C3.92678 9.23744 3.92678 8.76256 4.21967 8.46967Z' fill='white' /%3E %3C/svg%3E"
  35988. /***/ }),
  35989. /***/ "./blockTools.ts":
  35990. /*!***********************!*\
  35991. !*** ./blockTools.ts ***!
  35992. \***********************/
  35993. /*! exports provided: BlockTools */
  35994. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35995. "use strict";
  35996. __webpack_require__.r(__webpack_exports__);
  35997. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BlockTools", function() { return BlockTools; });
  35998. /* harmony import */ var babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs-gui/2D/controls/button */ "babylonjs-gui/2D/controls/button");
  35999. /* harmony import */ var babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__);
  36000. var BlockTools = /** @class */ (function () {
  36001. function BlockTools() {
  36002. }
  36003. BlockTools.GetGuiFromString = function (data) {
  36004. //TODO: Add more elements and create default values for certain types.
  36005. var element;
  36006. switch (data) {
  36007. case "Slider":
  36008. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["Slider"]("Slider");
  36009. break;
  36010. case "Checkbox":
  36011. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["Checkbox"]("Checkbox");
  36012. break;
  36013. case "ColorPicker":
  36014. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["ColorPicker"]("ColorPicker");
  36015. break;
  36016. case "Ellipse":
  36017. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["Ellipse"]("Ellipse");
  36018. break;
  36019. case "Rectangle":
  36020. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["Rectangle"]("Rectangle");
  36021. break;
  36022. case "Line":
  36023. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["Line"]();
  36024. element.x1 = 10;
  36025. element.y1 = 10;
  36026. element.x2 = 100;
  36027. element.y2 = 100;
  36028. element.lineWidth = 5;
  36029. element.dash = [50, 10];
  36030. return element;
  36031. case "Text":
  36032. element = new babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["TextBlock"]("Textblock");
  36033. element.text = "My Text";
  36034. return element;
  36035. default:
  36036. element = babylonjs_gui_2D_controls_button__WEBPACK_IMPORTED_MODULE_0__["Button"].CreateSimpleButton("Button", "Click Me");
  36037. break;
  36038. }
  36039. element.width = "150px";
  36040. element.height = "40px";
  36041. element.color = "#FFFFFFFF";
  36042. element.isPointerBlocker = true;
  36043. return element;
  36044. };
  36045. return BlockTools;
  36046. }());
  36047. /***/ }),
  36048. /***/ "./components/log/log.scss":
  36049. /*!*********************************!*\
  36050. !*** ./components/log/log.scss ***!
  36051. \*********************************/
  36052. /*! no static exports found */
  36053. /***/ (function(module, exports, __webpack_require__) {
  36054. var api = __webpack_require__(/*! ../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
  36055. var content = __webpack_require__(/*! !../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./log.scss */ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./components/log/log.scss");
  36056. content = content.__esModule ? content.default : content;
  36057. if (typeof content === 'string') {
  36058. content = [[module.i, content, '']];
  36059. }
  36060. var options = {};
  36061. options.insert = "head";
  36062. options.singleton = false;
  36063. var update = api(content, options);
  36064. module.exports = content.locals || {};
  36065. /***/ }),
  36066. /***/ "./components/log/logComponent.tsx":
  36067. /*!*****************************************!*\
  36068. !*** ./components/log/logComponent.tsx ***!
  36069. \*****************************************/
  36070. /*! exports provided: LogEntry, LogComponent */
  36071. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36072. "use strict";
  36073. __webpack_require__.r(__webpack_exports__);
  36074. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogEntry", function() { return LogEntry; });
  36075. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogComponent", function() { return LogComponent; });
  36076. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  36077. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36078. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36079. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "../../node_modules/react-dom/index.js");
  36080. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);
  36081. __webpack_require__(/*! ./log.scss */ "./components/log/log.scss");
  36082. var LogEntry = /** @class */ (function () {
  36083. function LogEntry(message, isError) {
  36084. this.message = message;
  36085. this.isError = isError;
  36086. }
  36087. return LogEntry;
  36088. }());
  36089. var LogComponent = /** @class */ (function (_super) {
  36090. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LogComponent, _super);
  36091. function LogComponent(props) {
  36092. var _this = _super.call(this, props) || this;
  36093. _this.state = { logs: [] };
  36094. return _this;
  36095. }
  36096. LogComponent.prototype.componentDidMount = function () {
  36097. var _this = this;
  36098. this.props.globalState.onLogRequiredObservable.add(function (log) {
  36099. var currentLogs = _this.state.logs;
  36100. currentLogs.push(log);
  36101. _this.setState({ logs: currentLogs });
  36102. });
  36103. };
  36104. LogComponent.prototype.componentDidUpdate = function () {
  36105. var logConsole = react_dom__WEBPACK_IMPORTED_MODULE_2__["findDOMNode"](this.refs["log-console"]);
  36106. if (!logConsole) {
  36107. return;
  36108. }
  36109. logConsole.scrollTop = logConsole.scrollHeight;
  36110. };
  36111. LogComponent.prototype.render = function () {
  36112. var today = new Date();
  36113. var h = today.getHours();
  36114. var m = today.getMinutes();
  36115. var s = today.getSeconds();
  36116. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "log-console", ref: "log-console" }, this.state.logs.map(function (l, i) {
  36117. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { key: i, className: "log" + (l.isError ? " error" : "") }, h + ":" + m + ":" + s + ": " + l.message));
  36118. })));
  36119. };
  36120. return LogComponent;
  36121. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36122. /***/ }),
  36123. /***/ "./components/nodeList/guiList.scss":
  36124. /*!******************************************!*\
  36125. !*** ./components/nodeList/guiList.scss ***!
  36126. \******************************************/
  36127. /*! no static exports found */
  36128. /***/ (function(module, exports, __webpack_require__) {
  36129. var api = __webpack_require__(/*! ../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
  36130. var content = __webpack_require__(/*! !../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./guiList.scss */ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./components/nodeList/guiList.scss");
  36131. content = content.__esModule ? content.default : content;
  36132. if (typeof content === 'string') {
  36133. content = [[module.i, content, '']];
  36134. }
  36135. var options = {};
  36136. options.insert = "head";
  36137. options.singleton = false;
  36138. var update = api(content, options);
  36139. module.exports = content.locals || {};
  36140. /***/ }),
  36141. /***/ "./components/nodeList/guiListComponent.tsx":
  36142. /*!**************************************************!*\
  36143. !*** ./components/nodeList/guiListComponent.tsx ***!
  36144. \**************************************************/
  36145. /*! exports provided: GuiListComponent */
  36146. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36147. "use strict";
  36148. __webpack_require__.r(__webpack_exports__);
  36149. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuiListComponent", function() { return GuiListComponent; });
  36150. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  36151. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36152. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36153. /* harmony import */ var _sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../sharedComponents/lineContainerComponent */ "./sharedComponents/lineContainerComponent.tsx");
  36154. /* harmony import */ var _sharedComponents_draggableLineComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../sharedComponents/draggableLineComponent */ "./sharedComponents/draggableLineComponent.tsx");
  36155. __webpack_require__(/*! ./guiList.scss */ "./components/nodeList/guiList.scss");
  36156. var GuiListComponent = /** @class */ (function (_super) {
  36157. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GuiListComponent, _super);
  36158. function GuiListComponent(props) {
  36159. var _this = _super.call(this, props) || this;
  36160. _this.state = { filter: "" };
  36161. _this._onResetRequiredObserver = _this.props.globalState.onResetRequiredObservable.add(function () {
  36162. _this.forceUpdate();
  36163. });
  36164. return _this;
  36165. }
  36166. GuiListComponent.prototype.componentWillUnmount = function () {
  36167. this.props.globalState.onResetRequiredObservable.remove(this._onResetRequiredObserver);
  36168. };
  36169. GuiListComponent.prototype.filterContent = function (filter) {
  36170. this.setState({ filter: filter });
  36171. };
  36172. GuiListComponent.prototype.render = function () {
  36173. var _this = this;
  36174. // Block types used to create the menu from
  36175. var allBlocks = {
  36176. Buttons: ["TextButton", "ImageButton"],
  36177. Controls: ["Slider", "Checkbox", "ColorPicker", "VisualKeyboard"],
  36178. Containers: ["DisplayGrid", "Grid", "StackPanel"],
  36179. Shapes: ["Ellipse", "Image", "Line", "Rectangle"],
  36180. Inputs: ["Text", "IntputText", "InputPassword"]
  36181. };
  36182. // Create node menu
  36183. var blockMenu = [];
  36184. for (var key in allBlocks) {
  36185. var blockList = allBlocks[key].filter(function (b) { return !_this.state.filter || b.toLowerCase().indexOf(_this.state.filter.toLowerCase()) !== -1; })
  36186. .sort(function (a, b) { return a.localeCompare(b); })
  36187. .map(function (block, i) {
  36188. return react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_draggableLineComponent__WEBPACK_IMPORTED_MODULE_3__["DraggableLineComponent"], { key: block, data: block, tooltip: GuiListComponent._Tooltips[block] || "" });
  36189. });
  36190. if (blockList.length) {
  36191. blockMenu.push(react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__["LineContainerComponent"], { key: key + " blocks", title: key.replace("__", ": ").replace("_", " "), closed: false }, blockList));
  36192. }
  36193. }
  36194. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "guiList" },
  36195. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "panes" },
  36196. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "pane" },
  36197. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "filter" },
  36198. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { type: "text", placeholder: "Filter", onFocus: function () { return _this.props.globalState.blockKeyboardEvents = true; }, onBlur: function (evt) {
  36199. _this.props.globalState.blockKeyboardEvents = false;
  36200. }, onChange: function (evt) { return _this.filterContent(evt.target.value); } })),
  36201. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "list-container" }, blockMenu)))));
  36202. };
  36203. GuiListComponent._Tooltips = {
  36204. "Button": "A simple button",
  36205. };
  36206. return GuiListComponent;
  36207. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36208. /***/ }),
  36209. /***/ "./components/propertyTab/propertyTab.scss":
  36210. /*!*************************************************!*\
  36211. !*** ./components/propertyTab/propertyTab.scss ***!
  36212. \*************************************************/
  36213. /*! no static exports found */
  36214. /***/ (function(module, exports, __webpack_require__) {
  36215. var api = __webpack_require__(/*! ../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
  36216. var content = __webpack_require__(/*! !../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./propertyTab.scss */ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./components/propertyTab/propertyTab.scss");
  36217. content = content.__esModule ? content.default : content;
  36218. if (typeof content === 'string') {
  36219. content = [[module.i, content, '']];
  36220. }
  36221. var options = {};
  36222. options.insert = "head";
  36223. options.singleton = false;
  36224. var update = api(content, options);
  36225. module.exports = content.locals || {};
  36226. /***/ }),
  36227. /***/ "./components/propertyTab/propertyTabComponent.tsx":
  36228. /*!*********************************************************!*\
  36229. !*** ./components/propertyTab/propertyTabComponent.tsx ***!
  36230. \*********************************************************/
  36231. /*! exports provided: PropertyTabComponent */
  36232. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36233. "use strict";
  36234. __webpack_require__.r(__webpack_exports__);
  36235. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropertyTabComponent", function() { return PropertyTabComponent; });
  36236. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  36237. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36238. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36239. /* harmony import */ var _sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../sharedComponents/buttonLineComponent */ "./sharedComponents/buttonLineComponent.tsx");
  36240. /* harmony import */ var _sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../sharedComponents/lineContainerComponent */ "./sharedComponents/lineContainerComponent.tsx");
  36241. /* harmony import */ var _sharedComponents_fileButtonLineComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../sharedComponents/fileButtonLineComponent */ "./sharedComponents/fileButtonLineComponent.tsx");
  36242. /* harmony import */ var babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! babylonjs/Misc/tools */ "babylonjs/Misc/observable");
  36243. /* harmony import */ var babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__);
  36244. /* harmony import */ var _serializationTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../serializationTools */ "./serializationTools.ts");
  36245. /* harmony import */ var _sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../sharedComponents/checkBoxLineComponent */ "./sharedComponents/checkBoxLineComponent.tsx");
  36246. /* harmony import */ var _diagram_guiNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../diagram/guiNode */ "./diagram/guiNode.ts");
  36247. /* harmony import */ var _sharedComponents_sliderLineComponent__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../sharedComponents/sliderLineComponent */ "./sharedComponents/sliderLineComponent.tsx");
  36248. /* harmony import */ var _sharedComponents_textLineComponent__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../sharedComponents/textLineComponent */ "./sharedComponents/textLineComponent.tsx");
  36249. __webpack_require__(/*! ./propertyTab.scss */ "./components/propertyTab/propertyTab.scss");
  36250. var PropertyTabComponent = /** @class */ (function (_super) {
  36251. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PropertyTabComponent, _super);
  36252. function PropertyTabComponent(props) {
  36253. var _this = _super.call(this, props) || this;
  36254. _this.state = { currentNode: null };
  36255. return _this;
  36256. }
  36257. PropertyTabComponent.prototype.componentDidMount = function () {
  36258. var _this = this;
  36259. this.props.globalState.onSelectionChangedObservable.add(function (selection) {
  36260. if (selection instanceof _diagram_guiNode__WEBPACK_IMPORTED_MODULE_8__["GUINode"]) {
  36261. _this.setState({ currentNode: selection });
  36262. }
  36263. else {
  36264. _this.setState({ currentNode: null });
  36265. }
  36266. });
  36267. this._onBuiltObserver = this.props.globalState.onBuiltObservable.add(function () {
  36268. _this.forceUpdate();
  36269. });
  36270. };
  36271. PropertyTabComponent.prototype.componentWillUnmount = function () {
  36272. this.props.globalState.onBuiltObservable.remove(this._onBuiltObserver);
  36273. };
  36274. PropertyTabComponent.prototype.processInputBlockUpdate = function (ib) {
  36275. this.props.globalState.onUpdateRequiredObservable.notifyObservers();
  36276. if (ib.isConstant) {
  36277. this.props.globalState.onRebuildRequiredObservable.notifyObservers();
  36278. }
  36279. };
  36280. PropertyTabComponent.prototype.load = function (file) {
  36281. var _this = this;
  36282. babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["Tools"].ReadFile(file, function (data) {
  36283. var decoder = new TextDecoder("utf-8");
  36284. _serializationTools__WEBPACK_IMPORTED_MODULE_6__["SerializationTools"].Deserialize(JSON.parse(decoder.decode(data)), _this.props.globalState);
  36285. _this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  36286. }, undefined, true);
  36287. };
  36288. PropertyTabComponent.prototype.loadFrame = function (file) {
  36289. babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["Tools"].ReadFile(file, function (data) {
  36290. // get Frame Data from file
  36291. //let decoder = new TextDecoder("utf-8");
  36292. // const frameData = JSON.parse(decoder.decode(data));
  36293. // SerializationTools.AddFrameToMaterial(frameData, this.props.globalState, this.props.globalState.nodeMaterial);
  36294. }, undefined, true);
  36295. };
  36296. PropertyTabComponent.prototype.save = function () {
  36297. //let json = SerializationTools.Serialize(this.props.globalState.nodeMaterial, this.props.globalState);
  36298. //StringTools.DownloadAsFile(this.props.globalState.hostDocument, json, "nodeMaterial.json");
  36299. };
  36300. PropertyTabComponent.prototype.customSave = function () {
  36301. /*this.props.globalState.onLogRequiredObservable.notifyObservers({message: "Saving your material to Babylon.js snippet server...", isError: false});
  36302. this.props.globalState.customSave!.action(SerializationTools.Serialize(this.props.globalState.nodeMaterial, this.props.globalState)).then(() => {
  36303. this.props.globalState.onLogRequiredObservable.notifyObservers({message: "Material saved successfully", isError: false});
  36304. }).catch((err) => {
  36305. this.props.globalState.onLogRequiredObservable.notifyObservers({message: err, isError: true});
  36306. });*/
  36307. };
  36308. PropertyTabComponent.prototype.saveToSnippetServer = function () {
  36309. /*const material = this.props.globalState.nodeMaterial;
  36310. const xmlHttp = new XMLHttpRequest();
  36311. let json = SerializationTools.Serialize(material, this.props.globalState);
  36312. xmlHttp.onreadystatechange = () => {
  36313. if (xmlHttp.readyState == 4) {
  36314. if (xmlHttp.status == 200) {
  36315. var snippet = JSON.parse(xmlHttp.responseText);
  36316. const oldId = material.snippetId;
  36317. material.snippetId = snippet.id;
  36318. if (snippet.version && snippet.version != "0") {
  36319. material.snippetId += "#" + snippet.version;
  36320. }
  36321. this.forceUpdate();
  36322. if (navigator.clipboard) {
  36323. navigator.clipboard.writeText(material.snippetId);
  36324. }
  36325. let windowAsAny = window as any;
  36326. if (windowAsAny.Playground && oldId) {
  36327. windowAsAny.Playground.onRequestCodeChangeObservable.notifyObservers({
  36328. regex: new RegExp(oldId, "g"),
  36329. replace: material.snippetId
  36330. });
  36331. }
  36332. this.props.globalState.hostDocument.defaultView!.alert("NodeMaterial saved with ID: " + material.snippetId + " (please note that the id was also saved to your clipboard)");
  36333. }
  36334. else {
  36335. this.props.globalState.hostDocument.defaultView!.alert(`Unable to save your node material. It may be too large (${(dataToSend.payload.length / 1024).toFixed(2)} KB) because of embedded textures. Please reduce texture sizes or point to a specific url instead of embedding them and try again.`);
  36336. }
  36337. }
  36338. };
  36339. xmlHttp.open("POST", NodeMaterial.SnippetUrl + (material.snippetId ? "/" + material.snippetId : ""), true);
  36340. xmlHttp.setRequestHeader("Content-Type", "application/json");
  36341. var dataToSend = {
  36342. payload : JSON.stringify({
  36343. nodeMaterial: json
  36344. }),
  36345. name: "",
  36346. description: "",
  36347. tags: ""
  36348. };
  36349. xmlHttp.send(JSON.stringify(dataToSend));*/
  36350. };
  36351. PropertyTabComponent.prototype.loadFromSnippet = function () {
  36352. /*const material = this.props.globalState.nodeMaterial;
  36353. const scene = material.getScene();
  36354. let snippedID = window.prompt("Please enter the snippet ID to use");
  36355. if (!snippedID) {
  36356. return;
  36357. }
  36358. this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  36359. NodeMaterial.ParseFromSnippetAsync(snippedID, scene, "", material).then(() => {
  36360. material.build();
  36361. if (!this.changeMode(this.props.globalState.nodeMaterial!.mode, true, false)) {
  36362. this.props.globalState.onResetRequiredObservable.notifyObservers();
  36363. }
  36364. }).catch((err) => {
  36365. this.props.globalState.hostDocument.defaultView!.alert("Unable to load your node material: " + err);
  36366. });*/
  36367. };
  36368. PropertyTabComponent.prototype.render = function () {
  36369. var _this = this;
  36370. var _a;
  36371. if (this.state.currentNode) {
  36372. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "propertyTab" },
  36373. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "header" },
  36374. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("img", { id: "logo", src: "https://www.babylonjs.com/Assets/logo-babylonjs-social-twitter.png" }),
  36375. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "title" }, "GUI EDITOR")), (_a = this.state.currentNode) === null || _a === void 0 ? void 0 :
  36376. _a.renderProperties()));
  36377. }
  36378. var gridSize = babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].ReadNumber("GridSize", 20);
  36379. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "propertyTab" },
  36380. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "header" },
  36381. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("img", { id: "logo", src: "https://www.babylonjs.com/Assets/logo-babylonjs-social-twitter.png" }),
  36382. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "title" }, "GUI EDITOR")),
  36383. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", null,
  36384. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "GENERAL" },
  36385. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_textLineComponent__WEBPACK_IMPORTED_MODULE_10__["TextLineComponent"], { label: "Version", value: babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["Engine"].Version }),
  36386. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_textLineComponent__WEBPACK_IMPORTED_MODULE_10__["TextLineComponent"], { label: "Help", value: "doc.babylonjs.com", underline: true, onLink: function () { return window.open('https://doc.babylonjs.com/how_to/node_material', '_blank'); } }),
  36387. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: "Reset to default", onClick: function () {
  36388. _this.props.globalState.onResetRequiredObservable.notifyObservers();
  36389. } })),
  36390. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "UI" },
  36391. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: "Zoom to fit", onClick: function () {
  36392. _this.props.globalState.onZoomToFitRequiredObservable.notifyObservers();
  36393. } }),
  36394. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: "Reorganize", onClick: function () {
  36395. _this.props.globalState.onReOrganizedRequiredObservable.notifyObservers();
  36396. } })),
  36397. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "OPTIONS" },
  36398. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_7__["CheckBoxLineComponent"], { label: "Embed textures when saving", isSelected: function () { return babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].ReadBoolean("EmbedTextures", true); }, onSelect: function (value) {
  36399. babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].WriteBoolean("EmbedTextures", value);
  36400. } }),
  36401. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_sliderLineComponent__WEBPACK_IMPORTED_MODULE_9__["SliderLineComponent"], { label: "Grid size", minimum: 0, maximum: 100, step: 5, decimalCount: 0, globalState: this.props.globalState, directValue: gridSize, onChange: function (value) {
  36402. babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].WriteNumber("GridSize", value);
  36403. _this.props.globalState.onGridSizeChanged.notifyObservers();
  36404. _this.forceUpdate();
  36405. } }),
  36406. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_7__["CheckBoxLineComponent"], { label: "Show grid", isSelected: function () { return babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].ReadBoolean("ShowGrid", true); }, onSelect: function (value) {
  36407. babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].WriteBoolean("ShowGrid", value);
  36408. _this.props.globalState.onGridSizeChanged.notifyObservers();
  36409. } })),
  36410. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "FILE" },
  36411. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_fileButtonLineComponent__WEBPACK_IMPORTED_MODULE_4__["FileButtonLineComponent"], { label: "Load", onClick: function (file) { return _this.load(file); }, accept: ".json" }),
  36412. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: "Save", onClick: function () {
  36413. _this.save();
  36414. } }),
  36415. this.props.globalState.customSave &&
  36416. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: this.props.globalState.customSave.label, onClick: function () {
  36417. _this.customSave();
  36418. } }),
  36419. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_fileButtonLineComponent__WEBPACK_IMPORTED_MODULE_4__["FileButtonLineComponent"], { label: "Load Frame", uploadName: 'frame-upload', onClick: function (file) { return _this.loadFrame(file); }, accept: ".json" })),
  36420. !this.props.globalState.customSave &&
  36421. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "SNIPPET" },
  36422. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: "Load from snippet server", onClick: function () { return _this.loadFromSnippet(); } }),
  36423. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: "Save to snippet server", onClick: function () {
  36424. _this.saveToSnippetServer();
  36425. } })))));
  36426. };
  36427. return PropertyTabComponent;
  36428. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36429. /***/ }),
  36430. /***/ "./diagram/graphCanvas.scss":
  36431. /*!**********************************!*\
  36432. !*** ./diagram/graphCanvas.scss ***!
  36433. \**********************************/
  36434. /*! no static exports found */
  36435. /***/ (function(module, exports, __webpack_require__) {
  36436. var api = __webpack_require__(/*! ../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
  36437. var content = __webpack_require__(/*! !../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./graphCanvas.scss */ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./diagram/graphCanvas.scss");
  36438. content = content.__esModule ? content.default : content;
  36439. if (typeof content === 'string') {
  36440. content = [[module.i, content, '']];
  36441. }
  36442. var options = {};
  36443. options.insert = "head";
  36444. options.singleton = false;
  36445. var update = api(content, options);
  36446. module.exports = content.locals || {};
  36447. /***/ }),
  36448. /***/ "./diagram/guiNode.ts":
  36449. /*!****************************!*\
  36450. !*** ./diagram/guiNode.ts ***!
  36451. \****************************/
  36452. /*! exports provided: GUINode */
  36453. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36454. "use strict";
  36455. __webpack_require__.r(__webpack_exports__);
  36456. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GUINode", function() { return GUINode; });
  36457. /* harmony import */ var _propertyLedger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./propertyLedger */ "./diagram/propertyLedger.ts");
  36458. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36459. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36460. /* harmony import */ var _properties_genericNodePropertyComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./properties/genericNodePropertyComponent */ "./diagram/properties/genericNodePropertyComponent.tsx");
  36461. var GUINode = /** @class */ (function () {
  36462. function GUINode(globalState, guiNode) {
  36463. var _this = this;
  36464. this.guiNode = guiNode;
  36465. this._x = 0;
  36466. this._y = 0;
  36467. this._gridAlignedX = 0;
  36468. this._gridAlignedY = 0;
  36469. this._isVisible = true;
  36470. this._enclosingFrameId = -1;
  36471. this._globalState = globalState;
  36472. this._ownerCanvas = this._globalState.workbench;
  36473. guiNode.onPointerUpObservable.add(function (evt) {
  36474. _this.clicked = false;
  36475. console.log("up");
  36476. });
  36477. guiNode.onPointerDownObservable.add(function (evt) {
  36478. _this.clicked = true;
  36479. _this.isSelected = true;
  36480. console.log("down");
  36481. });
  36482. guiNode.onPointerEnterObservable.add(function (evt) {
  36483. _this._ownerCanvas.isOverGUINode = true;
  36484. console.log("in");
  36485. });
  36486. guiNode.onPointerOutObservable.add(function (evt) {
  36487. _this._ownerCanvas.isOverGUINode = false;
  36488. console.log("out");
  36489. });
  36490. //TODO: Implement
  36491. this._onSelectionBoxMovedObserver = this._globalState.onSelectionBoxMoved.add(function (rect1) {
  36492. });
  36493. }
  36494. Object.defineProperty(GUINode.prototype, "isVisible", {
  36495. get: function () {
  36496. return this._isVisible;
  36497. },
  36498. set: function (value) {
  36499. this._isVisible = value;
  36500. },
  36501. enumerable: false,
  36502. configurable: true
  36503. });
  36504. Object.defineProperty(GUINode.prototype, "gridAlignedX", {
  36505. get: function () {
  36506. return this._gridAlignedX;
  36507. },
  36508. enumerable: false,
  36509. configurable: true
  36510. });
  36511. Object.defineProperty(GUINode.prototype, "gridAlignedY", {
  36512. get: function () {
  36513. return this._gridAlignedY;
  36514. },
  36515. enumerable: false,
  36516. configurable: true
  36517. });
  36518. Object.defineProperty(GUINode.prototype, "x", {
  36519. get: function () {
  36520. return this._x;
  36521. },
  36522. set: function (value) {
  36523. if (this._x === value) {
  36524. return;
  36525. }
  36526. this._x = value;
  36527. this._gridAlignedX = this._ownerCanvas.getGridPosition(value);
  36528. },
  36529. enumerable: false,
  36530. configurable: true
  36531. });
  36532. Object.defineProperty(GUINode.prototype, "y", {
  36533. get: function () {
  36534. return this._y;
  36535. },
  36536. set: function (value) {
  36537. if (this._y === value) {
  36538. return;
  36539. }
  36540. this._y = value;
  36541. this._gridAlignedY = this._ownerCanvas.getGridPosition(value);
  36542. },
  36543. enumerable: false,
  36544. configurable: true
  36545. });
  36546. Object.defineProperty(GUINode.prototype, "width", {
  36547. get: function () {
  36548. return this.guiNode.widthInPixels;
  36549. },
  36550. enumerable: false,
  36551. configurable: true
  36552. });
  36553. Object.defineProperty(GUINode.prototype, "height", {
  36554. get: function () {
  36555. return this.guiNode.heightInPixels;
  36556. },
  36557. enumerable: false,
  36558. configurable: true
  36559. });
  36560. Object.defineProperty(GUINode.prototype, "id", {
  36561. get: function () {
  36562. return this.guiNode.uniqueId;
  36563. },
  36564. enumerable: false,
  36565. configurable: true
  36566. });
  36567. Object.defineProperty(GUINode.prototype, "name", {
  36568. get: function () {
  36569. return this.guiNode.name;
  36570. },
  36571. enumerable: false,
  36572. configurable: true
  36573. });
  36574. Object.defineProperty(GUINode.prototype, "isSelected", {
  36575. get: function () {
  36576. return this._isSelected;
  36577. },
  36578. set: function (value) {
  36579. this._isSelected = value;
  36580. if (value) {
  36581. this._globalState.onSelectionChangedObservable.notifyObservers(this);
  36582. }
  36583. },
  36584. enumerable: false,
  36585. configurable: true
  36586. });
  36587. Object.defineProperty(GUINode.prototype, "enclosingFrameId", {
  36588. get: function () {
  36589. return this._enclosingFrameId;
  36590. },
  36591. set: function (value) {
  36592. this._enclosingFrameId = value;
  36593. },
  36594. enumerable: false,
  36595. configurable: true
  36596. });
  36597. GUINode.prototype.cleanAccumulation = function (useCeil) {
  36598. if (useCeil === void 0) { useCeil = false; }
  36599. this.x = this._ownerCanvas.getGridPosition(this.x, useCeil);
  36600. this.y = this._ownerCanvas.getGridPosition(this.y, useCeil);
  36601. };
  36602. GUINode.prototype._onMove = function (evt, startPos) {
  36603. if (!this.clicked)
  36604. return false;
  36605. console.log("moving");
  36606. //TODO: Implement move with zoom factor.
  36607. var newX = (evt.x - startPos.x); // / this._ownerCanvas.zoom;
  36608. var newY = (evt.y - startPos.y); // / this._ownerCanvas.zoom;
  36609. this.x += newX;
  36610. this.y += newY;
  36611. return true;
  36612. //evt.stopPropagation();
  36613. };
  36614. GUINode.prototype.renderProperties = function () {
  36615. var className = this.guiNode.getClassName();
  36616. var control = _propertyLedger__WEBPACK_IMPORTED_MODULE_0__["PropertyGuiLedger"].RegisteredControls[className];
  36617. if (!control) {
  36618. control = _properties_genericNodePropertyComponent__WEBPACK_IMPORTED_MODULE_2__["GenericPropertyComponent"];
  36619. }
  36620. return react__WEBPACK_IMPORTED_MODULE_1__["createElement"](control, {
  36621. globalState: this._globalState,
  36622. guiBlock: this.guiNode
  36623. });
  36624. };
  36625. GUINode.prototype.updateVisual = function () {
  36626. this.guiNode.leftInPixels = this.x;
  36627. this.guiNode.topInPixels = this.y;
  36628. };
  36629. GUINode.prototype.appendVisual = function (root, owner) {
  36630. this._ownerCanvas = owner;
  36631. };
  36632. GUINode.prototype.dispose = function () {
  36633. // notify frame observers that this node is being deleted
  36634. this._globalState.onGraphNodeRemovalObservable.notifyObservers(this);
  36635. if (this._onSelectionChangedObserver) {
  36636. this._globalState.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);
  36637. }
  36638. if (this._onUpdateRequiredObserver) {
  36639. this._globalState.onUpdateRequiredObservable.remove(this._onUpdateRequiredObserver);
  36640. }
  36641. if (this._onSelectionBoxMovedObserver) {
  36642. this._globalState.onSelectionBoxMoved.remove(this._onSelectionBoxMovedObserver);
  36643. }
  36644. this.guiNode.dispose();
  36645. };
  36646. return GUINode;
  36647. }());
  36648. /***/ }),
  36649. /***/ "./diagram/properties/genericNodePropertyComponent.tsx":
  36650. /*!*************************************************************!*\
  36651. !*** ./diagram/properties/genericNodePropertyComponent.tsx ***!
  36652. \*************************************************************/
  36653. /*! exports provided: GenericPropertyComponent, GeneralPropertyTabComponent, GenericPropertyTabComponent */
  36654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36655. "use strict";
  36656. __webpack_require__.r(__webpack_exports__);
  36657. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericPropertyComponent", function() { return GenericPropertyComponent; });
  36658. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GeneralPropertyTabComponent", function() { return GeneralPropertyTabComponent; });
  36659. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericPropertyTabComponent", function() { return GenericPropertyTabComponent; });
  36660. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  36661. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36662. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36663. /* harmony import */ var _sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../sharedComponents/lineContainerComponent */ "./sharedComponents/lineContainerComponent.tsx");
  36664. /* harmony import */ var _sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../sharedComponents/checkBoxLineComponent */ "./sharedComponents/checkBoxLineComponent.tsx");
  36665. /* harmony import */ var _sharedComponents_floatLineComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../sharedComponents/floatLineComponent */ "./sharedComponents/floatLineComponent.tsx");
  36666. /* harmony import */ var _sharedComponents_sliderLineComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../sharedComponents/sliderLineComponent */ "./sharedComponents/sliderLineComponent.tsx");
  36667. /* harmony import */ var babylonjs_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! babylonjs/Materials/Node/nodeMaterialDecorator */ "babylonjs/Misc/observable");
  36668. /* harmony import */ var babylonjs_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_6__);
  36669. var GenericPropertyComponent = /** @class */ (function (_super) {
  36670. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GenericPropertyComponent, _super);
  36671. function GenericPropertyComponent(props) {
  36672. return _super.call(this, props) || this;
  36673. }
  36674. GenericPropertyComponent.prototype.render = function () {
  36675. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null,
  36676. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](GeneralPropertyTabComponent, { globalState: this.props.globalState, guiBlock: this.props.guiBlock }),
  36677. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](GenericPropertyTabComponent, { globalState: this.props.globalState, guiBlock: this.props.guiBlock })));
  36678. };
  36679. return GenericPropertyComponent;
  36680. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36681. var GeneralPropertyTabComponent = /** @class */ (function (_super) {
  36682. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GeneralPropertyTabComponent, _super);
  36683. function GeneralPropertyTabComponent(props) {
  36684. return _super.call(this, props) || this;
  36685. }
  36686. GeneralPropertyTabComponent.prototype.render = function () {
  36687. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null,
  36688. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__["LineContainerComponent"], { title: "GENERAL" })));
  36689. };
  36690. return GeneralPropertyTabComponent;
  36691. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36692. var GenericPropertyTabComponent = /** @class */ (function (_super) {
  36693. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GenericPropertyTabComponent, _super);
  36694. function GenericPropertyTabComponent(props) {
  36695. return _super.call(this, props) || this;
  36696. }
  36697. GenericPropertyTabComponent.prototype.forceRebuild = function (notifiers) {
  36698. if (!notifiers || notifiers.update) {
  36699. this.props.globalState.onUpdateRequiredObservable.notifyObservers();
  36700. }
  36701. if (!notifiers || notifiers.rebuild) {
  36702. this.props.globalState.onRebuildRequiredObservable.notifyObservers();
  36703. }
  36704. };
  36705. GenericPropertyTabComponent.prototype.render = function () {
  36706. var _this = this;
  36707. var block = this.props.guiBlock, propStore = block._propStore;
  36708. if (!propStore) {
  36709. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null));
  36710. }
  36711. var componentList = {}, groups = [];
  36712. var _loop_1 = function (propertyName, displayName, type, groupName, options) {
  36713. var components = componentList[groupName];
  36714. if (!components) {
  36715. components = [];
  36716. componentList[groupName] = components;
  36717. groups.push(groupName);
  36718. }
  36719. switch (type) {
  36720. case babylonjs_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_6__["PropertyTypeForEdition"].Boolean: {
  36721. components.push(react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_3__["CheckBoxLineComponent"], { label: displayName, target: this_1.props.guiBlock, propertyName: propertyName, onValueChanged: function () { return _this.forceRebuild(options.notifiers); } }));
  36722. break;
  36723. }
  36724. case babylonjs_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_6__["PropertyTypeForEdition"].Float: {
  36725. var cantDisplaySlider = (isNaN(options.min) || isNaN(options.max) || options.min === options.max);
  36726. if (cantDisplaySlider) {
  36727. components.push(react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_floatLineComponent__WEBPACK_IMPORTED_MODULE_4__["FloatLineComponent"], { globalState: this_1.props.globalState, label: displayName, propertyName: propertyName, target: this_1.props.guiBlock, onChange: function () { return _this.forceRebuild(options.notifiers); } }));
  36728. }
  36729. else {
  36730. components.push(react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_sliderLineComponent__WEBPACK_IMPORTED_MODULE_5__["SliderLineComponent"], { label: displayName, target: this_1.props.guiBlock, globalState: this_1.props.globalState, propertyName: propertyName, step: Math.abs(options.max - options.min) / 100.0, minimum: Math.min(options.min, options.max), maximum: options.max, onChange: function () { return _this.forceRebuild(options.notifiers); } }));
  36731. }
  36732. break;
  36733. }
  36734. }
  36735. };
  36736. var this_1 = this;
  36737. for (var _i = 0, propStore_1 = propStore; _i < propStore_1.length; _i++) {
  36738. var _a = propStore_1[_i], propertyName = _a.propertyName, displayName = _a.displayName, type = _a.type, groupName = _a.groupName, options = _a.options;
  36739. _loop_1(propertyName, displayName, type, groupName, options);
  36740. }
  36741. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null, groups.map(function (group) {
  36742. return react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__["LineContainerComponent"], { title: group }, componentList[group]);
  36743. })));
  36744. };
  36745. return GenericPropertyTabComponent;
  36746. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36747. /***/ }),
  36748. /***/ "./diagram/properties/sliderGuiPropertyComponent.tsx":
  36749. /*!***********************************************************!*\
  36750. !*** ./diagram/properties/sliderGuiPropertyComponent.tsx ***!
  36751. \***********************************************************/
  36752. /*! exports provided: SliderPropertyTabComponent */
  36753. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36754. "use strict";
  36755. __webpack_require__.r(__webpack_exports__);
  36756. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SliderPropertyTabComponent", function() { return SliderPropertyTabComponent; });
  36757. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  36758. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36759. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36760. /* harmony import */ var _sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../sharedComponents/lineContainerComponent */ "./sharedComponents/lineContainerComponent.tsx");
  36761. /* harmony import */ var _genericNodePropertyComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./genericNodePropertyComponent */ "./diagram/properties/genericNodePropertyComponent.tsx");
  36762. /* harmony import */ var _sharedComponents_textLineComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../sharedComponents/textLineComponent */ "./sharedComponents/textLineComponent.tsx");
  36763. /* harmony import */ var _sharedComponents_numericInputComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../sharedComponents/numericInputComponent */ "./sharedComponents/numericInputComponent.tsx");
  36764. var SliderPropertyTabComponent = /** @class */ (function (_super) {
  36765. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SliderPropertyTabComponent, _super);
  36766. function SliderPropertyTabComponent(props) {
  36767. var _this = _super.call(this, props) || this;
  36768. _this.slider = _this.props.guiBlock;
  36769. return _this;
  36770. }
  36771. SliderPropertyTabComponent.prototype.render = function () {
  36772. var _this = this;
  36773. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null,
  36774. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_genericNodePropertyComponent__WEBPACK_IMPORTED_MODULE_3__["GeneralPropertyTabComponent"], { globalState: this.props.globalState, guiBlock: this.props.guiBlock }),
  36775. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__["LineContainerComponent"], { title: "PROPERTIES" },
  36776. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_numericInputComponent__WEBPACK_IMPORTED_MODULE_5__["NumericInputComponent"], { globalState: this.props.globalState, label: "Minimum Value", value: this.slider.minimum, onChange: function (evt) {
  36777. _this.slider.minimum = evt;
  36778. } }),
  36779. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_numericInputComponent__WEBPACK_IMPORTED_MODULE_5__["NumericInputComponent"], { globalState: this.props.globalState, label: "Maximum Value", value: this.slider.maximum, onChange: function (evt) {
  36780. _this.slider.maximum = evt;
  36781. } }),
  36782. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_numericInputComponent__WEBPACK_IMPORTED_MODULE_5__["NumericInputComponent"], { globalState: this.props.globalState, label: "Value", value: this.slider.value, onChange: function (evt) {
  36783. _this.slider.value = evt;
  36784. } }),
  36785. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_numericInputComponent__WEBPACK_IMPORTED_MODULE_5__["NumericInputComponent"], { globalState: this.props.globalState, label: "Height", value: this.slider.heightInPixels, onChange: function (evt) {
  36786. _this.slider.height = evt;
  36787. } }),
  36788. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_numericInputComponent__WEBPACK_IMPORTED_MODULE_5__["NumericInputComponent"], { globalState: this.props.globalState, label: "Width", value: this.slider.widthInPixels, onChange: function (evt) {
  36789. _this.slider.width = evt;
  36790. } }),
  36791. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_textLineComponent__WEBPACK_IMPORTED_MODULE_4__["TextLineComponent"], { label: "Color", value: this.slider.background }))));
  36792. };
  36793. return SliderPropertyTabComponent;
  36794. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  36795. /***/ }),
  36796. /***/ "./diagram/propertyLedger.ts":
  36797. /*!***********************************!*\
  36798. !*** ./diagram/propertyLedger.ts ***!
  36799. \***********************************/
  36800. /*! exports provided: PropertyGuiLedger */
  36801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36802. "use strict";
  36803. __webpack_require__.r(__webpack_exports__);
  36804. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropertyGuiLedger", function() { return PropertyGuiLedger; });
  36805. /* harmony import */ var _properties_sliderGuiPropertyComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./properties/sliderGuiPropertyComponent */ "./diagram/properties/sliderGuiPropertyComponent.tsx");
  36806. var PropertyGuiLedger = /** @class */ (function () {
  36807. function PropertyGuiLedger() {
  36808. }
  36809. PropertyGuiLedger.RegisteredControls = {};
  36810. return PropertyGuiLedger;
  36811. }());
  36812. PropertyGuiLedger.RegisteredControls["Slider"] = _properties_sliderGuiPropertyComponent__WEBPACK_IMPORTED_MODULE_0__["SliderPropertyTabComponent"];
  36813. /***/ }),
  36814. /***/ "./diagram/workbench.tsx":
  36815. /*!*******************************!*\
  36816. !*** ./diagram/workbench.tsx ***!
  36817. \*******************************/
  36818. /*! exports provided: isFramePortData, WorkbenchComponent */
  36819. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  36820. "use strict";
  36821. __webpack_require__.r(__webpack_exports__);
  36822. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFramePortData", function() { return isFramePortData; });
  36823. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkbenchComponent", function() { return WorkbenchComponent; });
  36824. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  36825. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  36826. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  36827. /* harmony import */ var _guiNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./guiNode */ "./diagram/guiNode.ts");
  36828. /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dagre */ "../../node_modules/dagre/index.js");
  36829. /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_3__);
  36830. /* harmony import */ var babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! babylonjs/Misc/dataStorage */ "babylonjs/Misc/observable");
  36831. /* harmony import */ var babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__);
  36832. /* harmony import */ var babylonjs_gui_2D_advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! babylonjs-gui/2D/advancedDynamicTexture */ "babylonjs-gui/2D/controls/button");
  36833. /* harmony import */ var babylonjs_gui_2D_advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(babylonjs_gui_2D_advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_5__);
  36834. __webpack_require__(/*! ./graphCanvas.scss */ "./diagram/graphCanvas.scss");
  36835. var isFramePortData = function (variableToCheck) {
  36836. if (variableToCheck) {
  36837. return variableToCheck !== undefined;
  36838. }
  36839. else
  36840. return false;
  36841. };
  36842. var WorkbenchComponent = /** @class */ (function (_super) {
  36843. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WorkbenchComponent, _super);
  36844. function WorkbenchComponent(props) {
  36845. var _this = _super.call(this, props) || this;
  36846. _this.MinZoom = 0.1;
  36847. _this.MaxZoom = 4;
  36848. _this._guiNodes = [];
  36849. _this._mouseStartPointX = null;
  36850. _this._mouseStartPointY = null;
  36851. _this._selectionStartX = 0;
  36852. _this._selectionStartY = 0;
  36853. _this._x = 0;
  36854. _this._y = 0;
  36855. _this._zoom = 1;
  36856. _this._selectedGuiNodes = [];
  36857. _this._gridSize = 20;
  36858. _this._selectionBox = null;
  36859. _this._frameCandidate = null;
  36860. _this._altKeyIsPressed = false;
  36861. _this._ctrlKeyIsPressed = false;
  36862. _this._oldY = -1;
  36863. _this._frameIsMoving = false;
  36864. _this._isLoading = false;
  36865. _this.isOverGUINode = false;
  36866. props.globalState.onSelectionChangedObservable.add(function (selection) {
  36867. console.log(selection);
  36868. _this.selectedGuiNodes.forEach(function (element) {
  36869. element.isSelected = false;
  36870. });
  36871. if (!selection) {
  36872. _this._selectedGuiNodes = [];
  36873. }
  36874. else {
  36875. if (selection instanceof _guiNode__WEBPACK_IMPORTED_MODULE_2__["GUINode"]) {
  36876. if (_this._ctrlKeyIsPressed) {
  36877. if (_this._selectedGuiNodes.indexOf(selection) === -1) {
  36878. _this._selectedGuiNodes.push(selection);
  36879. }
  36880. }
  36881. else {
  36882. _this._selectedGuiNodes = [selection];
  36883. }
  36884. }
  36885. }
  36886. });
  36887. props.globalState.onGridSizeChanged.add(function () {
  36888. _this.gridSize = babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["DataStorage"].ReadNumber("GridSize", 20);
  36889. });
  36890. _this.props.globalState.hostDocument.addEventListener("keyup", function () { return _this.onKeyUp(); }, false);
  36891. _this.props.globalState.hostDocument.addEventListener("keydown", function (evt) {
  36892. _this._altKeyIsPressed = evt.altKey;
  36893. _this._ctrlKeyIsPressed = evt.ctrlKey;
  36894. }, false);
  36895. _this.props.globalState.hostDocument.defaultView.addEventListener("blur", function () {
  36896. _this._altKeyIsPressed = false;
  36897. _this._ctrlKeyIsPressed = false;
  36898. }, false);
  36899. // Store additional data to serialization object
  36900. _this.props.globalState.storeEditorData = function (editorData, graphFrame) {
  36901. editorData.frames = [];
  36902. if (graphFrame) {
  36903. }
  36904. else {
  36905. editorData.x = _this.x;
  36906. editorData.y = _this.y;
  36907. editorData.zoom = _this.zoom;
  36908. }
  36909. };
  36910. _this.props.globalState.workbench = _this;
  36911. return _this;
  36912. }
  36913. Object.defineProperty(WorkbenchComponent.prototype, "gridSize", {
  36914. get: function () {
  36915. return this._gridSize;
  36916. },
  36917. set: function (value) {
  36918. this._gridSize = value;
  36919. this.updateTransform();
  36920. },
  36921. enumerable: false,
  36922. configurable: true
  36923. });
  36924. Object.defineProperty(WorkbenchComponent.prototype, "globalState", {
  36925. get: function () {
  36926. return this.props.globalState;
  36927. },
  36928. enumerable: false,
  36929. configurable: true
  36930. });
  36931. Object.defineProperty(WorkbenchComponent.prototype, "nodes", {
  36932. get: function () {
  36933. return this._guiNodes;
  36934. },
  36935. enumerable: false,
  36936. configurable: true
  36937. });
  36938. Object.defineProperty(WorkbenchComponent.prototype, "zoom", {
  36939. get: function () {
  36940. return this._zoom;
  36941. },
  36942. set: function (value) {
  36943. if (this._zoom === value) {
  36944. return;
  36945. }
  36946. this._zoom = value;
  36947. this.updateTransform();
  36948. },
  36949. enumerable: false,
  36950. configurable: true
  36951. });
  36952. Object.defineProperty(WorkbenchComponent.prototype, "x", {
  36953. get: function () {
  36954. return this._x;
  36955. },
  36956. set: function (value) {
  36957. this._x = value;
  36958. this.updateTransform();
  36959. },
  36960. enumerable: false,
  36961. configurable: true
  36962. });
  36963. Object.defineProperty(WorkbenchComponent.prototype, "y", {
  36964. get: function () {
  36965. return this._y;
  36966. },
  36967. set: function (value) {
  36968. this._y = value;
  36969. this.updateTransform();
  36970. },
  36971. enumerable: false,
  36972. configurable: true
  36973. });
  36974. Object.defineProperty(WorkbenchComponent.prototype, "selectedGuiNodes", {
  36975. get: function () {
  36976. return this._selectedGuiNodes;
  36977. },
  36978. enumerable: false,
  36979. configurable: true
  36980. });
  36981. Object.defineProperty(WorkbenchComponent.prototype, "canvasContainer", {
  36982. get: function () {
  36983. return this._graphCanvas;
  36984. },
  36985. enumerable: false,
  36986. configurable: true
  36987. });
  36988. Object.defineProperty(WorkbenchComponent.prototype, "hostCanvas", {
  36989. get: function () {
  36990. return this._hostCanvas;
  36991. },
  36992. enumerable: false,
  36993. configurable: true
  36994. });
  36995. Object.defineProperty(WorkbenchComponent.prototype, "svgCanvas", {
  36996. get: function () {
  36997. return this._svgCanvas;
  36998. },
  36999. enumerable: false,
  37000. configurable: true
  37001. });
  37002. Object.defineProperty(WorkbenchComponent.prototype, "selectionContainer", {
  37003. get: function () {
  37004. return this._selectionContainer;
  37005. },
  37006. enumerable: false,
  37007. configurable: true
  37008. });
  37009. Object.defineProperty(WorkbenchComponent.prototype, "frameContainer", {
  37010. get: function () {
  37011. return this._frameContainer;
  37012. },
  37013. enumerable: false,
  37014. configurable: true
  37015. });
  37016. WorkbenchComponent.prototype.getGridPosition = function (position, useCeil) {
  37017. if (useCeil === void 0) { useCeil = false; }
  37018. var gridSize = this.gridSize;
  37019. if (gridSize === 0) {
  37020. return position;
  37021. }
  37022. if (useCeil) {
  37023. return gridSize * Math.ceil(position / gridSize);
  37024. }
  37025. return gridSize * Math.floor(position / gridSize);
  37026. };
  37027. WorkbenchComponent.prototype.getGridPositionCeil = function (position) {
  37028. var gridSize = this.gridSize;
  37029. if (gridSize === 0) {
  37030. return position;
  37031. }
  37032. return gridSize * Math.ceil(position / gridSize);
  37033. };
  37034. WorkbenchComponent.prototype.updateTransform = function () {
  37035. this._rootContainer.style.transform = "translate(" + this._x + "px, " + this._y + "px) scale(" + this._zoom + ")";
  37036. if (babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["DataStorage"].ReadBoolean("ShowGrid", true)) {
  37037. this._hostCanvas.style.backgroundSize = this._gridSize * this._zoom + "px " + this._gridSize * this._zoom + "px";
  37038. this._hostCanvas.style.backgroundPosition = this._x + "px " + this._y + "px";
  37039. }
  37040. else {
  37041. this._hostCanvas.style.backgroundSize = "0";
  37042. }
  37043. };
  37044. WorkbenchComponent.prototype.onKeyUp = function () {
  37045. this._altKeyIsPressed = false;
  37046. this._ctrlKeyIsPressed = false;
  37047. this._oldY = -1;
  37048. };
  37049. WorkbenchComponent.prototype.findNodeFromGuiElement = function (guiElement) {
  37050. return this._guiNodes.filter(function (n) { return n.guiNode === guiElement; })[0];
  37051. };
  37052. WorkbenchComponent.prototype.reset = function () {
  37053. for (var _i = 0, _a = this._guiNodes; _i < _a.length; _i++) {
  37054. var node = _a[_i];
  37055. node.dispose();
  37056. }
  37057. this._guiNodes = [];
  37058. this._graphCanvas.innerHTML = "";
  37059. this._svgCanvas.innerHTML = "";
  37060. };
  37061. WorkbenchComponent.prototype.appendBlock = function (guiElement) {
  37062. var newGuiNode = new _guiNode__WEBPACK_IMPORTED_MODULE_2__["GUINode"](this.props.globalState, guiElement);
  37063. newGuiNode.appendVisual(this._graphCanvas, this);
  37064. this._guiNodes.push(newGuiNode);
  37065. this.globalState.guiTexture.addControl(guiElement);
  37066. return newGuiNode;
  37067. };
  37068. WorkbenchComponent.prototype.distributeGraph = function () {
  37069. var _this = this;
  37070. this.x = 0;
  37071. this.y = 0;
  37072. this.zoom = 1;
  37073. var graph = new dagre__WEBPACK_IMPORTED_MODULE_3__["graphlib"].Graph();
  37074. graph.setGraph({});
  37075. graph.setDefaultEdgeLabel(function () { return ({}); });
  37076. graph.graph().rankdir = "LR";
  37077. // Build dagre graph
  37078. this._guiNodes.forEach(function (node) {
  37079. graph.setNode(node.id.toString(), {
  37080. id: node.id,
  37081. type: "node",
  37082. width: node.width,
  37083. height: node.height
  37084. });
  37085. });
  37086. // Distribute
  37087. dagre__WEBPACK_IMPORTED_MODULE_3__["layout"](graph);
  37088. // Update graph
  37089. var dagreNodes = graph.nodes().map(function (node) { return graph.node(node); });
  37090. dagreNodes.forEach(function (dagreNode) {
  37091. if (!dagreNode) {
  37092. return;
  37093. }
  37094. if (dagreNode.type === "node") {
  37095. for (var _i = 0, _a = _this._guiNodes; _i < _a.length; _i++) {
  37096. var node = _a[_i];
  37097. if (node.id === dagreNode.id) {
  37098. node.x = dagreNode.x - dagreNode.width / 2;
  37099. node.y = dagreNode.y - dagreNode.height / 2;
  37100. node.cleanAccumulation();
  37101. return;
  37102. }
  37103. }
  37104. return;
  37105. }
  37106. });
  37107. };
  37108. WorkbenchComponent.prototype.componentDidMount = function () {
  37109. this._hostCanvas = this.props.globalState.hostDocument.getElementById("graph-canvas");
  37110. this._rootContainer = this.props.globalState.hostDocument.getElementById("graph-container");
  37111. this._graphCanvas = this.props.globalState.hostDocument.getElementById("graph-canvas-container");
  37112. this._svgCanvas = this.props.globalState.hostDocument.getElementById("graph-svg-container");
  37113. this._selectionContainer = this.props.globalState.hostDocument.getElementById("selection-container");
  37114. this._frameContainer = this.props.globalState.hostDocument.getElementById("frame-container");
  37115. this.gridSize = babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["DataStorage"].ReadNumber("GridSize", 20);
  37116. this.updateTransform();
  37117. };
  37118. WorkbenchComponent.prototype.onMove = function (evt) {
  37119. // Selection box
  37120. if (this._selectionBox) {
  37121. var rootRect = this.canvasContainer.getBoundingClientRect();
  37122. var localX = evt.pageX - rootRect.left;
  37123. var localY = evt.pageY - rootRect.top;
  37124. if (localX > this._selectionStartX) {
  37125. this._selectionBox.style.left = this._selectionStartX / this.zoom + "px";
  37126. this._selectionBox.style.width = (localX - this._selectionStartX) / this.zoom + "px";
  37127. }
  37128. else {
  37129. this._selectionBox.style.left = localX / this.zoom + "px";
  37130. this._selectionBox.style.width = (this._selectionStartX - localX) / this.zoom + "px";
  37131. }
  37132. if (localY > this._selectionStartY) {
  37133. this._selectionBox.style.top = this._selectionStartY / this.zoom + "px";
  37134. this._selectionBox.style.height = (localY - this._selectionStartY) / this.zoom + "px";
  37135. }
  37136. else {
  37137. this._selectionBox.style.top = localY / this.zoom + "px";
  37138. this._selectionBox.style.height = (this._selectionStartY - localY) / this.zoom + "px";
  37139. }
  37140. this.props.globalState.onSelectionBoxMoved.notifyObservers(this._selectionBox.getBoundingClientRect());
  37141. return;
  37142. }
  37143. // Zoom with mouse + alt
  37144. if (this._altKeyIsPressed && evt.buttons === 1) {
  37145. if (this._oldY < 0) {
  37146. this._oldY = evt.pageY;
  37147. }
  37148. var zoomDelta = (evt.pageY - this._oldY) / 10;
  37149. if (Math.abs(zoomDelta) > 5) {
  37150. var oldZoom = this.zoom;
  37151. this.zoom = Math.max(Math.min(this.MaxZoom, this.zoom + zoomDelta / 100), this.MinZoom);
  37152. var boundingRect = evt.currentTarget.getBoundingClientRect();
  37153. var clientWidth = boundingRect.width;
  37154. var widthDiff = clientWidth * this.zoom - clientWidth * oldZoom;
  37155. var clientX = evt.clientX - boundingRect.left;
  37156. var xFactor = (clientX - this.x) / oldZoom / clientWidth;
  37157. this.x = this.x - widthDiff * xFactor;
  37158. this._oldY = evt.pageY;
  37159. }
  37160. return;
  37161. }
  37162. // Move canvas and/or guiNodes
  37163. if (this._mouseStartPointX != null && this._mouseStartPointY != null) {
  37164. var x = this._mouseStartPointX;
  37165. var y = this._mouseStartPointY;
  37166. var selected_1 = false;
  37167. this.selectedGuiNodes.forEach(function (element) {
  37168. selected_1 = element._onMove(new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Vector2"](evt.clientX, evt.clientY), new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Vector2"](x, y)) || selected_1;
  37169. });
  37170. if (!selected_1) {
  37171. this._rootContainer.style.cursor = "move";
  37172. this.x += evt.clientX - this._mouseStartPointX;
  37173. this.y += evt.clientY - this._mouseStartPointY;
  37174. }
  37175. this._mouseStartPointX = evt.clientX;
  37176. this._mouseStartPointY = evt.clientY;
  37177. }
  37178. };
  37179. WorkbenchComponent.prototype.onDown = function (evt) {
  37180. this._rootContainer.setPointerCapture(evt.pointerId);
  37181. // Selection?
  37182. /*if (evt.currentTarget === this._hostCanvas && evt.ctrlKey) {
  37183. this._selectionBox = this.props.globalState.hostDocument.createElement("div");
  37184. this._selectionBox.classList.add("selection-box");
  37185. this._selectionContainer.appendChild(this._selectionBox);
  37186. const rootRect = this.canvasContainer.getBoundingClientRect();
  37187. this._selectionStartX = (evt.pageX - rootRect.left);
  37188. this._selectionStartY = (evt.pageY - rootRect.top);
  37189. this._selectionBox.style.left = `${this._selectionStartX / this.zoom}px`;
  37190. this._selectionBox.style.top = `${this._selectionStartY / this.zoom}px`;
  37191. this._selectionBox.style.width = "0px";
  37192. this._selectionBox.style.height = "0px";
  37193. return;
  37194. }*/
  37195. console.log('workbench click');
  37196. if (!this.isOverGUINode) {
  37197. console.log('unclicked');
  37198. this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  37199. }
  37200. this._mouseStartPointX = evt.clientX;
  37201. this._mouseStartPointY = evt.clientY;
  37202. };
  37203. WorkbenchComponent.prototype.onUp = function (evt) {
  37204. this._mouseStartPointX = null;
  37205. this._mouseStartPointY = null;
  37206. this._rootContainer.releasePointerCapture(evt.pointerId);
  37207. this._oldY = -1;
  37208. if (this._selectionBox) {
  37209. this._selectionBox.parentElement.removeChild(this._selectionBox);
  37210. this._selectionBox = null;
  37211. }
  37212. if (this._frameCandidate) {
  37213. this._frameCandidate.parentElement.removeChild(this._frameCandidate);
  37214. this._frameCandidate = null;
  37215. }
  37216. };
  37217. WorkbenchComponent.prototype.onWheel = function (evt) {
  37218. var delta = evt.deltaY < 0 ? 0.1 : -0.1;
  37219. var oldZoom = this.zoom;
  37220. this.zoom = Math.min(Math.max(this.MinZoom, this.zoom + delta * this.zoom), this.MaxZoom);
  37221. var boundingRect = evt.currentTarget.getBoundingClientRect();
  37222. var clientWidth = boundingRect.width;
  37223. var clientHeight = boundingRect.height;
  37224. var widthDiff = clientWidth * this.zoom - clientWidth * oldZoom;
  37225. var heightDiff = clientHeight * this.zoom - clientHeight * oldZoom;
  37226. var clientX = evt.clientX - boundingRect.left;
  37227. var clientY = evt.clientY - boundingRect.top;
  37228. var xFactor = (clientX - this.x) / oldZoom / clientWidth;
  37229. var yFactor = (clientY - this.y) / oldZoom / clientHeight;
  37230. this.x = this.x - widthDiff * xFactor;
  37231. this.y = this.y - heightDiff * yFactor;
  37232. evt.stopPropagation();
  37233. };
  37234. WorkbenchComponent.prototype.zoomToFit = function () {
  37235. // Get negative offset
  37236. var minX = 0;
  37237. var minY = 0;
  37238. this._guiNodes.forEach(function (node) {
  37239. if (node.x < minX) {
  37240. minX = node.x;
  37241. }
  37242. if (node.y < minY) {
  37243. minY = node.y;
  37244. }
  37245. });
  37246. // Restore to 0
  37247. this._guiNodes.forEach(function (node) {
  37248. node.x += -minX;
  37249. node.y += -minY;
  37250. node.cleanAccumulation();
  37251. });
  37252. // Get correct zoom
  37253. var xFactor = this._rootContainer.clientWidth / this._rootContainer.scrollWidth;
  37254. var yFactor = this._rootContainer.clientHeight / this._rootContainer.scrollHeight;
  37255. var zoomFactor = xFactor < yFactor ? xFactor : yFactor;
  37256. this.zoom = zoomFactor;
  37257. this.x = 0;
  37258. this.y = 0;
  37259. };
  37260. WorkbenchComponent.prototype.createGUICanvas = function () {
  37261. var _this = this;
  37262. // Get the canvas element from the DOM.
  37263. var canvas = document.getElementById("graph-canvas");
  37264. // Associate a Babylon Engine to it.
  37265. var engine = new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Engine"](canvas);
  37266. // Create our first scene.
  37267. var scene = new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Scene"](engine);
  37268. scene.clearColor = new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Color4"](0.2, 0.2, 0.3, 0.1);
  37269. // This creates and positions a free camera (non-mesh)
  37270. var camera = new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["FreeCamera"]("camera1", new babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Vector3"](0, 5, -10), scene);
  37271. // This targets the camera to scene origin
  37272. camera.setTarget(babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_4__["Vector3"].Zero());
  37273. // This attaches the camera to the canvas
  37274. //camera.attachControl(true);
  37275. // GUI
  37276. this.globalState.guiTexture = babylonjs_gui_2D_advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_5__["AdvancedDynamicTexture"].CreateFullscreenUI("UI");
  37277. scene.getEngine().onCanvasPointerOutObservable.clear();
  37278. // Watch for browser/canvas resize events
  37279. window.addEventListener("resize", function () {
  37280. engine.resize();
  37281. });
  37282. engine.runRenderLoop(function () { _this.updateGUIs(); scene.render(); });
  37283. };
  37284. WorkbenchComponent.prototype.updateGUIs = function () {
  37285. this._guiNodes.forEach(function (element) {
  37286. element.updateVisual();
  37287. });
  37288. };
  37289. WorkbenchComponent.prototype.render = function () {
  37290. var _this = this;
  37291. return react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("canvas", { id: "graph-canvas", onWheel: function (evt) { return _this.onWheel(evt); }, onPointerMove: function (evt) { return _this.onMove(evt); }, onPointerDown: function (evt) { return _this.onDown(evt); }, onPointerUp: function (evt) { return _this.onUp(evt); } },
  37292. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "graph-container" },
  37293. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "graph-canvas-container" }),
  37294. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "frame-container" }),
  37295. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("svg", { id: "graph-svg-container" }),
  37296. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "selection-container" })));
  37297. };
  37298. return WorkbenchComponent;
  37299. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37300. /***/ }),
  37301. /***/ "./globalState.ts":
  37302. /*!************************!*\
  37303. !*** ./globalState.ts ***!
  37304. \************************/
  37305. /*! exports provided: GlobalState */
  37306. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37307. "use strict";
  37308. __webpack_require__.r(__webpack_exports__);
  37309. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GlobalState", function() { return GlobalState; });
  37310. /* harmony import */ var babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/observable */ "babylonjs/Misc/observable");
  37311. /* harmony import */ var babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__);
  37312. var GlobalState = /** @class */ (function () {
  37313. function GlobalState() {
  37314. this.onSelectionChangedObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37315. this.onRebuildRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37316. this.onBuiltObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37317. this.onResetRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37318. this.onUpdateRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37319. this.onZoomToFitRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37320. this.onReOrganizedRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37321. this.onLogRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37322. this.onErrorMessageDialogRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37323. this.onIsLoadingChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37324. this.onPreviewCommandActivated = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37325. this.onLightUpdated = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37326. this.onPreviewBackgroundChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37327. this.onBackFaceCullingChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37328. this.onDepthPrePassChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37329. this.onAnimationCommandActivated = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37330. this.onCandidateLinkMoved = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37331. this.onSelectionBoxMoved = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37332. this.onImportFrameObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37333. this.onGraphNodeRemovalObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37334. this.onGridSizeChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37335. this.onExposePortOnFrameObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
  37336. this.listOfCustomPreviewFiles = [];
  37337. this.blockKeyboardEvents = false;
  37338. this.backFaceCulling = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("BackFaceCulling", true);
  37339. this.depthPrePass = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("DepthPrePass", false);
  37340. this.hemisphericLight = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("HemisphericLight", true);
  37341. this.directionalLight0 = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("DirectionalLight0", false);
  37342. this.directionalLight1 = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("DirectionalLight1", false);
  37343. this.controlCamera = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("ControlCamera", true);
  37344. var r = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadNumber("BackgroundColorR", 0.12549019607843137);
  37345. var g = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadNumber("BackgroundColorG", 0.09803921568627451);
  37346. var b = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadNumber("BackgroundColorB", 0.25098039215686274);
  37347. this.backgroundColor = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Color4"](r, g, b, 1.0);
  37348. }
  37349. return GlobalState;
  37350. }());
  37351. /***/ }),
  37352. /***/ "./guiEditor.ts":
  37353. /*!**********************!*\
  37354. !*** ./guiEditor.ts ***!
  37355. \**********************/
  37356. /*! exports provided: GuiEditor */
  37357. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37358. "use strict";
  37359. __webpack_require__.r(__webpack_exports__);
  37360. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuiEditor", function() { return GuiEditor; });
  37361. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37362. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  37363. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "../../node_modules/react-dom/index.js");
  37364. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
  37365. /* harmony import */ var _globalState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./globalState */ "./globalState.ts");
  37366. /* harmony import */ var _workbenchEditor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./workbenchEditor */ "./workbenchEditor.tsx");
  37367. /* harmony import */ var _sharedComponents_popup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sharedComponents/popup */ "./sharedComponents/popup.ts");
  37368. /* harmony import */ var _serializationTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./serializationTools */ "./serializationTools.ts");
  37369. /**
  37370. * Class used to create a gui editor
  37371. */
  37372. var GuiEditor = /** @class */ (function () {
  37373. function GuiEditor() {
  37374. }
  37375. /**
  37376. * Show the gui editor
  37377. * @param options defines the options to use to configure the gui editor
  37378. */
  37379. GuiEditor.Show = function (options) {
  37380. if (this._CurrentState) {
  37381. var popupWindow = _sharedComponents_popup__WEBPACK_IMPORTED_MODULE_4__["Popup"]["gui-editor"];
  37382. if (popupWindow) {
  37383. popupWindow.close();
  37384. }
  37385. }
  37386. var hostElement = options.hostElement;
  37387. if (!hostElement) {
  37388. hostElement = _sharedComponents_popup__WEBPACK_IMPORTED_MODULE_4__["Popup"].CreatePopup("BABYLON.JS NODE EDITOR", "gui-editor", 1000, 800);
  37389. }
  37390. var globalState = new _globalState__WEBPACK_IMPORTED_MODULE_2__["GlobalState"]();
  37391. globalState.hostElement = hostElement;
  37392. globalState.hostDocument = hostElement.ownerDocument;
  37393. globalState.customSave = options.customSave;
  37394. globalState.hostWindow = hostElement.ownerDocument.defaultView;
  37395. var graphEditor = react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_workbenchEditor__WEBPACK_IMPORTED_MODULE_3__["WorkbenchEditor"], {
  37396. globalState: globalState
  37397. });
  37398. react_dom__WEBPACK_IMPORTED_MODULE_1__["render"](graphEditor, hostElement);
  37399. // create the middle workbench canvas
  37400. if (!globalState.guiTexture) {
  37401. globalState.workbench.createGUICanvas();
  37402. }
  37403. if (options.customLoadObservable) {
  37404. options.customLoadObservable.add(function (data) {
  37405. _serializationTools__WEBPACK_IMPORTED_MODULE_5__["SerializationTools"].Deserialize(data, globalState);
  37406. globalState.onResetRequiredObservable.notifyObservers();
  37407. globalState.onBuiltObservable.notifyObservers();
  37408. });
  37409. }
  37410. this._CurrentState = globalState;
  37411. // Close the popup window when the page is refreshed or scene is disposed
  37412. var popupWindow = _sharedComponents_popup__WEBPACK_IMPORTED_MODULE_4__["Popup"]["gui-editor"];
  37413. if (popupWindow) {
  37414. window.onbeforeunload = function () {
  37415. var popupWindow = _sharedComponents_popup__WEBPACK_IMPORTED_MODULE_4__["Popup"]["gui-editor"];
  37416. if (popupWindow) {
  37417. popupWindow.close();
  37418. }
  37419. };
  37420. }
  37421. window.addEventListener('beforeunload', function () {
  37422. });
  37423. };
  37424. return GuiEditor;
  37425. }());
  37426. /***/ }),
  37427. /***/ "./index.ts":
  37428. /*!******************!*\
  37429. !*** ./index.ts ***!
  37430. \******************/
  37431. /*! exports provided: GuiEditor */
  37432. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37433. "use strict";
  37434. __webpack_require__.r(__webpack_exports__);
  37435. /* harmony import */ var _guiEditor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./guiEditor */ "./guiEditor.ts");
  37436. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GuiEditor", function() { return _guiEditor__WEBPACK_IMPORTED_MODULE_0__["GuiEditor"]; });
  37437. /***/ }),
  37438. /***/ "./legacy/legacy.ts":
  37439. /*!**************************!*\
  37440. !*** ./legacy/legacy.ts ***!
  37441. \**************************/
  37442. /*! exports provided: GuiEditor */
  37443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37444. "use strict";
  37445. __webpack_require__.r(__webpack_exports__);
  37446. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "./index.ts");
  37447. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GuiEditor", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GuiEditor"]; });
  37448. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  37449. if (typeof globalObject !== "undefined") {
  37450. globalObject.BABYLON = globalObject.BABYLON || {};
  37451. globalObject.BABYLON.GuiEditor = _index__WEBPACK_IMPORTED_MODULE_0__["GuiEditor"];
  37452. }
  37453. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  37454. /***/ }),
  37455. /***/ "./main.scss":
  37456. /*!*******************!*\
  37457. !*** ./main.scss ***!
  37458. \*******************/
  37459. /*! no static exports found */
  37460. /***/ (function(module, exports, __webpack_require__) {
  37461. var api = __webpack_require__(/*! ../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
  37462. var content = __webpack_require__(/*! !../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss */ "../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
  37463. content = content.__esModule ? content.default : content;
  37464. if (typeof content === 'string') {
  37465. content = [[module.i, content, '']];
  37466. }
  37467. var options = {};
  37468. options.insert = "head";
  37469. options.singleton = false;
  37470. var update = api(content, options);
  37471. module.exports = content.locals || {};
  37472. /***/ }),
  37473. /***/ "./portal.tsx":
  37474. /*!********************!*\
  37475. !*** ./portal.tsx ***!
  37476. \********************/
  37477. /*! exports provided: Portal */
  37478. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37479. "use strict";
  37480. __webpack_require__.r(__webpack_exports__);
  37481. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Portal", function() { return Portal; });
  37482. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37483. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37484. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37485. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "../../node_modules/react-dom/index.js");
  37486. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);
  37487. var Portal = /** @class */ (function (_super) {
  37488. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Portal, _super);
  37489. function Portal() {
  37490. return _super !== null && _super.apply(this, arguments) || this;
  37491. }
  37492. Portal.prototype.render = function () {
  37493. return react_dom__WEBPACK_IMPORTED_MODULE_2__["createPortal"](this.props.children, this.props.globalState.hostElement);
  37494. };
  37495. return Portal;
  37496. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37497. /***/ }),
  37498. /***/ "./serializationTools.ts":
  37499. /*!*******************************!*\
  37500. !*** ./serializationTools.ts ***!
  37501. \*******************************/
  37502. /*! exports provided: SerializationTools */
  37503. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37504. "use strict";
  37505. __webpack_require__.r(__webpack_exports__);
  37506. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SerializationTools", function() { return SerializationTools; });
  37507. /* harmony import */ var babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/Textures/texture */ "babylonjs/Misc/observable");
  37508. /* harmony import */ var babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__);
  37509. var SerializationTools = /** @class */ (function () {
  37510. function SerializationTools() {
  37511. }
  37512. SerializationTools.UpdateLocations = function (material, globalState) {
  37513. material.editorData = {
  37514. locations: []
  37515. };
  37516. globalState.storeEditorData(material.editorData);
  37517. };
  37518. SerializationTools.Serialize = function (material, globalState) {
  37519. var bufferSerializationState = babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__["Texture"].SerializeBuffers;
  37520. babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__["Texture"].SerializeBuffers = babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__["DataStorage"].ReadBoolean("EmbedTextures", true);
  37521. var selectedBlocks = undefined;
  37522. var serializationObject = material.serialize(selectedBlocks);
  37523. babylonjs_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__["Texture"].SerializeBuffers = bufferSerializationState;
  37524. return JSON.stringify(serializationObject, undefined, 2);
  37525. };
  37526. SerializationTools.Deserialize = function (serializationObject, globalState) {
  37527. globalState.onIsLoadingChanged.notifyObservers(true);
  37528. };
  37529. SerializationTools.AddFrameToMaterial = function (serializationObject, globalState, currentMaterial) {
  37530. globalState.onIsLoadingChanged.notifyObservers(true);
  37531. this.UpdateLocations(currentMaterial, globalState);
  37532. globalState.onImportFrameObservable.notifyObservers(serializationObject);
  37533. };
  37534. return SerializationTools;
  37535. }());
  37536. /***/ }),
  37537. /***/ "./sharedComponents/buttonLineComponent.tsx":
  37538. /*!**************************************************!*\
  37539. !*** ./sharedComponents/buttonLineComponent.tsx ***!
  37540. \**************************************************/
  37541. /*! exports provided: ButtonLineComponent */
  37542. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37543. "use strict";
  37544. __webpack_require__.r(__webpack_exports__);
  37545. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonLineComponent", function() { return ButtonLineComponent; });
  37546. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37547. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37548. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37549. var ButtonLineComponent = /** @class */ (function (_super) {
  37550. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ButtonLineComponent, _super);
  37551. function ButtonLineComponent(props) {
  37552. return _super.call(this, props) || this;
  37553. }
  37554. ButtonLineComponent.prototype.render = function () {
  37555. var _this = this;
  37556. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "buttonLine" },
  37557. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("button", { onClick: function () { return _this.props.onClick(); } }, this.props.label)));
  37558. };
  37559. return ButtonLineComponent;
  37560. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37561. /***/ }),
  37562. /***/ "./sharedComponents/checkBoxLineComponent.tsx":
  37563. /*!****************************************************!*\
  37564. !*** ./sharedComponents/checkBoxLineComponent.tsx ***!
  37565. \****************************************************/
  37566. /*! exports provided: CheckBoxLineComponent */
  37567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37568. "use strict";
  37569. __webpack_require__.r(__webpack_exports__);
  37570. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckBoxLineComponent", function() { return CheckBoxLineComponent; });
  37571. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37572. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37573. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37574. var CheckBoxLineComponent = /** @class */ (function (_super) {
  37575. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CheckBoxLineComponent, _super);
  37576. function CheckBoxLineComponent(props) {
  37577. var _this = _super.call(this, props) || this;
  37578. _this._localChange = false;
  37579. _this._uniqueId = CheckBoxLineComponent._UniqueIdSeed++;
  37580. if (_this.props.isSelected) {
  37581. _this.state = { isSelected: _this.props.isSelected() };
  37582. }
  37583. else {
  37584. _this.state = { isSelected: _this.props.target[_this.props.propertyName] == true };
  37585. }
  37586. if (_this.props.disabled) {
  37587. _this.state = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, _this.state), { isDisabled: _this.props.disabled });
  37588. }
  37589. return _this;
  37590. }
  37591. CheckBoxLineComponent.prototype.shouldComponentUpdate = function (nextProps, nextState) {
  37592. var currentState;
  37593. if (nextProps.isSelected) {
  37594. currentState = nextProps.isSelected();
  37595. }
  37596. else {
  37597. currentState = nextProps.target[nextProps.propertyName] == true;
  37598. }
  37599. if (currentState !== nextState.isSelected || this._localChange) {
  37600. nextState.isSelected = currentState;
  37601. this._localChange = false;
  37602. return true;
  37603. }
  37604. if (nextProps.disabled !== !!nextState.isDisabled) {
  37605. return true;
  37606. }
  37607. return nextProps.label !== this.props.label || nextProps.target !== this.props.target;
  37608. };
  37609. CheckBoxLineComponent.prototype.onChange = function () {
  37610. this._localChange = true;
  37611. if (this.props.onSelect) {
  37612. this.props.onSelect(!this.state.isSelected);
  37613. }
  37614. else {
  37615. if (this.props.onPropertyChangedObservable) {
  37616. this.props.onPropertyChangedObservable.notifyObservers({
  37617. object: this.props.target,
  37618. property: this.props.propertyName,
  37619. value: !this.state.isSelected,
  37620. initialValue: this.state.isSelected
  37621. });
  37622. }
  37623. this.props.target[this.props.propertyName] = !this.state.isSelected;
  37624. }
  37625. if (this.props.onValueChanged) {
  37626. this.props.onValueChanged();
  37627. }
  37628. this.setState({ isSelected: !this.state.isSelected });
  37629. };
  37630. CheckBoxLineComponent.prototype.render = function () {
  37631. var _this = this;
  37632. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "checkBoxLine" },
  37633. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "label" }, this.props.label),
  37634. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "checkBox" },
  37635. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { type: "checkbox", id: "checkbox" + this._uniqueId, className: "cbx hidden", checked: this.state.isSelected, onChange: function () { return _this.onChange(); }, disabled: !!this.props.disabled }),
  37636. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("label", { htmlFor: "checkbox" + this._uniqueId, className: "lbl" + (!!this.props.disabled ? ' disabled' : '') }))));
  37637. };
  37638. CheckBoxLineComponent._UniqueIdSeed = 0;
  37639. return CheckBoxLineComponent;
  37640. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37641. /***/ }),
  37642. /***/ "./sharedComponents/draggableLineComponent.tsx":
  37643. /*!*****************************************************!*\
  37644. !*** ./sharedComponents/draggableLineComponent.tsx ***!
  37645. \*****************************************************/
  37646. /*! exports provided: DraggableLineComponent */
  37647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37648. "use strict";
  37649. __webpack_require__.r(__webpack_exports__);
  37650. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DraggableLineComponent", function() { return DraggableLineComponent; });
  37651. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37652. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37653. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37654. var DraggableLineComponent = /** @class */ (function (_super) {
  37655. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DraggableLineComponent, _super);
  37656. function DraggableLineComponent(props) {
  37657. return _super.call(this, props) || this;
  37658. }
  37659. DraggableLineComponent.prototype.render = function () {
  37660. var _this = this;
  37661. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "draggableLine", title: this.props.tooltip, draggable: true, onDragStart: function (event) {
  37662. event.dataTransfer.setData("babylonjs-material-node", _this.props.data);
  37663. } }, this.props.data.replace("Block", "")));
  37664. };
  37665. return DraggableLineComponent;
  37666. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37667. /***/ }),
  37668. /***/ "./sharedComponents/fileButtonLineComponent.tsx":
  37669. /*!******************************************************!*\
  37670. !*** ./sharedComponents/fileButtonLineComponent.tsx ***!
  37671. \******************************************************/
  37672. /*! exports provided: FileButtonLineComponent */
  37673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37674. "use strict";
  37675. __webpack_require__.r(__webpack_exports__);
  37676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileButtonLineComponent", function() { return FileButtonLineComponent; });
  37677. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37678. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37679. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37680. var FileButtonLineComponent = /** @class */ (function (_super) {
  37681. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FileButtonLineComponent, _super);
  37682. function FileButtonLineComponent(props) {
  37683. var _this = _super.call(this, props) || this;
  37684. _this.uploadRef = react__WEBPACK_IMPORTED_MODULE_1__["createRef"]();
  37685. return _this;
  37686. }
  37687. FileButtonLineComponent.prototype.onChange = function (evt) {
  37688. var files = evt.target.files;
  37689. if (files && files.length) {
  37690. this.props.onClick(files[0]);
  37691. }
  37692. evt.target.value = "";
  37693. };
  37694. FileButtonLineComponent.prototype.render = function () {
  37695. var _this = this;
  37696. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "buttonLine" },
  37697. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("label", { htmlFor: this.props.uploadName ? this.props.uploadName : "file-upload", className: "file-upload" }, this.props.label),
  37698. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { ref: this.uploadRef, id: this.props.uploadName ? this.props.uploadName : "file-upload", type: "file", accept: this.props.accept, onChange: function (evt) { return _this.onChange(evt); } })));
  37699. };
  37700. return FileButtonLineComponent;
  37701. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37702. /***/ }),
  37703. /***/ "./sharedComponents/floatLineComponent.tsx":
  37704. /*!*************************************************!*\
  37705. !*** ./sharedComponents/floatLineComponent.tsx ***!
  37706. \*************************************************/
  37707. /*! exports provided: FloatLineComponent */
  37708. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37709. "use strict";
  37710. __webpack_require__.r(__webpack_exports__);
  37711. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatLineComponent", function() { return FloatLineComponent; });
  37712. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37713. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37714. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37715. var FloatLineComponent = /** @class */ (function (_super) {
  37716. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FloatLineComponent, _super);
  37717. function FloatLineComponent(props) {
  37718. var _this = _super.call(this, props) || this;
  37719. _this._localChange = false;
  37720. var currentValue = _this.props.target[_this.props.propertyName];
  37721. _this.state = { value: currentValue ? (_this.props.isInteger ? currentValue.toFixed(0) : currentValue.toFixed(_this.props.digits || 2)) : "0" };
  37722. _this._store = currentValue;
  37723. var rexp = "(.*\\.";
  37724. var numDigits = _this.props.digits || 2;
  37725. while (numDigits--) {
  37726. rexp += ".";
  37727. }
  37728. rexp += ").+";
  37729. _this._regExp = new RegExp(rexp);
  37730. return _this;
  37731. }
  37732. FloatLineComponent.prototype.shouldComponentUpdate = function (nextProps, nextState) {
  37733. if (this._localChange) {
  37734. this._localChange = false;
  37735. return true;
  37736. }
  37737. var newValue = nextProps.target[nextProps.propertyName];
  37738. var newValueString = newValue ? this.props.isInteger ? newValue.toFixed(0) : newValue.toFixed(this.props.digits || 2) : "0";
  37739. if (newValueString !== nextState.value) {
  37740. nextState.value = newValueString;
  37741. return true;
  37742. }
  37743. return false;
  37744. };
  37745. FloatLineComponent.prototype.raiseOnPropertyChanged = function (newValue, previousValue) {
  37746. if (this.props.onChange) {
  37747. this.props.onChange(newValue);
  37748. }
  37749. if (!this.props.onPropertyChangedObservable) {
  37750. return;
  37751. }
  37752. this.props.onPropertyChangedObservable.notifyObservers({
  37753. object: this.props.target,
  37754. property: this.props.propertyName,
  37755. value: newValue,
  37756. initialValue: previousValue
  37757. });
  37758. };
  37759. FloatLineComponent.prototype.updateValue = function (valueString) {
  37760. if (/[^0-9\.\-]/g.test(valueString)) {
  37761. return;
  37762. }
  37763. valueString = valueString.replace(this._regExp, "$1");
  37764. var valueAsNumber;
  37765. if (this.props.isInteger) {
  37766. valueAsNumber = parseInt(valueString);
  37767. }
  37768. else {
  37769. valueAsNumber = parseFloat(valueString);
  37770. }
  37771. this._localChange = true;
  37772. this.setState({ value: valueString });
  37773. if (isNaN(valueAsNumber)) {
  37774. return;
  37775. }
  37776. if (this.props.max != undefined && (valueAsNumber > this.props.max)) {
  37777. valueAsNumber = this.props.max;
  37778. }
  37779. if (this.props.min != undefined && (valueAsNumber < this.props.min)) {
  37780. valueAsNumber = this.props.min;
  37781. }
  37782. this.props.target[this.props.propertyName] = valueAsNumber;
  37783. this.raiseOnPropertyChanged(valueAsNumber, this._store);
  37784. this._store = valueAsNumber;
  37785. };
  37786. FloatLineComponent.prototype.render = function () {
  37787. var _this = this;
  37788. var className = this.props.smallUI ? "short" : "value";
  37789. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", null, react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: this.props.additionalClass ? this.props.additionalClass + " floatLine" : "floatLine" },
  37790. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "label" }, this.props.label),
  37791. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: className },
  37792. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { type: "number", step: this.props.step || "0.01", className: "numeric-input", onBlur: function (evt) {
  37793. _this.props.globalState.blockKeyboardEvents = false;
  37794. if (_this.props.onEnter) {
  37795. _this.props.onEnter(_this._store);
  37796. }
  37797. }, onKeyDown: function (evt) {
  37798. if (evt.keyCode !== 13) {
  37799. return;
  37800. }
  37801. if (_this.props.onEnter) {
  37802. _this.props.onEnter(_this._store);
  37803. }
  37804. }, onFocus: function () { return _this.props.globalState.blockKeyboardEvents = true; }, value: this.state.value, onChange: function (evt) { return _this.updateValue(evt.target.value); } })))));
  37805. };
  37806. return FloatLineComponent;
  37807. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37808. /***/ }),
  37809. /***/ "./sharedComponents/lineContainerComponent.tsx":
  37810. /*!*****************************************************!*\
  37811. !*** ./sharedComponents/lineContainerComponent.tsx ***!
  37812. \*****************************************************/
  37813. /*! exports provided: LineContainerComponent */
  37814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37815. "use strict";
  37816. __webpack_require__.r(__webpack_exports__);
  37817. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LineContainerComponent", function() { return LineContainerComponent; });
  37818. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37819. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37820. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37821. /* harmony import */ var babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! babylonjs/Misc/dataStorage */ "babylonjs/Misc/observable");
  37822. /* harmony import */ var babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_2__);
  37823. var downArrow = __webpack_require__(/*! ../../imgs/downArrow.svg */ "../imgs/downArrow.svg");
  37824. var LineContainerComponent = /** @class */ (function (_super) {
  37825. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LineContainerComponent, _super);
  37826. function LineContainerComponent(props) {
  37827. var _this = _super.call(this, props) || this;
  37828. var initialState = babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadBoolean(_this.props.title, !_this.props.closed);
  37829. _this.state = { isExpanded: initialState };
  37830. return _this;
  37831. }
  37832. LineContainerComponent.prototype.switchExpandedState = function () {
  37833. var newState = !this.state.isExpanded;
  37834. babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].WriteBoolean(this.props.title, newState);
  37835. this.setState({ isExpanded: newState });
  37836. };
  37837. LineContainerComponent.prototype.renderHeader = function () {
  37838. var _this = this;
  37839. var className = this.state.isExpanded ? "collapse" : "collapse closed";
  37840. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "header", onClick: function () { return _this.switchExpandedState(); } },
  37841. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "title" }, this.props.title),
  37842. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: className },
  37843. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("img", { className: "img", title: this.props.title, src: downArrow }))));
  37844. };
  37845. LineContainerComponent.prototype.render = function () {
  37846. if (!this.state.isExpanded) {
  37847. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "paneContainer" },
  37848. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "paneContainer-content" }, this.renderHeader())));
  37849. }
  37850. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "paneContainer" },
  37851. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "paneContainer-content" },
  37852. this.renderHeader(),
  37853. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "paneList" }, this.props.children))));
  37854. };
  37855. return LineContainerComponent;
  37856. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37857. /***/ }),
  37858. /***/ "./sharedComponents/messageDialog.tsx":
  37859. /*!********************************************!*\
  37860. !*** ./sharedComponents/messageDialog.tsx ***!
  37861. \********************************************/
  37862. /*! exports provided: MessageDialogComponent */
  37863. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37864. "use strict";
  37865. __webpack_require__.r(__webpack_exports__);
  37866. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MessageDialogComponent", function() { return MessageDialogComponent; });
  37867. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37868. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37869. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37870. var MessageDialogComponent = /** @class */ (function (_super) {
  37871. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MessageDialogComponent, _super);
  37872. function MessageDialogComponent(props) {
  37873. var _this = _super.call(this, props) || this;
  37874. _this.state = { message: "", isError: false };
  37875. _this.props.globalState.onErrorMessageDialogRequiredObservable.add(function (message) {
  37876. _this.setState({ message: message, isError: true });
  37877. });
  37878. return _this;
  37879. }
  37880. MessageDialogComponent.prototype.render = function () {
  37881. var _this = this;
  37882. if (!this.state.message) {
  37883. return null;
  37884. }
  37885. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "dialog-container" },
  37886. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "dialog" },
  37887. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "dialog-message" }, this.state.message),
  37888. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "dialog-buttons" },
  37889. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "dialog-button-ok" + (this.state.isError ? " error" : ""), onClick: function () { return _this.setState({ message: "" }); } }, "OK")))));
  37890. };
  37891. return MessageDialogComponent;
  37892. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37893. /***/ }),
  37894. /***/ "./sharedComponents/numericInputComponent.tsx":
  37895. /*!****************************************************!*\
  37896. !*** ./sharedComponents/numericInputComponent.tsx ***!
  37897. \****************************************************/
  37898. /*! exports provided: NumericInputComponent */
  37899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37900. "use strict";
  37901. __webpack_require__.r(__webpack_exports__);
  37902. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumericInputComponent", function() { return NumericInputComponent; });
  37903. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  37904. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  37905. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  37906. var NumericInputComponent = /** @class */ (function (_super) {
  37907. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NumericInputComponent, _super);
  37908. function NumericInputComponent(props) {
  37909. var _this = _super.call(this, props) || this;
  37910. _this._localChange = false;
  37911. _this.state = { value: _this.props.value.toFixed(3) };
  37912. return _this;
  37913. }
  37914. NumericInputComponent.prototype.shouldComponentUpdate = function (nextProps, nextState) {
  37915. if (this._localChange) {
  37916. this._localChange = false;
  37917. return true;
  37918. }
  37919. if (nextProps.value.toString() !== nextState.value) {
  37920. nextState.value = nextProps.value.toFixed(3);
  37921. return true;
  37922. }
  37923. return false;
  37924. };
  37925. NumericInputComponent.prototype.updateValue = function (evt) {
  37926. var value = evt.target.value;
  37927. if (/[^0-9\.\-]/g.test(value)) {
  37928. return;
  37929. }
  37930. var valueAsNumber = parseFloat(value);
  37931. this._localChange = true;
  37932. this.setState({ value: value });
  37933. if (isNaN(valueAsNumber)) {
  37934. return;
  37935. }
  37936. this.props.onChange(valueAsNumber);
  37937. };
  37938. NumericInputComponent.prototype.render = function () {
  37939. var _this = this;
  37940. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "numeric" },
  37941. this.props.label &&
  37942. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "numeric-label" }, this.props.label + ": "),
  37943. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { type: "number", onFocus: function () { return _this.props.globalState.blockKeyboardEvents = true; }, onBlur: function (evt) {
  37944. _this.props.globalState.blockKeyboardEvents = false;
  37945. }, step: this.props.step, className: "numeric-input", value: this.state.value, onChange: function (evt) { return _this.updateValue(evt); } })));
  37946. };
  37947. NumericInputComponent.defaultProps = {
  37948. step: 1,
  37949. };
  37950. return NumericInputComponent;
  37951. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  37952. /***/ }),
  37953. /***/ "./sharedComponents/popup.ts":
  37954. /*!***********************************!*\
  37955. !*** ./sharedComponents/popup.ts ***!
  37956. \***********************************/
  37957. /*! exports provided: Popup */
  37958. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37959. "use strict";
  37960. __webpack_require__.r(__webpack_exports__);
  37961. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Popup", function() { return Popup; });
  37962. var Popup = /** @class */ (function () {
  37963. function Popup() {
  37964. }
  37965. Popup.CreatePopup = function (title, windowVariableName, width, height) {
  37966. var _this = this;
  37967. if (width === void 0) { width = 300; }
  37968. if (height === void 0) { height = 800; }
  37969. var windowCreationOptionsList = {
  37970. width: width,
  37971. height: height,
  37972. top: (window.innerHeight - width) / 2 + window.screenY,
  37973. left: (window.innerWidth - height) / 2 + window.screenX
  37974. };
  37975. var windowCreationOptions = Object.keys(windowCreationOptionsList)
  37976. .map(function (key) { return key + '=' + windowCreationOptionsList[key]; })
  37977. .join(',');
  37978. var popupWindow = window.open("", title, windowCreationOptions);
  37979. if (!popupWindow) {
  37980. return null;
  37981. }
  37982. var parentDocument = popupWindow.document;
  37983. // Font
  37984. var newLinkEl = parentDocument.createElement('link');
  37985. newLinkEl.rel = 'stylesheet';
  37986. newLinkEl.href = "https://use.typekit.net/cta4xsb.css";
  37987. parentDocument.head.appendChild(newLinkEl);
  37988. parentDocument.title = title;
  37989. parentDocument.body.style.width = "100%";
  37990. parentDocument.body.style.height = "100%";
  37991. parentDocument.body.style.margin = "0";
  37992. parentDocument.body.style.padding = "0";
  37993. var parentControl = parentDocument.createElement("div");
  37994. parentControl.style.width = "100%";
  37995. parentControl.style.height = "100%";
  37996. parentControl.style.margin = "0";
  37997. parentControl.style.padding = "0";
  37998. popupWindow.document.body.appendChild(parentControl);
  37999. this._CopyStyles(window.document, parentDocument);
  38000. setTimeout(function () {
  38001. _this._CopyStyles(window.document, parentDocument);
  38002. }, 0);
  38003. this[windowVariableName] = popupWindow;
  38004. return parentControl;
  38005. };
  38006. Popup._CopyStyles = function (sourceDoc, targetDoc) {
  38007. for (var index = 0; index < sourceDoc.styleSheets.length; index++) {
  38008. var styleSheet = sourceDoc.styleSheets[index];
  38009. try {
  38010. if (styleSheet.cssRules) { // for <style> elements
  38011. var newStyleEl = sourceDoc.createElement('style');
  38012. for (var _i = 0, _a = styleSheet.cssRules; _i < _a.length; _i++) {
  38013. var cssRule = _a[_i];
  38014. // write the text of each rule into the body of the style element
  38015. newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText));
  38016. }
  38017. targetDoc.head.appendChild(newStyleEl);
  38018. }
  38019. else if (styleSheet.href) { // for <link> elements loading CSS from a URL
  38020. var newLinkEl = sourceDoc.createElement('link');
  38021. newLinkEl.rel = 'stylesheet';
  38022. newLinkEl.href = styleSheet.href;
  38023. targetDoc.head.appendChild(newLinkEl);
  38024. }
  38025. }
  38026. catch (e) {
  38027. console.log(e);
  38028. }
  38029. }
  38030. };
  38031. return Popup;
  38032. }());
  38033. /***/ }),
  38034. /***/ "./sharedComponents/sliderLineComponent.tsx":
  38035. /*!**************************************************!*\
  38036. !*** ./sharedComponents/sliderLineComponent.tsx ***!
  38037. \**************************************************/
  38038. /*! exports provided: SliderLineComponent */
  38039. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38040. "use strict";
  38041. __webpack_require__.r(__webpack_exports__);
  38042. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SliderLineComponent", function() { return SliderLineComponent; });
  38043. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  38044. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  38045. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  38046. /* harmony import */ var babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! babylonjs/Misc/tools */ "babylonjs/Misc/observable");
  38047. /* harmony import */ var babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_2__);
  38048. /* harmony import */ var _floatLineComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./floatLineComponent */ "./sharedComponents/floatLineComponent.tsx");
  38049. var SliderLineComponent = /** @class */ (function (_super) {
  38050. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SliderLineComponent, _super);
  38051. function SliderLineComponent(props) {
  38052. var _this = _super.call(this, props) || this;
  38053. _this._localChange = false;
  38054. if (_this.props.directValue !== undefined) {
  38055. _this.state = {
  38056. value: _this.props.directValue
  38057. };
  38058. }
  38059. else {
  38060. var value = _this.props.target[_this.props.propertyName];
  38061. if (value === undefined) {
  38062. value = _this.props.maximum;
  38063. }
  38064. _this.state = { value: value };
  38065. }
  38066. return _this;
  38067. }
  38068. SliderLineComponent.prototype.shouldComponentUpdate = function (nextProps, nextState) {
  38069. if (nextProps.directValue !== undefined) {
  38070. nextState.value = nextProps.directValue;
  38071. return true;
  38072. }
  38073. var currentState = nextProps.target[nextProps.propertyName];
  38074. if (currentState === undefined) {
  38075. currentState = nextProps.maximum;
  38076. }
  38077. if (currentState !== nextState.value || nextProps.minimum !== this.props.minimum || nextProps.maximum !== this.props.maximum || this._localChange) {
  38078. nextState.value = Math.min(Math.max(currentState, nextProps.minimum), nextProps.maximum);
  38079. this._localChange = false;
  38080. return true;
  38081. }
  38082. return false;
  38083. };
  38084. SliderLineComponent.prototype.onChange = function (newValueString) {
  38085. this._localChange = true;
  38086. var newValue = parseFloat(newValueString);
  38087. if (this.props.useEuler) {
  38088. newValue = babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_2__["Tools"].ToRadians(newValue);
  38089. }
  38090. if (this.props.target) {
  38091. if (this.props.onPropertyChangedObservable) {
  38092. this.props.onPropertyChangedObservable.notifyObservers({
  38093. object: this.props.target,
  38094. property: this.props.propertyName,
  38095. value: newValue,
  38096. initialValue: this.state.value
  38097. });
  38098. }
  38099. this.props.target[this.props.propertyName] = newValue;
  38100. }
  38101. if (this.props.onChange) {
  38102. this.props.onChange(newValue);
  38103. }
  38104. this.setState({ value: newValue });
  38105. };
  38106. SliderLineComponent.prototype.onInput = function (newValueString) {
  38107. var newValue = parseFloat(newValueString);
  38108. if (this.props.onInput) {
  38109. this.props.onInput(newValue);
  38110. }
  38111. };
  38112. SliderLineComponent.prototype.prepareDataToRead = function (value) {
  38113. if (this.props.useEuler) {
  38114. return babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_2__["Tools"].ToDegrees(value);
  38115. }
  38116. return value;
  38117. };
  38118. SliderLineComponent.prototype.render = function () {
  38119. var _this = this;
  38120. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "sliderLine" },
  38121. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "label" }, this.props.label),
  38122. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_floatLineComponent__WEBPACK_IMPORTED_MODULE_3__["FloatLineComponent"], { globalState: this.props.globalState, smallUI: true, label: "", target: this.state, propertyName: "value", min: this.prepareDataToRead(this.props.minimum), max: this.prepareDataToRead(this.props.maximum), onEnter: function () {
  38123. _this.onChange(_this.state.value);
  38124. } }),
  38125. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "slider" },
  38126. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { className: "range", type: "range", step: this.props.step, min: this.prepareDataToRead(this.props.minimum), max: this.prepareDataToRead(this.props.maximum), value: this.prepareDataToRead(this.state.value), onInput: function (evt) { return _this.onInput(evt.target.value); }, onChange: function (evt) { return _this.onChange(evt.target.value); } }))));
  38127. };
  38128. return SliderLineComponent;
  38129. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  38130. /***/ }),
  38131. /***/ "./sharedComponents/textLineComponent.tsx":
  38132. /*!************************************************!*\
  38133. !*** ./sharedComponents/textLineComponent.tsx ***!
  38134. \************************************************/
  38135. /*! exports provided: TextLineComponent */
  38136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38137. "use strict";
  38138. __webpack_require__.r(__webpack_exports__);
  38139. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextLineComponent", function() { return TextLineComponent; });
  38140. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  38141. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  38142. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  38143. var TextLineComponent = /** @class */ (function (_super) {
  38144. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TextLineComponent, _super);
  38145. function TextLineComponent(props) {
  38146. return _super.call(this, props) || this;
  38147. }
  38148. TextLineComponent.prototype.onLink = function () {
  38149. if (!this.props.onLink) {
  38150. return;
  38151. }
  38152. this.props.onLink();
  38153. };
  38154. TextLineComponent.prototype.renderContent = function () {
  38155. var _this = this;
  38156. if (this.props.onLink) {
  38157. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "link-value", title: this.props.value, onClick: function () { return _this.onLink(); } }, this.props.value || "no name"));
  38158. }
  38159. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "value", title: this.props.value, style: { color: this.props.color ? this.props.color : "" } }, this.props.value || "no name"));
  38160. };
  38161. TextLineComponent.prototype.render = function () {
  38162. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: this.props.underline ? "textLine underline" : "textLine" },
  38163. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "label" }, this.props.label),
  38164. this.renderContent()));
  38165. };
  38166. return TextLineComponent;
  38167. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  38168. /***/ }),
  38169. /***/ "./workbenchEditor.tsx":
  38170. /*!*****************************!*\
  38171. !*** ./workbenchEditor.tsx ***!
  38172. \*****************************/
  38173. /*! exports provided: WorkbenchEditor */
  38174. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38175. "use strict";
  38176. __webpack_require__.r(__webpack_exports__);
  38177. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkbenchEditor", function() { return WorkbenchEditor; });
  38178. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  38179. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
  38180. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  38181. /* harmony import */ var _components_nodeList_guiListComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/nodeList/guiListComponent */ "./components/nodeList/guiListComponent.tsx");
  38182. /* harmony import */ var _components_propertyTab_propertyTabComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/propertyTab/propertyTabComponent */ "./components/propertyTab/propertyTabComponent.tsx");
  38183. /* harmony import */ var _portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./portal */ "./portal.tsx");
  38184. /* harmony import */ var _components_log_logComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/log/logComponent */ "./components/log/logComponent.tsx");
  38185. /* harmony import */ var babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! babylonjs/Misc/dataStorage */ "babylonjs/Misc/observable");
  38186. /* harmony import */ var babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__);
  38187. /* harmony import */ var _blockTools__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./blockTools */ "./blockTools.ts");
  38188. /* harmony import */ var _diagram_workbench__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagram/workbench */ "./diagram/workbench.tsx");
  38189. /* harmony import */ var _sharedComponents_messageDialog__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./sharedComponents/messageDialog */ "./sharedComponents/messageDialog.tsx");
  38190. __webpack_require__(/*! ./main.scss */ "./main.scss");
  38191. ;
  38192. var WorkbenchEditor = /** @class */ (function (_super) {
  38193. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WorkbenchEditor, _super);
  38194. function WorkbenchEditor(props) {
  38195. var _this = _super.call(this, props) || this;
  38196. _this._leftWidth = babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__["DataStorage"].ReadNumber("LeftWidth", 200);
  38197. _this._rightWidth = babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__["DataStorage"].ReadNumber("RightWidth", 300);
  38198. _this._blocks = new Array();
  38199. _this.handlePopUp = function () {
  38200. _this.setState({
  38201. showPreviewPopUp: true
  38202. });
  38203. _this.props.globalState.hostWindow.addEventListener('beforeunload', _this.handleClosingPopUp);
  38204. };
  38205. _this.handleClosingPopUp = function () {
  38206. _this._popUpWindow.close();
  38207. };
  38208. _this.createPopupWindow = function (title, windowVariableName, width, height) {
  38209. if (width === void 0) { width = 500; }
  38210. if (height === void 0) { height = 500; }
  38211. var windowCreationOptionsList = {
  38212. width: width,
  38213. height: height,
  38214. top: (_this.props.globalState.hostWindow.innerHeight - width) / 2 + window.screenY,
  38215. left: (_this.props.globalState.hostWindow.innerWidth - height) / 2 + window.screenX
  38216. };
  38217. var windowCreationOptions = Object.keys(windowCreationOptionsList)
  38218. .map(function (key) { return key + '=' + windowCreationOptionsList[key]; })
  38219. .join(',');
  38220. var popupWindow = _this.props.globalState.hostWindow.open("", title, windowCreationOptions);
  38221. if (!popupWindow) {
  38222. return null;
  38223. }
  38224. var parentDocument = popupWindow.document;
  38225. parentDocument.title = title;
  38226. parentDocument.body.style.width = "100%";
  38227. parentDocument.body.style.height = "100%";
  38228. parentDocument.body.style.margin = "0";
  38229. parentDocument.body.style.padding = "0";
  38230. var parentControl = parentDocument.createElement("div");
  38231. parentControl.style.width = "100%";
  38232. parentControl.style.height = "100%";
  38233. parentControl.style.margin = "0";
  38234. parentControl.style.padding = "0";
  38235. parentControl.style.display = "grid";
  38236. parentControl.style.gridTemplateRows = "40px auto";
  38237. parentControl.id = 'node-editor-graph-root';
  38238. parentControl.className = 'right-panel';
  38239. popupWindow.document.body.appendChild(parentControl);
  38240. _this.copyStyles(_this.props.globalState.hostWindow.document, parentDocument);
  38241. _this[windowVariableName] = popupWindow;
  38242. _this._popUpWindow = popupWindow;
  38243. return popupWindow;
  38244. };
  38245. _this.copyStyles = function (sourceDoc, targetDoc) {
  38246. var styleContainer = [];
  38247. for (var index = 0; index < sourceDoc.styleSheets.length; index++) {
  38248. var styleSheet = sourceDoc.styleSheets[index];
  38249. try {
  38250. if (styleSheet.href) { // for <link> elements loading CSS from a URL
  38251. var newLinkEl = sourceDoc.createElement('link');
  38252. newLinkEl.rel = 'stylesheet';
  38253. newLinkEl.href = styleSheet.href;
  38254. targetDoc.head.appendChild(newLinkEl);
  38255. styleContainer.push(newLinkEl);
  38256. }
  38257. else if (styleSheet.cssRules) { // for <style> elements
  38258. var newStyleEl = sourceDoc.createElement('style');
  38259. for (var _i = 0, _a = styleSheet.cssRules; _i < _a.length; _i++) {
  38260. var cssRule = _a[_i];
  38261. newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText));
  38262. }
  38263. targetDoc.head.appendChild(newStyleEl);
  38264. styleContainer.push(newStyleEl);
  38265. }
  38266. }
  38267. catch (e) {
  38268. console.log(e);
  38269. }
  38270. }
  38271. };
  38272. _this.fixPopUpStyles = function (document) {
  38273. var previewContainer = document.getElementById("preview");
  38274. if (previewContainer) {
  38275. previewContainer.style.height = "auto";
  38276. previewContainer.style.gridRow = "1";
  38277. }
  38278. var previewConfigBar = document.getElementById("preview-config-bar");
  38279. if (previewConfigBar) {
  38280. previewConfigBar.style.gridRow = "2";
  38281. }
  38282. var newWindowButton = document.getElementById('preview-new-window');
  38283. if (newWindowButton) {
  38284. newWindowButton.style.display = 'none';
  38285. }
  38286. var previewMeshBar = document.getElementById('preview-mesh-bar');
  38287. if (previewMeshBar) {
  38288. previewMeshBar.style.gridTemplateColumns = "auto 1fr 40px 40px";
  38289. }
  38290. };
  38291. _this.state = {
  38292. showPreviewPopUp: false
  38293. };
  38294. _this.props.globalState.onZoomToFitRequiredObservable.add(function () {
  38295. _this.zoomToFit();
  38296. });
  38297. _this.props.globalState.onReOrganizedRequiredObservable.add(function () {
  38298. _this.reOrganize();
  38299. });
  38300. _this.props.globalState.hostDocument.addEventListener("keydown", function (evt) {
  38301. if ((evt.keyCode === 46 || evt.keyCode === 8) && !_this.props.globalState.blockKeyboardEvents) { // Delete
  38302. var selectedItems = _this._workbenchCanvas.selectedGuiNodes;
  38303. for (var _i = 0, selectedItems_1 = selectedItems; _i < selectedItems_1.length; _i++) {
  38304. var selectedItem = selectedItems_1[_i];
  38305. selectedItem.dispose();
  38306. }
  38307. _this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  38308. _this.props.globalState.onRebuildRequiredObservable.notifyObservers();
  38309. return;
  38310. }
  38311. if (!evt.ctrlKey || _this.props.globalState.blockKeyboardEvents) {
  38312. return;
  38313. }
  38314. if (evt.key === "c") { // Copy
  38315. var selectedItems = _this._workbenchCanvas.selectedGuiNodes;
  38316. if (!selectedItems.length) {
  38317. return;
  38318. }
  38319. var selectedItem_1 = selectedItems[0];
  38320. if (!selectedItem_1.guiNode) {
  38321. return;
  38322. }
  38323. }
  38324. else if (evt.key === "v") { // Paste
  38325. //TODO: Implement
  38326. }
  38327. }, false);
  38328. return _this;
  38329. }
  38330. /**
  38331. * Creates a node and recursivly creates its parent nodes from it's input
  38332. * @param block
  38333. */
  38334. WorkbenchEditor.prototype.createNodeFromObject = function (block, recursion) {
  38335. if (recursion === void 0) { recursion = true; }
  38336. if (this._blocks.indexOf(block) !== -1) {
  38337. return this._workbenchCanvas.nodes.filter(function (n) { return n.guiNode === block; })[0];
  38338. }
  38339. this._blocks.push(block);
  38340. //TODO: Implement
  38341. var node = null;
  38342. return node;
  38343. };
  38344. WorkbenchEditor.prototype.componentDidMount = function () {
  38345. if (this.props.globalState.hostDocument) {
  38346. this._workbenchCanvas = this.refs["graphCanvas"];
  38347. }
  38348. if (navigator.userAgent.indexOf("Mobile") !== -1) {
  38349. (this.props.globalState.hostDocument || document).querySelector(".blocker").style.visibility = "visible";
  38350. }
  38351. };
  38352. WorkbenchEditor.prototype.componentWillUnmount = function () {
  38353. if (this.props.globalState.hostDocument) {
  38354. this.props.globalState.hostDocument.removeEventListener("keyup", this._onWidgetKeyUpPointer, false);
  38355. }
  38356. };
  38357. WorkbenchEditor.prototype.pasteSelection = function (copiedNodes, currentX, currentY, selectNew) {
  38358. //let originalNode: Nullable<GUINode> = null;
  38359. if (selectNew === void 0) { selectNew = false; }
  38360. var newNodes = [];
  38361. // Copy to prevent recursive side effects while creating nodes.
  38362. copiedNodes = copiedNodes.slice();
  38363. // Cancel selection
  38364. this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  38365. // Create new nodes
  38366. for (var _i = 0, copiedNodes_1 = copiedNodes; _i < copiedNodes_1.length; _i++) {
  38367. var node = copiedNodes_1[_i];
  38368. var block = node.guiNode;
  38369. if (!block) {
  38370. continue;
  38371. }
  38372. }
  38373. return newNodes;
  38374. };
  38375. WorkbenchEditor.prototype.zoomToFit = function () {
  38376. this._workbenchCanvas.zoomToFit();
  38377. };
  38378. WorkbenchEditor.prototype.buildMaterial = function () {
  38379. this.props.globalState.onLogRequiredObservable.notifyObservers(new _components_log_logComponent__WEBPACK_IMPORTED_MODULE_5__["LogEntry"]("Node material build successful", false));
  38380. this.props.globalState.onBuiltObservable.notifyObservers();
  38381. };
  38382. WorkbenchEditor.prototype.showWaitScreen = function () {
  38383. var _a;
  38384. (_a = this.props.globalState.hostDocument.querySelector(".wait-screen")) === null || _a === void 0 ? void 0 : _a.classList.remove("hidden");
  38385. };
  38386. WorkbenchEditor.prototype.hideWaitScreen = function () {
  38387. var _a;
  38388. (_a = this.props.globalState.hostDocument.querySelector(".wait-screen")) === null || _a === void 0 ? void 0 : _a.classList.add("hidden");
  38389. };
  38390. WorkbenchEditor.prototype.reOrganize = function (editorData, isImportingAFrame) {
  38391. var _this = this;
  38392. if (editorData === void 0) { editorData = null; }
  38393. if (isImportingAFrame === void 0) { isImportingAFrame = false; }
  38394. this.showWaitScreen();
  38395. this._workbenchCanvas._isLoading = true; // Will help loading large graphes
  38396. setTimeout(function () {
  38397. if (!editorData || !editorData.locations) {
  38398. _this._workbenchCanvas.distributeGraph();
  38399. }
  38400. else {
  38401. // Locations
  38402. for (var _i = 0, _a = editorData.locations; _i < _a.length; _i++) {
  38403. var location = _a[_i];
  38404. for (var _b = 0, _c = _this._workbenchCanvas.nodes; _b < _c.length; _b++) {
  38405. var node = _c[_b];
  38406. if (node.guiNode && node.guiNode.uniqueId === location.blockId) {
  38407. node.x = location.x;
  38408. node.y = location.y;
  38409. node.cleanAccumulation();
  38410. break;
  38411. }
  38412. }
  38413. }
  38414. }
  38415. _this._workbenchCanvas._isLoading = false;
  38416. for (var _d = 0, _e = _this._workbenchCanvas.nodes; _d < _e.length; _d++) {
  38417. var node = _e[_d];
  38418. }
  38419. _this.hideWaitScreen();
  38420. });
  38421. };
  38422. WorkbenchEditor.prototype.onPointerDown = function (evt) {
  38423. this._startX = evt.clientX;
  38424. this._moveInProgress = true;
  38425. evt.currentTarget.setPointerCapture(evt.pointerId);
  38426. };
  38427. WorkbenchEditor.prototype.onPointerUp = function (evt) {
  38428. this._moveInProgress = false;
  38429. evt.currentTarget.releasePointerCapture(evt.pointerId);
  38430. };
  38431. WorkbenchEditor.prototype.resizeColumns = function (evt, forLeft) {
  38432. if (forLeft === void 0) { forLeft = true; }
  38433. if (!this._moveInProgress) {
  38434. return;
  38435. }
  38436. var deltaX = evt.clientX - this._startX;
  38437. var rootElement = evt.currentTarget.ownerDocument.getElementById("node-editor-graph-root");
  38438. if (forLeft) {
  38439. this._leftWidth += deltaX;
  38440. this._leftWidth = Math.max(150, Math.min(400, this._leftWidth));
  38441. babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__["DataStorage"].WriteNumber("LeftWidth", this._leftWidth);
  38442. }
  38443. else {
  38444. this._rightWidth -= deltaX;
  38445. this._rightWidth = Math.max(250, Math.min(500, this._rightWidth));
  38446. babylonjs_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__["DataStorage"].WriteNumber("RightWidth", this._rightWidth);
  38447. rootElement.ownerDocument.getElementById("preview").style.height = this._rightWidth + "px";
  38448. }
  38449. rootElement.style.gridTemplateColumns = this.buildColumnLayout();
  38450. this._startX = evt.clientX;
  38451. };
  38452. WorkbenchEditor.prototype.buildColumnLayout = function () {
  38453. return this._leftWidth + "px 4px calc(100% - " + (this._leftWidth + 8 + this._rightWidth) + "px) 4px " + this._rightWidth + "px";
  38454. };
  38455. WorkbenchEditor.prototype.emitNewBlock = function (event) {
  38456. var data = event.dataTransfer.getData("babylonjs-material-node");
  38457. var guiElement = _blockTools__WEBPACK_IMPORTED_MODULE_7__["BlockTools"].GetGuiFromString(data);
  38458. var newGuiNode = this._workbenchCanvas.appendBlock(guiElement);
  38459. //TODO: Get correct positioning
  38460. /*let x = event.clientX; // - event.currentTarget.offsetLeft - this._workbenchCanvas.x;
  38461. let y = event.clientY; // - event.currentTarget.offsetTop - this._workbenchCanvas.y - 20;
  38462. newGuiNode.x += (x - newGuiNode.x);
  38463. newGuiNode.y += y - newGuiNode.y;
  38464. //newGuiNode.cleanAccumulation();*/
  38465. this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  38466. this.props.globalState.onSelectionChangedObservable.notifyObservers(newGuiNode);
  38467. this.forceUpdate();
  38468. };
  38469. WorkbenchEditor.prototype.render = function () {
  38470. var _this = this;
  38471. return (react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_portal__WEBPACK_IMPORTED_MODULE_4__["Portal"], { globalState: this.props.globalState },
  38472. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "gui-editor-workbench-root", style: {
  38473. gridTemplateColumns: this.buildColumnLayout()
  38474. }, onMouseMove: function (evt) {
  38475. // this._mouseLocationX = evt.pageX;
  38476. // this._mouseLocationY = evt.pageY;
  38477. }, onMouseDown: function (evt) {
  38478. if (evt.target.nodeName === "INPUT") {
  38479. return;
  38480. }
  38481. _this.props.globalState.blockKeyboardEvents = false;
  38482. } },
  38483. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_components_nodeList_guiListComponent__WEBPACK_IMPORTED_MODULE_2__["GuiListComponent"], { globalState: this.props.globalState }),
  38484. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "leftGrab", onPointerDown: function (evt) { return _this.onPointerDown(evt); }, onPointerUp: function (evt) { return _this.onPointerUp(evt); }, onPointerMove: function (evt) { return _this.resizeColumns(evt); } }),
  38485. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "diagram-container", onDrop: function (event) {
  38486. _this.emitNewBlock(event);
  38487. }, onDragOver: function (event) {
  38488. event.preventDefault();
  38489. } },
  38490. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_diagram_workbench__WEBPACK_IMPORTED_MODULE_8__["WorkbenchComponent"], { ref: "graphCanvas", globalState: this.props.globalState })),
  38491. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { id: "rightGrab", onPointerDown: function (evt) { return _this.onPointerDown(evt); }, onPointerUp: function (evt) { return _this.onPointerUp(evt); }, onPointerMove: function (evt) { return _this.resizeColumns(evt, false); } }),
  38492. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "right-panel" },
  38493. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_components_propertyTab_propertyTabComponent__WEBPACK_IMPORTED_MODULE_3__["PropertyTabComponent"], { globalState: this.props.globalState })),
  38494. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_components_log_logComponent__WEBPACK_IMPORTED_MODULE_5__["LogComponent"], { globalState: this.props.globalState })),
  38495. react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_messageDialog__WEBPACK_IMPORTED_MODULE_9__["MessageDialogComponent"], { globalState: this.props.globalState }),
  38496. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "blocker" }, "Node Material Editor runs only on desktop"),
  38497. react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { className: "wait-screen hidden" }, "Processing...please wait")));
  38498. };
  38499. return WorkbenchEditor;
  38500. }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
  38501. /***/ }),
  38502. /***/ "babylonjs-gui/2D/controls/button":
  38503. /*!************************************************************************************************************************!*\
  38504. !*** external {"root":["BABYLON","GUI"],"commonjs":"babylonjs-gui","commonjs2":"babylonjs-gui","amd":"babylonjs-gui"} ***!
  38505. \************************************************************************************************************************/
  38506. /*! no static exports found */
  38507. /***/ (function(module, exports) {
  38508. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_gui_2D_controls_button__;
  38509. /***/ }),
  38510. /***/ "babylonjs/Misc/observable":
  38511. /*!****************************************************************************************************!*\
  38512. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  38513. \****************************************************************************************************/
  38514. /*! no static exports found */
  38515. /***/ (function(module, exports) {
  38516. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_observable__;
  38517. /***/ })
  38518. /******/ });
  38519. });
  38520. //# sourceMappingURL=babylon.guiEditor.max.js.map