bundle.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId])
  10. /******/ return installedModules[moduleId].exports;
  11. /******/
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/
  39. /******/ // define getter function for harmony exports
  40. /******/ __webpack_require__.d = function(exports, name, getter) {
  41. /******/ if(!__webpack_require__.o(exports, name)) {
  42. /******/ Object.defineProperty(exports, name, {
  43. /******/ configurable: false,
  44. /******/ enumerable: true,
  45. /******/ get: getter
  46. /******/ });
  47. /******/ }
  48. /******/ };
  49. /******/
  50. /******/ // getDefaultExport function for compatibility with non-harmony modules
  51. /******/ __webpack_require__.n = function(module) {
  52. /******/ var getter = module && module.__esModule ?
  53. /******/ function getDefault() { return module['default']; } :
  54. /******/ function getModuleExports() { return module; };
  55. /******/ __webpack_require__.d(getter, 'a', getter);
  56. /******/ return getter;
  57. /******/ };
  58. /******/
  59. /******/ // Object.prototype.hasOwnProperty.call
  60. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  61. /******/
  62. /******/ // __webpack_public_path__
  63. /******/ __webpack_require__.p = "";
  64. /******/
  65. /******/ // Load entry module and return exports
  66. /******/ return __webpack_require__(__webpack_require__.s = 92);
  67. /******/ })
  68. /************************************************************************/
  69. /******/ ([
  70. /* 0 */
  71. /***/ (function(module, exports, __webpack_require__) {
  72. "use strict";
  73. /**
  74. * Copyright (c) 2013-present, Facebook, Inc.
  75. * All rights reserved.
  76. *
  77. * This source code is licensed under the BSD-style license found in the
  78. * LICENSE file in the root directory of this source tree. An additional grant
  79. * of patent rights can be found in the PATENTS file in the same directory.
  80. *
  81. */
  82. /**
  83. * Use invariant() to assert state which your program assumes to be true.
  84. *
  85. * Provide sprintf-style format (only %s is supported) and arguments
  86. * to provide information about what broke and what you were
  87. * expecting.
  88. *
  89. * The invariant message will be stripped in production, but the invariant
  90. * will remain to ensure logic does not differ in production.
  91. */
  92. var validateFormat = function validateFormat(format) {};
  93. if (false) {
  94. validateFormat = function validateFormat(format) {
  95. if (format === undefined) {
  96. throw new Error('invariant requires an error message argument');
  97. }
  98. };
  99. }
  100. function invariant(condition, format, a, b, c, d, e, f) {
  101. validateFormat(format);
  102. if (!condition) {
  103. var error;
  104. if (format === undefined) {
  105. error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
  106. } else {
  107. var args = [a, b, c, d, e, f];
  108. var argIndex = 0;
  109. error = new Error(format.replace(/%s/g, function () {
  110. return args[argIndex++];
  111. }));
  112. error.name = 'Invariant Violation';
  113. }
  114. error.framesToPop = 1; // we don't care about invariant's own frame
  115. throw error;
  116. }
  117. }
  118. module.exports = invariant;
  119. /***/ }),
  120. /* 1 */
  121. /***/ (function(module, exports, __webpack_require__) {
  122. "use strict";
  123. /**
  124. * Copyright 2014-2015, Facebook, Inc.
  125. * All rights reserved.
  126. *
  127. * This source code is licensed under the BSD-style license found in the
  128. * LICENSE file in the root directory of this source tree. An additional grant
  129. * of patent rights can be found in the PATENTS file in the same directory.
  130. *
  131. */
  132. var emptyFunction = __webpack_require__(9);
  133. /**
  134. * Similar to invariant but only logs a warning if the condition is not met.
  135. * This can be used to log issues in development environments in critical
  136. * paths. Removing the logging code for production environments will keep the
  137. * same logic and follow the same code paths.
  138. */
  139. var warning = emptyFunction;
  140. if (false) {
  141. (function () {
  142. var printWarning = function printWarning(format) {
  143. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  144. args[_key - 1] = arguments[_key];
  145. }
  146. var argIndex = 0;
  147. var message = 'Warning: ' + format.replace(/%s/g, function () {
  148. return args[argIndex++];
  149. });
  150. if (typeof console !== 'undefined') {
  151. console.error(message);
  152. }
  153. try {
  154. // --- Welcome to debugging React ---
  155. // This error was thrown as a convenience so that you can use this stack
  156. // to find the callsite that caused this warning to fire.
  157. throw new Error(message);
  158. } catch (x) {}
  159. };
  160. warning = function warning(condition, format) {
  161. if (format === undefined) {
  162. throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
  163. }
  164. if (format.indexOf('Failed Composite propType: ') === 0) {
  165. return; // Ignore CompositeComponent proptype check.
  166. }
  167. if (!condition) {
  168. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  169. args[_key2 - 2] = arguments[_key2];
  170. }
  171. printWarning.apply(undefined, [format].concat(args));
  172. }
  173. };
  174. })();
  175. }
  176. module.exports = warning;
  177. /***/ }),
  178. /* 2 */
  179. /***/ (function(module, exports, __webpack_require__) {
  180. "use strict";
  181. /**
  182. * Copyright (c) 2013-present, Facebook, Inc.
  183. * All rights reserved.
  184. *
  185. * This source code is licensed under the BSD-style license found in the
  186. * LICENSE file in the root directory of this source tree. An additional grant
  187. * of patent rights can be found in the PATENTS file in the same directory.
  188. *
  189. *
  190. */
  191. /**
  192. * WARNING: DO NOT manually require this module.
  193. * This is a replacement for `invariant(...)` used by the error code system
  194. * and will _only_ be required by the corresponding babel pass.
  195. * It always throws.
  196. */
  197. function reactProdInvariant(code) {
  198. var argCount = arguments.length - 1;
  199. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  200. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  201. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  202. }
  203. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  204. var error = new Error(message);
  205. error.name = 'Invariant Violation';
  206. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  207. throw error;
  208. }
  209. module.exports = reactProdInvariant;
  210. /***/ }),
  211. /* 3 */
  212. /***/ (function(module, exports, __webpack_require__) {
  213. "use strict";
  214. /*
  215. object-assign
  216. (c) Sindre Sorhus
  217. @license MIT
  218. */
  219. /* eslint-disable no-unused-vars */
  220. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  221. var hasOwnProperty = Object.prototype.hasOwnProperty;
  222. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  223. function toObject(val) {
  224. if (val === null || val === undefined) {
  225. throw new TypeError('Object.assign cannot be called with null or undefined');
  226. }
  227. return Object(val);
  228. }
  229. function shouldUseNative() {
  230. try {
  231. if (!Object.assign) {
  232. return false;
  233. }
  234. // Detect buggy property enumeration order in older V8 versions.
  235. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  236. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  237. test1[5] = 'de';
  238. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  239. return false;
  240. }
  241. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  242. var test2 = {};
  243. for (var i = 0; i < 10; i++) {
  244. test2['_' + String.fromCharCode(i)] = i;
  245. }
  246. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  247. return test2[n];
  248. });
  249. if (order2.join('') !== '0123456789') {
  250. return false;
  251. }
  252. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  253. var test3 = {};
  254. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  255. test3[letter] = letter;
  256. });
  257. if (Object.keys(Object.assign({}, test3)).join('') !==
  258. 'abcdefghijklmnopqrst') {
  259. return false;
  260. }
  261. return true;
  262. } catch (err) {
  263. // We don't expect any of the above to throw, but better to be safe.
  264. return false;
  265. }
  266. }
  267. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  268. var from;
  269. var to = toObject(target);
  270. var symbols;
  271. for (var s = 1; s < arguments.length; s++) {
  272. from = Object(arguments[s]);
  273. for (var key in from) {
  274. if (hasOwnProperty.call(from, key)) {
  275. to[key] = from[key];
  276. }
  277. }
  278. if (getOwnPropertySymbols) {
  279. symbols = getOwnPropertySymbols(from);
  280. for (var i = 0; i < symbols.length; i++) {
  281. if (propIsEnumerable.call(from, symbols[i])) {
  282. to[symbols[i]] = from[symbols[i]];
  283. }
  284. }
  285. }
  286. }
  287. return to;
  288. };
  289. /***/ }),
  290. /* 4 */
  291. /***/ (function(module, exports, __webpack_require__) {
  292. "use strict";
  293. /**
  294. * Copyright 2013-present, Facebook, Inc.
  295. * All rights reserved.
  296. *
  297. * This source code is licensed under the BSD-style license found in the
  298. * LICENSE file in the root directory of this source tree. An additional grant
  299. * of patent rights can be found in the PATENTS file in the same directory.
  300. *
  301. */
  302. var _prodInvariant = __webpack_require__(2);
  303. var DOMProperty = __webpack_require__(18);
  304. var ReactDOMComponentFlags = __webpack_require__(61);
  305. var invariant = __webpack_require__(0);
  306. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  307. var Flags = ReactDOMComponentFlags;
  308. var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
  309. /**
  310. * Check if a given node should be cached.
  311. */
  312. function shouldPrecacheNode(node, nodeID) {
  313. return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
  314. }
  315. /**
  316. * Drill down (through composites and empty components) until we get a host or
  317. * host text component.
  318. *
  319. * This is pretty polymorphic but unavoidable with the current structure we have
  320. * for `_renderedChildren`.
  321. */
  322. function getRenderedHostOrTextFromComponent(component) {
  323. var rendered;
  324. while (rendered = component._renderedComponent) {
  325. component = rendered;
  326. }
  327. return component;
  328. }
  329. /**
  330. * Populate `_hostNode` on the rendered host/text component with the given
  331. * DOM node. The passed `inst` can be a composite.
  332. */
  333. function precacheNode(inst, node) {
  334. var hostInst = getRenderedHostOrTextFromComponent(inst);
  335. hostInst._hostNode = node;
  336. node[internalInstanceKey] = hostInst;
  337. }
  338. function uncacheNode(inst) {
  339. var node = inst._hostNode;
  340. if (node) {
  341. delete node[internalInstanceKey];
  342. inst._hostNode = null;
  343. }
  344. }
  345. /**
  346. * Populate `_hostNode` on each child of `inst`, assuming that the children
  347. * match up with the DOM (element) children of `node`.
  348. *
  349. * We cache entire levels at once to avoid an n^2 problem where we access the
  350. * children of a node sequentially and have to walk from the start to our target
  351. * node every time.
  352. *
  353. * Since we update `_renderedChildren` and the actual DOM at (slightly)
  354. * different times, we could race here and see a newer `_renderedChildren` than
  355. * the DOM nodes we see. To avoid this, ReactMultiChild calls
  356. * `prepareToManageChildren` before we change `_renderedChildren`, at which
  357. * time the container's child nodes are always cached (until it unmounts).
  358. */
  359. function precacheChildNodes(inst, node) {
  360. if (inst._flags & Flags.hasCachedChildNodes) {
  361. return;
  362. }
  363. var children = inst._renderedChildren;
  364. var childNode = node.firstChild;
  365. outer: for (var name in children) {
  366. if (!children.hasOwnProperty(name)) {
  367. continue;
  368. }
  369. var childInst = children[name];
  370. var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
  371. if (childID === 0) {
  372. // We're currently unmounting this child in ReactMultiChild; skip it.
  373. continue;
  374. }
  375. // We assume the child nodes are in the same order as the child instances.
  376. for (; childNode !== null; childNode = childNode.nextSibling) {
  377. if (shouldPrecacheNode(childNode, childID)) {
  378. precacheNode(childInst, childNode);
  379. continue outer;
  380. }
  381. }
  382. // We reached the end of the DOM children without finding an ID match.
  383. true ? false ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
  384. }
  385. inst._flags |= Flags.hasCachedChildNodes;
  386. }
  387. /**
  388. * Given a DOM node, return the closest ReactDOMComponent or
  389. * ReactDOMTextComponent instance ancestor.
  390. */
  391. function getClosestInstanceFromNode(node) {
  392. if (node[internalInstanceKey]) {
  393. return node[internalInstanceKey];
  394. }
  395. // Walk up the tree until we find an ancestor whose instance we have cached.
  396. var parents = [];
  397. while (!node[internalInstanceKey]) {
  398. parents.push(node);
  399. if (node.parentNode) {
  400. node = node.parentNode;
  401. } else {
  402. // Top of the tree. This node must not be part of a React tree (or is
  403. // unmounted, potentially).
  404. return null;
  405. }
  406. }
  407. var closest;
  408. var inst;
  409. for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
  410. closest = inst;
  411. if (parents.length) {
  412. precacheChildNodes(inst, node);
  413. }
  414. }
  415. return closest;
  416. }
  417. /**
  418. * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
  419. * instance, or null if the node was not rendered by this React.
  420. */
  421. function getInstanceFromNode(node) {
  422. var inst = getClosestInstanceFromNode(node);
  423. if (inst != null && inst._hostNode === node) {
  424. return inst;
  425. } else {
  426. return null;
  427. }
  428. }
  429. /**
  430. * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
  431. * DOM node.
  432. */
  433. function getNodeFromInstance(inst) {
  434. // Without this first invariant, passing a non-DOM-component triggers the next
  435. // invariant for a missing parent, which is super confusing.
  436. !(inst._hostNode !== undefined) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  437. if (inst._hostNode) {
  438. return inst._hostNode;
  439. }
  440. // Walk up the tree until we find an ancestor whose DOM node we have cached.
  441. var parents = [];
  442. while (!inst._hostNode) {
  443. parents.push(inst);
  444. !inst._hostParent ? false ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
  445. inst = inst._hostParent;
  446. }
  447. // Now parents contains each ancestor that does *not* have a cached native
  448. // node, and `inst` is the deepest ancestor that does.
  449. for (; parents.length; inst = parents.pop()) {
  450. precacheChildNodes(inst, inst._hostNode);
  451. }
  452. return inst._hostNode;
  453. }
  454. var ReactDOMComponentTree = {
  455. getClosestInstanceFromNode: getClosestInstanceFromNode,
  456. getInstanceFromNode: getInstanceFromNode,
  457. getNodeFromInstance: getNodeFromInstance,
  458. precacheChildNodes: precacheChildNodes,
  459. precacheNode: precacheNode,
  460. uncacheNode: uncacheNode
  461. };
  462. module.exports = ReactDOMComponentTree;
  463. /***/ }),
  464. /* 5 */
  465. /***/ (function(module, exports, __webpack_require__) {
  466. "use strict";
  467. /**
  468. * Copyright (c) 2013-present, Facebook, Inc.
  469. * All rights reserved.
  470. *
  471. * This source code is licensed under the BSD-style license found in the
  472. * LICENSE file in the root directory of this source tree. An additional grant
  473. * of patent rights can be found in the PATENTS file in the same directory.
  474. *
  475. */
  476. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  477. /**
  478. * Simple, lightweight module assisting with the detection and context of
  479. * Worker. Helps avoid circular dependencies and allows code to reason about
  480. * whether or not they are in a Worker, even if they never include the main
  481. * `ReactWorker` dependency.
  482. */
  483. var ExecutionEnvironment = {
  484. canUseDOM: canUseDOM,
  485. canUseWorkers: typeof Worker !== 'undefined',
  486. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  487. canUseViewport: canUseDOM && !!window.screen,
  488. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  489. };
  490. module.exports = ExecutionEnvironment;
  491. /***/ }),
  492. /* 6 */
  493. /***/ (function(module, exports) {
  494. /*
  495. MIT License http://www.opensource.org/licenses/mit-license.php
  496. Author Tobias Koppers @sokra
  497. */
  498. // css base code, injected by the css-loader
  499. module.exports = function() {
  500. var list = [];
  501. // return the list of modules as css string
  502. list.toString = function toString() {
  503. var result = [];
  504. for(var i = 0; i < this.length; i++) {
  505. var item = this[i];
  506. if(item[2]) {
  507. result.push("@media " + item[2] + "{" + item[1] + "}");
  508. } else {
  509. result.push(item[1]);
  510. }
  511. }
  512. return result.join("");
  513. };
  514. // import a list of modules into the list
  515. list.i = function(modules, mediaQuery) {
  516. if(typeof modules === "string")
  517. modules = [[null, modules, ""]];
  518. var alreadyImportedModules = {};
  519. for(var i = 0; i < this.length; i++) {
  520. var id = this[i][0];
  521. if(typeof id === "number")
  522. alreadyImportedModules[id] = true;
  523. }
  524. for(i = 0; i < modules.length; i++) {
  525. var item = modules[i];
  526. // skip already imported module
  527. // this implementation is not 100% perfect for weird media query combinations
  528. // when a module is imported multiple times with different media queries.
  529. // I hope this will never occur (Hey this way we have smaller bundles)
  530. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  531. if(mediaQuery && !item[2]) {
  532. item[2] = mediaQuery;
  533. } else if(mediaQuery) {
  534. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  535. }
  536. list.push(item);
  537. }
  538. }
  539. };
  540. return list;
  541. };
  542. /***/ }),
  543. /* 7 */
  544. /***/ (function(module, exports, __webpack_require__) {
  545. "use strict";
  546. module.exports = __webpack_require__(20);
  547. /***/ }),
  548. /* 8 */
  549. /***/ (function(module, exports, __webpack_require__) {
  550. /*
  551. MIT License http://www.opensource.org/licenses/mit-license.php
  552. Author Tobias Koppers @sokra
  553. */
  554. var stylesInDom = {},
  555. memoize = function(fn) {
  556. var memo;
  557. return function () {
  558. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  559. return memo;
  560. };
  561. },
  562. isOldIE = memoize(function() {
  563. // Test for IE <= 9 as proposed by Browserhacks
  564. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  565. // Tests for existence of standard globals is to allow style-loader
  566. // to operate correctly into non-standard environments
  567. // @see https://github.com/webpack-contrib/style-loader/issues/177
  568. return window && document && document.all && !window.atob;
  569. }),
  570. getElement = (function(fn) {
  571. var memo = {};
  572. return function(selector) {
  573. if (typeof memo[selector] === "undefined") {
  574. memo[selector] = fn.call(this, selector);
  575. }
  576. return memo[selector]
  577. };
  578. })(function (styleTarget) {
  579. return document.querySelector(styleTarget)
  580. }),
  581. singletonElement = null,
  582. singletonCounter = 0,
  583. styleElementsInsertedAtTop = [],
  584. fixUrls = __webpack_require__(111);
  585. module.exports = function(list, options) {
  586. if(typeof DEBUG !== "undefined" && DEBUG) {
  587. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  588. }
  589. options = options || {};
  590. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  591. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  592. // tags it will allow on a page
  593. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  594. // By default, add <style> tags to the <head> element
  595. if (typeof options.insertInto === "undefined") options.insertInto = "head";
  596. // By default, add <style> tags to the bottom of the target
  597. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  598. var styles = listToStyles(list);
  599. addStylesToDom(styles, options);
  600. return function update(newList) {
  601. var mayRemove = [];
  602. for(var i = 0; i < styles.length; i++) {
  603. var item = styles[i];
  604. var domStyle = stylesInDom[item.id];
  605. domStyle.refs--;
  606. mayRemove.push(domStyle);
  607. }
  608. if(newList) {
  609. var newStyles = listToStyles(newList);
  610. addStylesToDom(newStyles, options);
  611. }
  612. for(var i = 0; i < mayRemove.length; i++) {
  613. var domStyle = mayRemove[i];
  614. if(domStyle.refs === 0) {
  615. for(var j = 0; j < domStyle.parts.length; j++)
  616. domStyle.parts[j]();
  617. delete stylesInDom[domStyle.id];
  618. }
  619. }
  620. };
  621. };
  622. function addStylesToDom(styles, options) {
  623. for(var i = 0; i < styles.length; i++) {
  624. var item = styles[i];
  625. var domStyle = stylesInDom[item.id];
  626. if(domStyle) {
  627. domStyle.refs++;
  628. for(var j = 0; j < domStyle.parts.length; j++) {
  629. domStyle.parts[j](item.parts[j]);
  630. }
  631. for(; j < item.parts.length; j++) {
  632. domStyle.parts.push(addStyle(item.parts[j], options));
  633. }
  634. } else {
  635. var parts = [];
  636. for(var j = 0; j < item.parts.length; j++) {
  637. parts.push(addStyle(item.parts[j], options));
  638. }
  639. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  640. }
  641. }
  642. }
  643. function listToStyles(list) {
  644. var styles = [];
  645. var newStyles = {};
  646. for(var i = 0; i < list.length; i++) {
  647. var item = list[i];
  648. var id = item[0];
  649. var css = item[1];
  650. var media = item[2];
  651. var sourceMap = item[3];
  652. var part = {css: css, media: media, sourceMap: sourceMap};
  653. if(!newStyles[id])
  654. styles.push(newStyles[id] = {id: id, parts: [part]});
  655. else
  656. newStyles[id].parts.push(part);
  657. }
  658. return styles;
  659. }
  660. function insertStyleElement(options, styleElement) {
  661. var styleTarget = getElement(options.insertInto)
  662. if (!styleTarget) {
  663. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  664. }
  665. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  666. if (options.insertAt === "top") {
  667. if(!lastStyleElementInsertedAtTop) {
  668. styleTarget.insertBefore(styleElement, styleTarget.firstChild);
  669. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  670. styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  671. } else {
  672. styleTarget.appendChild(styleElement);
  673. }
  674. styleElementsInsertedAtTop.push(styleElement);
  675. } else if (options.insertAt === "bottom") {
  676. styleTarget.appendChild(styleElement);
  677. } else {
  678. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  679. }
  680. }
  681. function removeStyleElement(styleElement) {
  682. styleElement.parentNode.removeChild(styleElement);
  683. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  684. if(idx >= 0) {
  685. styleElementsInsertedAtTop.splice(idx, 1);
  686. }
  687. }
  688. function createStyleElement(options) {
  689. var styleElement = document.createElement("style");
  690. options.attrs.type = "text/css";
  691. attachTagAttrs(styleElement, options.attrs);
  692. insertStyleElement(options, styleElement);
  693. return styleElement;
  694. }
  695. function createLinkElement(options) {
  696. var linkElement = document.createElement("link");
  697. options.attrs.type = "text/css";
  698. options.attrs.rel = "stylesheet";
  699. attachTagAttrs(linkElement, options.attrs);
  700. insertStyleElement(options, linkElement);
  701. return linkElement;
  702. }
  703. function attachTagAttrs(element, attrs) {
  704. Object.keys(attrs).forEach(function (key) {
  705. element.setAttribute(key, attrs[key]);
  706. });
  707. }
  708. function addStyle(obj, options) {
  709. var styleElement, update, remove;
  710. if (options.singleton) {
  711. var styleIndex = singletonCounter++;
  712. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  713. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  714. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  715. } else if(obj.sourceMap &&
  716. typeof URL === "function" &&
  717. typeof URL.createObjectURL === "function" &&
  718. typeof URL.revokeObjectURL === "function" &&
  719. typeof Blob === "function" &&
  720. typeof btoa === "function") {
  721. styleElement = createLinkElement(options);
  722. update = updateLink.bind(null, styleElement, options);
  723. remove = function() {
  724. removeStyleElement(styleElement);
  725. if(styleElement.href)
  726. URL.revokeObjectURL(styleElement.href);
  727. };
  728. } else {
  729. styleElement = createStyleElement(options);
  730. update = applyToTag.bind(null, styleElement);
  731. remove = function() {
  732. removeStyleElement(styleElement);
  733. };
  734. }
  735. update(obj);
  736. return function updateStyle(newObj) {
  737. if(newObj) {
  738. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  739. return;
  740. update(obj = newObj);
  741. } else {
  742. remove();
  743. }
  744. };
  745. }
  746. var replaceText = (function () {
  747. var textStore = [];
  748. return function (index, replacement) {
  749. textStore[index] = replacement;
  750. return textStore.filter(Boolean).join('\n');
  751. };
  752. })();
  753. function applyToSingletonTag(styleElement, index, remove, obj) {
  754. var css = remove ? "" : obj.css;
  755. if (styleElement.styleSheet) {
  756. styleElement.styleSheet.cssText = replaceText(index, css);
  757. } else {
  758. var cssNode = document.createTextNode(css);
  759. var childNodes = styleElement.childNodes;
  760. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  761. if (childNodes.length) {
  762. styleElement.insertBefore(cssNode, childNodes[index]);
  763. } else {
  764. styleElement.appendChild(cssNode);
  765. }
  766. }
  767. }
  768. function applyToTag(styleElement, obj) {
  769. var css = obj.css;
  770. var media = obj.media;
  771. if(media) {
  772. styleElement.setAttribute("media", media)
  773. }
  774. if(styleElement.styleSheet) {
  775. styleElement.styleSheet.cssText = css;
  776. } else {
  777. while(styleElement.firstChild) {
  778. styleElement.removeChild(styleElement.firstChild);
  779. }
  780. styleElement.appendChild(document.createTextNode(css));
  781. }
  782. }
  783. function updateLink(linkElement, options, obj) {
  784. var css = obj.css;
  785. var sourceMap = obj.sourceMap;
  786. /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  787. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  788. on by default. Otherwise default to the convertToAbsoluteUrls option
  789. directly
  790. */
  791. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  792. if (options.convertToAbsoluteUrls || autoFixUrls){
  793. css = fixUrls(css);
  794. }
  795. if(sourceMap) {
  796. // http://stackoverflow.com/a/26603875
  797. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  798. }
  799. var blob = new Blob([css], { type: "text/css" });
  800. var oldSrc = linkElement.href;
  801. linkElement.href = URL.createObjectURL(blob);
  802. if(oldSrc)
  803. URL.revokeObjectURL(oldSrc);
  804. }
  805. /***/ }),
  806. /* 9 */
  807. /***/ (function(module, exports, __webpack_require__) {
  808. "use strict";
  809. /**
  810. * Copyright (c) 2013-present, Facebook, Inc.
  811. * All rights reserved.
  812. *
  813. * This source code is licensed under the BSD-style license found in the
  814. * LICENSE file in the root directory of this source tree. An additional grant
  815. * of patent rights can be found in the PATENTS file in the same directory.
  816. *
  817. *
  818. */
  819. function makeEmptyFunction(arg) {
  820. return function () {
  821. return arg;
  822. };
  823. }
  824. /**
  825. * This function accepts and discards inputs; it has no side effects. This is
  826. * primarily useful idiomatically for overridable function endpoints which
  827. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  828. */
  829. var emptyFunction = function emptyFunction() {};
  830. emptyFunction.thatReturns = makeEmptyFunction;
  831. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  832. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  833. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  834. emptyFunction.thatReturnsThis = function () {
  835. return this;
  836. };
  837. emptyFunction.thatReturnsArgument = function (arg) {
  838. return arg;
  839. };
  840. module.exports = emptyFunction;
  841. /***/ }),
  842. /* 10 */
  843. /***/ (function(module, exports, __webpack_require__) {
  844. "use strict";
  845. /**
  846. * Copyright 2016-present, Facebook, Inc.
  847. * All rights reserved.
  848. *
  849. * This source code is licensed under the BSD-style license found in the
  850. * LICENSE file in the root directory of this source tree. An additional grant
  851. * of patent rights can be found in the PATENTS file in the same directory.
  852. *
  853. *
  854. */
  855. // Trust the developer to only use ReactInstrumentation with a __DEV__ check
  856. var debugTool = null;
  857. if (false) {
  858. var ReactDebugTool = require('./ReactDebugTool');
  859. debugTool = ReactDebugTool;
  860. }
  861. module.exports = { debugTool: debugTool };
  862. /***/ }),
  863. /* 11 */
  864. /***/ (function(module, exports, __webpack_require__) {
  865. "use strict";
  866. /**
  867. * Copyright 2013-present, Facebook, Inc.
  868. * All rights reserved.
  869. *
  870. * This source code is licensed under the BSD-style license found in the
  871. * LICENSE file in the root directory of this source tree. An additional grant
  872. * of patent rights can be found in the PATENTS file in the same directory.
  873. *
  874. */
  875. var _prodInvariant = __webpack_require__(2),
  876. _assign = __webpack_require__(3);
  877. var CallbackQueue = __webpack_require__(59);
  878. var PooledClass = __webpack_require__(15);
  879. var ReactFeatureFlags = __webpack_require__(64);
  880. var ReactReconciler = __webpack_require__(19);
  881. var Transaction = __webpack_require__(30);
  882. var invariant = __webpack_require__(0);
  883. var dirtyComponents = [];
  884. var updateBatchNumber = 0;
  885. var asapCallbackQueue = CallbackQueue.getPooled();
  886. var asapEnqueued = false;
  887. var batchingStrategy = null;
  888. function ensureInjected() {
  889. !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? false ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
  890. }
  891. var NESTED_UPDATES = {
  892. initialize: function () {
  893. this.dirtyComponentsLength = dirtyComponents.length;
  894. },
  895. close: function () {
  896. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  897. // Additional updates were enqueued by componentDidUpdate handlers or
  898. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  899. // these new updates so that if A's componentDidUpdate calls setState on
  900. // B, B will update before the callback A's updater provided when calling
  901. // setState.
  902. dirtyComponents.splice(0, this.dirtyComponentsLength);
  903. flushBatchedUpdates();
  904. } else {
  905. dirtyComponents.length = 0;
  906. }
  907. }
  908. };
  909. var UPDATE_QUEUEING = {
  910. initialize: function () {
  911. this.callbackQueue.reset();
  912. },
  913. close: function () {
  914. this.callbackQueue.notifyAll();
  915. }
  916. };
  917. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  918. function ReactUpdatesFlushTransaction() {
  919. this.reinitializeTransaction();
  920. this.dirtyComponentsLength = null;
  921. this.callbackQueue = CallbackQueue.getPooled();
  922. this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  923. /* useCreateElement */true);
  924. }
  925. _assign(ReactUpdatesFlushTransaction.prototype, Transaction, {
  926. getTransactionWrappers: function () {
  927. return TRANSACTION_WRAPPERS;
  928. },
  929. destructor: function () {
  930. this.dirtyComponentsLength = null;
  931. CallbackQueue.release(this.callbackQueue);
  932. this.callbackQueue = null;
  933. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  934. this.reconcileTransaction = null;
  935. },
  936. perform: function (method, scope, a) {
  937. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  938. // with this transaction's wrappers around it.
  939. return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
  940. }
  941. });
  942. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  943. function batchedUpdates(callback, a, b, c, d, e) {
  944. ensureInjected();
  945. return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
  946. }
  947. /**
  948. * Array comparator for ReactComponents by mount ordering.
  949. *
  950. * @param {ReactComponent} c1 first component you're comparing
  951. * @param {ReactComponent} c2 second component you're comparing
  952. * @return {number} Return value usable by Array.prototype.sort().
  953. */
  954. function mountOrderComparator(c1, c2) {
  955. return c1._mountOrder - c2._mountOrder;
  956. }
  957. function runBatchedUpdates(transaction) {
  958. var len = transaction.dirtyComponentsLength;
  959. !(len === dirtyComponents.length) ? false ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
  960. // Since reconciling a component higher in the owner hierarchy usually (not
  961. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  962. // them before their children by sorting the array.
  963. dirtyComponents.sort(mountOrderComparator);
  964. // Any updates enqueued while reconciling must be performed after this entire
  965. // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
  966. // C, B could update twice in a single batch if C's render enqueues an update
  967. // to B (since B would have already updated, we should skip it, and the only
  968. // way we can know to do so is by checking the batch counter).
  969. updateBatchNumber++;
  970. for (var i = 0; i < len; i++) {
  971. // If a component is unmounted before pending changes apply, it will still
  972. // be here, but we assume that it has cleared its _pendingCallbacks and
  973. // that performUpdateIfNecessary is a noop.
  974. var component = dirtyComponents[i];
  975. // If performUpdateIfNecessary happens to enqueue any new updates, we
  976. // shouldn't execute the callbacks until the next render happens, so
  977. // stash the callbacks first
  978. var callbacks = component._pendingCallbacks;
  979. component._pendingCallbacks = null;
  980. var markerName;
  981. if (ReactFeatureFlags.logTopLevelRenders) {
  982. var namedComponent = component;
  983. // Duck type TopLevelWrapper. This is probably always true.
  984. if (component._currentElement.type.isReactTopLevelWrapper) {
  985. namedComponent = component._renderedComponent;
  986. }
  987. markerName = 'React update: ' + namedComponent.getName();
  988. console.time(markerName);
  989. }
  990. ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
  991. if (markerName) {
  992. console.timeEnd(markerName);
  993. }
  994. if (callbacks) {
  995. for (var j = 0; j < callbacks.length; j++) {
  996. transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
  997. }
  998. }
  999. }
  1000. }
  1001. var flushBatchedUpdates = function () {
  1002. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  1003. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  1004. // componentDidUpdate) but we need to check here too in order to catch
  1005. // updates enqueued by setState callbacks and asap calls.
  1006. while (dirtyComponents.length || asapEnqueued) {
  1007. if (dirtyComponents.length) {
  1008. var transaction = ReactUpdatesFlushTransaction.getPooled();
  1009. transaction.perform(runBatchedUpdates, null, transaction);
  1010. ReactUpdatesFlushTransaction.release(transaction);
  1011. }
  1012. if (asapEnqueued) {
  1013. asapEnqueued = false;
  1014. var queue = asapCallbackQueue;
  1015. asapCallbackQueue = CallbackQueue.getPooled();
  1016. queue.notifyAll();
  1017. CallbackQueue.release(queue);
  1018. }
  1019. }
  1020. };
  1021. /**
  1022. * Mark a component as needing a rerender, adding an optional callback to a
  1023. * list of functions which will be executed once the rerender occurs.
  1024. */
  1025. function enqueueUpdate(component) {
  1026. ensureInjected();
  1027. // Various parts of our code (such as ReactCompositeComponent's
  1028. // _renderValidatedComponent) assume that calls to render aren't nested;
  1029. // verify that that's the case. (This is called by each top-level update
  1030. // function, like setState, forceUpdate, etc.; creation and
  1031. // destruction of top-level components is guarded in ReactMount.)
  1032. if (!batchingStrategy.isBatchingUpdates) {
  1033. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  1034. return;
  1035. }
  1036. dirtyComponents.push(component);
  1037. if (component._updateBatchNumber == null) {
  1038. component._updateBatchNumber = updateBatchNumber + 1;
  1039. }
  1040. }
  1041. /**
  1042. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  1043. * if no updates are currently being performed.
  1044. */
  1045. function asap(callback, context) {
  1046. !batchingStrategy.isBatchingUpdates ? false ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
  1047. asapCallbackQueue.enqueue(callback, context);
  1048. asapEnqueued = true;
  1049. }
  1050. var ReactUpdatesInjection = {
  1051. injectReconcileTransaction: function (ReconcileTransaction) {
  1052. !ReconcileTransaction ? false ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
  1053. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  1054. },
  1055. injectBatchingStrategy: function (_batchingStrategy) {
  1056. !_batchingStrategy ? false ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
  1057. !(typeof _batchingStrategy.batchedUpdates === 'function') ? false ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
  1058. !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? false ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
  1059. batchingStrategy = _batchingStrategy;
  1060. }
  1061. };
  1062. var ReactUpdates = {
  1063. /**
  1064. * React references `ReactReconcileTransaction` using this property in order
  1065. * to allow dependency injection.
  1066. *
  1067. * @internal
  1068. */
  1069. ReactReconcileTransaction: null,
  1070. batchedUpdates: batchedUpdates,
  1071. enqueueUpdate: enqueueUpdate,
  1072. flushBatchedUpdates: flushBatchedUpdates,
  1073. injection: ReactUpdatesInjection,
  1074. asap: asap
  1075. };
  1076. module.exports = ReactUpdates;
  1077. /***/ }),
  1078. /* 12 */
  1079. /***/ (function(module, exports, __webpack_require__) {
  1080. "use strict";
  1081. /**
  1082. * Copyright 2013-present, Facebook, Inc.
  1083. * All rights reserved.
  1084. *
  1085. * This source code is licensed under the BSD-style license found in the
  1086. * LICENSE file in the root directory of this source tree. An additional grant
  1087. * of patent rights can be found in the PATENTS file in the same directory.
  1088. *
  1089. */
  1090. var _assign = __webpack_require__(3);
  1091. var PooledClass = __webpack_require__(15);
  1092. var emptyFunction = __webpack_require__(9);
  1093. var warning = __webpack_require__(1);
  1094. var didWarnForAddedNewProperty = false;
  1095. var isProxySupported = typeof Proxy === 'function';
  1096. var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
  1097. /**
  1098. * @interface Event
  1099. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  1100. */
  1101. var EventInterface = {
  1102. type: null,
  1103. target: null,
  1104. // currentTarget is set when dispatching; no use in copying it here
  1105. currentTarget: emptyFunction.thatReturnsNull,
  1106. eventPhase: null,
  1107. bubbles: null,
  1108. cancelable: null,
  1109. timeStamp: function (event) {
  1110. return event.timeStamp || Date.now();
  1111. },
  1112. defaultPrevented: null,
  1113. isTrusted: null
  1114. };
  1115. /**
  1116. * Synthetic events are dispatched by event plugins, typically in response to a
  1117. * top-level event delegation handler.
  1118. *
  1119. * These systems should generally use pooling to reduce the frequency of garbage
  1120. * collection. The system should check `isPersistent` to determine whether the
  1121. * event should be released into the pool after being dispatched. Users that
  1122. * need a persisted event should invoke `persist`.
  1123. *
  1124. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  1125. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  1126. * DOM interface; custom application-specific events can also subclass this.
  1127. *
  1128. * @param {object} dispatchConfig Configuration used to dispatch this event.
  1129. * @param {*} targetInst Marker identifying the event target.
  1130. * @param {object} nativeEvent Native browser event.
  1131. * @param {DOMEventTarget} nativeEventTarget Target node.
  1132. */
  1133. function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
  1134. if (false) {
  1135. // these have a getter/setter for warnings
  1136. delete this.nativeEvent;
  1137. delete this.preventDefault;
  1138. delete this.stopPropagation;
  1139. }
  1140. this.dispatchConfig = dispatchConfig;
  1141. this._targetInst = targetInst;
  1142. this.nativeEvent = nativeEvent;
  1143. var Interface = this.constructor.Interface;
  1144. for (var propName in Interface) {
  1145. if (!Interface.hasOwnProperty(propName)) {
  1146. continue;
  1147. }
  1148. if (false) {
  1149. delete this[propName]; // this has a getter/setter for warnings
  1150. }
  1151. var normalize = Interface[propName];
  1152. if (normalize) {
  1153. this[propName] = normalize(nativeEvent);
  1154. } else {
  1155. if (propName === 'target') {
  1156. this.target = nativeEventTarget;
  1157. } else {
  1158. this[propName] = nativeEvent[propName];
  1159. }
  1160. }
  1161. }
  1162. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  1163. if (defaultPrevented) {
  1164. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1165. } else {
  1166. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  1167. }
  1168. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  1169. return this;
  1170. }
  1171. _assign(SyntheticEvent.prototype, {
  1172. preventDefault: function () {
  1173. this.defaultPrevented = true;
  1174. var event = this.nativeEvent;
  1175. if (!event) {
  1176. return;
  1177. }
  1178. if (event.preventDefault) {
  1179. event.preventDefault();
  1180. } else if (typeof event.returnValue !== 'unknown') {
  1181. // eslint-disable-line valid-typeof
  1182. event.returnValue = false;
  1183. }
  1184. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1185. },
  1186. stopPropagation: function () {
  1187. var event = this.nativeEvent;
  1188. if (!event) {
  1189. return;
  1190. }
  1191. if (event.stopPropagation) {
  1192. event.stopPropagation();
  1193. } else if (typeof event.cancelBubble !== 'unknown') {
  1194. // eslint-disable-line valid-typeof
  1195. // The ChangeEventPlugin registers a "propertychange" event for
  1196. // IE. This event does not support bubbling or cancelling, and
  1197. // any references to cancelBubble throw "Member not found". A
  1198. // typeof check of "unknown" circumvents this issue (and is also
  1199. // IE specific).
  1200. event.cancelBubble = true;
  1201. }
  1202. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  1203. },
  1204. /**
  1205. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  1206. * them back into the pool. This allows a way to hold onto a reference that
  1207. * won't be added back into the pool.
  1208. */
  1209. persist: function () {
  1210. this.isPersistent = emptyFunction.thatReturnsTrue;
  1211. },
  1212. /**
  1213. * Checks if this event should be released back into the pool.
  1214. *
  1215. * @return {boolean} True if this should not be released, false otherwise.
  1216. */
  1217. isPersistent: emptyFunction.thatReturnsFalse,
  1218. /**
  1219. * `PooledClass` looks for `destructor` on each instance it releases.
  1220. */
  1221. destructor: function () {
  1222. var Interface = this.constructor.Interface;
  1223. for (var propName in Interface) {
  1224. if (false) {
  1225. Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
  1226. } else {
  1227. this[propName] = null;
  1228. }
  1229. }
  1230. for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
  1231. this[shouldBeReleasedProperties[i]] = null;
  1232. }
  1233. if (false) {
  1234. Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
  1235. Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
  1236. Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
  1237. }
  1238. }
  1239. });
  1240. SyntheticEvent.Interface = EventInterface;
  1241. if (false) {
  1242. if (isProxySupported) {
  1243. /*eslint-disable no-func-assign */
  1244. SyntheticEvent = new Proxy(SyntheticEvent, {
  1245. construct: function (target, args) {
  1246. return this.apply(target, Object.create(target.prototype), args);
  1247. },
  1248. apply: function (constructor, that, args) {
  1249. return new Proxy(constructor.apply(that, args), {
  1250. set: function (target, prop, value) {
  1251. if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
  1252. process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
  1253. didWarnForAddedNewProperty = true;
  1254. }
  1255. target[prop] = value;
  1256. return true;
  1257. }
  1258. });
  1259. }
  1260. });
  1261. /*eslint-enable no-func-assign */
  1262. }
  1263. }
  1264. /**
  1265. * Helper to reduce boilerplate when creating subclasses.
  1266. *
  1267. * @param {function} Class
  1268. * @param {?object} Interface
  1269. */
  1270. SyntheticEvent.augmentClass = function (Class, Interface) {
  1271. var Super = this;
  1272. var E = function () {};
  1273. E.prototype = Super.prototype;
  1274. var prototype = new E();
  1275. _assign(prototype, Class.prototype);
  1276. Class.prototype = prototype;
  1277. Class.prototype.constructor = Class;
  1278. Class.Interface = _assign({}, Super.Interface, Interface);
  1279. Class.augmentClass = Super.augmentClass;
  1280. PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
  1281. };
  1282. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
  1283. module.exports = SyntheticEvent;
  1284. /**
  1285. * Helper to nullify syntheticEvent instance properties when destructing
  1286. *
  1287. * @param {object} SyntheticEvent
  1288. * @param {String} propName
  1289. * @return {object} defineProperty object
  1290. */
  1291. function getPooledWarningPropertyDefinition(propName, getVal) {
  1292. var isFunction = typeof getVal === 'function';
  1293. return {
  1294. configurable: true,
  1295. set: set,
  1296. get: get
  1297. };
  1298. function set(val) {
  1299. var action = isFunction ? 'setting the method' : 'setting the property';
  1300. warn(action, 'This is effectively a no-op');
  1301. return val;
  1302. }
  1303. function get() {
  1304. var action = isFunction ? 'accessing the method' : 'accessing the property';
  1305. var result = isFunction ? 'This is a no-op function' : 'This is set to null';
  1306. warn(action, result);
  1307. return getVal;
  1308. }
  1309. function warn(action, result) {
  1310. var warningCondition = false;
  1311. false ? warning(warningCondition, '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) : void 0;
  1312. }
  1313. }
  1314. /***/ }),
  1315. /* 13 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. "use strict";
  1318. /**
  1319. * Copyright 2013-present, Facebook, Inc.
  1320. * All rights reserved.
  1321. *
  1322. * This source code is licensed under the BSD-style license found in the
  1323. * LICENSE file in the root directory of this source tree. An additional grant
  1324. * of patent rights can be found in the PATENTS file in the same directory.
  1325. *
  1326. *
  1327. */
  1328. /**
  1329. * Keeps track of the current owner.
  1330. *
  1331. * The current owner is the component who should own any components that are
  1332. * currently being constructed.
  1333. */
  1334. var ReactCurrentOwner = {
  1335. /**
  1336. * @internal
  1337. * @type {ReactComponent}
  1338. */
  1339. current: null
  1340. };
  1341. module.exports = ReactCurrentOwner;
  1342. /***/ }),
  1343. /* 14 */
  1344. /***/ (function(module, exports) {
  1345. /**
  1346. * @author oldj
  1347. * @blog https://oldj.net
  1348. */
  1349. 'use strict';
  1350. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1351. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1352. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1353. var IS_DEV = process.env.ENV === 'dev';
  1354. var _require = require('electron'),
  1355. ipcRenderer = _require.ipcRenderer;
  1356. var platform = process.platform;
  1357. var EventEmitter = require('events');
  1358. var MyEmitter = function (_EventEmitter) {
  1359. _inherits(MyEmitter, _EventEmitter);
  1360. function MyEmitter() {
  1361. _classCallCheck(this, MyEmitter);
  1362. return _possibleConstructorReturn(this, (MyEmitter.__proto__ || Object.getPrototypeOf(MyEmitter)).apply(this, arguments));
  1363. }
  1364. return MyEmitter;
  1365. }(EventEmitter);
  1366. var evt = new MyEmitter();
  1367. var max_listener_count = 20;
  1368. evt.setMaxListeners(max_listener_count);
  1369. ipcRenderer.setMaxListeners(max_listener_count);
  1370. var x_get_idx = 0;
  1371. /**
  1372. * act
  1373. * @param action {String}
  1374. * @param args {Array}
  1375. */
  1376. function act(action) {
  1377. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1378. args[_key - 1] = arguments[_key];
  1379. }
  1380. var fn = ['_cb', new Date().getTime(), x_get_idx++].join('_');
  1381. var callback = void 0;
  1382. if (args.length > 0 && typeof args[args.length - 1] === 'function') {
  1383. callback = args.pop();
  1384. }
  1385. if (typeof callback === 'function') {
  1386. ipcRenderer.once(fn, function (e, d) {
  1387. return callback.apply(null, d);
  1388. });
  1389. }
  1390. ipcRenderer.send('x', {
  1391. action: action,
  1392. data: args,
  1393. callback: fn
  1394. });
  1395. }
  1396. function pact(action) {
  1397. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1398. args[_key2 - 1] = arguments[_key2];
  1399. }
  1400. return new Promise(function (resolve, reject) {
  1401. args.push(function (err, result) {
  1402. return err ? reject(err) : resolve(result);
  1403. });
  1404. act.apply(undefined, [action].concat(args));
  1405. });
  1406. }
  1407. module.exports = {
  1408. IS_DEV: IS_DEV,
  1409. platform: platform,
  1410. act: act,
  1411. pact: pact,
  1412. on: function on() {
  1413. return evt.on.apply(evt, arguments);
  1414. },
  1415. emit: function emit() {
  1416. return evt.emit.apply(evt, arguments);
  1417. }
  1418. };
  1419. /***/ }),
  1420. /* 15 */
  1421. /***/ (function(module, exports, __webpack_require__) {
  1422. "use strict";
  1423. /**
  1424. * Copyright 2013-present, Facebook, Inc.
  1425. * All rights reserved.
  1426. *
  1427. * This source code is licensed under the BSD-style license found in the
  1428. * LICENSE file in the root directory of this source tree. An additional grant
  1429. * of patent rights can be found in the PATENTS file in the same directory.
  1430. *
  1431. *
  1432. */
  1433. var _prodInvariant = __webpack_require__(2);
  1434. var invariant = __webpack_require__(0);
  1435. /**
  1436. * Static poolers. Several custom versions for each potential number of
  1437. * arguments. A completely generic pooler is easy to implement, but would
  1438. * require accessing the `arguments` object. In each of these, `this` refers to
  1439. * the Class itself, not an instance. If any others are needed, simply add them
  1440. * here, or in their own files.
  1441. */
  1442. var oneArgumentPooler = function (copyFieldsFrom) {
  1443. var Klass = this;
  1444. if (Klass.instancePool.length) {
  1445. var instance = Klass.instancePool.pop();
  1446. Klass.call(instance, copyFieldsFrom);
  1447. return instance;
  1448. } else {
  1449. return new Klass(copyFieldsFrom);
  1450. }
  1451. };
  1452. var twoArgumentPooler = function (a1, a2) {
  1453. var Klass = this;
  1454. if (Klass.instancePool.length) {
  1455. var instance = Klass.instancePool.pop();
  1456. Klass.call(instance, a1, a2);
  1457. return instance;
  1458. } else {
  1459. return new Klass(a1, a2);
  1460. }
  1461. };
  1462. var threeArgumentPooler = function (a1, a2, a3) {
  1463. var Klass = this;
  1464. if (Klass.instancePool.length) {
  1465. var instance = Klass.instancePool.pop();
  1466. Klass.call(instance, a1, a2, a3);
  1467. return instance;
  1468. } else {
  1469. return new Klass(a1, a2, a3);
  1470. }
  1471. };
  1472. var fourArgumentPooler = function (a1, a2, a3, a4) {
  1473. var Klass = this;
  1474. if (Klass.instancePool.length) {
  1475. var instance = Klass.instancePool.pop();
  1476. Klass.call(instance, a1, a2, a3, a4);
  1477. return instance;
  1478. } else {
  1479. return new Klass(a1, a2, a3, a4);
  1480. }
  1481. };
  1482. var standardReleaser = function (instance) {
  1483. var Klass = this;
  1484. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  1485. instance.destructor();
  1486. if (Klass.instancePool.length < Klass.poolSize) {
  1487. Klass.instancePool.push(instance);
  1488. }
  1489. };
  1490. var DEFAULT_POOL_SIZE = 10;
  1491. var DEFAULT_POOLER = oneArgumentPooler;
  1492. /**
  1493. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  1494. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  1495. * you give this may have a `poolSize` property, and will look for a
  1496. * prototypical `destructor` on instances.
  1497. *
  1498. * @param {Function} CopyConstructor Constructor that can be used to reset.
  1499. * @param {Function} pooler Customizable pooler.
  1500. */
  1501. var addPoolingTo = function (CopyConstructor, pooler) {
  1502. // Casting as any so that flow ignores the actual implementation and trusts
  1503. // it to match the type we declared
  1504. var NewKlass = CopyConstructor;
  1505. NewKlass.instancePool = [];
  1506. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  1507. if (!NewKlass.poolSize) {
  1508. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  1509. }
  1510. NewKlass.release = standardReleaser;
  1511. return NewKlass;
  1512. };
  1513. var PooledClass = {
  1514. addPoolingTo: addPoolingTo,
  1515. oneArgumentPooler: oneArgumentPooler,
  1516. twoArgumentPooler: twoArgumentPooler,
  1517. threeArgumentPooler: threeArgumentPooler,
  1518. fourArgumentPooler: fourArgumentPooler
  1519. };
  1520. module.exports = PooledClass;
  1521. /***/ }),
  1522. /* 16 */
  1523. /***/ (function(module, exports, __webpack_require__) {
  1524. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1525. Copyright (c) 2016 Jed Watson.
  1526. Licensed under the MIT License (MIT), see
  1527. http://jedwatson.github.io/classnames
  1528. */
  1529. /* global define */
  1530. (function () {
  1531. 'use strict';
  1532. var hasOwn = {}.hasOwnProperty;
  1533. function classNames () {
  1534. var classes = [];
  1535. for (var i = 0; i < arguments.length; i++) {
  1536. var arg = arguments[i];
  1537. if (!arg) continue;
  1538. var argType = typeof arg;
  1539. if (argType === 'string' || argType === 'number') {
  1540. classes.push(arg);
  1541. } else if (Array.isArray(arg)) {
  1542. classes.push(classNames.apply(null, arg));
  1543. } else if (argType === 'object') {
  1544. for (var key in arg) {
  1545. if (hasOwn.call(arg, key) && arg[key]) {
  1546. classes.push(key);
  1547. }
  1548. }
  1549. }
  1550. }
  1551. return classes.join(' ');
  1552. }
  1553. if (typeof module !== 'undefined' && module.exports) {
  1554. module.exports = classNames;
  1555. } else if (true) {
  1556. // register as 'classnames', consistent with npm package name
  1557. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
  1558. return classNames;
  1559. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1560. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1561. } else {
  1562. window.classNames = classNames;
  1563. }
  1564. }());
  1565. /***/ }),
  1566. /* 17 */
  1567. /***/ (function(module, exports, __webpack_require__) {
  1568. "use strict";
  1569. /**
  1570. * Copyright 2015-present, Facebook, Inc.
  1571. * All rights reserved.
  1572. *
  1573. * This source code is licensed under the BSD-style license found in the
  1574. * LICENSE file in the root directory of this source tree. An additional grant
  1575. * of patent rights can be found in the PATENTS file in the same directory.
  1576. *
  1577. */
  1578. var DOMNamespaces = __webpack_require__(36);
  1579. var setInnerHTML = __webpack_require__(32);
  1580. var createMicrosoftUnsafeLocalFunction = __webpack_require__(44);
  1581. var setTextContent = __webpack_require__(76);
  1582. var ELEMENT_NODE_TYPE = 1;
  1583. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  1584. /**
  1585. * In IE (8-11) and Edge, appending nodes with no children is dramatically
  1586. * faster than appending a full subtree, so we essentially queue up the
  1587. * .appendChild calls here and apply them so each node is added to its parent
  1588. * before any children are added.
  1589. *
  1590. * In other browsers, doing so is slower or neutral compared to the other order
  1591. * (in Firefox, twice as slow) so we only do this inversion in IE.
  1592. *
  1593. * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
  1594. */
  1595. var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
  1596. function insertTreeChildren(tree) {
  1597. if (!enableLazy) {
  1598. return;
  1599. }
  1600. var node = tree.node;
  1601. var children = tree.children;
  1602. if (children.length) {
  1603. for (var i = 0; i < children.length; i++) {
  1604. insertTreeBefore(node, children[i], null);
  1605. }
  1606. } else if (tree.html != null) {
  1607. setInnerHTML(node, tree.html);
  1608. } else if (tree.text != null) {
  1609. setTextContent(node, tree.text);
  1610. }
  1611. }
  1612. var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
  1613. // DocumentFragments aren't actually part of the DOM after insertion so
  1614. // appending children won't update the DOM. We need to ensure the fragment
  1615. // is properly populated first, breaking out of our lazy approach for just
  1616. // this level. Also, some <object> plugins (like Flash Player) will read
  1617. // <param> nodes immediately upon insertion into the DOM, so <object>
  1618. // must also be populated prior to insertion into the DOM.
  1619. if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) {
  1620. insertTreeChildren(tree);
  1621. parentNode.insertBefore(tree.node, referenceNode);
  1622. } else {
  1623. parentNode.insertBefore(tree.node, referenceNode);
  1624. insertTreeChildren(tree);
  1625. }
  1626. });
  1627. function replaceChildWithTree(oldNode, newTree) {
  1628. oldNode.parentNode.replaceChild(newTree.node, oldNode);
  1629. insertTreeChildren(newTree);
  1630. }
  1631. function queueChild(parentTree, childTree) {
  1632. if (enableLazy) {
  1633. parentTree.children.push(childTree);
  1634. } else {
  1635. parentTree.node.appendChild(childTree.node);
  1636. }
  1637. }
  1638. function queueHTML(tree, html) {
  1639. if (enableLazy) {
  1640. tree.html = html;
  1641. } else {
  1642. setInnerHTML(tree.node, html);
  1643. }
  1644. }
  1645. function queueText(tree, text) {
  1646. if (enableLazy) {
  1647. tree.text = text;
  1648. } else {
  1649. setTextContent(tree.node, text);
  1650. }
  1651. }
  1652. function toString() {
  1653. return this.node.nodeName;
  1654. }
  1655. function DOMLazyTree(node) {
  1656. return {
  1657. node: node,
  1658. children: [],
  1659. html: null,
  1660. text: null,
  1661. toString: toString
  1662. };
  1663. }
  1664. DOMLazyTree.insertTreeBefore = insertTreeBefore;
  1665. DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
  1666. DOMLazyTree.queueChild = queueChild;
  1667. DOMLazyTree.queueHTML = queueHTML;
  1668. DOMLazyTree.queueText = queueText;
  1669. module.exports = DOMLazyTree;
  1670. /***/ }),
  1671. /* 18 */
  1672. /***/ (function(module, exports, __webpack_require__) {
  1673. "use strict";
  1674. /**
  1675. * Copyright 2013-present, Facebook, Inc.
  1676. * All rights reserved.
  1677. *
  1678. * This source code is licensed under the BSD-style license found in the
  1679. * LICENSE file in the root directory of this source tree. An additional grant
  1680. * of patent rights can be found in the PATENTS file in the same directory.
  1681. *
  1682. */
  1683. var _prodInvariant = __webpack_require__(2);
  1684. var invariant = __webpack_require__(0);
  1685. function checkMask(value, bitmask) {
  1686. return (value & bitmask) === bitmask;
  1687. }
  1688. var DOMPropertyInjection = {
  1689. /**
  1690. * Mapping from normalized, camelcased property names to a configuration that
  1691. * specifies how the associated DOM property should be accessed or rendered.
  1692. */
  1693. MUST_USE_PROPERTY: 0x1,
  1694. HAS_BOOLEAN_VALUE: 0x4,
  1695. HAS_NUMERIC_VALUE: 0x8,
  1696. HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  1697. HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
  1698. /**
  1699. * Inject some specialized knowledge about the DOM. This takes a config object
  1700. * with the following properties:
  1701. *
  1702. * isCustomAttribute: function that given an attribute name will return true
  1703. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1704. * attributes where it's impossible to enumerate all of the possible
  1705. * attribute names,
  1706. *
  1707. * Properties: object mapping DOM property name to one of the
  1708. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1709. * it won't get written to the DOM.
  1710. *
  1711. * DOMAttributeNames: object mapping React attribute name to the DOM
  1712. * attribute name. Attribute names not specified use the **lowercase**
  1713. * normalized name.
  1714. *
  1715. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1716. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1717. *
  1718. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1719. * Property names not specified use the normalized name.
  1720. *
  1721. * DOMMutationMethods: Properties that require special mutation methods. If
  1722. * `value` is undefined, the mutation method should unset the property.
  1723. *
  1724. * @param {object} domPropertyConfig the config as described above.
  1725. */
  1726. injectDOMPropertyConfig: function (domPropertyConfig) {
  1727. var Injection = DOMPropertyInjection;
  1728. var Properties = domPropertyConfig.Properties || {};
  1729. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1730. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1731. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1732. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1733. if (domPropertyConfig.isCustomAttribute) {
  1734. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1735. }
  1736. for (var propName in Properties) {
  1737. !!DOMProperty.properties.hasOwnProperty(propName) ? false ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0;
  1738. var lowerCased = propName.toLowerCase();
  1739. var propConfig = Properties[propName];
  1740. var propertyInfo = {
  1741. attributeName: lowerCased,
  1742. attributeNamespace: null,
  1743. propertyName: propName,
  1744. mutationMethod: null,
  1745. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1746. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1747. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1748. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1749. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1750. };
  1751. !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? false ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;
  1752. if (false) {
  1753. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1754. }
  1755. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1756. var attributeName = DOMAttributeNames[propName];
  1757. propertyInfo.attributeName = attributeName;
  1758. if (false) {
  1759. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1760. }
  1761. }
  1762. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1763. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1764. }
  1765. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1766. propertyInfo.propertyName = DOMPropertyNames[propName];
  1767. }
  1768. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1769. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1770. }
  1771. DOMProperty.properties[propName] = propertyInfo;
  1772. }
  1773. }
  1774. };
  1775. /* eslint-disable max-len */
  1776. 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';
  1777. /* eslint-enable max-len */
  1778. /**
  1779. * DOMProperty exports lookup objects that can be used like functions:
  1780. *
  1781. * > DOMProperty.isValid['id']
  1782. * true
  1783. * > DOMProperty.isValid['foobar']
  1784. * undefined
  1785. *
  1786. * Although this may be confusing, it performs better in general.
  1787. *
  1788. * @see http://jsperf.com/key-exists
  1789. * @see http://jsperf.com/key-missing
  1790. */
  1791. var DOMProperty = {
  1792. ID_ATTRIBUTE_NAME: 'data-reactid',
  1793. ROOT_ATTRIBUTE_NAME: 'data-reactroot',
  1794. ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  1795. ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
  1796. /**
  1797. * Map from property "standard name" to an object with info about how to set
  1798. * the property in the DOM. Each object contains:
  1799. *
  1800. * attributeName:
  1801. * Used when rendering markup or with `*Attribute()`.
  1802. * attributeNamespace
  1803. * propertyName:
  1804. * Used on DOM node instances. (This includes properties that mutate due to
  1805. * external factors.)
  1806. * mutationMethod:
  1807. * If non-null, used instead of the property or `setAttribute()` after
  1808. * initial render.
  1809. * mustUseProperty:
  1810. * Whether the property must be accessed and mutated as an object property.
  1811. * hasBooleanValue:
  1812. * Whether the property should be removed when set to a falsey value.
  1813. * hasNumericValue:
  1814. * Whether the property must be numeric or parse as a numeric and should be
  1815. * removed when set to a falsey value.
  1816. * hasPositiveNumericValue:
  1817. * Whether the property must be positive numeric or parse as a positive
  1818. * numeric and should be removed when set to a falsey value.
  1819. * hasOverloadedBooleanValue:
  1820. * Whether the property can be used as a flag as well as with a value.
  1821. * Removed when strictly equal to false; present without a value when
  1822. * strictly equal to true; present with a value otherwise.
  1823. */
  1824. properties: {},
  1825. /**
  1826. * Mapping from lowercase property names to the properly cased version, used
  1827. * to warn in the case of missing properties. Available only in __DEV__.
  1828. *
  1829. * autofocus is predefined, because adding it to the property whitelist
  1830. * causes unintended side effects.
  1831. *
  1832. * @type {Object}
  1833. */
  1834. getPossibleStandardName: false ? { autofocus: 'autoFocus' } : null,
  1835. /**
  1836. * All of the isCustomAttribute() functions that have been injected.
  1837. */
  1838. _isCustomAttributeFunctions: [],
  1839. /**
  1840. * Checks whether a property name is a custom attribute.
  1841. * @method
  1842. */
  1843. isCustomAttribute: function (attributeName) {
  1844. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1845. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1846. if (isCustomAttributeFn(attributeName)) {
  1847. return true;
  1848. }
  1849. }
  1850. return false;
  1851. },
  1852. injection: DOMPropertyInjection
  1853. };
  1854. module.exports = DOMProperty;
  1855. /***/ }),
  1856. /* 19 */
  1857. /***/ (function(module, exports, __webpack_require__) {
  1858. "use strict";
  1859. /**
  1860. * Copyright 2013-present, Facebook, Inc.
  1861. * All rights reserved.
  1862. *
  1863. * This source code is licensed under the BSD-style license found in the
  1864. * LICENSE file in the root directory of this source tree. An additional grant
  1865. * of patent rights can be found in the PATENTS file in the same directory.
  1866. *
  1867. */
  1868. var ReactRef = __webpack_require__(177);
  1869. var ReactInstrumentation = __webpack_require__(10);
  1870. var warning = __webpack_require__(1);
  1871. /**
  1872. * Helper to call ReactRef.attachRefs with this composite component, split out
  1873. * to avoid allocations in the transaction mount-ready queue.
  1874. */
  1875. function attachRefs() {
  1876. ReactRef.attachRefs(this, this._currentElement);
  1877. }
  1878. var ReactReconciler = {
  1879. /**
  1880. * Initializes the component, renders markup, and registers event listeners.
  1881. *
  1882. * @param {ReactComponent} internalInstance
  1883. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  1884. * @param {?object} the containing host component instance
  1885. * @param {?object} info about the host container
  1886. * @return {?string} Rendered markup to be inserted into the DOM.
  1887. * @final
  1888. * @internal
  1889. */
  1890. mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
  1891. ) {
  1892. if (false) {
  1893. if (internalInstance._debugID !== 0) {
  1894. ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
  1895. }
  1896. }
  1897. var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
  1898. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1899. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1900. }
  1901. if (false) {
  1902. if (internalInstance._debugID !== 0) {
  1903. ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
  1904. }
  1905. }
  1906. return markup;
  1907. },
  1908. /**
  1909. * Returns a value that can be passed to
  1910. * ReactComponentEnvironment.replaceNodeWithMarkup.
  1911. */
  1912. getHostNode: function (internalInstance) {
  1913. return internalInstance.getHostNode();
  1914. },
  1915. /**
  1916. * Releases any resources allocated by `mountComponent`.
  1917. *
  1918. * @final
  1919. * @internal
  1920. */
  1921. unmountComponent: function (internalInstance, safely) {
  1922. if (false) {
  1923. if (internalInstance._debugID !== 0) {
  1924. ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
  1925. }
  1926. }
  1927. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  1928. internalInstance.unmountComponent(safely);
  1929. if (false) {
  1930. if (internalInstance._debugID !== 0) {
  1931. ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
  1932. }
  1933. }
  1934. },
  1935. /**
  1936. * Update a component using a new element.
  1937. *
  1938. * @param {ReactComponent} internalInstance
  1939. * @param {ReactElement} nextElement
  1940. * @param {ReactReconcileTransaction} transaction
  1941. * @param {object} context
  1942. * @internal
  1943. */
  1944. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  1945. var prevElement = internalInstance._currentElement;
  1946. if (nextElement === prevElement && context === internalInstance._context) {
  1947. // Since elements are immutable after the owner is rendered,
  1948. // we can do a cheap identity compare here to determine if this is a
  1949. // superfluous reconcile. It's possible for state to be mutable but such
  1950. // change should trigger an update of the owner which would recreate
  1951. // the element. We explicitly check for the existence of an owner since
  1952. // it's possible for an element created outside a composite to be
  1953. // deeply mutated and reused.
  1954. // TODO: Bailing out early is just a perf optimization right?
  1955. // TODO: Removing the return statement should affect correctness?
  1956. return;
  1957. }
  1958. if (false) {
  1959. if (internalInstance._debugID !== 0) {
  1960. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
  1961. }
  1962. }
  1963. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  1964. if (refsChanged) {
  1965. ReactRef.detachRefs(internalInstance, prevElement);
  1966. }
  1967. internalInstance.receiveComponent(nextElement, transaction, context);
  1968. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1969. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1970. }
  1971. if (false) {
  1972. if (internalInstance._debugID !== 0) {
  1973. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  1974. }
  1975. }
  1976. },
  1977. /**
  1978. * Flush any dirty changes in a component.
  1979. *
  1980. * @param {ReactComponent} internalInstance
  1981. * @param {ReactReconcileTransaction} transaction
  1982. * @internal
  1983. */
  1984. performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
  1985. if (internalInstance._updateBatchNumber !== updateBatchNumber) {
  1986. // The component's enqueued batch number should always be the current
  1987. // batch or the following one.
  1988. false ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
  1989. return;
  1990. }
  1991. if (false) {
  1992. if (internalInstance._debugID !== 0) {
  1993. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
  1994. }
  1995. }
  1996. internalInstance.performUpdateIfNecessary(transaction);
  1997. if (false) {
  1998. if (internalInstance._debugID !== 0) {
  1999. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2000. }
  2001. }
  2002. }
  2003. };
  2004. module.exports = ReactReconciler;
  2005. /***/ }),
  2006. /* 20 */
  2007. /***/ (function(module, exports, __webpack_require__) {
  2008. "use strict";
  2009. /**
  2010. * Copyright 2013-present, Facebook, Inc.
  2011. * All rights reserved.
  2012. *
  2013. * This source code is licensed under the BSD-style license found in the
  2014. * LICENSE file in the root directory of this source tree. An additional grant
  2015. * of patent rights can be found in the PATENTS file in the same directory.
  2016. *
  2017. */
  2018. var _assign = __webpack_require__(3);
  2019. var ReactChildren = __webpack_require__(207);
  2020. var ReactComponent = __webpack_require__(51);
  2021. var ReactPureComponent = __webpack_require__(212);
  2022. var ReactClass = __webpack_require__(208);
  2023. var ReactDOMFactories = __webpack_require__(209);
  2024. var ReactElement = __webpack_require__(21);
  2025. var ReactPropTypes = __webpack_require__(210);
  2026. var ReactVersion = __webpack_require__(213);
  2027. var onlyChild = __webpack_require__(214);
  2028. var warning = __webpack_require__(1);
  2029. var createElement = ReactElement.createElement;
  2030. var createFactory = ReactElement.createFactory;
  2031. var cloneElement = ReactElement.cloneElement;
  2032. if (false) {
  2033. var ReactElementValidator = require('./ReactElementValidator');
  2034. createElement = ReactElementValidator.createElement;
  2035. createFactory = ReactElementValidator.createFactory;
  2036. cloneElement = ReactElementValidator.cloneElement;
  2037. }
  2038. var __spread = _assign;
  2039. if (false) {
  2040. var warned = false;
  2041. __spread = function () {
  2042. process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
  2043. warned = true;
  2044. return _assign.apply(null, arguments);
  2045. };
  2046. }
  2047. var React = {
  2048. // Modern
  2049. Children: {
  2050. map: ReactChildren.map,
  2051. forEach: ReactChildren.forEach,
  2052. count: ReactChildren.count,
  2053. toArray: ReactChildren.toArray,
  2054. only: onlyChild
  2055. },
  2056. Component: ReactComponent,
  2057. PureComponent: ReactPureComponent,
  2058. createElement: createElement,
  2059. cloneElement: cloneElement,
  2060. isValidElement: ReactElement.isValidElement,
  2061. // Classic
  2062. PropTypes: ReactPropTypes,
  2063. createClass: ReactClass.createClass,
  2064. createFactory: createFactory,
  2065. createMixin: function (mixin) {
  2066. // Currently a noop. Will be used to validate and trace mixins.
  2067. return mixin;
  2068. },
  2069. // This looks DOM specific but these are actually isomorphic helpers
  2070. // since they are just generating DOM strings.
  2071. DOM: ReactDOMFactories,
  2072. version: ReactVersion,
  2073. // Deprecated hook for JSX spread, don't use this for anything.
  2074. __spread: __spread
  2075. };
  2076. module.exports = React;
  2077. /***/ }),
  2078. /* 21 */
  2079. /***/ (function(module, exports, __webpack_require__) {
  2080. "use strict";
  2081. /**
  2082. * Copyright 2014-present, Facebook, Inc.
  2083. * All rights reserved.
  2084. *
  2085. * This source code is licensed under the BSD-style license found in the
  2086. * LICENSE file in the root directory of this source tree. An additional grant
  2087. * of patent rights can be found in the PATENTS file in the same directory.
  2088. *
  2089. */
  2090. var _assign = __webpack_require__(3);
  2091. var ReactCurrentOwner = __webpack_require__(13);
  2092. var warning = __webpack_require__(1);
  2093. var canDefineProperty = __webpack_require__(81);
  2094. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2095. var REACT_ELEMENT_TYPE = __webpack_require__(79);
  2096. var RESERVED_PROPS = {
  2097. key: true,
  2098. ref: true,
  2099. __self: true,
  2100. __source: true
  2101. };
  2102. var specialPropKeyWarningShown, specialPropRefWarningShown;
  2103. function hasValidRef(config) {
  2104. if (false) {
  2105. if (hasOwnProperty.call(config, 'ref')) {
  2106. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  2107. if (getter && getter.isReactWarning) {
  2108. return false;
  2109. }
  2110. }
  2111. }
  2112. return config.ref !== undefined;
  2113. }
  2114. function hasValidKey(config) {
  2115. if (false) {
  2116. if (hasOwnProperty.call(config, 'key')) {
  2117. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  2118. if (getter && getter.isReactWarning) {
  2119. return false;
  2120. }
  2121. }
  2122. }
  2123. return config.key !== undefined;
  2124. }
  2125. function defineKeyPropWarningGetter(props, displayName) {
  2126. var warnAboutAccessingKey = function () {
  2127. if (!specialPropKeyWarningShown) {
  2128. specialPropKeyWarningShown = true;
  2129. false ? warning(false, '%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) : void 0;
  2130. }
  2131. };
  2132. warnAboutAccessingKey.isReactWarning = true;
  2133. Object.defineProperty(props, 'key', {
  2134. get: warnAboutAccessingKey,
  2135. configurable: true
  2136. });
  2137. }
  2138. function defineRefPropWarningGetter(props, displayName) {
  2139. var warnAboutAccessingRef = function () {
  2140. if (!specialPropRefWarningShown) {
  2141. specialPropRefWarningShown = true;
  2142. false ? warning(false, '%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) : void 0;
  2143. }
  2144. };
  2145. warnAboutAccessingRef.isReactWarning = true;
  2146. Object.defineProperty(props, 'ref', {
  2147. get: warnAboutAccessingRef,
  2148. configurable: true
  2149. });
  2150. }
  2151. /**
  2152. * Factory method to create a new React element. This no longer adheres to
  2153. * the class pattern, so do not use new to call it. Also, no instanceof check
  2154. * will work. Instead test $$typeof field against Symbol.for('react.element') to check
  2155. * if something is a React Element.
  2156. *
  2157. * @param {*} type
  2158. * @param {*} key
  2159. * @param {string|object} ref
  2160. * @param {*} self A *temporary* helper to detect places where `this` is
  2161. * different from the `owner` when React.createElement is called, so that we
  2162. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  2163. * functions, and as long as `this` and owner are the same, there will be no
  2164. * change in behavior.
  2165. * @param {*} source An annotation object (added by a transpiler or otherwise)
  2166. * indicating filename, line number, and/or other information.
  2167. * @param {*} owner
  2168. * @param {*} props
  2169. * @internal
  2170. */
  2171. var ReactElement = function (type, key, ref, self, source, owner, props) {
  2172. var element = {
  2173. // This tag allow us to uniquely identify this as a React Element
  2174. $$typeof: REACT_ELEMENT_TYPE,
  2175. // Built-in properties that belong on the element
  2176. type: type,
  2177. key: key,
  2178. ref: ref,
  2179. props: props,
  2180. // Record the component responsible for creating this element.
  2181. _owner: owner
  2182. };
  2183. if (false) {
  2184. // The validation flag is currently mutative. We put it on
  2185. // an external backing store so that we can freeze the whole object.
  2186. // This can be replaced with a WeakMap once they are implemented in
  2187. // commonly used development environments.
  2188. element._store = {};
  2189. // To make comparing ReactElements easier for testing purposes, we make
  2190. // the validation flag non-enumerable (where possible, which should
  2191. // include every environment we run tests in), so the test framework
  2192. // ignores it.
  2193. if (canDefineProperty) {
  2194. Object.defineProperty(element._store, 'validated', {
  2195. configurable: false,
  2196. enumerable: false,
  2197. writable: true,
  2198. value: false
  2199. });
  2200. // self and source are DEV only properties.
  2201. Object.defineProperty(element, '_self', {
  2202. configurable: false,
  2203. enumerable: false,
  2204. writable: false,
  2205. value: self
  2206. });
  2207. // Two elements created in two different places should be considered
  2208. // equal for testing purposes and therefore we hide it from enumeration.
  2209. Object.defineProperty(element, '_source', {
  2210. configurable: false,
  2211. enumerable: false,
  2212. writable: false,
  2213. value: source
  2214. });
  2215. } else {
  2216. element._store.validated = false;
  2217. element._self = self;
  2218. element._source = source;
  2219. }
  2220. if (Object.freeze) {
  2221. Object.freeze(element.props);
  2222. Object.freeze(element);
  2223. }
  2224. }
  2225. return element;
  2226. };
  2227. /**
  2228. * Create and return a new ReactElement of the given type.
  2229. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
  2230. */
  2231. ReactElement.createElement = function (type, config, children) {
  2232. var propName;
  2233. // Reserved names are extracted
  2234. var props = {};
  2235. var key = null;
  2236. var ref = null;
  2237. var self = null;
  2238. var source = null;
  2239. if (config != null) {
  2240. if (hasValidRef(config)) {
  2241. ref = config.ref;
  2242. }
  2243. if (hasValidKey(config)) {
  2244. key = '' + config.key;
  2245. }
  2246. self = config.__self === undefined ? null : config.__self;
  2247. source = config.__source === undefined ? null : config.__source;
  2248. // Remaining properties are added to a new props object
  2249. for (propName in config) {
  2250. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2251. props[propName] = config[propName];
  2252. }
  2253. }
  2254. }
  2255. // Children can be more than one argument, and those are transferred onto
  2256. // the newly allocated props object.
  2257. var childrenLength = arguments.length - 2;
  2258. if (childrenLength === 1) {
  2259. props.children = children;
  2260. } else if (childrenLength > 1) {
  2261. var childArray = Array(childrenLength);
  2262. for (var i = 0; i < childrenLength; i++) {
  2263. childArray[i] = arguments[i + 2];
  2264. }
  2265. if (false) {
  2266. if (Object.freeze) {
  2267. Object.freeze(childArray);
  2268. }
  2269. }
  2270. props.children = childArray;
  2271. }
  2272. // Resolve default props
  2273. if (type && type.defaultProps) {
  2274. var defaultProps = type.defaultProps;
  2275. for (propName in defaultProps) {
  2276. if (props[propName] === undefined) {
  2277. props[propName] = defaultProps[propName];
  2278. }
  2279. }
  2280. }
  2281. if (false) {
  2282. if (key || ref) {
  2283. if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
  2284. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  2285. if (key) {
  2286. defineKeyPropWarningGetter(props, displayName);
  2287. }
  2288. if (ref) {
  2289. defineRefPropWarningGetter(props, displayName);
  2290. }
  2291. }
  2292. }
  2293. }
  2294. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  2295. };
  2296. /**
  2297. * Return a function that produces ReactElements of a given type.
  2298. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
  2299. */
  2300. ReactElement.createFactory = function (type) {
  2301. var factory = ReactElement.createElement.bind(null, type);
  2302. // Expose the type on the factory and the prototype so that it can be
  2303. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  2304. // This should not be named `constructor` since this may not be the function
  2305. // that created the element, and it may not even be a constructor.
  2306. // Legacy hook TODO: Warn if this is accessed
  2307. factory.type = type;
  2308. return factory;
  2309. };
  2310. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  2311. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  2312. return newElement;
  2313. };
  2314. /**
  2315. * Clone and return a new ReactElement using element as the starting point.
  2316. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
  2317. */
  2318. ReactElement.cloneElement = function (element, config, children) {
  2319. var propName;
  2320. // Original props are copied
  2321. var props = _assign({}, element.props);
  2322. // Reserved names are extracted
  2323. var key = element.key;
  2324. var ref = element.ref;
  2325. // Self is preserved since the owner is preserved.
  2326. var self = element._self;
  2327. // Source is preserved since cloneElement is unlikely to be targeted by a
  2328. // transpiler, and the original source is probably a better indicator of the
  2329. // true owner.
  2330. var source = element._source;
  2331. // Owner will be preserved, unless ref is overridden
  2332. var owner = element._owner;
  2333. if (config != null) {
  2334. if (hasValidRef(config)) {
  2335. // Silently steal the ref from the parent.
  2336. ref = config.ref;
  2337. owner = ReactCurrentOwner.current;
  2338. }
  2339. if (hasValidKey(config)) {
  2340. key = '' + config.key;
  2341. }
  2342. // Remaining properties override existing props
  2343. var defaultProps;
  2344. if (element.type && element.type.defaultProps) {
  2345. defaultProps = element.type.defaultProps;
  2346. }
  2347. for (propName in config) {
  2348. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2349. if (config[propName] === undefined && defaultProps !== undefined) {
  2350. // Resolve default props
  2351. props[propName] = defaultProps[propName];
  2352. } else {
  2353. props[propName] = config[propName];
  2354. }
  2355. }
  2356. }
  2357. }
  2358. // Children can be more than one argument, and those are transferred onto
  2359. // the newly allocated props object.
  2360. var childrenLength = arguments.length - 2;
  2361. if (childrenLength === 1) {
  2362. props.children = children;
  2363. } else if (childrenLength > 1) {
  2364. var childArray = Array(childrenLength);
  2365. for (var i = 0; i < childrenLength; i++) {
  2366. childArray[i] = arguments[i + 2];
  2367. }
  2368. props.children = childArray;
  2369. }
  2370. return ReactElement(element.type, key, ref, self, source, owner, props);
  2371. };
  2372. /**
  2373. * Verifies the object is a ReactElement.
  2374. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
  2375. * @param {?object} object
  2376. * @return {boolean} True if `object` is a valid component.
  2377. * @final
  2378. */
  2379. ReactElement.isValidElement = function (object) {
  2380. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  2381. };
  2382. module.exports = ReactElement;
  2383. /***/ }),
  2384. /* 22 */
  2385. /***/ (function(module, exports, __webpack_require__) {
  2386. "use strict";
  2387. /**
  2388. * Copyright (c) 2013-present, Facebook, Inc.
  2389. * All rights reserved.
  2390. *
  2391. * This source code is licensed under the BSD-style license found in the
  2392. * LICENSE file in the root directory of this source tree. An additional grant
  2393. * of patent rights can be found in the PATENTS file in the same directory.
  2394. *
  2395. *
  2396. */
  2397. /**
  2398. * WARNING: DO NOT manually require this module.
  2399. * This is a replacement for `invariant(...)` used by the error code system
  2400. * and will _only_ be required by the corresponding babel pass.
  2401. * It always throws.
  2402. */
  2403. function reactProdInvariant(code) {
  2404. var argCount = arguments.length - 1;
  2405. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  2406. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  2407. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  2408. }
  2409. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  2410. var error = new Error(message);
  2411. error.name = 'Invariant Violation';
  2412. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  2413. throw error;
  2414. }
  2415. module.exports = reactProdInvariant;
  2416. /***/ }),
  2417. /* 23 */
  2418. /***/ (function(module, exports, __webpack_require__) {
  2419. "use strict";
  2420. /**
  2421. * Copyright (c) 2013-present, Facebook, Inc.
  2422. * All rights reserved.
  2423. *
  2424. * This source code is licensed under the BSD-style license found in the
  2425. * LICENSE file in the root directory of this source tree. An additional grant
  2426. * of patent rights can be found in the PATENTS file in the same directory.
  2427. *
  2428. */
  2429. var emptyObject = {};
  2430. if (false) {
  2431. Object.freeze(emptyObject);
  2432. }
  2433. module.exports = emptyObject;
  2434. /***/ }),
  2435. /* 24 */
  2436. /***/ (function(module, exports, __webpack_require__) {
  2437. "use strict";
  2438. /**
  2439. * Copyright 2013-present, Facebook, Inc.
  2440. * All rights reserved.
  2441. *
  2442. * This source code is licensed under the BSD-style license found in the
  2443. * LICENSE file in the root directory of this source tree. An additional grant
  2444. * of patent rights can be found in the PATENTS file in the same directory.
  2445. *
  2446. */
  2447. var _prodInvariant = __webpack_require__(2);
  2448. var EventPluginRegistry = __webpack_require__(37);
  2449. var EventPluginUtils = __webpack_require__(38);
  2450. var ReactErrorUtils = __webpack_require__(42);
  2451. var accumulateInto = __webpack_require__(70);
  2452. var forEachAccumulated = __webpack_require__(71);
  2453. var invariant = __webpack_require__(0);
  2454. /**
  2455. * Internal store for event listeners
  2456. */
  2457. var listenerBank = {};
  2458. /**
  2459. * Internal queue of events that have accumulated their dispatches and are
  2460. * waiting to have their dispatches executed.
  2461. */
  2462. var eventQueue = null;
  2463. /**
  2464. * Dispatches an event and releases it back into the pool, unless persistent.
  2465. *
  2466. * @param {?object} event Synthetic event to be dispatched.
  2467. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2468. * @private
  2469. */
  2470. var executeDispatchesAndRelease = function (event, simulated) {
  2471. if (event) {
  2472. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2473. if (!event.isPersistent()) {
  2474. event.constructor.release(event);
  2475. }
  2476. }
  2477. };
  2478. var executeDispatchesAndReleaseSimulated = function (e) {
  2479. return executeDispatchesAndRelease(e, true);
  2480. };
  2481. var executeDispatchesAndReleaseTopLevel = function (e) {
  2482. return executeDispatchesAndRelease(e, false);
  2483. };
  2484. var getDictionaryKey = function (inst) {
  2485. // Prevents V8 performance issue:
  2486. // https://github.com/facebook/react/pull/7232
  2487. return '.' + inst._rootNodeID;
  2488. };
  2489. function isInteractive(tag) {
  2490. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  2491. }
  2492. function shouldPreventMouseEvent(name, type, props) {
  2493. switch (name) {
  2494. case 'onClick':
  2495. case 'onClickCapture':
  2496. case 'onDoubleClick':
  2497. case 'onDoubleClickCapture':
  2498. case 'onMouseDown':
  2499. case 'onMouseDownCapture':
  2500. case 'onMouseMove':
  2501. case 'onMouseMoveCapture':
  2502. case 'onMouseUp':
  2503. case 'onMouseUpCapture':
  2504. return !!(props.disabled && isInteractive(type));
  2505. default:
  2506. return false;
  2507. }
  2508. }
  2509. /**
  2510. * This is a unified interface for event plugins to be installed and configured.
  2511. *
  2512. * Event plugins can implement the following properties:
  2513. *
  2514. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2515. * Required. When a top-level event is fired, this method is expected to
  2516. * extract synthetic events that will in turn be queued and dispatched.
  2517. *
  2518. * `eventTypes` {object}
  2519. * Optional, plugins that fire events must publish a mapping of registration
  2520. * names that are used to register listeners. Values of this mapping must
  2521. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2522. *
  2523. * `executeDispatch` {function(object, function, string)}
  2524. * Optional, allows plugins to override how an event gets dispatched. By
  2525. * default, the listener is simply invoked.
  2526. *
  2527. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2528. *
  2529. * @public
  2530. */
  2531. var EventPluginHub = {
  2532. /**
  2533. * Methods for injecting dependencies.
  2534. */
  2535. injection: {
  2536. /**
  2537. * @param {array} InjectedEventPluginOrder
  2538. * @public
  2539. */
  2540. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2541. /**
  2542. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2543. */
  2544. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2545. },
  2546. /**
  2547. * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
  2548. *
  2549. * @param {object} inst The instance, which is the source of events.
  2550. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2551. * @param {function} listener The callback to store.
  2552. */
  2553. putListener: function (inst, registrationName, listener) {
  2554. !(typeof listener === 'function') ? false ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0;
  2555. var key = getDictionaryKey(inst);
  2556. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2557. bankForRegistrationName[key] = listener;
  2558. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2559. if (PluginModule && PluginModule.didPutListener) {
  2560. PluginModule.didPutListener(inst, registrationName, listener);
  2561. }
  2562. },
  2563. /**
  2564. * @param {object} inst The instance, which is the source of events.
  2565. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2566. * @return {?function} The stored callback.
  2567. */
  2568. getListener: function (inst, registrationName) {
  2569. // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  2570. // live here; needs to be moved to a better place soon
  2571. var bankForRegistrationName = listenerBank[registrationName];
  2572. if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
  2573. return null;
  2574. }
  2575. var key = getDictionaryKey(inst);
  2576. return bankForRegistrationName && bankForRegistrationName[key];
  2577. },
  2578. /**
  2579. * Deletes a listener from the registration bank.
  2580. *
  2581. * @param {object} inst The instance, which is the source of events.
  2582. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2583. */
  2584. deleteListener: function (inst, registrationName) {
  2585. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2586. if (PluginModule && PluginModule.willDeleteListener) {
  2587. PluginModule.willDeleteListener(inst, registrationName);
  2588. }
  2589. var bankForRegistrationName = listenerBank[registrationName];
  2590. // TODO: This should never be null -- when is it?
  2591. if (bankForRegistrationName) {
  2592. var key = getDictionaryKey(inst);
  2593. delete bankForRegistrationName[key];
  2594. }
  2595. },
  2596. /**
  2597. * Deletes all listeners for the DOM element with the supplied ID.
  2598. *
  2599. * @param {object} inst The instance, which is the source of events.
  2600. */
  2601. deleteAllListeners: function (inst) {
  2602. var key = getDictionaryKey(inst);
  2603. for (var registrationName in listenerBank) {
  2604. if (!listenerBank.hasOwnProperty(registrationName)) {
  2605. continue;
  2606. }
  2607. if (!listenerBank[registrationName][key]) {
  2608. continue;
  2609. }
  2610. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2611. if (PluginModule && PluginModule.willDeleteListener) {
  2612. PluginModule.willDeleteListener(inst, registrationName);
  2613. }
  2614. delete listenerBank[registrationName][key];
  2615. }
  2616. },
  2617. /**
  2618. * Allows registered plugins an opportunity to extract events from top-level
  2619. * native browser events.
  2620. *
  2621. * @return {*} An accumulation of synthetic events.
  2622. * @internal
  2623. */
  2624. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  2625. var events;
  2626. var plugins = EventPluginRegistry.plugins;
  2627. for (var i = 0; i < plugins.length; i++) {
  2628. // Not every plugin in the ordering may be loaded at runtime.
  2629. var possiblePlugin = plugins[i];
  2630. if (possiblePlugin) {
  2631. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  2632. if (extractedEvents) {
  2633. events = accumulateInto(events, extractedEvents);
  2634. }
  2635. }
  2636. }
  2637. return events;
  2638. },
  2639. /**
  2640. * Enqueues a synthetic event that should be dispatched when
  2641. * `processEventQueue` is invoked.
  2642. *
  2643. * @param {*} events An accumulation of synthetic events.
  2644. * @internal
  2645. */
  2646. enqueueEvents: function (events) {
  2647. if (events) {
  2648. eventQueue = accumulateInto(eventQueue, events);
  2649. }
  2650. },
  2651. /**
  2652. * Dispatches all synthetic events on the event queue.
  2653. *
  2654. * @internal
  2655. */
  2656. processEventQueue: function (simulated) {
  2657. // Set `eventQueue` to null before processing it so that we can tell if more
  2658. // events get enqueued while processing.
  2659. var processingEventQueue = eventQueue;
  2660. eventQueue = null;
  2661. if (simulated) {
  2662. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2663. } else {
  2664. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2665. }
  2666. !!eventQueue ? false ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0;
  2667. // This would be a good time to rethrow if any of the event handlers threw.
  2668. ReactErrorUtils.rethrowCaughtError();
  2669. },
  2670. /**
  2671. * These are needed for tests only. Do not use!
  2672. */
  2673. __purge: function () {
  2674. listenerBank = {};
  2675. },
  2676. __getListenerBank: function () {
  2677. return listenerBank;
  2678. }
  2679. };
  2680. module.exports = EventPluginHub;
  2681. /***/ }),
  2682. /* 25 */
  2683. /***/ (function(module, exports, __webpack_require__) {
  2684. "use strict";
  2685. /**
  2686. * Copyright 2013-present, Facebook, Inc.
  2687. * All rights reserved.
  2688. *
  2689. * This source code is licensed under the BSD-style license found in the
  2690. * LICENSE file in the root directory of this source tree. An additional grant
  2691. * of patent rights can be found in the PATENTS file in the same directory.
  2692. *
  2693. */
  2694. var EventPluginHub = __webpack_require__(24);
  2695. var EventPluginUtils = __webpack_require__(38);
  2696. var accumulateInto = __webpack_require__(70);
  2697. var forEachAccumulated = __webpack_require__(71);
  2698. var warning = __webpack_require__(1);
  2699. var getListener = EventPluginHub.getListener;
  2700. /**
  2701. * Some event types have a notion of different registration names for different
  2702. * "phases" of propagation. This finds listeners by a given phase.
  2703. */
  2704. function listenerAtPhase(inst, event, propagationPhase) {
  2705. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2706. return getListener(inst, registrationName);
  2707. }
  2708. /**
  2709. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2710. * here, allows us to not have to bind or create functions for each event.
  2711. * Mutating the event's members allows us to not have to create a wrapping
  2712. * "dispatch" object that pairs the event with the listener.
  2713. */
  2714. function accumulateDirectionalDispatches(inst, phase, event) {
  2715. if (false) {
  2716. process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
  2717. }
  2718. var listener = listenerAtPhase(inst, event, phase);
  2719. if (listener) {
  2720. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2721. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2722. }
  2723. }
  2724. /**
  2725. * Collect dispatches (must be entirely collected before dispatching - see unit
  2726. * tests). Lazily allocate the array to conserve memory. We must loop through
  2727. * each event and perform the traversal for each one. We cannot perform a
  2728. * single traversal for the entire collection of events because each event may
  2729. * have a different target.
  2730. */
  2731. function accumulateTwoPhaseDispatchesSingle(event) {
  2732. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2733. EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  2734. }
  2735. }
  2736. /**
  2737. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2738. */
  2739. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2740. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2741. var targetInst = event._targetInst;
  2742. var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
  2743. EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
  2744. }
  2745. }
  2746. /**
  2747. * Accumulates without regard to direction, does not look for phased
  2748. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2749. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2750. */
  2751. function accumulateDispatches(inst, ignoredDirection, event) {
  2752. if (event && event.dispatchConfig.registrationName) {
  2753. var registrationName = event.dispatchConfig.registrationName;
  2754. var listener = getListener(inst, registrationName);
  2755. if (listener) {
  2756. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2757. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2758. }
  2759. }
  2760. }
  2761. /**
  2762. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2763. * `dispatchMarker`.
  2764. * @param {SyntheticEvent} event
  2765. */
  2766. function accumulateDirectDispatchesSingle(event) {
  2767. if (event && event.dispatchConfig.registrationName) {
  2768. accumulateDispatches(event._targetInst, null, event);
  2769. }
  2770. }
  2771. function accumulateTwoPhaseDispatches(events) {
  2772. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2773. }
  2774. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2775. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2776. }
  2777. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  2778. EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  2779. }
  2780. function accumulateDirectDispatches(events) {
  2781. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2782. }
  2783. /**
  2784. * A small set of propagation patterns, each of which will accept a small amount
  2785. * of information, and generate a set of "dispatch ready event objects" - which
  2786. * are sets of events that have already been annotated with a set of dispatched
  2787. * listener functions/ids. The API is designed this way to discourage these
  2788. * propagation strategies from actually executing the dispatches, since we
  2789. * always want to collect the entire set of dispatches before executing event a
  2790. * single one.
  2791. *
  2792. * @constructor EventPropagators
  2793. */
  2794. var EventPropagators = {
  2795. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2796. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2797. accumulateDirectDispatches: accumulateDirectDispatches,
  2798. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2799. };
  2800. module.exports = EventPropagators;
  2801. /***/ }),
  2802. /* 26 */
  2803. /***/ (function(module, exports, __webpack_require__) {
  2804. "use strict";
  2805. /**
  2806. * Copyright 2013-present, Facebook, Inc.
  2807. * All rights reserved.
  2808. *
  2809. * This source code is licensed under the BSD-style license found in the
  2810. * LICENSE file in the root directory of this source tree. An additional grant
  2811. * of patent rights can be found in the PATENTS file in the same directory.
  2812. *
  2813. */
  2814. /**
  2815. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  2816. * instance (key) and the internal representation (value). This allows public
  2817. * methods to accept the user facing instance as an argument and map them back
  2818. * to internal methods.
  2819. */
  2820. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  2821. var ReactInstanceMap = {
  2822. /**
  2823. * This API should be called `delete` but we'd have to make sure to always
  2824. * transform these to strings for IE support. When this transform is fully
  2825. * supported we can rename it.
  2826. */
  2827. remove: function (key) {
  2828. key._reactInternalInstance = undefined;
  2829. },
  2830. get: function (key) {
  2831. return key._reactInternalInstance;
  2832. },
  2833. has: function (key) {
  2834. return key._reactInternalInstance !== undefined;
  2835. },
  2836. set: function (key, value) {
  2837. key._reactInternalInstance = value;
  2838. }
  2839. };
  2840. module.exports = ReactInstanceMap;
  2841. /***/ }),
  2842. /* 27 */
  2843. /***/ (function(module, exports, __webpack_require__) {
  2844. "use strict";
  2845. /**
  2846. * Copyright 2013-present, Facebook, Inc.
  2847. * All rights reserved.
  2848. *
  2849. * This source code is licensed under the BSD-style license found in the
  2850. * LICENSE file in the root directory of this source tree. An additional grant
  2851. * of patent rights can be found in the PATENTS file in the same directory.
  2852. *
  2853. */
  2854. var SyntheticEvent = __webpack_require__(12);
  2855. var getEventTarget = __webpack_require__(47);
  2856. /**
  2857. * @interface UIEvent
  2858. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  2859. */
  2860. var UIEventInterface = {
  2861. view: function (event) {
  2862. if (event.view) {
  2863. return event.view;
  2864. }
  2865. var target = getEventTarget(event);
  2866. if (target.window === target) {
  2867. // target is a window object
  2868. return target;
  2869. }
  2870. var doc = target.ownerDocument;
  2871. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2872. if (doc) {
  2873. return doc.defaultView || doc.parentWindow;
  2874. } else {
  2875. return window;
  2876. }
  2877. },
  2878. detail: function (event) {
  2879. return event.detail || 0;
  2880. }
  2881. };
  2882. /**
  2883. * @param {object} dispatchConfig Configuration used to dispatch this event.
  2884. * @param {string} dispatchMarker Marker identifying the event target.
  2885. * @param {object} nativeEvent Native browser event.
  2886. * @extends {SyntheticEvent}
  2887. */
  2888. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  2889. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  2890. }
  2891. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  2892. module.exports = SyntheticUIEvent;
  2893. /***/ }),
  2894. /* 28 */
  2895. /***/ (function(module, exports, __webpack_require__) {
  2896. "use strict";
  2897. /**
  2898. * Copyright 2013-present, Facebook, Inc.
  2899. * All rights reserved.
  2900. *
  2901. * This source code is licensed under the BSD-style license found in the
  2902. * LICENSE file in the root directory of this source tree. An additional grant
  2903. * of patent rights can be found in the PATENTS file in the same directory.
  2904. *
  2905. */
  2906. var _assign = __webpack_require__(3);
  2907. var EventPluginRegistry = __webpack_require__(37);
  2908. var ReactEventEmitterMixin = __webpack_require__(169);
  2909. var ViewportMetrics = __webpack_require__(69);
  2910. var getVendorPrefixedEventName = __webpack_require__(202);
  2911. var isEventSupported = __webpack_require__(48);
  2912. /**
  2913. * Summary of `ReactBrowserEventEmitter` event handling:
  2914. *
  2915. * - Top-level delegation is used to trap most native browser events. This
  2916. * may only occur in the main thread and is the responsibility of
  2917. * ReactEventListener, which is injected and can therefore support pluggable
  2918. * event sources. This is the only work that occurs in the main thread.
  2919. *
  2920. * - We normalize and de-duplicate events to account for browser quirks. This
  2921. * may be done in the worker thread.
  2922. *
  2923. * - Forward these native events (with the associated top-level type used to
  2924. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  2925. * to extract any synthetic events.
  2926. *
  2927. * - The `EventPluginHub` will then process each event by annotating them with
  2928. * "dispatches", a sequence of listeners and IDs that care about that event.
  2929. *
  2930. * - The `EventPluginHub` then dispatches the events.
  2931. *
  2932. * Overview of React and the event system:
  2933. *
  2934. * +------------+ .
  2935. * | DOM | .
  2936. * +------------+ .
  2937. * | .
  2938. * v .
  2939. * +------------+ .
  2940. * | ReactEvent | .
  2941. * | Listener | .
  2942. * +------------+ . +-----------+
  2943. * | . +--------+|SimpleEvent|
  2944. * | . | |Plugin |
  2945. * +-----|------+ . v +-----------+
  2946. * | | | . +--------------+ +------------+
  2947. * | +-----------.--->|EventPluginHub| | Event |
  2948. * | | . | | +-----------+ | Propagators|
  2949. * | ReactEvent | . | | |TapEvent | |------------|
  2950. * | Emitter | . | |<---+|Plugin | |other plugin|
  2951. * | | . | | +-----------+ | utilities |
  2952. * | +-----------.--->| | +------------+
  2953. * | | | . +--------------+
  2954. * +-----|------+ . ^ +-----------+
  2955. * | . | |Enter/Leave|
  2956. * + . +-------+|Plugin |
  2957. * +-------------+ . +-----------+
  2958. * | application | .
  2959. * |-------------| .
  2960. * | | .
  2961. * | | .
  2962. * +-------------+ .
  2963. * .
  2964. * React Core . General Purpose Event Plugin System
  2965. */
  2966. var hasEventPageXY;
  2967. var alreadyListeningTo = {};
  2968. var isMonitoringScrollValue = false;
  2969. var reactTopListenersCounter = 0;
  2970. // For events like 'submit' which don't consistently bubble (which we trap at a
  2971. // lower node than `document`), binding at `document` would cause duplicate
  2972. // events so we don't include them here
  2973. var topEventMapping = {
  2974. topAbort: 'abort',
  2975. topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
  2976. topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
  2977. topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
  2978. topBlur: 'blur',
  2979. topCanPlay: 'canplay',
  2980. topCanPlayThrough: 'canplaythrough',
  2981. topChange: 'change',
  2982. topClick: 'click',
  2983. topCompositionEnd: 'compositionend',
  2984. topCompositionStart: 'compositionstart',
  2985. topCompositionUpdate: 'compositionupdate',
  2986. topContextMenu: 'contextmenu',
  2987. topCopy: 'copy',
  2988. topCut: 'cut',
  2989. topDoubleClick: 'dblclick',
  2990. topDrag: 'drag',
  2991. topDragEnd: 'dragend',
  2992. topDragEnter: 'dragenter',
  2993. topDragExit: 'dragexit',
  2994. topDragLeave: 'dragleave',
  2995. topDragOver: 'dragover',
  2996. topDragStart: 'dragstart',
  2997. topDrop: 'drop',
  2998. topDurationChange: 'durationchange',
  2999. topEmptied: 'emptied',
  3000. topEncrypted: 'encrypted',
  3001. topEnded: 'ended',
  3002. topError: 'error',
  3003. topFocus: 'focus',
  3004. topInput: 'input',
  3005. topKeyDown: 'keydown',
  3006. topKeyPress: 'keypress',
  3007. topKeyUp: 'keyup',
  3008. topLoadedData: 'loadeddata',
  3009. topLoadedMetadata: 'loadedmetadata',
  3010. topLoadStart: 'loadstart',
  3011. topMouseDown: 'mousedown',
  3012. topMouseMove: 'mousemove',
  3013. topMouseOut: 'mouseout',
  3014. topMouseOver: 'mouseover',
  3015. topMouseUp: 'mouseup',
  3016. topPaste: 'paste',
  3017. topPause: 'pause',
  3018. topPlay: 'play',
  3019. topPlaying: 'playing',
  3020. topProgress: 'progress',
  3021. topRateChange: 'ratechange',
  3022. topScroll: 'scroll',
  3023. topSeeked: 'seeked',
  3024. topSeeking: 'seeking',
  3025. topSelectionChange: 'selectionchange',
  3026. topStalled: 'stalled',
  3027. topSuspend: 'suspend',
  3028. topTextInput: 'textInput',
  3029. topTimeUpdate: 'timeupdate',
  3030. topTouchCancel: 'touchcancel',
  3031. topTouchEnd: 'touchend',
  3032. topTouchMove: 'touchmove',
  3033. topTouchStart: 'touchstart',
  3034. topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
  3035. topVolumeChange: 'volumechange',
  3036. topWaiting: 'waiting',
  3037. topWheel: 'wheel'
  3038. };
  3039. /**
  3040. * To ensure no conflicts with other potential React instances on the page
  3041. */
  3042. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3043. function getListeningForDocument(mountAt) {
  3044. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3045. // directly.
  3046. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3047. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3048. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3049. }
  3050. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3051. }
  3052. /**
  3053. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3054. * example:
  3055. *
  3056. * EventPluginHub.putListener('myID', 'onClick', myFunction);
  3057. *
  3058. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3059. *
  3060. * @internal
  3061. */
  3062. var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
  3063. /**
  3064. * Injectable event backend
  3065. */
  3066. ReactEventListener: null,
  3067. injection: {
  3068. /**
  3069. * @param {object} ReactEventListener
  3070. */
  3071. injectReactEventListener: function (ReactEventListener) {
  3072. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3073. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3074. }
  3075. },
  3076. /**
  3077. * Sets whether or not any created callbacks should be enabled.
  3078. *
  3079. * @param {boolean} enabled True if callbacks should be enabled.
  3080. */
  3081. setEnabled: function (enabled) {
  3082. if (ReactBrowserEventEmitter.ReactEventListener) {
  3083. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3084. }
  3085. },
  3086. /**
  3087. * @return {boolean} True if callbacks are enabled.
  3088. */
  3089. isEnabled: function () {
  3090. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3091. },
  3092. /**
  3093. * We listen for bubbled touch events on the document object.
  3094. *
  3095. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3096. * mounting `onmousemove` events at some node that was not the document
  3097. * element. The symptoms were that if your mouse is not moving over something
  3098. * contained within that mount point (for example on the background) the
  3099. * top-level listeners for `onmousemove` won't be called. However, if you
  3100. * register the `mousemove` on the document object, then it will of course
  3101. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3102. * top-level listeners to the document object only, at least for these
  3103. * movement types of events and possibly all events.
  3104. *
  3105. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3106. *
  3107. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3108. * they bubble to document.
  3109. *
  3110. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3111. * @param {object} contentDocumentHandle Document which owns the container
  3112. */
  3113. listenTo: function (registrationName, contentDocumentHandle) {
  3114. var mountAt = contentDocumentHandle;
  3115. var isListening = getListeningForDocument(mountAt);
  3116. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3117. for (var i = 0; i < dependencies.length; i++) {
  3118. var dependency = dependencies[i];
  3119. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3120. if (dependency === 'topWheel') {
  3121. if (isEventSupported('wheel')) {
  3122. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
  3123. } else if (isEventSupported('mousewheel')) {
  3124. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
  3125. } else {
  3126. // Firefox needs to capture a different mouse scroll event.
  3127. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3128. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
  3129. }
  3130. } else if (dependency === 'topScroll') {
  3131. if (isEventSupported('scroll', true)) {
  3132. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
  3133. } else {
  3134. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3135. }
  3136. } else if (dependency === 'topFocus' || dependency === 'topBlur') {
  3137. if (isEventSupported('focus', true)) {
  3138. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
  3139. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
  3140. } else if (isEventSupported('focusin')) {
  3141. // IE has `focusin` and `focusout` events which bubble.
  3142. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3143. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
  3144. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
  3145. }
  3146. // to make sure blur and focus event listeners are only attached once
  3147. isListening.topBlur = true;
  3148. isListening.topFocus = true;
  3149. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3150. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3151. }
  3152. isListening[dependency] = true;
  3153. }
  3154. }
  3155. },
  3156. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3157. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3158. },
  3159. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3160. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3161. },
  3162. /**
  3163. * Protect against document.createEvent() returning null
  3164. * Some popup blocker extensions appear to do this:
  3165. * https://github.com/facebook/react/issues/6887
  3166. */
  3167. supportsEventPageXY: function () {
  3168. if (!document.createEvent) {
  3169. return false;
  3170. }
  3171. var ev = document.createEvent('MouseEvent');
  3172. return ev != null && 'pageX' in ev;
  3173. },
  3174. /**
  3175. * Listens to window scroll and resize events. We cache scroll values so that
  3176. * application code can access them without triggering reflows.
  3177. *
  3178. * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
  3179. * pageX/pageY isn't supported (legacy browsers).
  3180. *
  3181. * NOTE: Scroll events do not bubble.
  3182. *
  3183. * @see http://www.quirksmode.org/dom/events/scroll.html
  3184. */
  3185. ensureScrollValueMonitoring: function () {
  3186. if (hasEventPageXY === undefined) {
  3187. hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
  3188. }
  3189. if (!hasEventPageXY && !isMonitoringScrollValue) {
  3190. var refresh = ViewportMetrics.refreshScrollValues;
  3191. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3192. isMonitoringScrollValue = true;
  3193. }
  3194. }
  3195. });
  3196. module.exports = ReactBrowserEventEmitter;
  3197. /***/ }),
  3198. /* 29 */
  3199. /***/ (function(module, exports, __webpack_require__) {
  3200. "use strict";
  3201. /**
  3202. * Copyright 2013-present, Facebook, Inc.
  3203. * All rights reserved.
  3204. *
  3205. * This source code is licensed under the BSD-style license found in the
  3206. * LICENSE file in the root directory of this source tree. An additional grant
  3207. * of patent rights can be found in the PATENTS file in the same directory.
  3208. *
  3209. */
  3210. var SyntheticUIEvent = __webpack_require__(27);
  3211. var ViewportMetrics = __webpack_require__(69);
  3212. var getEventModifierState = __webpack_require__(46);
  3213. /**
  3214. * @interface MouseEvent
  3215. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  3216. */
  3217. var MouseEventInterface = {
  3218. screenX: null,
  3219. screenY: null,
  3220. clientX: null,
  3221. clientY: null,
  3222. ctrlKey: null,
  3223. shiftKey: null,
  3224. altKey: null,
  3225. metaKey: null,
  3226. getModifierState: getEventModifierState,
  3227. button: function (event) {
  3228. // Webkit, Firefox, IE9+
  3229. // which: 1 2 3
  3230. // button: 0 1 2 (standard)
  3231. var button = event.button;
  3232. if ('which' in event) {
  3233. return button;
  3234. }
  3235. // IE<9
  3236. // which: undefined
  3237. // button: 0 0 0
  3238. // button: 1 4 2 (onmouseup)
  3239. return button === 2 ? 2 : button === 4 ? 1 : 0;
  3240. },
  3241. buttons: null,
  3242. relatedTarget: function (event) {
  3243. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  3244. },
  3245. // "Proprietary" Interface.
  3246. pageX: function (event) {
  3247. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  3248. },
  3249. pageY: function (event) {
  3250. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  3251. }
  3252. };
  3253. /**
  3254. * @param {object} dispatchConfig Configuration used to dispatch this event.
  3255. * @param {string} dispatchMarker Marker identifying the event target.
  3256. * @param {object} nativeEvent Native browser event.
  3257. * @extends {SyntheticUIEvent}
  3258. */
  3259. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  3260. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  3261. }
  3262. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  3263. module.exports = SyntheticMouseEvent;
  3264. /***/ }),
  3265. /* 30 */
  3266. /***/ (function(module, exports, __webpack_require__) {
  3267. "use strict";
  3268. /**
  3269. * Copyright 2013-present, Facebook, Inc.
  3270. * All rights reserved.
  3271. *
  3272. * This source code is licensed under the BSD-style license found in the
  3273. * LICENSE file in the root directory of this source tree. An additional grant
  3274. * of patent rights can be found in the PATENTS file in the same directory.
  3275. *
  3276. *
  3277. */
  3278. var _prodInvariant = __webpack_require__(2);
  3279. var invariant = __webpack_require__(0);
  3280. var OBSERVED_ERROR = {};
  3281. /**
  3282. * `Transaction` creates a black box that is able to wrap any method such that
  3283. * certain invariants are maintained before and after the method is invoked
  3284. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  3285. * instantiates a transaction can provide enforcers of the invariants at
  3286. * creation time. The `Transaction` class itself will supply one additional
  3287. * automatic invariant for you - the invariant that any transaction instance
  3288. * should not be run while it is already being run. You would typically create a
  3289. * single instance of a `Transaction` for reuse multiple times, that potentially
  3290. * is used to wrap several different methods. Wrappers are extremely simple -
  3291. * they only require implementing two methods.
  3292. *
  3293. * <pre>
  3294. * wrappers (injected at creation time)
  3295. * + +
  3296. * | |
  3297. * +-----------------|--------|--------------+
  3298. * | v | |
  3299. * | +---------------+ | |
  3300. * | +--| wrapper1 |---|----+ |
  3301. * | | +---------------+ v | |
  3302. * | | +-------------+ | |
  3303. * | | +----| wrapper2 |--------+ |
  3304. * | | | +-------------+ | | |
  3305. * | | | | | |
  3306. * | v v v v | wrapper
  3307. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  3308. * perform(anyMethod) | | | | | | | | | | | | maintained
  3309. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  3310. * | | | | | | | | | | | |
  3311. * | | | | | | | | | | | |
  3312. * | | | | | | | | | | | |
  3313. * | +---+ +---+ +---------+ +---+ +---+ |
  3314. * | initialize close |
  3315. * +-----------------------------------------+
  3316. * </pre>
  3317. *
  3318. * Use cases:
  3319. * - Preserving the input selection ranges before/after reconciliation.
  3320. * Restoring selection even in the event of an unexpected error.
  3321. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  3322. * while guaranteeing that afterwards, the event system is reactivated.
  3323. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  3324. * reconciliation takes place in a worker thread.
  3325. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  3326. * content.
  3327. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  3328. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  3329. * - (Future use case): Layout calculations before and after DOM updates.
  3330. *
  3331. * Transactional plugin API:
  3332. * - A module that has an `initialize` method that returns any precomputation.
  3333. * - and a `close` method that accepts the precomputation. `close` is invoked
  3334. * when the wrapped process is completed, or has failed.
  3335. *
  3336. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  3337. * that implement `initialize` and `close`.
  3338. * @return {Transaction} Single transaction for reuse in thread.
  3339. *
  3340. * @class Transaction
  3341. */
  3342. var TransactionImpl = {
  3343. /**
  3344. * Sets up this instance so that it is prepared for collecting metrics. Does
  3345. * so such that this setup method may be used on an instance that is already
  3346. * initialized, in a way that does not consume additional memory upon reuse.
  3347. * That can be useful if you decide to make your subclass of this mixin a
  3348. * "PooledClass".
  3349. */
  3350. reinitializeTransaction: function () {
  3351. this.transactionWrappers = this.getTransactionWrappers();
  3352. if (this.wrapperInitData) {
  3353. this.wrapperInitData.length = 0;
  3354. } else {
  3355. this.wrapperInitData = [];
  3356. }
  3357. this._isInTransaction = false;
  3358. },
  3359. _isInTransaction: false,
  3360. /**
  3361. * @abstract
  3362. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  3363. */
  3364. getTransactionWrappers: null,
  3365. isInTransaction: function () {
  3366. return !!this._isInTransaction;
  3367. },
  3368. /**
  3369. * Executes the function within a safety window. Use this for the top level
  3370. * methods that result in large amounts of computation/mutations that would
  3371. * need to be safety checked. The optional arguments helps prevent the need
  3372. * to bind in many cases.
  3373. *
  3374. * @param {function} method Member of scope to call.
  3375. * @param {Object} scope Scope to invoke from.
  3376. * @param {Object?=} a Argument to pass to the method.
  3377. * @param {Object?=} b Argument to pass to the method.
  3378. * @param {Object?=} c Argument to pass to the method.
  3379. * @param {Object?=} d Argument to pass to the method.
  3380. * @param {Object?=} e Argument to pass to the method.
  3381. * @param {Object?=} f Argument to pass to the method.
  3382. *
  3383. * @return {*} Return value from `method`.
  3384. */
  3385. perform: function (method, scope, a, b, c, d, e, f) {
  3386. !!this.isInTransaction() ? false ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
  3387. var errorThrown;
  3388. var ret;
  3389. try {
  3390. this._isInTransaction = true;
  3391. // Catching errors makes debugging more difficult, so we start with
  3392. // errorThrown set to true before setting it to false after calling
  3393. // close -- if it's still set to true in the finally block, it means
  3394. // one of these calls threw.
  3395. errorThrown = true;
  3396. this.initializeAll(0);
  3397. ret = method.call(scope, a, b, c, d, e, f);
  3398. errorThrown = false;
  3399. } finally {
  3400. try {
  3401. if (errorThrown) {
  3402. // If `method` throws, prefer to show that stack trace over any thrown
  3403. // by invoking `closeAll`.
  3404. try {
  3405. this.closeAll(0);
  3406. } catch (err) {}
  3407. } else {
  3408. // Since `method` didn't throw, we don't want to silence the exception
  3409. // here.
  3410. this.closeAll(0);
  3411. }
  3412. } finally {
  3413. this._isInTransaction = false;
  3414. }
  3415. }
  3416. return ret;
  3417. },
  3418. initializeAll: function (startIndex) {
  3419. var transactionWrappers = this.transactionWrappers;
  3420. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3421. var wrapper = transactionWrappers[i];
  3422. try {
  3423. // Catching errors makes debugging more difficult, so we start with the
  3424. // OBSERVED_ERROR state before overwriting it with the real return value
  3425. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  3426. // block, it means wrapper.initialize threw.
  3427. this.wrapperInitData[i] = OBSERVED_ERROR;
  3428. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  3429. } finally {
  3430. if (this.wrapperInitData[i] === OBSERVED_ERROR) {
  3431. // The initializer for wrapper i threw an error; initialize the
  3432. // remaining wrappers but silence any exceptions from them to ensure
  3433. // that the first error is the one to bubble up.
  3434. try {
  3435. this.initializeAll(i + 1);
  3436. } catch (err) {}
  3437. }
  3438. }
  3439. }
  3440. },
  3441. /**
  3442. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  3443. * them the respective return values of `this.transactionWrappers.init[i]`
  3444. * (`close`rs that correspond to initializers that failed will not be
  3445. * invoked).
  3446. */
  3447. closeAll: function (startIndex) {
  3448. !this.isInTransaction() ? false ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
  3449. var transactionWrappers = this.transactionWrappers;
  3450. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3451. var wrapper = transactionWrappers[i];
  3452. var initData = this.wrapperInitData[i];
  3453. var errorThrown;
  3454. try {
  3455. // Catching errors makes debugging more difficult, so we start with
  3456. // errorThrown set to true before setting it to false after calling
  3457. // close -- if it's still set to true in the finally block, it means
  3458. // wrapper.close threw.
  3459. errorThrown = true;
  3460. if (initData !== OBSERVED_ERROR && wrapper.close) {
  3461. wrapper.close.call(this, initData);
  3462. }
  3463. errorThrown = false;
  3464. } finally {
  3465. if (errorThrown) {
  3466. // The closer for wrapper i threw an error; close the remaining
  3467. // wrappers but silence any exceptions from them to ensure that the
  3468. // first error is the one to bubble up.
  3469. try {
  3470. this.closeAll(i + 1);
  3471. } catch (e) {}
  3472. }
  3473. }
  3474. }
  3475. this.wrapperInitData.length = 0;
  3476. }
  3477. };
  3478. module.exports = TransactionImpl;
  3479. /***/ }),
  3480. /* 31 */
  3481. /***/ (function(module, exports, __webpack_require__) {
  3482. "use strict";
  3483. /**
  3484. * Copyright 2016-present, Facebook, Inc.
  3485. * All rights reserved.
  3486. *
  3487. * This source code is licensed under the BSD-style license found in the
  3488. * LICENSE file in the root directory of this source tree. An additional grant
  3489. * of patent rights can be found in the PATENTS file in the same directory.
  3490. *
  3491. * Based on the escape-html library, which is used under the MIT License below:
  3492. *
  3493. * Copyright (c) 2012-2013 TJ Holowaychuk
  3494. * Copyright (c) 2015 Andreas Lubbe
  3495. * Copyright (c) 2015 Tiancheng "Timothy" Gu
  3496. *
  3497. * Permission is hereby granted, free of charge, to any person obtaining
  3498. * a copy of this software and associated documentation files (the
  3499. * 'Software'), to deal in the Software without restriction, including
  3500. * without limitation the rights to use, copy, modify, merge, publish,
  3501. * distribute, sublicense, and/or sell copies of the Software, and to
  3502. * permit persons to whom the Software is furnished to do so, subject to
  3503. * the following conditions:
  3504. *
  3505. * The above copyright notice and this permission notice shall be
  3506. * included in all copies or substantial portions of the Software.
  3507. *
  3508. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  3509. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3510. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  3511. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  3512. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  3513. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  3514. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3515. *
  3516. */
  3517. // code copied and modified from escape-html
  3518. /**
  3519. * Module variables.
  3520. * @private
  3521. */
  3522. var matchHtmlRegExp = /["'&<>]/;
  3523. /**
  3524. * Escape special characters in the given string of html.
  3525. *
  3526. * @param {string} string The string to escape for inserting into HTML
  3527. * @return {string}
  3528. * @public
  3529. */
  3530. function escapeHtml(string) {
  3531. var str = '' + string;
  3532. var match = matchHtmlRegExp.exec(str);
  3533. if (!match) {
  3534. return str;
  3535. }
  3536. var escape;
  3537. var html = '';
  3538. var index = 0;
  3539. var lastIndex = 0;
  3540. for (index = match.index; index < str.length; index++) {
  3541. switch (str.charCodeAt(index)) {
  3542. case 34:
  3543. // "
  3544. escape = '&quot;';
  3545. break;
  3546. case 38:
  3547. // &
  3548. escape = '&amp;';
  3549. break;
  3550. case 39:
  3551. // '
  3552. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  3553. break;
  3554. case 60:
  3555. // <
  3556. escape = '&lt;';
  3557. break;
  3558. case 62:
  3559. // >
  3560. escape = '&gt;';
  3561. break;
  3562. default:
  3563. continue;
  3564. }
  3565. if (lastIndex !== index) {
  3566. html += str.substring(lastIndex, index);
  3567. }
  3568. lastIndex = index + 1;
  3569. html += escape;
  3570. }
  3571. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  3572. }
  3573. // end code copied and modified from escape-html
  3574. /**
  3575. * Escapes text to prevent scripting attacks.
  3576. *
  3577. * @param {*} text Text value to escape.
  3578. * @return {string} An escaped string.
  3579. */
  3580. function escapeTextContentForBrowser(text) {
  3581. if (typeof text === 'boolean' || typeof text === 'number') {
  3582. // this shortcircuit helps perf for types that we know will never have
  3583. // special characters, especially given that this function is used often
  3584. // for numeric dom ids.
  3585. return '' + text;
  3586. }
  3587. return escapeHtml(text);
  3588. }
  3589. module.exports = escapeTextContentForBrowser;
  3590. /***/ }),
  3591. /* 32 */
  3592. /***/ (function(module, exports, __webpack_require__) {
  3593. "use strict";
  3594. /**
  3595. * Copyright 2013-present, Facebook, Inc.
  3596. * All rights reserved.
  3597. *
  3598. * This source code is licensed under the BSD-style license found in the
  3599. * LICENSE file in the root directory of this source tree. An additional grant
  3600. * of patent rights can be found in the PATENTS file in the same directory.
  3601. *
  3602. */
  3603. var ExecutionEnvironment = __webpack_require__(5);
  3604. var DOMNamespaces = __webpack_require__(36);
  3605. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  3606. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  3607. var createMicrosoftUnsafeLocalFunction = __webpack_require__(44);
  3608. // SVG temp container for IE lacking innerHTML
  3609. var reusableSVGContainer;
  3610. /**
  3611. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  3612. * even in IE8.
  3613. *
  3614. * @param {DOMElement} node
  3615. * @param {string} html
  3616. * @internal
  3617. */
  3618. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  3619. // IE does not have innerHTML for SVG nodes, so instead we inject the
  3620. // new markup in a temp node and then move the child nodes across into
  3621. // the target node
  3622. if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
  3623. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  3624. reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  3625. var svgNode = reusableSVGContainer.firstChild;
  3626. while (svgNode.firstChild) {
  3627. node.appendChild(svgNode.firstChild);
  3628. }
  3629. } else {
  3630. node.innerHTML = html;
  3631. }
  3632. });
  3633. if (ExecutionEnvironment.canUseDOM) {
  3634. // IE8: When updating a just created node with innerHTML only leading
  3635. // whitespace is removed. When updating an existing node with innerHTML
  3636. // whitespace in root TextNodes is also collapsed.
  3637. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  3638. // Feature detection; only IE8 is known to behave improperly like this.
  3639. var testElement = document.createElement('div');
  3640. testElement.innerHTML = ' ';
  3641. if (testElement.innerHTML === '') {
  3642. setInnerHTML = function (node, html) {
  3643. // Magic theory: IE8 supposedly differentiates between added and updated
  3644. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  3645. // from worse whitespace behavior. Re-adding a node like this triggers
  3646. // the initial and more favorable whitespace behavior.
  3647. // TODO: What to do on a detached node?
  3648. if (node.parentNode) {
  3649. node.parentNode.replaceChild(node, node);
  3650. }
  3651. // We also implement a workaround for non-visible tags disappearing into
  3652. // thin air on IE8, this only happens if there is no visible text
  3653. // in-front of the non-visible tags. Piggyback on the whitespace fix
  3654. // and simply check if any non-visible tags appear in the source.
  3655. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  3656. // Recover leading whitespace by temporarily prepending any character.
  3657. // \uFEFF has the potential advantage of being zero-width/invisible.
  3658. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  3659. // in hopes that this is preserved even if "\uFEFF" is transformed to
  3660. // the actual Unicode character (by Babel, for example).
  3661. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  3662. node.innerHTML = String.fromCharCode(0xFEFF) + html;
  3663. // deleteData leaves an empty `TextNode` which offsets the index of all
  3664. // children. Definitely want to avoid this.
  3665. var textNode = node.firstChild;
  3666. if (textNode.data.length === 1) {
  3667. node.removeChild(textNode);
  3668. } else {
  3669. textNode.deleteData(0, 1);
  3670. }
  3671. } else {
  3672. node.innerHTML = html;
  3673. }
  3674. };
  3675. }
  3676. testElement = null;
  3677. }
  3678. module.exports = setInnerHTML;
  3679. /***/ }),
  3680. /* 33 */
  3681. /***/ (function(module, exports, __webpack_require__) {
  3682. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  3683. // Distributed under an MIT license: http://codemirror.net/LICENSE
  3684. // This is CodeMirror (http://codemirror.net), a code editor
  3685. // implemented in JavaScript on top of the browser's DOM.
  3686. //
  3687. // You can find some technical background for some of the code below
  3688. // at http://marijnhaverbeke.nl/blog/#cm-internals .
  3689. (function (global, factory) {
  3690. true ? module.exports = factory() :
  3691. typeof define === 'function' && define.amd ? define(factory) :
  3692. (global.CodeMirror = factory());
  3693. }(this, (function () { 'use strict';
  3694. // Kludges for bugs and behavior differences that can't be feature
  3695. // detected are enabled based on userAgent etc sniffing.
  3696. var userAgent = navigator.userAgent;
  3697. var platform = navigator.platform;
  3698. var gecko = /gecko\/\d/i.test(userAgent);
  3699. var ie_upto10 = /MSIE \d/.test(userAgent);
  3700. var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  3701. var edge = /Edge\/(\d+)/.exec(userAgent);
  3702. var ie = ie_upto10 || ie_11up || edge;
  3703. var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  3704. var webkit = !edge && /WebKit\//.test(userAgent);
  3705. var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  3706. var chrome = !edge && /Chrome\//.test(userAgent);
  3707. var presto = /Opera\//.test(userAgent);
  3708. var safari = /Apple Computer/.test(navigator.vendor);
  3709. var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  3710. var phantom = /PhantomJS/.test(userAgent);
  3711. var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
  3712. var android = /Android/.test(userAgent);
  3713. // This is woefully incomplete. Suggestions for alternative methods welcome.
  3714. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  3715. var mac = ios || /Mac/.test(platform);
  3716. var chromeOS = /\bCrOS\b/.test(userAgent);
  3717. var windows = /win/i.test(platform);
  3718. var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  3719. if (presto_version) { presto_version = Number(presto_version[1]); }
  3720. if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  3721. // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  3722. var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  3723. var captureRightClick = gecko || (ie && ie_version >= 9);
  3724. function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
  3725. var rmClass = function(node, cls) {
  3726. var current = node.className;
  3727. var match = classTest(cls).exec(current);
  3728. if (match) {
  3729. var after = current.slice(match.index + match[0].length);
  3730. node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
  3731. }
  3732. };
  3733. function removeChildren(e) {
  3734. for (var count = e.childNodes.length; count > 0; --count)
  3735. { e.removeChild(e.firstChild); }
  3736. return e
  3737. }
  3738. function removeChildrenAndAdd(parent, e) {
  3739. return removeChildren(parent).appendChild(e)
  3740. }
  3741. function elt(tag, content, className, style) {
  3742. var e = document.createElement(tag);
  3743. if (className) { e.className = className; }
  3744. if (style) { e.style.cssText = style; }
  3745. if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
  3746. else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
  3747. return e
  3748. }
  3749. // wrapper for elt, which removes the elt from the accessibility tree
  3750. function eltP(tag, content, className, style) {
  3751. var e = elt(tag, content, className, style);
  3752. e.setAttribute("role", "presentation");
  3753. return e
  3754. }
  3755. var range;
  3756. if (document.createRange) { range = function(node, start, end, endNode) {
  3757. var r = document.createRange();
  3758. r.setEnd(endNode || node, end);
  3759. r.setStart(node, start);
  3760. return r
  3761. }; }
  3762. else { range = function(node, start, end) {
  3763. var r = document.body.createTextRange();
  3764. try { r.moveToElementText(node.parentNode); }
  3765. catch(e) { return r }
  3766. r.collapse(true);
  3767. r.moveEnd("character", end);
  3768. r.moveStart("character", start);
  3769. return r
  3770. }; }
  3771. function contains(parent, child) {
  3772. if (child.nodeType == 3) // Android browser always returns false when child is a textnode
  3773. { child = child.parentNode; }
  3774. if (parent.contains)
  3775. { return parent.contains(child) }
  3776. do {
  3777. if (child.nodeType == 11) { child = child.host; }
  3778. if (child == parent) { return true }
  3779. } while (child = child.parentNode)
  3780. }
  3781. function activeElt() {
  3782. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
  3783. // IE < 10 will throw when accessed while the page is loading or in an iframe.
  3784. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
  3785. var activeElement;
  3786. try {
  3787. activeElement = document.activeElement;
  3788. } catch(e) {
  3789. activeElement = document.body || null;
  3790. }
  3791. while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
  3792. { activeElement = activeElement.shadowRoot.activeElement; }
  3793. return activeElement
  3794. }
  3795. function addClass(node, cls) {
  3796. var current = node.className;
  3797. if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  3798. }
  3799. function joinClasses(a, b) {
  3800. var as = a.split(" ");
  3801. for (var i = 0; i < as.length; i++)
  3802. { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
  3803. return b
  3804. }
  3805. var selectInput = function(node) { node.select(); };
  3806. if (ios) // Mobile Safari apparently has a bug where select() is broken.
  3807. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  3808. else if (ie) // Suppress mysterious IE10 errors
  3809. { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
  3810. function bind(f) {
  3811. var args = Array.prototype.slice.call(arguments, 1);
  3812. return function(){return f.apply(null, args)}
  3813. }
  3814. function copyObj(obj, target, overwrite) {
  3815. if (!target) { target = {}; }
  3816. for (var prop in obj)
  3817. { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
  3818. { target[prop] = obj[prop]; } }
  3819. return target
  3820. }
  3821. // Counts the column offset in a string, taking tabs into account.
  3822. // Used mostly to find indentation.
  3823. function countColumn(string, end, tabSize, startIndex, startValue) {
  3824. if (end == null) {
  3825. end = string.search(/[^\s\u00a0]/);
  3826. if (end == -1) { end = string.length; }
  3827. }
  3828. for (var i = startIndex || 0, n = startValue || 0;;) {
  3829. var nextTab = string.indexOf("\t", i);
  3830. if (nextTab < 0 || nextTab >= end)
  3831. { return n + (end - i) }
  3832. n += nextTab - i;
  3833. n += tabSize - (n % tabSize);
  3834. i = nextTab + 1;
  3835. }
  3836. }
  3837. var Delayed = function() {this.id = null;};
  3838. Delayed.prototype.set = function (ms, f) {
  3839. clearTimeout(this.id);
  3840. this.id = setTimeout(f, ms);
  3841. };
  3842. function indexOf(array, elt) {
  3843. for (var i = 0; i < array.length; ++i)
  3844. { if (array[i] == elt) { return i } }
  3845. return -1
  3846. }
  3847. // Number of pixels added to scroller and sizer to hide scrollbar
  3848. var scrollerGap = 30;
  3849. // Returned or thrown by various protocols to signal 'I'm not
  3850. // handling this'.
  3851. var Pass = {toString: function(){return "CodeMirror.Pass"}};
  3852. // Reused option objects for setSelection & friends
  3853. var sel_dontScroll = {scroll: false};
  3854. var sel_mouse = {origin: "*mouse"};
  3855. var sel_move = {origin: "+move"};
  3856. // The inverse of countColumn -- find the offset that corresponds to
  3857. // a particular column.
  3858. function findColumn(string, goal, tabSize) {
  3859. for (var pos = 0, col = 0;;) {
  3860. var nextTab = string.indexOf("\t", pos);
  3861. if (nextTab == -1) { nextTab = string.length; }
  3862. var skipped = nextTab - pos;
  3863. if (nextTab == string.length || col + skipped >= goal)
  3864. { return pos + Math.min(skipped, goal - col) }
  3865. col += nextTab - pos;
  3866. col += tabSize - (col % tabSize);
  3867. pos = nextTab + 1;
  3868. if (col >= goal) { return pos }
  3869. }
  3870. }
  3871. var spaceStrs = [""];
  3872. function spaceStr(n) {
  3873. while (spaceStrs.length <= n)
  3874. { spaceStrs.push(lst(spaceStrs) + " "); }
  3875. return spaceStrs[n]
  3876. }
  3877. function lst(arr) { return arr[arr.length-1] }
  3878. function map(array, f) {
  3879. var out = [];
  3880. for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
  3881. return out
  3882. }
  3883. function insertSorted(array, value, score) {
  3884. var pos = 0, priority = score(value);
  3885. while (pos < array.length && score(array[pos]) <= priority) { pos++; }
  3886. array.splice(pos, 0, value);
  3887. }
  3888. function nothing() {}
  3889. function createObj(base, props) {
  3890. var inst;
  3891. if (Object.create) {
  3892. inst = Object.create(base);
  3893. } else {
  3894. nothing.prototype = base;
  3895. inst = new nothing();
  3896. }
  3897. if (props) { copyObj(props, inst); }
  3898. return inst
  3899. }
  3900. var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  3901. function isWordCharBasic(ch) {
  3902. return /\w/.test(ch) || ch > "\x80" &&
  3903. (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  3904. }
  3905. function isWordChar(ch, helper) {
  3906. if (!helper) { return isWordCharBasic(ch) }
  3907. if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
  3908. return helper.test(ch)
  3909. }
  3910. function isEmpty(obj) {
  3911. for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
  3912. return true
  3913. }
  3914. // Extending unicode characters. A series of a non-extending char +
  3915. // any number of extending chars is treated as a single unit as far
  3916. // as editing and measuring is concerned. This is not fully correct,
  3917. // since some scripts/fonts/browsers also treat other configurations
  3918. // of code points as a group.
  3919. var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
  3920. function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
  3921. // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
  3922. function skipExtendingChars(str, pos, dir) {
  3923. while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
  3924. return pos
  3925. }
  3926. // Returns the value from the range [`from`; `to`] that satisfies
  3927. // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
  3928. function findFirst(pred, from, to) {
  3929. for (;;) {
  3930. if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
  3931. var mid = Math.floor((from + to) / 2);
  3932. if (pred(mid)) { to = mid; }
  3933. else { from = mid; }
  3934. }
  3935. }
  3936. // The display handles the DOM integration, both for input reading
  3937. // and content drawing. It holds references to DOM nodes and
  3938. // display-related state.
  3939. function Display(place, doc, input) {
  3940. var d = this;
  3941. this.input = input;
  3942. // Covers bottom-right square when both scrollbars are present.
  3943. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
  3944. d.scrollbarFiller.setAttribute("cm-not-content", "true");
  3945. // Covers bottom of gutter when coverGutterNextToScrollbar is on
  3946. // and h scrollbar is present.
  3947. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
  3948. d.gutterFiller.setAttribute("cm-not-content", "true");
  3949. // Will contain the actual code, positioned to cover the viewport.
  3950. d.lineDiv = eltP("div", null, "CodeMirror-code");
  3951. // Elements are added to these to represent selection and cursors.
  3952. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
  3953. d.cursorDiv = elt("div", null, "CodeMirror-cursors");
  3954. // A visibility: hidden element used to find the size of things.
  3955. d.measure = elt("div", null, "CodeMirror-measure");
  3956. // When lines outside of the viewport are measured, they are drawn in this.
  3957. d.lineMeasure = elt("div", null, "CodeMirror-measure");
  3958. // Wraps everything that needs to exist inside the vertically-padded coordinate system
  3959. d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
  3960. null, "position: relative; outline: none");
  3961. var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
  3962. // Moved around its parent to cover visible view.
  3963. d.mover = elt("div", [lines], null, "position: relative");
  3964. // Set to the height of the document, allowing scrolling.
  3965. d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  3966. d.sizerWidth = null;
  3967. // Behavior of elts with overflow: auto and padding is
  3968. // inconsistent across browsers. This is used to ensure the
  3969. // scrollable area is big enough.
  3970. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
  3971. // Will contain the gutters, if any.
  3972. d.gutters = elt("div", null, "CodeMirror-gutters");
  3973. d.lineGutter = null;
  3974. // Actual scrollable element.
  3975. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
  3976. d.scroller.setAttribute("tabIndex", "-1");
  3977. // The element in which the editor lives.
  3978. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
  3979. // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
  3980. if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  3981. if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
  3982. if (place) {
  3983. if (place.appendChild) { place.appendChild(d.wrapper); }
  3984. else { place(d.wrapper); }
  3985. }
  3986. // Current rendered range (may be bigger than the view window).
  3987. d.viewFrom = d.viewTo = doc.first;
  3988. d.reportedViewFrom = d.reportedViewTo = doc.first;
  3989. // Information about the rendered lines.
  3990. d.view = [];
  3991. d.renderedView = null;
  3992. // Holds info about a single rendered line when it was rendered
  3993. // for measurement, while not in view.
  3994. d.externalMeasured = null;
  3995. // Empty space (in pixels) above the view
  3996. d.viewOffset = 0;
  3997. d.lastWrapHeight = d.lastWrapWidth = 0;
  3998. d.updateLineNumbers = null;
  3999. d.nativeBarWidth = d.barHeight = d.barWidth = 0;
  4000. d.scrollbarsClipped = false;
  4001. // Used to only resize the line number gutter when necessary (when
  4002. // the amount of lines crosses a boundary that makes its width change)
  4003. d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  4004. // Set to true when a non-horizontal-scrolling line widget is
  4005. // added. As an optimization, line widget aligning is skipped when
  4006. // this is false.
  4007. d.alignWidgets = false;
  4008. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  4009. // Tracks the maximum line length so that the horizontal scrollbar
  4010. // can be kept static when scrolling.
  4011. d.maxLine = null;
  4012. d.maxLineLength = 0;
  4013. d.maxLineChanged = false;
  4014. // Used for measuring wheel scrolling granularity
  4015. d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
  4016. // True when shift is held down.
  4017. d.shift = false;
  4018. // Used to track whether anything happened since the context menu
  4019. // was opened.
  4020. d.selForContextMenu = null;
  4021. d.activeTouch = null;
  4022. input.init(d);
  4023. }
  4024. // Find the line object corresponding to the given line number.
  4025. function getLine(doc, n) {
  4026. n -= doc.first;
  4027. if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
  4028. var chunk = doc;
  4029. while (!chunk.lines) {
  4030. for (var i = 0;; ++i) {
  4031. var child = chunk.children[i], sz = child.chunkSize();
  4032. if (n < sz) { chunk = child; break }
  4033. n -= sz;
  4034. }
  4035. }
  4036. return chunk.lines[n]
  4037. }
  4038. // Get the part of a document between two positions, as an array of
  4039. // strings.
  4040. function getBetween(doc, start, end) {
  4041. var out = [], n = start.line;
  4042. doc.iter(start.line, end.line + 1, function (line) {
  4043. var text = line.text;
  4044. if (n == end.line) { text = text.slice(0, end.ch); }
  4045. if (n == start.line) { text = text.slice(start.ch); }
  4046. out.push(text);
  4047. ++n;
  4048. });
  4049. return out
  4050. }
  4051. // Get the lines between from and to, as array of strings.
  4052. function getLines(doc, from, to) {
  4053. var out = [];
  4054. doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
  4055. return out
  4056. }
  4057. // Update the height of a line, propagating the height change
  4058. // upwards to parent nodes.
  4059. function updateLineHeight(line, height) {
  4060. var diff = height - line.height;
  4061. if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  4062. }
  4063. // Given a line object, find its line number by walking up through
  4064. // its parent links.
  4065. function lineNo(line) {
  4066. if (line.parent == null) { return null }
  4067. var cur = line.parent, no = indexOf(cur.lines, line);
  4068. for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
  4069. for (var i = 0;; ++i) {
  4070. if (chunk.children[i] == cur) { break }
  4071. no += chunk.children[i].chunkSize();
  4072. }
  4073. }
  4074. return no + cur.first
  4075. }
  4076. // Find the line at the given vertical position, using the height
  4077. // information in the document tree.
  4078. function lineAtHeight(chunk, h) {
  4079. var n = chunk.first;
  4080. outer: do {
  4081. for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
  4082. var child = chunk.children[i$1], ch = child.height;
  4083. if (h < ch) { chunk = child; continue outer }
  4084. h -= ch;
  4085. n += child.chunkSize();
  4086. }
  4087. return n
  4088. } while (!chunk.lines)
  4089. var i = 0;
  4090. for (; i < chunk.lines.length; ++i) {
  4091. var line = chunk.lines[i], lh = line.height;
  4092. if (h < lh) { break }
  4093. h -= lh;
  4094. }
  4095. return n + i
  4096. }
  4097. function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
  4098. function lineNumberFor(options, i) {
  4099. return String(options.lineNumberFormatter(i + options.firstLineNumber))
  4100. }
  4101. // A Pos instance represents a position within the text.
  4102. function Pos(line, ch, sticky) {
  4103. if ( sticky === void 0 ) sticky = null;
  4104. if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
  4105. this.line = line;
  4106. this.ch = ch;
  4107. this.sticky = sticky;
  4108. }
  4109. // Compare two positions, return 0 if they are the same, a negative
  4110. // number when a is less, and a positive number otherwise.
  4111. function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
  4112. function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
  4113. function copyPos(x) {return Pos(x.line, x.ch)}
  4114. function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  4115. function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
  4116. // Most of the external API clips given positions to make sure they
  4117. // actually exist within the document.
  4118. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  4119. function clipPos(doc, pos) {
  4120. if (pos.line < doc.first) { return Pos(doc.first, 0) }
  4121. var last = doc.first + doc.size - 1;
  4122. if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
  4123. return clipToLen(pos, getLine(doc, pos.line).text.length)
  4124. }
  4125. function clipToLen(pos, linelen) {
  4126. var ch = pos.ch;
  4127. if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
  4128. else if (ch < 0) { return Pos(pos.line, 0) }
  4129. else { return pos }
  4130. }
  4131. function clipPosArray(doc, array) {
  4132. var out = [];
  4133. for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
  4134. return out
  4135. }
  4136. // Optimize some code when these features are not used.
  4137. var sawReadOnlySpans = false;
  4138. var sawCollapsedSpans = false;
  4139. function seeReadOnlySpans() {
  4140. sawReadOnlySpans = true;
  4141. }
  4142. function seeCollapsedSpans() {
  4143. sawCollapsedSpans = true;
  4144. }
  4145. // TEXTMARKER SPANS
  4146. function MarkedSpan(marker, from, to) {
  4147. this.marker = marker;
  4148. this.from = from; this.to = to;
  4149. }
  4150. // Search an array of spans for a span matching the given marker.
  4151. function getMarkedSpanFor(spans, marker) {
  4152. if (spans) { for (var i = 0; i < spans.length; ++i) {
  4153. var span = spans[i];
  4154. if (span.marker == marker) { return span }
  4155. } }
  4156. }
  4157. // Remove a span from an array, returning undefined if no spans are
  4158. // left (we don't store arrays for lines without spans).
  4159. function removeMarkedSpan(spans, span) {
  4160. var r;
  4161. for (var i = 0; i < spans.length; ++i)
  4162. { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
  4163. return r
  4164. }
  4165. // Add a span to a line.
  4166. function addMarkedSpan(line, span) {
  4167. line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
  4168. span.marker.attachLine(line);
  4169. }
  4170. // Used for the algorithm that adjusts markers for a change in the
  4171. // document. These functions cut an array of spans at a given
  4172. // character position, returning an array of remaining chunks (or
  4173. // undefined if nothing remains).
  4174. function markedSpansBefore(old, startCh, isInsert) {
  4175. var nw;
  4176. if (old) { for (var i = 0; i < old.length; ++i) {
  4177. var span = old[i], marker = span.marker;
  4178. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
  4179. if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
  4180. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
  4181. }
  4182. } }
  4183. return nw
  4184. }
  4185. function markedSpansAfter(old, endCh, isInsert) {
  4186. var nw;
  4187. if (old) { for (var i = 0; i < old.length; ++i) {
  4188. var span = old[i], marker = span.marker;
  4189. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
  4190. if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
  4191. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
  4192. span.to == null ? null : span.to - endCh));
  4193. }
  4194. } }
  4195. return nw
  4196. }
  4197. // Given a change object, compute the new set of marker spans that
  4198. // cover the line in which the change took place. Removes spans
  4199. // entirely within the change, reconnects spans belonging to the
  4200. // same marker that appear on both sides of the change, and cuts off
  4201. // spans partially within the change. Returns an array of span
  4202. // arrays with one element for each line in (after) the change.
  4203. function stretchSpansOverChange(doc, change) {
  4204. if (change.full) { return null }
  4205. var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
  4206. var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
  4207. if (!oldFirst && !oldLast) { return null }
  4208. var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
  4209. // Get the spans that 'stick out' on both sides
  4210. var first = markedSpansBefore(oldFirst, startCh, isInsert);
  4211. var last = markedSpansAfter(oldLast, endCh, isInsert);
  4212. // Next, merge those two ends
  4213. var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
  4214. if (first) {
  4215. // Fix up .to properties of first
  4216. for (var i = 0; i < first.length; ++i) {
  4217. var span = first[i];
  4218. if (span.to == null) {
  4219. var found = getMarkedSpanFor(last, span.marker);
  4220. if (!found) { span.to = startCh; }
  4221. else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
  4222. }
  4223. }
  4224. }
  4225. if (last) {
  4226. // Fix up .from in last (or move them into first in case of sameLine)
  4227. for (var i$1 = 0; i$1 < last.length; ++i$1) {
  4228. var span$1 = last[i$1];
  4229. if (span$1.to != null) { span$1.to += offset; }
  4230. if (span$1.from == null) {
  4231. var found$1 = getMarkedSpanFor(first, span$1.marker);
  4232. if (!found$1) {
  4233. span$1.from = offset;
  4234. if (sameLine) { (first || (first = [])).push(span$1); }
  4235. }
  4236. } else {
  4237. span$1.from += offset;
  4238. if (sameLine) { (first || (first = [])).push(span$1); }
  4239. }
  4240. }
  4241. }
  4242. // Make sure we didn't create any zero-length spans
  4243. if (first) { first = clearEmptySpans(first); }
  4244. if (last && last != first) { last = clearEmptySpans(last); }
  4245. var newMarkers = [first];
  4246. if (!sameLine) {
  4247. // Fill gap with whole-line-spans
  4248. var gap = change.text.length - 2, gapMarkers;
  4249. if (gap > 0 && first)
  4250. { for (var i$2 = 0; i$2 < first.length; ++i$2)
  4251. { if (first[i$2].to == null)
  4252. { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
  4253. for (var i$3 = 0; i$3 < gap; ++i$3)
  4254. { newMarkers.push(gapMarkers); }
  4255. newMarkers.push(last);
  4256. }
  4257. return newMarkers
  4258. }
  4259. // Remove spans that are empty and don't have a clearWhenEmpty
  4260. // option of false.
  4261. function clearEmptySpans(spans) {
  4262. for (var i = 0; i < spans.length; ++i) {
  4263. var span = spans[i];
  4264. if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
  4265. { spans.splice(i--, 1); }
  4266. }
  4267. if (!spans.length) { return null }
  4268. return spans
  4269. }
  4270. // Used to 'clip' out readOnly ranges when making a change.
  4271. function removeReadOnlyRanges(doc, from, to) {
  4272. var markers = null;
  4273. doc.iter(from.line, to.line + 1, function (line) {
  4274. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  4275. var mark = line.markedSpans[i].marker;
  4276. if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
  4277. { (markers || (markers = [])).push(mark); }
  4278. } }
  4279. });
  4280. if (!markers) { return null }
  4281. var parts = [{from: from, to: to}];
  4282. for (var i = 0; i < markers.length; ++i) {
  4283. var mk = markers[i], m = mk.find(0);
  4284. for (var j = 0; j < parts.length; ++j) {
  4285. var p = parts[j];
  4286. if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
  4287. var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
  4288. if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
  4289. { newParts.push({from: p.from, to: m.from}); }
  4290. if (dto > 0 || !mk.inclusiveRight && !dto)
  4291. { newParts.push({from: m.to, to: p.to}); }
  4292. parts.splice.apply(parts, newParts);
  4293. j += newParts.length - 3;
  4294. }
  4295. }
  4296. return parts
  4297. }
  4298. // Connect or disconnect spans from a line.
  4299. function detachMarkedSpans(line) {
  4300. var spans = line.markedSpans;
  4301. if (!spans) { return }
  4302. for (var i = 0; i < spans.length; ++i)
  4303. { spans[i].marker.detachLine(line); }
  4304. line.markedSpans = null;
  4305. }
  4306. function attachMarkedSpans(line, spans) {
  4307. if (!spans) { return }
  4308. for (var i = 0; i < spans.length; ++i)
  4309. { spans[i].marker.attachLine(line); }
  4310. line.markedSpans = spans;
  4311. }
  4312. // Helpers used when computing which overlapping collapsed span
  4313. // counts as the larger one.
  4314. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  4315. function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
  4316. // Returns a number indicating which of two overlapping collapsed
  4317. // spans is larger (and thus includes the other). Falls back to
  4318. // comparing ids when the spans cover exactly the same range.
  4319. function compareCollapsedMarkers(a, b) {
  4320. var lenDiff = a.lines.length - b.lines.length;
  4321. if (lenDiff != 0) { return lenDiff }
  4322. var aPos = a.find(), bPos = b.find();
  4323. var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
  4324. if (fromCmp) { return -fromCmp }
  4325. var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
  4326. if (toCmp) { return toCmp }
  4327. return b.id - a.id
  4328. }
  4329. // Find out whether a line ends or starts in a collapsed span. If
  4330. // so, return the marker for that span.
  4331. function collapsedSpanAtSide(line, start) {
  4332. var sps = sawCollapsedSpans && line.markedSpans, found;
  4333. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  4334. sp = sps[i];
  4335. if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
  4336. (!found || compareCollapsedMarkers(found, sp.marker) < 0))
  4337. { found = sp.marker; }
  4338. } }
  4339. return found
  4340. }
  4341. function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  4342. function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
  4343. // Test whether there exists a collapsed span that partially
  4344. // overlaps (covers the start or end, but not both) of a new span.
  4345. // Such overlap is not allowed.
  4346. function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
  4347. var line = getLine(doc, lineNo$$1);
  4348. var sps = sawCollapsedSpans && line.markedSpans;
  4349. if (sps) { for (var i = 0; i < sps.length; ++i) {
  4350. var sp = sps[i];
  4351. if (!sp.marker.collapsed) { continue }
  4352. var found = sp.marker.find(0);
  4353. var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
  4354. var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
  4355. if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
  4356. if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
  4357. fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
  4358. { return true }
  4359. } }
  4360. }
  4361. // A visual line is a line as drawn on the screen. Folding, for
  4362. // example, can cause multiple logical lines to appear on the same
  4363. // visual line. This finds the start of the visual line that the
  4364. // given line is part of (usually that is the line itself).
  4365. function visualLine(line) {
  4366. var merged;
  4367. while (merged = collapsedSpanAtStart(line))
  4368. { line = merged.find(-1, true).line; }
  4369. return line
  4370. }
  4371. function visualLineEnd(line) {
  4372. var merged;
  4373. while (merged = collapsedSpanAtEnd(line))
  4374. { line = merged.find(1, true).line; }
  4375. return line
  4376. }
  4377. // Returns an array of logical lines that continue the visual line
  4378. // started by the argument, or undefined if there are no such lines.
  4379. function visualLineContinued(line) {
  4380. var merged, lines;
  4381. while (merged = collapsedSpanAtEnd(line)) {
  4382. line = merged.find(1, true).line
  4383. ;(lines || (lines = [])).push(line);
  4384. }
  4385. return lines
  4386. }
  4387. // Get the line number of the start of the visual line that the
  4388. // given line number is part of.
  4389. function visualLineNo(doc, lineN) {
  4390. var line = getLine(doc, lineN), vis = visualLine(line);
  4391. if (line == vis) { return lineN }
  4392. return lineNo(vis)
  4393. }
  4394. // Get the line number of the start of the next visual line after
  4395. // the given line.
  4396. function visualLineEndNo(doc, lineN) {
  4397. if (lineN > doc.lastLine()) { return lineN }
  4398. var line = getLine(doc, lineN), merged;
  4399. if (!lineIsHidden(doc, line)) { return lineN }
  4400. while (merged = collapsedSpanAtEnd(line))
  4401. { line = merged.find(1, true).line; }
  4402. return lineNo(line) + 1
  4403. }
  4404. // Compute whether a line is hidden. Lines count as hidden when they
  4405. // are part of a visual line that starts with another line, or when
  4406. // they are entirely covered by collapsed, non-widget span.
  4407. function lineIsHidden(doc, line) {
  4408. var sps = sawCollapsedSpans && line.markedSpans;
  4409. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  4410. sp = sps[i];
  4411. if (!sp.marker.collapsed) { continue }
  4412. if (sp.from == null) { return true }
  4413. if (sp.marker.widgetNode) { continue }
  4414. if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
  4415. { return true }
  4416. } }
  4417. }
  4418. function lineIsHiddenInner(doc, line, span) {
  4419. if (span.to == null) {
  4420. var end = span.marker.find(1, true);
  4421. return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
  4422. }
  4423. if (span.marker.inclusiveRight && span.to == line.text.length)
  4424. { return true }
  4425. for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
  4426. sp = line.markedSpans[i];
  4427. if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
  4428. (sp.to == null || sp.to != span.from) &&
  4429. (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
  4430. lineIsHiddenInner(doc, line, sp)) { return true }
  4431. }
  4432. }
  4433. // Find the height above the given line.
  4434. function heightAtLine(lineObj) {
  4435. lineObj = visualLine(lineObj);
  4436. var h = 0, chunk = lineObj.parent;
  4437. for (var i = 0; i < chunk.lines.length; ++i) {
  4438. var line = chunk.lines[i];
  4439. if (line == lineObj) { break }
  4440. else { h += line.height; }
  4441. }
  4442. for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
  4443. for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
  4444. var cur = p.children[i$1];
  4445. if (cur == chunk) { break }
  4446. else { h += cur.height; }
  4447. }
  4448. }
  4449. return h
  4450. }
  4451. // Compute the character length of a line, taking into account
  4452. // collapsed ranges (see markText) that might hide parts, and join
  4453. // other lines onto it.
  4454. function lineLength(line) {
  4455. if (line.height == 0) { return 0 }
  4456. var len = line.text.length, merged, cur = line;
  4457. while (merged = collapsedSpanAtStart(cur)) {
  4458. var found = merged.find(0, true);
  4459. cur = found.from.line;
  4460. len += found.from.ch - found.to.ch;
  4461. }
  4462. cur = line;
  4463. while (merged = collapsedSpanAtEnd(cur)) {
  4464. var found$1 = merged.find(0, true);
  4465. len -= cur.text.length - found$1.from.ch;
  4466. cur = found$1.to.line;
  4467. len += cur.text.length - found$1.to.ch;
  4468. }
  4469. return len
  4470. }
  4471. // Find the longest line in the document.
  4472. function findMaxLine(cm) {
  4473. var d = cm.display, doc = cm.doc;
  4474. d.maxLine = getLine(doc, doc.first);
  4475. d.maxLineLength = lineLength(d.maxLine);
  4476. d.maxLineChanged = true;
  4477. doc.iter(function (line) {
  4478. var len = lineLength(line);
  4479. if (len > d.maxLineLength) {
  4480. d.maxLineLength = len;
  4481. d.maxLine = line;
  4482. }
  4483. });
  4484. }
  4485. // BIDI HELPERS
  4486. function iterateBidiSections(order, from, to, f) {
  4487. if (!order) { return f(from, to, "ltr") }
  4488. var found = false;
  4489. for (var i = 0; i < order.length; ++i) {
  4490. var part = order[i];
  4491. if (part.from < to && part.to > from || from == to && part.to == from) {
  4492. f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
  4493. found = true;
  4494. }
  4495. }
  4496. if (!found) { f(from, to, "ltr"); }
  4497. }
  4498. var bidiOther = null;
  4499. function getBidiPartAt(order, ch, sticky) {
  4500. var found;
  4501. bidiOther = null;
  4502. for (var i = 0; i < order.length; ++i) {
  4503. var cur = order[i];
  4504. if (cur.from < ch && cur.to > ch) { return i }
  4505. if (cur.to == ch) {
  4506. if (cur.from != cur.to && sticky == "before") { found = i; }
  4507. else { bidiOther = i; }
  4508. }
  4509. if (cur.from == ch) {
  4510. if (cur.from != cur.to && sticky != "before") { found = i; }
  4511. else { bidiOther = i; }
  4512. }
  4513. }
  4514. return found != null ? found : bidiOther
  4515. }
  4516. // Bidirectional ordering algorithm
  4517. // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  4518. // that this (partially) implements.
  4519. // One-char codes used for character types:
  4520. // L (L): Left-to-Right
  4521. // R (R): Right-to-Left
  4522. // r (AL): Right-to-Left Arabic
  4523. // 1 (EN): European Number
  4524. // + (ES): European Number Separator
  4525. // % (ET): European Number Terminator
  4526. // n (AN): Arabic Number
  4527. // , (CS): Common Number Separator
  4528. // m (NSM): Non-Spacing Mark
  4529. // b (BN): Boundary Neutral
  4530. // s (B): Paragraph Separator
  4531. // t (S): Segment Separator
  4532. // w (WS): Whitespace
  4533. // N (ON): Other Neutrals
  4534. // Returns null if characters are ordered as they appear
  4535. // (left-to-right), or an array of sections ({from, to, level}
  4536. // objects) in the order in which they occur visually.
  4537. var bidiOrdering = (function() {
  4538. // Character types for codepoints 0 to 0xff
  4539. var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
  4540. // Character types for codepoints 0x600 to 0x6f9
  4541. var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
  4542. function charType(code) {
  4543. if (code <= 0xf7) { return lowTypes.charAt(code) }
  4544. else if (0x590 <= code && code <= 0x5f4) { return "R" }
  4545. else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
  4546. else if (0x6ee <= code && code <= 0x8ac) { return "r" }
  4547. else if (0x2000 <= code && code <= 0x200b) { return "w" }
  4548. else if (code == 0x200c) { return "b" }
  4549. else { return "L" }
  4550. }
  4551. var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  4552. var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
  4553. function BidiSpan(level, from, to) {
  4554. this.level = level;
  4555. this.from = from; this.to = to;
  4556. }
  4557. return function(str, direction) {
  4558. var outerType = direction == "ltr" ? "L" : "R";
  4559. if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
  4560. var len = str.length, types = [];
  4561. for (var i = 0; i < len; ++i)
  4562. { types.push(charType(str.charCodeAt(i))); }
  4563. // W1. Examine each non-spacing mark (NSM) in the level run, and
  4564. // change the type of the NSM to the type of the previous
  4565. // character. If the NSM is at the start of the level run, it will
  4566. // get the type of sor.
  4567. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
  4568. var type = types[i$1];
  4569. if (type == "m") { types[i$1] = prev; }
  4570. else { prev = type; }
  4571. }
  4572. // W2. Search backwards from each instance of a European number
  4573. // until the first strong type (R, L, AL, or sor) is found. If an
  4574. // AL is found, change the type of the European number to Arabic
  4575. // number.
  4576. // W3. Change all ALs to R.
  4577. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
  4578. var type$1 = types[i$2];
  4579. if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
  4580. else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
  4581. }
  4582. // W4. A single European separator between two European numbers
  4583. // changes to a European number. A single common separator between
  4584. // two numbers of the same type changes to that type.
  4585. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
  4586. var type$2 = types[i$3];
  4587. if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
  4588. else if (type$2 == "," && prev$1 == types[i$3+1] &&
  4589. (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
  4590. prev$1 = type$2;
  4591. }
  4592. // W5. A sequence of European terminators adjacent to European
  4593. // numbers changes to all European numbers.
  4594. // W6. Otherwise, separators and terminators change to Other
  4595. // Neutral.
  4596. for (var i$4 = 0; i$4 < len; ++i$4) {
  4597. var type$3 = types[i$4];
  4598. if (type$3 == ",") { types[i$4] = "N"; }
  4599. else if (type$3 == "%") {
  4600. var end = (void 0);
  4601. for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
  4602. var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
  4603. for (var j = i$4; j < end; ++j) { types[j] = replace; }
  4604. i$4 = end - 1;
  4605. }
  4606. }
  4607. // W7. Search backwards from each instance of a European number
  4608. // until the first strong type (R, L, or sor) is found. If an L is
  4609. // found, then change the type of the European number to L.
  4610. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
  4611. var type$4 = types[i$5];
  4612. if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
  4613. else if (isStrong.test(type$4)) { cur$1 = type$4; }
  4614. }
  4615. // N1. A sequence of neutrals takes the direction of the
  4616. // surrounding strong text if the text on both sides has the same
  4617. // direction. European and Arabic numbers act as if they were R in
  4618. // terms of their influence on neutrals. Start-of-level-run (sor)
  4619. // and end-of-level-run (eor) are used at level run boundaries.
  4620. // N2. Any remaining neutrals take the embedding direction.
  4621. for (var i$6 = 0; i$6 < len; ++i$6) {
  4622. if (isNeutral.test(types[i$6])) {
  4623. var end$1 = (void 0);
  4624. for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
  4625. var before = (i$6 ? types[i$6-1] : outerType) == "L";
  4626. var after = (end$1 < len ? types[end$1] : outerType) == "L";
  4627. var replace$1 = before == after ? (before ? "L" : "R") : outerType;
  4628. for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
  4629. i$6 = end$1 - 1;
  4630. }
  4631. }
  4632. // Here we depart from the documented algorithm, in order to avoid
  4633. // building up an actual levels array. Since there are only three
  4634. // levels (0, 1, 2) in an implementation that doesn't take
  4635. // explicit embedding into account, we can build up the order on
  4636. // the fly, without following the level-based algorithm.
  4637. var order = [], m;
  4638. for (var i$7 = 0; i$7 < len;) {
  4639. if (countsAsLeft.test(types[i$7])) {
  4640. var start = i$7;
  4641. for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
  4642. order.push(new BidiSpan(0, start, i$7));
  4643. } else {
  4644. var pos = i$7, at = order.length;
  4645. for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
  4646. for (var j$2 = pos; j$2 < i$7;) {
  4647. if (countsAsNum.test(types[j$2])) {
  4648. if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
  4649. var nstart = j$2;
  4650. for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
  4651. order.splice(at, 0, new BidiSpan(2, nstart, j$2));
  4652. pos = j$2;
  4653. } else { ++j$2; }
  4654. }
  4655. if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
  4656. }
  4657. }
  4658. if (order[0].level == 1 && (m = str.match(/^\s+/))) {
  4659. order[0].from = m[0].length;
  4660. order.unshift(new BidiSpan(0, 0, m[0].length));
  4661. }
  4662. if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
  4663. lst(order).to -= m[0].length;
  4664. order.push(new BidiSpan(0, len - m[0].length, len));
  4665. }
  4666. return direction == "rtl" ? order.reverse() : order
  4667. }
  4668. })();
  4669. // Get the bidi ordering for the given line (and cache it). Returns
  4670. // false for lines that are fully left-to-right, and an array of
  4671. // BidiSpan objects otherwise.
  4672. function getOrder(line, direction) {
  4673. var order = line.order;
  4674. if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
  4675. return order
  4676. }
  4677. function moveCharLogically(line, ch, dir) {
  4678. var target = skipExtendingChars(line.text, ch + dir, dir);
  4679. return target < 0 || target > line.text.length ? null : target
  4680. }
  4681. function moveLogically(line, start, dir) {
  4682. var ch = moveCharLogically(line, start.ch, dir);
  4683. return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  4684. }
  4685. function endOfLine(visually, cm, lineObj, lineNo, dir) {
  4686. if (visually) {
  4687. var order = getOrder(lineObj, cm.doc.direction);
  4688. if (order) {
  4689. var part = dir < 0 ? lst(order) : order[0];
  4690. var moveInStorageOrder = (dir < 0) == (part.level == 1);
  4691. var sticky = moveInStorageOrder ? "after" : "before";
  4692. var ch;
  4693. // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
  4694. // it could be that the last bidi part is not on the last visual line,
  4695. // since visual lines contain content order-consecutive chunks.
  4696. // Thus, in rtl, we are looking for the first (content-order) character
  4697. // in the rtl chunk that is on the last line (that is, the same line
  4698. // as the last (content-order) character).
  4699. if (part.level > 0) {
  4700. var prep = prepareMeasureForLine(cm, lineObj);
  4701. ch = dir < 0 ? lineObj.text.length - 1 : 0;
  4702. var targetTop = measureCharPrepared(cm, prep, ch).top;
  4703. ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
  4704. if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); }
  4705. } else { ch = dir < 0 ? part.to : part.from; }
  4706. return new Pos(lineNo, ch, sticky)
  4707. }
  4708. }
  4709. return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  4710. }
  4711. function moveVisually(cm, line, start, dir) {
  4712. var bidi = getOrder(line, cm.doc.direction);
  4713. if (!bidi) { return moveLogically(line, start, dir) }
  4714. if (start.ch >= line.text.length) {
  4715. start.ch = line.text.length;
  4716. start.sticky = "before";
  4717. } else if (start.ch <= 0) {
  4718. start.ch = 0;
  4719. start.sticky = "after";
  4720. }
  4721. var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
  4722. if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
  4723. // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
  4724. // nothing interesting happens.
  4725. return moveLogically(line, start, dir)
  4726. }
  4727. var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
  4728. var prep;
  4729. var getWrappedLineExtent = function (ch) {
  4730. if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
  4731. prep = prep || prepareMeasureForLine(cm, line);
  4732. return wrappedLineExtentChar(cm, line, prep, ch)
  4733. };
  4734. var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
  4735. if (cm.doc.direction == "rtl" || part.level == 1) {
  4736. var moveInStorageOrder = (part.level == 1) == (dir < 0);
  4737. var ch = mv(start, moveInStorageOrder ? 1 : -1);
  4738. if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
  4739. // Case 2: We move within an rtl part or in an rtl editor on the same visual line
  4740. var sticky = moveInStorageOrder ? "before" : "after";
  4741. return new Pos(start.line, ch, sticky)
  4742. }
  4743. }
  4744. // Case 3: Could not move within this bidi part in this visual line, so leave
  4745. // the current bidi part
  4746. var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
  4747. var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
  4748. ? new Pos(start.line, mv(ch, 1), "before")
  4749. : new Pos(start.line, ch, "after"); };
  4750. for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
  4751. var part = bidi[partPos];
  4752. var moveInStorageOrder = (dir > 0) == (part.level != 1);
  4753. var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
  4754. if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
  4755. ch = moveInStorageOrder ? part.from : mv(part.to, -1);
  4756. if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
  4757. }
  4758. };
  4759. // Case 3a: Look for other bidi parts on the same visual line
  4760. var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
  4761. if (res) { return res }
  4762. // Case 3b: Look for other bidi parts on the next visual line
  4763. var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
  4764. if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
  4765. res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
  4766. if (res) { return res }
  4767. }
  4768. // Case 4: Nowhere to move
  4769. return null
  4770. }
  4771. // EVENT HANDLING
  4772. // Lightweight event framework. on/off also work on DOM nodes,
  4773. // registering native DOM handlers.
  4774. var noHandlers = [];
  4775. var on = function(emitter, type, f) {
  4776. if (emitter.addEventListener) {
  4777. emitter.addEventListener(type, f, false);
  4778. } else if (emitter.attachEvent) {
  4779. emitter.attachEvent("on" + type, f);
  4780. } else {
  4781. var map$$1 = emitter._handlers || (emitter._handlers = {});
  4782. map$$1[type] = (map$$1[type] || noHandlers).concat(f);
  4783. }
  4784. };
  4785. function getHandlers(emitter, type) {
  4786. return emitter._handlers && emitter._handlers[type] || noHandlers
  4787. }
  4788. function off(emitter, type, f) {
  4789. if (emitter.removeEventListener) {
  4790. emitter.removeEventListener(type, f, false);
  4791. } else if (emitter.detachEvent) {
  4792. emitter.detachEvent("on" + type, f);
  4793. } else {
  4794. var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
  4795. if (arr) {
  4796. var index = indexOf(arr, f);
  4797. if (index > -1)
  4798. { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
  4799. }
  4800. }
  4801. }
  4802. function signal(emitter, type /*, values...*/) {
  4803. var handlers = getHandlers(emitter, type);
  4804. if (!handlers.length) { return }
  4805. var args = Array.prototype.slice.call(arguments, 2);
  4806. for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  4807. }
  4808. // The DOM events that CodeMirror handles can be overridden by
  4809. // registering a (non-DOM) handler on the editor for the event name,
  4810. // and preventDefault-ing the event in that handler.
  4811. function signalDOMEvent(cm, e, override) {
  4812. if (typeof e == "string")
  4813. { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
  4814. signal(cm, override || e.type, cm, e);
  4815. return e_defaultPrevented(e) || e.codemirrorIgnore
  4816. }
  4817. function signalCursorActivity(cm) {
  4818. var arr = cm._handlers && cm._handlers.cursorActivity;
  4819. if (!arr) { return }
  4820. var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
  4821. for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
  4822. { set.push(arr[i]); } }
  4823. }
  4824. function hasHandler(emitter, type) {
  4825. return getHandlers(emitter, type).length > 0
  4826. }
  4827. // Add on and off methods to a constructor's prototype, to make
  4828. // registering events on such objects more convenient.
  4829. function eventMixin(ctor) {
  4830. ctor.prototype.on = function(type, f) {on(this, type, f);};
  4831. ctor.prototype.off = function(type, f) {off(this, type, f);};
  4832. }
  4833. // Due to the fact that we still support jurassic IE versions, some
  4834. // compatibility wrappers are needed.
  4835. function e_preventDefault(e) {
  4836. if (e.preventDefault) { e.preventDefault(); }
  4837. else { e.returnValue = false; }
  4838. }
  4839. function e_stopPropagation(e) {
  4840. if (e.stopPropagation) { e.stopPropagation(); }
  4841. else { e.cancelBubble = true; }
  4842. }
  4843. function e_defaultPrevented(e) {
  4844. return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  4845. }
  4846. function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
  4847. function e_target(e) {return e.target || e.srcElement}
  4848. function e_button(e) {
  4849. var b = e.which;
  4850. if (b == null) {
  4851. if (e.button & 1) { b = 1; }
  4852. else if (e.button & 2) { b = 3; }
  4853. else if (e.button & 4) { b = 2; }
  4854. }
  4855. if (mac && e.ctrlKey && b == 1) { b = 3; }
  4856. return b
  4857. }
  4858. // Detect drag-and-drop
  4859. var dragAndDrop = function() {
  4860. // There is *some* kind of drag-and-drop support in IE6-8, but I
  4861. // couldn't get it to work yet.
  4862. if (ie && ie_version < 9) { return false }
  4863. var div = elt('div');
  4864. return "draggable" in div || "dragDrop" in div
  4865. }();
  4866. var zwspSupported;
  4867. function zeroWidthElement(measure) {
  4868. if (zwspSupported == null) {
  4869. var test = elt("span", "\u200b");
  4870. removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
  4871. if (measure.firstChild.offsetHeight != 0)
  4872. { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
  4873. }
  4874. var node = zwspSupported ? elt("span", "\u200b") :
  4875. elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
  4876. node.setAttribute("cm-text", "");
  4877. return node
  4878. }
  4879. // Feature-detect IE's crummy client rect reporting for bidi text
  4880. var badBidiRects;
  4881. function hasBadBidiRects(measure) {
  4882. if (badBidiRects != null) { return badBidiRects }
  4883. var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
  4884. var r0 = range(txt, 0, 1).getBoundingClientRect();
  4885. var r1 = range(txt, 1, 2).getBoundingClientRect();
  4886. removeChildren(measure);
  4887. if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
  4888. return badBidiRects = (r1.right - r0.right < 3)
  4889. }
  4890. // See if "".split is the broken IE version, if so, provide an
  4891. // alternative way to split lines.
  4892. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
  4893. var pos = 0, result = [], l = string.length;
  4894. while (pos <= l) {
  4895. var nl = string.indexOf("\n", pos);
  4896. if (nl == -1) { nl = string.length; }
  4897. var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
  4898. var rt = line.indexOf("\r");
  4899. if (rt != -1) {
  4900. result.push(line.slice(0, rt));
  4901. pos += rt + 1;
  4902. } else {
  4903. result.push(line);
  4904. pos = nl + 1;
  4905. }
  4906. }
  4907. return result
  4908. } : function (string) { return string.split(/\r\n?|\n/); };
  4909. var hasSelection = window.getSelection ? function (te) {
  4910. try { return te.selectionStart != te.selectionEnd }
  4911. catch(e) { return false }
  4912. } : function (te) {
  4913. var range$$1;
  4914. try {range$$1 = te.ownerDocument.selection.createRange();}
  4915. catch(e) {}
  4916. if (!range$$1 || range$$1.parentElement() != te) { return false }
  4917. return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
  4918. };
  4919. var hasCopyEvent = (function () {
  4920. var e = elt("div");
  4921. if ("oncopy" in e) { return true }
  4922. e.setAttribute("oncopy", "return;");
  4923. return typeof e.oncopy == "function"
  4924. })();
  4925. var badZoomedRects = null;
  4926. function hasBadZoomedRects(measure) {
  4927. if (badZoomedRects != null) { return badZoomedRects }
  4928. var node = removeChildrenAndAdd(measure, elt("span", "x"));
  4929. var normal = node.getBoundingClientRect();
  4930. var fromRange = range(node, 0, 1).getBoundingClientRect();
  4931. return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  4932. }
  4933. // Known modes, by name and by MIME
  4934. var modes = {};
  4935. var mimeModes = {};
  4936. // Extra arguments are stored as the mode's dependencies, which is
  4937. // used by (legacy) mechanisms like loadmode.js to automatically
  4938. // load a mode. (Preferred mechanism is the require/define calls.)
  4939. function defineMode(name, mode) {
  4940. if (arguments.length > 2)
  4941. { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
  4942. modes[name] = mode;
  4943. }
  4944. function defineMIME(mime, spec) {
  4945. mimeModes[mime] = spec;
  4946. }
  4947. // Given a MIME type, a {name, ...options} config object, or a name
  4948. // string, return a mode config object.
  4949. function resolveMode(spec) {
  4950. if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
  4951. spec = mimeModes[spec];
  4952. } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
  4953. var found = mimeModes[spec.name];
  4954. if (typeof found == "string") { found = {name: found}; }
  4955. spec = createObj(found, spec);
  4956. spec.name = found.name;
  4957. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
  4958. return resolveMode("application/xml")
  4959. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
  4960. return resolveMode("application/json")
  4961. }
  4962. if (typeof spec == "string") { return {name: spec} }
  4963. else { return spec || {name: "null"} }
  4964. }
  4965. // Given a mode spec (anything that resolveMode accepts), find and
  4966. // initialize an actual mode object.
  4967. function getMode(options, spec) {
  4968. spec = resolveMode(spec);
  4969. var mfactory = modes[spec.name];
  4970. if (!mfactory) { return getMode(options, "text/plain") }
  4971. var modeObj = mfactory(options, spec);
  4972. if (modeExtensions.hasOwnProperty(spec.name)) {
  4973. var exts = modeExtensions[spec.name];
  4974. for (var prop in exts) {
  4975. if (!exts.hasOwnProperty(prop)) { continue }
  4976. if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
  4977. modeObj[prop] = exts[prop];
  4978. }
  4979. }
  4980. modeObj.name = spec.name;
  4981. if (spec.helperType) { modeObj.helperType = spec.helperType; }
  4982. if (spec.modeProps) { for (var prop$1 in spec.modeProps)
  4983. { modeObj[prop$1] = spec.modeProps[prop$1]; } }
  4984. return modeObj
  4985. }
  4986. // This can be used to attach properties to mode objects from
  4987. // outside the actual mode definition.
  4988. var modeExtensions = {};
  4989. function extendMode(mode, properties) {
  4990. var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
  4991. copyObj(properties, exts);
  4992. }
  4993. function copyState(mode, state) {
  4994. if (state === true) { return state }
  4995. if (mode.copyState) { return mode.copyState(state) }
  4996. var nstate = {};
  4997. for (var n in state) {
  4998. var val = state[n];
  4999. if (val instanceof Array) { val = val.concat([]); }
  5000. nstate[n] = val;
  5001. }
  5002. return nstate
  5003. }
  5004. // Given a mode and a state (for that mode), find the inner mode and
  5005. // state at the position that the state refers to.
  5006. function innerMode(mode, state) {
  5007. var info;
  5008. while (mode.innerMode) {
  5009. info = mode.innerMode(state);
  5010. if (!info || info.mode == mode) { break }
  5011. state = info.state;
  5012. mode = info.mode;
  5013. }
  5014. return info || {mode: mode, state: state}
  5015. }
  5016. function startState(mode, a1, a2) {
  5017. return mode.startState ? mode.startState(a1, a2) : true
  5018. }
  5019. // STRING STREAM
  5020. // Fed to the mode parsers, provides helper functions to make
  5021. // parsers more succinct.
  5022. var StringStream = function(string, tabSize) {
  5023. this.pos = this.start = 0;
  5024. this.string = string;
  5025. this.tabSize = tabSize || 8;
  5026. this.lastColumnPos = this.lastColumnValue = 0;
  5027. this.lineStart = 0;
  5028. };
  5029. StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  5030. StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  5031. StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  5032. StringStream.prototype.next = function () {
  5033. if (this.pos < this.string.length)
  5034. { return this.string.charAt(this.pos++) }
  5035. };
  5036. StringStream.prototype.eat = function (match) {
  5037. var ch = this.string.charAt(this.pos);
  5038. var ok;
  5039. if (typeof match == "string") { ok = ch == match; }
  5040. else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
  5041. if (ok) {++this.pos; return ch}
  5042. };
  5043. StringStream.prototype.eatWhile = function (match) {
  5044. var start = this.pos;
  5045. while (this.eat(match)){}
  5046. return this.pos > start
  5047. };
  5048. StringStream.prototype.eatSpace = function () {
  5049. var this$1 = this;
  5050. var start = this.pos;
  5051. while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
  5052. return this.pos > start
  5053. };
  5054. StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  5055. StringStream.prototype.skipTo = function (ch) {
  5056. var found = this.string.indexOf(ch, this.pos);
  5057. if (found > -1) {this.pos = found; return true}
  5058. };
  5059. StringStream.prototype.backUp = function (n) {this.pos -= n;};
  5060. StringStream.prototype.column = function () {
  5061. if (this.lastColumnPos < this.start) {
  5062. this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
  5063. this.lastColumnPos = this.start;
  5064. }
  5065. return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  5066. };
  5067. StringStream.prototype.indentation = function () {
  5068. return countColumn(this.string, null, this.tabSize) -
  5069. (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  5070. };
  5071. StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
  5072. if (typeof pattern == "string") {
  5073. var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
  5074. var substr = this.string.substr(this.pos, pattern.length);
  5075. if (cased(substr) == cased(pattern)) {
  5076. if (consume !== false) { this.pos += pattern.length; }
  5077. return true
  5078. }
  5079. } else {
  5080. var match = this.string.slice(this.pos).match(pattern);
  5081. if (match && match.index > 0) { return null }
  5082. if (match && consume !== false) { this.pos += match[0].length; }
  5083. return match
  5084. }
  5085. };
  5086. StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  5087. StringStream.prototype.hideFirstChars = function (n, inner) {
  5088. this.lineStart += n;
  5089. try { return inner() }
  5090. finally { this.lineStart -= n; }
  5091. };
  5092. // Compute a style array (an array starting with a mode generation
  5093. // -- for invalidation -- followed by pairs of end positions and
  5094. // style strings), which is used to highlight the tokens on the
  5095. // line.
  5096. function highlightLine(cm, line, state, forceToEnd) {
  5097. // A styles array always starts with a number identifying the
  5098. // mode/overlays that it is based on (for easy invalidation).
  5099. var st = [cm.state.modeGen], lineClasses = {};
  5100. // Compute the base array of styles
  5101. runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
  5102. lineClasses, forceToEnd);
  5103. // Run overlays, adjust style array.
  5104. var loop = function ( o ) {
  5105. var overlay = cm.state.overlays[o], i = 1, at = 0;
  5106. runMode(cm, line.text, overlay.mode, true, function (end, style) {
  5107. var start = i;
  5108. // Ensure there's a token end at the current position, and that i points at it
  5109. while (at < end) {
  5110. var i_end = st[i];
  5111. if (i_end > end)
  5112. { st.splice(i, 1, end, st[i+1], i_end); }
  5113. i += 2;
  5114. at = Math.min(end, i_end);
  5115. }
  5116. if (!style) { return }
  5117. if (overlay.opaque) {
  5118. st.splice(start, i - start, end, "overlay " + style);
  5119. i = start + 2;
  5120. } else {
  5121. for (; start < i; start += 2) {
  5122. var cur = st[start+1];
  5123. st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
  5124. }
  5125. }
  5126. }, lineClasses);
  5127. };
  5128. for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
  5129. return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  5130. }
  5131. function getLineStyles(cm, line, updateFrontier) {
  5132. if (!line.styles || line.styles[0] != cm.state.modeGen) {
  5133. var state = getStateBefore(cm, lineNo(line));
  5134. var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
  5135. line.stateAfter = state;
  5136. line.styles = result.styles;
  5137. if (result.classes) { line.styleClasses = result.classes; }
  5138. else if (line.styleClasses) { line.styleClasses = null; }
  5139. if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; }
  5140. }
  5141. return line.styles
  5142. }
  5143. function getStateBefore(cm, n, precise) {
  5144. var doc = cm.doc, display = cm.display;
  5145. if (!doc.mode.startState) { return true }
  5146. var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
  5147. if (!state) { state = startState(doc.mode); }
  5148. else { state = copyState(doc.mode, state); }
  5149. doc.iter(pos, n, function (line) {
  5150. processLine(cm, line.text, state);
  5151. var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
  5152. line.stateAfter = save ? copyState(doc.mode, state) : null;
  5153. ++pos;
  5154. });
  5155. if (precise) { doc.frontier = pos; }
  5156. return state
  5157. }
  5158. // Lightweight form of highlight -- proceed over this line and
  5159. // update state, but don't save a style array. Used for lines that
  5160. // aren't currently visible.
  5161. function processLine(cm, text, state, startAt) {
  5162. var mode = cm.doc.mode;
  5163. var stream = new StringStream(text, cm.options.tabSize);
  5164. stream.start = stream.pos = startAt || 0;
  5165. if (text == "") { callBlankLine(mode, state); }
  5166. while (!stream.eol()) {
  5167. readToken(mode, stream, state);
  5168. stream.start = stream.pos;
  5169. }
  5170. }
  5171. function callBlankLine(mode, state) {
  5172. if (mode.blankLine) { return mode.blankLine(state) }
  5173. if (!mode.innerMode) { return }
  5174. var inner = innerMode(mode, state);
  5175. if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  5176. }
  5177. function readToken(mode, stream, state, inner) {
  5178. for (var i = 0; i < 10; i++) {
  5179. if (inner) { inner[0] = innerMode(mode, state).mode; }
  5180. var style = mode.token(stream, state);
  5181. if (stream.pos > stream.start) { return style }
  5182. }
  5183. throw new Error("Mode " + mode.name + " failed to advance stream.")
  5184. }
  5185. // Utility for getTokenAt and getLineTokens
  5186. function takeToken(cm, pos, precise, asArray) {
  5187. var getObj = function (copy) { return ({
  5188. start: stream.start, end: stream.pos,
  5189. string: stream.current(),
  5190. type: style || null,
  5191. state: copy ? copyState(doc.mode, state) : state
  5192. }); };
  5193. var doc = cm.doc, mode = doc.mode, style;
  5194. pos = clipPos(doc, pos);
  5195. var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
  5196. var stream = new StringStream(line.text, cm.options.tabSize), tokens;
  5197. if (asArray) { tokens = []; }
  5198. while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
  5199. stream.start = stream.pos;
  5200. style = readToken(mode, stream, state);
  5201. if (asArray) { tokens.push(getObj(true)); }
  5202. }
  5203. return asArray ? tokens : getObj()
  5204. }
  5205. function extractLineClasses(type, output) {
  5206. if (type) { for (;;) {
  5207. var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
  5208. if (!lineClass) { break }
  5209. type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
  5210. var prop = lineClass[1] ? "bgClass" : "textClass";
  5211. if (output[prop] == null)
  5212. { output[prop] = lineClass[2]; }
  5213. else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
  5214. { output[prop] += " " + lineClass[2]; }
  5215. } }
  5216. return type
  5217. }
  5218. // Run the given mode's parser over a line, calling f for each token.
  5219. function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
  5220. var flattenSpans = mode.flattenSpans;
  5221. if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
  5222. var curStart = 0, curStyle = null;
  5223. var stream = new StringStream(text, cm.options.tabSize), style;
  5224. var inner = cm.options.addModeClass && [null];
  5225. if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); }
  5226. while (!stream.eol()) {
  5227. if (stream.pos > cm.options.maxHighlightLength) {
  5228. flattenSpans = false;
  5229. if (forceToEnd) { processLine(cm, text, state, stream.pos); }
  5230. stream.pos = text.length;
  5231. style = null;
  5232. } else {
  5233. style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
  5234. }
  5235. if (inner) {
  5236. var mName = inner[0].name;
  5237. if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
  5238. }
  5239. if (!flattenSpans || curStyle != style) {
  5240. while (curStart < stream.start) {
  5241. curStart = Math.min(stream.start, curStart + 5000);
  5242. f(curStart, curStyle);
  5243. }
  5244. curStyle = style;
  5245. }
  5246. stream.start = stream.pos;
  5247. }
  5248. while (curStart < stream.pos) {
  5249. // Webkit seems to refuse to render text nodes longer than 57444
  5250. // characters, and returns inaccurate measurements in nodes
  5251. // starting around 5000 chars.
  5252. var pos = Math.min(stream.pos, curStart + 5000);
  5253. f(pos, curStyle);
  5254. curStart = pos;
  5255. }
  5256. }
  5257. // Finds the line to start with when starting a parse. Tries to
  5258. // find a line with a stateAfter, so that it can start with a
  5259. // valid state. If that fails, it returns the line with the
  5260. // smallest indentation, which tends to need the least context to
  5261. // parse correctly.
  5262. function findStartLine(cm, n, precise) {
  5263. var minindent, minline, doc = cm.doc;
  5264. var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
  5265. for (var search = n; search > lim; --search) {
  5266. if (search <= doc.first) { return doc.first }
  5267. var line = getLine(doc, search - 1);
  5268. if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
  5269. var indented = countColumn(line.text, null, cm.options.tabSize);
  5270. if (minline == null || minindent > indented) {
  5271. minline = search - 1;
  5272. minindent = indented;
  5273. }
  5274. }
  5275. return minline
  5276. }
  5277. // LINE DATA STRUCTURE
  5278. // Line objects. These hold state related to a line, including
  5279. // highlighting info (the styles array).
  5280. var Line = function(text, markedSpans, estimateHeight) {
  5281. this.text = text;
  5282. attachMarkedSpans(this, markedSpans);
  5283. this.height = estimateHeight ? estimateHeight(this) : 1;
  5284. };
  5285. Line.prototype.lineNo = function () { return lineNo(this) };
  5286. eventMixin(Line);
  5287. // Change the content (text, markers) of a line. Automatically
  5288. // invalidates cached information and tries to re-estimate the
  5289. // line's height.
  5290. function updateLine(line, text, markedSpans, estimateHeight) {
  5291. line.text = text;
  5292. if (line.stateAfter) { line.stateAfter = null; }
  5293. if (line.styles) { line.styles = null; }
  5294. if (line.order != null) { line.order = null; }
  5295. detachMarkedSpans(line);
  5296. attachMarkedSpans(line, markedSpans);
  5297. var estHeight = estimateHeight ? estimateHeight(line) : 1;
  5298. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  5299. }
  5300. // Detach a line from the document tree and its markers.
  5301. function cleanUpLine(line) {
  5302. line.parent = null;
  5303. detachMarkedSpans(line);
  5304. }
  5305. // Convert a style as returned by a mode (either null, or a string
  5306. // containing one or more styles) to a CSS style. This is cached,
  5307. // and also looks for line-wide styles.
  5308. var styleToClassCache = {};
  5309. var styleToClassCacheWithMode = {};
  5310. function interpretTokenStyle(style, options) {
  5311. if (!style || /^\s*$/.test(style)) { return null }
  5312. var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
  5313. return cache[style] ||
  5314. (cache[style] = style.replace(/\S+/g, "cm-$&"))
  5315. }
  5316. // Render the DOM representation of the text of a line. Also builds
  5317. // up a 'line map', which points at the DOM nodes that represent
  5318. // specific stretches of text, and is used by the measuring code.
  5319. // The returned object contains the DOM node, this map, and
  5320. // information about line-wide styles that were set by the mode.
  5321. function buildLineContent(cm, lineView) {
  5322. // The padding-right forces the element to have a 'border', which
  5323. // is needed on Webkit to be able to get line-level bounding
  5324. // rectangles for it (in measureChar).
  5325. var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
  5326. var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
  5327. col: 0, pos: 0, cm: cm,
  5328. trailingSpace: false,
  5329. splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
  5330. lineView.measure = {};
  5331. // Iterate over the logical lines that make up this visual line.
  5332. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
  5333. var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
  5334. builder.pos = 0;
  5335. builder.addToken = buildToken;
  5336. // Optionally wire in some hacks into the token-rendering
  5337. // algorithm, to deal with browser quirks.
  5338. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
  5339. { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
  5340. builder.map = [];
  5341. var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
  5342. insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
  5343. if (line.styleClasses) {
  5344. if (line.styleClasses.bgClass)
  5345. { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
  5346. if (line.styleClasses.textClass)
  5347. { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
  5348. }
  5349. // Ensure at least a single node is present, for measuring.
  5350. if (builder.map.length == 0)
  5351. { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
  5352. // Store the map and a cache object for the current logical line
  5353. if (i == 0) {
  5354. lineView.measure.map = builder.map;
  5355. lineView.measure.cache = {};
  5356. } else {
  5357. (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
  5358. ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
  5359. }
  5360. }
  5361. // See issue #2901
  5362. if (webkit) {
  5363. var last = builder.content.lastChild;
  5364. if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
  5365. { builder.content.className = "cm-tab-wrap-hack"; }
  5366. }
  5367. signal(cm, "renderLine", cm, lineView.line, builder.pre);
  5368. if (builder.pre.className)
  5369. { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
  5370. return builder
  5371. }
  5372. function defaultSpecialCharPlaceholder(ch) {
  5373. var token = elt("span", "\u2022", "cm-invalidchar");
  5374. token.title = "\\u" + ch.charCodeAt(0).toString(16);
  5375. token.setAttribute("aria-label", token.title);
  5376. return token
  5377. }
  5378. // Build up the DOM representation for a single token, and add it to
  5379. // the line map. Takes care to render special characters separately.
  5380. function buildToken(builder, text, style, startStyle, endStyle, title, css) {
  5381. if (!text) { return }
  5382. var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
  5383. var special = builder.cm.state.specialChars, mustWrap = false;
  5384. var content;
  5385. if (!special.test(text)) {
  5386. builder.col += text.length;
  5387. content = document.createTextNode(displayText);
  5388. builder.map.push(builder.pos, builder.pos + text.length, content);
  5389. if (ie && ie_version < 9) { mustWrap = true; }
  5390. builder.pos += text.length;
  5391. } else {
  5392. content = document.createDocumentFragment();
  5393. var pos = 0;
  5394. while (true) {
  5395. special.lastIndex = pos;
  5396. var m = special.exec(text);
  5397. var skipped = m ? m.index - pos : text.length - pos;
  5398. if (skipped) {
  5399. var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
  5400. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
  5401. else { content.appendChild(txt); }
  5402. builder.map.push(builder.pos, builder.pos + skipped, txt);
  5403. builder.col += skipped;
  5404. builder.pos += skipped;
  5405. }
  5406. if (!m) { break }
  5407. pos += skipped + 1;
  5408. var txt$1 = (void 0);
  5409. if (m[0] == "\t") {
  5410. var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
  5411. txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
  5412. txt$1.setAttribute("role", "presentation");
  5413. txt$1.setAttribute("cm-text", "\t");
  5414. builder.col += tabWidth;
  5415. } else if (m[0] == "\r" || m[0] == "\n") {
  5416. txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
  5417. txt$1.setAttribute("cm-text", m[0]);
  5418. builder.col += 1;
  5419. } else {
  5420. txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
  5421. txt$1.setAttribute("cm-text", m[0]);
  5422. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
  5423. else { content.appendChild(txt$1); }
  5424. builder.col += 1;
  5425. }
  5426. builder.map.push(builder.pos, builder.pos + 1, txt$1);
  5427. builder.pos++;
  5428. }
  5429. }
  5430. builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
  5431. if (style || startStyle || endStyle || mustWrap || css) {
  5432. var fullStyle = style || "";
  5433. if (startStyle) { fullStyle += startStyle; }
  5434. if (endStyle) { fullStyle += endStyle; }
  5435. var token = elt("span", [content], fullStyle, css);
  5436. if (title) { token.title = title; }
  5437. return builder.content.appendChild(token)
  5438. }
  5439. builder.content.appendChild(content);
  5440. }
  5441. function splitSpaces(text, trailingBefore) {
  5442. if (text.length > 1 && !/ /.test(text)) { return text }
  5443. var spaceBefore = trailingBefore, result = "";
  5444. for (var i = 0; i < text.length; i++) {
  5445. var ch = text.charAt(i);
  5446. if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
  5447. { ch = "\u00a0"; }
  5448. result += ch;
  5449. spaceBefore = ch == " ";
  5450. }
  5451. return result
  5452. }
  5453. // Work around nonsense dimensions being reported for stretches of
  5454. // right-to-left text.
  5455. function buildTokenBadBidi(inner, order) {
  5456. return function (builder, text, style, startStyle, endStyle, title, css) {
  5457. style = style ? style + " cm-force-border" : "cm-force-border";
  5458. var start = builder.pos, end = start + text.length;
  5459. for (;;) {
  5460. // Find the part that overlaps with the start of this text
  5461. var part = (void 0);
  5462. for (var i = 0; i < order.length; i++) {
  5463. part = order[i];
  5464. if (part.to > start && part.from <= start) { break }
  5465. }
  5466. if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
  5467. inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
  5468. startStyle = null;
  5469. text = text.slice(part.to - start);
  5470. start = part.to;
  5471. }
  5472. }
  5473. }
  5474. function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
  5475. var widget = !ignoreWidget && marker.widgetNode;
  5476. if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
  5477. if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
  5478. if (!widget)
  5479. { widget = builder.content.appendChild(document.createElement("span")); }
  5480. widget.setAttribute("cm-marker", marker.id);
  5481. }
  5482. if (widget) {
  5483. builder.cm.display.input.setUneditable(widget);
  5484. builder.content.appendChild(widget);
  5485. }
  5486. builder.pos += size;
  5487. builder.trailingSpace = false;
  5488. }
  5489. // Outputs a number of spans to make up a line, taking highlighting
  5490. // and marked text into account.
  5491. function insertLineContent(line, builder, styles) {
  5492. var spans = line.markedSpans, allText = line.text, at = 0;
  5493. if (!spans) {
  5494. for (var i$1 = 1; i$1 < styles.length; i$1+=2)
  5495. { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
  5496. return
  5497. }
  5498. var len = allText.length, pos = 0, i = 1, text = "", style, css;
  5499. var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
  5500. for (;;) {
  5501. if (nextChange == pos) { // Update current marker set
  5502. spanStyle = spanEndStyle = spanStartStyle = title = css = "";
  5503. collapsed = null; nextChange = Infinity;
  5504. var foundBookmarks = [], endStyles = (void 0);
  5505. for (var j = 0; j < spans.length; ++j) {
  5506. var sp = spans[j], m = sp.marker;
  5507. if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
  5508. foundBookmarks.push(m);
  5509. } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
  5510. if (sp.to != null && sp.to != pos && nextChange > sp.to) {
  5511. nextChange = sp.to;
  5512. spanEndStyle = "";
  5513. }
  5514. if (m.className) { spanStyle += " " + m.className; }
  5515. if (m.css) { css = (css ? css + ";" : "") + m.css; }
  5516. if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
  5517. if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
  5518. if (m.title && !title) { title = m.title; }
  5519. if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
  5520. { collapsed = sp; }
  5521. } else if (sp.from > pos && nextChange > sp.from) {
  5522. nextChange = sp.from;
  5523. }
  5524. }
  5525. if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
  5526. { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
  5527. if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
  5528. { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
  5529. if (collapsed && (collapsed.from || 0) == pos) {
  5530. buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
  5531. collapsed.marker, collapsed.from == null);
  5532. if (collapsed.to == null) { return }
  5533. if (collapsed.to == pos) { collapsed = false; }
  5534. }
  5535. }
  5536. if (pos >= len) { break }
  5537. var upto = Math.min(len, nextChange);
  5538. while (true) {
  5539. if (text) {
  5540. var end = pos + text.length;
  5541. if (!collapsed) {
  5542. var tokenText = end > upto ? text.slice(0, upto - pos) : text;
  5543. builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
  5544. spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
  5545. }
  5546. if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
  5547. pos = end;
  5548. spanStartStyle = "";
  5549. }
  5550. text = allText.slice(at, at = styles[i++]);
  5551. style = interpretTokenStyle(styles[i++], builder.cm.options);
  5552. }
  5553. }
  5554. }
  5555. // These objects are used to represent the visible (currently drawn)
  5556. // part of the document. A LineView may correspond to multiple
  5557. // logical lines, if those are connected by collapsed ranges.
  5558. function LineView(doc, line, lineN) {
  5559. // The starting line
  5560. this.line = line;
  5561. // Continuing lines, if any
  5562. this.rest = visualLineContinued(line);
  5563. // Number of logical lines in this visual line
  5564. this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
  5565. this.node = this.text = null;
  5566. this.hidden = lineIsHidden(doc, line);
  5567. }
  5568. // Create a range of LineView objects for the given lines.
  5569. function buildViewArray(cm, from, to) {
  5570. var array = [], nextPos;
  5571. for (var pos = from; pos < to; pos = nextPos) {
  5572. var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
  5573. nextPos = pos + view.size;
  5574. array.push(view);
  5575. }
  5576. return array
  5577. }
  5578. var operationGroup = null;
  5579. function pushOperation(op) {
  5580. if (operationGroup) {
  5581. operationGroup.ops.push(op);
  5582. } else {
  5583. op.ownsGroup = operationGroup = {
  5584. ops: [op],
  5585. delayedCallbacks: []
  5586. };
  5587. }
  5588. }
  5589. function fireCallbacksForOps(group) {
  5590. // Calls delayed callbacks and cursorActivity handlers until no
  5591. // new ones appear
  5592. var callbacks = group.delayedCallbacks, i = 0;
  5593. do {
  5594. for (; i < callbacks.length; i++)
  5595. { callbacks[i].call(null); }
  5596. for (var j = 0; j < group.ops.length; j++) {
  5597. var op = group.ops[j];
  5598. if (op.cursorActivityHandlers)
  5599. { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
  5600. { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
  5601. }
  5602. } while (i < callbacks.length)
  5603. }
  5604. function finishOperation(op, endCb) {
  5605. var group = op.ownsGroup;
  5606. if (!group) { return }
  5607. try { fireCallbacksForOps(group); }
  5608. finally {
  5609. operationGroup = null;
  5610. endCb(group);
  5611. }
  5612. }
  5613. var orphanDelayedCallbacks = null;
  5614. // Often, we want to signal events at a point where we are in the
  5615. // middle of some work, but don't want the handler to start calling
  5616. // other methods on the editor, which might be in an inconsistent
  5617. // state or simply not expect any other events to happen.
  5618. // signalLater looks whether there are any handlers, and schedules
  5619. // them to be executed when the last operation ends, or, if no
  5620. // operation is active, when a timeout fires.
  5621. function signalLater(emitter, type /*, values...*/) {
  5622. var arr = getHandlers(emitter, type);
  5623. if (!arr.length) { return }
  5624. var args = Array.prototype.slice.call(arguments, 2), list;
  5625. if (operationGroup) {
  5626. list = operationGroup.delayedCallbacks;
  5627. } else if (orphanDelayedCallbacks) {
  5628. list = orphanDelayedCallbacks;
  5629. } else {
  5630. list = orphanDelayedCallbacks = [];
  5631. setTimeout(fireOrphanDelayed, 0);
  5632. }
  5633. var loop = function ( i ) {
  5634. list.push(function () { return arr[i].apply(null, args); });
  5635. };
  5636. for (var i = 0; i < arr.length; ++i)
  5637. loop( i );
  5638. }
  5639. function fireOrphanDelayed() {
  5640. var delayed = orphanDelayedCallbacks;
  5641. orphanDelayedCallbacks = null;
  5642. for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  5643. }
  5644. // When an aspect of a line changes, a string is added to
  5645. // lineView.changes. This updates the relevant part of the line's
  5646. // DOM structure.
  5647. function updateLineForChanges(cm, lineView, lineN, dims) {
  5648. for (var j = 0; j < lineView.changes.length; j++) {
  5649. var type = lineView.changes[j];
  5650. if (type == "text") { updateLineText(cm, lineView); }
  5651. else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
  5652. else if (type == "class") { updateLineClasses(cm, lineView); }
  5653. else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
  5654. }
  5655. lineView.changes = null;
  5656. }
  5657. // Lines with gutter elements, widgets or a background class need to
  5658. // be wrapped, and have the extra elements added to the wrapper div
  5659. function ensureLineWrapped(lineView) {
  5660. if (lineView.node == lineView.text) {
  5661. lineView.node = elt("div", null, null, "position: relative");
  5662. if (lineView.text.parentNode)
  5663. { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
  5664. lineView.node.appendChild(lineView.text);
  5665. if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
  5666. }
  5667. return lineView.node
  5668. }
  5669. function updateLineBackground(cm, lineView) {
  5670. var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
  5671. if (cls) { cls += " CodeMirror-linebackground"; }
  5672. if (lineView.background) {
  5673. if (cls) { lineView.background.className = cls; }
  5674. else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
  5675. } else if (cls) {
  5676. var wrap = ensureLineWrapped(lineView);
  5677. lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
  5678. cm.display.input.setUneditable(lineView.background);
  5679. }
  5680. }
  5681. // Wrapper around buildLineContent which will reuse the structure
  5682. // in display.externalMeasured when possible.
  5683. function getLineContent(cm, lineView) {
  5684. var ext = cm.display.externalMeasured;
  5685. if (ext && ext.line == lineView.line) {
  5686. cm.display.externalMeasured = null;
  5687. lineView.measure = ext.measure;
  5688. return ext.built
  5689. }
  5690. return buildLineContent(cm, lineView)
  5691. }
  5692. // Redraw the line's text. Interacts with the background and text
  5693. // classes because the mode may output tokens that influence these
  5694. // classes.
  5695. function updateLineText(cm, lineView) {
  5696. var cls = lineView.text.className;
  5697. var built = getLineContent(cm, lineView);
  5698. if (lineView.text == lineView.node) { lineView.node = built.pre; }
  5699. lineView.text.parentNode.replaceChild(built.pre, lineView.text);
  5700. lineView.text = built.pre;
  5701. if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
  5702. lineView.bgClass = built.bgClass;
  5703. lineView.textClass = built.textClass;
  5704. updateLineClasses(cm, lineView);
  5705. } else if (cls) {
  5706. lineView.text.className = cls;
  5707. }
  5708. }
  5709. function updateLineClasses(cm, lineView) {
  5710. updateLineBackground(cm, lineView);
  5711. if (lineView.line.wrapClass)
  5712. { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
  5713. else if (lineView.node != lineView.text)
  5714. { lineView.node.className = ""; }
  5715. var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
  5716. lineView.text.className = textClass || "";
  5717. }
  5718. function updateLineGutter(cm, lineView, lineN, dims) {
  5719. if (lineView.gutter) {
  5720. lineView.node.removeChild(lineView.gutter);
  5721. lineView.gutter = null;
  5722. }
  5723. if (lineView.gutterBackground) {
  5724. lineView.node.removeChild(lineView.gutterBackground);
  5725. lineView.gutterBackground = null;
  5726. }
  5727. if (lineView.line.gutterClass) {
  5728. var wrap = ensureLineWrapped(lineView);
  5729. lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
  5730. ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
  5731. cm.display.input.setUneditable(lineView.gutterBackground);
  5732. wrap.insertBefore(lineView.gutterBackground, lineView.text);
  5733. }
  5734. var markers = lineView.line.gutterMarkers;
  5735. if (cm.options.lineNumbers || markers) {
  5736. var wrap$1 = ensureLineWrapped(lineView);
  5737. var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
  5738. cm.display.input.setUneditable(gutterWrap);
  5739. wrap$1.insertBefore(gutterWrap, lineView.text);
  5740. if (lineView.line.gutterClass)
  5741. { gutterWrap.className += " " + lineView.line.gutterClass; }
  5742. if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  5743. { lineView.lineNumber = gutterWrap.appendChild(
  5744. elt("div", lineNumberFor(cm.options, lineN),
  5745. "CodeMirror-linenumber CodeMirror-gutter-elt",
  5746. ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
  5747. if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
  5748. var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
  5749. if (found)
  5750. { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
  5751. ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
  5752. } }
  5753. }
  5754. }
  5755. function updateLineWidgets(cm, lineView, dims) {
  5756. if (lineView.alignable) { lineView.alignable = null; }
  5757. for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
  5758. next = node.nextSibling;
  5759. if (node.className == "CodeMirror-linewidget")
  5760. { lineView.node.removeChild(node); }
  5761. }
  5762. insertLineWidgets(cm, lineView, dims);
  5763. }
  5764. // Build a line's DOM representation from scratch
  5765. function buildLineElement(cm, lineView, lineN, dims) {
  5766. var built = getLineContent(cm, lineView);
  5767. lineView.text = lineView.node = built.pre;
  5768. if (built.bgClass) { lineView.bgClass = built.bgClass; }
  5769. if (built.textClass) { lineView.textClass = built.textClass; }
  5770. updateLineClasses(cm, lineView);
  5771. updateLineGutter(cm, lineView, lineN, dims);
  5772. insertLineWidgets(cm, lineView, dims);
  5773. return lineView.node
  5774. }
  5775. // A lineView may contain multiple logical lines (when merged by
  5776. // collapsed spans). The widgets for all of them need to be drawn.
  5777. function insertLineWidgets(cm, lineView, dims) {
  5778. insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
  5779. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  5780. { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  5781. }
  5782. function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
  5783. if (!line.widgets) { return }
  5784. var wrap = ensureLineWrapped(lineView);
  5785. for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  5786. var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
  5787. if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
  5788. positionLineWidget(widget, node, lineView, dims);
  5789. cm.display.input.setUneditable(node);
  5790. if (allowAbove && widget.above)
  5791. { wrap.insertBefore(node, lineView.gutter || lineView.text); }
  5792. else
  5793. { wrap.appendChild(node); }
  5794. signalLater(widget, "redraw");
  5795. }
  5796. }
  5797. function positionLineWidget(widget, node, lineView, dims) {
  5798. if (widget.noHScroll) {
  5799. (lineView.alignable || (lineView.alignable = [])).push(node);
  5800. var width = dims.wrapperWidth;
  5801. node.style.left = dims.fixedPos + "px";
  5802. if (!widget.coverGutter) {
  5803. width -= dims.gutterTotalWidth;
  5804. node.style.paddingLeft = dims.gutterTotalWidth + "px";
  5805. }
  5806. node.style.width = width + "px";
  5807. }
  5808. if (widget.coverGutter) {
  5809. node.style.zIndex = 5;
  5810. node.style.position = "relative";
  5811. if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
  5812. }
  5813. }
  5814. function widgetHeight(widget) {
  5815. if (widget.height != null) { return widget.height }
  5816. var cm = widget.doc.cm;
  5817. if (!cm) { return 0 }
  5818. if (!contains(document.body, widget.node)) {
  5819. var parentStyle = "position: relative;";
  5820. if (widget.coverGutter)
  5821. { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
  5822. if (widget.noHScroll)
  5823. { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
  5824. removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
  5825. }
  5826. return widget.height = widget.node.parentNode.offsetHeight
  5827. }
  5828. // Return true when the given mouse event happened in a widget
  5829. function eventInWidget(display, e) {
  5830. for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
  5831. if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
  5832. (n.parentNode == display.sizer && n != display.mover))
  5833. { return true }
  5834. }
  5835. }
  5836. // POSITION MEASUREMENT
  5837. function paddingTop(display) {return display.lineSpace.offsetTop}
  5838. function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  5839. function paddingH(display) {
  5840. if (display.cachedPaddingH) { return display.cachedPaddingH }
  5841. var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
  5842. var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
  5843. var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
  5844. if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
  5845. return data
  5846. }
  5847. function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  5848. function displayWidth(cm) {
  5849. return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  5850. }
  5851. function displayHeight(cm) {
  5852. return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  5853. }
  5854. // Ensure the lineView.wrapping.heights array is populated. This is
  5855. // an array of bottom offsets for the lines that make up a drawn
  5856. // line. When lineWrapping is on, there might be more than one
  5857. // height.
  5858. function ensureLineHeights(cm, lineView, rect) {
  5859. var wrapping = cm.options.lineWrapping;
  5860. var curWidth = wrapping && displayWidth(cm);
  5861. if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
  5862. var heights = lineView.measure.heights = [];
  5863. if (wrapping) {
  5864. lineView.measure.width = curWidth;
  5865. var rects = lineView.text.firstChild.getClientRects();
  5866. for (var i = 0; i < rects.length - 1; i++) {
  5867. var cur = rects[i], next = rects[i + 1];
  5868. if (Math.abs(cur.bottom - next.bottom) > 2)
  5869. { heights.push((cur.bottom + next.top) / 2 - rect.top); }
  5870. }
  5871. }
  5872. heights.push(rect.bottom - rect.top);
  5873. }
  5874. }
  5875. // Find a line map (mapping character offsets to text nodes) and a
  5876. // measurement cache for the given line number. (A line view might
  5877. // contain multiple lines when collapsed ranges are present.)
  5878. function mapFromLineView(lineView, line, lineN) {
  5879. if (lineView.line == line)
  5880. { return {map: lineView.measure.map, cache: lineView.measure.cache} }
  5881. for (var i = 0; i < lineView.rest.length; i++)
  5882. { if (lineView.rest[i] == line)
  5883. { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
  5884. for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
  5885. { if (lineNo(lineView.rest[i$1]) > lineN)
  5886. { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  5887. }
  5888. // Render a line into the hidden node display.externalMeasured. Used
  5889. // when measurement is needed for a line that's not in the viewport.
  5890. function updateExternalMeasurement(cm, line) {
  5891. line = visualLine(line);
  5892. var lineN = lineNo(line);
  5893. var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
  5894. view.lineN = lineN;
  5895. var built = view.built = buildLineContent(cm, view);
  5896. view.text = built.pre;
  5897. removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
  5898. return view
  5899. }
  5900. // Get a {top, bottom, left, right} box (in line-local coordinates)
  5901. // for a given character.
  5902. function measureChar(cm, line, ch, bias) {
  5903. return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  5904. }
  5905. // Find a line view that corresponds to the given line number.
  5906. function findViewForLine(cm, lineN) {
  5907. if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
  5908. { return cm.display.view[findViewIndex(cm, lineN)] }
  5909. var ext = cm.display.externalMeasured;
  5910. if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
  5911. { return ext }
  5912. }
  5913. // Measurement can be split in two steps, the set-up work that
  5914. // applies to the whole line, and the measurement of the actual
  5915. // character. Functions like coordsChar, that need to do a lot of
  5916. // measurements in a row, can thus ensure that the set-up work is
  5917. // only done once.
  5918. function prepareMeasureForLine(cm, line) {
  5919. var lineN = lineNo(line);
  5920. var view = findViewForLine(cm, lineN);
  5921. if (view && !view.text) {
  5922. view = null;
  5923. } else if (view && view.changes) {
  5924. updateLineForChanges(cm, view, lineN, getDimensions(cm));
  5925. cm.curOp.forceUpdate = true;
  5926. }
  5927. if (!view)
  5928. { view = updateExternalMeasurement(cm, line); }
  5929. var info = mapFromLineView(view, line, lineN);
  5930. return {
  5931. line: line, view: view, rect: null,
  5932. map: info.map, cache: info.cache, before: info.before,
  5933. hasHeights: false
  5934. }
  5935. }
  5936. // Given a prepared measurement object, measures the position of an
  5937. // actual character (or fetches it from the cache).
  5938. function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
  5939. if (prepared.before) { ch = -1; }
  5940. var key = ch + (bias || ""), found;
  5941. if (prepared.cache.hasOwnProperty(key)) {
  5942. found = prepared.cache[key];
  5943. } else {
  5944. if (!prepared.rect)
  5945. { prepared.rect = prepared.view.text.getBoundingClientRect(); }
  5946. if (!prepared.hasHeights) {
  5947. ensureLineHeights(cm, prepared.view, prepared.rect);
  5948. prepared.hasHeights = true;
  5949. }
  5950. found = measureCharInner(cm, prepared, ch, bias);
  5951. if (!found.bogus) { prepared.cache[key] = found; }
  5952. }
  5953. return {left: found.left, right: found.right,
  5954. top: varHeight ? found.rtop : found.top,
  5955. bottom: varHeight ? found.rbottom : found.bottom}
  5956. }
  5957. var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
  5958. function nodeAndOffsetInLineMap(map$$1, ch, bias) {
  5959. var node, start, end, collapse, mStart, mEnd;
  5960. // First, search the line map for the text node corresponding to,
  5961. // or closest to, the target character.
  5962. for (var i = 0; i < map$$1.length; i += 3) {
  5963. mStart = map$$1[i];
  5964. mEnd = map$$1[i + 1];
  5965. if (ch < mStart) {
  5966. start = 0; end = 1;
  5967. collapse = "left";
  5968. } else if (ch < mEnd) {
  5969. start = ch - mStart;
  5970. end = start + 1;
  5971. } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
  5972. end = mEnd - mStart;
  5973. start = end - 1;
  5974. if (ch >= mEnd) { collapse = "right"; }
  5975. }
  5976. if (start != null) {
  5977. node = map$$1[i + 2];
  5978. if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
  5979. { collapse = bias; }
  5980. if (bias == "left" && start == 0)
  5981. { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
  5982. node = map$$1[(i -= 3) + 2];
  5983. collapse = "left";
  5984. } }
  5985. if (bias == "right" && start == mEnd - mStart)
  5986. { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
  5987. node = map$$1[(i += 3) + 2];
  5988. collapse = "right";
  5989. } }
  5990. break
  5991. }
  5992. }
  5993. return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  5994. }
  5995. function getUsefulRect(rects, bias) {
  5996. var rect = nullRect;
  5997. if (bias == "left") { for (var i = 0; i < rects.length; i++) {
  5998. if ((rect = rects[i]).left != rect.right) { break }
  5999. } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
  6000. if ((rect = rects[i$1]).left != rect.right) { break }
  6001. } }
  6002. return rect
  6003. }
  6004. function measureCharInner(cm, prepared, ch, bias) {
  6005. var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
  6006. var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
  6007. var rect;
  6008. if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
  6009. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
  6010. while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
  6011. while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
  6012. if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
  6013. { rect = node.parentNode.getBoundingClientRect(); }
  6014. else
  6015. { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
  6016. if (rect.left || rect.right || start == 0) { break }
  6017. end = start;
  6018. start = start - 1;
  6019. collapse = "right";
  6020. }
  6021. if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
  6022. } else { // If it is a widget, simply get the box for the whole widget.
  6023. if (start > 0) { collapse = bias = "right"; }
  6024. var rects;
  6025. if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
  6026. { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
  6027. else
  6028. { rect = node.getBoundingClientRect(); }
  6029. }
  6030. if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
  6031. var rSpan = node.parentNode.getClientRects()[0];
  6032. if (rSpan)
  6033. { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
  6034. else
  6035. { rect = nullRect; }
  6036. }
  6037. var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
  6038. var mid = (rtop + rbot) / 2;
  6039. var heights = prepared.view.measure.heights;
  6040. var i = 0;
  6041. for (; i < heights.length - 1; i++)
  6042. { if (mid < heights[i]) { break } }
  6043. var top = i ? heights[i - 1] : 0, bot = heights[i];
  6044. var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
  6045. right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
  6046. top: top, bottom: bot};
  6047. if (!rect.left && !rect.right) { result.bogus = true; }
  6048. if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
  6049. return result
  6050. }
  6051. // Work around problem with bounding client rects on ranges being
  6052. // returned incorrectly when zoomed on IE10 and below.
  6053. function maybeUpdateRectForZooming(measure, rect) {
  6054. if (!window.screen || screen.logicalXDPI == null ||
  6055. screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
  6056. { return rect }
  6057. var scaleX = screen.logicalXDPI / screen.deviceXDPI;
  6058. var scaleY = screen.logicalYDPI / screen.deviceYDPI;
  6059. return {left: rect.left * scaleX, right: rect.right * scaleX,
  6060. top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  6061. }
  6062. function clearLineMeasurementCacheFor(lineView) {
  6063. if (lineView.measure) {
  6064. lineView.measure.cache = {};
  6065. lineView.measure.heights = null;
  6066. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  6067. { lineView.measure.caches[i] = {}; } }
  6068. }
  6069. }
  6070. function clearLineMeasurementCache(cm) {
  6071. cm.display.externalMeasure = null;
  6072. removeChildren(cm.display.lineMeasure);
  6073. for (var i = 0; i < cm.display.view.length; i++)
  6074. { clearLineMeasurementCacheFor(cm.display.view[i]); }
  6075. }
  6076. function clearCaches(cm) {
  6077. clearLineMeasurementCache(cm);
  6078. cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
  6079. if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
  6080. cm.display.lineNumChars = null;
  6081. }
  6082. function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft }
  6083. function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop }
  6084. // Converts a {top, bottom, left, right} box from line-local
  6085. // coordinates into another coordinate system. Context may be one of
  6086. // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  6087. // or "page".
  6088. function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
  6089. if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
  6090. var size = widgetHeight(lineObj.widgets[i]);
  6091. rect.top += size; rect.bottom += size;
  6092. } } }
  6093. if (context == "line") { return rect }
  6094. if (!context) { context = "local"; }
  6095. var yOff = heightAtLine(lineObj);
  6096. if (context == "local") { yOff += paddingTop(cm.display); }
  6097. else { yOff -= cm.display.viewOffset; }
  6098. if (context == "page" || context == "window") {
  6099. var lOff = cm.display.lineSpace.getBoundingClientRect();
  6100. yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
  6101. var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
  6102. rect.left += xOff; rect.right += xOff;
  6103. }
  6104. rect.top += yOff; rect.bottom += yOff;
  6105. return rect
  6106. }
  6107. // Coverts a box from "div" coords to another coordinate system.
  6108. // Context may be "window", "page", "div", or "local"./null.
  6109. function fromCoordSystem(cm, coords, context) {
  6110. if (context == "div") { return coords }
  6111. var left = coords.left, top = coords.top;
  6112. // First move into "page" coordinate system
  6113. if (context == "page") {
  6114. left -= pageScrollX();
  6115. top -= pageScrollY();
  6116. } else if (context == "local" || !context) {
  6117. var localBox = cm.display.sizer.getBoundingClientRect();
  6118. left += localBox.left;
  6119. top += localBox.top;
  6120. }
  6121. var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
  6122. return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  6123. }
  6124. function charCoords(cm, pos, context, lineObj, bias) {
  6125. if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
  6126. return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  6127. }
  6128. // Returns a box for a given cursor position, which may have an
  6129. // 'other' property containing the position of the secondary cursor
  6130. // on a bidi boundary.
  6131. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
  6132. // and after `char - 1` in writing order of `char - 1`
  6133. // A cursor Pos(line, char, "after") is on the same visual line as `char`
  6134. // and before `char` in writing order of `char`
  6135. // Examples (upper-case letters are RTL, lower-case are LTR):
  6136. // Pos(0, 1, ...)
  6137. // before after
  6138. // ab a|b a|b
  6139. // aB a|B aB|
  6140. // Ab |Ab A|b
  6141. // AB B|A B|A
  6142. // Every position after the last character on a line is considered to stick
  6143. // to the last character on the line.
  6144. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
  6145. lineObj = lineObj || getLine(cm.doc, pos.line);
  6146. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  6147. function get(ch, right) {
  6148. var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
  6149. if (right) { m.left = m.right; } else { m.right = m.left; }
  6150. return intoCoordSystem(cm, lineObj, m, context)
  6151. }
  6152. var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
  6153. if (ch >= lineObj.text.length) {
  6154. ch = lineObj.text.length;
  6155. sticky = "before";
  6156. } else if (ch <= 0) {
  6157. ch = 0;
  6158. sticky = "after";
  6159. }
  6160. if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
  6161. function getBidi(ch, partPos, invert) {
  6162. var part = order[partPos], right = (part.level % 2) != 0;
  6163. return get(invert ? ch - 1 : ch, right != invert)
  6164. }
  6165. var partPos = getBidiPartAt(order, ch, sticky);
  6166. var other = bidiOther;
  6167. var val = getBidi(ch, partPos, sticky == "before");
  6168. if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
  6169. return val
  6170. }
  6171. // Used to cheaply estimate the coordinates for a position. Used for
  6172. // intermediate scroll updates.
  6173. function estimateCoords(cm, pos) {
  6174. var left = 0;
  6175. pos = clipPos(cm.doc, pos);
  6176. if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
  6177. var lineObj = getLine(cm.doc, pos.line);
  6178. var top = heightAtLine(lineObj) + paddingTop(cm.display);
  6179. return {left: left, right: left, top: top, bottom: top + lineObj.height}
  6180. }
  6181. // Positions returned by coordsChar contain some extra information.
  6182. // xRel is the relative x position of the input coordinates compared
  6183. // to the found position (so xRel > 0 means the coordinates are to
  6184. // the right of the character position, for example). When outside
  6185. // is true, that means the coordinates lie outside the line's
  6186. // vertical range.
  6187. function PosWithInfo(line, ch, sticky, outside, xRel) {
  6188. var pos = Pos(line, ch, sticky);
  6189. pos.xRel = xRel;
  6190. if (outside) { pos.outside = true; }
  6191. return pos
  6192. }
  6193. // Compute the character position closest to the given coordinates.
  6194. // Input must be lineSpace-local ("div" coordinate system).
  6195. function coordsChar(cm, x, y) {
  6196. var doc = cm.doc;
  6197. y += cm.display.viewOffset;
  6198. if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
  6199. var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
  6200. if (lineN > last)
  6201. { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
  6202. if (x < 0) { x = 0; }
  6203. var lineObj = getLine(doc, lineN);
  6204. for (;;) {
  6205. var found = coordsCharInner(cm, lineObj, lineN, x, y);
  6206. var merged = collapsedSpanAtEnd(lineObj);
  6207. var mergedPos = merged && merged.find(0, true);
  6208. if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
  6209. { lineN = lineNo(lineObj = mergedPos.to.line); }
  6210. else
  6211. { return found }
  6212. }
  6213. }
  6214. function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
  6215. var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); };
  6216. var end = lineObj.text.length;
  6217. var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0);
  6218. end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end);
  6219. return {begin: begin, end: end}
  6220. }
  6221. function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
  6222. var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
  6223. return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  6224. }
  6225. function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
  6226. y -= heightAtLine(lineObj);
  6227. var begin = 0, end = lineObj.text.length;
  6228. var preparedMeasure = prepareMeasureForLine(cm, lineObj);
  6229. var pos;
  6230. var order = getOrder(lineObj, cm.doc.direction);
  6231. if (order) {
  6232. if (cm.options.lineWrapping) {
  6233. var assign;
  6234. ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign));
  6235. }
  6236. pos = new Pos(lineNo$$1, begin);
  6237. var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left;
  6238. var dir = beginLeft < x ? 1 : -1;
  6239. var prevDiff, diff = beginLeft - x, prevPos;
  6240. do {
  6241. prevDiff = diff;
  6242. prevPos = pos;
  6243. pos = moveVisually(cm, lineObj, pos, dir);
  6244. if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
  6245. pos = prevPos;
  6246. break
  6247. }
  6248. diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x;
  6249. } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
  6250. if (Math.abs(diff) > Math.abs(prevDiff)) {
  6251. if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
  6252. pos = prevPos;
  6253. }
  6254. } else {
  6255. var ch = findFirst(function (ch) {
  6256. var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line");
  6257. if (box.top > y) {
  6258. // For the cursor stickiness
  6259. end = Math.min(ch, end);
  6260. return true
  6261. }
  6262. else if (box.bottom <= y) { return false }
  6263. else if (box.left > x) { return true }
  6264. else if (box.right < x) { return false }
  6265. else { return (x - box.left < box.right - x) }
  6266. }, begin, end);
  6267. ch = skipExtendingChars(lineObj.text, ch, 1);
  6268. pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after");
  6269. }
  6270. var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure);
  6271. if (y < coords.top || coords.bottom < y) { pos.outside = true; }
  6272. pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0);
  6273. return pos
  6274. }
  6275. var measureText;
  6276. // Compute the default text height.
  6277. function textHeight(display) {
  6278. if (display.cachedTextHeight != null) { return display.cachedTextHeight }
  6279. if (measureText == null) {
  6280. measureText = elt("pre");
  6281. // Measure a bunch of lines, for browsers that compute
  6282. // fractional heights.
  6283. for (var i = 0; i < 49; ++i) {
  6284. measureText.appendChild(document.createTextNode("x"));
  6285. measureText.appendChild(elt("br"));
  6286. }
  6287. measureText.appendChild(document.createTextNode("x"));
  6288. }
  6289. removeChildrenAndAdd(display.measure, measureText);
  6290. var height = measureText.offsetHeight / 50;
  6291. if (height > 3) { display.cachedTextHeight = height; }
  6292. removeChildren(display.measure);
  6293. return height || 1
  6294. }
  6295. // Compute the default character width.
  6296. function charWidth(display) {
  6297. if (display.cachedCharWidth != null) { return display.cachedCharWidth }
  6298. var anchor = elt("span", "xxxxxxxxxx");
  6299. var pre = elt("pre", [anchor]);
  6300. removeChildrenAndAdd(display.measure, pre);
  6301. var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
  6302. if (width > 2) { display.cachedCharWidth = width; }
  6303. return width || 10
  6304. }
  6305. // Do a bulk-read of the DOM positions and sizes needed to draw the
  6306. // view, so that we don't interleave reading and writing to the DOM.
  6307. function getDimensions(cm) {
  6308. var d = cm.display, left = {}, width = {};
  6309. var gutterLeft = d.gutters.clientLeft;
  6310. for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  6311. left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
  6312. width[cm.options.gutters[i]] = n.clientWidth;
  6313. }
  6314. return {fixedPos: compensateForHScroll(d),
  6315. gutterTotalWidth: d.gutters.offsetWidth,
  6316. gutterLeft: left,
  6317. gutterWidth: width,
  6318. wrapperWidth: d.wrapper.clientWidth}
  6319. }
  6320. // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  6321. // but using getBoundingClientRect to get a sub-pixel-accurate
  6322. // result.
  6323. function compensateForHScroll(display) {
  6324. return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  6325. }
  6326. // Returns a function that estimates the height of a line, to use as
  6327. // first approximation until the line becomes visible (and is thus
  6328. // properly measurable).
  6329. function estimateHeight(cm) {
  6330. var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
  6331. var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
  6332. return function (line) {
  6333. if (lineIsHidden(cm.doc, line)) { return 0 }
  6334. var widgetsHeight = 0;
  6335. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
  6336. if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
  6337. } }
  6338. if (wrapping)
  6339. { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
  6340. else
  6341. { return widgetsHeight + th }
  6342. }
  6343. }
  6344. function estimateLineHeights(cm) {
  6345. var doc = cm.doc, est = estimateHeight(cm);
  6346. doc.iter(function (line) {
  6347. var estHeight = est(line);
  6348. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  6349. });
  6350. }
  6351. // Given a mouse event, find the corresponding position. If liberal
  6352. // is false, it checks whether a gutter or scrollbar was clicked,
  6353. // and returns null if it was. forRect is used by rectangular
  6354. // selections, and tries to estimate a character position even for
  6355. // coordinates beyond the right of the text.
  6356. function posFromMouse(cm, e, liberal, forRect) {
  6357. var display = cm.display;
  6358. if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
  6359. var x, y, space = display.lineSpace.getBoundingClientRect();
  6360. // Fails unpredictably on IE[67] when mouse is dragged around quickly.
  6361. try { x = e.clientX - space.left; y = e.clientY - space.top; }
  6362. catch (e) { return null }
  6363. var coords = coordsChar(cm, x, y), line;
  6364. if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
  6365. var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
  6366. coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
  6367. }
  6368. return coords
  6369. }
  6370. // Find the view element corresponding to a given line. Return null
  6371. // when the line isn't visible.
  6372. function findViewIndex(cm, n) {
  6373. if (n >= cm.display.viewTo) { return null }
  6374. n -= cm.display.viewFrom;
  6375. if (n < 0) { return null }
  6376. var view = cm.display.view;
  6377. for (var i = 0; i < view.length; i++) {
  6378. n -= view[i].size;
  6379. if (n < 0) { return i }
  6380. }
  6381. }
  6382. function updateSelection(cm) {
  6383. cm.display.input.showSelection(cm.display.input.prepareSelection());
  6384. }
  6385. function prepareSelection(cm, primary) {
  6386. var doc = cm.doc, result = {};
  6387. var curFragment = result.cursors = document.createDocumentFragment();
  6388. var selFragment = result.selection = document.createDocumentFragment();
  6389. for (var i = 0; i < doc.sel.ranges.length; i++) {
  6390. if (primary === false && i == doc.sel.primIndex) { continue }
  6391. var range$$1 = doc.sel.ranges[i];
  6392. if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
  6393. var collapsed = range$$1.empty();
  6394. if (collapsed || cm.options.showCursorWhenSelecting)
  6395. { drawSelectionCursor(cm, range$$1.head, curFragment); }
  6396. if (!collapsed)
  6397. { drawSelectionRange(cm, range$$1, selFragment); }
  6398. }
  6399. return result
  6400. }
  6401. // Draws a cursor for the given range
  6402. function drawSelectionCursor(cm, head, output) {
  6403. var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
  6404. var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
  6405. cursor.style.left = pos.left + "px";
  6406. cursor.style.top = pos.top + "px";
  6407. cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  6408. if (pos.other) {
  6409. // Secondary cursor, shown when on a 'jump' in bi-directional text
  6410. var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
  6411. otherCursor.style.display = "";
  6412. otherCursor.style.left = pos.other.left + "px";
  6413. otherCursor.style.top = pos.other.top + "px";
  6414. otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  6415. }
  6416. }
  6417. // Draws the given range as a highlighted selection
  6418. function drawSelectionRange(cm, range$$1, output) {
  6419. var display = cm.display, doc = cm.doc;
  6420. var fragment = document.createDocumentFragment();
  6421. var padding = paddingH(cm.display), leftSide = padding.left;
  6422. var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
  6423. function add(left, top, width, bottom) {
  6424. if (top < 0) { top = 0; }
  6425. top = Math.round(top);
  6426. bottom = Math.round(bottom);
  6427. fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
  6428. }
  6429. function drawForLine(line, fromArg, toArg) {
  6430. var lineObj = getLine(doc, line);
  6431. var lineLen = lineObj.text.length;
  6432. var start, end;
  6433. function coords(ch, bias) {
  6434. return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
  6435. }
  6436. iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
  6437. var leftPos = coords(from, "left"), rightPos, left, right;
  6438. if (from == to) {
  6439. rightPos = leftPos;
  6440. left = right = leftPos.left;
  6441. } else {
  6442. rightPos = coords(to - 1, "right");
  6443. if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
  6444. left = leftPos.left;
  6445. right = rightPos.right;
  6446. }
  6447. if (fromArg == null && from == 0) { left = leftSide; }
  6448. if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
  6449. add(left, leftPos.top, null, leftPos.bottom);
  6450. left = leftSide;
  6451. if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }
  6452. }
  6453. if (toArg == null && to == lineLen) { right = rightSide; }
  6454. if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
  6455. { start = leftPos; }
  6456. if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
  6457. { end = rightPos; }
  6458. if (left < leftSide + 1) { left = leftSide; }
  6459. add(left, rightPos.top, right - left, rightPos.bottom);
  6460. });
  6461. return {start: start, end: end}
  6462. }
  6463. var sFrom = range$$1.from(), sTo = range$$1.to();
  6464. if (sFrom.line == sTo.line) {
  6465. drawForLine(sFrom.line, sFrom.ch, sTo.ch);
  6466. } else {
  6467. var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
  6468. var singleVLine = visualLine(fromLine) == visualLine(toLine);
  6469. var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
  6470. var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
  6471. if (singleVLine) {
  6472. if (leftEnd.top < rightStart.top - 2) {
  6473. add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
  6474. add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
  6475. } else {
  6476. add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
  6477. }
  6478. }
  6479. if (leftEnd.bottom < rightStart.top)
  6480. { add(leftSide, leftEnd.bottom, null, rightStart.top); }
  6481. }
  6482. output.appendChild(fragment);
  6483. }
  6484. // Cursor-blinking
  6485. function restartBlink(cm) {
  6486. if (!cm.state.focused) { return }
  6487. var display = cm.display;
  6488. clearInterval(display.blinker);
  6489. var on = true;
  6490. display.cursorDiv.style.visibility = "";
  6491. if (cm.options.cursorBlinkRate > 0)
  6492. { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
  6493. cm.options.cursorBlinkRate); }
  6494. else if (cm.options.cursorBlinkRate < 0)
  6495. { display.cursorDiv.style.visibility = "hidden"; }
  6496. }
  6497. function ensureFocus(cm) {
  6498. if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
  6499. }
  6500. function delayBlurEvent(cm) {
  6501. cm.state.delayingBlurEvent = true;
  6502. setTimeout(function () { if (cm.state.delayingBlurEvent) {
  6503. cm.state.delayingBlurEvent = false;
  6504. onBlur(cm);
  6505. } }, 100);
  6506. }
  6507. function onFocus(cm, e) {
  6508. if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
  6509. if (cm.options.readOnly == "nocursor") { return }
  6510. if (!cm.state.focused) {
  6511. signal(cm, "focus", cm, e);
  6512. cm.state.focused = true;
  6513. addClass(cm.display.wrapper, "CodeMirror-focused");
  6514. // This test prevents this from firing when a context
  6515. // menu is closed (since the input reset would kill the
  6516. // select-all detection hack)
  6517. if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
  6518. cm.display.input.reset();
  6519. if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
  6520. }
  6521. cm.display.input.receivedFocus();
  6522. }
  6523. restartBlink(cm);
  6524. }
  6525. function onBlur(cm, e) {
  6526. if (cm.state.delayingBlurEvent) { return }
  6527. if (cm.state.focused) {
  6528. signal(cm, "blur", cm, e);
  6529. cm.state.focused = false;
  6530. rmClass(cm.display.wrapper, "CodeMirror-focused");
  6531. }
  6532. clearInterval(cm.display.blinker);
  6533. setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  6534. }
  6535. // Re-align line numbers and gutter marks to compensate for
  6536. // horizontal scrolling.
  6537. function alignHorizontally(cm) {
  6538. var display = cm.display, view = display.view;
  6539. if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
  6540. var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
  6541. var gutterW = display.gutters.offsetWidth, left = comp + "px";
  6542. for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
  6543. if (cm.options.fixedGutter) {
  6544. if (view[i].gutter)
  6545. { view[i].gutter.style.left = left; }
  6546. if (view[i].gutterBackground)
  6547. { view[i].gutterBackground.style.left = left; }
  6548. }
  6549. var align = view[i].alignable;
  6550. if (align) { for (var j = 0; j < align.length; j++)
  6551. { align[j].style.left = left; } }
  6552. } }
  6553. if (cm.options.fixedGutter)
  6554. { display.gutters.style.left = (comp + gutterW) + "px"; }
  6555. }
  6556. // Used to ensure that the line number gutter is still the right
  6557. // size for the current document size. Returns true when an update
  6558. // is needed.
  6559. function maybeUpdateLineNumberWidth(cm) {
  6560. if (!cm.options.lineNumbers) { return false }
  6561. var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
  6562. if (last.length != display.lineNumChars) {
  6563. var test = display.measure.appendChild(elt("div", [elt("div", last)],
  6564. "CodeMirror-linenumber CodeMirror-gutter-elt"));
  6565. var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  6566. display.lineGutter.style.width = "";
  6567. display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
  6568. display.lineNumWidth = display.lineNumInnerWidth + padding;
  6569. display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  6570. display.lineGutter.style.width = display.lineNumWidth + "px";
  6571. updateGutterSpace(cm);
  6572. return true
  6573. }
  6574. return false
  6575. }
  6576. // Read the actual heights of the rendered lines, and update their
  6577. // stored heights to match.
  6578. function updateHeightsInViewport(cm) {
  6579. var display = cm.display;
  6580. var prevBottom = display.lineDiv.offsetTop;
  6581. for (var i = 0; i < display.view.length; i++) {
  6582. var cur = display.view[i], height = (void 0);
  6583. if (cur.hidden) { continue }
  6584. if (ie && ie_version < 8) {
  6585. var bot = cur.node.offsetTop + cur.node.offsetHeight;
  6586. height = bot - prevBottom;
  6587. prevBottom = bot;
  6588. } else {
  6589. var box = cur.node.getBoundingClientRect();
  6590. height = box.bottom - box.top;
  6591. }
  6592. var diff = cur.line.height - height;
  6593. if (height < 2) { height = textHeight(display); }
  6594. if (diff > .001 || diff < -.001) {
  6595. updateLineHeight(cur.line, height);
  6596. updateWidgetHeight(cur.line);
  6597. if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
  6598. { updateWidgetHeight(cur.rest[j]); } }
  6599. }
  6600. }
  6601. }
  6602. // Read and store the height of line widgets associated with the
  6603. // given line.
  6604. function updateWidgetHeight(line) {
  6605. if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
  6606. { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }
  6607. }
  6608. // Compute the lines that are visible in a given viewport (defaults
  6609. // the the current scroll position). viewport may contain top,
  6610. // height, and ensure (see op.scrollToPos) properties.
  6611. function visibleLines(display, doc, viewport) {
  6612. var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
  6613. top = Math.floor(top - paddingTop(display));
  6614. var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
  6615. var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
  6616. // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
  6617. // forces those lines into the viewport (if possible).
  6618. if (viewport && viewport.ensure) {
  6619. var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
  6620. if (ensureFrom < from) {
  6621. from = ensureFrom;
  6622. to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
  6623. } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
  6624. from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
  6625. to = ensureTo;
  6626. }
  6627. }
  6628. return {from: from, to: Math.max(to, from + 1)}
  6629. }
  6630. // Sync the scrollable area and scrollbars, ensure the viewport
  6631. // covers the visible area.
  6632. function setScrollTop(cm, val) {
  6633. if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
  6634. cm.doc.scrollTop = val;
  6635. if (!gecko) { updateDisplaySimple(cm, {top: val}); }
  6636. if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  6637. cm.display.scrollbars.setScrollTop(val);
  6638. if (gecko) { updateDisplaySimple(cm); }
  6639. startWorker(cm, 100);
  6640. }
  6641. // Sync scroller and scrollbar, ensure the gutter elements are
  6642. // aligned.
  6643. function setScrollLeft(cm, val, isScroller) {
  6644. if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
  6645. val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
  6646. cm.doc.scrollLeft = val;
  6647. alignHorizontally(cm);
  6648. if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
  6649. cm.display.scrollbars.setScrollLeft(val);
  6650. }
  6651. // Since the delta values reported on mouse wheel events are
  6652. // unstandardized between browsers and even browser versions, and
  6653. // generally horribly unpredictable, this code starts by measuring
  6654. // the scroll effect that the first few mouse wheel events have,
  6655. // and, from that, detects the way it can convert deltas to pixel
  6656. // offsets afterwards.
  6657. //
  6658. // The reason we want to know the amount a wheel event will scroll
  6659. // is that it gives us a chance to update the display before the
  6660. // actual scrolling happens, reducing flickering.
  6661. var wheelSamples = 0;
  6662. var wheelPixelsPerUnit = null;
  6663. // Fill in a browser-detected starting value on browsers where we
  6664. // know one. These don't have to be accurate -- the result of them
  6665. // being wrong would just be a slight flicker on the first wheel
  6666. // scroll (if it is large enough).
  6667. if (ie) { wheelPixelsPerUnit = -.53; }
  6668. else if (gecko) { wheelPixelsPerUnit = 15; }
  6669. else if (chrome) { wheelPixelsPerUnit = -.7; }
  6670. else if (safari) { wheelPixelsPerUnit = -1/3; }
  6671. function wheelEventDelta(e) {
  6672. var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
  6673. if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
  6674. if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
  6675. else if (dy == null) { dy = e.wheelDelta; }
  6676. return {x: dx, y: dy}
  6677. }
  6678. function wheelEventPixels(e) {
  6679. var delta = wheelEventDelta(e);
  6680. delta.x *= wheelPixelsPerUnit;
  6681. delta.y *= wheelPixelsPerUnit;
  6682. return delta
  6683. }
  6684. function onScrollWheel(cm, e) {
  6685. var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
  6686. var display = cm.display, scroll = display.scroller;
  6687. // Quit if there's nothing to scroll here
  6688. var canScrollX = scroll.scrollWidth > scroll.clientWidth;
  6689. var canScrollY = scroll.scrollHeight > scroll.clientHeight;
  6690. if (!(dx && canScrollX || dy && canScrollY)) { return }
  6691. // Webkit browsers on OS X abort momentum scrolls when the target
  6692. // of the scroll event is removed from the scrollable element.
  6693. // This hack (see related code in patchDisplay) makes sure the
  6694. // element is kept around.
  6695. if (dy && mac && webkit) {
  6696. outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
  6697. for (var i = 0; i < view.length; i++) {
  6698. if (view[i].node == cur) {
  6699. cm.display.currentWheelTarget = cur;
  6700. break outer
  6701. }
  6702. }
  6703. }
  6704. }
  6705. // On some browsers, horizontal scrolling will cause redraws to
  6706. // happen before the gutter has been realigned, causing it to
  6707. // wriggle around in a most unseemly way. When we have an
  6708. // estimated pixels/delta value, we just handle horizontal
  6709. // scrolling entirely here. It'll be slightly off from native, but
  6710. // better than glitching out.
  6711. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
  6712. if (dy && canScrollY)
  6713. { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); }
  6714. setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
  6715. // Only prevent default scrolling if vertical scrolling is
  6716. // actually possible. Otherwise, it causes vertical scroll
  6717. // jitter on OSX trackpads when deltaX is small and deltaY
  6718. // is large (issue #3579)
  6719. if (!dy || (dy && canScrollY))
  6720. { e_preventDefault(e); }
  6721. display.wheelStartX = null; // Abort measurement, if in progress
  6722. return
  6723. }
  6724. // 'Project' the visible viewport to cover the area that is being
  6725. // scrolled into view (if we know enough to estimate it).
  6726. if (dy && wheelPixelsPerUnit != null) {
  6727. var pixels = dy * wheelPixelsPerUnit;
  6728. var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
  6729. if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
  6730. else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
  6731. updateDisplaySimple(cm, {top: top, bottom: bot});
  6732. }
  6733. if (wheelSamples < 20) {
  6734. if (display.wheelStartX == null) {
  6735. display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
  6736. display.wheelDX = dx; display.wheelDY = dy;
  6737. setTimeout(function () {
  6738. if (display.wheelStartX == null) { return }
  6739. var movedX = scroll.scrollLeft - display.wheelStartX;
  6740. var movedY = scroll.scrollTop - display.wheelStartY;
  6741. var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
  6742. (movedX && display.wheelDX && movedX / display.wheelDX);
  6743. display.wheelStartX = display.wheelStartY = null;
  6744. if (!sample) { return }
  6745. wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
  6746. ++wheelSamples;
  6747. }, 200);
  6748. } else {
  6749. display.wheelDX += dx; display.wheelDY += dy;
  6750. }
  6751. }
  6752. }
  6753. // SCROLLBARS
  6754. // Prepare DOM reads needed to update the scrollbars. Done in one
  6755. // shot to minimize update/measure roundtrips.
  6756. function measureForScrollbars(cm) {
  6757. var d = cm.display, gutterW = d.gutters.offsetWidth;
  6758. var docH = Math.round(cm.doc.height + paddingVert(cm.display));
  6759. return {
  6760. clientHeight: d.scroller.clientHeight,
  6761. viewHeight: d.wrapper.clientHeight,
  6762. scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
  6763. viewWidth: d.wrapper.clientWidth,
  6764. barLeft: cm.options.fixedGutter ? gutterW : 0,
  6765. docHeight: docH,
  6766. scrollHeight: docH + scrollGap(cm) + d.barHeight,
  6767. nativeBarWidth: d.nativeBarWidth,
  6768. gutterWidth: gutterW
  6769. }
  6770. }
  6771. var NativeScrollbars = function(place, scroll, cm) {
  6772. this.cm = cm;
  6773. var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
  6774. var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
  6775. place(vert); place(horiz);
  6776. on(vert, "scroll", function () {
  6777. if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
  6778. });
  6779. on(horiz, "scroll", function () {
  6780. if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
  6781. });
  6782. this.checkedZeroWidth = false;
  6783. // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  6784. if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  6785. };
  6786. NativeScrollbars.prototype.update = function (measure) {
  6787. var needsH = measure.scrollWidth > measure.clientWidth + 1;
  6788. var needsV = measure.scrollHeight > measure.clientHeight + 1;
  6789. var sWidth = measure.nativeBarWidth;
  6790. if (needsV) {
  6791. this.vert.style.display = "block";
  6792. this.vert.style.bottom = needsH ? sWidth + "px" : "0";
  6793. var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
  6794. // A bug in IE8 can cause this value to be negative, so guard it.
  6795. this.vert.firstChild.style.height =
  6796. Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
  6797. } else {
  6798. this.vert.style.display = "";
  6799. this.vert.firstChild.style.height = "0";
  6800. }
  6801. if (needsH) {
  6802. this.horiz.style.display = "block";
  6803. this.horiz.style.right = needsV ? sWidth + "px" : "0";
  6804. this.horiz.style.left = measure.barLeft + "px";
  6805. var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
  6806. this.horiz.firstChild.style.width =
  6807. Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
  6808. } else {
  6809. this.horiz.style.display = "";
  6810. this.horiz.firstChild.style.width = "0";
  6811. }
  6812. if (!this.checkedZeroWidth && measure.clientHeight > 0) {
  6813. if (sWidth == 0) { this.zeroWidthHack(); }
  6814. this.checkedZeroWidth = true;
  6815. }
  6816. return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  6817. };
  6818. NativeScrollbars.prototype.setScrollLeft = function (pos) {
  6819. if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
  6820. if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); }
  6821. };
  6822. NativeScrollbars.prototype.setScrollTop = function (pos) {
  6823. if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
  6824. if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); }
  6825. };
  6826. NativeScrollbars.prototype.zeroWidthHack = function () {
  6827. var w = mac && !mac_geMountainLion ? "12px" : "18px";
  6828. this.horiz.style.height = this.vert.style.width = w;
  6829. this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
  6830. this.disableHoriz = new Delayed;
  6831. this.disableVert = new Delayed;
  6832. };
  6833. NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) {
  6834. bar.style.pointerEvents = "auto";
  6835. function maybeDisable() {
  6836. // To find out whether the scrollbar is still visible, we
  6837. // check whether the element under the pixel in the bottom
  6838. // left corner of the scrollbar box is the scrollbar box
  6839. // itself (when the bar is still visible) or its filler child
  6840. // (when the bar is hidden). If it is still visible, we keep
  6841. // it enabled, if it's hidden, we disable pointer events.
  6842. var box = bar.getBoundingClientRect();
  6843. var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1);
  6844. if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
  6845. else { delay.set(1000, maybeDisable); }
  6846. }
  6847. delay.set(1000, maybeDisable);
  6848. };
  6849. NativeScrollbars.prototype.clear = function () {
  6850. var parent = this.horiz.parentNode;
  6851. parent.removeChild(this.horiz);
  6852. parent.removeChild(this.vert);
  6853. };
  6854. var NullScrollbars = function () {};
  6855. NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  6856. NullScrollbars.prototype.setScrollLeft = function () {};
  6857. NullScrollbars.prototype.setScrollTop = function () {};
  6858. NullScrollbars.prototype.clear = function () {};
  6859. function updateScrollbars(cm, measure) {
  6860. if (!measure) { measure = measureForScrollbars(cm); }
  6861. var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
  6862. updateScrollbarsInner(cm, measure);
  6863. for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
  6864. if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
  6865. { updateHeightsInViewport(cm); }
  6866. updateScrollbarsInner(cm, measureForScrollbars(cm));
  6867. startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
  6868. }
  6869. }
  6870. // Re-synchronize the fake scrollbars with the actual size of the
  6871. // content.
  6872. function updateScrollbarsInner(cm, measure) {
  6873. var d = cm.display;
  6874. var sizes = d.scrollbars.update(measure);
  6875. d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
  6876. d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
  6877. d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
  6878. if (sizes.right && sizes.bottom) {
  6879. d.scrollbarFiller.style.display = "block";
  6880. d.scrollbarFiller.style.height = sizes.bottom + "px";
  6881. d.scrollbarFiller.style.width = sizes.right + "px";
  6882. } else { d.scrollbarFiller.style.display = ""; }
  6883. if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
  6884. d.gutterFiller.style.display = "block";
  6885. d.gutterFiller.style.height = sizes.bottom + "px";
  6886. d.gutterFiller.style.width = measure.gutterWidth + "px";
  6887. } else { d.gutterFiller.style.display = ""; }
  6888. }
  6889. var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
  6890. function initScrollbars(cm) {
  6891. if (cm.display.scrollbars) {
  6892. cm.display.scrollbars.clear();
  6893. if (cm.display.scrollbars.addClass)
  6894. { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  6895. }
  6896. cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
  6897. cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
  6898. // Prevent clicks in the scrollbars from killing focus
  6899. on(node, "mousedown", function () {
  6900. if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
  6901. });
  6902. node.setAttribute("cm-not-content", "true");
  6903. }, function (pos, axis) {
  6904. if (axis == "horizontal") { setScrollLeft(cm, pos); }
  6905. else { setScrollTop(cm, pos); }
  6906. }, cm);
  6907. if (cm.display.scrollbars.addClass)
  6908. { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  6909. }
  6910. // SCROLLING THINGS INTO VIEW
  6911. // If an editor sits on the top or bottom of the window, partially
  6912. // scrolled out of view, this ensures that the cursor is visible.
  6913. function maybeScrollWindow(cm, rect) {
  6914. if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
  6915. var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
  6916. if (rect.top + box.top < 0) { doScroll = true; }
  6917. else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
  6918. if (doScroll != null && !phantom) {
  6919. var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
  6920. cm.display.lineSpace.appendChild(scrollNode);
  6921. scrollNode.scrollIntoView(doScroll);
  6922. cm.display.lineSpace.removeChild(scrollNode);
  6923. }
  6924. }
  6925. // Scroll a given position into view (immediately), verifying that
  6926. // it actually became visible (as line heights are accurately
  6927. // measured, the position of something may 'drift' during drawing).
  6928. function scrollPosIntoView(cm, pos, end, margin) {
  6929. if (margin == null) { margin = 0; }
  6930. var rect;
  6931. for (var limit = 0; limit < 5; limit++) {
  6932. var changed = false;
  6933. var coords = cursorCoords(cm, pos);
  6934. var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
  6935. rect = {left: Math.min(coords.left, endCoords.left),
  6936. top: Math.min(coords.top, endCoords.top) - margin,
  6937. right: Math.max(coords.left, endCoords.left),
  6938. bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
  6939. var scrollPos = calculateScrollPos(cm, rect);
  6940. var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
  6941. if (scrollPos.scrollTop != null) {
  6942. setScrollTop(cm, scrollPos.scrollTop);
  6943. if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
  6944. }
  6945. if (scrollPos.scrollLeft != null) {
  6946. setScrollLeft(cm, scrollPos.scrollLeft);
  6947. if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
  6948. }
  6949. if (!changed) { break }
  6950. }
  6951. return rect
  6952. }
  6953. // Scroll a given set of coordinates into view (immediately).
  6954. function scrollIntoView(cm, rect) {
  6955. var scrollPos = calculateScrollPos(cm, rect);
  6956. if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); }
  6957. if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  6958. }
  6959. // Calculate a new scroll position needed to scroll the given
  6960. // rectangle into view. Returns an object with scrollTop and
  6961. // scrollLeft properties. When these are undefined, the
  6962. // vertical/horizontal position does not need to be adjusted.
  6963. function calculateScrollPos(cm, rect) {
  6964. var display = cm.display, snapMargin = textHeight(cm.display);
  6965. if (rect.top < 0) { rect.top = 0; }
  6966. var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
  6967. var screen = displayHeight(cm), result = {};
  6968. if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
  6969. var docBottom = cm.doc.height + paddingVert(display);
  6970. var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
  6971. if (rect.top < screentop) {
  6972. result.scrollTop = atTop ? 0 : rect.top;
  6973. } else if (rect.bottom > screentop + screen) {
  6974. var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
  6975. if (newTop != screentop) { result.scrollTop = newTop; }
  6976. }
  6977. var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
  6978. var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
  6979. var tooWide = rect.right - rect.left > screenw;
  6980. if (tooWide) { rect.right = rect.left + screenw; }
  6981. if (rect.left < 10)
  6982. { result.scrollLeft = 0; }
  6983. else if (rect.left < screenleft)
  6984. { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
  6985. else if (rect.right > screenw + screenleft - 3)
  6986. { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
  6987. return result
  6988. }
  6989. // Store a relative adjustment to the scroll position in the current
  6990. // operation (to be applied when the operation finishes).
  6991. function addToScrollPos(cm, left, top) {
  6992. if (left != null || top != null) { resolveScrollToPos(cm); }
  6993. if (left != null)
  6994. { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; }
  6995. if (top != null)
  6996. { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
  6997. }
  6998. // Make sure that at the end of the operation the current cursor is
  6999. // shown.
  7000. function ensureCursorVisible(cm) {
  7001. resolveScrollToPos(cm);
  7002. var cur = cm.getCursor(), from = cur, to = cur;
  7003. if (!cm.options.lineWrapping) {
  7004. from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
  7005. to = Pos(cur.line, cur.ch + 1);
  7006. }
  7007. cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin};
  7008. }
  7009. // When an operation has its scrollToPos property set, and another
  7010. // scroll action is applied before the end of the operation, this
  7011. // 'simulates' scrolling that position into view in a cheap way, so
  7012. // that the effect of intermediate scroll commands is not ignored.
  7013. function resolveScrollToPos(cm) {
  7014. var range$$1 = cm.curOp.scrollToPos;
  7015. if (range$$1) {
  7016. cm.curOp.scrollToPos = null;
  7017. var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
  7018. var sPos = calculateScrollPos(cm, {
  7019. left: Math.min(from.left, to.left),
  7020. top: Math.min(from.top, to.top) - range$$1.margin,
  7021. right: Math.max(from.right, to.right),
  7022. bottom: Math.max(from.bottom, to.bottom) + range$$1.margin
  7023. });
  7024. cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  7025. }
  7026. }
  7027. // Operations are used to wrap a series of changes to the editor
  7028. // state in such a way that each change won't have to update the
  7029. // cursor and display (which would be awkward, slow, and
  7030. // error-prone). Instead, display updates are batched and then all
  7031. // combined and executed at once.
  7032. var nextOpId = 0;
  7033. // Start a new operation.
  7034. function startOperation(cm) {
  7035. cm.curOp = {
  7036. cm: cm,
  7037. viewChanged: false, // Flag that indicates that lines might need to be redrawn
  7038. startHeight: cm.doc.height, // Used to detect need to update scrollbar
  7039. forceUpdate: false, // Used to force a redraw
  7040. updateInput: null, // Whether to reset the input textarea
  7041. typing: false, // Whether this reset should be careful to leave existing text (for compositing)
  7042. changeObjs: null, // Accumulated changes, for firing change events
  7043. cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
  7044. cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
  7045. selectionChanged: false, // Whether the selection needs to be redrawn
  7046. updateMaxLine: false, // Set when the widest line needs to be determined anew
  7047. scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
  7048. scrollToPos: null, // Used to scroll to a specific position
  7049. focus: false,
  7050. id: ++nextOpId // Unique ID
  7051. };
  7052. pushOperation(cm.curOp);
  7053. }
  7054. // Finish an operation, updating the display and signalling delayed events
  7055. function endOperation(cm) {
  7056. var op = cm.curOp;
  7057. finishOperation(op, function (group) {
  7058. for (var i = 0; i < group.ops.length; i++)
  7059. { group.ops[i].cm.curOp = null; }
  7060. endOperations(group);
  7061. });
  7062. }
  7063. // The DOM updates done when an operation finishes are batched so
  7064. // that the minimum number of relayouts are required.
  7065. function endOperations(group) {
  7066. var ops = group.ops;
  7067. for (var i = 0; i < ops.length; i++) // Read DOM
  7068. { endOperation_R1(ops[i]); }
  7069. for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
  7070. { endOperation_W1(ops[i$1]); }
  7071. for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
  7072. { endOperation_R2(ops[i$2]); }
  7073. for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
  7074. { endOperation_W2(ops[i$3]); }
  7075. for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
  7076. { endOperation_finish(ops[i$4]); }
  7077. }
  7078. function endOperation_R1(op) {
  7079. var cm = op.cm, display = cm.display;
  7080. maybeClipScrollbars(cm);
  7081. if (op.updateMaxLine) { findMaxLine(cm); }
  7082. op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
  7083. op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
  7084. op.scrollToPos.to.line >= display.viewTo) ||
  7085. display.maxLineChanged && cm.options.lineWrapping;
  7086. op.update = op.mustUpdate &&
  7087. new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  7088. }
  7089. function endOperation_W1(op) {
  7090. op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  7091. }
  7092. function endOperation_R2(op) {
  7093. var cm = op.cm, display = cm.display;
  7094. if (op.updatedDisplay) { updateHeightsInViewport(cm); }
  7095. op.barMeasure = measureForScrollbars(cm);
  7096. // If the max line changed since it was last measured, measure it,
  7097. // and ensure the document's width matches it.
  7098. // updateDisplay_W2 will use these properties to do the actual resizing
  7099. if (display.maxLineChanged && !cm.options.lineWrapping) {
  7100. op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
  7101. cm.display.sizerWidth = op.adjustWidthTo;
  7102. op.barMeasure.scrollWidth =
  7103. Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
  7104. op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
  7105. }
  7106. if (op.updatedDisplay || op.selectionChanged)
  7107. { op.preparedSelection = display.input.prepareSelection(op.focus); }
  7108. }
  7109. function endOperation_W2(op) {
  7110. var cm = op.cm;
  7111. if (op.adjustWidthTo != null) {
  7112. cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
  7113. if (op.maxScrollLeft < cm.doc.scrollLeft)
  7114. { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
  7115. cm.display.maxLineChanged = false;
  7116. }
  7117. var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus());
  7118. if (op.preparedSelection)
  7119. { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
  7120. if (op.updatedDisplay || op.startHeight != cm.doc.height)
  7121. { updateScrollbars(cm, op.barMeasure); }
  7122. if (op.updatedDisplay)
  7123. { setDocumentHeight(cm, op.barMeasure); }
  7124. if (op.selectionChanged) { restartBlink(cm); }
  7125. if (cm.state.focused && op.updateInput)
  7126. { cm.display.input.reset(op.typing); }
  7127. if (takeFocus) { ensureFocus(op.cm); }
  7128. }
  7129. function endOperation_finish(op) {
  7130. var cm = op.cm, display = cm.display, doc = cm.doc;
  7131. if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
  7132. // Abort mouse wheel delta measurement, when scrolling explicitly
  7133. if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
  7134. { display.wheelStartX = display.wheelStartY = null; }
  7135. // Propagate the scroll position to the actual DOM scroller
  7136. if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
  7137. doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
  7138. display.scrollbars.setScrollTop(doc.scrollTop);
  7139. display.scroller.scrollTop = doc.scrollTop;
  7140. }
  7141. if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
  7142. doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
  7143. display.scrollbars.setScrollLeft(doc.scrollLeft);
  7144. display.scroller.scrollLeft = doc.scrollLeft;
  7145. alignHorizontally(cm);
  7146. }
  7147. // If we need to scroll a specific position into view, do so.
  7148. if (op.scrollToPos) {
  7149. var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
  7150. clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
  7151. maybeScrollWindow(cm, rect);
  7152. }
  7153. // Fire events for markers that are hidden/unidden by editing or
  7154. // undoing
  7155. var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
  7156. if (hidden) { for (var i = 0; i < hidden.length; ++i)
  7157. { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
  7158. if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
  7159. { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
  7160. if (display.wrapper.offsetHeight)
  7161. { doc.scrollTop = cm.display.scroller.scrollTop; }
  7162. // Fire change events, and delayed event handlers
  7163. if (op.changeObjs)
  7164. { signal(cm, "changes", cm, op.changeObjs); }
  7165. if (op.update)
  7166. { op.update.finish(); }
  7167. }
  7168. // Run the given function in an operation
  7169. function runInOp(cm, f) {
  7170. if (cm.curOp) { return f() }
  7171. startOperation(cm);
  7172. try { return f() }
  7173. finally { endOperation(cm); }
  7174. }
  7175. // Wraps a function in an operation. Returns the wrapped function.
  7176. function operation(cm, f) {
  7177. return function() {
  7178. if (cm.curOp) { return f.apply(cm, arguments) }
  7179. startOperation(cm);
  7180. try { return f.apply(cm, arguments) }
  7181. finally { endOperation(cm); }
  7182. }
  7183. }
  7184. // Used to add methods to editor and doc instances, wrapping them in
  7185. // operations.
  7186. function methodOp(f) {
  7187. return function() {
  7188. if (this.curOp) { return f.apply(this, arguments) }
  7189. startOperation(this);
  7190. try { return f.apply(this, arguments) }
  7191. finally { endOperation(this); }
  7192. }
  7193. }
  7194. function docMethodOp(f) {
  7195. return function() {
  7196. var cm = this.cm;
  7197. if (!cm || cm.curOp) { return f.apply(this, arguments) }
  7198. startOperation(cm);
  7199. try { return f.apply(this, arguments) }
  7200. finally { endOperation(cm); }
  7201. }
  7202. }
  7203. // Updates the display.view data structure for a given change to the
  7204. // document. From and to are in pre-change coordinates. Lendiff is
  7205. // the amount of lines added or subtracted by the change. This is
  7206. // used for changes that span multiple lines, or change the way
  7207. // lines are divided into visual lines. regLineChange (below)
  7208. // registers single-line changes.
  7209. function regChange(cm, from, to, lendiff) {
  7210. if (from == null) { from = cm.doc.first; }
  7211. if (to == null) { to = cm.doc.first + cm.doc.size; }
  7212. if (!lendiff) { lendiff = 0; }
  7213. var display = cm.display;
  7214. if (lendiff && to < display.viewTo &&
  7215. (display.updateLineNumbers == null || display.updateLineNumbers > from))
  7216. { display.updateLineNumbers = from; }
  7217. cm.curOp.viewChanged = true;
  7218. if (from >= display.viewTo) { // Change after
  7219. if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
  7220. { resetView(cm); }
  7221. } else if (to <= display.viewFrom) { // Change before
  7222. if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
  7223. resetView(cm);
  7224. } else {
  7225. display.viewFrom += lendiff;
  7226. display.viewTo += lendiff;
  7227. }
  7228. } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
  7229. resetView(cm);
  7230. } else if (from <= display.viewFrom) { // Top overlap
  7231. var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
  7232. if (cut) {
  7233. display.view = display.view.slice(cut.index);
  7234. display.viewFrom = cut.lineN;
  7235. display.viewTo += lendiff;
  7236. } else {
  7237. resetView(cm);
  7238. }
  7239. } else if (to >= display.viewTo) { // Bottom overlap
  7240. var cut$1 = viewCuttingPoint(cm, from, from, -1);
  7241. if (cut$1) {
  7242. display.view = display.view.slice(0, cut$1.index);
  7243. display.viewTo = cut$1.lineN;
  7244. } else {
  7245. resetView(cm);
  7246. }
  7247. } else { // Gap in the middle
  7248. var cutTop = viewCuttingPoint(cm, from, from, -1);
  7249. var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
  7250. if (cutTop && cutBot) {
  7251. display.view = display.view.slice(0, cutTop.index)
  7252. .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
  7253. .concat(display.view.slice(cutBot.index));
  7254. display.viewTo += lendiff;
  7255. } else {
  7256. resetView(cm);
  7257. }
  7258. }
  7259. var ext = display.externalMeasured;
  7260. if (ext) {
  7261. if (to < ext.lineN)
  7262. { ext.lineN += lendiff; }
  7263. else if (from < ext.lineN + ext.size)
  7264. { display.externalMeasured = null; }
  7265. }
  7266. }
  7267. // Register a change to a single line. Type must be one of "text",
  7268. // "gutter", "class", "widget"
  7269. function regLineChange(cm, line, type) {
  7270. cm.curOp.viewChanged = true;
  7271. var display = cm.display, ext = cm.display.externalMeasured;
  7272. if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
  7273. { display.externalMeasured = null; }
  7274. if (line < display.viewFrom || line >= display.viewTo) { return }
  7275. var lineView = display.view[findViewIndex(cm, line)];
  7276. if (lineView.node == null) { return }
  7277. var arr = lineView.changes || (lineView.changes = []);
  7278. if (indexOf(arr, type) == -1) { arr.push(type); }
  7279. }
  7280. // Clear the view.
  7281. function resetView(cm) {
  7282. cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
  7283. cm.display.view = [];
  7284. cm.display.viewOffset = 0;
  7285. }
  7286. function viewCuttingPoint(cm, oldN, newN, dir) {
  7287. var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
  7288. if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
  7289. { return {index: index, lineN: newN} }
  7290. var n = cm.display.viewFrom;
  7291. for (var i = 0; i < index; i++)
  7292. { n += view[i].size; }
  7293. if (n != oldN) {
  7294. if (dir > 0) {
  7295. if (index == view.length - 1) { return null }
  7296. diff = (n + view[index].size) - oldN;
  7297. index++;
  7298. } else {
  7299. diff = n - oldN;
  7300. }
  7301. oldN += diff; newN += diff;
  7302. }
  7303. while (visualLineNo(cm.doc, newN) != newN) {
  7304. if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
  7305. newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
  7306. index += dir;
  7307. }
  7308. return {index: index, lineN: newN}
  7309. }
  7310. // Force the view to cover a given range, adding empty view element
  7311. // or clipping off existing ones as needed.
  7312. function adjustView(cm, from, to) {
  7313. var display = cm.display, view = display.view;
  7314. if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
  7315. display.view = buildViewArray(cm, from, to);
  7316. display.viewFrom = from;
  7317. } else {
  7318. if (display.viewFrom > from)
  7319. { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
  7320. else if (display.viewFrom < from)
  7321. { display.view = display.view.slice(findViewIndex(cm, from)); }
  7322. display.viewFrom = from;
  7323. if (display.viewTo < to)
  7324. { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
  7325. else if (display.viewTo > to)
  7326. { display.view = display.view.slice(0, findViewIndex(cm, to)); }
  7327. }
  7328. display.viewTo = to;
  7329. }
  7330. // Count the number of lines in the view whose DOM representation is
  7331. // out of date (or nonexistent).
  7332. function countDirtyView(cm) {
  7333. var view = cm.display.view, dirty = 0;
  7334. for (var i = 0; i < view.length; i++) {
  7335. var lineView = view[i];
  7336. if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
  7337. }
  7338. return dirty
  7339. }
  7340. // HIGHLIGHT WORKER
  7341. function startWorker(cm, time) {
  7342. if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
  7343. { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  7344. }
  7345. function highlightWorker(cm) {
  7346. var doc = cm.doc;
  7347. if (doc.frontier < doc.first) { doc.frontier = doc.first; }
  7348. if (doc.frontier >= cm.display.viewTo) { return }
  7349. var end = +new Date + cm.options.workTime;
  7350. var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
  7351. var changedLines = [];
  7352. doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
  7353. if (doc.frontier >= cm.display.viewFrom) { // Visible
  7354. var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
  7355. var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
  7356. line.styles = highlighted.styles;
  7357. var oldCls = line.styleClasses, newCls = highlighted.classes;
  7358. if (newCls) { line.styleClasses = newCls; }
  7359. else if (oldCls) { line.styleClasses = null; }
  7360. var ischange = !oldStyles || oldStyles.length != line.styles.length ||
  7361. oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
  7362. for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
  7363. if (ischange) { changedLines.push(doc.frontier); }
  7364. line.stateAfter = tooLong ? state : copyState(doc.mode, state);
  7365. } else {
  7366. if (line.text.length <= cm.options.maxHighlightLength)
  7367. { processLine(cm, line.text, state); }
  7368. line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
  7369. }
  7370. ++doc.frontier;
  7371. if (+new Date > end) {
  7372. startWorker(cm, cm.options.workDelay);
  7373. return true
  7374. }
  7375. });
  7376. if (changedLines.length) { runInOp(cm, function () {
  7377. for (var i = 0; i < changedLines.length; i++)
  7378. { regLineChange(cm, changedLines[i], "text"); }
  7379. }); }
  7380. }
  7381. // DISPLAY DRAWING
  7382. var DisplayUpdate = function(cm, viewport, force) {
  7383. var display = cm.display;
  7384. this.viewport = viewport;
  7385. // Store some values that we'll need later (but don't want to force a relayout for)
  7386. this.visible = visibleLines(display, cm.doc, viewport);
  7387. this.editorIsHidden = !display.wrapper.offsetWidth;
  7388. this.wrapperHeight = display.wrapper.clientHeight;
  7389. this.wrapperWidth = display.wrapper.clientWidth;
  7390. this.oldDisplayWidth = displayWidth(cm);
  7391. this.force = force;
  7392. this.dims = getDimensions(cm);
  7393. this.events = [];
  7394. };
  7395. DisplayUpdate.prototype.signal = function (emitter, type) {
  7396. if (hasHandler(emitter, type))
  7397. { this.events.push(arguments); }
  7398. };
  7399. DisplayUpdate.prototype.finish = function () {
  7400. var this$1 = this;
  7401. for (var i = 0; i < this.events.length; i++)
  7402. { signal.apply(null, this$1.events[i]); }
  7403. };
  7404. function maybeClipScrollbars(cm) {
  7405. var display = cm.display;
  7406. if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
  7407. display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
  7408. display.heightForcer.style.height = scrollGap(cm) + "px";
  7409. display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
  7410. display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
  7411. display.scrollbarsClipped = true;
  7412. }
  7413. }
  7414. // Does the actual updating of the line display. Bails out
  7415. // (returning false) when there is nothing to be done and forced is
  7416. // false.
  7417. function updateDisplayIfNeeded(cm, update) {
  7418. var display = cm.display, doc = cm.doc;
  7419. if (update.editorIsHidden) {
  7420. resetView(cm);
  7421. return false
  7422. }
  7423. // Bail out if the visible area is already rendered and nothing changed.
  7424. if (!update.force &&
  7425. update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
  7426. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
  7427. display.renderedView == display.view && countDirtyView(cm) == 0)
  7428. { return false }
  7429. if (maybeUpdateLineNumberWidth(cm)) {
  7430. resetView(cm);
  7431. update.dims = getDimensions(cm);
  7432. }
  7433. // Compute a suitable new viewport (from & to)
  7434. var end = doc.first + doc.size;
  7435. var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
  7436. var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
  7437. if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
  7438. if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
  7439. if (sawCollapsedSpans) {
  7440. from = visualLineNo(cm.doc, from);
  7441. to = visualLineEndNo(cm.doc, to);
  7442. }
  7443. var different = from != display.viewFrom || to != display.viewTo ||
  7444. display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
  7445. adjustView(cm, from, to);
  7446. display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
  7447. // Position the mover div to align with the current scroll position
  7448. cm.display.mover.style.top = display.viewOffset + "px";
  7449. var toUpdate = countDirtyView(cm);
  7450. if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
  7451. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
  7452. { return false }
  7453. // For big changes, we hide the enclosing element during the
  7454. // update, since that speeds up the operations on most browsers.
  7455. var focused = activeElt();
  7456. if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
  7457. patchDisplay(cm, display.updateLineNumbers, update.dims);
  7458. if (toUpdate > 4) { display.lineDiv.style.display = ""; }
  7459. display.renderedView = display.view;
  7460. // There might have been a widget with a focused element that got
  7461. // hidden or updated, if so re-focus it.
  7462. if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); }
  7463. // Prevent selection and cursors from interfering with the scroll
  7464. // width and height.
  7465. removeChildren(display.cursorDiv);
  7466. removeChildren(display.selectionDiv);
  7467. display.gutters.style.height = display.sizer.style.minHeight = 0;
  7468. if (different) {
  7469. display.lastWrapHeight = update.wrapperHeight;
  7470. display.lastWrapWidth = update.wrapperWidth;
  7471. startWorker(cm, 400);
  7472. }
  7473. display.updateLineNumbers = null;
  7474. return true
  7475. }
  7476. function postUpdateDisplay(cm, update) {
  7477. var viewport = update.viewport;
  7478. for (var first = true;; first = false) {
  7479. if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
  7480. // Clip forced viewport to actual scrollable area.
  7481. if (viewport && viewport.top != null)
  7482. { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
  7483. // Updated line heights might result in the drawn area not
  7484. // actually covering the viewport. Keep looping until it does.
  7485. update.visible = visibleLines(cm.display, cm.doc, viewport);
  7486. if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
  7487. { break }
  7488. }
  7489. if (!updateDisplayIfNeeded(cm, update)) { break }
  7490. updateHeightsInViewport(cm);
  7491. var barMeasure = measureForScrollbars(cm);
  7492. updateSelection(cm);
  7493. updateScrollbars(cm, barMeasure);
  7494. setDocumentHeight(cm, barMeasure);
  7495. }
  7496. update.signal(cm, "update", cm);
  7497. if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
  7498. update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
  7499. cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
  7500. }
  7501. }
  7502. function updateDisplaySimple(cm, viewport) {
  7503. var update = new DisplayUpdate(cm, viewport);
  7504. if (updateDisplayIfNeeded(cm, update)) {
  7505. updateHeightsInViewport(cm);
  7506. postUpdateDisplay(cm, update);
  7507. var barMeasure = measureForScrollbars(cm);
  7508. updateSelection(cm);
  7509. updateScrollbars(cm, barMeasure);
  7510. setDocumentHeight(cm, barMeasure);
  7511. update.finish();
  7512. }
  7513. }
  7514. // Sync the actual display DOM structure with display.view, removing
  7515. // nodes for lines that are no longer in view, and creating the ones
  7516. // that are not there yet, and updating the ones that are out of
  7517. // date.
  7518. function patchDisplay(cm, updateNumbersFrom, dims) {
  7519. var display = cm.display, lineNumbers = cm.options.lineNumbers;
  7520. var container = display.lineDiv, cur = container.firstChild;
  7521. function rm(node) {
  7522. var next = node.nextSibling;
  7523. // Works around a throw-scroll bug in OS X Webkit
  7524. if (webkit && mac && cm.display.currentWheelTarget == node)
  7525. { node.style.display = "none"; }
  7526. else
  7527. { node.parentNode.removeChild(node); }
  7528. return next
  7529. }
  7530. var view = display.view, lineN = display.viewFrom;
  7531. // Loop over the elements in the view, syncing cur (the DOM nodes
  7532. // in display.lineDiv) with the view as we go.
  7533. for (var i = 0; i < view.length; i++) {
  7534. var lineView = view[i];
  7535. if (lineView.hidden) {
  7536. } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
  7537. var node = buildLineElement(cm, lineView, lineN, dims);
  7538. container.insertBefore(node, cur);
  7539. } else { // Already drawn
  7540. while (cur != lineView.node) { cur = rm(cur); }
  7541. var updateNumber = lineNumbers && updateNumbersFrom != null &&
  7542. updateNumbersFrom <= lineN && lineView.lineNumber;
  7543. if (lineView.changes) {
  7544. if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
  7545. updateLineForChanges(cm, lineView, lineN, dims);
  7546. }
  7547. if (updateNumber) {
  7548. removeChildren(lineView.lineNumber);
  7549. lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
  7550. }
  7551. cur = lineView.node.nextSibling;
  7552. }
  7553. lineN += lineView.size;
  7554. }
  7555. while (cur) { cur = rm(cur); }
  7556. }
  7557. function updateGutterSpace(cm) {
  7558. var width = cm.display.gutters.offsetWidth;
  7559. cm.display.sizer.style.marginLeft = width + "px";
  7560. }
  7561. function setDocumentHeight(cm, measure) {
  7562. cm.display.sizer.style.minHeight = measure.docHeight + "px";
  7563. cm.display.heightForcer.style.top = measure.docHeight + "px";
  7564. cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  7565. }
  7566. // Rebuild the gutter elements, ensure the margin to the left of the
  7567. // code matches their width.
  7568. function updateGutters(cm) {
  7569. var gutters = cm.display.gutters, specs = cm.options.gutters;
  7570. removeChildren(gutters);
  7571. var i = 0;
  7572. for (; i < specs.length; ++i) {
  7573. var gutterClass = specs[i];
  7574. var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
  7575. if (gutterClass == "CodeMirror-linenumbers") {
  7576. cm.display.lineGutter = gElt;
  7577. gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
  7578. }
  7579. }
  7580. gutters.style.display = i ? "" : "none";
  7581. updateGutterSpace(cm);
  7582. }
  7583. // Make sure the gutters options contains the element
  7584. // "CodeMirror-linenumbers" when the lineNumbers option is true.
  7585. function setGuttersForLineNumbers(options) {
  7586. var found = indexOf(options.gutters, "CodeMirror-linenumbers");
  7587. if (found == -1 && options.lineNumbers) {
  7588. options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
  7589. } else if (found > -1 && !options.lineNumbers) {
  7590. options.gutters = options.gutters.slice(0);
  7591. options.gutters.splice(found, 1);
  7592. }
  7593. }
  7594. // Selection objects are immutable. A new one is created every time
  7595. // the selection changes. A selection is one or more non-overlapping
  7596. // (and non-touching) ranges, sorted, and an integer that indicates
  7597. // which one is the primary selection (the one that's scrolled into
  7598. // view, that getCursor returns, etc).
  7599. var Selection = function(ranges, primIndex) {
  7600. this.ranges = ranges;
  7601. this.primIndex = primIndex;
  7602. };
  7603. Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
  7604. Selection.prototype.equals = function (other) {
  7605. var this$1 = this;
  7606. if (other == this) { return true }
  7607. if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
  7608. for (var i = 0; i < this.ranges.length; i++) {
  7609. var here = this$1.ranges[i], there = other.ranges[i];
  7610. if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
  7611. }
  7612. return true
  7613. };
  7614. Selection.prototype.deepCopy = function () {
  7615. var this$1 = this;
  7616. var out = [];
  7617. for (var i = 0; i < this.ranges.length; i++)
  7618. { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
  7619. return new Selection(out, this.primIndex)
  7620. };
  7621. Selection.prototype.somethingSelected = function () {
  7622. var this$1 = this;
  7623. for (var i = 0; i < this.ranges.length; i++)
  7624. { if (!this$1.ranges[i].empty()) { return true } }
  7625. return false
  7626. };
  7627. Selection.prototype.contains = function (pos, end) {
  7628. var this$1 = this;
  7629. if (!end) { end = pos; }
  7630. for (var i = 0; i < this.ranges.length; i++) {
  7631. var range = this$1.ranges[i];
  7632. if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
  7633. { return i }
  7634. }
  7635. return -1
  7636. };
  7637. var Range = function(anchor, head) {
  7638. this.anchor = anchor; this.head = head;
  7639. };
  7640. Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  7641. Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  7642. Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
  7643. // Take an unsorted, potentially overlapping set of ranges, and
  7644. // build a selection out of it. 'Consumes' ranges array (modifying
  7645. // it).
  7646. function normalizeSelection(ranges, primIndex) {
  7647. var prim = ranges[primIndex];
  7648. ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
  7649. primIndex = indexOf(ranges, prim);
  7650. for (var i = 1; i < ranges.length; i++) {
  7651. var cur = ranges[i], prev = ranges[i - 1];
  7652. if (cmp(prev.to(), cur.from()) >= 0) {
  7653. var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
  7654. var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
  7655. if (i <= primIndex) { --primIndex; }
  7656. ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
  7657. }
  7658. }
  7659. return new Selection(ranges, primIndex)
  7660. }
  7661. function simpleSelection(anchor, head) {
  7662. return new Selection([new Range(anchor, head || anchor)], 0)
  7663. }
  7664. // Compute the position of the end of a change (its 'to' property
  7665. // refers to the pre-change end).
  7666. function changeEnd(change) {
  7667. if (!change.text) { return change.to }
  7668. return Pos(change.from.line + change.text.length - 1,
  7669. lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  7670. }
  7671. // Adjust a position to refer to the post-change position of the
  7672. // same text, or the end of the change if the change covers it.
  7673. function adjustForChange(pos, change) {
  7674. if (cmp(pos, change.from) < 0) { return pos }
  7675. if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
  7676. var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
  7677. if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
  7678. return Pos(line, ch)
  7679. }
  7680. function computeSelAfterChange(doc, change) {
  7681. var out = [];
  7682. for (var i = 0; i < doc.sel.ranges.length; i++) {
  7683. var range = doc.sel.ranges[i];
  7684. out.push(new Range(adjustForChange(range.anchor, change),
  7685. adjustForChange(range.head, change)));
  7686. }
  7687. return normalizeSelection(out, doc.sel.primIndex)
  7688. }
  7689. function offsetPos(pos, old, nw) {
  7690. if (pos.line == old.line)
  7691. { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
  7692. else
  7693. { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  7694. }
  7695. // Used by replaceSelections to allow moving the selection to the
  7696. // start or around the replaced test. Hint may be "start" or "around".
  7697. function computeReplacedSel(doc, changes, hint) {
  7698. var out = [];
  7699. var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
  7700. for (var i = 0; i < changes.length; i++) {
  7701. var change = changes[i];
  7702. var from = offsetPos(change.from, oldPrev, newPrev);
  7703. var to = offsetPos(changeEnd(change), oldPrev, newPrev);
  7704. oldPrev = change.to;
  7705. newPrev = to;
  7706. if (hint == "around") {
  7707. var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
  7708. out[i] = new Range(inv ? to : from, inv ? from : to);
  7709. } else {
  7710. out[i] = new Range(from, from);
  7711. }
  7712. }
  7713. return new Selection(out, doc.sel.primIndex)
  7714. }
  7715. // Used to get the editor into a consistent state again when options change.
  7716. function loadMode(cm) {
  7717. cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
  7718. resetModeState(cm);
  7719. }
  7720. function resetModeState(cm) {
  7721. cm.doc.iter(function (line) {
  7722. if (line.stateAfter) { line.stateAfter = null; }
  7723. if (line.styles) { line.styles = null; }
  7724. });
  7725. cm.doc.frontier = cm.doc.first;
  7726. startWorker(cm, 100);
  7727. cm.state.modeGen++;
  7728. if (cm.curOp) { regChange(cm); }
  7729. }
  7730. // DOCUMENT DATA STRUCTURE
  7731. // By default, updates that start and end at the beginning of a line
  7732. // are treated specially, in order to make the association of line
  7733. // widgets and marker elements with the text behave more intuitive.
  7734. function isWholeLineUpdate(doc, change) {
  7735. return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
  7736. (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  7737. }
  7738. // Perform a change on the document data structure.
  7739. function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
  7740. function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  7741. function update(line, text, spans) {
  7742. updateLine(line, text, spans, estimateHeight$$1);
  7743. signalLater(line, "change", line, change);
  7744. }
  7745. function linesFor(start, end) {
  7746. var result = [];
  7747. for (var i = start; i < end; ++i)
  7748. { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
  7749. return result
  7750. }
  7751. var from = change.from, to = change.to, text = change.text;
  7752. var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
  7753. var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
  7754. // Adjust the line structure
  7755. if (change.full) {
  7756. doc.insert(0, linesFor(0, text.length));
  7757. doc.remove(text.length, doc.size - text.length);
  7758. } else if (isWholeLineUpdate(doc, change)) {
  7759. // This is a whole-line replace. Treated specially to make
  7760. // sure line objects move the way they are supposed to.
  7761. var added = linesFor(0, text.length - 1);
  7762. update(lastLine, lastLine.text, lastSpans);
  7763. if (nlines) { doc.remove(from.line, nlines); }
  7764. if (added.length) { doc.insert(from.line, added); }
  7765. } else if (firstLine == lastLine) {
  7766. if (text.length == 1) {
  7767. update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
  7768. } else {
  7769. var added$1 = linesFor(1, text.length - 1);
  7770. added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
  7771. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  7772. doc.insert(from.line + 1, added$1);
  7773. }
  7774. } else if (text.length == 1) {
  7775. update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
  7776. doc.remove(from.line + 1, nlines);
  7777. } else {
  7778. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  7779. update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
  7780. var added$2 = linesFor(1, text.length - 1);
  7781. if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
  7782. doc.insert(from.line + 1, added$2);
  7783. }
  7784. signalLater(doc, "change", doc, change);
  7785. }
  7786. // Call f for all linked documents.
  7787. function linkedDocs(doc, f, sharedHistOnly) {
  7788. function propagate(doc, skip, sharedHist) {
  7789. if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
  7790. var rel = doc.linked[i];
  7791. if (rel.doc == skip) { continue }
  7792. var shared = sharedHist && rel.sharedHist;
  7793. if (sharedHistOnly && !shared) { continue }
  7794. f(rel.doc, shared);
  7795. propagate(rel.doc, doc, shared);
  7796. } }
  7797. }
  7798. propagate(doc, null, true);
  7799. }
  7800. // Attach a document to an editor.
  7801. function attachDoc(cm, doc) {
  7802. if (doc.cm) { throw new Error("This document is already in use.") }
  7803. cm.doc = doc;
  7804. doc.cm = cm;
  7805. estimateLineHeights(cm);
  7806. loadMode(cm);
  7807. setDirectionClass(cm);
  7808. if (!cm.options.lineWrapping) { findMaxLine(cm); }
  7809. cm.options.mode = doc.modeOption;
  7810. regChange(cm);
  7811. }
  7812. function setDirectionClass(cm) {
  7813. (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  7814. }
  7815. function directionChanged(cm) {
  7816. runInOp(cm, function () {
  7817. setDirectionClass(cm);
  7818. regChange(cm);
  7819. });
  7820. }
  7821. function History(startGen) {
  7822. // Arrays of change events and selections. Doing something adds an
  7823. // event to done and clears undo. Undoing moves events from done
  7824. // to undone, redoing moves them in the other direction.
  7825. this.done = []; this.undone = [];
  7826. this.undoDepth = Infinity;
  7827. // Used to track when changes can be merged into a single undo
  7828. // event
  7829. this.lastModTime = this.lastSelTime = 0;
  7830. this.lastOp = this.lastSelOp = null;
  7831. this.lastOrigin = this.lastSelOrigin = null;
  7832. // Used by the isClean() method
  7833. this.generation = this.maxGeneration = startGen || 1;
  7834. }
  7835. // Create a history change event from an updateDoc-style change
  7836. // object.
  7837. function historyChangeFromChange(doc, change) {
  7838. var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
  7839. attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
  7840. linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
  7841. return histChange
  7842. }
  7843. // Pop all selection events off the end of a history array. Stop at
  7844. // a change event.
  7845. function clearSelectionEvents(array) {
  7846. while (array.length) {
  7847. var last = lst(array);
  7848. if (last.ranges) { array.pop(); }
  7849. else { break }
  7850. }
  7851. }
  7852. // Find the top change event in the history. Pop off selection
  7853. // events that are in the way.
  7854. function lastChangeEvent(hist, force) {
  7855. if (force) {
  7856. clearSelectionEvents(hist.done);
  7857. return lst(hist.done)
  7858. } else if (hist.done.length && !lst(hist.done).ranges) {
  7859. return lst(hist.done)
  7860. } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
  7861. hist.done.pop();
  7862. return lst(hist.done)
  7863. }
  7864. }
  7865. // Register a change in the history. Merges changes that are within
  7866. // a single operation, or are close together with an origin that
  7867. // allows merging (starting with "+") into a single event.
  7868. function addChangeToHistory(doc, change, selAfter, opId) {
  7869. var hist = doc.history;
  7870. hist.undone.length = 0;
  7871. var time = +new Date, cur;
  7872. var last;
  7873. if ((hist.lastOp == opId ||
  7874. hist.lastOrigin == change.origin && change.origin &&
  7875. ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
  7876. change.origin.charAt(0) == "*")) &&
  7877. (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
  7878. // Merge this change into the last event
  7879. last = lst(cur.changes);
  7880. if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
  7881. // Optimized case for simple insertion -- don't want to add
  7882. // new changesets for every character typed
  7883. last.to = changeEnd(change);
  7884. } else {
  7885. // Add new sub-event
  7886. cur.changes.push(historyChangeFromChange(doc, change));
  7887. }
  7888. } else {
  7889. // Can not be merged, start a new event.
  7890. var before = lst(hist.done);
  7891. if (!before || !before.ranges)
  7892. { pushSelectionToHistory(doc.sel, hist.done); }
  7893. cur = {changes: [historyChangeFromChange(doc, change)],
  7894. generation: hist.generation};
  7895. hist.done.push(cur);
  7896. while (hist.done.length > hist.undoDepth) {
  7897. hist.done.shift();
  7898. if (!hist.done[0].ranges) { hist.done.shift(); }
  7899. }
  7900. }
  7901. hist.done.push(selAfter);
  7902. hist.generation = ++hist.maxGeneration;
  7903. hist.lastModTime = hist.lastSelTime = time;
  7904. hist.lastOp = hist.lastSelOp = opId;
  7905. hist.lastOrigin = hist.lastSelOrigin = change.origin;
  7906. if (!last) { signal(doc, "historyAdded"); }
  7907. }
  7908. function selectionEventCanBeMerged(doc, origin, prev, sel) {
  7909. var ch = origin.charAt(0);
  7910. return ch == "*" ||
  7911. ch == "+" &&
  7912. prev.ranges.length == sel.ranges.length &&
  7913. prev.somethingSelected() == sel.somethingSelected() &&
  7914. new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  7915. }
  7916. // Called whenever the selection changes, sets the new selection as
  7917. // the pending selection in the history, and pushes the old pending
  7918. // selection into the 'done' array when it was significantly
  7919. // different (in number of selected ranges, emptiness, or time).
  7920. function addSelectionToHistory(doc, sel, opId, options) {
  7921. var hist = doc.history, origin = options && options.origin;
  7922. // A new event is started when the previous origin does not match
  7923. // the current, or the origins don't allow matching. Origins
  7924. // starting with * are always merged, those starting with + are
  7925. // merged when similar and close together in time.
  7926. if (opId == hist.lastSelOp ||
  7927. (origin && hist.lastSelOrigin == origin &&
  7928. (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
  7929. selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
  7930. { hist.done[hist.done.length - 1] = sel; }
  7931. else
  7932. { pushSelectionToHistory(sel, hist.done); }
  7933. hist.lastSelTime = +new Date;
  7934. hist.lastSelOrigin = origin;
  7935. hist.lastSelOp = opId;
  7936. if (options && options.clearRedo !== false)
  7937. { clearSelectionEvents(hist.undone); }
  7938. }
  7939. function pushSelectionToHistory(sel, dest) {
  7940. var top = lst(dest);
  7941. if (!(top && top.ranges && top.equals(sel)))
  7942. { dest.push(sel); }
  7943. }
  7944. // Used to store marked span information in the history.
  7945. function attachLocalSpans(doc, change, from, to) {
  7946. var existing = change["spans_" + doc.id], n = 0;
  7947. doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
  7948. if (line.markedSpans)
  7949. { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
  7950. ++n;
  7951. });
  7952. }
  7953. // When un/re-doing restores text containing marked spans, those
  7954. // that have been explicitly cleared should not be restored.
  7955. function removeClearedSpans(spans) {
  7956. if (!spans) { return null }
  7957. var out;
  7958. for (var i = 0; i < spans.length; ++i) {
  7959. if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
  7960. else if (out) { out.push(spans[i]); }
  7961. }
  7962. return !out ? spans : out.length ? out : null
  7963. }
  7964. // Retrieve and filter the old marked spans stored in a change event.
  7965. function getOldSpans(doc, change) {
  7966. var found = change["spans_" + doc.id];
  7967. if (!found) { return null }
  7968. var nw = [];
  7969. for (var i = 0; i < change.text.length; ++i)
  7970. { nw.push(removeClearedSpans(found[i])); }
  7971. return nw
  7972. }
  7973. // Used for un/re-doing changes from the history. Combines the
  7974. // result of computing the existing spans with the set of spans that
  7975. // existed in the history (so that deleting around a span and then
  7976. // undoing brings back the span).
  7977. function mergeOldSpans(doc, change) {
  7978. var old = getOldSpans(doc, change);
  7979. var stretched = stretchSpansOverChange(doc, change);
  7980. if (!old) { return stretched }
  7981. if (!stretched) { return old }
  7982. for (var i = 0; i < old.length; ++i) {
  7983. var oldCur = old[i], stretchCur = stretched[i];
  7984. if (oldCur && stretchCur) {
  7985. spans: for (var j = 0; j < stretchCur.length; ++j) {
  7986. var span = stretchCur[j];
  7987. for (var k = 0; k < oldCur.length; ++k)
  7988. { if (oldCur[k].marker == span.marker) { continue spans } }
  7989. oldCur.push(span);
  7990. }
  7991. } else if (stretchCur) {
  7992. old[i] = stretchCur;
  7993. }
  7994. }
  7995. return old
  7996. }
  7997. // Used both to provide a JSON-safe object in .getHistory, and, when
  7998. // detaching a document, to split the history in two
  7999. function copyHistoryArray(events, newGroup, instantiateSel) {
  8000. var copy = [];
  8001. for (var i = 0; i < events.length; ++i) {
  8002. var event = events[i];
  8003. if (event.ranges) {
  8004. copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
  8005. continue
  8006. }
  8007. var changes = event.changes, newChanges = [];
  8008. copy.push({changes: newChanges});
  8009. for (var j = 0; j < changes.length; ++j) {
  8010. var change = changes[j], m = (void 0);
  8011. newChanges.push({from: change.from, to: change.to, text: change.text});
  8012. if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
  8013. if (indexOf(newGroup, Number(m[1])) > -1) {
  8014. lst(newChanges)[prop] = change[prop];
  8015. delete change[prop];
  8016. }
  8017. } } }
  8018. }
  8019. }
  8020. return copy
  8021. }
  8022. // The 'scroll' parameter given to many of these indicated whether
  8023. // the new cursor position should be scrolled into view after
  8024. // modifying the selection.
  8025. // If shift is held or the extend flag is set, extends a range to
  8026. // include a given position (and optionally a second position).
  8027. // Otherwise, simply returns the range between the given positions.
  8028. // Used for cursor motion and such.
  8029. function extendRange(doc, range, head, other) {
  8030. if (doc.cm && doc.cm.display.shift || doc.extend) {
  8031. var anchor = range.anchor;
  8032. if (other) {
  8033. var posBefore = cmp(head, anchor) < 0;
  8034. if (posBefore != (cmp(other, anchor) < 0)) {
  8035. anchor = head;
  8036. head = other;
  8037. } else if (posBefore != (cmp(head, other) < 0)) {
  8038. head = other;
  8039. }
  8040. }
  8041. return new Range(anchor, head)
  8042. } else {
  8043. return new Range(other || head, head)
  8044. }
  8045. }
  8046. // Extend the primary selection range, discard the rest.
  8047. function extendSelection(doc, head, other, options) {
  8048. setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
  8049. }
  8050. // Extend all selections (pos is an array of selections with length
  8051. // equal the number of selections)
  8052. function extendSelections(doc, heads, options) {
  8053. var out = [];
  8054. for (var i = 0; i < doc.sel.ranges.length; i++)
  8055. { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); }
  8056. var newSel = normalizeSelection(out, doc.sel.primIndex);
  8057. setSelection(doc, newSel, options);
  8058. }
  8059. // Updates a single range in the selection.
  8060. function replaceOneSelection(doc, i, range, options) {
  8061. var ranges = doc.sel.ranges.slice(0);
  8062. ranges[i] = range;
  8063. setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
  8064. }
  8065. // Reset the selection to a single range.
  8066. function setSimpleSelection(doc, anchor, head, options) {
  8067. setSelection(doc, simpleSelection(anchor, head), options);
  8068. }
  8069. // Give beforeSelectionChange handlers a change to influence a
  8070. // selection update.
  8071. function filterSelectionChange(doc, sel, options) {
  8072. var obj = {
  8073. ranges: sel.ranges,
  8074. update: function(ranges) {
  8075. var this$1 = this;
  8076. this.ranges = [];
  8077. for (var i = 0; i < ranges.length; i++)
  8078. { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
  8079. clipPos(doc, ranges[i].head)); }
  8080. },
  8081. origin: options && options.origin
  8082. };
  8083. signal(doc, "beforeSelectionChange", doc, obj);
  8084. if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
  8085. if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
  8086. else { return sel }
  8087. }
  8088. function setSelectionReplaceHistory(doc, sel, options) {
  8089. var done = doc.history.done, last = lst(done);
  8090. if (last && last.ranges) {
  8091. done[done.length - 1] = sel;
  8092. setSelectionNoUndo(doc, sel, options);
  8093. } else {
  8094. setSelection(doc, sel, options);
  8095. }
  8096. }
  8097. // Set a new selection.
  8098. function setSelection(doc, sel, options) {
  8099. setSelectionNoUndo(doc, sel, options);
  8100. addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  8101. }
  8102. function setSelectionNoUndo(doc, sel, options) {
  8103. if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
  8104. { sel = filterSelectionChange(doc, sel, options); }
  8105. var bias = options && options.bias ||
  8106. (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
  8107. setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
  8108. if (!(options && options.scroll === false) && doc.cm)
  8109. { ensureCursorVisible(doc.cm); }
  8110. }
  8111. function setSelectionInner(doc, sel) {
  8112. if (sel.equals(doc.sel)) { return }
  8113. doc.sel = sel;
  8114. if (doc.cm) {
  8115. doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
  8116. signalCursorActivity(doc.cm);
  8117. }
  8118. signalLater(doc, "cursorActivity", doc);
  8119. }
  8120. // Verify that the selection does not partially select any atomic
  8121. // marked ranges.
  8122. function reCheckSelection(doc) {
  8123. setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
  8124. }
  8125. // Return a selection that does not partially select any atomic
  8126. // ranges.
  8127. function skipAtomicInSelection(doc, sel, bias, mayClear) {
  8128. var out;
  8129. for (var i = 0; i < sel.ranges.length; i++) {
  8130. var range = sel.ranges[i];
  8131. var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
  8132. var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
  8133. var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
  8134. if (out || newAnchor != range.anchor || newHead != range.head) {
  8135. if (!out) { out = sel.ranges.slice(0, i); }
  8136. out[i] = new Range(newAnchor, newHead);
  8137. }
  8138. }
  8139. return out ? normalizeSelection(out, sel.primIndex) : sel
  8140. }
  8141. function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  8142. var line = getLine(doc, pos.line);
  8143. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  8144. var sp = line.markedSpans[i], m = sp.marker;
  8145. if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
  8146. (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
  8147. if (mayClear) {
  8148. signal(m, "beforeCursorEnter");
  8149. if (m.explicitlyCleared) {
  8150. if (!line.markedSpans) { break }
  8151. else {--i; continue}
  8152. }
  8153. }
  8154. if (!m.atomic) { continue }
  8155. if (oldPos) {
  8156. var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
  8157. if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
  8158. { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
  8159. if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
  8160. { return skipAtomicInner(doc, near, pos, dir, mayClear) }
  8161. }
  8162. var far = m.find(dir < 0 ? -1 : 1);
  8163. if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
  8164. { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
  8165. return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
  8166. }
  8167. } }
  8168. return pos
  8169. }
  8170. // Ensure a given position is not inside an atomic range.
  8171. function skipAtomic(doc, pos, oldPos, bias, mayClear) {
  8172. var dir = bias || 1;
  8173. var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
  8174. (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
  8175. skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
  8176. (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
  8177. if (!found) {
  8178. doc.cantEdit = true;
  8179. return Pos(doc.first, 0)
  8180. }
  8181. return found
  8182. }
  8183. function movePos(doc, pos, dir, line) {
  8184. if (dir < 0 && pos.ch == 0) {
  8185. if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
  8186. else { return null }
  8187. } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
  8188. if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
  8189. else { return null }
  8190. } else {
  8191. return new Pos(pos.line, pos.ch + dir)
  8192. }
  8193. }
  8194. function selectAll(cm) {
  8195. cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  8196. }
  8197. // UPDATING
  8198. // Allow "beforeChange" event handlers to influence a change
  8199. function filterChange(doc, change, update) {
  8200. var obj = {
  8201. canceled: false,
  8202. from: change.from,
  8203. to: change.to,
  8204. text: change.text,
  8205. origin: change.origin,
  8206. cancel: function () { return obj.canceled = true; }
  8207. };
  8208. if (update) { obj.update = function (from, to, text, origin) {
  8209. if (from) { obj.from = clipPos(doc, from); }
  8210. if (to) { obj.to = clipPos(doc, to); }
  8211. if (text) { obj.text = text; }
  8212. if (origin !== undefined) { obj.origin = origin; }
  8213. }; }
  8214. signal(doc, "beforeChange", doc, obj);
  8215. if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
  8216. if (obj.canceled) { return null }
  8217. return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  8218. }
  8219. // Apply a change to a document, and add it to the document's
  8220. // history, and propagating it to all linked documents.
  8221. function makeChange(doc, change, ignoreReadOnly) {
  8222. if (doc.cm) {
  8223. if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
  8224. if (doc.cm.state.suppressEdits) { return }
  8225. }
  8226. if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
  8227. change = filterChange(doc, change, true);
  8228. if (!change) { return }
  8229. }
  8230. // Possibly split or suppress the update based on the presence
  8231. // of read-only spans in its range.
  8232. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
  8233. if (split) {
  8234. for (var i = split.length - 1; i >= 0; --i)
  8235. { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); }
  8236. } else {
  8237. makeChangeInner(doc, change);
  8238. }
  8239. }
  8240. function makeChangeInner(doc, change) {
  8241. if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
  8242. var selAfter = computeSelAfterChange(doc, change);
  8243. addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
  8244. makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
  8245. var rebased = [];
  8246. linkedDocs(doc, function (doc, sharedHist) {
  8247. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  8248. rebaseHist(doc.history, change);
  8249. rebased.push(doc.history);
  8250. }
  8251. makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
  8252. });
  8253. }
  8254. // Revert a change stored in a document's history.
  8255. function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  8256. if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
  8257. var hist = doc.history, event, selAfter = doc.sel;
  8258. var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
  8259. // Verify that there is a useable event (so that ctrl-z won't
  8260. // needlessly clear selection events)
  8261. var i = 0;
  8262. for (; i < source.length; i++) {
  8263. event = source[i];
  8264. if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
  8265. { break }
  8266. }
  8267. if (i == source.length) { return }
  8268. hist.lastOrigin = hist.lastSelOrigin = null;
  8269. for (;;) {
  8270. event = source.pop();
  8271. if (event.ranges) {
  8272. pushSelectionToHistory(event, dest);
  8273. if (allowSelectionOnly && !event.equals(doc.sel)) {
  8274. setSelection(doc, event, {clearRedo: false});
  8275. return
  8276. }
  8277. selAfter = event;
  8278. }
  8279. else { break }
  8280. }
  8281. // Build up a reverse change object to add to the opposite history
  8282. // stack (redo when undoing, and vice versa).
  8283. var antiChanges = [];
  8284. pushSelectionToHistory(selAfter, dest);
  8285. dest.push({changes: antiChanges, generation: hist.generation});
  8286. hist.generation = event.generation || ++hist.maxGeneration;
  8287. var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
  8288. var loop = function ( i ) {
  8289. var change = event.changes[i];
  8290. change.origin = type;
  8291. if (filter && !filterChange(doc, change, false)) {
  8292. source.length = 0;
  8293. return {}
  8294. }
  8295. antiChanges.push(historyChangeFromChange(doc, change));
  8296. var after = i ? computeSelAfterChange(doc, change) : lst(source);
  8297. makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
  8298. if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
  8299. var rebased = [];
  8300. // Propagate to the linked documents
  8301. linkedDocs(doc, function (doc, sharedHist) {
  8302. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  8303. rebaseHist(doc.history, change);
  8304. rebased.push(doc.history);
  8305. }
  8306. makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
  8307. });
  8308. };
  8309. for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
  8310. var returned = loop( i$1 );
  8311. if ( returned ) return returned.v;
  8312. }
  8313. }
  8314. // Sub-views need their line numbers shifted when text is added
  8315. // above or below them in the parent document.
  8316. function shiftDoc(doc, distance) {
  8317. if (distance == 0) { return }
  8318. doc.first += distance;
  8319. doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
  8320. Pos(range.anchor.line + distance, range.anchor.ch),
  8321. Pos(range.head.line + distance, range.head.ch)
  8322. ); }), doc.sel.primIndex);
  8323. if (doc.cm) {
  8324. regChange(doc.cm, doc.first, doc.first - distance, distance);
  8325. for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
  8326. { regLineChange(doc.cm, l, "gutter"); }
  8327. }
  8328. }
  8329. // More lower-level change function, handling only a single document
  8330. // (not linked ones).
  8331. function makeChangeSingleDoc(doc, change, selAfter, spans) {
  8332. if (doc.cm && !doc.cm.curOp)
  8333. { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
  8334. if (change.to.line < doc.first) {
  8335. shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
  8336. return
  8337. }
  8338. if (change.from.line > doc.lastLine()) { return }
  8339. // Clip the change to the size of this doc
  8340. if (change.from.line < doc.first) {
  8341. var shift = change.text.length - 1 - (doc.first - change.from.line);
  8342. shiftDoc(doc, shift);
  8343. change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
  8344. text: [lst(change.text)], origin: change.origin};
  8345. }
  8346. var last = doc.lastLine();
  8347. if (change.to.line > last) {
  8348. change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
  8349. text: [change.text[0]], origin: change.origin};
  8350. }
  8351. change.removed = getBetween(doc, change.from, change.to);
  8352. if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
  8353. if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
  8354. else { updateDoc(doc, change, spans); }
  8355. setSelectionNoUndo(doc, selAfter, sel_dontScroll);
  8356. }
  8357. // Handle the interaction of a change to a document with the editor
  8358. // that this document is part of.
  8359. function makeChangeSingleDocInEditor(cm, change, spans) {
  8360. var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
  8361. var recomputeMaxLength = false, checkWidthStart = from.line;
  8362. if (!cm.options.lineWrapping) {
  8363. checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
  8364. doc.iter(checkWidthStart, to.line + 1, function (line) {
  8365. if (line == display.maxLine) {
  8366. recomputeMaxLength = true;
  8367. return true
  8368. }
  8369. });
  8370. }
  8371. if (doc.sel.contains(change.from, change.to) > -1)
  8372. { signalCursorActivity(cm); }
  8373. updateDoc(doc, change, spans, estimateHeight(cm));
  8374. if (!cm.options.lineWrapping) {
  8375. doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
  8376. var len = lineLength(line);
  8377. if (len > display.maxLineLength) {
  8378. display.maxLine = line;
  8379. display.maxLineLength = len;
  8380. display.maxLineChanged = true;
  8381. recomputeMaxLength = false;
  8382. }
  8383. });
  8384. if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
  8385. }
  8386. // Adjust frontier, schedule worker
  8387. doc.frontier = Math.min(doc.frontier, from.line);
  8388. startWorker(cm, 400);
  8389. var lendiff = change.text.length - (to.line - from.line) - 1;
  8390. // Remember that these lines changed, for updating the display
  8391. if (change.full)
  8392. { regChange(cm); }
  8393. else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
  8394. { regLineChange(cm, from.line, "text"); }
  8395. else
  8396. { regChange(cm, from.line, to.line + 1, lendiff); }
  8397. var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
  8398. if (changeHandler || changesHandler) {
  8399. var obj = {
  8400. from: from, to: to,
  8401. text: change.text,
  8402. removed: change.removed,
  8403. origin: change.origin
  8404. };
  8405. if (changeHandler) { signalLater(cm, "change", cm, obj); }
  8406. if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
  8407. }
  8408. cm.display.selForContextMenu = null;
  8409. }
  8410. function replaceRange(doc, code, from, to, origin) {
  8411. if (!to) { to = from; }
  8412. if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
  8413. if (typeof code == "string") { code = doc.splitLines(code); }
  8414. makeChange(doc, {from: from, to: to, text: code, origin: origin});
  8415. }
  8416. // Rebasing/resetting history to deal with externally-sourced changes
  8417. function rebaseHistSelSingle(pos, from, to, diff) {
  8418. if (to < pos.line) {
  8419. pos.line += diff;
  8420. } else if (from < pos.line) {
  8421. pos.line = from;
  8422. pos.ch = 0;
  8423. }
  8424. }
  8425. // Tries to rebase an array of history events given a change in the
  8426. // document. If the change touches the same lines as the event, the
  8427. // event, and everything 'behind' it, is discarded. If the change is
  8428. // before the event, the event's positions are updated. Uses a
  8429. // copy-on-write scheme for the positions, to avoid having to
  8430. // reallocate them all on every rebase, but also avoid problems with
  8431. // shared position objects being unsafely updated.
  8432. function rebaseHistArray(array, from, to, diff) {
  8433. for (var i = 0; i < array.length; ++i) {
  8434. var sub = array[i], ok = true;
  8435. if (sub.ranges) {
  8436. if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
  8437. for (var j = 0; j < sub.ranges.length; j++) {
  8438. rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
  8439. rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
  8440. }
  8441. continue
  8442. }
  8443. for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
  8444. var cur = sub.changes[j$1];
  8445. if (to < cur.from.line) {
  8446. cur.from = Pos(cur.from.line + diff, cur.from.ch);
  8447. cur.to = Pos(cur.to.line + diff, cur.to.ch);
  8448. } else if (from <= cur.to.line) {
  8449. ok = false;
  8450. break
  8451. }
  8452. }
  8453. if (!ok) {
  8454. array.splice(0, i + 1);
  8455. i = 0;
  8456. }
  8457. }
  8458. }
  8459. function rebaseHist(hist, change) {
  8460. var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
  8461. rebaseHistArray(hist.done, from, to, diff);
  8462. rebaseHistArray(hist.undone, from, to, diff);
  8463. }
  8464. // Utility for applying a change to a line by handle or number,
  8465. // returning the number and optionally registering the line as
  8466. // changed.
  8467. function changeLine(doc, handle, changeType, op) {
  8468. var no = handle, line = handle;
  8469. if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
  8470. else { no = lineNo(handle); }
  8471. if (no == null) { return null }
  8472. if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
  8473. return line
  8474. }
  8475. // The document is represented as a BTree consisting of leaves, with
  8476. // chunk of lines in them, and branches, with up to ten leaves or
  8477. // other branch nodes below them. The top node is always a branch
  8478. // node, and is the document object itself (meaning it has
  8479. // additional methods and properties).
  8480. //
  8481. // All nodes have parent links. The tree is used both to go from
  8482. // line numbers to line objects, and to go from objects to numbers.
  8483. // It also indexes by height, and is used to convert between height
  8484. // and line object, and to find the total height of the document.
  8485. //
  8486. // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
  8487. var LeafChunk = function(lines) {
  8488. var this$1 = this;
  8489. this.lines = lines;
  8490. this.parent = null;
  8491. var height = 0;
  8492. for (var i = 0; i < lines.length; ++i) {
  8493. lines[i].parent = this$1;
  8494. height += lines[i].height;
  8495. }
  8496. this.height = height;
  8497. };
  8498. LeafChunk.prototype.chunkSize = function () { return this.lines.length };
  8499. // Remove the n lines at offset 'at'.
  8500. LeafChunk.prototype.removeInner = function (at, n) {
  8501. var this$1 = this;
  8502. for (var i = at, e = at + n; i < e; ++i) {
  8503. var line = this$1.lines[i];
  8504. this$1.height -= line.height;
  8505. cleanUpLine(line);
  8506. signalLater(line, "delete");
  8507. }
  8508. this.lines.splice(at, n);
  8509. };
  8510. // Helper used to collapse a small branch into a single leaf.
  8511. LeafChunk.prototype.collapse = function (lines) {
  8512. lines.push.apply(lines, this.lines);
  8513. };
  8514. // Insert the given array of lines at offset 'at', count them as
  8515. // having the given height.
  8516. LeafChunk.prototype.insertInner = function (at, lines, height) {
  8517. var this$1 = this;
  8518. this.height += height;
  8519. this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
  8520. for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
  8521. };
  8522. // Used to iterate over a part of the tree.
  8523. LeafChunk.prototype.iterN = function (at, n, op) {
  8524. var this$1 = this;
  8525. for (var e = at + n; at < e; ++at)
  8526. { if (op(this$1.lines[at])) { return true } }
  8527. };
  8528. var BranchChunk = function(children) {
  8529. var this$1 = this;
  8530. this.children = children;
  8531. var size = 0, height = 0;
  8532. for (var i = 0; i < children.length; ++i) {
  8533. var ch = children[i];
  8534. size += ch.chunkSize(); height += ch.height;
  8535. ch.parent = this$1;
  8536. }
  8537. this.size = size;
  8538. this.height = height;
  8539. this.parent = null;
  8540. };
  8541. BranchChunk.prototype.chunkSize = function () { return this.size };
  8542. BranchChunk.prototype.removeInner = function (at, n) {
  8543. var this$1 = this;
  8544. this.size -= n;
  8545. for (var i = 0; i < this.children.length; ++i) {
  8546. var child = this$1.children[i], sz = child.chunkSize();
  8547. if (at < sz) {
  8548. var rm = Math.min(n, sz - at), oldHeight = child.height;
  8549. child.removeInner(at, rm);
  8550. this$1.height -= oldHeight - child.height;
  8551. if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
  8552. if ((n -= rm) == 0) { break }
  8553. at = 0;
  8554. } else { at -= sz; }
  8555. }
  8556. // If the result is smaller than 25 lines, ensure that it is a
  8557. // single leaf node.
  8558. if (this.size - n < 25 &&
  8559. (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
  8560. var lines = [];
  8561. this.collapse(lines);
  8562. this.children = [new LeafChunk(lines)];
  8563. this.children[0].parent = this;
  8564. }
  8565. };
  8566. BranchChunk.prototype.collapse = function (lines) {
  8567. var this$1 = this;
  8568. for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
  8569. };
  8570. BranchChunk.prototype.insertInner = function (at, lines, height) {
  8571. var this$1 = this;
  8572. this.size += lines.length;
  8573. this.height += height;
  8574. for (var i = 0; i < this.children.length; ++i) {
  8575. var child = this$1.children[i], sz = child.chunkSize();
  8576. if (at <= sz) {
  8577. child.insertInner(at, lines, height);
  8578. if (child.lines && child.lines.length > 50) {
  8579. // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
  8580. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
  8581. var remaining = child.lines.length % 25 + 25;
  8582. for (var pos = remaining; pos < child.lines.length;) {
  8583. var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
  8584. child.height -= leaf.height;
  8585. this$1.children.splice(++i, 0, leaf);
  8586. leaf.parent = this$1;
  8587. }
  8588. child.lines = child.lines.slice(0, remaining);
  8589. this$1.maybeSpill();
  8590. }
  8591. break
  8592. }
  8593. at -= sz;
  8594. }
  8595. };
  8596. // When a node has grown, check whether it should be split.
  8597. BranchChunk.prototype.maybeSpill = function () {
  8598. if (this.children.length <= 10) { return }
  8599. var me = this;
  8600. do {
  8601. var spilled = me.children.splice(me.children.length - 5, 5);
  8602. var sibling = new BranchChunk(spilled);
  8603. if (!me.parent) { // Become the parent node
  8604. var copy = new BranchChunk(me.children);
  8605. copy.parent = me;
  8606. me.children = [copy, sibling];
  8607. me = copy;
  8608. } else {
  8609. me.size -= sibling.size;
  8610. me.height -= sibling.height;
  8611. var myIndex = indexOf(me.parent.children, me);
  8612. me.parent.children.splice(myIndex + 1, 0, sibling);
  8613. }
  8614. sibling.parent = me.parent;
  8615. } while (me.children.length > 10)
  8616. me.parent.maybeSpill();
  8617. };
  8618. BranchChunk.prototype.iterN = function (at, n, op) {
  8619. var this$1 = this;
  8620. for (var i = 0; i < this.children.length; ++i) {
  8621. var child = this$1.children[i], sz = child.chunkSize();
  8622. if (at < sz) {
  8623. var used = Math.min(n, sz - at);
  8624. if (child.iterN(at, used, op)) { return true }
  8625. if ((n -= used) == 0) { break }
  8626. at = 0;
  8627. } else { at -= sz; }
  8628. }
  8629. };
  8630. // Line widgets are block elements displayed above or below a line.
  8631. var LineWidget = function(doc, node, options) {
  8632. var this$1 = this;
  8633. if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
  8634. { this$1[opt] = options[opt]; } } }
  8635. this.doc = doc;
  8636. this.node = node;
  8637. };
  8638. LineWidget.prototype.clear = function () {
  8639. var this$1 = this;
  8640. var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
  8641. if (no == null || !ws) { return }
  8642. for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
  8643. if (!ws.length) { line.widgets = null; }
  8644. var height = widgetHeight(this);
  8645. updateLineHeight(line, Math.max(0, line.height - height));
  8646. if (cm) {
  8647. runInOp(cm, function () {
  8648. adjustScrollWhenAboveVisible(cm, line, -height);
  8649. regLineChange(cm, no, "widget");
  8650. });
  8651. signalLater(cm, "lineWidgetCleared", cm, this, no);
  8652. }
  8653. };
  8654. LineWidget.prototype.changed = function () {
  8655. var this$1 = this;
  8656. var oldH = this.height, cm = this.doc.cm, line = this.line;
  8657. this.height = null;
  8658. var diff = widgetHeight(this) - oldH;
  8659. if (!diff) { return }
  8660. updateLineHeight(line, line.height + diff);
  8661. if (cm) {
  8662. runInOp(cm, function () {
  8663. cm.curOp.forceUpdate = true;
  8664. adjustScrollWhenAboveVisible(cm, line, diff);
  8665. signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
  8666. });
  8667. }
  8668. };
  8669. eventMixin(LineWidget);
  8670. function adjustScrollWhenAboveVisible(cm, line, diff) {
  8671. if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
  8672. { addToScrollPos(cm, null, diff); }
  8673. }
  8674. function addLineWidget(doc, handle, node, options) {
  8675. var widget = new LineWidget(doc, node, options);
  8676. var cm = doc.cm;
  8677. if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
  8678. changeLine(doc, handle, "widget", function (line) {
  8679. var widgets = line.widgets || (line.widgets = []);
  8680. if (widget.insertAt == null) { widgets.push(widget); }
  8681. else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
  8682. widget.line = line;
  8683. if (cm && !lineIsHidden(doc, line)) {
  8684. var aboveVisible = heightAtLine(line) < doc.scrollTop;
  8685. updateLineHeight(line, line.height + widgetHeight(widget));
  8686. if (aboveVisible) { addToScrollPos(cm, null, widget.height); }
  8687. cm.curOp.forceUpdate = true;
  8688. }
  8689. return true
  8690. });
  8691. signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle));
  8692. return widget
  8693. }
  8694. // TEXTMARKERS
  8695. // Created with markText and setBookmark methods. A TextMarker is a
  8696. // handle that can be used to clear or find a marked position in the
  8697. // document. Line objects hold arrays (markedSpans) containing
  8698. // {from, to, marker} object pointing to such marker objects, and
  8699. // indicating that such a marker is present on that line. Multiple
  8700. // lines may point to the same marker when it spans across lines.
  8701. // The spans will have null for their from/to properties when the
  8702. // marker continues beyond the start/end of the line. Markers have
  8703. // links back to the lines they currently touch.
  8704. // Collapsed markers have unique ids, in order to be able to order
  8705. // them, which is needed for uniquely determining an outer marker
  8706. // when they overlap (they may nest, but not partially overlap).
  8707. var nextMarkerId = 0;
  8708. var TextMarker = function(doc, type) {
  8709. this.lines = [];
  8710. this.type = type;
  8711. this.doc = doc;
  8712. this.id = ++nextMarkerId;
  8713. };
  8714. // Clear the marker.
  8715. TextMarker.prototype.clear = function () {
  8716. var this$1 = this;
  8717. if (this.explicitlyCleared) { return }
  8718. var cm = this.doc.cm, withOp = cm && !cm.curOp;
  8719. if (withOp) { startOperation(cm); }
  8720. if (hasHandler(this, "clear")) {
  8721. var found = this.find();
  8722. if (found) { signalLater(this, "clear", found.from, found.to); }
  8723. }
  8724. var min = null, max = null;
  8725. for (var i = 0; i < this.lines.length; ++i) {
  8726. var line = this$1.lines[i];
  8727. var span = getMarkedSpanFor(line.markedSpans, this$1);
  8728. if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
  8729. else if (cm) {
  8730. if (span.to != null) { max = lineNo(line); }
  8731. if (span.from != null) { min = lineNo(line); }
  8732. }
  8733. line.markedSpans = removeMarkedSpan(line.markedSpans, span);
  8734. if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
  8735. { updateLineHeight(line, textHeight(cm.display)); }
  8736. }
  8737. if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
  8738. var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
  8739. if (len > cm.display.maxLineLength) {
  8740. cm.display.maxLine = visual;
  8741. cm.display.maxLineLength = len;
  8742. cm.display.maxLineChanged = true;
  8743. }
  8744. } }
  8745. if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
  8746. this.lines.length = 0;
  8747. this.explicitlyCleared = true;
  8748. if (this.atomic && this.doc.cantEdit) {
  8749. this.doc.cantEdit = false;
  8750. if (cm) { reCheckSelection(cm.doc); }
  8751. }
  8752. if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
  8753. if (withOp) { endOperation(cm); }
  8754. if (this.parent) { this.parent.clear(); }
  8755. };
  8756. // Find the position of the marker in the document. Returns a {from,
  8757. // to} object by default. Side can be passed to get a specific side
  8758. // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  8759. // Pos objects returned contain a line object, rather than a line
  8760. // number (used to prevent looking up the same line twice).
  8761. TextMarker.prototype.find = function (side, lineObj) {
  8762. var this$1 = this;
  8763. if (side == null && this.type == "bookmark") { side = 1; }
  8764. var from, to;
  8765. for (var i = 0; i < this.lines.length; ++i) {
  8766. var line = this$1.lines[i];
  8767. var span = getMarkedSpanFor(line.markedSpans, this$1);
  8768. if (span.from != null) {
  8769. from = Pos(lineObj ? line : lineNo(line), span.from);
  8770. if (side == -1) { return from }
  8771. }
  8772. if (span.to != null) {
  8773. to = Pos(lineObj ? line : lineNo(line), span.to);
  8774. if (side == 1) { return to }
  8775. }
  8776. }
  8777. return from && {from: from, to: to}
  8778. };
  8779. // Signals that the marker's widget changed, and surrounding layout
  8780. // should be recomputed.
  8781. TextMarker.prototype.changed = function () {
  8782. var this$1 = this;
  8783. var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
  8784. if (!pos || !cm) { return }
  8785. runInOp(cm, function () {
  8786. var line = pos.line, lineN = lineNo(pos.line);
  8787. var view = findViewForLine(cm, lineN);
  8788. if (view) {
  8789. clearLineMeasurementCacheFor(view);
  8790. cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
  8791. }
  8792. cm.curOp.updateMaxLine = true;
  8793. if (!lineIsHidden(widget.doc, line) && widget.height != null) {
  8794. var oldHeight = widget.height;
  8795. widget.height = null;
  8796. var dHeight = widgetHeight(widget) - oldHeight;
  8797. if (dHeight)
  8798. { updateLineHeight(line, line.height + dHeight); }
  8799. }
  8800. signalLater(cm, "markerChanged", cm, this$1);
  8801. });
  8802. };
  8803. TextMarker.prototype.attachLine = function (line) {
  8804. if (!this.lines.length && this.doc.cm) {
  8805. var op = this.doc.cm.curOp;
  8806. if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
  8807. { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
  8808. }
  8809. this.lines.push(line);
  8810. };
  8811. TextMarker.prototype.detachLine = function (line) {
  8812. this.lines.splice(indexOf(this.lines, line), 1);
  8813. if (!this.lines.length && this.doc.cm) {
  8814. var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
  8815. }
  8816. };
  8817. eventMixin(TextMarker);
  8818. // Create a marker, wire it up to the right lines, and
  8819. function markText(doc, from, to, options, type) {
  8820. // Shared markers (across linked documents) are handled separately
  8821. // (markTextShared will call out to this again, once per
  8822. // document).
  8823. if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
  8824. // Ensure we are in an operation.
  8825. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
  8826. var marker = new TextMarker(doc, type), diff = cmp(from, to);
  8827. if (options) { copyObj(options, marker, false); }
  8828. // Don't connect empty markers unless clearWhenEmpty is false
  8829. if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
  8830. { return marker }
  8831. if (marker.replacedWith) {
  8832. // Showing up as a widget implies collapsed (widget replaces text)
  8833. marker.collapsed = true;
  8834. marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
  8835. if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
  8836. if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
  8837. }
  8838. if (marker.collapsed) {
  8839. if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
  8840. from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
  8841. { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
  8842. seeCollapsedSpans();
  8843. }
  8844. if (marker.addToHistory)
  8845. { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
  8846. var curLine = from.line, cm = doc.cm, updateMaxLine;
  8847. doc.iter(curLine, to.line + 1, function (line) {
  8848. if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
  8849. { updateMaxLine = true; }
  8850. if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
  8851. addMarkedSpan(line, new MarkedSpan(marker,
  8852. curLine == from.line ? from.ch : null,
  8853. curLine == to.line ? to.ch : null));
  8854. ++curLine;
  8855. });
  8856. // lineIsHidden depends on the presence of the spans, so needs a second pass
  8857. if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
  8858. if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
  8859. }); }
  8860. if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
  8861. if (marker.readOnly) {
  8862. seeReadOnlySpans();
  8863. if (doc.history.done.length || doc.history.undone.length)
  8864. { doc.clearHistory(); }
  8865. }
  8866. if (marker.collapsed) {
  8867. marker.id = ++nextMarkerId;
  8868. marker.atomic = true;
  8869. }
  8870. if (cm) {
  8871. // Sync editor state
  8872. if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
  8873. if (marker.collapsed)
  8874. { regChange(cm, from.line, to.line + 1); }
  8875. else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
  8876. { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
  8877. if (marker.atomic) { reCheckSelection(cm.doc); }
  8878. signalLater(cm, "markerAdded", cm, marker);
  8879. }
  8880. return marker
  8881. }
  8882. // SHARED TEXTMARKERS
  8883. // A shared marker spans multiple linked documents. It is
  8884. // implemented as a meta-marker-object controlling multiple normal
  8885. // markers.
  8886. var SharedTextMarker = function(markers, primary) {
  8887. var this$1 = this;
  8888. this.markers = markers;
  8889. this.primary = primary;
  8890. for (var i = 0; i < markers.length; ++i)
  8891. { markers[i].parent = this$1; }
  8892. };
  8893. SharedTextMarker.prototype.clear = function () {
  8894. var this$1 = this;
  8895. if (this.explicitlyCleared) { return }
  8896. this.explicitlyCleared = true;
  8897. for (var i = 0; i < this.markers.length; ++i)
  8898. { this$1.markers[i].clear(); }
  8899. signalLater(this, "clear");
  8900. };
  8901. SharedTextMarker.prototype.find = function (side, lineObj) {
  8902. return this.primary.find(side, lineObj)
  8903. };
  8904. eventMixin(SharedTextMarker);
  8905. function markTextShared(doc, from, to, options, type) {
  8906. options = copyObj(options);
  8907. options.shared = false;
  8908. var markers = [markText(doc, from, to, options, type)], primary = markers[0];
  8909. var widget = options.widgetNode;
  8910. linkedDocs(doc, function (doc) {
  8911. if (widget) { options.widgetNode = widget.cloneNode(true); }
  8912. markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
  8913. for (var i = 0; i < doc.linked.length; ++i)
  8914. { if (doc.linked[i].isParent) { return } }
  8915. primary = lst(markers);
  8916. });
  8917. return new SharedTextMarker(markers, primary)
  8918. }
  8919. function findSharedMarkers(doc) {
  8920. return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  8921. }
  8922. function copySharedMarkers(doc, markers) {
  8923. for (var i = 0; i < markers.length; i++) {
  8924. var marker = markers[i], pos = marker.find();
  8925. var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
  8926. if (cmp(mFrom, mTo)) {
  8927. var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
  8928. marker.markers.push(subMark);
  8929. subMark.parent = marker;
  8930. }
  8931. }
  8932. }
  8933. function detachSharedMarkers(markers) {
  8934. var loop = function ( i ) {
  8935. var marker = markers[i], linked = [marker.primary.doc];
  8936. linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
  8937. for (var j = 0; j < marker.markers.length; j++) {
  8938. var subMarker = marker.markers[j];
  8939. if (indexOf(linked, subMarker.doc) == -1) {
  8940. subMarker.parent = null;
  8941. marker.markers.splice(j--, 1);
  8942. }
  8943. }
  8944. };
  8945. for (var i = 0; i < markers.length; i++) loop( i );
  8946. }
  8947. var nextDocId = 0;
  8948. var Doc = function(text, mode, firstLine, lineSep, direction) {
  8949. if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
  8950. if (firstLine == null) { firstLine = 0; }
  8951. BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
  8952. this.first = firstLine;
  8953. this.scrollTop = this.scrollLeft = 0;
  8954. this.cantEdit = false;
  8955. this.cleanGeneration = 1;
  8956. this.frontier = firstLine;
  8957. var start = Pos(firstLine, 0);
  8958. this.sel = simpleSelection(start);
  8959. this.history = new History(null);
  8960. this.id = ++nextDocId;
  8961. this.modeOption = mode;
  8962. this.lineSep = lineSep;
  8963. this.direction = (direction == "rtl") ? "rtl" : "ltr";
  8964. this.extend = false;
  8965. if (typeof text == "string") { text = this.splitLines(text); }
  8966. updateDoc(this, {from: start, to: start, text: text});
  8967. setSelection(this, simpleSelection(start), sel_dontScroll);
  8968. };
  8969. Doc.prototype = createObj(BranchChunk.prototype, {
  8970. constructor: Doc,
  8971. // Iterate over the document. Supports two forms -- with only one
  8972. // argument, it calls that for each line in the document. With
  8973. // three, it iterates over the range given by the first two (with
  8974. // the second being non-inclusive).
  8975. iter: function(from, to, op) {
  8976. if (op) { this.iterN(from - this.first, to - from, op); }
  8977. else { this.iterN(this.first, this.first + this.size, from); }
  8978. },
  8979. // Non-public interface for adding and removing lines.
  8980. insert: function(at, lines) {
  8981. var height = 0;
  8982. for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
  8983. this.insertInner(at - this.first, lines, height);
  8984. },
  8985. remove: function(at, n) { this.removeInner(at - this.first, n); },
  8986. // From here, the methods are part of the public interface. Most
  8987. // are also available from CodeMirror (editor) instances.
  8988. getValue: function(lineSep) {
  8989. var lines = getLines(this, this.first, this.first + this.size);
  8990. if (lineSep === false) { return lines }
  8991. return lines.join(lineSep || this.lineSeparator())
  8992. },
  8993. setValue: docMethodOp(function(code) {
  8994. var top = Pos(this.first, 0), last = this.first + this.size - 1;
  8995. makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
  8996. text: this.splitLines(code), origin: "setValue", full: true}, true);
  8997. setSelection(this, simpleSelection(top));
  8998. }),
  8999. replaceRange: function(code, from, to, origin) {
  9000. from = clipPos(this, from);
  9001. to = to ? clipPos(this, to) : from;
  9002. replaceRange(this, code, from, to, origin);
  9003. },
  9004. getRange: function(from, to, lineSep) {
  9005. var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
  9006. if (lineSep === false) { return lines }
  9007. return lines.join(lineSep || this.lineSeparator())
  9008. },
  9009. getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
  9010. getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
  9011. getLineNumber: function(line) {return lineNo(line)},
  9012. getLineHandleVisualStart: function(line) {
  9013. if (typeof line == "number") { line = getLine(this, line); }
  9014. return visualLine(line)
  9015. },
  9016. lineCount: function() {return this.size},
  9017. firstLine: function() {return this.first},
  9018. lastLine: function() {return this.first + this.size - 1},
  9019. clipPos: function(pos) {return clipPos(this, pos)},
  9020. getCursor: function(start) {
  9021. var range$$1 = this.sel.primary(), pos;
  9022. if (start == null || start == "head") { pos = range$$1.head; }
  9023. else if (start == "anchor") { pos = range$$1.anchor; }
  9024. else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
  9025. else { pos = range$$1.from(); }
  9026. return pos
  9027. },
  9028. listSelections: function() { return this.sel.ranges },
  9029. somethingSelected: function() {return this.sel.somethingSelected()},
  9030. setCursor: docMethodOp(function(line, ch, options) {
  9031. setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
  9032. }),
  9033. setSelection: docMethodOp(function(anchor, head, options) {
  9034. setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
  9035. }),
  9036. extendSelection: docMethodOp(function(head, other, options) {
  9037. extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
  9038. }),
  9039. extendSelections: docMethodOp(function(heads, options) {
  9040. extendSelections(this, clipPosArray(this, heads), options);
  9041. }),
  9042. extendSelectionsBy: docMethodOp(function(f, options) {
  9043. var heads = map(this.sel.ranges, f);
  9044. extendSelections(this, clipPosArray(this, heads), options);
  9045. }),
  9046. setSelections: docMethodOp(function(ranges, primary, options) {
  9047. var this$1 = this;
  9048. if (!ranges.length) { return }
  9049. var out = [];
  9050. for (var i = 0; i < ranges.length; i++)
  9051. { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
  9052. clipPos(this$1, ranges[i].head)); }
  9053. if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
  9054. setSelection(this, normalizeSelection(out, primary), options);
  9055. }),
  9056. addSelection: docMethodOp(function(anchor, head, options) {
  9057. var ranges = this.sel.ranges.slice(0);
  9058. ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
  9059. setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
  9060. }),
  9061. getSelection: function(lineSep) {
  9062. var this$1 = this;
  9063. var ranges = this.sel.ranges, lines;
  9064. for (var i = 0; i < ranges.length; i++) {
  9065. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  9066. lines = lines ? lines.concat(sel) : sel;
  9067. }
  9068. if (lineSep === false) { return lines }
  9069. else { return lines.join(lineSep || this.lineSeparator()) }
  9070. },
  9071. getSelections: function(lineSep) {
  9072. var this$1 = this;
  9073. var parts = [], ranges = this.sel.ranges;
  9074. for (var i = 0; i < ranges.length; i++) {
  9075. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  9076. if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
  9077. parts[i] = sel;
  9078. }
  9079. return parts
  9080. },
  9081. replaceSelection: function(code, collapse, origin) {
  9082. var dup = [];
  9083. for (var i = 0; i < this.sel.ranges.length; i++)
  9084. { dup[i] = code; }
  9085. this.replaceSelections(dup, collapse, origin || "+input");
  9086. },
  9087. replaceSelections: docMethodOp(function(code, collapse, origin) {
  9088. var this$1 = this;
  9089. var changes = [], sel = this.sel;
  9090. for (var i = 0; i < sel.ranges.length; i++) {
  9091. var range$$1 = sel.ranges[i];
  9092. changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
  9093. }
  9094. var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
  9095. for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
  9096. { makeChange(this$1, changes[i$1]); }
  9097. if (newSel) { setSelectionReplaceHistory(this, newSel); }
  9098. else if (this.cm) { ensureCursorVisible(this.cm); }
  9099. }),
  9100. undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
  9101. redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
  9102. undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
  9103. redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
  9104. setExtending: function(val) {this.extend = val;},
  9105. getExtending: function() {return this.extend},
  9106. historySize: function() {
  9107. var hist = this.history, done = 0, undone = 0;
  9108. for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
  9109. for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
  9110. return {undo: done, redo: undone}
  9111. },
  9112. clearHistory: function() {this.history = new History(this.history.maxGeneration);},
  9113. markClean: function() {
  9114. this.cleanGeneration = this.changeGeneration(true);
  9115. },
  9116. changeGeneration: function(forceSplit) {
  9117. if (forceSplit)
  9118. { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
  9119. return this.history.generation
  9120. },
  9121. isClean: function (gen) {
  9122. return this.history.generation == (gen || this.cleanGeneration)
  9123. },
  9124. getHistory: function() {
  9125. return {done: copyHistoryArray(this.history.done),
  9126. undone: copyHistoryArray(this.history.undone)}
  9127. },
  9128. setHistory: function(histData) {
  9129. var hist = this.history = new History(this.history.maxGeneration);
  9130. hist.done = copyHistoryArray(histData.done.slice(0), null, true);
  9131. hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
  9132. },
  9133. setGutterMarker: docMethodOp(function(line, gutterID, value) {
  9134. return changeLine(this, line, "gutter", function (line) {
  9135. var markers = line.gutterMarkers || (line.gutterMarkers = {});
  9136. markers[gutterID] = value;
  9137. if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
  9138. return true
  9139. })
  9140. }),
  9141. clearGutter: docMethodOp(function(gutterID) {
  9142. var this$1 = this;
  9143. this.iter(function (line) {
  9144. if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
  9145. changeLine(this$1, line, "gutter", function () {
  9146. line.gutterMarkers[gutterID] = null;
  9147. if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
  9148. return true
  9149. });
  9150. }
  9151. });
  9152. }),
  9153. lineInfo: function(line) {
  9154. var n;
  9155. if (typeof line == "number") {
  9156. if (!isLine(this, line)) { return null }
  9157. n = line;
  9158. line = getLine(this, line);
  9159. if (!line) { return null }
  9160. } else {
  9161. n = lineNo(line);
  9162. if (n == null) { return null }
  9163. }
  9164. return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
  9165. textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
  9166. widgets: line.widgets}
  9167. },
  9168. addLineClass: docMethodOp(function(handle, where, cls) {
  9169. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  9170. var prop = where == "text" ? "textClass"
  9171. : where == "background" ? "bgClass"
  9172. : where == "gutter" ? "gutterClass" : "wrapClass";
  9173. if (!line[prop]) { line[prop] = cls; }
  9174. else if (classTest(cls).test(line[prop])) { return false }
  9175. else { line[prop] += " " + cls; }
  9176. return true
  9177. })
  9178. }),
  9179. removeLineClass: docMethodOp(function(handle, where, cls) {
  9180. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  9181. var prop = where == "text" ? "textClass"
  9182. : where == "background" ? "bgClass"
  9183. : where == "gutter" ? "gutterClass" : "wrapClass";
  9184. var cur = line[prop];
  9185. if (!cur) { return false }
  9186. else if (cls == null) { line[prop] = null; }
  9187. else {
  9188. var found = cur.match(classTest(cls));
  9189. if (!found) { return false }
  9190. var end = found.index + found[0].length;
  9191. line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
  9192. }
  9193. return true
  9194. })
  9195. }),
  9196. addLineWidget: docMethodOp(function(handle, node, options) {
  9197. return addLineWidget(this, handle, node, options)
  9198. }),
  9199. removeLineWidget: function(widget) { widget.clear(); },
  9200. markText: function(from, to, options) {
  9201. return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
  9202. },
  9203. setBookmark: function(pos, options) {
  9204. var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
  9205. insertLeft: options && options.insertLeft,
  9206. clearWhenEmpty: false, shared: options && options.shared,
  9207. handleMouseEvents: options && options.handleMouseEvents};
  9208. pos = clipPos(this, pos);
  9209. return markText(this, pos, pos, realOpts, "bookmark")
  9210. },
  9211. findMarksAt: function(pos) {
  9212. pos = clipPos(this, pos);
  9213. var markers = [], spans = getLine(this, pos.line).markedSpans;
  9214. if (spans) { for (var i = 0; i < spans.length; ++i) {
  9215. var span = spans[i];
  9216. if ((span.from == null || span.from <= pos.ch) &&
  9217. (span.to == null || span.to >= pos.ch))
  9218. { markers.push(span.marker.parent || span.marker); }
  9219. } }
  9220. return markers
  9221. },
  9222. findMarks: function(from, to, filter) {
  9223. from = clipPos(this, from); to = clipPos(this, to);
  9224. var found = [], lineNo$$1 = from.line;
  9225. this.iter(from.line, to.line + 1, function (line) {
  9226. var spans = line.markedSpans;
  9227. if (spans) { for (var i = 0; i < spans.length; i++) {
  9228. var span = spans[i];
  9229. if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
  9230. span.from == null && lineNo$$1 != from.line ||
  9231. span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
  9232. (!filter || filter(span.marker)))
  9233. { found.push(span.marker.parent || span.marker); }
  9234. } }
  9235. ++lineNo$$1;
  9236. });
  9237. return found
  9238. },
  9239. getAllMarks: function() {
  9240. var markers = [];
  9241. this.iter(function (line) {
  9242. var sps = line.markedSpans;
  9243. if (sps) { for (var i = 0; i < sps.length; ++i)
  9244. { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
  9245. });
  9246. return markers
  9247. },
  9248. posFromIndex: function(off) {
  9249. var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
  9250. this.iter(function (line) {
  9251. var sz = line.text.length + sepSize;
  9252. if (sz > off) { ch = off; return true }
  9253. off -= sz;
  9254. ++lineNo$$1;
  9255. });
  9256. return clipPos(this, Pos(lineNo$$1, ch))
  9257. },
  9258. indexFromPos: function (coords) {
  9259. coords = clipPos(this, coords);
  9260. var index = coords.ch;
  9261. if (coords.line < this.first || coords.ch < 0) { return 0 }
  9262. var sepSize = this.lineSeparator().length;
  9263. this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
  9264. index += line.text.length + sepSize;
  9265. });
  9266. return index
  9267. },
  9268. copy: function(copyHistory) {
  9269. var doc = new Doc(getLines(this, this.first, this.first + this.size),
  9270. this.modeOption, this.first, this.lineSep, this.direction);
  9271. doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
  9272. doc.sel = this.sel;
  9273. doc.extend = false;
  9274. if (copyHistory) {
  9275. doc.history.undoDepth = this.history.undoDepth;
  9276. doc.setHistory(this.getHistory());
  9277. }
  9278. return doc
  9279. },
  9280. linkedDoc: function(options) {
  9281. if (!options) { options = {}; }
  9282. var from = this.first, to = this.first + this.size;
  9283. if (options.from != null && options.from > from) { from = options.from; }
  9284. if (options.to != null && options.to < to) { to = options.to; }
  9285. var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
  9286. if (options.sharedHist) { copy.history = this.history
  9287. ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
  9288. copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
  9289. copySharedMarkers(copy, findSharedMarkers(this));
  9290. return copy
  9291. },
  9292. unlinkDoc: function(other) {
  9293. var this$1 = this;
  9294. if (other instanceof CodeMirror$1) { other = other.doc; }
  9295. if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
  9296. var link = this$1.linked[i];
  9297. if (link.doc != other) { continue }
  9298. this$1.linked.splice(i, 1);
  9299. other.unlinkDoc(this$1);
  9300. detachSharedMarkers(findSharedMarkers(this$1));
  9301. break
  9302. } }
  9303. // If the histories were shared, split them again
  9304. if (other.history == this.history) {
  9305. var splitIds = [other.id];
  9306. linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
  9307. other.history = new History(null);
  9308. other.history.done = copyHistoryArray(this.history.done, splitIds);
  9309. other.history.undone = copyHistoryArray(this.history.undone, splitIds);
  9310. }
  9311. },
  9312. iterLinkedDocs: function(f) {linkedDocs(this, f);},
  9313. getMode: function() {return this.mode},
  9314. getEditor: function() {return this.cm},
  9315. splitLines: function(str) {
  9316. if (this.lineSep) { return str.split(this.lineSep) }
  9317. return splitLinesAuto(str)
  9318. },
  9319. lineSeparator: function() { return this.lineSep || "\n" },
  9320. setDirection: docMethodOp(function (dir) {
  9321. if (dir != "rtl") { dir = "ltr"; }
  9322. if (dir == this.direction) { return }
  9323. this.direction = dir;
  9324. this.iter(function (line) { return line.order = null; });
  9325. if (this.cm) { directionChanged(this.cm); }
  9326. })
  9327. });
  9328. // Public alias.
  9329. Doc.prototype.eachLine = Doc.prototype.iter;
  9330. // Kludge to work around strange IE behavior where it'll sometimes
  9331. // re-fire a series of drag-related events right after the drop (#1551)
  9332. var lastDrop = 0;
  9333. function onDrop(e) {
  9334. var cm = this;
  9335. clearDragCursor(cm);
  9336. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
  9337. { return }
  9338. e_preventDefault(e);
  9339. if (ie) { lastDrop = +new Date; }
  9340. var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
  9341. if (!pos || cm.isReadOnly()) { return }
  9342. // Might be a file drop, in which case we simply extract the text
  9343. // and insert it.
  9344. if (files && files.length && window.FileReader && window.File) {
  9345. var n = files.length, text = Array(n), read = 0;
  9346. var loadFile = function (file, i) {
  9347. if (cm.options.allowDropFileTypes &&
  9348. indexOf(cm.options.allowDropFileTypes, file.type) == -1)
  9349. { return }
  9350. var reader = new FileReader;
  9351. reader.onload = operation(cm, function () {
  9352. var content = reader.result;
  9353. if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
  9354. text[i] = content;
  9355. if (++read == n) {
  9356. pos = clipPos(cm.doc, pos);
  9357. var change = {from: pos, to: pos,
  9358. text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
  9359. origin: "paste"};
  9360. makeChange(cm.doc, change);
  9361. setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
  9362. }
  9363. });
  9364. reader.readAsText(file);
  9365. };
  9366. for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
  9367. } else { // Normal drop
  9368. // Don't do a replace if the drop happened inside of the selected text.
  9369. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
  9370. cm.state.draggingText(e);
  9371. // Ensure the editor is re-focused
  9372. setTimeout(function () { return cm.display.input.focus(); }, 20);
  9373. return
  9374. }
  9375. try {
  9376. var text$1 = e.dataTransfer.getData("Text");
  9377. if (text$1) {
  9378. var selected;
  9379. if (cm.state.draggingText && !cm.state.draggingText.copy)
  9380. { selected = cm.listSelections(); }
  9381. setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
  9382. if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
  9383. { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
  9384. cm.replaceSelection(text$1, "around", "paste");
  9385. cm.display.input.focus();
  9386. }
  9387. }
  9388. catch(e){}
  9389. }
  9390. }
  9391. function onDragStart(cm, e) {
  9392. if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
  9393. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
  9394. e.dataTransfer.setData("Text", cm.getSelection());
  9395. e.dataTransfer.effectAllowed = "copyMove";
  9396. // Use dummy image instead of default browsers image.
  9397. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
  9398. if (e.dataTransfer.setDragImage && !safari) {
  9399. var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
  9400. img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
  9401. if (presto) {
  9402. img.width = img.height = 1;
  9403. cm.display.wrapper.appendChild(img);
  9404. // Force a relayout, or Opera won't use our image for some obscure reason
  9405. img._top = img.offsetTop;
  9406. }
  9407. e.dataTransfer.setDragImage(img, 0, 0);
  9408. if (presto) { img.parentNode.removeChild(img); }
  9409. }
  9410. }
  9411. function onDragOver(cm, e) {
  9412. var pos = posFromMouse(cm, e);
  9413. if (!pos) { return }
  9414. var frag = document.createDocumentFragment();
  9415. drawSelectionCursor(cm, pos, frag);
  9416. if (!cm.display.dragCursor) {
  9417. cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
  9418. cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
  9419. }
  9420. removeChildrenAndAdd(cm.display.dragCursor, frag);
  9421. }
  9422. function clearDragCursor(cm) {
  9423. if (cm.display.dragCursor) {
  9424. cm.display.lineSpace.removeChild(cm.display.dragCursor);
  9425. cm.display.dragCursor = null;
  9426. }
  9427. }
  9428. // These must be handled carefully, because naively registering a
  9429. // handler for each editor will cause the editors to never be
  9430. // garbage collected.
  9431. function forEachCodeMirror(f) {
  9432. if (!document.body.getElementsByClassName) { return }
  9433. var byClass = document.body.getElementsByClassName("CodeMirror");
  9434. for (var i = 0; i < byClass.length; i++) {
  9435. var cm = byClass[i].CodeMirror;
  9436. if (cm) { f(cm); }
  9437. }
  9438. }
  9439. var globalsRegistered = false;
  9440. function ensureGlobalHandlers() {
  9441. if (globalsRegistered) { return }
  9442. registerGlobalHandlers();
  9443. globalsRegistered = true;
  9444. }
  9445. function registerGlobalHandlers() {
  9446. // When the window resizes, we need to refresh active editors.
  9447. var resizeTimer;
  9448. on(window, "resize", function () {
  9449. if (resizeTimer == null) { resizeTimer = setTimeout(function () {
  9450. resizeTimer = null;
  9451. forEachCodeMirror(onResize);
  9452. }, 100); }
  9453. });
  9454. // When the window loses focus, we want to show the editor as blurred
  9455. on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  9456. }
  9457. // Called when the window resizes
  9458. function onResize(cm) {
  9459. var d = cm.display;
  9460. if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
  9461. { return }
  9462. // Might be a text scaling operation, clear size caches.
  9463. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  9464. d.scrollbarsClipped = false;
  9465. cm.setSize();
  9466. }
  9467. var keyNames = {
  9468. 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
  9469. 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
  9470. 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
  9471. 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
  9472. 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
  9473. 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
  9474. 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
  9475. 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  9476. };
  9477. // Number keys
  9478. for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  9479. // Alphabetic keys
  9480. for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  9481. // Function keys
  9482. for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
  9483. var keyMap = {};
  9484. keyMap.basic = {
  9485. "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
  9486. "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
  9487. "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
  9488. "Tab": "defaultTab", "Shift-Tab": "indentAuto",
  9489. "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
  9490. "Esc": "singleSelection"
  9491. };
  9492. // Note that the save and find-related commands aren't defined by
  9493. // default. User code or addons can define them. Unknown commands
  9494. // are simply ignored.
  9495. keyMap.pcDefault = {
  9496. "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
  9497. "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
  9498. "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
  9499. "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
  9500. "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
  9501. "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
  9502. "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
  9503. fallthrough: "basic"
  9504. };
  9505. // Very basic readline/emacs-style bindings, which are standard on Mac.
  9506. keyMap.emacsy = {
  9507. "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
  9508. "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
  9509. "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
  9510. "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
  9511. "Ctrl-O": "openLine"
  9512. };
  9513. keyMap.macDefault = {
  9514. "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
  9515. "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
  9516. "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
  9517. "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
  9518. "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
  9519. "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
  9520. "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
  9521. fallthrough: ["basic", "emacsy"]
  9522. };
  9523. keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
  9524. // KEYMAP DISPATCH
  9525. function normalizeKeyName(name) {
  9526. var parts = name.split(/-(?!$)/);
  9527. name = parts[parts.length - 1];
  9528. var alt, ctrl, shift, cmd;
  9529. for (var i = 0; i < parts.length - 1; i++) {
  9530. var mod = parts[i];
  9531. if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
  9532. else if (/^a(lt)?$/i.test(mod)) { alt = true; }
  9533. else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
  9534. else if (/^s(hift)?$/i.test(mod)) { shift = true; }
  9535. else { throw new Error("Unrecognized modifier name: " + mod) }
  9536. }
  9537. if (alt) { name = "Alt-" + name; }
  9538. if (ctrl) { name = "Ctrl-" + name; }
  9539. if (cmd) { name = "Cmd-" + name; }
  9540. if (shift) { name = "Shift-" + name; }
  9541. return name
  9542. }
  9543. // This is a kludge to keep keymaps mostly working as raw objects
  9544. // (backwards compatibility) while at the same time support features
  9545. // like normalization and multi-stroke key bindings. It compiles a
  9546. // new normalized keymap, and then updates the old object to reflect
  9547. // this.
  9548. function normalizeKeyMap(keymap) {
  9549. var copy = {};
  9550. for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
  9551. var value = keymap[keyname];
  9552. if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
  9553. if (value == "...") { delete keymap[keyname]; continue }
  9554. var keys = map(keyname.split(" "), normalizeKeyName);
  9555. for (var i = 0; i < keys.length; i++) {
  9556. var val = (void 0), name = (void 0);
  9557. if (i == keys.length - 1) {
  9558. name = keys.join(" ");
  9559. val = value;
  9560. } else {
  9561. name = keys.slice(0, i + 1).join(" ");
  9562. val = "...";
  9563. }
  9564. var prev = copy[name];
  9565. if (!prev) { copy[name] = val; }
  9566. else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
  9567. }
  9568. delete keymap[keyname];
  9569. } }
  9570. for (var prop in copy) { keymap[prop] = copy[prop]; }
  9571. return keymap
  9572. }
  9573. function lookupKey(key, map$$1, handle, context) {
  9574. map$$1 = getKeyMap(map$$1);
  9575. var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
  9576. if (found === false) { return "nothing" }
  9577. if (found === "...") { return "multi" }
  9578. if (found != null && handle(found)) { return "handled" }
  9579. if (map$$1.fallthrough) {
  9580. if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
  9581. { return lookupKey(key, map$$1.fallthrough, handle, context) }
  9582. for (var i = 0; i < map$$1.fallthrough.length; i++) {
  9583. var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
  9584. if (result) { return result }
  9585. }
  9586. }
  9587. }
  9588. // Modifier key presses don't count as 'real' key presses for the
  9589. // purpose of keymap fallthrough.
  9590. function isModifierKey(value) {
  9591. var name = typeof value == "string" ? value : keyNames[value.keyCode];
  9592. return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  9593. }
  9594. // Look up the name of a key as indicated by an event object.
  9595. function keyName(event, noShift) {
  9596. if (presto && event.keyCode == 34 && event["char"]) { return false }
  9597. var base = keyNames[event.keyCode], name = base;
  9598. if (name == null || event.altGraphKey) { return false }
  9599. if (event.altKey && base != "Alt") { name = "Alt-" + name; }
  9600. if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
  9601. if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
  9602. if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
  9603. return name
  9604. }
  9605. function getKeyMap(val) {
  9606. return typeof val == "string" ? keyMap[val] : val
  9607. }
  9608. // Helper for deleting text near the selection(s), used to implement
  9609. // backspace, delete, and similar functionality.
  9610. function deleteNearSelection(cm, compute) {
  9611. var ranges = cm.doc.sel.ranges, kill = [];
  9612. // Build up a set of ranges to kill first, merging overlapping
  9613. // ranges.
  9614. for (var i = 0; i < ranges.length; i++) {
  9615. var toKill = compute(ranges[i]);
  9616. while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
  9617. var replaced = kill.pop();
  9618. if (cmp(replaced.from, toKill.from) < 0) {
  9619. toKill.from = replaced.from;
  9620. break
  9621. }
  9622. }
  9623. kill.push(toKill);
  9624. }
  9625. // Next, remove those actual ranges.
  9626. runInOp(cm, function () {
  9627. for (var i = kill.length - 1; i >= 0; i--)
  9628. { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
  9629. ensureCursorVisible(cm);
  9630. });
  9631. }
  9632. // Commands are parameter-less actions that can be performed on an
  9633. // editor, mostly used for keybindings.
  9634. var commands = {
  9635. selectAll: selectAll,
  9636. singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
  9637. killLine: function (cm) { return deleteNearSelection(cm, function (range) {
  9638. if (range.empty()) {
  9639. var len = getLine(cm.doc, range.head.line).text.length;
  9640. if (range.head.ch == len && range.head.line < cm.lastLine())
  9641. { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
  9642. else
  9643. { return {from: range.head, to: Pos(range.head.line, len)} }
  9644. } else {
  9645. return {from: range.from(), to: range.to()}
  9646. }
  9647. }); },
  9648. deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  9649. from: Pos(range.from().line, 0),
  9650. to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
  9651. }); }); },
  9652. delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  9653. from: Pos(range.from().line, 0), to: range.from()
  9654. }); }); },
  9655. delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
  9656. var top = cm.charCoords(range.head, "div").top + 5;
  9657. var leftPos = cm.coordsChar({left: 0, top: top}, "div");
  9658. return {from: leftPos, to: range.from()}
  9659. }); },
  9660. delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
  9661. var top = cm.charCoords(range.head, "div").top + 5;
  9662. var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
  9663. return {from: range.from(), to: rightPos }
  9664. }); },
  9665. undo: function (cm) { return cm.undo(); },
  9666. redo: function (cm) { return cm.redo(); },
  9667. undoSelection: function (cm) { return cm.undoSelection(); },
  9668. redoSelection: function (cm) { return cm.redoSelection(); },
  9669. goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
  9670. goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
  9671. goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
  9672. {origin: "+move", bias: 1}
  9673. ); },
  9674. goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
  9675. {origin: "+move", bias: 1}
  9676. ); },
  9677. goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
  9678. {origin: "+move", bias: -1}
  9679. ); },
  9680. goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
  9681. var top = cm.charCoords(range.head, "div").top + 5;
  9682. return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
  9683. }, sel_move); },
  9684. goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
  9685. var top = cm.charCoords(range.head, "div").top + 5;
  9686. return cm.coordsChar({left: 0, top: top}, "div")
  9687. }, sel_move); },
  9688. goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
  9689. var top = cm.charCoords(range.head, "div").top + 5;
  9690. var pos = cm.coordsChar({left: 0, top: top}, "div");
  9691. if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
  9692. return pos
  9693. }, sel_move); },
  9694. goLineUp: function (cm) { return cm.moveV(-1, "line"); },
  9695. goLineDown: function (cm) { return cm.moveV(1, "line"); },
  9696. goPageUp: function (cm) { return cm.moveV(-1, "page"); },
  9697. goPageDown: function (cm) { return cm.moveV(1, "page"); },
  9698. goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
  9699. goCharRight: function (cm) { return cm.moveH(1, "char"); },
  9700. goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
  9701. goColumnRight: function (cm) { return cm.moveH(1, "column"); },
  9702. goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
  9703. goGroupRight: function (cm) { return cm.moveH(1, "group"); },
  9704. goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
  9705. goWordRight: function (cm) { return cm.moveH(1, "word"); },
  9706. delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
  9707. delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
  9708. delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
  9709. delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
  9710. delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
  9711. delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
  9712. indentAuto: function (cm) { return cm.indentSelection("smart"); },
  9713. indentMore: function (cm) { return cm.indentSelection("add"); },
  9714. indentLess: function (cm) { return cm.indentSelection("subtract"); },
  9715. insertTab: function (cm) { return cm.replaceSelection("\t"); },
  9716. insertSoftTab: function (cm) {
  9717. var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
  9718. for (var i = 0; i < ranges.length; i++) {
  9719. var pos = ranges[i].from();
  9720. var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
  9721. spaces.push(spaceStr(tabSize - col % tabSize));
  9722. }
  9723. cm.replaceSelections(spaces);
  9724. },
  9725. defaultTab: function (cm) {
  9726. if (cm.somethingSelected()) { cm.indentSelection("add"); }
  9727. else { cm.execCommand("insertTab"); }
  9728. },
  9729. // Swap the two chars left and right of each selection's head.
  9730. // Move cursor behind the two swapped characters afterwards.
  9731. //
  9732. // Doesn't consider line feeds a character.
  9733. // Doesn't scan more than one line above to find a character.
  9734. // Doesn't do anything on an empty line.
  9735. // Doesn't do anything with non-empty selections.
  9736. transposeChars: function (cm) { return runInOp(cm, function () {
  9737. var ranges = cm.listSelections(), newSel = [];
  9738. for (var i = 0; i < ranges.length; i++) {
  9739. if (!ranges[i].empty()) { continue }
  9740. var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
  9741. if (line) {
  9742. if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
  9743. if (cur.ch > 0) {
  9744. cur = new Pos(cur.line, cur.ch + 1);
  9745. cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
  9746. Pos(cur.line, cur.ch - 2), cur, "+transpose");
  9747. } else if (cur.line > cm.doc.first) {
  9748. var prev = getLine(cm.doc, cur.line - 1).text;
  9749. if (prev) {
  9750. cur = new Pos(cur.line, 1);
  9751. cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
  9752. prev.charAt(prev.length - 1),
  9753. Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
  9754. }
  9755. }
  9756. }
  9757. newSel.push(new Range(cur, cur));
  9758. }
  9759. cm.setSelections(newSel);
  9760. }); },
  9761. newlineAndIndent: function (cm) { return runInOp(cm, function () {
  9762. var sels = cm.listSelections();
  9763. for (var i = sels.length - 1; i >= 0; i--)
  9764. { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
  9765. sels = cm.listSelections();
  9766. for (var i$1 = 0; i$1 < sels.length; i$1++)
  9767. { cm.indentLine(sels[i$1].from().line, null, true); }
  9768. ensureCursorVisible(cm);
  9769. }); },
  9770. openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
  9771. toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  9772. };
  9773. function lineStart(cm, lineN) {
  9774. var line = getLine(cm.doc, lineN);
  9775. var visual = visualLine(line);
  9776. if (visual != line) { lineN = lineNo(visual); }
  9777. return endOfLine(true, cm, visual, lineN, 1)
  9778. }
  9779. function lineEnd(cm, lineN) {
  9780. var line = getLine(cm.doc, lineN);
  9781. var visual = visualLineEnd(line);
  9782. if (visual != line) { lineN = lineNo(visual); }
  9783. return endOfLine(true, cm, line, lineN, -1)
  9784. }
  9785. function lineStartSmart(cm, pos) {
  9786. var start = lineStart(cm, pos.line);
  9787. var line = getLine(cm.doc, start.line);
  9788. var order = getOrder(line, cm.doc.direction);
  9789. if (!order || order[0].level == 0) {
  9790. var firstNonWS = Math.max(0, line.text.search(/\S/));
  9791. var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
  9792. return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
  9793. }
  9794. return start
  9795. }
  9796. // Run a handler that was bound to a key.
  9797. function doHandleBinding(cm, bound, dropShift) {
  9798. if (typeof bound == "string") {
  9799. bound = commands[bound];
  9800. if (!bound) { return false }
  9801. }
  9802. // Ensure previous input has been read, so that the handler sees a
  9803. // consistent view of the document
  9804. cm.display.input.ensurePolled();
  9805. var prevShift = cm.display.shift, done = false;
  9806. try {
  9807. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  9808. if (dropShift) { cm.display.shift = false; }
  9809. done = bound(cm) != Pass;
  9810. } finally {
  9811. cm.display.shift = prevShift;
  9812. cm.state.suppressEdits = false;
  9813. }
  9814. return done
  9815. }
  9816. function lookupKeyForEditor(cm, name, handle) {
  9817. for (var i = 0; i < cm.state.keyMaps.length; i++) {
  9818. var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
  9819. if (result) { return result }
  9820. }
  9821. return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
  9822. || lookupKey(name, cm.options.keyMap, handle, cm)
  9823. }
  9824. var stopSeq = new Delayed;
  9825. function dispatchKey(cm, name, e, handle) {
  9826. var seq = cm.state.keySeq;
  9827. if (seq) {
  9828. if (isModifierKey(name)) { return "handled" }
  9829. stopSeq.set(50, function () {
  9830. if (cm.state.keySeq == seq) {
  9831. cm.state.keySeq = null;
  9832. cm.display.input.reset();
  9833. }
  9834. });
  9835. name = seq + " " + name;
  9836. }
  9837. var result = lookupKeyForEditor(cm, name, handle);
  9838. if (result == "multi")
  9839. { cm.state.keySeq = name; }
  9840. if (result == "handled")
  9841. { signalLater(cm, "keyHandled", cm, name, e); }
  9842. if (result == "handled" || result == "multi") {
  9843. e_preventDefault(e);
  9844. restartBlink(cm);
  9845. }
  9846. if (seq && !result && /\'$/.test(name)) {
  9847. e_preventDefault(e);
  9848. return true
  9849. }
  9850. return !!result
  9851. }
  9852. // Handle a key from the keydown event.
  9853. function handleKeyBinding(cm, e) {
  9854. var name = keyName(e, true);
  9855. if (!name) { return false }
  9856. if (e.shiftKey && !cm.state.keySeq) {
  9857. // First try to resolve full name (including 'Shift-'). Failing
  9858. // that, see if there is a cursor-motion command (starting with
  9859. // 'go') bound to the keyname without 'Shift-'.
  9860. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
  9861. || dispatchKey(cm, name, e, function (b) {
  9862. if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
  9863. { return doHandleBinding(cm, b) }
  9864. })
  9865. } else {
  9866. return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
  9867. }
  9868. }
  9869. // Handle a key from the keypress event
  9870. function handleCharBinding(cm, e, ch) {
  9871. return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  9872. }
  9873. var lastStoppedKey = null;
  9874. function onKeyDown(e) {
  9875. var cm = this;
  9876. cm.curOp.focus = activeElt();
  9877. if (signalDOMEvent(cm, e)) { return }
  9878. // IE does strange things with escape.
  9879. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
  9880. var code = e.keyCode;
  9881. cm.display.shift = code == 16 || e.shiftKey;
  9882. var handled = handleKeyBinding(cm, e);
  9883. if (presto) {
  9884. lastStoppedKey = handled ? code : null;
  9885. // Opera has no cut event... we try to at least catch the key combo
  9886. if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
  9887. { cm.replaceSelection("", null, "cut"); }
  9888. }
  9889. // Turn mouse into crosshair when Alt is held on Mac.
  9890. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
  9891. { showCrossHair(cm); }
  9892. }
  9893. function showCrossHair(cm) {
  9894. var lineDiv = cm.display.lineDiv;
  9895. addClass(lineDiv, "CodeMirror-crosshair");
  9896. function up(e) {
  9897. if (e.keyCode == 18 || !e.altKey) {
  9898. rmClass(lineDiv, "CodeMirror-crosshair");
  9899. off(document, "keyup", up);
  9900. off(document, "mouseover", up);
  9901. }
  9902. }
  9903. on(document, "keyup", up);
  9904. on(document, "mouseover", up);
  9905. }
  9906. function onKeyUp(e) {
  9907. if (e.keyCode == 16) { this.doc.sel.shift = false; }
  9908. signalDOMEvent(this, e);
  9909. }
  9910. function onKeyPress(e) {
  9911. var cm = this;
  9912. if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
  9913. var keyCode = e.keyCode, charCode = e.charCode;
  9914. if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
  9915. if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
  9916. var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
  9917. // Some browsers fire keypress events for backspace
  9918. if (ch == "\x08") { return }
  9919. if (handleCharBinding(cm, e, ch)) { return }
  9920. cm.display.input.onKeyPress(e);
  9921. }
  9922. // A mouse down can be a single click, double click, triple click,
  9923. // start of selection drag, start of text drag, new cursor
  9924. // (ctrl-click), rectangle drag (alt-drag), or xwin
  9925. // middle-click-paste. Or it might be a click on something we should
  9926. // not interfere with, such as a scrollbar or widget.
  9927. function onMouseDown(e) {
  9928. var cm = this, display = cm.display;
  9929. if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  9930. display.input.ensurePolled();
  9931. display.shift = e.shiftKey;
  9932. if (eventInWidget(display, e)) {
  9933. if (!webkit) {
  9934. // Briefly turn off draggability, to allow widgets to do
  9935. // normal dragging things.
  9936. display.scroller.draggable = false;
  9937. setTimeout(function () { return display.scroller.draggable = true; }, 100);
  9938. }
  9939. return
  9940. }
  9941. if (clickInGutter(cm, e)) { return }
  9942. var start = posFromMouse(cm, e);
  9943. window.focus();
  9944. switch (e_button(e)) {
  9945. case 1:
  9946. // #3261: make sure, that we're not starting a second selection
  9947. if (cm.state.selectingText)
  9948. { cm.state.selectingText(e); }
  9949. else if (start)
  9950. { leftButtonDown(cm, e, start); }
  9951. else if (e_target(e) == display.scroller)
  9952. { e_preventDefault(e); }
  9953. break
  9954. case 2:
  9955. if (webkit) { cm.state.lastMiddleDown = +new Date; }
  9956. if (start) { extendSelection(cm.doc, start); }
  9957. setTimeout(function () { return display.input.focus(); }, 20);
  9958. e_preventDefault(e);
  9959. break
  9960. case 3:
  9961. if (captureRightClick) { onContextMenu(cm, e); }
  9962. else { delayBlurEvent(cm); }
  9963. break
  9964. }
  9965. }
  9966. var lastClick;
  9967. var lastDoubleClick;
  9968. function leftButtonDown(cm, e, start) {
  9969. if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
  9970. else { cm.curOp.focus = activeElt(); }
  9971. var now = +new Date, type;
  9972. if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
  9973. type = "triple";
  9974. } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
  9975. type = "double";
  9976. lastDoubleClick = {time: now, pos: start};
  9977. } else {
  9978. type = "single";
  9979. lastClick = {time: now, pos: start};
  9980. }
  9981. var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
  9982. if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
  9983. type == "single" && (contained = sel.contains(start)) > -1 &&
  9984. (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
  9985. (cmp(contained.to(), start) > 0 || start.xRel < 0))
  9986. { leftButtonStartDrag(cm, e, start, modifier); }
  9987. else
  9988. { leftButtonSelect(cm, e, start, type, modifier); }
  9989. }
  9990. // Start a text drag. When it ends, see if any dragging actually
  9991. // happen, and treat as a click if it didn't.
  9992. function leftButtonStartDrag(cm, e, start, modifier) {
  9993. var display = cm.display, startTime = +new Date;
  9994. var dragEnd = operation(cm, function (e2) {
  9995. if (webkit) { display.scroller.draggable = false; }
  9996. cm.state.draggingText = false;
  9997. off(document, "mouseup", dragEnd);
  9998. off(display.scroller, "drop", dragEnd);
  9999. if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
  10000. e_preventDefault(e2);
  10001. if (!modifier && +new Date - 200 < startTime)
  10002. { extendSelection(cm.doc, start); }
  10003. // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
  10004. if (webkit || ie && ie_version == 9)
  10005. { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
  10006. else
  10007. { display.input.focus(); }
  10008. }
  10009. });
  10010. // Let the drag handler handle this.
  10011. if (webkit) { display.scroller.draggable = true; }
  10012. cm.state.draggingText = dragEnd;
  10013. dragEnd.copy = mac ? e.altKey : e.ctrlKey;
  10014. // IE's approach to draggable
  10015. if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  10016. on(document, "mouseup", dragEnd);
  10017. on(display.scroller, "drop", dragEnd);
  10018. }
  10019. // Normal selection, as opposed to text dragging.
  10020. function leftButtonSelect(cm, e, start, type, addNew) {
  10021. var display = cm.display, doc = cm.doc;
  10022. e_preventDefault(e);
  10023. var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
  10024. if (addNew && !e.shiftKey) {
  10025. ourIndex = doc.sel.contains(start);
  10026. if (ourIndex > -1)
  10027. { ourRange = ranges[ourIndex]; }
  10028. else
  10029. { ourRange = new Range(start, start); }
  10030. } else {
  10031. ourRange = doc.sel.primary();
  10032. ourIndex = doc.sel.primIndex;
  10033. }
  10034. if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
  10035. type = "rect";
  10036. if (!addNew) { ourRange = new Range(start, start); }
  10037. start = posFromMouse(cm, e, true, true);
  10038. ourIndex = -1;
  10039. } else if (type == "double") {
  10040. var word = cm.findWordAt(start);
  10041. if (cm.display.shift || doc.extend)
  10042. { ourRange = extendRange(doc, ourRange, word.anchor, word.head); }
  10043. else
  10044. { ourRange = word; }
  10045. } else if (type == "triple") {
  10046. var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
  10047. if (cm.display.shift || doc.extend)
  10048. { ourRange = extendRange(doc, ourRange, line.anchor, line.head); }
  10049. else
  10050. { ourRange = line; }
  10051. } else {
  10052. ourRange = extendRange(doc, ourRange, start);
  10053. }
  10054. if (!addNew) {
  10055. ourIndex = 0;
  10056. setSelection(doc, new Selection([ourRange], 0), sel_mouse);
  10057. startSel = doc.sel;
  10058. } else if (ourIndex == -1) {
  10059. ourIndex = ranges.length;
  10060. setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
  10061. {scroll: false, origin: "*mouse"});
  10062. } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
  10063. setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
  10064. {scroll: false, origin: "*mouse"});
  10065. startSel = doc.sel;
  10066. } else {
  10067. replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
  10068. }
  10069. var lastPos = start;
  10070. function extendTo(pos) {
  10071. if (cmp(lastPos, pos) == 0) { return }
  10072. lastPos = pos;
  10073. if (type == "rect") {
  10074. var ranges = [], tabSize = cm.options.tabSize;
  10075. var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
  10076. var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
  10077. var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
  10078. for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
  10079. line <= end; line++) {
  10080. var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
  10081. if (left == right)
  10082. { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
  10083. else if (text.length > leftPos)
  10084. { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
  10085. }
  10086. if (!ranges.length) { ranges.push(new Range(start, start)); }
  10087. setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
  10088. {origin: "*mouse", scroll: false});
  10089. cm.scrollIntoView(pos);
  10090. } else {
  10091. var oldRange = ourRange;
  10092. var anchor = oldRange.anchor, head = pos;
  10093. if (type != "single") {
  10094. var range$$1;
  10095. if (type == "double")
  10096. { range$$1 = cm.findWordAt(pos); }
  10097. else
  10098. { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }
  10099. if (cmp(range$$1.anchor, anchor) > 0) {
  10100. head = range$$1.head;
  10101. anchor = minPos(oldRange.from(), range$$1.anchor);
  10102. } else {
  10103. head = range$$1.anchor;
  10104. anchor = maxPos(oldRange.to(), range$$1.head);
  10105. }
  10106. }
  10107. var ranges$1 = startSel.ranges.slice(0);
  10108. ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);
  10109. setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);
  10110. }
  10111. }
  10112. var editorSize = display.wrapper.getBoundingClientRect();
  10113. // Used to ensure timeout re-tries don't fire when another extend
  10114. // happened in the meantime (clearTimeout isn't reliable -- at
  10115. // least on Chrome, the timeouts still happen even when cleared,
  10116. // if the clear happens after their scheduled firing time).
  10117. var counter = 0;
  10118. function extend(e) {
  10119. var curCount = ++counter;
  10120. var cur = posFromMouse(cm, e, true, type == "rect");
  10121. if (!cur) { return }
  10122. if (cmp(cur, lastPos) != 0) {
  10123. cm.curOp.focus = activeElt();
  10124. extendTo(cur);
  10125. var visible = visibleLines(display, doc);
  10126. if (cur.line >= visible.to || cur.line < visible.from)
  10127. { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
  10128. } else {
  10129. var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
  10130. if (outside) { setTimeout(operation(cm, function () {
  10131. if (counter != curCount) { return }
  10132. display.scroller.scrollTop += outside;
  10133. extend(e);
  10134. }), 50); }
  10135. }
  10136. }
  10137. function done(e) {
  10138. cm.state.selectingText = false;
  10139. counter = Infinity;
  10140. e_preventDefault(e);
  10141. display.input.focus();
  10142. off(document, "mousemove", move);
  10143. off(document, "mouseup", up);
  10144. doc.history.lastSelOrigin = null;
  10145. }
  10146. var move = operation(cm, function (e) {
  10147. if (!e_button(e)) { done(e); }
  10148. else { extend(e); }
  10149. });
  10150. var up = operation(cm, done);
  10151. cm.state.selectingText = up;
  10152. on(document, "mousemove", move);
  10153. on(document, "mouseup", up);
  10154. }
  10155. // Determines whether an event happened in the gutter, and fires the
  10156. // handlers for the corresponding event.
  10157. function gutterEvent(cm, e, type, prevent) {
  10158. var mX, mY;
  10159. try { mX = e.clientX; mY = e.clientY; }
  10160. catch(e) { return false }
  10161. if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  10162. if (prevent) { e_preventDefault(e); }
  10163. var display = cm.display;
  10164. var lineBox = display.lineDiv.getBoundingClientRect();
  10165. if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
  10166. mY -= lineBox.top - display.viewOffset;
  10167. for (var i = 0; i < cm.options.gutters.length; ++i) {
  10168. var g = display.gutters.childNodes[i];
  10169. if (g && g.getBoundingClientRect().right >= mX) {
  10170. var line = lineAtHeight(cm.doc, mY);
  10171. var gutter = cm.options.gutters[i];
  10172. signal(cm, type, cm, line, gutter, e);
  10173. return e_defaultPrevented(e)
  10174. }
  10175. }
  10176. }
  10177. function clickInGutter(cm, e) {
  10178. return gutterEvent(cm, e, "gutterClick", true)
  10179. }
  10180. // CONTEXT MENU HANDLING
  10181. // To make the context menu work, we need to briefly unhide the
  10182. // textarea (making it as unobtrusive as possible) to let the
  10183. // right-click take effect on it.
  10184. function onContextMenu(cm, e) {
  10185. if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
  10186. if (signalDOMEvent(cm, e, "contextmenu")) { return }
  10187. cm.display.input.onContextMenu(e);
  10188. }
  10189. function contextMenuInGutter(cm, e) {
  10190. if (!hasHandler(cm, "gutterContextMenu")) { return false }
  10191. return gutterEvent(cm, e, "gutterContextMenu", false)
  10192. }
  10193. function themeChanged(cm) {
  10194. cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  10195. cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  10196. clearCaches(cm);
  10197. }
  10198. var Init = {toString: function(){return "CodeMirror.Init"}};
  10199. var defaults = {};
  10200. var optionHandlers = {};
  10201. function defineOptions(CodeMirror) {
  10202. var optionHandlers = CodeMirror.optionHandlers;
  10203. function option(name, deflt, handle, notOnInit) {
  10204. CodeMirror.defaults[name] = deflt;
  10205. if (handle) { optionHandlers[name] =
  10206. notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
  10207. }
  10208. CodeMirror.defineOption = option;
  10209. // Passed to option handlers when there is no old value.
  10210. CodeMirror.Init = Init;
  10211. // These two are, on init, called from the constructor because they
  10212. // have to be initialized before the editor can start at all.
  10213. option("value", "", function (cm, val) { return cm.setValue(val); }, true);
  10214. option("mode", null, function (cm, val) {
  10215. cm.doc.modeOption = val;
  10216. loadMode(cm);
  10217. }, true);
  10218. option("indentUnit", 2, loadMode, true);
  10219. option("indentWithTabs", false);
  10220. option("smartIndent", true);
  10221. option("tabSize", 4, function (cm) {
  10222. resetModeState(cm);
  10223. clearCaches(cm);
  10224. regChange(cm);
  10225. }, true);
  10226. option("lineSeparator", null, function (cm, val) {
  10227. cm.doc.lineSep = val;
  10228. if (!val) { return }
  10229. var newBreaks = [], lineNo = cm.doc.first;
  10230. cm.doc.iter(function (line) {
  10231. for (var pos = 0;;) {
  10232. var found = line.text.indexOf(val, pos);
  10233. if (found == -1) { break }
  10234. pos = found + val.length;
  10235. newBreaks.push(Pos(lineNo, found));
  10236. }
  10237. lineNo++;
  10238. });
  10239. for (var i = newBreaks.length - 1; i >= 0; i--)
  10240. { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
  10241. });
  10242. option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
  10243. cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
  10244. if (old != Init) { cm.refresh(); }
  10245. });
  10246. option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
  10247. option("electricChars", true);
  10248. option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
  10249. throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
  10250. }, true);
  10251. option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
  10252. option("rtlMoveVisually", !windows);
  10253. option("wholeLineUpdateBefore", true);
  10254. option("theme", "default", function (cm) {
  10255. themeChanged(cm);
  10256. guttersChanged(cm);
  10257. }, true);
  10258. option("keyMap", "default", function (cm, val, old) {
  10259. var next = getKeyMap(val);
  10260. var prev = old != Init && getKeyMap(old);
  10261. if (prev && prev.detach) { prev.detach(cm, next); }
  10262. if (next.attach) { next.attach(cm, prev || null); }
  10263. });
  10264. option("extraKeys", null);
  10265. option("lineWrapping", false, wrappingChanged, true);
  10266. option("gutters", [], function (cm) {
  10267. setGuttersForLineNumbers(cm.options);
  10268. guttersChanged(cm);
  10269. }, true);
  10270. option("fixedGutter", true, function (cm, val) {
  10271. cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
  10272. cm.refresh();
  10273. }, true);
  10274. option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
  10275. option("scrollbarStyle", "native", function (cm) {
  10276. initScrollbars(cm);
  10277. updateScrollbars(cm);
  10278. cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
  10279. cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
  10280. }, true);
  10281. option("lineNumbers", false, function (cm) {
  10282. setGuttersForLineNumbers(cm.options);
  10283. guttersChanged(cm);
  10284. }, true);
  10285. option("firstLineNumber", 1, guttersChanged, true);
  10286. option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
  10287. option("showCursorWhenSelecting", false, updateSelection, true);
  10288. option("resetSelectionOnContextMenu", true);
  10289. option("lineWiseCopyCut", true);
  10290. option("readOnly", false, function (cm, val) {
  10291. if (val == "nocursor") {
  10292. onBlur(cm);
  10293. cm.display.input.blur();
  10294. cm.display.disabled = true;
  10295. } else {
  10296. cm.display.disabled = false;
  10297. }
  10298. cm.display.input.readOnlyChanged(val);
  10299. });
  10300. option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
  10301. option("dragDrop", true, dragDropChanged);
  10302. option("allowDropFileTypes", null);
  10303. option("cursorBlinkRate", 530);
  10304. option("cursorScrollMargin", 0);
  10305. option("cursorHeight", 1, updateSelection, true);
  10306. option("singleCursorHeightPerLine", true, updateSelection, true);
  10307. option("workTime", 100);
  10308. option("workDelay", 100);
  10309. option("flattenSpans", true, resetModeState, true);
  10310. option("addModeClass", false, resetModeState, true);
  10311. option("pollInterval", 100);
  10312. option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
  10313. option("historyEventDelay", 1250);
  10314. option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
  10315. option("maxHighlightLength", 10000, resetModeState, true);
  10316. option("moveInputWithCursor", true, function (cm, val) {
  10317. if (!val) { cm.display.input.resetPosition(); }
  10318. });
  10319. option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
  10320. option("autofocus", null);
  10321. option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
  10322. }
  10323. function guttersChanged(cm) {
  10324. updateGutters(cm);
  10325. regChange(cm);
  10326. alignHorizontally(cm);
  10327. }
  10328. function dragDropChanged(cm, value, old) {
  10329. var wasOn = old && old != Init;
  10330. if (!value != !wasOn) {
  10331. var funcs = cm.display.dragFunctions;
  10332. var toggle = value ? on : off;
  10333. toggle(cm.display.scroller, "dragstart", funcs.start);
  10334. toggle(cm.display.scroller, "dragenter", funcs.enter);
  10335. toggle(cm.display.scroller, "dragover", funcs.over);
  10336. toggle(cm.display.scroller, "dragleave", funcs.leave);
  10337. toggle(cm.display.scroller, "drop", funcs.drop);
  10338. }
  10339. }
  10340. function wrappingChanged(cm) {
  10341. if (cm.options.lineWrapping) {
  10342. addClass(cm.display.wrapper, "CodeMirror-wrap");
  10343. cm.display.sizer.style.minWidth = "";
  10344. cm.display.sizerWidth = null;
  10345. } else {
  10346. rmClass(cm.display.wrapper, "CodeMirror-wrap");
  10347. findMaxLine(cm);
  10348. }
  10349. estimateLineHeights(cm);
  10350. regChange(cm);
  10351. clearCaches(cm);
  10352. setTimeout(function () { return updateScrollbars(cm); }, 100);
  10353. }
  10354. // A CodeMirror instance represents an editor. This is the object
  10355. // that user code is usually dealing with.
  10356. function CodeMirror$1(place, options) {
  10357. var this$1 = this;
  10358. if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
  10359. this.options = options = options ? copyObj(options) : {};
  10360. // Determine effective options based on given values and defaults.
  10361. copyObj(defaults, options, false);
  10362. setGuttersForLineNumbers(options);
  10363. var doc = options.value;
  10364. if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
  10365. this.doc = doc;
  10366. var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
  10367. var display = this.display = new Display(place, doc, input);
  10368. display.wrapper.CodeMirror = this;
  10369. updateGutters(this);
  10370. themeChanged(this);
  10371. if (options.lineWrapping)
  10372. { this.display.wrapper.className += " CodeMirror-wrap"; }
  10373. initScrollbars(this);
  10374. this.state = {
  10375. keyMaps: [], // stores maps added by addKeyMap
  10376. overlays: [], // highlighting overlays, as added by addOverlay
  10377. modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
  10378. overwrite: false,
  10379. delayingBlurEvent: false,
  10380. focused: false,
  10381. suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
  10382. pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
  10383. selectingText: false,
  10384. draggingText: false,
  10385. highlight: new Delayed(), // stores highlight worker timeout
  10386. keySeq: null, // Unfinished key sequence
  10387. specialChars: null
  10388. };
  10389. if (options.autofocus && !mobile) { display.input.focus(); }
  10390. // Override magic textarea content restore that IE sometimes does
  10391. // on our hidden textarea on reload
  10392. if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
  10393. registerEventHandlers(this);
  10394. ensureGlobalHandlers();
  10395. startOperation(this);
  10396. this.curOp.forceUpdate = true;
  10397. attachDoc(this, doc);
  10398. if ((options.autofocus && !mobile) || this.hasFocus())
  10399. { setTimeout(bind(onFocus, this), 20); }
  10400. else
  10401. { onBlur(this); }
  10402. for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
  10403. { optionHandlers[opt](this$1, options[opt], Init); } }
  10404. maybeUpdateLineNumberWidth(this);
  10405. if (options.finishInit) { options.finishInit(this); }
  10406. for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
  10407. endOperation(this);
  10408. // Suppress optimizelegibility in Webkit, since it breaks text
  10409. // measuring on line wrapping boundaries.
  10410. if (webkit && options.lineWrapping &&
  10411. getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
  10412. { display.lineDiv.style.textRendering = "auto"; }
  10413. }
  10414. // The default configuration options.
  10415. CodeMirror$1.defaults = defaults;
  10416. // Functions to run when options are changed.
  10417. CodeMirror$1.optionHandlers = optionHandlers;
  10418. // Attach the necessary event handlers when initializing the editor
  10419. function registerEventHandlers(cm) {
  10420. var d = cm.display;
  10421. on(d.scroller, "mousedown", operation(cm, onMouseDown));
  10422. // Older IE's will not fire a second mousedown for a double click
  10423. if (ie && ie_version < 11)
  10424. { on(d.scroller, "dblclick", operation(cm, function (e) {
  10425. if (signalDOMEvent(cm, e)) { return }
  10426. var pos = posFromMouse(cm, e);
  10427. if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
  10428. e_preventDefault(e);
  10429. var word = cm.findWordAt(pos);
  10430. extendSelection(cm.doc, word.anchor, word.head);
  10431. })); }
  10432. else
  10433. { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
  10434. // Some browsers fire contextmenu *after* opening the menu, at
  10435. // which point we can't mess with it anymore. Context menu is
  10436. // handled in onMouseDown for these browsers.
  10437. if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); }
  10438. // Used to suppress mouse event handling when a touch happens
  10439. var touchFinished, prevTouch = {end: 0};
  10440. function finishTouch() {
  10441. if (d.activeTouch) {
  10442. touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
  10443. prevTouch = d.activeTouch;
  10444. prevTouch.end = +new Date;
  10445. }
  10446. }
  10447. function isMouseLikeTouchEvent(e) {
  10448. if (e.touches.length != 1) { return false }
  10449. var touch = e.touches[0];
  10450. return touch.radiusX <= 1 && touch.radiusY <= 1
  10451. }
  10452. function farAway(touch, other) {
  10453. if (other.left == null) { return true }
  10454. var dx = other.left - touch.left, dy = other.top - touch.top;
  10455. return dx * dx + dy * dy > 20 * 20
  10456. }
  10457. on(d.scroller, "touchstart", function (e) {
  10458. if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
  10459. d.input.ensurePolled();
  10460. clearTimeout(touchFinished);
  10461. var now = +new Date;
  10462. d.activeTouch = {start: now, moved: false,
  10463. prev: now - prevTouch.end <= 300 ? prevTouch : null};
  10464. if (e.touches.length == 1) {
  10465. d.activeTouch.left = e.touches[0].pageX;
  10466. d.activeTouch.top = e.touches[0].pageY;
  10467. }
  10468. }
  10469. });
  10470. on(d.scroller, "touchmove", function () {
  10471. if (d.activeTouch) { d.activeTouch.moved = true; }
  10472. });
  10473. on(d.scroller, "touchend", function (e) {
  10474. var touch = d.activeTouch;
  10475. if (touch && !eventInWidget(d, e) && touch.left != null &&
  10476. !touch.moved && new Date - touch.start < 300) {
  10477. var pos = cm.coordsChar(d.activeTouch, "page"), range;
  10478. if (!touch.prev || farAway(touch, touch.prev)) // Single tap
  10479. { range = new Range(pos, pos); }
  10480. else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
  10481. { range = cm.findWordAt(pos); }
  10482. else // Triple tap
  10483. { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
  10484. cm.setSelection(range.anchor, range.head);
  10485. cm.focus();
  10486. e_preventDefault(e);
  10487. }
  10488. finishTouch();
  10489. });
  10490. on(d.scroller, "touchcancel", finishTouch);
  10491. // Sync scrolling between fake scrollbars and real scrollable
  10492. // area, ensure viewport is updated when scrolling.
  10493. on(d.scroller, "scroll", function () {
  10494. if (d.scroller.clientHeight) {
  10495. setScrollTop(cm, d.scroller.scrollTop);
  10496. setScrollLeft(cm, d.scroller.scrollLeft, true);
  10497. signal(cm, "scroll", cm);
  10498. }
  10499. });
  10500. // Listen to wheel events in order to try and update the viewport on time.
  10501. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
  10502. on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
  10503. // Prevent wrapper from ever scrolling
  10504. on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
  10505. d.dragFunctions = {
  10506. enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
  10507. over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
  10508. start: function (e) { return onDragStart(cm, e); },
  10509. drop: operation(cm, onDrop),
  10510. leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
  10511. };
  10512. var inp = d.input.getField();
  10513. on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
  10514. on(inp, "keydown", operation(cm, onKeyDown));
  10515. on(inp, "keypress", operation(cm, onKeyPress));
  10516. on(inp, "focus", function (e) { return onFocus(cm, e); });
  10517. on(inp, "blur", function (e) { return onBlur(cm, e); });
  10518. }
  10519. var initHooks = [];
  10520. CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
  10521. // Indent the given line. The how parameter can be "smart",
  10522. // "add"/null, "subtract", or "prev". When aggressive is false
  10523. // (typically set to true for forced single-line indents), empty
  10524. // lines are not indented, and places where the mode returns Pass
  10525. // are left alone.
  10526. function indentLine(cm, n, how, aggressive) {
  10527. var doc = cm.doc, state;
  10528. if (how == null) { how = "add"; }
  10529. if (how == "smart") {
  10530. // Fall back to "prev" when the mode doesn't have an indentation
  10531. // method.
  10532. if (!doc.mode.indent) { how = "prev"; }
  10533. else { state = getStateBefore(cm, n); }
  10534. }
  10535. var tabSize = cm.options.tabSize;
  10536. var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
  10537. if (line.stateAfter) { line.stateAfter = null; }
  10538. var curSpaceString = line.text.match(/^\s*/)[0], indentation;
  10539. if (!aggressive && !/\S/.test(line.text)) {
  10540. indentation = 0;
  10541. how = "not";
  10542. } else if (how == "smart") {
  10543. indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
  10544. if (indentation == Pass || indentation > 150) {
  10545. if (!aggressive) { return }
  10546. how = "prev";
  10547. }
  10548. }
  10549. if (how == "prev") {
  10550. if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
  10551. else { indentation = 0; }
  10552. } else if (how == "add") {
  10553. indentation = curSpace + cm.options.indentUnit;
  10554. } else if (how == "subtract") {
  10555. indentation = curSpace - cm.options.indentUnit;
  10556. } else if (typeof how == "number") {
  10557. indentation = curSpace + how;
  10558. }
  10559. indentation = Math.max(0, indentation);
  10560. var indentString = "", pos = 0;
  10561. if (cm.options.indentWithTabs)
  10562. { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
  10563. if (pos < indentation) { indentString += spaceStr(indentation - pos); }
  10564. if (indentString != curSpaceString) {
  10565. replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
  10566. line.stateAfter = null;
  10567. return true
  10568. } else {
  10569. // Ensure that, if the cursor was in the whitespace at the start
  10570. // of the line, it is moved to the end of that space.
  10571. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
  10572. var range = doc.sel.ranges[i$1];
  10573. if (range.head.line == n && range.head.ch < curSpaceString.length) {
  10574. var pos$1 = Pos(n, curSpaceString.length);
  10575. replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
  10576. break
  10577. }
  10578. }
  10579. }
  10580. }
  10581. // This will be set to a {lineWise: bool, text: [string]} object, so
  10582. // that, when pasting, we know what kind of selections the copied
  10583. // text was made out of.
  10584. var lastCopied = null;
  10585. function setLastCopied(newLastCopied) {
  10586. lastCopied = newLastCopied;
  10587. }
  10588. function applyTextInput(cm, inserted, deleted, sel, origin) {
  10589. var doc = cm.doc;
  10590. cm.display.shift = false;
  10591. if (!sel) { sel = doc.sel; }
  10592. var paste = cm.state.pasteIncoming || origin == "paste";
  10593. var textLines = splitLinesAuto(inserted), multiPaste = null;
  10594. // When pasing N lines into N selections, insert one line per selection
  10595. if (paste && sel.ranges.length > 1) {
  10596. if (lastCopied && lastCopied.text.join("\n") == inserted) {
  10597. if (sel.ranges.length % lastCopied.text.length == 0) {
  10598. multiPaste = [];
  10599. for (var i = 0; i < lastCopied.text.length; i++)
  10600. { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
  10601. }
  10602. } else if (textLines.length == sel.ranges.length) {
  10603. multiPaste = map(textLines, function (l) { return [l]; });
  10604. }
  10605. }
  10606. var updateInput;
  10607. // Normal behavior is to insert the new text into every selection
  10608. for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
  10609. var range$$1 = sel.ranges[i$1];
  10610. var from = range$$1.from(), to = range$$1.to();
  10611. if (range$$1.empty()) {
  10612. if (deleted && deleted > 0) // Handle deletion
  10613. { from = Pos(from.line, from.ch - deleted); }
  10614. else if (cm.state.overwrite && !paste) // Handle overwrite
  10615. { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
  10616. else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
  10617. { from = to = Pos(from.line, 0); }
  10618. }
  10619. updateInput = cm.curOp.updateInput;
  10620. var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
  10621. origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
  10622. makeChange(cm.doc, changeEvent);
  10623. signalLater(cm, "inputRead", cm, changeEvent);
  10624. }
  10625. if (inserted && !paste)
  10626. { triggerElectric(cm, inserted); }
  10627. ensureCursorVisible(cm);
  10628. cm.curOp.updateInput = updateInput;
  10629. cm.curOp.typing = true;
  10630. cm.state.pasteIncoming = cm.state.cutIncoming = false;
  10631. }
  10632. function handlePaste(e, cm) {
  10633. var pasted = e.clipboardData && e.clipboardData.getData("Text");
  10634. if (pasted) {
  10635. e.preventDefault();
  10636. if (!cm.isReadOnly() && !cm.options.disableInput)
  10637. { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
  10638. return true
  10639. }
  10640. }
  10641. function triggerElectric(cm, inserted) {
  10642. // When an 'electric' character is inserted, immediately trigger a reindent
  10643. if (!cm.options.electricChars || !cm.options.smartIndent) { return }
  10644. var sel = cm.doc.sel;
  10645. for (var i = sel.ranges.length - 1; i >= 0; i--) {
  10646. var range$$1 = sel.ranges[i];
  10647. if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
  10648. var mode = cm.getModeAt(range$$1.head);
  10649. var indented = false;
  10650. if (mode.electricChars) {
  10651. for (var j = 0; j < mode.electricChars.length; j++)
  10652. { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
  10653. indented = indentLine(cm, range$$1.head.line, "smart");
  10654. break
  10655. } }
  10656. } else if (mode.electricInput) {
  10657. if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
  10658. { indented = indentLine(cm, range$$1.head.line, "smart"); }
  10659. }
  10660. if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
  10661. }
  10662. }
  10663. function copyableRanges(cm) {
  10664. var text = [], ranges = [];
  10665. for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
  10666. var line = cm.doc.sel.ranges[i].head.line;
  10667. var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
  10668. ranges.push(lineRange);
  10669. text.push(cm.getRange(lineRange.anchor, lineRange.head));
  10670. }
  10671. return {text: text, ranges: ranges}
  10672. }
  10673. function disableBrowserMagic(field, spellcheck) {
  10674. field.setAttribute("autocorrect", "off");
  10675. field.setAttribute("autocapitalize", "off");
  10676. field.setAttribute("spellcheck", !!spellcheck);
  10677. }
  10678. function hiddenTextarea() {
  10679. var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
  10680. var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
  10681. // The textarea is kept positioned near the cursor to prevent the
  10682. // fact that it'll be scrolled into view on input from scrolling
  10683. // our fake cursor out of view. On webkit, when wrap=off, paste is
  10684. // very slow. So make the area wide instead.
  10685. if (webkit) { te.style.width = "1000px"; }
  10686. else { te.setAttribute("wrap", "off"); }
  10687. // If border: 0; -- iOS fails to open keyboard (issue #1287)
  10688. if (ios) { te.style.border = "1px solid black"; }
  10689. disableBrowserMagic(te);
  10690. return div
  10691. }
  10692. // The publicly visible API. Note that methodOp(f) means
  10693. // 'wrap f in an operation, performed on its `this` parameter'.
  10694. // This is not the complete set of editor methods. Most of the
  10695. // methods defined on the Doc type are also injected into
  10696. // CodeMirror.prototype, for backwards compatibility and
  10697. // convenience.
  10698. var addEditorMethods = function(CodeMirror) {
  10699. var optionHandlers = CodeMirror.optionHandlers;
  10700. var helpers = CodeMirror.helpers = {};
  10701. CodeMirror.prototype = {
  10702. constructor: CodeMirror,
  10703. focus: function(){window.focus(); this.display.input.focus();},
  10704. setOption: function(option, value) {
  10705. var options = this.options, old = options[option];
  10706. if (options[option] == value && option != "mode") { return }
  10707. options[option] = value;
  10708. if (optionHandlers.hasOwnProperty(option))
  10709. { operation(this, optionHandlers[option])(this, value, old); }
  10710. signal(this, "optionChange", this, option);
  10711. },
  10712. getOption: function(option) {return this.options[option]},
  10713. getDoc: function() {return this.doc},
  10714. addKeyMap: function(map$$1, bottom) {
  10715. this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
  10716. },
  10717. removeKeyMap: function(map$$1) {
  10718. var maps = this.state.keyMaps;
  10719. for (var i = 0; i < maps.length; ++i)
  10720. { if (maps[i] == map$$1 || maps[i].name == map$$1) {
  10721. maps.splice(i, 1);
  10722. return true
  10723. } }
  10724. },
  10725. addOverlay: methodOp(function(spec, options) {
  10726. var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
  10727. if (mode.startState) { throw new Error("Overlays may not be stateful.") }
  10728. insertSorted(this.state.overlays,
  10729. {mode: mode, modeSpec: spec, opaque: options && options.opaque,
  10730. priority: (options && options.priority) || 0},
  10731. function (overlay) { return overlay.priority; });
  10732. this.state.modeGen++;
  10733. regChange(this);
  10734. }),
  10735. removeOverlay: methodOp(function(spec) {
  10736. var this$1 = this;
  10737. var overlays = this.state.overlays;
  10738. for (var i = 0; i < overlays.length; ++i) {
  10739. var cur = overlays[i].modeSpec;
  10740. if (cur == spec || typeof spec == "string" && cur.name == spec) {
  10741. overlays.splice(i, 1);
  10742. this$1.state.modeGen++;
  10743. regChange(this$1);
  10744. return
  10745. }
  10746. }
  10747. }),
  10748. indentLine: methodOp(function(n, dir, aggressive) {
  10749. if (typeof dir != "string" && typeof dir != "number") {
  10750. if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
  10751. else { dir = dir ? "add" : "subtract"; }
  10752. }
  10753. if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
  10754. }),
  10755. indentSelection: methodOp(function(how) {
  10756. var this$1 = this;
  10757. var ranges = this.doc.sel.ranges, end = -1;
  10758. for (var i = 0; i < ranges.length; i++) {
  10759. var range$$1 = ranges[i];
  10760. if (!range$$1.empty()) {
  10761. var from = range$$1.from(), to = range$$1.to();
  10762. var start = Math.max(end, from.line);
  10763. end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
  10764. for (var j = start; j < end; ++j)
  10765. { indentLine(this$1, j, how); }
  10766. var newRanges = this$1.doc.sel.ranges;
  10767. if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
  10768. { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
  10769. } else if (range$$1.head.line > end) {
  10770. indentLine(this$1, range$$1.head.line, how, true);
  10771. end = range$$1.head.line;
  10772. if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
  10773. }
  10774. }
  10775. }),
  10776. // Fetch the parser token for a given character. Useful for hacks
  10777. // that want to inspect the mode state (say, for completion).
  10778. getTokenAt: function(pos, precise) {
  10779. return takeToken(this, pos, precise)
  10780. },
  10781. getLineTokens: function(line, precise) {
  10782. return takeToken(this, Pos(line), precise, true)
  10783. },
  10784. getTokenTypeAt: function(pos) {
  10785. pos = clipPos(this.doc, pos);
  10786. var styles = getLineStyles(this, getLine(this.doc, pos.line));
  10787. var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
  10788. var type;
  10789. if (ch == 0) { type = styles[2]; }
  10790. else { for (;;) {
  10791. var mid = (before + after) >> 1;
  10792. if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
  10793. else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
  10794. else { type = styles[mid * 2 + 2]; break }
  10795. } }
  10796. var cut = type ? type.indexOf("overlay ") : -1;
  10797. return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
  10798. },
  10799. getModeAt: function(pos) {
  10800. var mode = this.doc.mode;
  10801. if (!mode.innerMode) { return mode }
  10802. return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
  10803. },
  10804. getHelper: function(pos, type) {
  10805. return this.getHelpers(pos, type)[0]
  10806. },
  10807. getHelpers: function(pos, type) {
  10808. var this$1 = this;
  10809. var found = [];
  10810. if (!helpers.hasOwnProperty(type)) { return found }
  10811. var help = helpers[type], mode = this.getModeAt(pos);
  10812. if (typeof mode[type] == "string") {
  10813. if (help[mode[type]]) { found.push(help[mode[type]]); }
  10814. } else if (mode[type]) {
  10815. for (var i = 0; i < mode[type].length; i++) {
  10816. var val = help[mode[type][i]];
  10817. if (val) { found.push(val); }
  10818. }
  10819. } else if (mode.helperType && help[mode.helperType]) {
  10820. found.push(help[mode.helperType]);
  10821. } else if (help[mode.name]) {
  10822. found.push(help[mode.name]);
  10823. }
  10824. for (var i$1 = 0; i$1 < help._global.length; i$1++) {
  10825. var cur = help._global[i$1];
  10826. if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
  10827. { found.push(cur.val); }
  10828. }
  10829. return found
  10830. },
  10831. getStateAfter: function(line, precise) {
  10832. var doc = this.doc;
  10833. line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
  10834. return getStateBefore(this, line + 1, precise)
  10835. },
  10836. cursorCoords: function(start, mode) {
  10837. var pos, range$$1 = this.doc.sel.primary();
  10838. if (start == null) { pos = range$$1.head; }
  10839. else if (typeof start == "object") { pos = clipPos(this.doc, start); }
  10840. else { pos = start ? range$$1.from() : range$$1.to(); }
  10841. return cursorCoords(this, pos, mode || "page")
  10842. },
  10843. charCoords: function(pos, mode) {
  10844. return charCoords(this, clipPos(this.doc, pos), mode || "page")
  10845. },
  10846. coordsChar: function(coords, mode) {
  10847. coords = fromCoordSystem(this, coords, mode || "page");
  10848. return coordsChar(this, coords.left, coords.top)
  10849. },
  10850. lineAtHeight: function(height, mode) {
  10851. height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
  10852. return lineAtHeight(this.doc, height + this.display.viewOffset)
  10853. },
  10854. heightAtLine: function(line, mode, includeWidgets) {
  10855. var end = false, lineObj;
  10856. if (typeof line == "number") {
  10857. var last = this.doc.first + this.doc.size - 1;
  10858. if (line < this.doc.first) { line = this.doc.first; }
  10859. else if (line > last) { line = last; end = true; }
  10860. lineObj = getLine(this.doc, line);
  10861. } else {
  10862. lineObj = line;
  10863. }
  10864. return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
  10865. (end ? this.doc.height - heightAtLine(lineObj) : 0)
  10866. },
  10867. defaultTextHeight: function() { return textHeight(this.display) },
  10868. defaultCharWidth: function() { return charWidth(this.display) },
  10869. getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
  10870. addWidget: function(pos, node, scroll, vert, horiz) {
  10871. var display = this.display;
  10872. pos = cursorCoords(this, clipPos(this.doc, pos));
  10873. var top = pos.bottom, left = pos.left;
  10874. node.style.position = "absolute";
  10875. node.setAttribute("cm-ignore-events", "true");
  10876. this.display.input.setUneditable(node);
  10877. display.sizer.appendChild(node);
  10878. if (vert == "over") {
  10879. top = pos.top;
  10880. } else if (vert == "above" || vert == "near") {
  10881. var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
  10882. hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
  10883. // Default to positioning above (if specified and possible); otherwise default to positioning below
  10884. if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
  10885. { top = pos.top - node.offsetHeight; }
  10886. else if (pos.bottom + node.offsetHeight <= vspace)
  10887. { top = pos.bottom; }
  10888. if (left + node.offsetWidth > hspace)
  10889. { left = hspace - node.offsetWidth; }
  10890. }
  10891. node.style.top = top + "px";
  10892. node.style.left = node.style.right = "";
  10893. if (horiz == "right") {
  10894. left = display.sizer.clientWidth - node.offsetWidth;
  10895. node.style.right = "0px";
  10896. } else {
  10897. if (horiz == "left") { left = 0; }
  10898. else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
  10899. node.style.left = left + "px";
  10900. }
  10901. if (scroll)
  10902. { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
  10903. },
  10904. triggerOnKeyDown: methodOp(onKeyDown),
  10905. triggerOnKeyPress: methodOp(onKeyPress),
  10906. triggerOnKeyUp: onKeyUp,
  10907. execCommand: function(cmd) {
  10908. if (commands.hasOwnProperty(cmd))
  10909. { return commands[cmd].call(null, this) }
  10910. },
  10911. triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
  10912. findPosH: function(from, amount, unit, visually) {
  10913. var this$1 = this;
  10914. var dir = 1;
  10915. if (amount < 0) { dir = -1; amount = -amount; }
  10916. var cur = clipPos(this.doc, from);
  10917. for (var i = 0; i < amount; ++i) {
  10918. cur = findPosH(this$1.doc, cur, dir, unit, visually);
  10919. if (cur.hitSide) { break }
  10920. }
  10921. return cur
  10922. },
  10923. moveH: methodOp(function(dir, unit) {
  10924. var this$1 = this;
  10925. this.extendSelectionsBy(function (range$$1) {
  10926. if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
  10927. { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
  10928. else
  10929. { return dir < 0 ? range$$1.from() : range$$1.to() }
  10930. }, sel_move);
  10931. }),
  10932. deleteH: methodOp(function(dir, unit) {
  10933. var sel = this.doc.sel, doc = this.doc;
  10934. if (sel.somethingSelected())
  10935. { doc.replaceSelection("", null, "+delete"); }
  10936. else
  10937. { deleteNearSelection(this, function (range$$1) {
  10938. var other = findPosH(doc, range$$1.head, dir, unit, false);
  10939. return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
  10940. }); }
  10941. }),
  10942. findPosV: function(from, amount, unit, goalColumn) {
  10943. var this$1 = this;
  10944. var dir = 1, x = goalColumn;
  10945. if (amount < 0) { dir = -1; amount = -amount; }
  10946. var cur = clipPos(this.doc, from);
  10947. for (var i = 0; i < amount; ++i) {
  10948. var coords = cursorCoords(this$1, cur, "div");
  10949. if (x == null) { x = coords.left; }
  10950. else { coords.left = x; }
  10951. cur = findPosV(this$1, coords, dir, unit);
  10952. if (cur.hitSide) { break }
  10953. }
  10954. return cur
  10955. },
  10956. moveV: methodOp(function(dir, unit) {
  10957. var this$1 = this;
  10958. var doc = this.doc, goals = [];
  10959. var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
  10960. doc.extendSelectionsBy(function (range$$1) {
  10961. if (collapse)
  10962. { return dir < 0 ? range$$1.from() : range$$1.to() }
  10963. var headPos = cursorCoords(this$1, range$$1.head, "div");
  10964. if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
  10965. goals.push(headPos.left);
  10966. var pos = findPosV(this$1, headPos, dir, unit);
  10967. if (unit == "page" && range$$1 == doc.sel.primary())
  10968. { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); }
  10969. return pos
  10970. }, sel_move);
  10971. if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
  10972. { doc.sel.ranges[i].goalColumn = goals[i]; } }
  10973. }),
  10974. // Find the word at the given position (as returned by coordsChar).
  10975. findWordAt: function(pos) {
  10976. var doc = this.doc, line = getLine(doc, pos.line).text;
  10977. var start = pos.ch, end = pos.ch;
  10978. if (line) {
  10979. var helper = this.getHelper(pos, "wordChars");
  10980. if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
  10981. var startChar = line.charAt(start);
  10982. var check = isWordChar(startChar, helper)
  10983. ? function (ch) { return isWordChar(ch, helper); }
  10984. : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
  10985. : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
  10986. while (start > 0 && check(line.charAt(start - 1))) { --start; }
  10987. while (end < line.length && check(line.charAt(end))) { ++end; }
  10988. }
  10989. return new Range(Pos(pos.line, start), Pos(pos.line, end))
  10990. },
  10991. toggleOverwrite: function(value) {
  10992. if (value != null && value == this.state.overwrite) { return }
  10993. if (this.state.overwrite = !this.state.overwrite)
  10994. { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  10995. else
  10996. { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  10997. signal(this, "overwriteToggle", this, this.state.overwrite);
  10998. },
  10999. hasFocus: function() { return this.display.input.getField() == activeElt() },
  11000. isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
  11001. scrollTo: methodOp(function(x, y) {
  11002. if (x != null || y != null) { resolveScrollToPos(this); }
  11003. if (x != null) { this.curOp.scrollLeft = x; }
  11004. if (y != null) { this.curOp.scrollTop = y; }
  11005. }),
  11006. getScrollInfo: function() {
  11007. var scroller = this.display.scroller;
  11008. return {left: scroller.scrollLeft, top: scroller.scrollTop,
  11009. height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
  11010. width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
  11011. clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
  11012. },
  11013. scrollIntoView: methodOp(function(range$$1, margin) {
  11014. if (range$$1 == null) {
  11015. range$$1 = {from: this.doc.sel.primary().head, to: null};
  11016. if (margin == null) { margin = this.options.cursorScrollMargin; }
  11017. } else if (typeof range$$1 == "number") {
  11018. range$$1 = {from: Pos(range$$1, 0), to: null};
  11019. } else if (range$$1.from == null) {
  11020. range$$1 = {from: range$$1, to: null};
  11021. }
  11022. if (!range$$1.to) { range$$1.to = range$$1.from; }
  11023. range$$1.margin = margin || 0;
  11024. if (range$$1.from.line != null) {
  11025. resolveScrollToPos(this);
  11026. this.curOp.scrollToPos = range$$1;
  11027. } else {
  11028. var sPos = calculateScrollPos(this, {
  11029. left: Math.min(range$$1.from.left, range$$1.to.left),
  11030. top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin,
  11031. right: Math.max(range$$1.from.right, range$$1.to.right),
  11032. bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin
  11033. });
  11034. this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  11035. }
  11036. }),
  11037. setSize: methodOp(function(width, height) {
  11038. var this$1 = this;
  11039. var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
  11040. if (width != null) { this.display.wrapper.style.width = interpret(width); }
  11041. if (height != null) { this.display.wrapper.style.height = interpret(height); }
  11042. if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
  11043. var lineNo$$1 = this.display.viewFrom;
  11044. this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
  11045. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
  11046. { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
  11047. ++lineNo$$1;
  11048. });
  11049. this.curOp.forceUpdate = true;
  11050. signal(this, "refresh", this);
  11051. }),
  11052. operation: function(f){return runInOp(this, f)},
  11053. refresh: methodOp(function() {
  11054. var oldHeight = this.display.cachedTextHeight;
  11055. regChange(this);
  11056. this.curOp.forceUpdate = true;
  11057. clearCaches(this);
  11058. this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
  11059. updateGutterSpace(this);
  11060. if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
  11061. { estimateLineHeights(this); }
  11062. signal(this, "refresh", this);
  11063. }),
  11064. swapDoc: methodOp(function(doc) {
  11065. var old = this.doc;
  11066. old.cm = null;
  11067. attachDoc(this, doc);
  11068. clearCaches(this);
  11069. this.display.input.reset();
  11070. this.scrollTo(doc.scrollLeft, doc.scrollTop);
  11071. this.curOp.forceScroll = true;
  11072. signalLater(this, "swapDoc", this, old);
  11073. return old
  11074. }),
  11075. getInputField: function(){return this.display.input.getField()},
  11076. getWrapperElement: function(){return this.display.wrapper},
  11077. getScrollerElement: function(){return this.display.scroller},
  11078. getGutterElement: function(){return this.display.gutters}
  11079. };
  11080. eventMixin(CodeMirror);
  11081. CodeMirror.registerHelper = function(type, name, value) {
  11082. if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
  11083. helpers[type][name] = value;
  11084. };
  11085. CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
  11086. CodeMirror.registerHelper(type, name, value);
  11087. helpers[type]._global.push({pred: predicate, val: value});
  11088. };
  11089. };
  11090. // Used for horizontal relative motion. Dir is -1 or 1 (left or
  11091. // right), unit can be "char", "column" (like char, but doesn't
  11092. // cross line boundaries), "word" (across next word), or "group" (to
  11093. // the start of next group of word or non-word-non-whitespace
  11094. // chars). The visually param controls whether, in right-to-left
  11095. // text, direction 1 means to move towards the next index in the
  11096. // string, or towards the character to the right of the current
  11097. // position. The resulting position will have a hitSide=true
  11098. // property if it reached the end of the document.
  11099. function findPosH(doc, pos, dir, unit, visually) {
  11100. var oldPos = pos;
  11101. var origDir = dir;
  11102. var lineObj = getLine(doc, pos.line);
  11103. function findNextLine() {
  11104. var l = pos.line + dir;
  11105. if (l < doc.first || l >= doc.first + doc.size) { return false }
  11106. pos = new Pos(l, pos.ch, pos.sticky);
  11107. return lineObj = getLine(doc, l)
  11108. }
  11109. function moveOnce(boundToLine) {
  11110. var next;
  11111. if (visually) {
  11112. next = moveVisually(doc.cm, lineObj, pos, dir);
  11113. } else {
  11114. next = moveLogically(lineObj, pos, dir);
  11115. }
  11116. if (next == null) {
  11117. if (!boundToLine && findNextLine())
  11118. { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
  11119. else
  11120. { return false }
  11121. } else {
  11122. pos = next;
  11123. }
  11124. return true
  11125. }
  11126. if (unit == "char") {
  11127. moveOnce();
  11128. } else if (unit == "column") {
  11129. moveOnce(true);
  11130. } else if (unit == "word" || unit == "group") {
  11131. var sawType = null, group = unit == "group";
  11132. var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
  11133. for (var first = true;; first = false) {
  11134. if (dir < 0 && !moveOnce(!first)) { break }
  11135. var cur = lineObj.text.charAt(pos.ch) || "\n";
  11136. var type = isWordChar(cur, helper) ? "w"
  11137. : group && cur == "\n" ? "n"
  11138. : !group || /\s/.test(cur) ? null
  11139. : "p";
  11140. if (group && !first && !type) { type = "s"; }
  11141. if (sawType && sawType != type) {
  11142. if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
  11143. break
  11144. }
  11145. if (type) { sawType = type; }
  11146. if (dir > 0 && !moveOnce(!first)) { break }
  11147. }
  11148. }
  11149. var result = skipAtomic(doc, pos, oldPos, origDir, true);
  11150. if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
  11151. return result
  11152. }
  11153. // For relative vertical movement. Dir may be -1 or 1. Unit can be
  11154. // "page" or "line". The resulting position will have a hitSide=true
  11155. // property if it reached the end of the document.
  11156. function findPosV(cm, pos, dir, unit) {
  11157. var doc = cm.doc, x = pos.left, y;
  11158. if (unit == "page") {
  11159. var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
  11160. var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
  11161. y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
  11162. } else if (unit == "line") {
  11163. y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
  11164. }
  11165. var target;
  11166. for (;;) {
  11167. target = coordsChar(cm, x, y);
  11168. if (!target.outside) { break }
  11169. if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
  11170. y += dir * 5;
  11171. }
  11172. return target
  11173. }
  11174. // CONTENTEDITABLE INPUT STYLE
  11175. var ContentEditableInput = function(cm) {
  11176. this.cm = cm;
  11177. this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
  11178. this.polling = new Delayed();
  11179. this.composing = null;
  11180. this.gracePeriod = false;
  11181. this.readDOMTimeout = null;
  11182. };
  11183. ContentEditableInput.prototype.init = function (display) {
  11184. var this$1 = this;
  11185. var input = this, cm = input.cm;
  11186. var div = input.div = display.lineDiv;
  11187. disableBrowserMagic(div, cm.options.spellcheck);
  11188. on(div, "paste", function (e) {
  11189. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  11190. // IE doesn't fire input events, so we schedule a read for the pasted content in this way
  11191. if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
  11192. });
  11193. on(div, "compositionstart", function (e) {
  11194. this$1.composing = {data: e.data, done: false};
  11195. });
  11196. on(div, "compositionupdate", function (e) {
  11197. if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
  11198. });
  11199. on(div, "compositionend", function (e) {
  11200. if (this$1.composing) {
  11201. if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
  11202. this$1.composing.done = true;
  11203. }
  11204. });
  11205. on(div, "touchstart", function () { return input.forceCompositionEnd(); });
  11206. on(div, "input", function () {
  11207. if (!this$1.composing) { this$1.readFromDOMSoon(); }
  11208. });
  11209. function onCopyCut(e) {
  11210. if (signalDOMEvent(cm, e)) { return }
  11211. if (cm.somethingSelected()) {
  11212. setLastCopied({lineWise: false, text: cm.getSelections()});
  11213. if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
  11214. } else if (!cm.options.lineWiseCopyCut) {
  11215. return
  11216. } else {
  11217. var ranges = copyableRanges(cm);
  11218. setLastCopied({lineWise: true, text: ranges.text});
  11219. if (e.type == "cut") {
  11220. cm.operation(function () {
  11221. cm.setSelections(ranges.ranges, 0, sel_dontScroll);
  11222. cm.replaceSelection("", null, "cut");
  11223. });
  11224. }
  11225. }
  11226. if (e.clipboardData) {
  11227. e.clipboardData.clearData();
  11228. var content = lastCopied.text.join("\n");
  11229. // iOS exposes the clipboard API, but seems to discard content inserted into it
  11230. e.clipboardData.setData("Text", content);
  11231. if (e.clipboardData.getData("Text") == content) {
  11232. e.preventDefault();
  11233. return
  11234. }
  11235. }
  11236. // Old-fashioned briefly-focus-a-textarea hack
  11237. var kludge = hiddenTextarea(), te = kludge.firstChild;
  11238. cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
  11239. te.value = lastCopied.text.join("\n");
  11240. var hadFocus = document.activeElement;
  11241. selectInput(te);
  11242. setTimeout(function () {
  11243. cm.display.lineSpace.removeChild(kludge);
  11244. hadFocus.focus();
  11245. if (hadFocus == div) { input.showPrimarySelection(); }
  11246. }, 50);
  11247. }
  11248. on(div, "copy", onCopyCut);
  11249. on(div, "cut", onCopyCut);
  11250. };
  11251. ContentEditableInput.prototype.prepareSelection = function () {
  11252. var result = prepareSelection(this.cm, false);
  11253. result.focus = this.cm.state.focused;
  11254. return result
  11255. };
  11256. ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
  11257. if (!info || !this.cm.display.view.length) { return }
  11258. if (info.focus || takeFocus) { this.showPrimarySelection(); }
  11259. this.showMultipleSelections(info);
  11260. };
  11261. ContentEditableInput.prototype.showPrimarySelection = function () {
  11262. var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
  11263. var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
  11264. var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
  11265. if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
  11266. cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
  11267. cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
  11268. { return }
  11269. var start = posToDOM(this.cm, prim.from());
  11270. var end = posToDOM(this.cm, prim.to());
  11271. if (!start && !end) {
  11272. sel.removeAllRanges();
  11273. return
  11274. }
  11275. var view = this.cm.display.view;
  11276. var old = sel.rangeCount && sel.getRangeAt(0);
  11277. if (!start) {
  11278. start = {node: view[0].measure.map[2], offset: 0};
  11279. } else if (!end) { // FIXME dangerously hacky
  11280. var measure = view[view.length - 1].measure;
  11281. var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
  11282. end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
  11283. }
  11284. var rng;
  11285. try { rng = range(start.node, start.offset, end.offset, end.node); }
  11286. catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
  11287. if (rng) {
  11288. if (!gecko && this.cm.state.focused) {
  11289. sel.collapse(start.node, start.offset);
  11290. if (!rng.collapsed) {
  11291. sel.removeAllRanges();
  11292. sel.addRange(rng);
  11293. }
  11294. } else {
  11295. sel.removeAllRanges();
  11296. sel.addRange(rng);
  11297. }
  11298. if (old && sel.anchorNode == null) { sel.addRange(old); }
  11299. else if (gecko) { this.startGracePeriod(); }
  11300. }
  11301. this.rememberSelection();
  11302. };
  11303. ContentEditableInput.prototype.startGracePeriod = function () {
  11304. var this$1 = this;
  11305. clearTimeout(this.gracePeriod);
  11306. this.gracePeriod = setTimeout(function () {
  11307. this$1.gracePeriod = false;
  11308. if (this$1.selectionChanged())
  11309. { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
  11310. }, 20);
  11311. };
  11312. ContentEditableInput.prototype.showMultipleSelections = function (info) {
  11313. removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
  11314. removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  11315. };
  11316. ContentEditableInput.prototype.rememberSelection = function () {
  11317. var sel = window.getSelection();
  11318. this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
  11319. this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  11320. };
  11321. ContentEditableInput.prototype.selectionInEditor = function () {
  11322. var sel = window.getSelection();
  11323. if (!sel.rangeCount) { return false }
  11324. var node = sel.getRangeAt(0).commonAncestorContainer;
  11325. return contains(this.div, node)
  11326. };
  11327. ContentEditableInput.prototype.focus = function () {
  11328. if (this.cm.options.readOnly != "nocursor") {
  11329. if (!this.selectionInEditor())
  11330. { this.showSelection(this.prepareSelection(), true); }
  11331. this.div.focus();
  11332. }
  11333. };
  11334. ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  11335. ContentEditableInput.prototype.getField = function () { return this.div };
  11336. ContentEditableInput.prototype.supportsTouch = function () { return true };
  11337. ContentEditableInput.prototype.receivedFocus = function () {
  11338. var input = this;
  11339. if (this.selectionInEditor())
  11340. { this.pollSelection(); }
  11341. else
  11342. { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
  11343. function poll() {
  11344. if (input.cm.state.focused) {
  11345. input.pollSelection();
  11346. input.polling.set(input.cm.options.pollInterval, poll);
  11347. }
  11348. }
  11349. this.polling.set(this.cm.options.pollInterval, poll);
  11350. };
  11351. ContentEditableInput.prototype.selectionChanged = function () {
  11352. var sel = window.getSelection();
  11353. return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
  11354. sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  11355. };
  11356. ContentEditableInput.prototype.pollSelection = function () {
  11357. if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
  11358. var sel = window.getSelection(), cm = this.cm;
  11359. // On Android Chrome (version 56, at least), backspacing into an
  11360. // uneditable block element will put the cursor in that element,
  11361. // and then, because it's not editable, hide the virtual keyboard.
  11362. // Because Android doesn't allow us to actually detect backspace
  11363. // presses in a sane way, this code checks for when that happens
  11364. // and simulates a backspace press in this case.
  11365. if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
  11366. this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
  11367. this.blur();
  11368. this.focus();
  11369. return
  11370. }
  11371. if (this.composing) { return }
  11372. this.rememberSelection();
  11373. var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  11374. var head = domToPos(cm, sel.focusNode, sel.focusOffset);
  11375. if (anchor && head) { runInOp(cm, function () {
  11376. setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
  11377. if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
  11378. }); }
  11379. };
  11380. ContentEditableInput.prototype.pollContent = function () {
  11381. if (this.readDOMTimeout != null) {
  11382. clearTimeout(this.readDOMTimeout);
  11383. this.readDOMTimeout = null;
  11384. }
  11385. var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
  11386. var from = sel.from(), to = sel.to();
  11387. if (from.ch == 0 && from.line > cm.firstLine())
  11388. { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
  11389. if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
  11390. { to = Pos(to.line + 1, 0); }
  11391. if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
  11392. var fromIndex, fromLine, fromNode;
  11393. if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
  11394. fromLine = lineNo(display.view[0].line);
  11395. fromNode = display.view[0].node;
  11396. } else {
  11397. fromLine = lineNo(display.view[fromIndex].line);
  11398. fromNode = display.view[fromIndex - 1].node.nextSibling;
  11399. }
  11400. var toIndex = findViewIndex(cm, to.line);
  11401. var toLine, toNode;
  11402. if (toIndex == display.view.length - 1) {
  11403. toLine = display.viewTo - 1;
  11404. toNode = display.lineDiv.lastChild;
  11405. } else {
  11406. toLine = lineNo(display.view[toIndex + 1].line) - 1;
  11407. toNode = display.view[toIndex + 1].node.previousSibling;
  11408. }
  11409. if (!fromNode) { return false }
  11410. var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
  11411. var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
  11412. while (newText.length > 1 && oldText.length > 1) {
  11413. if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
  11414. else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
  11415. else { break }
  11416. }
  11417. var cutFront = 0, cutEnd = 0;
  11418. var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
  11419. while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
  11420. { ++cutFront; }
  11421. var newBot = lst(newText), oldBot = lst(oldText);
  11422. var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
  11423. oldBot.length - (oldText.length == 1 ? cutFront : 0));
  11424. while (cutEnd < maxCutEnd &&
  11425. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
  11426. { ++cutEnd; }
  11427. // Try to move start of change to start of selection if ambiguous
  11428. if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
  11429. while (cutFront && cutFront > from.ch &&
  11430. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
  11431. cutFront--;
  11432. cutEnd++;
  11433. }
  11434. }
  11435. newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
  11436. newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
  11437. var chFrom = Pos(fromLine, cutFront);
  11438. var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
  11439. if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
  11440. replaceRange(cm.doc, newText, chFrom, chTo, "+input");
  11441. return true
  11442. }
  11443. };
  11444. ContentEditableInput.prototype.ensurePolled = function () {
  11445. this.forceCompositionEnd();
  11446. };
  11447. ContentEditableInput.prototype.reset = function () {
  11448. this.forceCompositionEnd();
  11449. };
  11450. ContentEditableInput.prototype.forceCompositionEnd = function () {
  11451. if (!this.composing) { return }
  11452. clearTimeout(this.readDOMTimeout);
  11453. this.composing = null;
  11454. this.updateFromDOM();
  11455. this.div.blur();
  11456. this.div.focus();
  11457. };
  11458. ContentEditableInput.prototype.readFromDOMSoon = function () {
  11459. var this$1 = this;
  11460. if (this.readDOMTimeout != null) { return }
  11461. this.readDOMTimeout = setTimeout(function () {
  11462. this$1.readDOMTimeout = null;
  11463. if (this$1.composing) {
  11464. if (this$1.composing.done) { this$1.composing = null; }
  11465. else { return }
  11466. }
  11467. this$1.updateFromDOM();
  11468. }, 80);
  11469. };
  11470. ContentEditableInput.prototype.updateFromDOM = function () {
  11471. var this$1 = this;
  11472. if (this.cm.isReadOnly() || !this.pollContent())
  11473. { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  11474. };
  11475. ContentEditableInput.prototype.setUneditable = function (node) {
  11476. node.contentEditable = "false";
  11477. };
  11478. ContentEditableInput.prototype.onKeyPress = function (e) {
  11479. if (e.charCode == 0) { return }
  11480. e.preventDefault();
  11481. if (!this.cm.isReadOnly())
  11482. { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  11483. };
  11484. ContentEditableInput.prototype.readOnlyChanged = function (val) {
  11485. this.div.contentEditable = String(val != "nocursor");
  11486. };
  11487. ContentEditableInput.prototype.onContextMenu = function () {};
  11488. ContentEditableInput.prototype.resetPosition = function () {};
  11489. ContentEditableInput.prototype.needsContentAttribute = true;
  11490. function posToDOM(cm, pos) {
  11491. var view = findViewForLine(cm, pos.line);
  11492. if (!view || view.hidden) { return null }
  11493. var line = getLine(cm.doc, pos.line);
  11494. var info = mapFromLineView(view, line, pos.line);
  11495. var order = getOrder(line, cm.doc.direction), side = "left";
  11496. if (order) {
  11497. var partPos = getBidiPartAt(order, pos.ch);
  11498. side = partPos % 2 ? "right" : "left";
  11499. }
  11500. var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
  11501. result.offset = result.collapse == "right" ? result.end : result.start;
  11502. return result
  11503. }
  11504. function isInGutter(node) {
  11505. for (var scan = node; scan; scan = scan.parentNode)
  11506. { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
  11507. return false
  11508. }
  11509. function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
  11510. function domTextBetween(cm, from, to, fromLine, toLine) {
  11511. var text = "", closing = false, lineSep = cm.doc.lineSeparator();
  11512. function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  11513. function close() {
  11514. if (closing) {
  11515. text += lineSep;
  11516. closing = false;
  11517. }
  11518. }
  11519. function addText(str) {
  11520. if (str) {
  11521. close();
  11522. text += str;
  11523. }
  11524. }
  11525. function walk(node) {
  11526. if (node.nodeType == 1) {
  11527. var cmText = node.getAttribute("cm-text");
  11528. if (cmText != null) {
  11529. addText(cmText || node.textContent.replace(/\u200b/g, ""));
  11530. return
  11531. }
  11532. var markerID = node.getAttribute("cm-marker"), range$$1;
  11533. if (markerID) {
  11534. var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
  11535. if (found.length && (range$$1 = found[0].find()))
  11536. { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
  11537. return
  11538. }
  11539. if (node.getAttribute("contenteditable") == "false") { return }
  11540. var isBlock = /^(pre|div|p)$/i.test(node.nodeName);
  11541. if (isBlock) { close(); }
  11542. for (var i = 0; i < node.childNodes.length; i++)
  11543. { walk(node.childNodes[i]); }
  11544. if (isBlock) { closing = true; }
  11545. } else if (node.nodeType == 3) {
  11546. addText(node.nodeValue);
  11547. }
  11548. }
  11549. for (;;) {
  11550. walk(from);
  11551. if (from == to) { break }
  11552. from = from.nextSibling;
  11553. }
  11554. return text
  11555. }
  11556. function domToPos(cm, node, offset) {
  11557. var lineNode;
  11558. if (node == cm.display.lineDiv) {
  11559. lineNode = cm.display.lineDiv.childNodes[offset];
  11560. if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
  11561. node = null; offset = 0;
  11562. } else {
  11563. for (lineNode = node;; lineNode = lineNode.parentNode) {
  11564. if (!lineNode || lineNode == cm.display.lineDiv) { return null }
  11565. if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
  11566. }
  11567. }
  11568. for (var i = 0; i < cm.display.view.length; i++) {
  11569. var lineView = cm.display.view[i];
  11570. if (lineView.node == lineNode)
  11571. { return locateNodeInLineView(lineView, node, offset) }
  11572. }
  11573. }
  11574. function locateNodeInLineView(lineView, node, offset) {
  11575. var wrapper = lineView.text.firstChild, bad = false;
  11576. if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  11577. if (node == wrapper) {
  11578. bad = true;
  11579. node = wrapper.childNodes[offset];
  11580. offset = 0;
  11581. if (!node) {
  11582. var line = lineView.rest ? lst(lineView.rest) : lineView.line;
  11583. return badPos(Pos(lineNo(line), line.text.length), bad)
  11584. }
  11585. }
  11586. var textNode = node.nodeType == 3 ? node : null, topNode = node;
  11587. if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
  11588. textNode = node.firstChild;
  11589. if (offset) { offset = textNode.nodeValue.length; }
  11590. }
  11591. while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
  11592. var measure = lineView.measure, maps = measure.maps;
  11593. function find(textNode, topNode, offset) {
  11594. for (var i = -1; i < (maps ? maps.length : 0); i++) {
  11595. var map$$1 = i < 0 ? measure.map : maps[i];
  11596. for (var j = 0; j < map$$1.length; j += 3) {
  11597. var curNode = map$$1[j + 2];
  11598. if (curNode == textNode || curNode == topNode) {
  11599. var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
  11600. var ch = map$$1[j] + offset;
  11601. if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
  11602. return Pos(line, ch)
  11603. }
  11604. }
  11605. }
  11606. }
  11607. var found = find(textNode, topNode, offset);
  11608. if (found) { return badPos(found, bad) }
  11609. // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
  11610. for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
  11611. found = find(after, after.firstChild, 0);
  11612. if (found)
  11613. { return badPos(Pos(found.line, found.ch - dist), bad) }
  11614. else
  11615. { dist += after.textContent.length; }
  11616. }
  11617. for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
  11618. found = find(before, before.firstChild, -1);
  11619. if (found)
  11620. { return badPos(Pos(found.line, found.ch + dist$1), bad) }
  11621. else
  11622. { dist$1 += before.textContent.length; }
  11623. }
  11624. }
  11625. // TEXTAREA INPUT STYLE
  11626. var TextareaInput = function(cm) {
  11627. this.cm = cm;
  11628. // See input.poll and input.reset
  11629. this.prevInput = "";
  11630. // Flag that indicates whether we expect input to appear real soon
  11631. // now (after some event like 'keypress' or 'input') and are
  11632. // polling intensively.
  11633. this.pollingFast = false;
  11634. // Self-resetting timeout for the poller
  11635. this.polling = new Delayed();
  11636. // Tracks when input.reset has punted to just putting a short
  11637. // string into the textarea instead of the full selection.
  11638. this.inaccurateSelection = false;
  11639. // Used to work around IE issue with selection being forgotten when focus moves away from textarea
  11640. this.hasSelection = false;
  11641. this.composing = null;
  11642. };
  11643. TextareaInput.prototype.init = function (display) {
  11644. var this$1 = this;
  11645. var input = this, cm = this.cm;
  11646. // Wraps and hides input textarea
  11647. var div = this.wrapper = hiddenTextarea();
  11648. // The semihidden textarea that is focused when the editor is
  11649. // focused, and receives input.
  11650. var te = this.textarea = div.firstChild;
  11651. display.wrapper.insertBefore(div, display.wrapper.firstChild);
  11652. // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
  11653. if (ios) { te.style.width = "0px"; }
  11654. on(te, "input", function () {
  11655. if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
  11656. input.poll();
  11657. });
  11658. on(te, "paste", function (e) {
  11659. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  11660. cm.state.pasteIncoming = true;
  11661. input.fastPoll();
  11662. });
  11663. function prepareCopyCut(e) {
  11664. if (signalDOMEvent(cm, e)) { return }
  11665. if (cm.somethingSelected()) {
  11666. setLastCopied({lineWise: false, text: cm.getSelections()});
  11667. if (input.inaccurateSelection) {
  11668. input.prevInput = "";
  11669. input.inaccurateSelection = false;
  11670. te.value = lastCopied.text.join("\n");
  11671. selectInput(te);
  11672. }
  11673. } else if (!cm.options.lineWiseCopyCut) {
  11674. return
  11675. } else {
  11676. var ranges = copyableRanges(cm);
  11677. setLastCopied({lineWise: true, text: ranges.text});
  11678. if (e.type == "cut") {
  11679. cm.setSelections(ranges.ranges, null, sel_dontScroll);
  11680. } else {
  11681. input.prevInput = "";
  11682. te.value = ranges.text.join("\n");
  11683. selectInput(te);
  11684. }
  11685. }
  11686. if (e.type == "cut") { cm.state.cutIncoming = true; }
  11687. }
  11688. on(te, "cut", prepareCopyCut);
  11689. on(te, "copy", prepareCopyCut);
  11690. on(display.scroller, "paste", function (e) {
  11691. if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
  11692. cm.state.pasteIncoming = true;
  11693. input.focus();
  11694. });
  11695. // Prevent normal selection in the editor (we handle our own)
  11696. on(display.lineSpace, "selectstart", function (e) {
  11697. if (!eventInWidget(display, e)) { e_preventDefault(e); }
  11698. });
  11699. on(te, "compositionstart", function () {
  11700. var start = cm.getCursor("from");
  11701. if (input.composing) { input.composing.range.clear(); }
  11702. input.composing = {
  11703. start: start,
  11704. range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
  11705. };
  11706. });
  11707. on(te, "compositionend", function () {
  11708. if (input.composing) {
  11709. input.poll();
  11710. input.composing.range.clear();
  11711. input.composing = null;
  11712. }
  11713. });
  11714. };
  11715. TextareaInput.prototype.prepareSelection = function () {
  11716. // Redraw the selection and/or cursor
  11717. var cm = this.cm, display = cm.display, doc = cm.doc;
  11718. var result = prepareSelection(cm);
  11719. // Move the hidden textarea near the cursor to prevent scrolling artifacts
  11720. if (cm.options.moveInputWithCursor) {
  11721. var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
  11722. var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  11723. result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  11724. headPos.top + lineOff.top - wrapOff.top));
  11725. result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  11726. headPos.left + lineOff.left - wrapOff.left));
  11727. }
  11728. return result
  11729. };
  11730. TextareaInput.prototype.showSelection = function (drawn) {
  11731. var cm = this.cm, display = cm.display;
  11732. removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
  11733. removeChildrenAndAdd(display.selectionDiv, drawn.selection);
  11734. if (drawn.teTop != null) {
  11735. this.wrapper.style.top = drawn.teTop + "px";
  11736. this.wrapper.style.left = drawn.teLeft + "px";
  11737. }
  11738. };
  11739. // Reset the input to correspond to the selection (or to be empty,
  11740. // when not typing and nothing is selected)
  11741. TextareaInput.prototype.reset = function (typing) {
  11742. if (this.contextMenuPending) { return }
  11743. var minimal, selected, cm = this.cm, doc = cm.doc;
  11744. if (cm.somethingSelected()) {
  11745. this.prevInput = "";
  11746. var range$$1 = doc.sel.primary();
  11747. minimal = hasCopyEvent &&
  11748. (range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000);
  11749. var content = minimal ? "-" : selected || cm.getSelection();
  11750. this.textarea.value = content;
  11751. if (cm.state.focused) { selectInput(this.textarea); }
  11752. if (ie && ie_version >= 9) { this.hasSelection = content; }
  11753. } else if (!typing) {
  11754. this.prevInput = this.textarea.value = "";
  11755. if (ie && ie_version >= 9) { this.hasSelection = null; }
  11756. }
  11757. this.inaccurateSelection = minimal;
  11758. };
  11759. TextareaInput.prototype.getField = function () { return this.textarea };
  11760. TextareaInput.prototype.supportsTouch = function () { return false };
  11761. TextareaInput.prototype.focus = function () {
  11762. if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
  11763. try { this.textarea.focus(); }
  11764. catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
  11765. }
  11766. };
  11767. TextareaInput.prototype.blur = function () { this.textarea.blur(); };
  11768. TextareaInput.prototype.resetPosition = function () {
  11769. this.wrapper.style.top = this.wrapper.style.left = 0;
  11770. };
  11771. TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
  11772. // Poll for input changes, using the normal rate of polling. This
  11773. // runs as long as the editor is focused.
  11774. TextareaInput.prototype.slowPoll = function () {
  11775. var this$1 = this;
  11776. if (this.pollingFast) { return }
  11777. this.polling.set(this.cm.options.pollInterval, function () {
  11778. this$1.poll();
  11779. if (this$1.cm.state.focused) { this$1.slowPoll(); }
  11780. });
  11781. };
  11782. // When an event has just come in that is likely to add or change
  11783. // something in the input textarea, we poll faster, to ensure that
  11784. // the change appears on the screen quickly.
  11785. TextareaInput.prototype.fastPoll = function () {
  11786. var missed = false, input = this;
  11787. input.pollingFast = true;
  11788. function p() {
  11789. var changed = input.poll();
  11790. if (!changed && !missed) {missed = true; input.polling.set(60, p);}
  11791. else {input.pollingFast = false; input.slowPoll();}
  11792. }
  11793. input.polling.set(20, p);
  11794. };
  11795. // Read input from the textarea, and update the document to match.
  11796. // When something is selected, it is present in the textarea, and
  11797. // selected (unless it is huge, in which case a placeholder is
  11798. // used). When nothing is selected, the cursor sits after previously
  11799. // seen text (can be empty), which is stored in prevInput (we must
  11800. // not reset the textarea when typing, because that breaks IME).
  11801. TextareaInput.prototype.poll = function () {
  11802. var this$1 = this;
  11803. var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
  11804. // Since this is called a *lot*, try to bail out as cheaply as
  11805. // possible when it is clear that nothing happened. hasSelection
  11806. // will be the case when there is a lot of text in the textarea,
  11807. // in which case reading its value would be expensive.
  11808. if (this.contextMenuPending || !cm.state.focused ||
  11809. (hasSelection(input) && !prevInput && !this.composing) ||
  11810. cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
  11811. { return false }
  11812. var text = input.value;
  11813. // If nothing changed, bail.
  11814. if (text == prevInput && !cm.somethingSelected()) { return false }
  11815. // Work around nonsensical selection resetting in IE9/10, and
  11816. // inexplicable appearance of private area unicode characters on
  11817. // some key combos in Mac (#2689).
  11818. if (ie && ie_version >= 9 && this.hasSelection === text ||
  11819. mac && /[\uf700-\uf7ff]/.test(text)) {
  11820. cm.display.input.reset();
  11821. return false
  11822. }
  11823. if (cm.doc.sel == cm.display.selForContextMenu) {
  11824. var first = text.charCodeAt(0);
  11825. if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
  11826. if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
  11827. }
  11828. // Find the part of the input that is actually new
  11829. var same = 0, l = Math.min(prevInput.length, text.length);
  11830. while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
  11831. runInOp(cm, function () {
  11832. applyTextInput(cm, text.slice(same), prevInput.length - same,
  11833. null, this$1.composing ? "*compose" : null);
  11834. // Don't leave long text in the textarea, since it makes further polling slow
  11835. if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
  11836. else { this$1.prevInput = text; }
  11837. if (this$1.composing) {
  11838. this$1.composing.range.clear();
  11839. this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
  11840. {className: "CodeMirror-composing"});
  11841. }
  11842. });
  11843. return true
  11844. };
  11845. TextareaInput.prototype.ensurePolled = function () {
  11846. if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  11847. };
  11848. TextareaInput.prototype.onKeyPress = function () {
  11849. if (ie && ie_version >= 9) { this.hasSelection = null; }
  11850. this.fastPoll();
  11851. };
  11852. TextareaInput.prototype.onContextMenu = function (e) {
  11853. var input = this, cm = input.cm, display = cm.display, te = input.textarea;
  11854. var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
  11855. if (!pos || presto) { return } // Opera is difficult.
  11856. // Reset the current text selection only if the click is done outside of the selection
  11857. // and 'resetSelectionOnContextMenu' option is true.
  11858. var reset = cm.options.resetSelectionOnContextMenu;
  11859. if (reset && cm.doc.sel.contains(pos) == -1)
  11860. { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
  11861. var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
  11862. input.wrapper.style.cssText = "position: absolute";
  11863. var wrapperBox = input.wrapper.getBoundingClientRect();
  11864. te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
  11865. var oldScrollY;
  11866. if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
  11867. display.input.focus();
  11868. if (webkit) { window.scrollTo(null, oldScrollY); }
  11869. display.input.reset();
  11870. // Adds "Select all" to context menu in FF
  11871. if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
  11872. input.contextMenuPending = true;
  11873. display.selForContextMenu = cm.doc.sel;
  11874. clearTimeout(display.detectingSelectAll);
  11875. // Select-all will be greyed out if there's nothing to select, so
  11876. // this adds a zero-width space so that we can later check whether
  11877. // it got selected.
  11878. function prepareSelectAllHack() {
  11879. if (te.selectionStart != null) {
  11880. var selected = cm.somethingSelected();
  11881. var extval = "\u200b" + (selected ? te.value : "");
  11882. te.value = "\u21da"; // Used to catch context-menu undo
  11883. te.value = extval;
  11884. input.prevInput = selected ? "" : "\u200b";
  11885. te.selectionStart = 1; te.selectionEnd = extval.length;
  11886. // Re-set this, in case some other handler touched the
  11887. // selection in the meantime.
  11888. display.selForContextMenu = cm.doc.sel;
  11889. }
  11890. }
  11891. function rehide() {
  11892. input.contextMenuPending = false;
  11893. input.wrapper.style.cssText = oldWrapperCSS;
  11894. te.style.cssText = oldCSS;
  11895. if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
  11896. // Try to detect the user choosing select-all
  11897. if (te.selectionStart != null) {
  11898. if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
  11899. var i = 0, poll = function () {
  11900. if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
  11901. te.selectionEnd > 0 && input.prevInput == "\u200b") {
  11902. operation(cm, selectAll)(cm);
  11903. } else if (i++ < 10) {
  11904. display.detectingSelectAll = setTimeout(poll, 500);
  11905. } else {
  11906. display.selForContextMenu = null;
  11907. display.input.reset();
  11908. }
  11909. };
  11910. display.detectingSelectAll = setTimeout(poll, 200);
  11911. }
  11912. }
  11913. if (ie && ie_version >= 9) { prepareSelectAllHack(); }
  11914. if (captureRightClick) {
  11915. e_stop(e);
  11916. var mouseup = function () {
  11917. off(window, "mouseup", mouseup);
  11918. setTimeout(rehide, 20);
  11919. };
  11920. on(window, "mouseup", mouseup);
  11921. } else {
  11922. setTimeout(rehide, 50);
  11923. }
  11924. };
  11925. TextareaInput.prototype.readOnlyChanged = function (val) {
  11926. if (!val) { this.reset(); }
  11927. };
  11928. TextareaInput.prototype.setUneditable = function () {};
  11929. TextareaInput.prototype.needsContentAttribute = false;
  11930. function fromTextArea(textarea, options) {
  11931. options = options ? copyObj(options) : {};
  11932. options.value = textarea.value;
  11933. if (!options.tabindex && textarea.tabIndex)
  11934. { options.tabindex = textarea.tabIndex; }
  11935. if (!options.placeholder && textarea.placeholder)
  11936. { options.placeholder = textarea.placeholder; }
  11937. // Set autofocus to true if this textarea is focused, or if it has
  11938. // autofocus and no other element is focused.
  11939. if (options.autofocus == null) {
  11940. var hasFocus = activeElt();
  11941. options.autofocus = hasFocus == textarea ||
  11942. textarea.getAttribute("autofocus") != null && hasFocus == document.body;
  11943. }
  11944. function save() {textarea.value = cm.getValue();}
  11945. var realSubmit;
  11946. if (textarea.form) {
  11947. on(textarea.form, "submit", save);
  11948. // Deplorable hack to make the submit method do the right thing.
  11949. if (!options.leaveSubmitMethodAlone) {
  11950. var form = textarea.form;
  11951. realSubmit = form.submit;
  11952. try {
  11953. var wrappedSubmit = form.submit = function () {
  11954. save();
  11955. form.submit = realSubmit;
  11956. form.submit();
  11957. form.submit = wrappedSubmit;
  11958. };
  11959. } catch(e) {}
  11960. }
  11961. }
  11962. options.finishInit = function (cm) {
  11963. cm.save = save;
  11964. cm.getTextArea = function () { return textarea; };
  11965. cm.toTextArea = function () {
  11966. cm.toTextArea = isNaN; // Prevent this from being ran twice
  11967. save();
  11968. textarea.parentNode.removeChild(cm.getWrapperElement());
  11969. textarea.style.display = "";
  11970. if (textarea.form) {
  11971. off(textarea.form, "submit", save);
  11972. if (typeof textarea.form.submit == "function")
  11973. { textarea.form.submit = realSubmit; }
  11974. }
  11975. };
  11976. };
  11977. textarea.style.display = "none";
  11978. var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
  11979. options);
  11980. return cm
  11981. }
  11982. function addLegacyProps(CodeMirror) {
  11983. CodeMirror.off = off;
  11984. CodeMirror.on = on;
  11985. CodeMirror.wheelEventPixels = wheelEventPixels;
  11986. CodeMirror.Doc = Doc;
  11987. CodeMirror.splitLines = splitLinesAuto;
  11988. CodeMirror.countColumn = countColumn;
  11989. CodeMirror.findColumn = findColumn;
  11990. CodeMirror.isWordChar = isWordCharBasic;
  11991. CodeMirror.Pass = Pass;
  11992. CodeMirror.signal = signal;
  11993. CodeMirror.Line = Line;
  11994. CodeMirror.changeEnd = changeEnd;
  11995. CodeMirror.scrollbarModel = scrollbarModel;
  11996. CodeMirror.Pos = Pos;
  11997. CodeMirror.cmpPos = cmp;
  11998. CodeMirror.modes = modes;
  11999. CodeMirror.mimeModes = mimeModes;
  12000. CodeMirror.resolveMode = resolveMode;
  12001. CodeMirror.getMode = getMode;
  12002. CodeMirror.modeExtensions = modeExtensions;
  12003. CodeMirror.extendMode = extendMode;
  12004. CodeMirror.copyState = copyState;
  12005. CodeMirror.startState = startState;
  12006. CodeMirror.innerMode = innerMode;
  12007. CodeMirror.commands = commands;
  12008. CodeMirror.keyMap = keyMap;
  12009. CodeMirror.keyName = keyName;
  12010. CodeMirror.isModifierKey = isModifierKey;
  12011. CodeMirror.lookupKey = lookupKey;
  12012. CodeMirror.normalizeKeyMap = normalizeKeyMap;
  12013. CodeMirror.StringStream = StringStream;
  12014. CodeMirror.SharedTextMarker = SharedTextMarker;
  12015. CodeMirror.TextMarker = TextMarker;
  12016. CodeMirror.LineWidget = LineWidget;
  12017. CodeMirror.e_preventDefault = e_preventDefault;
  12018. CodeMirror.e_stopPropagation = e_stopPropagation;
  12019. CodeMirror.e_stop = e_stop;
  12020. CodeMirror.addClass = addClass;
  12021. CodeMirror.contains = contains;
  12022. CodeMirror.rmClass = rmClass;
  12023. CodeMirror.keyNames = keyNames;
  12024. }
  12025. // EDITOR CONSTRUCTOR
  12026. defineOptions(CodeMirror$1);
  12027. addEditorMethods(CodeMirror$1);
  12028. // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  12029. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  12030. for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
  12031. { CodeMirror$1.prototype[prop] = (function(method) {
  12032. return function() {return method.apply(this.doc, arguments)}
  12033. })(Doc.prototype[prop]); } }
  12034. eventMixin(Doc);
  12035. // INPUT HANDLING
  12036. CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
  12037. // MODE DEFINITION AND QUERYING
  12038. // Extra arguments are stored as the mode's dependencies, which is
  12039. // used by (legacy) mechanisms like loadmode.js to automatically
  12040. // load a mode. (Preferred mechanism is the require/define calls.)
  12041. CodeMirror$1.defineMode = function(name/*, mode, …*/) {
  12042. if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
  12043. defineMode.apply(this, arguments);
  12044. };
  12045. CodeMirror$1.defineMIME = defineMIME;
  12046. // Minimal default mode.
  12047. CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  12048. CodeMirror$1.defineMIME("text/plain", "null");
  12049. // EXTENSIONS
  12050. CodeMirror$1.defineExtension = function (name, func) {
  12051. CodeMirror$1.prototype[name] = func;
  12052. };
  12053. CodeMirror$1.defineDocExtension = function (name, func) {
  12054. Doc.prototype[name] = func;
  12055. };
  12056. CodeMirror$1.fromTextArea = fromTextArea;
  12057. addLegacyProps(CodeMirror$1);
  12058. CodeMirror$1.version = "5.25.0";
  12059. return CodeMirror$1;
  12060. })));
  12061. /***/ }),
  12062. /* 34 */
  12063. /***/ (function(module, exports, __webpack_require__) {
  12064. "use strict";
  12065. /**
  12066. * Copyright (c) 2013-present, Facebook, Inc.
  12067. * All rights reserved.
  12068. *
  12069. * This source code is licensed under the BSD-style license found in the
  12070. * LICENSE file in the root directory of this source tree. An additional grant
  12071. * of patent rights can be found in the PATENTS file in the same directory.
  12072. *
  12073. * @typechecks
  12074. *
  12075. */
  12076. /*eslint-disable no-self-compare */
  12077. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12078. /**
  12079. * inlined Object.is polyfill to avoid requiring consumers ship their own
  12080. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  12081. */
  12082. function is(x, y) {
  12083. // SameValue algorithm
  12084. if (x === y) {
  12085. // Steps 1-5, 7-10
  12086. // Steps 6.b-6.e: +0 != -0
  12087. // Added the nonzero y check to make Flow happy, but it is redundant
  12088. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  12089. } else {
  12090. // Step 6.a: NaN == NaN
  12091. return x !== x && y !== y;
  12092. }
  12093. }
  12094. /**
  12095. * Performs equality by iterating through keys on an object and returning false
  12096. * when any key has values which are not strictly equal between the arguments.
  12097. * Returns true when the values of all keys are strictly equal.
  12098. */
  12099. function shallowEqual(objA, objB) {
  12100. if (is(objA, objB)) {
  12101. return true;
  12102. }
  12103. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  12104. return false;
  12105. }
  12106. var keysA = Object.keys(objA);
  12107. var keysB = Object.keys(objB);
  12108. if (keysA.length !== keysB.length) {
  12109. return false;
  12110. }
  12111. // Test for A's keys different from B.
  12112. for (var i = 0; i < keysA.length; i++) {
  12113. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  12114. return false;
  12115. }
  12116. }
  12117. return true;
  12118. }
  12119. module.exports = shallowEqual;
  12120. /***/ }),
  12121. /* 35 */
  12122. /***/ (function(module, exports, __webpack_require__) {
  12123. "use strict";
  12124. /**
  12125. * Copyright 2013-present, Facebook, Inc.
  12126. * All rights reserved.
  12127. *
  12128. * This source code is licensed under the BSD-style license found in the
  12129. * LICENSE file in the root directory of this source tree. An additional grant
  12130. * of patent rights can be found in the PATENTS file in the same directory.
  12131. *
  12132. */
  12133. var DOMLazyTree = __webpack_require__(17);
  12134. var Danger = __webpack_require__(146);
  12135. var ReactDOMComponentTree = __webpack_require__(4);
  12136. var ReactInstrumentation = __webpack_require__(10);
  12137. var createMicrosoftUnsafeLocalFunction = __webpack_require__(44);
  12138. var setInnerHTML = __webpack_require__(32);
  12139. var setTextContent = __webpack_require__(76);
  12140. function getNodeAfter(parentNode, node) {
  12141. // Special case for text components, which return [open, close] comments
  12142. // from getHostNode.
  12143. if (Array.isArray(node)) {
  12144. node = node[1];
  12145. }
  12146. return node ? node.nextSibling : parentNode.firstChild;
  12147. }
  12148. /**
  12149. * Inserts `childNode` as a child of `parentNode` at the `index`.
  12150. *
  12151. * @param {DOMElement} parentNode Parent node in which to insert.
  12152. * @param {DOMElement} childNode Child node to insert.
  12153. * @param {number} index Index at which to insert the child.
  12154. * @internal
  12155. */
  12156. var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
  12157. // We rely exclusively on `insertBefore(node, null)` instead of also using
  12158. // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
  12159. // we are careful to use `null`.)
  12160. parentNode.insertBefore(childNode, referenceNode);
  12161. });
  12162. function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
  12163. DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
  12164. }
  12165. function moveChild(parentNode, childNode, referenceNode) {
  12166. if (Array.isArray(childNode)) {
  12167. moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
  12168. } else {
  12169. insertChildAt(parentNode, childNode, referenceNode);
  12170. }
  12171. }
  12172. function removeChild(parentNode, childNode) {
  12173. if (Array.isArray(childNode)) {
  12174. var closingComment = childNode[1];
  12175. childNode = childNode[0];
  12176. removeDelimitedText(parentNode, childNode, closingComment);
  12177. parentNode.removeChild(closingComment);
  12178. }
  12179. parentNode.removeChild(childNode);
  12180. }
  12181. function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
  12182. var node = openingComment;
  12183. while (true) {
  12184. var nextNode = node.nextSibling;
  12185. insertChildAt(parentNode, node, referenceNode);
  12186. if (node === closingComment) {
  12187. break;
  12188. }
  12189. node = nextNode;
  12190. }
  12191. }
  12192. function removeDelimitedText(parentNode, startNode, closingComment) {
  12193. while (true) {
  12194. var node = startNode.nextSibling;
  12195. if (node === closingComment) {
  12196. // The closing comment is removed by ReactMultiChild.
  12197. break;
  12198. } else {
  12199. parentNode.removeChild(node);
  12200. }
  12201. }
  12202. }
  12203. function replaceDelimitedText(openingComment, closingComment, stringText) {
  12204. var parentNode = openingComment.parentNode;
  12205. var nodeAfterComment = openingComment.nextSibling;
  12206. if (nodeAfterComment === closingComment) {
  12207. // There are no text nodes between the opening and closing comments; insert
  12208. // a new one if stringText isn't empty.
  12209. if (stringText) {
  12210. insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
  12211. }
  12212. } else {
  12213. if (stringText) {
  12214. // Set the text content of the first node after the opening comment, and
  12215. // remove all following nodes up until the closing comment.
  12216. setTextContent(nodeAfterComment, stringText);
  12217. removeDelimitedText(parentNode, nodeAfterComment, closingComment);
  12218. } else {
  12219. removeDelimitedText(parentNode, openingComment, closingComment);
  12220. }
  12221. }
  12222. if (false) {
  12223. ReactInstrumentation.debugTool.onHostOperation({
  12224. instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
  12225. type: 'replace text',
  12226. payload: stringText
  12227. });
  12228. }
  12229. }
  12230. var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
  12231. if (false) {
  12232. dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
  12233. Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
  12234. if (prevInstance._debugID !== 0) {
  12235. ReactInstrumentation.debugTool.onHostOperation({
  12236. instanceID: prevInstance._debugID,
  12237. type: 'replace with',
  12238. payload: markup.toString()
  12239. });
  12240. } else {
  12241. var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
  12242. if (nextInstance._debugID !== 0) {
  12243. ReactInstrumentation.debugTool.onHostOperation({
  12244. instanceID: nextInstance._debugID,
  12245. type: 'mount',
  12246. payload: markup.toString()
  12247. });
  12248. }
  12249. }
  12250. };
  12251. }
  12252. /**
  12253. * Operations for updating with DOM children.
  12254. */
  12255. var DOMChildrenOperations = {
  12256. dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
  12257. replaceDelimitedText: replaceDelimitedText,
  12258. /**
  12259. * Updates a component's children by processing a series of updates. The
  12260. * update configurations are each expected to have a `parentNode` property.
  12261. *
  12262. * @param {array<object>} updates List of update configurations.
  12263. * @internal
  12264. */
  12265. processUpdates: function (parentNode, updates) {
  12266. if (false) {
  12267. var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
  12268. }
  12269. for (var k = 0; k < updates.length; k++) {
  12270. var update = updates[k];
  12271. switch (update.type) {
  12272. case 'INSERT_MARKUP':
  12273. insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
  12274. if (false) {
  12275. ReactInstrumentation.debugTool.onHostOperation({
  12276. instanceID: parentNodeDebugID,
  12277. type: 'insert child',
  12278. payload: { toIndex: update.toIndex, content: update.content.toString() }
  12279. });
  12280. }
  12281. break;
  12282. case 'MOVE_EXISTING':
  12283. moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
  12284. if (false) {
  12285. ReactInstrumentation.debugTool.onHostOperation({
  12286. instanceID: parentNodeDebugID,
  12287. type: 'move child',
  12288. payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
  12289. });
  12290. }
  12291. break;
  12292. case 'SET_MARKUP':
  12293. setInnerHTML(parentNode, update.content);
  12294. if (false) {
  12295. ReactInstrumentation.debugTool.onHostOperation({
  12296. instanceID: parentNodeDebugID,
  12297. type: 'replace children',
  12298. payload: update.content.toString()
  12299. });
  12300. }
  12301. break;
  12302. case 'TEXT_CONTENT':
  12303. setTextContent(parentNode, update.content);
  12304. if (false) {
  12305. ReactInstrumentation.debugTool.onHostOperation({
  12306. instanceID: parentNodeDebugID,
  12307. type: 'replace text',
  12308. payload: update.content.toString()
  12309. });
  12310. }
  12311. break;
  12312. case 'REMOVE_NODE':
  12313. removeChild(parentNode, update.fromNode);
  12314. if (false) {
  12315. ReactInstrumentation.debugTool.onHostOperation({
  12316. instanceID: parentNodeDebugID,
  12317. type: 'remove child',
  12318. payload: { fromIndex: update.fromIndex }
  12319. });
  12320. }
  12321. break;
  12322. }
  12323. }
  12324. }
  12325. };
  12326. module.exports = DOMChildrenOperations;
  12327. /***/ }),
  12328. /* 36 */
  12329. /***/ (function(module, exports, __webpack_require__) {
  12330. "use strict";
  12331. /**
  12332. * Copyright 2013-present, Facebook, Inc.
  12333. * All rights reserved.
  12334. *
  12335. * This source code is licensed under the BSD-style license found in the
  12336. * LICENSE file in the root directory of this source tree. An additional grant
  12337. * of patent rights can be found in the PATENTS file in the same directory.
  12338. *
  12339. */
  12340. var DOMNamespaces = {
  12341. html: 'http://www.w3.org/1999/xhtml',
  12342. mathml: 'http://www.w3.org/1998/Math/MathML',
  12343. svg: 'http://www.w3.org/2000/svg'
  12344. };
  12345. module.exports = DOMNamespaces;
  12346. /***/ }),
  12347. /* 37 */
  12348. /***/ (function(module, exports, __webpack_require__) {
  12349. "use strict";
  12350. /**
  12351. * Copyright 2013-present, Facebook, Inc.
  12352. * All rights reserved.
  12353. *
  12354. * This source code is licensed under the BSD-style license found in the
  12355. * LICENSE file in the root directory of this source tree. An additional grant
  12356. * of patent rights can be found in the PATENTS file in the same directory.
  12357. *
  12358. *
  12359. */
  12360. var _prodInvariant = __webpack_require__(2);
  12361. var invariant = __webpack_require__(0);
  12362. /**
  12363. * Injectable ordering of event plugins.
  12364. */
  12365. var eventPluginOrder = null;
  12366. /**
  12367. * Injectable mapping from names to event plugin modules.
  12368. */
  12369. var namesToPlugins = {};
  12370. /**
  12371. * Recomputes the plugin list using the injected plugins and plugin ordering.
  12372. *
  12373. * @private
  12374. */
  12375. function recomputePluginOrdering() {
  12376. if (!eventPluginOrder) {
  12377. // Wait until an `eventPluginOrder` is injected.
  12378. return;
  12379. }
  12380. for (var pluginName in namesToPlugins) {
  12381. var pluginModule = namesToPlugins[pluginName];
  12382. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  12383. !(pluginIndex > -1) ? false ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
  12384. if (EventPluginRegistry.plugins[pluginIndex]) {
  12385. continue;
  12386. }
  12387. !pluginModule.extractEvents ? false ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
  12388. EventPluginRegistry.plugins[pluginIndex] = pluginModule;
  12389. var publishedEvents = pluginModule.eventTypes;
  12390. for (var eventName in publishedEvents) {
  12391. !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? false ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
  12392. }
  12393. }
  12394. }
  12395. /**
  12396. * Publishes an event so that it can be dispatched by the supplied plugin.
  12397. *
  12398. * @param {object} dispatchConfig Dispatch configuration for the event.
  12399. * @param {object} PluginModule Plugin publishing the event.
  12400. * @return {boolean} True if the event was successfully published.
  12401. * @private
  12402. */
  12403. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  12404. !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? false ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
  12405. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  12406. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12407. if (phasedRegistrationNames) {
  12408. for (var phaseName in phasedRegistrationNames) {
  12409. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  12410. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  12411. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  12412. }
  12413. }
  12414. return true;
  12415. } else if (dispatchConfig.registrationName) {
  12416. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  12417. return true;
  12418. }
  12419. return false;
  12420. }
  12421. /**
  12422. * Publishes a registration name that is used to identify dispatched events and
  12423. * can be used with `EventPluginHub.putListener` to register listeners.
  12424. *
  12425. * @param {string} registrationName Registration name to add.
  12426. * @param {object} PluginModule Plugin publishing the event.
  12427. * @private
  12428. */
  12429. function publishRegistrationName(registrationName, pluginModule, eventName) {
  12430. !!EventPluginRegistry.registrationNameModules[registrationName] ? false ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
  12431. EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
  12432. EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  12433. if (false) {
  12434. var lowerCasedName = registrationName.toLowerCase();
  12435. EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
  12436. if (registrationName === 'onDoubleClick') {
  12437. EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
  12438. }
  12439. }
  12440. }
  12441. /**
  12442. * Registers plugins so that they can extract and dispatch events.
  12443. *
  12444. * @see {EventPluginHub}
  12445. */
  12446. var EventPluginRegistry = {
  12447. /**
  12448. * Ordered list of injected plugins.
  12449. */
  12450. plugins: [],
  12451. /**
  12452. * Mapping from event name to dispatch config
  12453. */
  12454. eventNameDispatchConfigs: {},
  12455. /**
  12456. * Mapping from registration name to plugin module
  12457. */
  12458. registrationNameModules: {},
  12459. /**
  12460. * Mapping from registration name to event name
  12461. */
  12462. registrationNameDependencies: {},
  12463. /**
  12464. * Mapping from lowercase registration names to the properly cased version,
  12465. * used to warn in the case of missing event handlers. Available
  12466. * only in __DEV__.
  12467. * @type {Object}
  12468. */
  12469. possibleRegistrationNames: false ? {} : null,
  12470. // Trust the developer to only use possibleRegistrationNames in __DEV__
  12471. /**
  12472. * Injects an ordering of plugins (by plugin name). This allows the ordering
  12473. * to be decoupled from injection of the actual plugins so that ordering is
  12474. * always deterministic regardless of packaging, on-the-fly injection, etc.
  12475. *
  12476. * @param {array} InjectedEventPluginOrder
  12477. * @internal
  12478. * @see {EventPluginHub.injection.injectEventPluginOrder}
  12479. */
  12480. injectEventPluginOrder: function (injectedEventPluginOrder) {
  12481. !!eventPluginOrder ? false ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
  12482. // Clone the ordering so it cannot be dynamically mutated.
  12483. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  12484. recomputePluginOrdering();
  12485. },
  12486. /**
  12487. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  12488. * in the ordering injected by `injectEventPluginOrder`.
  12489. *
  12490. * Plugins can be injected as part of page initialization or on-the-fly.
  12491. *
  12492. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  12493. * @internal
  12494. * @see {EventPluginHub.injection.injectEventPluginsByName}
  12495. */
  12496. injectEventPluginsByName: function (injectedNamesToPlugins) {
  12497. var isOrderingDirty = false;
  12498. for (var pluginName in injectedNamesToPlugins) {
  12499. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  12500. continue;
  12501. }
  12502. var pluginModule = injectedNamesToPlugins[pluginName];
  12503. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  12504. !!namesToPlugins[pluginName] ? false ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
  12505. namesToPlugins[pluginName] = pluginModule;
  12506. isOrderingDirty = true;
  12507. }
  12508. }
  12509. if (isOrderingDirty) {
  12510. recomputePluginOrdering();
  12511. }
  12512. },
  12513. /**
  12514. * Looks up the plugin for the supplied event.
  12515. *
  12516. * @param {object} event A synthetic event.
  12517. * @return {?object} The plugin that created the supplied event.
  12518. * @internal
  12519. */
  12520. getPluginModuleForEvent: function (event) {
  12521. var dispatchConfig = event.dispatchConfig;
  12522. if (dispatchConfig.registrationName) {
  12523. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  12524. }
  12525. if (dispatchConfig.phasedRegistrationNames !== undefined) {
  12526. // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
  12527. // that it is not undefined.
  12528. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12529. for (var phase in phasedRegistrationNames) {
  12530. if (!phasedRegistrationNames.hasOwnProperty(phase)) {
  12531. continue;
  12532. }
  12533. var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
  12534. if (pluginModule) {
  12535. return pluginModule;
  12536. }
  12537. }
  12538. }
  12539. return null;
  12540. },
  12541. /**
  12542. * Exposed for unit testing.
  12543. * @private
  12544. */
  12545. _resetEventPlugins: function () {
  12546. eventPluginOrder = null;
  12547. for (var pluginName in namesToPlugins) {
  12548. if (namesToPlugins.hasOwnProperty(pluginName)) {
  12549. delete namesToPlugins[pluginName];
  12550. }
  12551. }
  12552. EventPluginRegistry.plugins.length = 0;
  12553. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  12554. for (var eventName in eventNameDispatchConfigs) {
  12555. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  12556. delete eventNameDispatchConfigs[eventName];
  12557. }
  12558. }
  12559. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  12560. for (var registrationName in registrationNameModules) {
  12561. if (registrationNameModules.hasOwnProperty(registrationName)) {
  12562. delete registrationNameModules[registrationName];
  12563. }
  12564. }
  12565. if (false) {
  12566. var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
  12567. for (var lowerCasedName in possibleRegistrationNames) {
  12568. if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
  12569. delete possibleRegistrationNames[lowerCasedName];
  12570. }
  12571. }
  12572. }
  12573. }
  12574. };
  12575. module.exports = EventPluginRegistry;
  12576. /***/ }),
  12577. /* 38 */
  12578. /***/ (function(module, exports, __webpack_require__) {
  12579. "use strict";
  12580. /**
  12581. * Copyright 2013-present, Facebook, Inc.
  12582. * All rights reserved.
  12583. *
  12584. * This source code is licensed under the BSD-style license found in the
  12585. * LICENSE file in the root directory of this source tree. An additional grant
  12586. * of patent rights can be found in the PATENTS file in the same directory.
  12587. *
  12588. */
  12589. var _prodInvariant = __webpack_require__(2);
  12590. var ReactErrorUtils = __webpack_require__(42);
  12591. var invariant = __webpack_require__(0);
  12592. var warning = __webpack_require__(1);
  12593. /**
  12594. * Injected dependencies:
  12595. */
  12596. /**
  12597. * - `ComponentTree`: [required] Module that can convert between React instances
  12598. * and actual node references.
  12599. */
  12600. var ComponentTree;
  12601. var TreeTraversal;
  12602. var injection = {
  12603. injectComponentTree: function (Injected) {
  12604. ComponentTree = Injected;
  12605. if (false) {
  12606. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
  12607. }
  12608. },
  12609. injectTreeTraversal: function (Injected) {
  12610. TreeTraversal = Injected;
  12611. if (false) {
  12612. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
  12613. }
  12614. }
  12615. };
  12616. function isEndish(topLevelType) {
  12617. return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
  12618. }
  12619. function isMoveish(topLevelType) {
  12620. return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
  12621. }
  12622. function isStartish(topLevelType) {
  12623. return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
  12624. }
  12625. var validateEventDispatches;
  12626. if (false) {
  12627. validateEventDispatches = function (event) {
  12628. var dispatchListeners = event._dispatchListeners;
  12629. var dispatchInstances = event._dispatchInstances;
  12630. var listenersIsArr = Array.isArray(dispatchListeners);
  12631. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  12632. var instancesIsArr = Array.isArray(dispatchInstances);
  12633. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  12634. process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
  12635. };
  12636. }
  12637. /**
  12638. * Dispatch the event to the listener.
  12639. * @param {SyntheticEvent} event SyntheticEvent to handle
  12640. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  12641. * @param {function} listener Application-level callback
  12642. * @param {*} inst Internal component instance
  12643. */
  12644. function executeDispatch(event, simulated, listener, inst) {
  12645. var type = event.type || 'unknown-event';
  12646. event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
  12647. if (simulated) {
  12648. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
  12649. } else {
  12650. ReactErrorUtils.invokeGuardedCallback(type, listener, event);
  12651. }
  12652. event.currentTarget = null;
  12653. }
  12654. /**
  12655. * Standard/simple iteration through an event's collected dispatches.
  12656. */
  12657. function executeDispatchesInOrder(event, simulated) {
  12658. var dispatchListeners = event._dispatchListeners;
  12659. var dispatchInstances = event._dispatchInstances;
  12660. if (false) {
  12661. validateEventDispatches(event);
  12662. }
  12663. if (Array.isArray(dispatchListeners)) {
  12664. for (var i = 0; i < dispatchListeners.length; i++) {
  12665. if (event.isPropagationStopped()) {
  12666. break;
  12667. }
  12668. // Listeners and Instances are two parallel arrays that are always in sync.
  12669. executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
  12670. }
  12671. } else if (dispatchListeners) {
  12672. executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
  12673. }
  12674. event._dispatchListeners = null;
  12675. event._dispatchInstances = null;
  12676. }
  12677. /**
  12678. * Standard/simple iteration through an event's collected dispatches, but stops
  12679. * at the first dispatch execution returning true, and returns that id.
  12680. *
  12681. * @return {?string} id of the first dispatch execution who's listener returns
  12682. * true, or null if no listener returned true.
  12683. */
  12684. function executeDispatchesInOrderStopAtTrueImpl(event) {
  12685. var dispatchListeners = event._dispatchListeners;
  12686. var dispatchInstances = event._dispatchInstances;
  12687. if (false) {
  12688. validateEventDispatches(event);
  12689. }
  12690. if (Array.isArray(dispatchListeners)) {
  12691. for (var i = 0; i < dispatchListeners.length; i++) {
  12692. if (event.isPropagationStopped()) {
  12693. break;
  12694. }
  12695. // Listeners and Instances are two parallel arrays that are always in sync.
  12696. if (dispatchListeners[i](event, dispatchInstances[i])) {
  12697. return dispatchInstances[i];
  12698. }
  12699. }
  12700. } else if (dispatchListeners) {
  12701. if (dispatchListeners(event, dispatchInstances)) {
  12702. return dispatchInstances;
  12703. }
  12704. }
  12705. return null;
  12706. }
  12707. /**
  12708. * @see executeDispatchesInOrderStopAtTrueImpl
  12709. */
  12710. function executeDispatchesInOrderStopAtTrue(event) {
  12711. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  12712. event._dispatchInstances = null;
  12713. event._dispatchListeners = null;
  12714. return ret;
  12715. }
  12716. /**
  12717. * Execution of a "direct" dispatch - there must be at most one dispatch
  12718. * accumulated on the event or it is considered an error. It doesn't really make
  12719. * sense for an event with multiple dispatches (bubbled) to keep track of the
  12720. * return values at each dispatch execution, but it does tend to make sense when
  12721. * dealing with "direct" dispatches.
  12722. *
  12723. * @return {*} The return value of executing the single dispatch.
  12724. */
  12725. function executeDirectDispatch(event) {
  12726. if (false) {
  12727. validateEventDispatches(event);
  12728. }
  12729. var dispatchListener = event._dispatchListeners;
  12730. var dispatchInstance = event._dispatchInstances;
  12731. !!Array.isArray(dispatchListener) ? false ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
  12732. event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
  12733. var res = dispatchListener ? dispatchListener(event) : null;
  12734. event.currentTarget = null;
  12735. event._dispatchListeners = null;
  12736. event._dispatchInstances = null;
  12737. return res;
  12738. }
  12739. /**
  12740. * @param {SyntheticEvent} event
  12741. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  12742. */
  12743. function hasDispatches(event) {
  12744. return !!event._dispatchListeners;
  12745. }
  12746. /**
  12747. * General utilities that are useful in creating custom Event Plugins.
  12748. */
  12749. var EventPluginUtils = {
  12750. isEndish: isEndish,
  12751. isMoveish: isMoveish,
  12752. isStartish: isStartish,
  12753. executeDirectDispatch: executeDirectDispatch,
  12754. executeDispatchesInOrder: executeDispatchesInOrder,
  12755. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  12756. hasDispatches: hasDispatches,
  12757. getInstanceFromNode: function (node) {
  12758. return ComponentTree.getInstanceFromNode(node);
  12759. },
  12760. getNodeFromInstance: function (node) {
  12761. return ComponentTree.getNodeFromInstance(node);
  12762. },
  12763. isAncestor: function (a, b) {
  12764. return TreeTraversal.isAncestor(a, b);
  12765. },
  12766. getLowestCommonAncestor: function (a, b) {
  12767. return TreeTraversal.getLowestCommonAncestor(a, b);
  12768. },
  12769. getParentInstance: function (inst) {
  12770. return TreeTraversal.getParentInstance(inst);
  12771. },
  12772. traverseTwoPhase: function (target, fn, arg) {
  12773. return TreeTraversal.traverseTwoPhase(target, fn, arg);
  12774. },
  12775. traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
  12776. return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
  12777. },
  12778. injection: injection
  12779. };
  12780. module.exports = EventPluginUtils;
  12781. /***/ }),
  12782. /* 39 */
  12783. /***/ (function(module, exports, __webpack_require__) {
  12784. "use strict";
  12785. /**
  12786. * Copyright 2013-present, Facebook, Inc.
  12787. * All rights reserved.
  12788. *
  12789. * This source code is licensed under the BSD-style license found in the
  12790. * LICENSE file in the root directory of this source tree. An additional grant
  12791. * of patent rights can be found in the PATENTS file in the same directory.
  12792. *
  12793. *
  12794. */
  12795. /**
  12796. * Escape and wrap key so it is safe to use as a reactid
  12797. *
  12798. * @param {string} key to be escaped.
  12799. * @return {string} the escaped key.
  12800. */
  12801. function escape(key) {
  12802. var escapeRegex = /[=:]/g;
  12803. var escaperLookup = {
  12804. '=': '=0',
  12805. ':': '=2'
  12806. };
  12807. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  12808. return escaperLookup[match];
  12809. });
  12810. return '$' + escapedString;
  12811. }
  12812. /**
  12813. * Unescape and unwrap key for human-readable display
  12814. *
  12815. * @param {string} key to unescape.
  12816. * @return {string} the unescaped key.
  12817. */
  12818. function unescape(key) {
  12819. var unescapeRegex = /(=0|=2)/g;
  12820. var unescaperLookup = {
  12821. '=0': '=',
  12822. '=2': ':'
  12823. };
  12824. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  12825. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  12826. return unescaperLookup[match];
  12827. });
  12828. }
  12829. var KeyEscapeUtils = {
  12830. escape: escape,
  12831. unescape: unescape
  12832. };
  12833. module.exports = KeyEscapeUtils;
  12834. /***/ }),
  12835. /* 40 */
  12836. /***/ (function(module, exports, __webpack_require__) {
  12837. "use strict";
  12838. /**
  12839. * Copyright 2013-present, Facebook, Inc.
  12840. * All rights reserved.
  12841. *
  12842. * This source code is licensed under the BSD-style license found in the
  12843. * LICENSE file in the root directory of this source tree. An additional grant
  12844. * of patent rights can be found in the PATENTS file in the same directory.
  12845. *
  12846. */
  12847. var _prodInvariant = __webpack_require__(2);
  12848. var React = __webpack_require__(20);
  12849. var ReactPropTypesSecret = __webpack_require__(175);
  12850. var invariant = __webpack_require__(0);
  12851. var warning = __webpack_require__(1);
  12852. var hasReadOnlyValue = {
  12853. 'button': true,
  12854. 'checkbox': true,
  12855. 'image': true,
  12856. 'hidden': true,
  12857. 'radio': true,
  12858. 'reset': true,
  12859. 'submit': true
  12860. };
  12861. function _assertSingleLink(inputProps) {
  12862. !(inputProps.checkedLink == null || inputProps.valueLink == null) ? false ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0;
  12863. }
  12864. function _assertValueLink(inputProps) {
  12865. _assertSingleLink(inputProps);
  12866. !(inputProps.value == null && inputProps.onChange == null) ? false ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0;
  12867. }
  12868. function _assertCheckedLink(inputProps) {
  12869. _assertSingleLink(inputProps);
  12870. !(inputProps.checked == null && inputProps.onChange == null) ? false ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0;
  12871. }
  12872. var propTypes = {
  12873. value: function (props, propName, componentName) {
  12874. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  12875. return null;
  12876. }
  12877. 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`.');
  12878. },
  12879. checked: function (props, propName, componentName) {
  12880. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  12881. return null;
  12882. }
  12883. 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`.');
  12884. },
  12885. onChange: React.PropTypes.func
  12886. };
  12887. var loggedTypeFailures = {};
  12888. function getDeclarationErrorAddendum(owner) {
  12889. if (owner) {
  12890. var name = owner.getName();
  12891. if (name) {
  12892. return ' Check the render method of `' + name + '`.';
  12893. }
  12894. }
  12895. return '';
  12896. }
  12897. /**
  12898. * Provide a linked `value` attribute for controlled forms. You should not use
  12899. * this outside of the ReactDOM controlled form components.
  12900. */
  12901. var LinkedValueUtils = {
  12902. checkPropTypes: function (tagName, props, owner) {
  12903. for (var propName in propTypes) {
  12904. if (propTypes.hasOwnProperty(propName)) {
  12905. var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
  12906. }
  12907. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  12908. // Only monitor this failure once because there tends to be a lot of the
  12909. // same error.
  12910. loggedTypeFailures[error.message] = true;
  12911. var addendum = getDeclarationErrorAddendum(owner);
  12912. false ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
  12913. }
  12914. }
  12915. },
  12916. /**
  12917. * @param {object} inputProps Props for form component
  12918. * @return {*} current value of the input either from value prop or link.
  12919. */
  12920. getValue: function (inputProps) {
  12921. if (inputProps.valueLink) {
  12922. _assertValueLink(inputProps);
  12923. return inputProps.valueLink.value;
  12924. }
  12925. return inputProps.value;
  12926. },
  12927. /**
  12928. * @param {object} inputProps Props for form component
  12929. * @return {*} current checked status of the input either from checked prop
  12930. * or link.
  12931. */
  12932. getChecked: function (inputProps) {
  12933. if (inputProps.checkedLink) {
  12934. _assertCheckedLink(inputProps);
  12935. return inputProps.checkedLink.value;
  12936. }
  12937. return inputProps.checked;
  12938. },
  12939. /**
  12940. * @param {object} inputProps Props for form component
  12941. * @param {SyntheticEvent} event change event to handle
  12942. */
  12943. executeOnChange: function (inputProps, event) {
  12944. if (inputProps.valueLink) {
  12945. _assertValueLink(inputProps);
  12946. return inputProps.valueLink.requestChange(event.target.value);
  12947. } else if (inputProps.checkedLink) {
  12948. _assertCheckedLink(inputProps);
  12949. return inputProps.checkedLink.requestChange(event.target.checked);
  12950. } else if (inputProps.onChange) {
  12951. return inputProps.onChange.call(undefined, event);
  12952. }
  12953. }
  12954. };
  12955. module.exports = LinkedValueUtils;
  12956. /***/ }),
  12957. /* 41 */
  12958. /***/ (function(module, exports, __webpack_require__) {
  12959. "use strict";
  12960. /**
  12961. * Copyright 2014-present, Facebook, Inc.
  12962. * All rights reserved.
  12963. *
  12964. * This source code is licensed under the BSD-style license found in the
  12965. * LICENSE file in the root directory of this source tree. An additional grant
  12966. * of patent rights can be found in the PATENTS file in the same directory.
  12967. *
  12968. *
  12969. */
  12970. var _prodInvariant = __webpack_require__(2);
  12971. var invariant = __webpack_require__(0);
  12972. var injected = false;
  12973. var ReactComponentEnvironment = {
  12974. /**
  12975. * Optionally injectable hook for swapping out mount images in the middle of
  12976. * the tree.
  12977. */
  12978. replaceNodeWithMarkup: null,
  12979. /**
  12980. * Optionally injectable hook for processing a queue of child updates. Will
  12981. * later move into MultiChildComponents.
  12982. */
  12983. processChildrenUpdates: null,
  12984. injection: {
  12985. injectEnvironment: function (environment) {
  12986. !!injected ? false ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
  12987. ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
  12988. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  12989. injected = true;
  12990. }
  12991. }
  12992. };
  12993. module.exports = ReactComponentEnvironment;
  12994. /***/ }),
  12995. /* 42 */
  12996. /***/ (function(module, exports, __webpack_require__) {
  12997. "use strict";
  12998. /**
  12999. * Copyright 2013-present, Facebook, Inc.
  13000. * All rights reserved.
  13001. *
  13002. * This source code is licensed under the BSD-style license found in the
  13003. * LICENSE file in the root directory of this source tree. An additional grant
  13004. * of patent rights can be found in the PATENTS file in the same directory.
  13005. *
  13006. *
  13007. */
  13008. var caughtError = null;
  13009. /**
  13010. * Call a function while guarding against errors that happens within it.
  13011. *
  13012. * @param {String} name of the guard to use for logging or debugging
  13013. * @param {Function} func The function to invoke
  13014. * @param {*} a First argument
  13015. * @param {*} b Second argument
  13016. */
  13017. function invokeGuardedCallback(name, func, a) {
  13018. try {
  13019. func(a);
  13020. } catch (x) {
  13021. if (caughtError === null) {
  13022. caughtError = x;
  13023. }
  13024. }
  13025. }
  13026. var ReactErrorUtils = {
  13027. invokeGuardedCallback: invokeGuardedCallback,
  13028. /**
  13029. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  13030. * handler are sure to be rethrown by rethrowCaughtError.
  13031. */
  13032. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  13033. /**
  13034. * During execution of guarded functions we will capture the first error which
  13035. * we will rethrow to be handled by the top level error handler.
  13036. */
  13037. rethrowCaughtError: function () {
  13038. if (caughtError) {
  13039. var error = caughtError;
  13040. caughtError = null;
  13041. throw error;
  13042. }
  13043. }
  13044. };
  13045. if (false) {
  13046. /**
  13047. * To help development we can get better devtools integration by simulating a
  13048. * real browser event.
  13049. */
  13050. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  13051. var fakeNode = document.createElement('react');
  13052. ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
  13053. var boundFunc = func.bind(null, a);
  13054. var evtType = 'react-' + name;
  13055. fakeNode.addEventListener(evtType, boundFunc, false);
  13056. var evt = document.createEvent('Event');
  13057. // $FlowFixMe https://github.com/facebook/flow/issues/2336
  13058. evt.initEvent(evtType, false, false);
  13059. fakeNode.dispatchEvent(evt);
  13060. fakeNode.removeEventListener(evtType, boundFunc, false);
  13061. };
  13062. }
  13063. }
  13064. module.exports = ReactErrorUtils;
  13065. /***/ }),
  13066. /* 43 */
  13067. /***/ (function(module, exports, __webpack_require__) {
  13068. "use strict";
  13069. /**
  13070. * Copyright 2015-present, Facebook, Inc.
  13071. * All rights reserved.
  13072. *
  13073. * This source code is licensed under the BSD-style license found in the
  13074. * LICENSE file in the root directory of this source tree. An additional grant
  13075. * of patent rights can be found in the PATENTS file in the same directory.
  13076. *
  13077. */
  13078. var _prodInvariant = __webpack_require__(2);
  13079. var ReactCurrentOwner = __webpack_require__(13);
  13080. var ReactInstanceMap = __webpack_require__(26);
  13081. var ReactInstrumentation = __webpack_require__(10);
  13082. var ReactUpdates = __webpack_require__(11);
  13083. var invariant = __webpack_require__(0);
  13084. var warning = __webpack_require__(1);
  13085. function enqueueUpdate(internalInstance) {
  13086. ReactUpdates.enqueueUpdate(internalInstance);
  13087. }
  13088. function formatUnexpectedArgument(arg) {
  13089. var type = typeof arg;
  13090. if (type !== 'object') {
  13091. return type;
  13092. }
  13093. var displayName = arg.constructor && arg.constructor.name || type;
  13094. var keys = Object.keys(arg);
  13095. if (keys.length > 0 && keys.length < 20) {
  13096. return displayName + ' (keys: ' + keys.join(', ') + ')';
  13097. }
  13098. return displayName;
  13099. }
  13100. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  13101. var internalInstance = ReactInstanceMap.get(publicInstance);
  13102. if (!internalInstance) {
  13103. if (false) {
  13104. var ctor = publicInstance.constructor;
  13105. // Only warn when we have a callerName. Otherwise we should be silent.
  13106. // We're probably calling from enqueueCallback. We don't want to warn
  13107. // there because we already warned for the corresponding lifecycle method.
  13108. process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
  13109. }
  13110. return null;
  13111. }
  13112. if (false) {
  13113. process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
  13114. }
  13115. return internalInstance;
  13116. }
  13117. /**
  13118. * ReactUpdateQueue allows for state updates to be scheduled into a later
  13119. * reconciliation step.
  13120. */
  13121. var ReactUpdateQueue = {
  13122. /**
  13123. * Checks whether or not this composite component is mounted.
  13124. * @param {ReactClass} publicInstance The instance we want to test.
  13125. * @return {boolean} True if mounted, false otherwise.
  13126. * @protected
  13127. * @final
  13128. */
  13129. isMounted: function (publicInstance) {
  13130. if (false) {
  13131. var owner = ReactCurrentOwner.current;
  13132. if (owner !== null) {
  13133. process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%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.', owner.getName() || 'A component') : void 0;
  13134. owner._warnedAboutRefsInRender = true;
  13135. }
  13136. }
  13137. var internalInstance = ReactInstanceMap.get(publicInstance);
  13138. if (internalInstance) {
  13139. // During componentWillMount and render this will still be null but after
  13140. // that will always render to something. At least for now. So we can use
  13141. // this hack.
  13142. return !!internalInstance._renderedComponent;
  13143. } else {
  13144. return false;
  13145. }
  13146. },
  13147. /**
  13148. * Enqueue a callback that will be executed after all the pending updates
  13149. * have processed.
  13150. *
  13151. * @param {ReactClass} publicInstance The instance to use as `this` context.
  13152. * @param {?function} callback Called after state is updated.
  13153. * @param {string} callerName Name of the calling function in the public API.
  13154. * @internal
  13155. */
  13156. enqueueCallback: function (publicInstance, callback, callerName) {
  13157. ReactUpdateQueue.validateCallback(callback, callerName);
  13158. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  13159. // Previously we would throw an error if we didn't have an internal
  13160. // instance. Since we want to make it a no-op instead, we mirror the same
  13161. // behavior we have in other enqueue* methods.
  13162. // We also need to ignore callbacks in componentWillMount. See
  13163. // enqueueUpdates.
  13164. if (!internalInstance) {
  13165. return null;
  13166. }
  13167. if (internalInstance._pendingCallbacks) {
  13168. internalInstance._pendingCallbacks.push(callback);
  13169. } else {
  13170. internalInstance._pendingCallbacks = [callback];
  13171. }
  13172. // TODO: The callback here is ignored when setState is called from
  13173. // componentWillMount. Either fix it or disallow doing so completely in
  13174. // favor of getInitialState. Alternatively, we can disallow
  13175. // componentWillMount during server-side rendering.
  13176. enqueueUpdate(internalInstance);
  13177. },
  13178. enqueueCallbackInternal: function (internalInstance, callback) {
  13179. if (internalInstance._pendingCallbacks) {
  13180. internalInstance._pendingCallbacks.push(callback);
  13181. } else {
  13182. internalInstance._pendingCallbacks = [callback];
  13183. }
  13184. enqueueUpdate(internalInstance);
  13185. },
  13186. /**
  13187. * Forces an update. This should only be invoked when it is known with
  13188. * certainty that we are **not** in a DOM transaction.
  13189. *
  13190. * You may want to call this when you know that some deeper aspect of the
  13191. * component's state has changed but `setState` was not called.
  13192. *
  13193. * This will not invoke `shouldComponentUpdate`, but it will invoke
  13194. * `componentWillUpdate` and `componentDidUpdate`.
  13195. *
  13196. * @param {ReactClass} publicInstance The instance that should rerender.
  13197. * @internal
  13198. */
  13199. enqueueForceUpdate: function (publicInstance) {
  13200. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  13201. if (!internalInstance) {
  13202. return;
  13203. }
  13204. internalInstance._pendingForceUpdate = true;
  13205. enqueueUpdate(internalInstance);
  13206. },
  13207. /**
  13208. * Replaces all of the state. Always use this or `setState` to mutate state.
  13209. * You should treat `this.state` as immutable.
  13210. *
  13211. * There is no guarantee that `this.state` will be immediately updated, so
  13212. * accessing `this.state` after calling this method may return the old value.
  13213. *
  13214. * @param {ReactClass} publicInstance The instance that should rerender.
  13215. * @param {object} completeState Next state.
  13216. * @internal
  13217. */
  13218. enqueueReplaceState: function (publicInstance, completeState) {
  13219. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  13220. if (!internalInstance) {
  13221. return;
  13222. }
  13223. internalInstance._pendingStateQueue = [completeState];
  13224. internalInstance._pendingReplaceState = true;
  13225. enqueueUpdate(internalInstance);
  13226. },
  13227. /**
  13228. * Sets a subset of the state. This only exists because _pendingState is
  13229. * internal. This provides a merging strategy that is not available to deep
  13230. * properties which is confusing. TODO: Expose pendingState or don't use it
  13231. * during the merge.
  13232. *
  13233. * @param {ReactClass} publicInstance The instance that should rerender.
  13234. * @param {object} partialState Next partial state to be merged with state.
  13235. * @internal
  13236. */
  13237. enqueueSetState: function (publicInstance, partialState) {
  13238. if (false) {
  13239. ReactInstrumentation.debugTool.onSetState();
  13240. process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
  13241. }
  13242. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  13243. if (!internalInstance) {
  13244. return;
  13245. }
  13246. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  13247. queue.push(partialState);
  13248. enqueueUpdate(internalInstance);
  13249. },
  13250. enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
  13251. internalInstance._pendingElement = nextElement;
  13252. // TODO: introduce _pendingContext instead of setting it directly.
  13253. internalInstance._context = nextContext;
  13254. enqueueUpdate(internalInstance);
  13255. },
  13256. validateCallback: function (callback, callerName) {
  13257. !(!callback || typeof callback === 'function') ? false ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
  13258. }
  13259. };
  13260. module.exports = ReactUpdateQueue;
  13261. /***/ }),
  13262. /* 44 */
  13263. /***/ (function(module, exports, __webpack_require__) {
  13264. "use strict";
  13265. /**
  13266. * Copyright 2013-present, Facebook, Inc.
  13267. * All rights reserved.
  13268. *
  13269. * This source code is licensed under the BSD-style license found in the
  13270. * LICENSE file in the root directory of this source tree. An additional grant
  13271. * of patent rights can be found in the PATENTS file in the same directory.
  13272. *
  13273. */
  13274. /* globals MSApp */
  13275. /**
  13276. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  13277. */
  13278. var createMicrosoftUnsafeLocalFunction = function (func) {
  13279. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  13280. return function (arg0, arg1, arg2, arg3) {
  13281. MSApp.execUnsafeLocalFunction(function () {
  13282. return func(arg0, arg1, arg2, arg3);
  13283. });
  13284. };
  13285. } else {
  13286. return func;
  13287. }
  13288. };
  13289. module.exports = createMicrosoftUnsafeLocalFunction;
  13290. /***/ }),
  13291. /* 45 */
  13292. /***/ (function(module, exports, __webpack_require__) {
  13293. "use strict";
  13294. /**
  13295. * Copyright 2013-present, Facebook, Inc.
  13296. * All rights reserved.
  13297. *
  13298. * This source code is licensed under the BSD-style license found in the
  13299. * LICENSE file in the root directory of this source tree. An additional grant
  13300. * of patent rights can be found in the PATENTS file in the same directory.
  13301. *
  13302. */
  13303. /**
  13304. * `charCode` represents the actual "character code" and is safe to use with
  13305. * `String.fromCharCode`. As such, only keys that correspond to printable
  13306. * characters produce a valid `charCode`, the only exception to this is Enter.
  13307. * The Tab-key is considered non-printable and does not have a `charCode`,
  13308. * presumably because it does not produce a tab-character in browsers.
  13309. *
  13310. * @param {object} nativeEvent Native browser event.
  13311. * @return {number} Normalized `charCode` property.
  13312. */
  13313. function getEventCharCode(nativeEvent) {
  13314. var charCode;
  13315. var keyCode = nativeEvent.keyCode;
  13316. if ('charCode' in nativeEvent) {
  13317. charCode = nativeEvent.charCode;
  13318. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  13319. if (charCode === 0 && keyCode === 13) {
  13320. charCode = 13;
  13321. }
  13322. } else {
  13323. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  13324. charCode = keyCode;
  13325. }
  13326. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  13327. // Must not discard the (non-)printable Enter-key.
  13328. if (charCode >= 32 || charCode === 13) {
  13329. return charCode;
  13330. }
  13331. return 0;
  13332. }
  13333. module.exports = getEventCharCode;
  13334. /***/ }),
  13335. /* 46 */
  13336. /***/ (function(module, exports, __webpack_require__) {
  13337. "use strict";
  13338. /**
  13339. * Copyright 2013-present, Facebook, Inc.
  13340. * All rights reserved.
  13341. *
  13342. * This source code is licensed under the BSD-style license found in the
  13343. * LICENSE file in the root directory of this source tree. An additional grant
  13344. * of patent rights can be found in the PATENTS file in the same directory.
  13345. *
  13346. */
  13347. /**
  13348. * Translation from modifier key to the associated property in the event.
  13349. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  13350. */
  13351. var modifierKeyToProp = {
  13352. 'Alt': 'altKey',
  13353. 'Control': 'ctrlKey',
  13354. 'Meta': 'metaKey',
  13355. 'Shift': 'shiftKey'
  13356. };
  13357. // IE8 does not implement getModifierState so we simply map it to the only
  13358. // modifier keys exposed by the event itself, does not support Lock-keys.
  13359. // Currently, all major browsers except Chrome seems to support Lock-keys.
  13360. function modifierStateGetter(keyArg) {
  13361. var syntheticEvent = this;
  13362. var nativeEvent = syntheticEvent.nativeEvent;
  13363. if (nativeEvent.getModifierState) {
  13364. return nativeEvent.getModifierState(keyArg);
  13365. }
  13366. var keyProp = modifierKeyToProp[keyArg];
  13367. return keyProp ? !!nativeEvent[keyProp] : false;
  13368. }
  13369. function getEventModifierState(nativeEvent) {
  13370. return modifierStateGetter;
  13371. }
  13372. module.exports = getEventModifierState;
  13373. /***/ }),
  13374. /* 47 */
  13375. /***/ (function(module, exports, __webpack_require__) {
  13376. "use strict";
  13377. /**
  13378. * Copyright 2013-present, Facebook, Inc.
  13379. * All rights reserved.
  13380. *
  13381. * This source code is licensed under the BSD-style license found in the
  13382. * LICENSE file in the root directory of this source tree. An additional grant
  13383. * of patent rights can be found in the PATENTS file in the same directory.
  13384. *
  13385. */
  13386. /**
  13387. * Gets the target node from a native browser event by accounting for
  13388. * inconsistencies in browser DOM APIs.
  13389. *
  13390. * @param {object} nativeEvent Native browser event.
  13391. * @return {DOMEventTarget} Target node.
  13392. */
  13393. function getEventTarget(nativeEvent) {
  13394. var target = nativeEvent.target || nativeEvent.srcElement || window;
  13395. // Normalize SVG <use> element events #4963
  13396. if (target.correspondingUseElement) {
  13397. target = target.correspondingUseElement;
  13398. }
  13399. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  13400. // @see http://www.quirksmode.org/js/events_properties.html
  13401. return target.nodeType === 3 ? target.parentNode : target;
  13402. }
  13403. module.exports = getEventTarget;
  13404. /***/ }),
  13405. /* 48 */
  13406. /***/ (function(module, exports, __webpack_require__) {
  13407. "use strict";
  13408. /**
  13409. * Copyright 2013-present, Facebook, Inc.
  13410. * All rights reserved.
  13411. *
  13412. * This source code is licensed under the BSD-style license found in the
  13413. * LICENSE file in the root directory of this source tree. An additional grant
  13414. * of patent rights can be found in the PATENTS file in the same directory.
  13415. *
  13416. */
  13417. var ExecutionEnvironment = __webpack_require__(5);
  13418. var useHasFeature;
  13419. if (ExecutionEnvironment.canUseDOM) {
  13420. useHasFeature = document.implementation && document.implementation.hasFeature &&
  13421. // always returns true in newer browsers as per the standard.
  13422. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  13423. document.implementation.hasFeature('', '') !== true;
  13424. }
  13425. /**
  13426. * Checks if an event is supported in the current execution environment.
  13427. *
  13428. * NOTE: This will not work correctly for non-generic events such as `change`,
  13429. * `reset`, `load`, `error`, and `select`.
  13430. *
  13431. * Borrows from Modernizr.
  13432. *
  13433. * @param {string} eventNameSuffix Event name, e.g. "click".
  13434. * @param {?boolean} capture Check if the capture phase is supported.
  13435. * @return {boolean} True if the event is supported.
  13436. * @internal
  13437. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  13438. */
  13439. function isEventSupported(eventNameSuffix, capture) {
  13440. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  13441. return false;
  13442. }
  13443. var eventName = 'on' + eventNameSuffix;
  13444. var isSupported = eventName in document;
  13445. if (!isSupported) {
  13446. var element = document.createElement('div');
  13447. element.setAttribute(eventName, 'return;');
  13448. isSupported = typeof element[eventName] === 'function';
  13449. }
  13450. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  13451. // This is the only way to test support for the `wheel` event in IE9+.
  13452. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  13453. }
  13454. return isSupported;
  13455. }
  13456. module.exports = isEventSupported;
  13457. /***/ }),
  13458. /* 49 */
  13459. /***/ (function(module, exports, __webpack_require__) {
  13460. "use strict";
  13461. /**
  13462. * Copyright 2013-present, Facebook, Inc.
  13463. * All rights reserved.
  13464. *
  13465. * This source code is licensed under the BSD-style license found in the
  13466. * LICENSE file in the root directory of this source tree. An additional grant
  13467. * of patent rights can be found in the PATENTS file in the same directory.
  13468. *
  13469. */
  13470. /**
  13471. * Given a `prevElement` and `nextElement`, determines if the existing
  13472. * instance should be updated as opposed to being destroyed or replaced by a new
  13473. * instance. Both arguments are elements. This ensures that this logic can
  13474. * operate on stateless trees without any backing instance.
  13475. *
  13476. * @param {?object} prevElement
  13477. * @param {?object} nextElement
  13478. * @return {boolean} True if the existing instance should be updated.
  13479. * @protected
  13480. */
  13481. function shouldUpdateReactComponent(prevElement, nextElement) {
  13482. var prevEmpty = prevElement === null || prevElement === false;
  13483. var nextEmpty = nextElement === null || nextElement === false;
  13484. if (prevEmpty || nextEmpty) {
  13485. return prevEmpty === nextEmpty;
  13486. }
  13487. var prevType = typeof prevElement;
  13488. var nextType = typeof nextElement;
  13489. if (prevType === 'string' || prevType === 'number') {
  13490. return nextType === 'string' || nextType === 'number';
  13491. } else {
  13492. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  13493. }
  13494. }
  13495. module.exports = shouldUpdateReactComponent;
  13496. /***/ }),
  13497. /* 50 */
  13498. /***/ (function(module, exports, __webpack_require__) {
  13499. "use strict";
  13500. /**
  13501. * Copyright 2015-present, Facebook, Inc.
  13502. * All rights reserved.
  13503. *
  13504. * This source code is licensed under the BSD-style license found in the
  13505. * LICENSE file in the root directory of this source tree. An additional grant
  13506. * of patent rights can be found in the PATENTS file in the same directory.
  13507. *
  13508. */
  13509. var _assign = __webpack_require__(3);
  13510. var emptyFunction = __webpack_require__(9);
  13511. var warning = __webpack_require__(1);
  13512. var validateDOMNesting = emptyFunction;
  13513. if (false) {
  13514. // This validation code was written based on the HTML5 parsing spec:
  13515. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  13516. //
  13517. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  13518. // not clear what practical benefit doing so provides); instead, we warn only
  13519. // for cases where the parser will give a parse tree differing from what React
  13520. // intended. For example, <b><div></div></b> is invalid but we don't warn
  13521. // because it still parses correctly; we do warn for other cases like nested
  13522. // <p> tags where the beginning of the second element implicitly closes the
  13523. // first, causing a confusing mess.
  13524. // https://html.spec.whatwg.org/multipage/syntax.html#special
  13525. 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'];
  13526. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  13527. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  13528. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  13529. // TODO: Distinguish by namespace here -- for <title>, including it here
  13530. // errs on the side of fewer warnings
  13531. 'foreignObject', 'desc', 'title'];
  13532. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  13533. var buttonScopeTags = inScopeTags.concat(['button']);
  13534. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  13535. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  13536. var emptyAncestorInfo = {
  13537. current: null,
  13538. formTag: null,
  13539. aTagInScope: null,
  13540. buttonTagInScope: null,
  13541. nobrTagInScope: null,
  13542. pTagInButtonScope: null,
  13543. listItemTagAutoclosing: null,
  13544. dlItemTagAutoclosing: null
  13545. };
  13546. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  13547. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  13548. var info = { tag: tag, instance: instance };
  13549. if (inScopeTags.indexOf(tag) !== -1) {
  13550. ancestorInfo.aTagInScope = null;
  13551. ancestorInfo.buttonTagInScope = null;
  13552. ancestorInfo.nobrTagInScope = null;
  13553. }
  13554. if (buttonScopeTags.indexOf(tag) !== -1) {
  13555. ancestorInfo.pTagInButtonScope = null;
  13556. }
  13557. // See rules for 'li', 'dd', 'dt' start tags in
  13558. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  13559. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  13560. ancestorInfo.listItemTagAutoclosing = null;
  13561. ancestorInfo.dlItemTagAutoclosing = null;
  13562. }
  13563. ancestorInfo.current = info;
  13564. if (tag === 'form') {
  13565. ancestorInfo.formTag = info;
  13566. }
  13567. if (tag === 'a') {
  13568. ancestorInfo.aTagInScope = info;
  13569. }
  13570. if (tag === 'button') {
  13571. ancestorInfo.buttonTagInScope = info;
  13572. }
  13573. if (tag === 'nobr') {
  13574. ancestorInfo.nobrTagInScope = info;
  13575. }
  13576. if (tag === 'p') {
  13577. ancestorInfo.pTagInButtonScope = info;
  13578. }
  13579. if (tag === 'li') {
  13580. ancestorInfo.listItemTagAutoclosing = info;
  13581. }
  13582. if (tag === 'dd' || tag === 'dt') {
  13583. ancestorInfo.dlItemTagAutoclosing = info;
  13584. }
  13585. return ancestorInfo;
  13586. };
  13587. /**
  13588. * Returns whether
  13589. */
  13590. var isTagValidWithParent = function (tag, parentTag) {
  13591. // First, let's check if we're in an unusual parsing mode...
  13592. switch (parentTag) {
  13593. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  13594. case 'select':
  13595. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  13596. case 'optgroup':
  13597. return tag === 'option' || tag === '#text';
  13598. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  13599. // but
  13600. case 'option':
  13601. return tag === '#text';
  13602. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  13603. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  13604. // No special behavior since these rules fall back to "in body" mode for
  13605. // all except special table nodes which cause bad parsing behavior anyway.
  13606. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  13607. case 'tr':
  13608. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  13609. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  13610. case 'tbody':
  13611. case 'thead':
  13612. case 'tfoot':
  13613. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  13614. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  13615. case 'colgroup':
  13616. return tag === 'col' || tag === 'template';
  13617. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  13618. case 'table':
  13619. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  13620. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  13621. case 'head':
  13622. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  13623. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  13624. case 'html':
  13625. return tag === 'head' || tag === 'body';
  13626. case '#document':
  13627. return tag === 'html';
  13628. }
  13629. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  13630. // where the parsing rules cause implicit opens or closes to be added.
  13631. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  13632. switch (tag) {
  13633. case 'h1':
  13634. case 'h2':
  13635. case 'h3':
  13636. case 'h4':
  13637. case 'h5':
  13638. case 'h6':
  13639. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  13640. case 'rp':
  13641. case 'rt':
  13642. return impliedEndTags.indexOf(parentTag) === -1;
  13643. case 'body':
  13644. case 'caption':
  13645. case 'col':
  13646. case 'colgroup':
  13647. case 'frame':
  13648. case 'head':
  13649. case 'html':
  13650. case 'tbody':
  13651. case 'td':
  13652. case 'tfoot':
  13653. case 'th':
  13654. case 'thead':
  13655. case 'tr':
  13656. // These tags are only valid with a few parents that have special child
  13657. // parsing rules -- if we're down here, then none of those matched and
  13658. // so we allow it only if we don't know what the parent is, as all other
  13659. // cases are invalid.
  13660. return parentTag == null;
  13661. }
  13662. return true;
  13663. };
  13664. /**
  13665. * Returns whether
  13666. */
  13667. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  13668. switch (tag) {
  13669. case 'address':
  13670. case 'article':
  13671. case 'aside':
  13672. case 'blockquote':
  13673. case 'center':
  13674. case 'details':
  13675. case 'dialog':
  13676. case 'dir':
  13677. case 'div':
  13678. case 'dl':
  13679. case 'fieldset':
  13680. case 'figcaption':
  13681. case 'figure':
  13682. case 'footer':
  13683. case 'header':
  13684. case 'hgroup':
  13685. case 'main':
  13686. case 'menu':
  13687. case 'nav':
  13688. case 'ol':
  13689. case 'p':
  13690. case 'section':
  13691. case 'summary':
  13692. case 'ul':
  13693. case 'pre':
  13694. case 'listing':
  13695. case 'table':
  13696. case 'hr':
  13697. case 'xmp':
  13698. case 'h1':
  13699. case 'h2':
  13700. case 'h3':
  13701. case 'h4':
  13702. case 'h5':
  13703. case 'h6':
  13704. return ancestorInfo.pTagInButtonScope;
  13705. case 'form':
  13706. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  13707. case 'li':
  13708. return ancestorInfo.listItemTagAutoclosing;
  13709. case 'dd':
  13710. case 'dt':
  13711. return ancestorInfo.dlItemTagAutoclosing;
  13712. case 'button':
  13713. return ancestorInfo.buttonTagInScope;
  13714. case 'a':
  13715. // Spec says something about storing a list of markers, but it sounds
  13716. // equivalent to this check.
  13717. return ancestorInfo.aTagInScope;
  13718. case 'nobr':
  13719. return ancestorInfo.nobrTagInScope;
  13720. }
  13721. return null;
  13722. };
  13723. /**
  13724. * Given a ReactCompositeComponent instance, return a list of its recursive
  13725. * owners, starting at the root and ending with the instance itself.
  13726. */
  13727. var findOwnerStack = function (instance) {
  13728. if (!instance) {
  13729. return [];
  13730. }
  13731. var stack = [];
  13732. do {
  13733. stack.push(instance);
  13734. } while (instance = instance._currentElement._owner);
  13735. stack.reverse();
  13736. return stack;
  13737. };
  13738. var didWarn = {};
  13739. validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
  13740. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  13741. var parentInfo = ancestorInfo.current;
  13742. var parentTag = parentInfo && parentInfo.tag;
  13743. if (childText != null) {
  13744. process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
  13745. childTag = '#text';
  13746. }
  13747. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  13748. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  13749. var problematic = invalidParent || invalidAncestor;
  13750. if (problematic) {
  13751. var ancestorTag = problematic.tag;
  13752. var ancestorInstance = problematic.instance;
  13753. var childOwner = childInstance && childInstance._currentElement._owner;
  13754. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  13755. var childOwners = findOwnerStack(childOwner);
  13756. var ancestorOwners = findOwnerStack(ancestorOwner);
  13757. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  13758. var i;
  13759. var deepestCommon = -1;
  13760. for (i = 0; i < minStackLen; i++) {
  13761. if (childOwners[i] === ancestorOwners[i]) {
  13762. deepestCommon = i;
  13763. } else {
  13764. break;
  13765. }
  13766. }
  13767. var UNKNOWN = '(unknown)';
  13768. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  13769. return inst.getName() || UNKNOWN;
  13770. });
  13771. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  13772. return inst.getName() || UNKNOWN;
  13773. });
  13774. var ownerInfo = [].concat(
  13775. // If the parent and child instances have a common owner ancestor, start
  13776. // with that -- otherwise we just start with the parent's owners.
  13777. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  13778. // If we're warning about an invalid (non-parent) ancestry, add '...'
  13779. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  13780. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  13781. if (didWarn[warnKey]) {
  13782. return;
  13783. }
  13784. didWarn[warnKey] = true;
  13785. var tagDisplayName = childTag;
  13786. var whitespaceInfo = '';
  13787. if (childTag === '#text') {
  13788. if (/\S/.test(childText)) {
  13789. tagDisplayName = 'Text nodes';
  13790. } else {
  13791. tagDisplayName = 'Whitespace text nodes';
  13792. whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
  13793. }
  13794. } else {
  13795. tagDisplayName = '<' + childTag + '>';
  13796. }
  13797. if (invalidParent) {
  13798. var info = '';
  13799. if (ancestorTag === 'table' && childTag === 'tr') {
  13800. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  13801. }
  13802. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0;
  13803. } else {
  13804. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
  13805. }
  13806. }
  13807. };
  13808. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  13809. // For testing
  13810. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  13811. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  13812. var parentInfo = ancestorInfo.current;
  13813. var parentTag = parentInfo && parentInfo.tag;
  13814. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  13815. };
  13816. }
  13817. module.exports = validateDOMNesting;
  13818. /***/ }),
  13819. /* 51 */
  13820. /***/ (function(module, exports, __webpack_require__) {
  13821. "use strict";
  13822. /**
  13823. * Copyright 2013-present, Facebook, Inc.
  13824. * All rights reserved.
  13825. *
  13826. * This source code is licensed under the BSD-style license found in the
  13827. * LICENSE file in the root directory of this source tree. An additional grant
  13828. * of patent rights can be found in the PATENTS file in the same directory.
  13829. *
  13830. */
  13831. var _prodInvariant = __webpack_require__(22);
  13832. var ReactNoopUpdateQueue = __webpack_require__(52);
  13833. var canDefineProperty = __webpack_require__(81);
  13834. var emptyObject = __webpack_require__(23);
  13835. var invariant = __webpack_require__(0);
  13836. var warning = __webpack_require__(1);
  13837. /**
  13838. * Base class helpers for the updating state of a component.
  13839. */
  13840. function ReactComponent(props, context, updater) {
  13841. this.props = props;
  13842. this.context = context;
  13843. this.refs = emptyObject;
  13844. // We initialize the default updater but the real one gets injected by the
  13845. // renderer.
  13846. this.updater = updater || ReactNoopUpdateQueue;
  13847. }
  13848. ReactComponent.prototype.isReactComponent = {};
  13849. /**
  13850. * Sets a subset of the state. Always use this to mutate
  13851. * state. You should treat `this.state` as immutable.
  13852. *
  13853. * There is no guarantee that `this.state` will be immediately updated, so
  13854. * accessing `this.state` after calling this method may return the old value.
  13855. *
  13856. * There is no guarantee that calls to `setState` will run synchronously,
  13857. * as they may eventually be batched together. You can provide an optional
  13858. * callback that will be executed when the call to setState is actually
  13859. * completed.
  13860. *
  13861. * When a function is provided to setState, it will be called at some point in
  13862. * the future (not synchronously). It will be called with the up to date
  13863. * component arguments (state, props, context). These values can be different
  13864. * from this.* because your function may be called after receiveProps but before
  13865. * shouldComponentUpdate, and this new state, props, and context will not yet be
  13866. * assigned to this.
  13867. *
  13868. * @param {object|function} partialState Next partial state or function to
  13869. * produce next partial state to be merged with current state.
  13870. * @param {?function} callback Called after state is updated.
  13871. * @final
  13872. * @protected
  13873. */
  13874. ReactComponent.prototype.setState = function (partialState, callback) {
  13875. !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? false ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
  13876. this.updater.enqueueSetState(this, partialState);
  13877. if (callback) {
  13878. this.updater.enqueueCallback(this, callback, 'setState');
  13879. }
  13880. };
  13881. /**
  13882. * Forces an update. This should only be invoked when it is known with
  13883. * certainty that we are **not** in a DOM transaction.
  13884. *
  13885. * You may want to call this when you know that some deeper aspect of the
  13886. * component's state has changed but `setState` was not called.
  13887. *
  13888. * This will not invoke `shouldComponentUpdate`, but it will invoke
  13889. * `componentWillUpdate` and `componentDidUpdate`.
  13890. *
  13891. * @param {?function} callback Called after update is complete.
  13892. * @final
  13893. * @protected
  13894. */
  13895. ReactComponent.prototype.forceUpdate = function (callback) {
  13896. this.updater.enqueueForceUpdate(this);
  13897. if (callback) {
  13898. this.updater.enqueueCallback(this, callback, 'forceUpdate');
  13899. }
  13900. };
  13901. /**
  13902. * Deprecated APIs. These APIs used to exist on classic React classes but since
  13903. * we would like to deprecate them, we're not going to move them over to this
  13904. * modern base class. Instead, we define a getter that warns if it's accessed.
  13905. */
  13906. if (false) {
  13907. var deprecatedAPIs = {
  13908. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  13909. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  13910. };
  13911. var defineDeprecationWarning = function (methodName, info) {
  13912. if (canDefineProperty) {
  13913. Object.defineProperty(ReactComponent.prototype, methodName, {
  13914. get: function () {
  13915. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
  13916. return undefined;
  13917. }
  13918. });
  13919. }
  13920. };
  13921. for (var fnName in deprecatedAPIs) {
  13922. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  13923. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  13924. }
  13925. }
  13926. }
  13927. module.exports = ReactComponent;
  13928. /***/ }),
  13929. /* 52 */
  13930. /***/ (function(module, exports, __webpack_require__) {
  13931. "use strict";
  13932. /**
  13933. * Copyright 2015-present, Facebook, Inc.
  13934. * All rights reserved.
  13935. *
  13936. * This source code is licensed under the BSD-style license found in the
  13937. * LICENSE file in the root directory of this source tree. An additional grant
  13938. * of patent rights can be found in the PATENTS file in the same directory.
  13939. *
  13940. */
  13941. var warning = __webpack_require__(1);
  13942. function warnNoop(publicInstance, callerName) {
  13943. if (false) {
  13944. var constructor = publicInstance.constructor;
  13945. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
  13946. }
  13947. }
  13948. /**
  13949. * This is the abstract API for an update queue.
  13950. */
  13951. var ReactNoopUpdateQueue = {
  13952. /**
  13953. * Checks whether or not this composite component is mounted.
  13954. * @param {ReactClass} publicInstance The instance we want to test.
  13955. * @return {boolean} True if mounted, false otherwise.
  13956. * @protected
  13957. * @final
  13958. */
  13959. isMounted: function (publicInstance) {
  13960. return false;
  13961. },
  13962. /**
  13963. * Enqueue a callback that will be executed after all the pending updates
  13964. * have processed.
  13965. *
  13966. * @param {ReactClass} publicInstance The instance to use as `this` context.
  13967. * @param {?function} callback Called after state is updated.
  13968. * @internal
  13969. */
  13970. enqueueCallback: function (publicInstance, callback) {},
  13971. /**
  13972. * Forces an update. This should only be invoked when it is known with
  13973. * certainty that we are **not** in a DOM transaction.
  13974. *
  13975. * You may want to call this when you know that some deeper aspect of the
  13976. * component's state has changed but `setState` was not called.
  13977. *
  13978. * This will not invoke `shouldComponentUpdate`, but it will invoke
  13979. * `componentWillUpdate` and `componentDidUpdate`.
  13980. *
  13981. * @param {ReactClass} publicInstance The instance that should rerender.
  13982. * @internal
  13983. */
  13984. enqueueForceUpdate: function (publicInstance) {
  13985. warnNoop(publicInstance, 'forceUpdate');
  13986. },
  13987. /**
  13988. * Replaces all of the state. Always use this or `setState` to mutate state.
  13989. * You should treat `this.state` as immutable.
  13990. *
  13991. * There is no guarantee that `this.state` will be immediately updated, so
  13992. * accessing `this.state` after calling this method may return the old value.
  13993. *
  13994. * @param {ReactClass} publicInstance The instance that should rerender.
  13995. * @param {object} completeState Next state.
  13996. * @internal
  13997. */
  13998. enqueueReplaceState: function (publicInstance, completeState) {
  13999. warnNoop(publicInstance, 'replaceState');
  14000. },
  14001. /**
  14002. * Sets a subset of the state. This only exists because _pendingState is
  14003. * internal. This provides a merging strategy that is not available to deep
  14004. * properties which is confusing. TODO: Expose pendingState or don't use it
  14005. * during the merge.
  14006. *
  14007. * @param {ReactClass} publicInstance The instance that should rerender.
  14008. * @param {object} partialState Next partial state to be merged with state.
  14009. * @internal
  14010. */
  14011. enqueueSetState: function (publicInstance, partialState) {
  14012. warnNoop(publicInstance, 'setState');
  14013. }
  14014. };
  14015. module.exports = ReactNoopUpdateQueue;
  14016. /***/ }),
  14017. /* 53 */
  14018. /***/ (function(module, exports) {
  14019. // shim for using process in browser
  14020. var process = module.exports = {};
  14021. // cached from whatever global is present so that test runners that stub it
  14022. // don't break things. But we need to wrap it in a try catch in case it is
  14023. // wrapped in strict mode code which doesn't define any globals. It's inside a
  14024. // function because try/catches deoptimize in certain engines.
  14025. var cachedSetTimeout;
  14026. var cachedClearTimeout;
  14027. function defaultSetTimout() {
  14028. throw new Error('setTimeout has not been defined');
  14029. }
  14030. function defaultClearTimeout () {
  14031. throw new Error('clearTimeout has not been defined');
  14032. }
  14033. (function () {
  14034. try {
  14035. if (typeof setTimeout === 'function') {
  14036. cachedSetTimeout = setTimeout;
  14037. } else {
  14038. cachedSetTimeout = defaultSetTimout;
  14039. }
  14040. } catch (e) {
  14041. cachedSetTimeout = defaultSetTimout;
  14042. }
  14043. try {
  14044. if (typeof clearTimeout === 'function') {
  14045. cachedClearTimeout = clearTimeout;
  14046. } else {
  14047. cachedClearTimeout = defaultClearTimeout;
  14048. }
  14049. } catch (e) {
  14050. cachedClearTimeout = defaultClearTimeout;
  14051. }
  14052. } ())
  14053. function runTimeout(fun) {
  14054. if (cachedSetTimeout === setTimeout) {
  14055. //normal enviroments in sane situations
  14056. return setTimeout(fun, 0);
  14057. }
  14058. // if setTimeout wasn't available but was latter defined
  14059. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  14060. cachedSetTimeout = setTimeout;
  14061. return setTimeout(fun, 0);
  14062. }
  14063. try {
  14064. // when when somebody has screwed with setTimeout but no I.E. maddness
  14065. return cachedSetTimeout(fun, 0);
  14066. } catch(e){
  14067. try {
  14068. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14069. return cachedSetTimeout.call(null, fun, 0);
  14070. } catch(e){
  14071. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  14072. return cachedSetTimeout.call(this, fun, 0);
  14073. }
  14074. }
  14075. }
  14076. function runClearTimeout(marker) {
  14077. if (cachedClearTimeout === clearTimeout) {
  14078. //normal enviroments in sane situations
  14079. return clearTimeout(marker);
  14080. }
  14081. // if clearTimeout wasn't available but was latter defined
  14082. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  14083. cachedClearTimeout = clearTimeout;
  14084. return clearTimeout(marker);
  14085. }
  14086. try {
  14087. // when when somebody has screwed with setTimeout but no I.E. maddness
  14088. return cachedClearTimeout(marker);
  14089. } catch (e){
  14090. try {
  14091. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14092. return cachedClearTimeout.call(null, marker);
  14093. } catch (e){
  14094. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  14095. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  14096. return cachedClearTimeout.call(this, marker);
  14097. }
  14098. }
  14099. }
  14100. var queue = [];
  14101. var draining = false;
  14102. var currentQueue;
  14103. var queueIndex = -1;
  14104. function cleanUpNextTick() {
  14105. if (!draining || !currentQueue) {
  14106. return;
  14107. }
  14108. draining = false;
  14109. if (currentQueue.length) {
  14110. queue = currentQueue.concat(queue);
  14111. } else {
  14112. queueIndex = -1;
  14113. }
  14114. if (queue.length) {
  14115. drainQueue();
  14116. }
  14117. }
  14118. function drainQueue() {
  14119. if (draining) {
  14120. return;
  14121. }
  14122. var timeout = runTimeout(cleanUpNextTick);
  14123. draining = true;
  14124. var len = queue.length;
  14125. while(len) {
  14126. currentQueue = queue;
  14127. queue = [];
  14128. while (++queueIndex < len) {
  14129. if (currentQueue) {
  14130. currentQueue[queueIndex].run();
  14131. }
  14132. }
  14133. queueIndex = -1;
  14134. len = queue.length;
  14135. }
  14136. currentQueue = null;
  14137. draining = false;
  14138. runClearTimeout(timeout);
  14139. }
  14140. process.nextTick = function (fun) {
  14141. var args = new Array(arguments.length - 1);
  14142. if (arguments.length > 1) {
  14143. for (var i = 1; i < arguments.length; i++) {
  14144. args[i - 1] = arguments[i];
  14145. }
  14146. }
  14147. queue.push(new Item(fun, args));
  14148. if (queue.length === 1 && !draining) {
  14149. runTimeout(drainQueue);
  14150. }
  14151. };
  14152. // v8 likes predictible objects
  14153. function Item(fun, array) {
  14154. this.fun = fun;
  14155. this.array = array;
  14156. }
  14157. Item.prototype.run = function () {
  14158. this.fun.apply(null, this.array);
  14159. };
  14160. process.title = 'browser';
  14161. process.browser = true;
  14162. process.env = {};
  14163. process.argv = [];
  14164. process.version = ''; // empty string to avoid regexp issues
  14165. process.versions = {};
  14166. function noop() {}
  14167. process.on = noop;
  14168. process.addListener = noop;
  14169. process.once = noop;
  14170. process.off = noop;
  14171. process.removeListener = noop;
  14172. process.removeAllListeners = noop;
  14173. process.emit = noop;
  14174. process.binding = function (name) {
  14175. throw new Error('process.binding is not supported');
  14176. };
  14177. process.cwd = function () { return '/' };
  14178. process.chdir = function (dir) {
  14179. throw new Error('process.chdir is not supported');
  14180. };
  14181. process.umask = function() { return 0; };
  14182. /***/ }),
  14183. /* 54 */
  14184. /***/ (function(module, exports) {
  14185. module.exports = "data:application/vnd.ms-fontobject;base64,"
  14186. /***/ }),
  14187. /* 55 */
  14188. /***/ (function(module, exports, __webpack_require__) {
  14189. "use strict";
  14190. /**
  14191. * Copyright (c) 2013-present, Facebook, Inc.
  14192. *
  14193. * Licensed under the Apache License, Version 2.0 (the "License");
  14194. * you may not use this file except in compliance with the License.
  14195. * You may obtain a copy of the License at
  14196. *
  14197. * http://www.apache.org/licenses/LICENSE-2.0
  14198. *
  14199. * Unless required by applicable law or agreed to in writing, software
  14200. * distributed under the License is distributed on an "AS IS" BASIS,
  14201. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14202. * See the License for the specific language governing permissions and
  14203. * limitations under the License.
  14204. *
  14205. * @typechecks
  14206. */
  14207. var emptyFunction = __webpack_require__(9);
  14208. /**
  14209. * Upstream version of event listener. Does not take into account specific
  14210. * nature of platform.
  14211. */
  14212. var EventListener = {
  14213. /**
  14214. * Listen to DOM events during the bubble phase.
  14215. *
  14216. * @param {DOMEventTarget} target DOM element to register listener on.
  14217. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14218. * @param {function} callback Callback function.
  14219. * @return {object} Object with a `remove` method.
  14220. */
  14221. listen: function listen(target, eventType, callback) {
  14222. if (target.addEventListener) {
  14223. target.addEventListener(eventType, callback, false);
  14224. return {
  14225. remove: function remove() {
  14226. target.removeEventListener(eventType, callback, false);
  14227. }
  14228. };
  14229. } else if (target.attachEvent) {
  14230. target.attachEvent('on' + eventType, callback);
  14231. return {
  14232. remove: function remove() {
  14233. target.detachEvent('on' + eventType, callback);
  14234. }
  14235. };
  14236. }
  14237. },
  14238. /**
  14239. * Listen to DOM events during the capture phase.
  14240. *
  14241. * @param {DOMEventTarget} target DOM element to register listener on.
  14242. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14243. * @param {function} callback Callback function.
  14244. * @return {object} Object with a `remove` method.
  14245. */
  14246. capture: function capture(target, eventType, callback) {
  14247. if (target.addEventListener) {
  14248. target.addEventListener(eventType, callback, true);
  14249. return {
  14250. remove: function remove() {
  14251. target.removeEventListener(eventType, callback, true);
  14252. }
  14253. };
  14254. } else {
  14255. if (false) {
  14256. console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
  14257. }
  14258. return {
  14259. remove: emptyFunction
  14260. };
  14261. }
  14262. },
  14263. registerDefault: function registerDefault() {}
  14264. };
  14265. module.exports = EventListener;
  14266. /***/ }),
  14267. /* 56 */
  14268. /***/ (function(module, exports, __webpack_require__) {
  14269. "use strict";
  14270. /**
  14271. * Copyright (c) 2013-present, Facebook, Inc.
  14272. * All rights reserved.
  14273. *
  14274. * This source code is licensed under the BSD-style license found in the
  14275. * LICENSE file in the root directory of this source tree. An additional grant
  14276. * of patent rights can be found in the PATENTS file in the same directory.
  14277. *
  14278. */
  14279. /**
  14280. * @param {DOMElement} node input/textarea to focus
  14281. */
  14282. function focusNode(node) {
  14283. // IE8 can throw "Can't move focus to the control because it is invisible,
  14284. // not enabled, or of a type that does not accept the focus." for all kinds of
  14285. // reasons that are too expensive and fragile to test.
  14286. try {
  14287. node.focus();
  14288. } catch (e) {}
  14289. }
  14290. module.exports = focusNode;
  14291. /***/ }),
  14292. /* 57 */
  14293. /***/ (function(module, exports, __webpack_require__) {
  14294. "use strict";
  14295. /* WEBPACK VAR INJECTION */(function(global) {
  14296. /**
  14297. * Copyright (c) 2013-present, Facebook, Inc.
  14298. * All rights reserved.
  14299. *
  14300. * This source code is licensed under the BSD-style license found in the
  14301. * LICENSE file in the root directory of this source tree. An additional grant
  14302. * of patent rights can be found in the PATENTS file in the same directory.
  14303. *
  14304. * @typechecks
  14305. */
  14306. /* eslint-disable fb-www/typeof-undefined */
  14307. /**
  14308. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  14309. * not safe to call document.activeElement if there is nothing focused.
  14310. *
  14311. * The activeElement will be null only if the document or document body is not
  14312. * yet defined.
  14313. *
  14314. * @param {?DOMDocument} doc Defaults to current document.
  14315. * @return {?DOMElement}
  14316. */
  14317. function getActiveElement(doc) /*?DOMElement*/{
  14318. doc = doc || global.document;
  14319. if (typeof doc === 'undefined') {
  14320. return null;
  14321. }
  14322. try {
  14323. return doc.activeElement || doc.body;
  14324. } catch (e) {
  14325. return doc.body;
  14326. }
  14327. }
  14328. module.exports = getActiveElement;
  14329. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(127)))
  14330. /***/ }),
  14331. /* 58 */
  14332. /***/ (function(module, exports, __webpack_require__) {
  14333. "use strict";
  14334. /**
  14335. * Copyright 2013-present, Facebook, Inc.
  14336. * All rights reserved.
  14337. *
  14338. * This source code is licensed under the BSD-style license found in the
  14339. * LICENSE file in the root directory of this source tree. An additional grant
  14340. * of patent rights can be found in the PATENTS file in the same directory.
  14341. *
  14342. */
  14343. /**
  14344. * CSS properties which accept numbers but are not in units of "px".
  14345. */
  14346. var isUnitlessNumber = {
  14347. animationIterationCount: true,
  14348. borderImageOutset: true,
  14349. borderImageSlice: true,
  14350. borderImageWidth: true,
  14351. boxFlex: true,
  14352. boxFlexGroup: true,
  14353. boxOrdinalGroup: true,
  14354. columnCount: true,
  14355. flex: true,
  14356. flexGrow: true,
  14357. flexPositive: true,
  14358. flexShrink: true,
  14359. flexNegative: true,
  14360. flexOrder: true,
  14361. gridRow: true,
  14362. gridColumn: true,
  14363. fontWeight: true,
  14364. lineClamp: true,
  14365. lineHeight: true,
  14366. opacity: true,
  14367. order: true,
  14368. orphans: true,
  14369. tabSize: true,
  14370. widows: true,
  14371. zIndex: true,
  14372. zoom: true,
  14373. // SVG-related properties
  14374. fillOpacity: true,
  14375. floodOpacity: true,
  14376. stopOpacity: true,
  14377. strokeDasharray: true,
  14378. strokeDashoffset: true,
  14379. strokeMiterlimit: true,
  14380. strokeOpacity: true,
  14381. strokeWidth: true
  14382. };
  14383. /**
  14384. * @param {string} prefix vendor-specific prefix, eg: Webkit
  14385. * @param {string} key style name, eg: transitionDuration
  14386. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  14387. * WebkitTransitionDuration
  14388. */
  14389. function prefixKey(prefix, key) {
  14390. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  14391. }
  14392. /**
  14393. * Support style names that may come passed in prefixed by adding permutations
  14394. * of vendor prefixes.
  14395. */
  14396. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  14397. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  14398. // infinite loop, because it iterates over the newly added props too.
  14399. Object.keys(isUnitlessNumber).forEach(function (prop) {
  14400. prefixes.forEach(function (prefix) {
  14401. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  14402. });
  14403. });
  14404. /**
  14405. * Most style properties can be unset by doing .style[prop] = '' but IE8
  14406. * doesn't like doing that with shorthand properties so for the properties that
  14407. * IE8 breaks on, which are listed here, we instead unset each of the
  14408. * individual properties. See http://bugs.jquery.com/ticket/12385.
  14409. * The 4-value 'clock' properties like margin, padding, border-width seem to
  14410. * behave without any problems. Curiously, list-style works too without any
  14411. * special prodding.
  14412. */
  14413. var shorthandPropertyExpansions = {
  14414. background: {
  14415. backgroundAttachment: true,
  14416. backgroundColor: true,
  14417. backgroundImage: true,
  14418. backgroundPositionX: true,
  14419. backgroundPositionY: true,
  14420. backgroundRepeat: true
  14421. },
  14422. backgroundPosition: {
  14423. backgroundPositionX: true,
  14424. backgroundPositionY: true
  14425. },
  14426. border: {
  14427. borderWidth: true,
  14428. borderStyle: true,
  14429. borderColor: true
  14430. },
  14431. borderBottom: {
  14432. borderBottomWidth: true,
  14433. borderBottomStyle: true,
  14434. borderBottomColor: true
  14435. },
  14436. borderLeft: {
  14437. borderLeftWidth: true,
  14438. borderLeftStyle: true,
  14439. borderLeftColor: true
  14440. },
  14441. borderRight: {
  14442. borderRightWidth: true,
  14443. borderRightStyle: true,
  14444. borderRightColor: true
  14445. },
  14446. borderTop: {
  14447. borderTopWidth: true,
  14448. borderTopStyle: true,
  14449. borderTopColor: true
  14450. },
  14451. font: {
  14452. fontStyle: true,
  14453. fontVariant: true,
  14454. fontWeight: true,
  14455. fontSize: true,
  14456. lineHeight: true,
  14457. fontFamily: true
  14458. },
  14459. outline: {
  14460. outlineWidth: true,
  14461. outlineStyle: true,
  14462. outlineColor: true
  14463. }
  14464. };
  14465. var CSSProperty = {
  14466. isUnitlessNumber: isUnitlessNumber,
  14467. shorthandPropertyExpansions: shorthandPropertyExpansions
  14468. };
  14469. module.exports = CSSProperty;
  14470. /***/ }),
  14471. /* 59 */
  14472. /***/ (function(module, exports, __webpack_require__) {
  14473. "use strict";
  14474. /**
  14475. * Copyright 2013-present, Facebook, Inc.
  14476. * All rights reserved.
  14477. *
  14478. * This source code is licensed under the BSD-style license found in the
  14479. * LICENSE file in the root directory of this source tree. An additional grant
  14480. * of patent rights can be found in the PATENTS file in the same directory.
  14481. *
  14482. *
  14483. */
  14484. var _prodInvariant = __webpack_require__(2);
  14485. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14486. var PooledClass = __webpack_require__(15);
  14487. var invariant = __webpack_require__(0);
  14488. /**
  14489. * A specialized pseudo-event module to help keep track of components waiting to
  14490. * be notified when their DOM representations are available for use.
  14491. *
  14492. * This implements `PooledClass`, so you should never need to instantiate this.
  14493. * Instead, use `CallbackQueue.getPooled()`.
  14494. *
  14495. * @class ReactMountReady
  14496. * @implements PooledClass
  14497. * @internal
  14498. */
  14499. var CallbackQueue = function () {
  14500. function CallbackQueue(arg) {
  14501. _classCallCheck(this, CallbackQueue);
  14502. this._callbacks = null;
  14503. this._contexts = null;
  14504. this._arg = arg;
  14505. }
  14506. /**
  14507. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  14508. *
  14509. * @param {function} callback Invoked when `notifyAll` is invoked.
  14510. * @param {?object} context Context to call `callback` with.
  14511. * @internal
  14512. */
  14513. CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
  14514. this._callbacks = this._callbacks || [];
  14515. this._callbacks.push(callback);
  14516. this._contexts = this._contexts || [];
  14517. this._contexts.push(context);
  14518. };
  14519. /**
  14520. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  14521. * the DOM representation of a component has been created or updated.
  14522. *
  14523. * @internal
  14524. */
  14525. CallbackQueue.prototype.notifyAll = function notifyAll() {
  14526. var callbacks = this._callbacks;
  14527. var contexts = this._contexts;
  14528. var arg = this._arg;
  14529. if (callbacks && contexts) {
  14530. !(callbacks.length === contexts.length) ? false ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
  14531. this._callbacks = null;
  14532. this._contexts = null;
  14533. for (var i = 0; i < callbacks.length; i++) {
  14534. callbacks[i].call(contexts[i], arg);
  14535. }
  14536. callbacks.length = 0;
  14537. contexts.length = 0;
  14538. }
  14539. };
  14540. CallbackQueue.prototype.checkpoint = function checkpoint() {
  14541. return this._callbacks ? this._callbacks.length : 0;
  14542. };
  14543. CallbackQueue.prototype.rollback = function rollback(len) {
  14544. if (this._callbacks && this._contexts) {
  14545. this._callbacks.length = len;
  14546. this._contexts.length = len;
  14547. }
  14548. };
  14549. /**
  14550. * Resets the internal queue.
  14551. *
  14552. * @internal
  14553. */
  14554. CallbackQueue.prototype.reset = function reset() {
  14555. this._callbacks = null;
  14556. this._contexts = null;
  14557. };
  14558. /**
  14559. * `PooledClass` looks for this.
  14560. */
  14561. CallbackQueue.prototype.destructor = function destructor() {
  14562. this.reset();
  14563. };
  14564. return CallbackQueue;
  14565. }();
  14566. module.exports = PooledClass.addPoolingTo(CallbackQueue);
  14567. /***/ }),
  14568. /* 60 */
  14569. /***/ (function(module, exports, __webpack_require__) {
  14570. "use strict";
  14571. /**
  14572. * Copyright 2013-present, Facebook, Inc.
  14573. * All rights reserved.
  14574. *
  14575. * This source code is licensed under the BSD-style license found in the
  14576. * LICENSE file in the root directory of this source tree. An additional grant
  14577. * of patent rights can be found in the PATENTS file in the same directory.
  14578. *
  14579. */
  14580. var DOMProperty = __webpack_require__(18);
  14581. var ReactDOMComponentTree = __webpack_require__(4);
  14582. var ReactInstrumentation = __webpack_require__(10);
  14583. var quoteAttributeValueForBrowser = __webpack_require__(203);
  14584. var warning = __webpack_require__(1);
  14585. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  14586. var illegalAttributeNameCache = {};
  14587. var validatedAttributeNameCache = {};
  14588. function isAttributeNameSafe(attributeName) {
  14589. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  14590. return true;
  14591. }
  14592. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  14593. return false;
  14594. }
  14595. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  14596. validatedAttributeNameCache[attributeName] = true;
  14597. return true;
  14598. }
  14599. illegalAttributeNameCache[attributeName] = true;
  14600. false ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
  14601. return false;
  14602. }
  14603. function shouldIgnoreValue(propertyInfo, value) {
  14604. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  14605. }
  14606. /**
  14607. * Operations for dealing with DOM properties.
  14608. */
  14609. var DOMPropertyOperations = {
  14610. /**
  14611. * Creates markup for the ID property.
  14612. *
  14613. * @param {string} id Unescaped ID.
  14614. * @return {string} Markup string.
  14615. */
  14616. createMarkupForID: function (id) {
  14617. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  14618. },
  14619. setAttributeForID: function (node, id) {
  14620. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  14621. },
  14622. createMarkupForRoot: function () {
  14623. return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
  14624. },
  14625. setAttributeForRoot: function (node) {
  14626. node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
  14627. },
  14628. /**
  14629. * Creates markup for a property.
  14630. *
  14631. * @param {string} name
  14632. * @param {*} value
  14633. * @return {?string} Markup string, or null if the property was invalid.
  14634. */
  14635. createMarkupForProperty: function (name, value) {
  14636. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  14637. if (propertyInfo) {
  14638. if (shouldIgnoreValue(propertyInfo, value)) {
  14639. return '';
  14640. }
  14641. var attributeName = propertyInfo.attributeName;
  14642. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  14643. return attributeName + '=""';
  14644. }
  14645. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  14646. } else if (DOMProperty.isCustomAttribute(name)) {
  14647. if (value == null) {
  14648. return '';
  14649. }
  14650. return name + '=' + quoteAttributeValueForBrowser(value);
  14651. }
  14652. return null;
  14653. },
  14654. /**
  14655. * Creates markup for a custom property.
  14656. *
  14657. * @param {string} name
  14658. * @param {*} value
  14659. * @return {string} Markup string, or empty string if the property was invalid.
  14660. */
  14661. createMarkupForCustomAttribute: function (name, value) {
  14662. if (!isAttributeNameSafe(name) || value == null) {
  14663. return '';
  14664. }
  14665. return name + '=' + quoteAttributeValueForBrowser(value);
  14666. },
  14667. /**
  14668. * Sets the value for a property on a node.
  14669. *
  14670. * @param {DOMElement} node
  14671. * @param {string} name
  14672. * @param {*} value
  14673. */
  14674. setValueForProperty: function (node, name, value) {
  14675. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  14676. if (propertyInfo) {
  14677. var mutationMethod = propertyInfo.mutationMethod;
  14678. if (mutationMethod) {
  14679. mutationMethod(node, value);
  14680. } else if (shouldIgnoreValue(propertyInfo, value)) {
  14681. this.deleteValueForProperty(node, name);
  14682. return;
  14683. } else if (propertyInfo.mustUseProperty) {
  14684. // Contrary to `setAttribute`, object properties are properly
  14685. // `toString`ed by IE8/9.
  14686. node[propertyInfo.propertyName] = value;
  14687. } else {
  14688. var attributeName = propertyInfo.attributeName;
  14689. var namespace = propertyInfo.attributeNamespace;
  14690. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  14691. // ('' + value) makes it output the correct toString()-value.
  14692. if (namespace) {
  14693. node.setAttributeNS(namespace, attributeName, '' + value);
  14694. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  14695. node.setAttribute(attributeName, '');
  14696. } else {
  14697. node.setAttribute(attributeName, '' + value);
  14698. }
  14699. }
  14700. } else if (DOMProperty.isCustomAttribute(name)) {
  14701. DOMPropertyOperations.setValueForAttribute(node, name, value);
  14702. return;
  14703. }
  14704. if (false) {
  14705. var payload = {};
  14706. payload[name] = value;
  14707. ReactInstrumentation.debugTool.onHostOperation({
  14708. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  14709. type: 'update attribute',
  14710. payload: payload
  14711. });
  14712. }
  14713. },
  14714. setValueForAttribute: function (node, name, value) {
  14715. if (!isAttributeNameSafe(name)) {
  14716. return;
  14717. }
  14718. if (value == null) {
  14719. node.removeAttribute(name);
  14720. } else {
  14721. node.setAttribute(name, '' + value);
  14722. }
  14723. if (false) {
  14724. var payload = {};
  14725. payload[name] = value;
  14726. ReactInstrumentation.debugTool.onHostOperation({
  14727. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  14728. type: 'update attribute',
  14729. payload: payload
  14730. });
  14731. }
  14732. },
  14733. /**
  14734. * Deletes an attributes from a node.
  14735. *
  14736. * @param {DOMElement} node
  14737. * @param {string} name
  14738. */
  14739. deleteValueForAttribute: function (node, name) {
  14740. node.removeAttribute(name);
  14741. if (false) {
  14742. ReactInstrumentation.debugTool.onHostOperation({
  14743. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  14744. type: 'remove attribute',
  14745. payload: name
  14746. });
  14747. }
  14748. },
  14749. /**
  14750. * Deletes the value for a property on a node.
  14751. *
  14752. * @param {DOMElement} node
  14753. * @param {string} name
  14754. */
  14755. deleteValueForProperty: function (node, name) {
  14756. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  14757. if (propertyInfo) {
  14758. var mutationMethod = propertyInfo.mutationMethod;
  14759. if (mutationMethod) {
  14760. mutationMethod(node, undefined);
  14761. } else if (propertyInfo.mustUseProperty) {
  14762. var propName = propertyInfo.propertyName;
  14763. if (propertyInfo.hasBooleanValue) {
  14764. node[propName] = false;
  14765. } else {
  14766. node[propName] = '';
  14767. }
  14768. } else {
  14769. node.removeAttribute(propertyInfo.attributeName);
  14770. }
  14771. } else if (DOMProperty.isCustomAttribute(name)) {
  14772. node.removeAttribute(name);
  14773. }
  14774. if (false) {
  14775. ReactInstrumentation.debugTool.onHostOperation({
  14776. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  14777. type: 'remove attribute',
  14778. payload: name
  14779. });
  14780. }
  14781. }
  14782. };
  14783. module.exports = DOMPropertyOperations;
  14784. /***/ }),
  14785. /* 61 */
  14786. /***/ (function(module, exports, __webpack_require__) {
  14787. "use strict";
  14788. /**
  14789. * Copyright 2015-present, Facebook, Inc.
  14790. * All rights reserved.
  14791. *
  14792. * This source code is licensed under the BSD-style license found in the
  14793. * LICENSE file in the root directory of this source tree. An additional grant
  14794. * of patent rights can be found in the PATENTS file in the same directory.
  14795. *
  14796. */
  14797. var ReactDOMComponentFlags = {
  14798. hasCachedChildNodes: 1 << 0
  14799. };
  14800. module.exports = ReactDOMComponentFlags;
  14801. /***/ }),
  14802. /* 62 */
  14803. /***/ (function(module, exports, __webpack_require__) {
  14804. "use strict";
  14805. /**
  14806. * Copyright 2013-present, Facebook, Inc.
  14807. * All rights reserved.
  14808. *
  14809. * This source code is licensed under the BSD-style license found in the
  14810. * LICENSE file in the root directory of this source tree. An additional grant
  14811. * of patent rights can be found in the PATENTS file in the same directory.
  14812. *
  14813. */
  14814. var _assign = __webpack_require__(3);
  14815. var LinkedValueUtils = __webpack_require__(40);
  14816. var ReactDOMComponentTree = __webpack_require__(4);
  14817. var ReactUpdates = __webpack_require__(11);
  14818. var warning = __webpack_require__(1);
  14819. var didWarnValueLink = false;
  14820. var didWarnValueDefaultValue = false;
  14821. function updateOptionsIfPendingUpdateAndMounted() {
  14822. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  14823. this._wrapperState.pendingUpdate = false;
  14824. var props = this._currentElement.props;
  14825. var value = LinkedValueUtils.getValue(props);
  14826. if (value != null) {
  14827. updateOptions(this, Boolean(props.multiple), value);
  14828. }
  14829. }
  14830. }
  14831. function getDeclarationErrorAddendum(owner) {
  14832. if (owner) {
  14833. var name = owner.getName();
  14834. if (name) {
  14835. return ' Check the render method of `' + name + '`.';
  14836. }
  14837. }
  14838. return '';
  14839. }
  14840. var valuePropNames = ['value', 'defaultValue'];
  14841. /**
  14842. * Validation function for `value` and `defaultValue`.
  14843. * @private
  14844. */
  14845. function checkSelectPropTypes(inst, props) {
  14846. var owner = inst._currentElement._owner;
  14847. LinkedValueUtils.checkPropTypes('select', props, owner);
  14848. if (props.valueLink !== undefined && !didWarnValueLink) {
  14849. false ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
  14850. didWarnValueLink = true;
  14851. }
  14852. for (var i = 0; i < valuePropNames.length; i++) {
  14853. var propName = valuePropNames[i];
  14854. if (props[propName] == null) {
  14855. continue;
  14856. }
  14857. var isArray = Array.isArray(props[propName]);
  14858. if (props.multiple && !isArray) {
  14859. false ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  14860. } else if (!props.multiple && isArray) {
  14861. false ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  14862. }
  14863. }
  14864. }
  14865. /**
  14866. * @param {ReactDOMComponent} inst
  14867. * @param {boolean} multiple
  14868. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  14869. * @private
  14870. */
  14871. function updateOptions(inst, multiple, propValue) {
  14872. var selectedValue, i;
  14873. var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
  14874. if (multiple) {
  14875. selectedValue = {};
  14876. for (i = 0; i < propValue.length; i++) {
  14877. selectedValue['' + propValue[i]] = true;
  14878. }
  14879. for (i = 0; i < options.length; i++) {
  14880. var selected = selectedValue.hasOwnProperty(options[i].value);
  14881. if (options[i].selected !== selected) {
  14882. options[i].selected = selected;
  14883. }
  14884. }
  14885. } else {
  14886. // Do not set `select.value` as exact behavior isn't consistent across all
  14887. // browsers for all cases.
  14888. selectedValue = '' + propValue;
  14889. for (i = 0; i < options.length; i++) {
  14890. if (options[i].value === selectedValue) {
  14891. options[i].selected = true;
  14892. return;
  14893. }
  14894. }
  14895. if (options.length) {
  14896. options[0].selected = true;
  14897. }
  14898. }
  14899. }
  14900. /**
  14901. * Implements a <select> host component that allows optionally setting the
  14902. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  14903. * stringable. If `multiple` is true, the prop must be an array of stringables.
  14904. *
  14905. * If `value` is not supplied (or null/undefined), user actions that change the
  14906. * selected option will trigger updates to the rendered options.
  14907. *
  14908. * If it is supplied (and not null/undefined), the rendered options will not
  14909. * update in response to user actions. Instead, the `value` prop must change in
  14910. * order for the rendered options to update.
  14911. *
  14912. * If `defaultValue` is provided, any options with the supplied values will be
  14913. * selected.
  14914. */
  14915. var ReactDOMSelect = {
  14916. getHostProps: function (inst, props) {
  14917. return _assign({}, props, {
  14918. onChange: inst._wrapperState.onChange,
  14919. value: undefined
  14920. });
  14921. },
  14922. mountWrapper: function (inst, props) {
  14923. if (false) {
  14924. checkSelectPropTypes(inst, props);
  14925. }
  14926. var value = LinkedValueUtils.getValue(props);
  14927. inst._wrapperState = {
  14928. pendingUpdate: false,
  14929. initialValue: value != null ? value : props.defaultValue,
  14930. listeners: null,
  14931. onChange: _handleChange.bind(inst),
  14932. wasMultiple: Boolean(props.multiple)
  14933. };
  14934. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  14935. false ? warning(false, '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') : void 0;
  14936. didWarnValueDefaultValue = true;
  14937. }
  14938. },
  14939. getSelectValueContext: function (inst) {
  14940. // ReactDOMOption looks at this initial value so the initial generated
  14941. // markup has correct `selected` attributes
  14942. return inst._wrapperState.initialValue;
  14943. },
  14944. postUpdateWrapper: function (inst) {
  14945. var props = inst._currentElement.props;
  14946. // After the initial mount, we control selected-ness manually so don't pass
  14947. // this value down
  14948. inst._wrapperState.initialValue = undefined;
  14949. var wasMultiple = inst._wrapperState.wasMultiple;
  14950. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  14951. var value = LinkedValueUtils.getValue(props);
  14952. if (value != null) {
  14953. inst._wrapperState.pendingUpdate = false;
  14954. updateOptions(inst, Boolean(props.multiple), value);
  14955. } else if (wasMultiple !== Boolean(props.multiple)) {
  14956. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  14957. if (props.defaultValue != null) {
  14958. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  14959. } else {
  14960. // Revert the select back to its default unselected state.
  14961. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  14962. }
  14963. }
  14964. }
  14965. };
  14966. function _handleChange(event) {
  14967. var props = this._currentElement.props;
  14968. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  14969. if (this._rootNodeID) {
  14970. this._wrapperState.pendingUpdate = true;
  14971. }
  14972. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  14973. return returnValue;
  14974. }
  14975. module.exports = ReactDOMSelect;
  14976. /***/ }),
  14977. /* 63 */
  14978. /***/ (function(module, exports, __webpack_require__) {
  14979. "use strict";
  14980. /**
  14981. * Copyright 2014-present, Facebook, Inc.
  14982. * All rights reserved.
  14983. *
  14984. * This source code is licensed under the BSD-style license found in the
  14985. * LICENSE file in the root directory of this source tree. An additional grant
  14986. * of patent rights can be found in the PATENTS file in the same directory.
  14987. *
  14988. */
  14989. var emptyComponentFactory;
  14990. var ReactEmptyComponentInjection = {
  14991. injectEmptyComponentFactory: function (factory) {
  14992. emptyComponentFactory = factory;
  14993. }
  14994. };
  14995. var ReactEmptyComponent = {
  14996. create: function (instantiate) {
  14997. return emptyComponentFactory(instantiate);
  14998. }
  14999. };
  15000. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  15001. module.exports = ReactEmptyComponent;
  15002. /***/ }),
  15003. /* 64 */
  15004. /***/ (function(module, exports, __webpack_require__) {
  15005. "use strict";
  15006. /**
  15007. * Copyright 2013-present, Facebook, Inc.
  15008. * All rights reserved.
  15009. *
  15010. * This source code is licensed under the BSD-style license found in the
  15011. * LICENSE file in the root directory of this source tree. An additional grant
  15012. * of patent rights can be found in the PATENTS file in the same directory.
  15013. *
  15014. *
  15015. */
  15016. var ReactFeatureFlags = {
  15017. // When true, call console.time() before and .timeEnd() after each top-level
  15018. // render (both initial renders and updates). Useful when looking at prod-mode
  15019. // timeline profiles in Chrome, for example.
  15020. logTopLevelRenders: false
  15021. };
  15022. module.exports = ReactFeatureFlags;
  15023. /***/ }),
  15024. /* 65 */
  15025. /***/ (function(module, exports, __webpack_require__) {
  15026. "use strict";
  15027. /**
  15028. * Copyright 2014-present, Facebook, Inc.
  15029. * All rights reserved.
  15030. *
  15031. * This source code is licensed under the BSD-style license found in the
  15032. * LICENSE file in the root directory of this source tree. An additional grant
  15033. * of patent rights can be found in the PATENTS file in the same directory.
  15034. *
  15035. */
  15036. var _prodInvariant = __webpack_require__(2);
  15037. var invariant = __webpack_require__(0);
  15038. var genericComponentClass = null;
  15039. var textComponentClass = null;
  15040. var ReactHostComponentInjection = {
  15041. // This accepts a class that receives the tag string. This is a catch all
  15042. // that can render any kind of tag.
  15043. injectGenericComponentClass: function (componentClass) {
  15044. genericComponentClass = componentClass;
  15045. },
  15046. // This accepts a text component class that takes the text string to be
  15047. // rendered as props.
  15048. injectTextComponentClass: function (componentClass) {
  15049. textComponentClass = componentClass;
  15050. }
  15051. };
  15052. /**
  15053. * Get a host internal component class for a specific tag.
  15054. *
  15055. * @param {ReactElement} element The element to create.
  15056. * @return {function} The internal class constructor function.
  15057. */
  15058. function createInternalComponent(element) {
  15059. !genericComponentClass ? false ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
  15060. return new genericComponentClass(element);
  15061. }
  15062. /**
  15063. * @param {ReactText} text
  15064. * @return {ReactComponent}
  15065. */
  15066. function createInstanceForText(text) {
  15067. return new textComponentClass(text);
  15068. }
  15069. /**
  15070. * @param {ReactComponent} component
  15071. * @return {boolean}
  15072. */
  15073. function isTextComponent(component) {
  15074. return component instanceof textComponentClass;
  15075. }
  15076. var ReactHostComponent = {
  15077. createInternalComponent: createInternalComponent,
  15078. createInstanceForText: createInstanceForText,
  15079. isTextComponent: isTextComponent,
  15080. injection: ReactHostComponentInjection
  15081. };
  15082. module.exports = ReactHostComponent;
  15083. /***/ }),
  15084. /* 66 */
  15085. /***/ (function(module, exports, __webpack_require__) {
  15086. "use strict";
  15087. /**
  15088. * Copyright 2013-present, Facebook, Inc.
  15089. * All rights reserved.
  15090. *
  15091. * This source code is licensed under the BSD-style license found in the
  15092. * LICENSE file in the root directory of this source tree. An additional grant
  15093. * of patent rights can be found in the PATENTS file in the same directory.
  15094. *
  15095. */
  15096. var ReactDOMSelection = __webpack_require__(162);
  15097. var containsNode = __webpack_require__(131);
  15098. var focusNode = __webpack_require__(56);
  15099. var getActiveElement = __webpack_require__(57);
  15100. function isInDocument(node) {
  15101. return containsNode(document.documentElement, node);
  15102. }
  15103. /**
  15104. * @ReactInputSelection: React input selection module. Based on Selection.js,
  15105. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  15106. * assume buttons have range selections allowed).
  15107. * Input selection module for React.
  15108. */
  15109. var ReactInputSelection = {
  15110. hasSelectionCapabilities: function (elem) {
  15111. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  15112. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  15113. },
  15114. getSelectionInformation: function () {
  15115. var focusedElem = getActiveElement();
  15116. return {
  15117. focusedElem: focusedElem,
  15118. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  15119. };
  15120. },
  15121. /**
  15122. * @restoreSelection: If any selection information was potentially lost,
  15123. * restore it. This is useful when performing operations that could remove dom
  15124. * nodes and place them back in, resulting in focus being lost.
  15125. */
  15126. restoreSelection: function (priorSelectionInformation) {
  15127. var curFocusedElem = getActiveElement();
  15128. var priorFocusedElem = priorSelectionInformation.focusedElem;
  15129. var priorSelectionRange = priorSelectionInformation.selectionRange;
  15130. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  15131. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  15132. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  15133. }
  15134. focusNode(priorFocusedElem);
  15135. }
  15136. },
  15137. /**
  15138. * @getSelection: Gets the selection bounds of a focused textarea, input or
  15139. * contentEditable node.
  15140. * -@input: Look up selection bounds of this input
  15141. * -@return {start: selectionStart, end: selectionEnd}
  15142. */
  15143. getSelection: function (input) {
  15144. var selection;
  15145. if ('selectionStart' in input) {
  15146. // Modern browser with input or textarea.
  15147. selection = {
  15148. start: input.selectionStart,
  15149. end: input.selectionEnd
  15150. };
  15151. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  15152. // IE8 input.
  15153. var range = document.selection.createRange();
  15154. // There can only be one selection per document in IE, so it must
  15155. // be in our element.
  15156. if (range.parentElement() === input) {
  15157. selection = {
  15158. start: -range.moveStart('character', -input.value.length),
  15159. end: -range.moveEnd('character', -input.value.length)
  15160. };
  15161. }
  15162. } else {
  15163. // Content editable or old IE textarea.
  15164. selection = ReactDOMSelection.getOffsets(input);
  15165. }
  15166. return selection || { start: 0, end: 0 };
  15167. },
  15168. /**
  15169. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  15170. * the input.
  15171. * -@input Set selection bounds of this input or textarea
  15172. * -@offsets Object of same form that is returned from get*
  15173. */
  15174. setSelection: function (input, offsets) {
  15175. var start = offsets.start;
  15176. var end = offsets.end;
  15177. if (end === undefined) {
  15178. end = start;
  15179. }
  15180. if ('selectionStart' in input) {
  15181. input.selectionStart = start;
  15182. input.selectionEnd = Math.min(end, input.value.length);
  15183. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  15184. var range = input.createTextRange();
  15185. range.collapse(true);
  15186. range.moveStart('character', start);
  15187. range.moveEnd('character', end - start);
  15188. range.select();
  15189. } else {
  15190. ReactDOMSelection.setOffsets(input, offsets);
  15191. }
  15192. }
  15193. };
  15194. module.exports = ReactInputSelection;
  15195. /***/ }),
  15196. /* 67 */
  15197. /***/ (function(module, exports, __webpack_require__) {
  15198. "use strict";
  15199. /**
  15200. * Copyright 2013-present, Facebook, Inc.
  15201. * All rights reserved.
  15202. *
  15203. * This source code is licensed under the BSD-style license found in the
  15204. * LICENSE file in the root directory of this source tree. An additional grant
  15205. * of patent rights can be found in the PATENTS file in the same directory.
  15206. *
  15207. */
  15208. var _prodInvariant = __webpack_require__(2);
  15209. var DOMLazyTree = __webpack_require__(17);
  15210. var DOMProperty = __webpack_require__(18);
  15211. var React = __webpack_require__(20);
  15212. var ReactBrowserEventEmitter = __webpack_require__(28);
  15213. var ReactCurrentOwner = __webpack_require__(13);
  15214. var ReactDOMComponentTree = __webpack_require__(4);
  15215. var ReactDOMContainerInfo = __webpack_require__(156);
  15216. var ReactDOMFeatureFlags = __webpack_require__(158);
  15217. var ReactFeatureFlags = __webpack_require__(64);
  15218. var ReactInstanceMap = __webpack_require__(26);
  15219. var ReactInstrumentation = __webpack_require__(10);
  15220. var ReactMarkupChecksum = __webpack_require__(172);
  15221. var ReactReconciler = __webpack_require__(19);
  15222. var ReactUpdateQueue = __webpack_require__(43);
  15223. var ReactUpdates = __webpack_require__(11);
  15224. var emptyObject = __webpack_require__(23);
  15225. var instantiateReactComponent = __webpack_require__(74);
  15226. var invariant = __webpack_require__(0);
  15227. var setInnerHTML = __webpack_require__(32);
  15228. var shouldUpdateReactComponent = __webpack_require__(49);
  15229. var warning = __webpack_require__(1);
  15230. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  15231. var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
  15232. var ELEMENT_NODE_TYPE = 1;
  15233. var DOC_NODE_TYPE = 9;
  15234. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  15235. var instancesByReactRootID = {};
  15236. /**
  15237. * Finds the index of the first character
  15238. * that's not common between the two given strings.
  15239. *
  15240. * @return {number} the index of the character where the strings diverge
  15241. */
  15242. function firstDifferenceIndex(string1, string2) {
  15243. var minLen = Math.min(string1.length, string2.length);
  15244. for (var i = 0; i < minLen; i++) {
  15245. if (string1.charAt(i) !== string2.charAt(i)) {
  15246. return i;
  15247. }
  15248. }
  15249. return string1.length === string2.length ? -1 : minLen;
  15250. }
  15251. /**
  15252. * @param {DOMElement|DOMDocument} container DOM element that may contain
  15253. * a React component
  15254. * @return {?*} DOM element that may have the reactRoot ID, or null.
  15255. */
  15256. function getReactRootElementInContainer(container) {
  15257. if (!container) {
  15258. return null;
  15259. }
  15260. if (container.nodeType === DOC_NODE_TYPE) {
  15261. return container.documentElement;
  15262. } else {
  15263. return container.firstChild;
  15264. }
  15265. }
  15266. function internalGetID(node) {
  15267. // If node is something like a window, document, or text node, none of
  15268. // which support attributes or a .getAttribute method, gracefully return
  15269. // the empty string, as if the attribute were missing.
  15270. return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  15271. }
  15272. /**
  15273. * Mounts this component and inserts it into the DOM.
  15274. *
  15275. * @param {ReactComponent} componentInstance The instance to mount.
  15276. * @param {DOMElement} container DOM element to mount into.
  15277. * @param {ReactReconcileTransaction} transaction
  15278. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  15279. */
  15280. function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
  15281. var markerName;
  15282. if (ReactFeatureFlags.logTopLevelRenders) {
  15283. var wrappedElement = wrapperInstance._currentElement.props.child;
  15284. var type = wrappedElement.type;
  15285. markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
  15286. console.time(markerName);
  15287. }
  15288. var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
  15289. );
  15290. if (markerName) {
  15291. console.timeEnd(markerName);
  15292. }
  15293. wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
  15294. ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
  15295. }
  15296. /**
  15297. * Batched mount.
  15298. *
  15299. * @param {ReactComponent} componentInstance The instance to mount.
  15300. * @param {DOMElement} container DOM element to mount into.
  15301. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  15302. */
  15303. function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
  15304. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  15305. /* useCreateElement */
  15306. !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
  15307. transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
  15308. ReactUpdates.ReactReconcileTransaction.release(transaction);
  15309. }
  15310. /**
  15311. * Unmounts a component and removes it from the DOM.
  15312. *
  15313. * @param {ReactComponent} instance React component instance.
  15314. * @param {DOMElement} container DOM element to unmount from.
  15315. * @final
  15316. * @internal
  15317. * @see {ReactMount.unmountComponentAtNode}
  15318. */
  15319. function unmountComponentFromNode(instance, container, safely) {
  15320. if (false) {
  15321. ReactInstrumentation.debugTool.onBeginFlush();
  15322. }
  15323. ReactReconciler.unmountComponent(instance, safely);
  15324. if (false) {
  15325. ReactInstrumentation.debugTool.onEndFlush();
  15326. }
  15327. if (container.nodeType === DOC_NODE_TYPE) {
  15328. container = container.documentElement;
  15329. }
  15330. // http://jsperf.com/emptying-a-node
  15331. while (container.lastChild) {
  15332. container.removeChild(container.lastChild);
  15333. }
  15334. }
  15335. /**
  15336. * True if the supplied DOM node has a direct React-rendered child that is
  15337. * not a React root element. Useful for warning in `render`,
  15338. * `unmountComponentAtNode`, etc.
  15339. *
  15340. * @param {?DOMElement} node The candidate DOM node.
  15341. * @return {boolean} True if the DOM element contains a direct child that was
  15342. * rendered by React but is not a root element.
  15343. * @internal
  15344. */
  15345. function hasNonRootReactChild(container) {
  15346. var rootEl = getReactRootElementInContainer(container);
  15347. if (rootEl) {
  15348. var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
  15349. return !!(inst && inst._hostParent);
  15350. }
  15351. }
  15352. /**
  15353. * True if the supplied DOM node is a React DOM element and
  15354. * it has been rendered by another copy of React.
  15355. *
  15356. * @param {?DOMElement} node The candidate DOM node.
  15357. * @return {boolean} True if the DOM has been rendered by another copy of React
  15358. * @internal
  15359. */
  15360. function nodeIsRenderedByOtherInstance(container) {
  15361. var rootEl = getReactRootElementInContainer(container);
  15362. return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
  15363. }
  15364. /**
  15365. * True if the supplied DOM node is a valid node element.
  15366. *
  15367. * @param {?DOMElement} node The candidate DOM node.
  15368. * @return {boolean} True if the DOM is a valid DOM node.
  15369. * @internal
  15370. */
  15371. function isValidContainer(node) {
  15372. return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
  15373. }
  15374. /**
  15375. * True if the supplied DOM node is a valid React node element.
  15376. *
  15377. * @param {?DOMElement} node The candidate DOM node.
  15378. * @return {boolean} True if the DOM is a valid React DOM node.
  15379. * @internal
  15380. */
  15381. function isReactNode(node) {
  15382. return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
  15383. }
  15384. function getHostRootInstanceInContainer(container) {
  15385. var rootEl = getReactRootElementInContainer(container);
  15386. var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
  15387. return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
  15388. }
  15389. function getTopLevelWrapperInContainer(container) {
  15390. var root = getHostRootInstanceInContainer(container);
  15391. return root ? root._hostContainerInfo._topLevelWrapper : null;
  15392. }
  15393. /**
  15394. * Temporary (?) hack so that we can store all top-level pending updates on
  15395. * composites instead of having to worry about different types of components
  15396. * here.
  15397. */
  15398. var topLevelRootCounter = 1;
  15399. var TopLevelWrapper = function () {
  15400. this.rootID = topLevelRootCounter++;
  15401. };
  15402. TopLevelWrapper.prototype.isReactComponent = {};
  15403. if (false) {
  15404. TopLevelWrapper.displayName = 'TopLevelWrapper';
  15405. }
  15406. TopLevelWrapper.prototype.render = function () {
  15407. return this.props.child;
  15408. };
  15409. TopLevelWrapper.isReactTopLevelWrapper = true;
  15410. /**
  15411. * Mounting is the process of initializing a React component by creating its
  15412. * representative DOM elements and inserting them into a supplied `container`.
  15413. * Any prior content inside `container` is destroyed in the process.
  15414. *
  15415. * ReactMount.render(
  15416. * component,
  15417. * document.getElementById('container')
  15418. * );
  15419. *
  15420. * <div id="container"> <-- Supplied `container`.
  15421. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  15422. * // ... component.
  15423. * </div>
  15424. * </div>
  15425. *
  15426. * Inside of `container`, the first element rendered is the "reactRoot".
  15427. */
  15428. var ReactMount = {
  15429. TopLevelWrapper: TopLevelWrapper,
  15430. /**
  15431. * Used by devtools. The keys are not important.
  15432. */
  15433. _instancesByReactRootID: instancesByReactRootID,
  15434. /**
  15435. * This is a hook provided to support rendering React components while
  15436. * ensuring that the apparent scroll position of its `container` does not
  15437. * change.
  15438. *
  15439. * @param {DOMElement} container The `container` being rendered into.
  15440. * @param {function} renderCallback This must be called once to do the render.
  15441. */
  15442. scrollMonitor: function (container, renderCallback) {
  15443. renderCallback();
  15444. },
  15445. /**
  15446. * Take a component that's already mounted into the DOM and replace its props
  15447. * @param {ReactComponent} prevComponent component instance already in the DOM
  15448. * @param {ReactElement} nextElement component instance to render
  15449. * @param {DOMElement} container container to render into
  15450. * @param {?function} callback function triggered on completion
  15451. */
  15452. _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
  15453. ReactMount.scrollMonitor(container, function () {
  15454. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
  15455. if (callback) {
  15456. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  15457. }
  15458. });
  15459. return prevComponent;
  15460. },
  15461. /**
  15462. * Render a new component into the DOM. Hooked by hooks!
  15463. *
  15464. * @param {ReactElement} nextElement element to render
  15465. * @param {DOMElement} container container to render into
  15466. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  15467. * @return {ReactComponent} nextComponent
  15468. */
  15469. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  15470. // Various parts of our code (such as ReactCompositeComponent's
  15471. // _renderValidatedComponent) assume that calls to render aren't nested;
  15472. // verify that that's the case.
  15473. false ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): 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. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
  15474. !isValidContainer(container) ? false ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
  15475. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  15476. var componentInstance = instantiateReactComponent(nextElement, false);
  15477. // The initial render is synchronous but any updates that happen during
  15478. // rendering, in componentWillMount or componentDidMount, will be batched
  15479. // according to the current batching strategy.
  15480. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
  15481. var wrapperID = componentInstance._instance.rootID;
  15482. instancesByReactRootID[wrapperID] = componentInstance;
  15483. return componentInstance;
  15484. },
  15485. /**
  15486. * Renders a React component into the DOM in the supplied `container`.
  15487. *
  15488. * If the React component was previously rendered into `container`, this will
  15489. * perform an update on it and only mutate the DOM as necessary to reflect the
  15490. * latest React component.
  15491. *
  15492. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  15493. * @param {ReactElement} nextElement Component element to render.
  15494. * @param {DOMElement} container DOM element to render into.
  15495. * @param {?function} callback function triggered on completion
  15496. * @return {ReactComponent} Component instance rendered in `container`.
  15497. */
  15498. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  15499. !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? false ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
  15500. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  15501. },
  15502. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  15503. ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
  15504. !React.isValidElement(nextElement) ? false ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' :
  15505. // Check if it quacks like an element
  15506. nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
  15507. false ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', '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.') : void 0;
  15508. var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement });
  15509. var nextContext;
  15510. if (parentComponent) {
  15511. var parentInst = ReactInstanceMap.get(parentComponent);
  15512. nextContext = parentInst._processChildContext(parentInst._context);
  15513. } else {
  15514. nextContext = emptyObject;
  15515. }
  15516. var prevComponent = getTopLevelWrapperInContainer(container);
  15517. if (prevComponent) {
  15518. var prevWrappedElement = prevComponent._currentElement;
  15519. var prevElement = prevWrappedElement.props.child;
  15520. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  15521. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  15522. var updatedCallback = callback && function () {
  15523. callback.call(publicInst);
  15524. };
  15525. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
  15526. return publicInst;
  15527. } else {
  15528. ReactMount.unmountComponentAtNode(container);
  15529. }
  15530. }
  15531. var reactRootElement = getReactRootElementInContainer(container);
  15532. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  15533. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  15534. if (false) {
  15535. process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, '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.') : void 0;
  15536. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  15537. var rootElementSibling = reactRootElement;
  15538. while (rootElementSibling) {
  15539. if (internalGetID(rootElementSibling)) {
  15540. process.env.NODE_ENV !== 'production' ? warning(false, '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.') : void 0;
  15541. break;
  15542. }
  15543. rootElementSibling = rootElementSibling.nextSibling;
  15544. }
  15545. }
  15546. }
  15547. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  15548. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
  15549. if (callback) {
  15550. callback.call(component);
  15551. }
  15552. return component;
  15553. },
  15554. /**
  15555. * Renders a React component into the DOM in the supplied `container`.
  15556. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
  15557. *
  15558. * If the React component was previously rendered into `container`, this will
  15559. * perform an update on it and only mutate the DOM as necessary to reflect the
  15560. * latest React component.
  15561. *
  15562. * @param {ReactElement} nextElement Component element to render.
  15563. * @param {DOMElement} container DOM element to render into.
  15564. * @param {?function} callback function triggered on completion
  15565. * @return {ReactComponent} Component instance rendered in `container`.
  15566. */
  15567. render: function (nextElement, container, callback) {
  15568. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  15569. },
  15570. /**
  15571. * Unmounts and destroys the React component rendered in the `container`.
  15572. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
  15573. *
  15574. * @param {DOMElement} container DOM element containing a React component.
  15575. * @return {boolean} True if a component was found in and unmounted from
  15576. * `container`
  15577. */
  15578. unmountComponentAtNode: function (container) {
  15579. // Various parts of our code (such as ReactCompositeComponent's
  15580. // _renderValidatedComponent) assume that calls to render aren't nested;
  15581. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  15582. // render but we still don't expect to be in a render call here.)
  15583. false ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): 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. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
  15584. !isValidContainer(container) ? false ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
  15585. if (false) {
  15586. process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0;
  15587. }
  15588. var prevComponent = getTopLevelWrapperInContainer(container);
  15589. if (!prevComponent) {
  15590. // Check if the node being unmounted was rendered by React, but isn't a
  15591. // root node.
  15592. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  15593. // Check if the container itself is a React root node.
  15594. var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
  15595. if (false) {
  15596. process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, '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.') : void 0;
  15597. }
  15598. return false;
  15599. }
  15600. delete instancesByReactRootID[prevComponent._instance.rootID];
  15601. ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
  15602. return true;
  15603. },
  15604. _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
  15605. !isValidContainer(container) ? false ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
  15606. if (shouldReuseMarkup) {
  15607. var rootElement = getReactRootElementInContainer(container);
  15608. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  15609. ReactDOMComponentTree.precacheNode(instance, rootElement);
  15610. return;
  15611. } else {
  15612. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  15613. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  15614. var rootMarkup = rootElement.outerHTML;
  15615. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  15616. var normalizedMarkup = markup;
  15617. if (false) {
  15618. // because rootMarkup is retrieved from the DOM, various normalizations
  15619. // will have occurred which will not be present in `markup`. Here,
  15620. // insert markup into a <div> or <iframe> depending on the container
  15621. // type to perform the same normalizations before comparing.
  15622. var normalizer;
  15623. if (container.nodeType === ELEMENT_NODE_TYPE) {
  15624. normalizer = document.createElement('div');
  15625. normalizer.innerHTML = markup;
  15626. normalizedMarkup = normalizer.innerHTML;
  15627. } else {
  15628. normalizer = document.createElement('iframe');
  15629. document.body.appendChild(normalizer);
  15630. normalizer.contentDocument.write(markup);
  15631. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  15632. document.body.removeChild(normalizer);
  15633. }
  15634. }
  15635. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  15636. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  15637. !(container.nodeType !== DOC_NODE_TYPE) ? false ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0;
  15638. if (false) {
  15639. process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;
  15640. }
  15641. }
  15642. }
  15643. !(container.nodeType !== DOC_NODE_TYPE) ? false ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0;
  15644. if (transaction.useCreateElement) {
  15645. while (container.lastChild) {
  15646. container.removeChild(container.lastChild);
  15647. }
  15648. DOMLazyTree.insertTreeBefore(container, markup, null);
  15649. } else {
  15650. setInnerHTML(container, markup);
  15651. ReactDOMComponentTree.precacheNode(instance, container.firstChild);
  15652. }
  15653. if (false) {
  15654. var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
  15655. if (hostNode._debugID !== 0) {
  15656. ReactInstrumentation.debugTool.onHostOperation({
  15657. instanceID: hostNode._debugID,
  15658. type: 'mount',
  15659. payload: markup.toString()
  15660. });
  15661. }
  15662. }
  15663. }
  15664. };
  15665. module.exports = ReactMount;
  15666. /***/ }),
  15667. /* 68 */
  15668. /***/ (function(module, exports, __webpack_require__) {
  15669. "use strict";
  15670. /**
  15671. * Copyright 2013-present, Facebook, Inc.
  15672. * All rights reserved.
  15673. *
  15674. * This source code is licensed under the BSD-style license found in the
  15675. * LICENSE file in the root directory of this source tree. An additional grant
  15676. * of patent rights can be found in the PATENTS file in the same directory.
  15677. *
  15678. *
  15679. */
  15680. var _prodInvariant = __webpack_require__(2);
  15681. var React = __webpack_require__(20);
  15682. var invariant = __webpack_require__(0);
  15683. var ReactNodeTypes = {
  15684. HOST: 0,
  15685. COMPOSITE: 1,
  15686. EMPTY: 2,
  15687. getType: function (node) {
  15688. if (node === null || node === false) {
  15689. return ReactNodeTypes.EMPTY;
  15690. } else if (React.isValidElement(node)) {
  15691. if (typeof node.type === 'function') {
  15692. return ReactNodeTypes.COMPOSITE;
  15693. } else {
  15694. return ReactNodeTypes.HOST;
  15695. }
  15696. }
  15697. true ? false ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
  15698. }
  15699. };
  15700. module.exports = ReactNodeTypes;
  15701. /***/ }),
  15702. /* 69 */
  15703. /***/ (function(module, exports, __webpack_require__) {
  15704. "use strict";
  15705. /**
  15706. * Copyright 2013-present, Facebook, Inc.
  15707. * All rights reserved.
  15708. *
  15709. * This source code is licensed under the BSD-style license found in the
  15710. * LICENSE file in the root directory of this source tree. An additional grant
  15711. * of patent rights can be found in the PATENTS file in the same directory.
  15712. *
  15713. */
  15714. var ViewportMetrics = {
  15715. currentScrollLeft: 0,
  15716. currentScrollTop: 0,
  15717. refreshScrollValues: function (scrollPosition) {
  15718. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  15719. ViewportMetrics.currentScrollTop = scrollPosition.y;
  15720. }
  15721. };
  15722. module.exports = ViewportMetrics;
  15723. /***/ }),
  15724. /* 70 */
  15725. /***/ (function(module, exports, __webpack_require__) {
  15726. "use strict";
  15727. /**
  15728. * Copyright 2014-present, Facebook, Inc.
  15729. * All rights reserved.
  15730. *
  15731. * This source code is licensed under the BSD-style license found in the
  15732. * LICENSE file in the root directory of this source tree. An additional grant
  15733. * of patent rights can be found in the PATENTS file in the same directory.
  15734. *
  15735. *
  15736. */
  15737. var _prodInvariant = __webpack_require__(2);
  15738. var invariant = __webpack_require__(0);
  15739. /**
  15740. * Accumulates items that must not be null or undefined into the first one. This
  15741. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  15742. * API cleanness. Since `current` can be null before being passed in and not
  15743. * null after this function, make sure to assign it back to `current`:
  15744. *
  15745. * `a = accumulateInto(a, b);`
  15746. *
  15747. * This API should be sparingly used. Try `accumulate` for something cleaner.
  15748. *
  15749. * @return {*|array<*>} An accumulation of items.
  15750. */
  15751. function accumulateInto(current, next) {
  15752. !(next != null) ? false ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
  15753. if (current == null) {
  15754. return next;
  15755. }
  15756. // Both are not empty. Warning: Never call x.concat(y) when you are not
  15757. // certain that x is an Array (x could be a string with concat method).
  15758. if (Array.isArray(current)) {
  15759. if (Array.isArray(next)) {
  15760. current.push.apply(current, next);
  15761. return current;
  15762. }
  15763. current.push(next);
  15764. return current;
  15765. }
  15766. if (Array.isArray(next)) {
  15767. // A bit too dangerous to mutate `next`.
  15768. return [current].concat(next);
  15769. }
  15770. return [current, next];
  15771. }
  15772. module.exports = accumulateInto;
  15773. /***/ }),
  15774. /* 71 */
  15775. /***/ (function(module, exports, __webpack_require__) {
  15776. "use strict";
  15777. /**
  15778. * Copyright 2013-present, Facebook, Inc.
  15779. * All rights reserved.
  15780. *
  15781. * This source code is licensed under the BSD-style license found in the
  15782. * LICENSE file in the root directory of this source tree. An additional grant
  15783. * of patent rights can be found in the PATENTS file in the same directory.
  15784. *
  15785. *
  15786. */
  15787. /**
  15788. * @param {array} arr an "accumulation" of items which is either an Array or
  15789. * a single item. Useful when paired with the `accumulate` module. This is a
  15790. * simple utility that allows us to reason about a collection of items, but
  15791. * handling the case when there is exactly one item (and we do not need to
  15792. * allocate an array).
  15793. */
  15794. function forEachAccumulated(arr, cb, scope) {
  15795. if (Array.isArray(arr)) {
  15796. arr.forEach(cb, scope);
  15797. } else if (arr) {
  15798. cb.call(scope, arr);
  15799. }
  15800. }
  15801. module.exports = forEachAccumulated;
  15802. /***/ }),
  15803. /* 72 */
  15804. /***/ (function(module, exports, __webpack_require__) {
  15805. "use strict";
  15806. /**
  15807. * Copyright 2013-present, Facebook, Inc.
  15808. * All rights reserved.
  15809. *
  15810. * This source code is licensed under the BSD-style license found in the
  15811. * LICENSE file in the root directory of this source tree. An additional grant
  15812. * of patent rights can be found in the PATENTS file in the same directory.
  15813. *
  15814. */
  15815. var ReactNodeTypes = __webpack_require__(68);
  15816. function getHostComponentFromComposite(inst) {
  15817. var type;
  15818. while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
  15819. inst = inst._renderedComponent;
  15820. }
  15821. if (type === ReactNodeTypes.HOST) {
  15822. return inst._renderedComponent;
  15823. } else if (type === ReactNodeTypes.EMPTY) {
  15824. return null;
  15825. }
  15826. }
  15827. module.exports = getHostComponentFromComposite;
  15828. /***/ }),
  15829. /* 73 */
  15830. /***/ (function(module, exports, __webpack_require__) {
  15831. "use strict";
  15832. /**
  15833. * Copyright 2013-present, Facebook, Inc.
  15834. * All rights reserved.
  15835. *
  15836. * This source code is licensed under the BSD-style license found in the
  15837. * LICENSE file in the root directory of this source tree. An additional grant
  15838. * of patent rights can be found in the PATENTS file in the same directory.
  15839. *
  15840. */
  15841. var ExecutionEnvironment = __webpack_require__(5);
  15842. var contentKey = null;
  15843. /**
  15844. * Gets the key used to access text content on a DOM node.
  15845. *
  15846. * @return {?string} Key used to access text content.
  15847. * @internal
  15848. */
  15849. function getTextContentAccessor() {
  15850. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  15851. // Prefer textContent to innerText because many browsers support both but
  15852. // SVG <text> elements don't support innerText even when <div> does.
  15853. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  15854. }
  15855. return contentKey;
  15856. }
  15857. module.exports = getTextContentAccessor;
  15858. /***/ }),
  15859. /* 74 */
  15860. /***/ (function(module, exports, __webpack_require__) {
  15861. "use strict";
  15862. /**
  15863. * Copyright 2013-present, Facebook, Inc.
  15864. * All rights reserved.
  15865. *
  15866. * This source code is licensed under the BSD-style license found in the
  15867. * LICENSE file in the root directory of this source tree. An additional grant
  15868. * of patent rights can be found in the PATENTS file in the same directory.
  15869. *
  15870. */
  15871. var _prodInvariant = __webpack_require__(2),
  15872. _assign = __webpack_require__(3);
  15873. var ReactCompositeComponent = __webpack_require__(153);
  15874. var ReactEmptyComponent = __webpack_require__(63);
  15875. var ReactHostComponent = __webpack_require__(65);
  15876. var getNextDebugID = __webpack_require__(200);
  15877. var invariant = __webpack_require__(0);
  15878. var warning = __webpack_require__(1);
  15879. // To avoid a cyclic dependency, we create the final class in this module
  15880. var ReactCompositeComponentWrapper = function (element) {
  15881. this.construct(element);
  15882. };
  15883. _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
  15884. _instantiateReactComponent: instantiateReactComponent
  15885. });
  15886. function getDeclarationErrorAddendum(owner) {
  15887. if (owner) {
  15888. var name = owner.getName();
  15889. if (name) {
  15890. return ' Check the render method of `' + name + '`.';
  15891. }
  15892. }
  15893. return '';
  15894. }
  15895. /**
  15896. * Check if the type reference is a known internal type. I.e. not a user
  15897. * provided composite type.
  15898. *
  15899. * @param {function} type
  15900. * @return {boolean} Returns true if this is a valid internal type.
  15901. */
  15902. function isInternalComponentType(type) {
  15903. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  15904. }
  15905. /**
  15906. * Given a ReactNode, create an instance that will actually be mounted.
  15907. *
  15908. * @param {ReactNode} node
  15909. * @param {boolean} shouldHaveDebugID
  15910. * @return {object} A new instance of the element's constructor.
  15911. * @protected
  15912. */
  15913. function instantiateReactComponent(node, shouldHaveDebugID) {
  15914. var instance;
  15915. if (node === null || node === false) {
  15916. instance = ReactEmptyComponent.create(instantiateReactComponent);
  15917. } else if (typeof node === 'object') {
  15918. var element = node;
  15919. var type = element.type;
  15920. if (typeof type !== 'function' && typeof type !== 'string') {
  15921. var info = '';
  15922. if (false) {
  15923. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  15924. info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
  15925. }
  15926. }
  15927. info += getDeclarationErrorAddendum(element._owner);
  15928. true ? false ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0;
  15929. }
  15930. // Special case string values
  15931. if (typeof element.type === 'string') {
  15932. instance = ReactHostComponent.createInternalComponent(element);
  15933. } else if (isInternalComponentType(element.type)) {
  15934. // This is temporarily available for custom components that are not string
  15935. // representations. I.e. ART. Once those are updated to use the string
  15936. // representation, we can drop this code path.
  15937. instance = new element.type(element);
  15938. // We renamed this. Allow the old name for compat. :(
  15939. if (!instance.getHostNode) {
  15940. instance.getHostNode = instance.getNativeNode;
  15941. }
  15942. } else {
  15943. instance = new ReactCompositeComponentWrapper(element);
  15944. }
  15945. } else if (typeof node === 'string' || typeof node === 'number') {
  15946. instance = ReactHostComponent.createInstanceForText(node);
  15947. } else {
  15948. true ? false ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
  15949. }
  15950. if (false) {
  15951. process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
  15952. }
  15953. // These two fields are used by the DOM and ART diffing algorithms
  15954. // respectively. Instead of using expandos on components, we should be
  15955. // storing the state needed by the diffing algorithms elsewhere.
  15956. instance._mountIndex = 0;
  15957. instance._mountImage = null;
  15958. if (false) {
  15959. instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
  15960. }
  15961. // Internal instances should fully constructed at this point, so they should
  15962. // not get any new fields added to them at this point.
  15963. if (false) {
  15964. if (Object.preventExtensions) {
  15965. Object.preventExtensions(instance);
  15966. }
  15967. }
  15968. return instance;
  15969. }
  15970. module.exports = instantiateReactComponent;
  15971. /***/ }),
  15972. /* 75 */
  15973. /***/ (function(module, exports, __webpack_require__) {
  15974. "use strict";
  15975. /**
  15976. * Copyright 2013-present, Facebook, Inc.
  15977. * All rights reserved.
  15978. *
  15979. * This source code is licensed under the BSD-style license found in the
  15980. * LICENSE file in the root directory of this source tree. An additional grant
  15981. * of patent rights can be found in the PATENTS file in the same directory.
  15982. *
  15983. *
  15984. */
  15985. /**
  15986. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  15987. */
  15988. var supportedInputTypes = {
  15989. 'color': true,
  15990. 'date': true,
  15991. 'datetime': true,
  15992. 'datetime-local': true,
  15993. 'email': true,
  15994. 'month': true,
  15995. 'number': true,
  15996. 'password': true,
  15997. 'range': true,
  15998. 'search': true,
  15999. 'tel': true,
  16000. 'text': true,
  16001. 'time': true,
  16002. 'url': true,
  16003. 'week': true
  16004. };
  16005. function isTextInputElement(elem) {
  16006. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  16007. if (nodeName === 'input') {
  16008. return !!supportedInputTypes[elem.type];
  16009. }
  16010. if (nodeName === 'textarea') {
  16011. return true;
  16012. }
  16013. return false;
  16014. }
  16015. module.exports = isTextInputElement;
  16016. /***/ }),
  16017. /* 76 */
  16018. /***/ (function(module, exports, __webpack_require__) {
  16019. "use strict";
  16020. /**
  16021. * Copyright 2013-present, Facebook, Inc.
  16022. * All rights reserved.
  16023. *
  16024. * This source code is licensed under the BSD-style license found in the
  16025. * LICENSE file in the root directory of this source tree. An additional grant
  16026. * of patent rights can be found in the PATENTS file in the same directory.
  16027. *
  16028. */
  16029. var ExecutionEnvironment = __webpack_require__(5);
  16030. var escapeTextContentForBrowser = __webpack_require__(31);
  16031. var setInnerHTML = __webpack_require__(32);
  16032. /**
  16033. * Set the textContent property of a node, ensuring that whitespace is preserved
  16034. * even in IE8. innerText is a poor substitute for textContent and, among many
  16035. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  16036. * as it should.
  16037. *
  16038. * @param {DOMElement} node
  16039. * @param {string} text
  16040. * @internal
  16041. */
  16042. var setTextContent = function (node, text) {
  16043. if (text) {
  16044. var firstChild = node.firstChild;
  16045. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
  16046. firstChild.nodeValue = text;
  16047. return;
  16048. }
  16049. }
  16050. node.textContent = text;
  16051. };
  16052. if (ExecutionEnvironment.canUseDOM) {
  16053. if (!('textContent' in document.documentElement)) {
  16054. setTextContent = function (node, text) {
  16055. if (node.nodeType === 3) {
  16056. node.nodeValue = text;
  16057. return;
  16058. }
  16059. setInnerHTML(node, escapeTextContentForBrowser(text));
  16060. };
  16061. }
  16062. }
  16063. module.exports = setTextContent;
  16064. /***/ }),
  16065. /* 77 */
  16066. /***/ (function(module, exports, __webpack_require__) {
  16067. "use strict";
  16068. /**
  16069. * Copyright 2013-present, Facebook, Inc.
  16070. * All rights reserved.
  16071. *
  16072. * This source code is licensed under the BSD-style license found in the
  16073. * LICENSE file in the root directory of this source tree. An additional grant
  16074. * of patent rights can be found in the PATENTS file in the same directory.
  16075. *
  16076. */
  16077. var _prodInvariant = __webpack_require__(2);
  16078. var ReactCurrentOwner = __webpack_require__(13);
  16079. var REACT_ELEMENT_TYPE = __webpack_require__(168);
  16080. var getIteratorFn = __webpack_require__(199);
  16081. var invariant = __webpack_require__(0);
  16082. var KeyEscapeUtils = __webpack_require__(39);
  16083. var warning = __webpack_require__(1);
  16084. var SEPARATOR = '.';
  16085. var SUBSEPARATOR = ':';
  16086. /**
  16087. * This is inlined from ReactElement since this file is shared between
  16088. * isomorphic and renderers. We could extract this to a
  16089. *
  16090. */
  16091. /**
  16092. * TODO: Test that a single child and an array with one item have the same key
  16093. * pattern.
  16094. */
  16095. var didWarnAboutMaps = false;
  16096. /**
  16097. * Generate a key string that identifies a component within a set.
  16098. *
  16099. * @param {*} component A component that could contain a manual key.
  16100. * @param {number} index Index that is used if a manual key is not provided.
  16101. * @return {string}
  16102. */
  16103. function getComponentKey(component, index) {
  16104. // Do some typechecking here since we call this blindly. We want to ensure
  16105. // that we don't block potential future ES APIs.
  16106. if (component && typeof component === 'object' && component.key != null) {
  16107. // Explicit key
  16108. return KeyEscapeUtils.escape(component.key);
  16109. }
  16110. // Implicit key determined by the index in the set
  16111. return index.toString(36);
  16112. }
  16113. /**
  16114. * @param {?*} children Children tree container.
  16115. * @param {!string} nameSoFar Name of the key path so far.
  16116. * @param {!function} callback Callback to invoke with each child found.
  16117. * @param {?*} traverseContext Used to pass information throughout the traversal
  16118. * process.
  16119. * @return {!number} The number of children in this subtree.
  16120. */
  16121. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  16122. var type = typeof children;
  16123. if (type === 'undefined' || type === 'boolean') {
  16124. // All of the above are perceived as null.
  16125. children = null;
  16126. }
  16127. if (children === null || type === 'string' || type === 'number' ||
  16128. // The following is inlined from ReactElement. This means we can optimize
  16129. // some checks. React Fiber also inlines this logic for similar purposes.
  16130. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  16131. callback(traverseContext, children,
  16132. // If it's the only child, treat the name as if it was wrapped in an array
  16133. // so that it's consistent if the number of children grows.
  16134. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  16135. return 1;
  16136. }
  16137. var child;
  16138. var nextName;
  16139. var subtreeCount = 0; // Count of children found in the current subtree.
  16140. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  16141. if (Array.isArray(children)) {
  16142. for (var i = 0; i < children.length; i++) {
  16143. child = children[i];
  16144. nextName = nextNamePrefix + getComponentKey(child, i);
  16145. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16146. }
  16147. } else {
  16148. var iteratorFn = getIteratorFn(children);
  16149. if (iteratorFn) {
  16150. var iterator = iteratorFn.call(children);
  16151. var step;
  16152. if (iteratorFn !== children.entries) {
  16153. var ii = 0;
  16154. while (!(step = iterator.next()).done) {
  16155. child = step.value;
  16156. nextName = nextNamePrefix + getComponentKey(child, ii++);
  16157. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16158. }
  16159. } else {
  16160. if (false) {
  16161. var mapsAsChildrenAddendum = '';
  16162. if (ReactCurrentOwner.current) {
  16163. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  16164. if (mapsAsChildrenOwnerName) {
  16165. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  16166. }
  16167. }
  16168. process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
  16169. didWarnAboutMaps = true;
  16170. }
  16171. // Iterator will provide entry [k,v] tuples rather than values.
  16172. while (!(step = iterator.next()).done) {
  16173. var entry = step.value;
  16174. if (entry) {
  16175. child = entry[1];
  16176. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  16177. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16178. }
  16179. }
  16180. }
  16181. } else if (type === 'object') {
  16182. var addendum = '';
  16183. if (false) {
  16184. addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
  16185. if (children._isReactElement) {
  16186. addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
  16187. }
  16188. if (ReactCurrentOwner.current) {
  16189. var name = ReactCurrentOwner.current.getName();
  16190. if (name) {
  16191. addendum += ' Check the render method of `' + name + '`.';
  16192. }
  16193. }
  16194. }
  16195. var childrenString = String(children);
  16196. true ? false ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
  16197. }
  16198. }
  16199. return subtreeCount;
  16200. }
  16201. /**
  16202. * Traverses children that are typically specified as `props.children`, but
  16203. * might also be specified through attributes:
  16204. *
  16205. * - `traverseAllChildren(this.props.children, ...)`
  16206. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  16207. *
  16208. * The `traverseContext` is an optional argument that is passed through the
  16209. * entire traversal. It can be used to store accumulations or anything else that
  16210. * the callback might find relevant.
  16211. *
  16212. * @param {?*} children Children tree object.
  16213. * @param {!function} callback To invoke upon traversing each child.
  16214. * @param {?*} traverseContext Context for traversal.
  16215. * @return {!number} The number of children in this subtree.
  16216. */
  16217. function traverseAllChildren(children, callback, traverseContext) {
  16218. if (children == null) {
  16219. return 0;
  16220. }
  16221. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  16222. }
  16223. module.exports = traverseAllChildren;
  16224. /***/ }),
  16225. /* 78 */
  16226. /***/ (function(module, exports, __webpack_require__) {
  16227. "use strict";
  16228. /**
  16229. * Copyright 2016-present, Facebook, Inc.
  16230. * All rights reserved.
  16231. *
  16232. * This source code is licensed under the BSD-style license found in the
  16233. * LICENSE file in the root directory of this source tree. An additional grant
  16234. * of patent rights can be found in the PATENTS file in the same directory.
  16235. *
  16236. *
  16237. */
  16238. var _prodInvariant = __webpack_require__(22);
  16239. var ReactCurrentOwner = __webpack_require__(13);
  16240. var invariant = __webpack_require__(0);
  16241. var warning = __webpack_require__(1);
  16242. function isNative(fn) {
  16243. // Based on isNative() from Lodash
  16244. var funcToString = Function.prototype.toString;
  16245. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16246. var reIsNative = RegExp('^' + funcToString
  16247. // Take an example native function source for comparison
  16248. .call(hasOwnProperty)
  16249. // Strip regex characters so we can use it for regex
  16250. .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  16251. // Remove hasOwnProperty from the template to make it generic
  16252. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
  16253. try {
  16254. var source = funcToString.call(fn);
  16255. return reIsNative.test(source);
  16256. } catch (err) {
  16257. return false;
  16258. }
  16259. }
  16260. var canUseCollections =
  16261. // Array.from
  16262. typeof Array.from === 'function' &&
  16263. // Map
  16264. typeof Map === 'function' && isNative(Map) &&
  16265. // Map.prototype.keys
  16266. Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
  16267. // Set
  16268. typeof Set === 'function' && isNative(Set) &&
  16269. // Set.prototype.keys
  16270. Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
  16271. var setItem;
  16272. var getItem;
  16273. var removeItem;
  16274. var getItemIDs;
  16275. var addRoot;
  16276. var removeRoot;
  16277. var getRootIDs;
  16278. if (canUseCollections) {
  16279. var itemMap = new Map();
  16280. var rootIDSet = new Set();
  16281. setItem = function (id, item) {
  16282. itemMap.set(id, item);
  16283. };
  16284. getItem = function (id) {
  16285. return itemMap.get(id);
  16286. };
  16287. removeItem = function (id) {
  16288. itemMap['delete'](id);
  16289. };
  16290. getItemIDs = function () {
  16291. return Array.from(itemMap.keys());
  16292. };
  16293. addRoot = function (id) {
  16294. rootIDSet.add(id);
  16295. };
  16296. removeRoot = function (id) {
  16297. rootIDSet['delete'](id);
  16298. };
  16299. getRootIDs = function () {
  16300. return Array.from(rootIDSet.keys());
  16301. };
  16302. } else {
  16303. var itemByKey = {};
  16304. var rootByKey = {};
  16305. // Use non-numeric keys to prevent V8 performance issues:
  16306. // https://github.com/facebook/react/pull/7232
  16307. var getKeyFromID = function (id) {
  16308. return '.' + id;
  16309. };
  16310. var getIDFromKey = function (key) {
  16311. return parseInt(key.substr(1), 10);
  16312. };
  16313. setItem = function (id, item) {
  16314. var key = getKeyFromID(id);
  16315. itemByKey[key] = item;
  16316. };
  16317. getItem = function (id) {
  16318. var key = getKeyFromID(id);
  16319. return itemByKey[key];
  16320. };
  16321. removeItem = function (id) {
  16322. var key = getKeyFromID(id);
  16323. delete itemByKey[key];
  16324. };
  16325. getItemIDs = function () {
  16326. return Object.keys(itemByKey).map(getIDFromKey);
  16327. };
  16328. addRoot = function (id) {
  16329. var key = getKeyFromID(id);
  16330. rootByKey[key] = true;
  16331. };
  16332. removeRoot = function (id) {
  16333. var key = getKeyFromID(id);
  16334. delete rootByKey[key];
  16335. };
  16336. getRootIDs = function () {
  16337. return Object.keys(rootByKey).map(getIDFromKey);
  16338. };
  16339. }
  16340. var unmountedIDs = [];
  16341. function purgeDeep(id) {
  16342. var item = getItem(id);
  16343. if (item) {
  16344. var childIDs = item.childIDs;
  16345. removeItem(id);
  16346. childIDs.forEach(purgeDeep);
  16347. }
  16348. }
  16349. function describeComponentFrame(name, source, ownerName) {
  16350. return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
  16351. }
  16352. function getDisplayName(element) {
  16353. if (element == null) {
  16354. return '#empty';
  16355. } else if (typeof element === 'string' || typeof element === 'number') {
  16356. return '#text';
  16357. } else if (typeof element.type === 'string') {
  16358. return element.type;
  16359. } else {
  16360. return element.type.displayName || element.type.name || 'Unknown';
  16361. }
  16362. }
  16363. function describeID(id) {
  16364. var name = ReactComponentTreeHook.getDisplayName(id);
  16365. var element = ReactComponentTreeHook.getElement(id);
  16366. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  16367. var ownerName;
  16368. if (ownerID) {
  16369. ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
  16370. }
  16371. false ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
  16372. return describeComponentFrame(name, element && element._source, ownerName);
  16373. }
  16374. var ReactComponentTreeHook = {
  16375. onSetChildren: function (id, nextChildIDs) {
  16376. var item = getItem(id);
  16377. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  16378. item.childIDs = nextChildIDs;
  16379. for (var i = 0; i < nextChildIDs.length; i++) {
  16380. var nextChildID = nextChildIDs[i];
  16381. var nextChild = getItem(nextChildID);
  16382. !nextChild ? false ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
  16383. !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? false ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
  16384. !nextChild.isMounted ? false ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
  16385. if (nextChild.parentID == null) {
  16386. nextChild.parentID = id;
  16387. // TODO: This shouldn't be necessary but mounting a new root during in
  16388. // componentWillMount currently causes not-yet-mounted components to
  16389. // be purged from our tree data so their parent id is missing.
  16390. }
  16391. !(nextChild.parentID === id) ? false ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
  16392. }
  16393. },
  16394. onBeforeMountComponent: function (id, element, parentID) {
  16395. var item = {
  16396. element: element,
  16397. parentID: parentID,
  16398. text: null,
  16399. childIDs: [],
  16400. isMounted: false,
  16401. updateCount: 0
  16402. };
  16403. setItem(id, item);
  16404. },
  16405. onBeforeUpdateComponent: function (id, element) {
  16406. var item = getItem(id);
  16407. if (!item || !item.isMounted) {
  16408. // We may end up here as a result of setState() in componentWillUnmount().
  16409. // In this case, ignore the element.
  16410. return;
  16411. }
  16412. item.element = element;
  16413. },
  16414. onMountComponent: function (id) {
  16415. var item = getItem(id);
  16416. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  16417. item.isMounted = true;
  16418. var isRoot = item.parentID === 0;
  16419. if (isRoot) {
  16420. addRoot(id);
  16421. }
  16422. },
  16423. onUpdateComponent: function (id) {
  16424. var item = getItem(id);
  16425. if (!item || !item.isMounted) {
  16426. // We may end up here as a result of setState() in componentWillUnmount().
  16427. // In this case, ignore the element.
  16428. return;
  16429. }
  16430. item.updateCount++;
  16431. },
  16432. onUnmountComponent: function (id) {
  16433. var item = getItem(id);
  16434. if (item) {
  16435. // We need to check if it exists.
  16436. // `item` might not exist if it is inside an error boundary, and a sibling
  16437. // error boundary child threw while mounting. Then this instance never
  16438. // got a chance to mount, but it still gets an unmounting event during
  16439. // the error boundary cleanup.
  16440. item.isMounted = false;
  16441. var isRoot = item.parentID === 0;
  16442. if (isRoot) {
  16443. removeRoot(id);
  16444. }
  16445. }
  16446. unmountedIDs.push(id);
  16447. },
  16448. purgeUnmountedComponents: function () {
  16449. if (ReactComponentTreeHook._preventPurging) {
  16450. // Should only be used for testing.
  16451. return;
  16452. }
  16453. for (var i = 0; i < unmountedIDs.length; i++) {
  16454. var id = unmountedIDs[i];
  16455. purgeDeep(id);
  16456. }
  16457. unmountedIDs.length = 0;
  16458. },
  16459. isMounted: function (id) {
  16460. var item = getItem(id);
  16461. return item ? item.isMounted : false;
  16462. },
  16463. getCurrentStackAddendum: function (topElement) {
  16464. var info = '';
  16465. if (topElement) {
  16466. var name = getDisplayName(topElement);
  16467. var owner = topElement._owner;
  16468. info += describeComponentFrame(name, topElement._source, owner && owner.getName());
  16469. }
  16470. var currentOwner = ReactCurrentOwner.current;
  16471. var id = currentOwner && currentOwner._debugID;
  16472. info += ReactComponentTreeHook.getStackAddendumByID(id);
  16473. return info;
  16474. },
  16475. getStackAddendumByID: function (id) {
  16476. var info = '';
  16477. while (id) {
  16478. info += describeID(id);
  16479. id = ReactComponentTreeHook.getParentID(id);
  16480. }
  16481. return info;
  16482. },
  16483. getChildIDs: function (id) {
  16484. var item = getItem(id);
  16485. return item ? item.childIDs : [];
  16486. },
  16487. getDisplayName: function (id) {
  16488. var element = ReactComponentTreeHook.getElement(id);
  16489. if (!element) {
  16490. return null;
  16491. }
  16492. return getDisplayName(element);
  16493. },
  16494. getElement: function (id) {
  16495. var item = getItem(id);
  16496. return item ? item.element : null;
  16497. },
  16498. getOwnerID: function (id) {
  16499. var element = ReactComponentTreeHook.getElement(id);
  16500. if (!element || !element._owner) {
  16501. return null;
  16502. }
  16503. return element._owner._debugID;
  16504. },
  16505. getParentID: function (id) {
  16506. var item = getItem(id);
  16507. return item ? item.parentID : null;
  16508. },
  16509. getSource: function (id) {
  16510. var item = getItem(id);
  16511. var element = item ? item.element : null;
  16512. var source = element != null ? element._source : null;
  16513. return source;
  16514. },
  16515. getText: function (id) {
  16516. var element = ReactComponentTreeHook.getElement(id);
  16517. if (typeof element === 'string') {
  16518. return element;
  16519. } else if (typeof element === 'number') {
  16520. return '' + element;
  16521. } else {
  16522. return null;
  16523. }
  16524. },
  16525. getUpdateCount: function (id) {
  16526. var item = getItem(id);
  16527. return item ? item.updateCount : 0;
  16528. },
  16529. getRootIDs: getRootIDs,
  16530. getRegisteredIDs: getItemIDs
  16531. };
  16532. module.exports = ReactComponentTreeHook;
  16533. /***/ }),
  16534. /* 79 */
  16535. /***/ (function(module, exports, __webpack_require__) {
  16536. "use strict";
  16537. /**
  16538. * Copyright 2014-present, Facebook, Inc.
  16539. * All rights reserved.
  16540. *
  16541. * This source code is licensed under the BSD-style license found in the
  16542. * LICENSE file in the root directory of this source tree. An additional grant
  16543. * of patent rights can be found in the PATENTS file in the same directory.
  16544. *
  16545. *
  16546. */
  16547. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  16548. // nor polyfill, then a plain number is used for performance.
  16549. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  16550. module.exports = REACT_ELEMENT_TYPE;
  16551. /***/ }),
  16552. /* 80 */
  16553. /***/ (function(module, exports, __webpack_require__) {
  16554. "use strict";
  16555. /**
  16556. * Copyright 2013-present, Facebook, Inc.
  16557. * All rights reserved.
  16558. *
  16559. * This source code is licensed under the BSD-style license found in the
  16560. * LICENSE file in the root directory of this source tree. An additional grant
  16561. * of patent rights can be found in the PATENTS file in the same directory.
  16562. *
  16563. *
  16564. */
  16565. var ReactPropTypeLocationNames = {};
  16566. if (false) {
  16567. ReactPropTypeLocationNames = {
  16568. prop: 'prop',
  16569. context: 'context',
  16570. childContext: 'child context'
  16571. };
  16572. }
  16573. module.exports = ReactPropTypeLocationNames;
  16574. /***/ }),
  16575. /* 81 */
  16576. /***/ (function(module, exports, __webpack_require__) {
  16577. "use strict";
  16578. /**
  16579. * Copyright 2013-present, Facebook, Inc.
  16580. * All rights reserved.
  16581. *
  16582. * This source code is licensed under the BSD-style license found in the
  16583. * LICENSE file in the root directory of this source tree. An additional grant
  16584. * of patent rights can be found in the PATENTS file in the same directory.
  16585. *
  16586. *
  16587. */
  16588. var canDefineProperty = false;
  16589. if (false) {
  16590. try {
  16591. // $FlowFixMe https://github.com/facebook/flow/issues/285
  16592. Object.defineProperty({}, 'x', { get: function () {} });
  16593. canDefineProperty = true;
  16594. } catch (x) {
  16595. // IE will fail on defineProperty
  16596. }
  16597. }
  16598. module.exports = canDefineProperty;
  16599. /***/ }),
  16600. /* 82 */
  16601. /***/ (function(module, exports, __webpack_require__) {
  16602. "use strict";
  16603. /**
  16604. * Copyright 2013-present, Facebook, Inc.
  16605. * All rights reserved.
  16606. *
  16607. * This source code is licensed under the BSD-style license found in the
  16608. * LICENSE file in the root directory of this source tree. An additional grant
  16609. * of patent rights can be found in the PATENTS file in the same directory.
  16610. *
  16611. *
  16612. */
  16613. /* global Symbol */
  16614. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  16615. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  16616. /**
  16617. * Returns the iterator method function contained on the iterable object.
  16618. *
  16619. * Be sure to invoke the function with the iterable as context:
  16620. *
  16621. * var iteratorFn = getIteratorFn(myIterable);
  16622. * if (iteratorFn) {
  16623. * var iterator = iteratorFn.call(myIterable);
  16624. * ...
  16625. * }
  16626. *
  16627. * @param {?object} maybeIterable
  16628. * @return {?function}
  16629. */
  16630. function getIteratorFn(maybeIterable) {
  16631. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  16632. if (typeof iteratorFn === 'function') {
  16633. return iteratorFn;
  16634. }
  16635. }
  16636. module.exports = getIteratorFn;
  16637. /***/ }),
  16638. /* 83 */
  16639. /***/ (function(module, exports, __webpack_require__) {
  16640. "use strict";
  16641. /**
  16642. * @author oldj
  16643. * @blog http://oldj.net
  16644. */
  16645. Object.defineProperty(exports, "__esModule", {
  16646. value: true
  16647. });
  16648. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  16649. var _react = __webpack_require__(7);
  16650. var _react2 = _interopRequireDefault(_react);
  16651. var _panel = __webpack_require__(96);
  16652. var _panel2 = _interopRequireDefault(_panel);
  16653. var _content = __webpack_require__(86);
  16654. var _content2 = _interopRequireDefault(_content);
  16655. var _edit = __webpack_require__(89);
  16656. var _edit2 = _interopRequireDefault(_edit);
  16657. var _Agent = __webpack_require__(14);
  16658. var _Agent2 = _interopRequireDefault(_Agent);
  16659. var _index = __webpack_require__(219);
  16660. var _index2 = _interopRequireDefault(_index);
  16661. __webpack_require__(112);
  16662. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16663. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16664. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  16665. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  16666. //import SudoPrompt from './frame/sudo'
  16667. //import PreferencesPrompt from './frame/preferences'
  16668. var App = function (_React$Component) {
  16669. _inherits(App, _React$Component);
  16670. function App(props) {
  16671. _classCallCheck(this, App);
  16672. var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props));
  16673. _this.state = {
  16674. list: [], // 用户的 hosts 列表
  16675. sys_hosts: {}, // 系统 hosts
  16676. current: {}, // 当前 hosts
  16677. lang: {} // 语言
  16678. };
  16679. _this.loadHosts();
  16680. _Agent2.default.pact('getLang').then(function (lang) {
  16681. _this.setState({ lang: lang });
  16682. });
  16683. _index2.default.reg(_this);
  16684. return _this;
  16685. }
  16686. _createClass(App, [{
  16687. key: 'loadHosts',
  16688. value: function loadHosts() {
  16689. var _this2 = this;
  16690. _Agent2.default.pact('getHosts').then(function (data) {
  16691. _this2.setState({
  16692. list: data.list,
  16693. sys_hosts: data.sys_hosts,
  16694. current: data.sys_hosts
  16695. });
  16696. });
  16697. }
  16698. }, {
  16699. key: 'setCurrent',
  16700. value: function setCurrent(hosts) {
  16701. var _this3 = this;
  16702. if (hosts.is_sys) {
  16703. _Agent2.default.pact('getSysHosts').then(function (_hosts) {
  16704. _this3.setState({
  16705. sys_hosts: _hosts,
  16706. current: _hosts
  16707. });
  16708. });
  16709. } else {
  16710. this.setState({
  16711. current: hosts
  16712. });
  16713. }
  16714. }
  16715. }, {
  16716. key: 'toSave',
  16717. value: function toSave() {
  16718. var _this4 = this;
  16719. clearTimeout(this._t);
  16720. this._t = setTimeout(function () {
  16721. _Agent2.default.emit('save', _this4.state.list);
  16722. }, 1000);
  16723. }
  16724. }, {
  16725. key: 'setHostsContent',
  16726. value: function setHostsContent(v) {
  16727. if (this.state.current.content === v) return; // not changed
  16728. this.state.current.content = v || '';
  16729. this.toSave();
  16730. }
  16731. }, {
  16732. key: 'componentDidMount',
  16733. value: function componentDidMount() {
  16734. window.addEventListener('keydown', function (e) {
  16735. if (e.keyCode === 27) {
  16736. _Agent2.default.emit('esc');
  16737. }
  16738. }, false);
  16739. }
  16740. }, {
  16741. key: 'render',
  16742. value: function render() {
  16743. var current = this.state.current;
  16744. return _react2.default.createElement(
  16745. 'div',
  16746. { id: 'app', className: 'platform-' + _Agent2.default.platform },
  16747. _react2.default.createElement(_panel2.default, {
  16748. list: this.state.list,
  16749. sys_hosts: this.state.sys_hosts,
  16750. current: current,
  16751. setCurrent: this.setCurrent.bind(this),
  16752. lang: this.state.lang
  16753. }),
  16754. _react2.default.createElement(_content2.default, {
  16755. current: current,
  16756. readonly: App.isReadOnly(current),
  16757. setHostsContent: this.setHostsContent.bind(this),
  16758. lang: this.state.lang
  16759. }),
  16760. _react2.default.createElement(
  16761. 'div',
  16762. { className: 'frames' },
  16763. _react2.default.createElement(_edit2.default, { lang: this.state.lang, list: this.state.list })
  16764. )
  16765. );
  16766. }
  16767. }], [{
  16768. key: 'isReadOnly',
  16769. value: function isReadOnly(hosts) {
  16770. return !hosts || hosts.is_sys || hosts.where === 'remote' || hosts.where === 'group';
  16771. }
  16772. }]);
  16773. return App;
  16774. }(_react2.default.Component);
  16775. exports.default = App;
  16776. /***/ }),
  16777. /* 84 */
  16778. /***/ (function(module, exports, __webpack_require__) {
  16779. "use strict";
  16780. module.exports = __webpack_require__(154);
  16781. /***/ }),
  16782. /* 85 */
  16783. /***/ (function(module, exports, __webpack_require__) {
  16784. "use strict";
  16785. // custom mode
  16786. Object.defineProperty(exports, "__esModule", {
  16787. value: true
  16788. });
  16789. exports.default = function () {
  16790. _codemirror2.default.defineMode('hosts', function () {
  16791. function tokenBase(stream) {
  16792. if (stream.eatSpace()) return null;
  16793. var sol = stream.sol();
  16794. var ch = stream.next();
  16795. var s = stream.string;
  16796. if (ch === '#') {
  16797. stream.skipToEnd();
  16798. return 'comment';
  16799. }
  16800. if (!s.match(/^\s*([\d\.]+|[\da-f:\.%lo]+)\s+\w/i)) {
  16801. return 'error';
  16802. }
  16803. if (sol && ch.match(/[\w\.:%]/)) {
  16804. stream.eatWhile(/[\w\.:%]/);
  16805. return 'ip';
  16806. }
  16807. return null;
  16808. }
  16809. function tokenize(stream, state) {
  16810. return (state.tokens[0] || tokenBase)(stream, state);
  16811. }
  16812. return {
  16813. startState: function startState() {
  16814. return { tokens: [] };
  16815. },
  16816. token: function token(stream, state) {
  16817. return tokenize(stream, state);
  16818. },
  16819. lineComment: '#'
  16820. };
  16821. });
  16822. //CodeMirror.defineMIME('text/x-hosts', 'hosts');
  16823. };
  16824. var _codemirror = __webpack_require__(33);
  16825. var _codemirror2 = _interopRequireDefault(_codemirror);
  16826. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16827. /***/ }),
  16828. /* 86 */
  16829. /***/ (function(module, exports, __webpack_require__) {
  16830. "use strict";
  16831. /**
  16832. * @author oldj
  16833. * @blog https://oldj.net
  16834. */
  16835. Object.defineProperty(exports, "__esModule", {
  16836. value: true
  16837. });
  16838. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  16839. var _react = __webpack_require__(7);
  16840. var _react2 = _interopRequireDefault(_react);
  16841. var _classnames = __webpack_require__(16);
  16842. var _classnames2 = _interopRequireDefault(_classnames);
  16843. var _editor = __webpack_require__(87);
  16844. var _editor2 = _interopRequireDefault(_editor);
  16845. __webpack_require__(113);
  16846. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16847. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16848. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  16849. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  16850. var Content = function (_React$Component) {
  16851. _inherits(Content, _React$Component);
  16852. function Content(props) {
  16853. _classCallCheck(this, Content);
  16854. var _this = _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).call(this, props));
  16855. _this.state = {
  16856. is_loading: _this.props.current.is_loading
  16857. };
  16858. return _this;
  16859. }
  16860. _createClass(Content, [{
  16861. key: 'setValue',
  16862. value: function setValue(v) {
  16863. this.props.setHostsContent(v);
  16864. }
  16865. }, {
  16866. key: 'render',
  16867. value: function render() {
  16868. var _props = this.props,
  16869. current = _props.current,
  16870. lang = _props.lang;
  16871. return _react2.default.createElement(
  16872. 'div',
  16873. { id: 'sh-content' },
  16874. _react2.default.createElement(
  16875. 'div',
  16876. { className: 'inform' },
  16877. _react2.default.createElement(
  16878. 'span',
  16879. {
  16880. className: (0, _classnames2.default)({
  16881. loading: 1,
  16882. show: this.state.is_loading
  16883. })
  16884. },
  16885. 'loading...'
  16886. ),
  16887. _react2.default.createElement('i', {
  16888. className: (0, _classnames2.default)({
  16889. show: current.where === 'remote',
  16890. iconfont: 1,
  16891. 'icon-earth': 1
  16892. }),
  16893. title: lang.remote_hosts
  16894. }),
  16895. _react2.default.createElement('i', {
  16896. className: (0, _classnames2.default)({
  16897. show: this.props.readonly,
  16898. iconfont: 1,
  16899. 'icon-lock2': 1
  16900. }),
  16901. title: lang.readonly
  16902. })
  16903. ),
  16904. _react2.default.createElement(
  16905. 'div',
  16906. { className: (0, _classnames2.default)({
  16907. errorMessage: 1,
  16908. show: !!this.props.current.error
  16909. }) },
  16910. this.props.current.error
  16911. ),
  16912. _react2.default.createElement(_editor2.default, {
  16913. readonly: this.props.readonly,
  16914. code: this.props.current.content || '',
  16915. setValue: this.setValue.bind(this)
  16916. })
  16917. );
  16918. }
  16919. }]);
  16920. return Content;
  16921. }(_react2.default.Component);
  16922. exports.default = Content;
  16923. /***/ }),
  16924. /* 87 */
  16925. /***/ (function(module, exports, __webpack_require__) {
  16926. "use strict";
  16927. /**
  16928. * @author oldj
  16929. * @blog http://oldj.net
  16930. */
  16931. Object.defineProperty(exports, "__esModule", {
  16932. value: true
  16933. });
  16934. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  16935. var _react = __webpack_require__(7);
  16936. var _react2 = _interopRequireDefault(_react);
  16937. var _codemirror = __webpack_require__(33);
  16938. var _codemirror2 = _interopRequireDefault(_codemirror);
  16939. __webpack_require__(128);
  16940. var _classnames = __webpack_require__(16);
  16941. var _classnames2 = _interopRequireDefault(_classnames);
  16942. var _kw = __webpack_require__(88);
  16943. var _kw2 = _interopRequireDefault(_kw);
  16944. var _Agent = __webpack_require__(14);
  16945. var _Agent2 = _interopRequireDefault(_Agent);
  16946. __webpack_require__(123);
  16947. __webpack_require__(114);
  16948. var _cm_hl = __webpack_require__(85);
  16949. var _cm_hl2 = _interopRequireDefault(_cm_hl);
  16950. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16951. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16952. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  16953. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  16954. // import '../../../node_modules/codemirror/addon/comment/comment'
  16955. (0, _cm_hl2.default)();
  16956. var Editor = function (_React$Component) {
  16957. _inherits(Editor, _React$Component);
  16958. function Editor(props) {
  16959. _classCallCheck(this, Editor);
  16960. var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));
  16961. _this.codemirror = null;
  16962. _this.marks = [];
  16963. _this.kw = '';
  16964. _this.state = {};
  16965. _Agent2.default.on('search', function (kw) {
  16966. _this.kw = kw;
  16967. _this.highlightKeyword();
  16968. });
  16969. return _this;
  16970. }
  16971. _createClass(Editor, [{
  16972. key: 'highlightKeyword',
  16973. value: function highlightKeyword() {
  16974. var _this2 = this;
  16975. while (this.marks.length > 0) {
  16976. this.marks.shift().clear();
  16977. }
  16978. var code = this.props.code;
  16979. var pos = _kw2.default.findPositions(this.kw, code) || [];
  16980. // this.codemirror.markText({line: 6, ch: 16}, {line: 6, ch: 22}, {className: 'cm-hl'});
  16981. pos.map(function (p) {
  16982. _this2.marks.push(_this2.codemirror.markText(p[0], p[1], { className: 'cm-hl' }));
  16983. });
  16984. }
  16985. }, {
  16986. key: 'setValue',
  16987. value: function setValue(v) {
  16988. this.props.setValue(v);
  16989. }
  16990. }, {
  16991. key: 'toComment',
  16992. value: function toComment() {
  16993. var doc = this.codemirror.getDoc();
  16994. var cur = doc.getCursor();
  16995. var line = cur.line;
  16996. var info = doc.lineInfo(line);
  16997. this.codemirror.toggleComment({
  16998. line: line,
  16999. cur: 0
  17000. }, {
  17001. line: line,
  17002. cur: info.text.length
  17003. });
  17004. }
  17005. }, {
  17006. key: 'componentDidMount',
  17007. value: function componentDidMount() {
  17008. var _this3 = this;
  17009. // console.log(this.cnt_node, this.cnt_node.value);
  17010. this.codemirror = _codemirror2.default.fromTextArea(this.cnt_node, {
  17011. lineNumbers: true,
  17012. readOnly: true,
  17013. mode: 'hosts'
  17014. });
  17015. this.codemirror.setSize('100%', '100%');
  17016. this.codemirror.on('change', function (a) {
  17017. var v = a.getDoc().getValue();
  17018. _this3.setValue(v);
  17019. });
  17020. this.codemirror.on('gutterClick', function (cm, n) {
  17021. if (_this3.props.readonly === true) return;
  17022. var info = cm.lineInfo(n);
  17023. //cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
  17024. var ln = info.text;
  17025. if (/^\s*$/.test(ln)) return;
  17026. var new_ln = void 0;
  17027. if (/^#/.test(ln)) {
  17028. new_ln = ln.replace(/^#\s*/, '');
  17029. } else {
  17030. new_ln = '# ' + ln;
  17031. }
  17032. _this3.codemirror.getDoc().replaceRange(new_ln, { line: info.line, ch: 0 }, {
  17033. line: info.line,
  17034. ch: ln.length
  17035. });
  17036. //app.caculateHosts();
  17037. });
  17038. _Agent2.default.on('to_comment', function () {
  17039. _this3.toComment();
  17040. });
  17041. }
  17042. }, {
  17043. key: 'componentWillReceiveProps',
  17044. value: function componentWillReceiveProps(next_props) {
  17045. var _this4 = this;
  17046. // console.log(next_props);
  17047. this.codemirror.getDoc().setValue(next_props.code);
  17048. this.codemirror.setOption('readOnly', next_props.readonly);
  17049. setTimeout(function () {
  17050. _this4.highlightKeyword();
  17051. }, 100);
  17052. }
  17053. }, {
  17054. key: 'render',
  17055. value: function render() {
  17056. var _this5 = this;
  17057. return _react2.default.createElement(
  17058. 'div',
  17059. {
  17060. id: 'sh-editor',
  17061. className: (0, _classnames2.default)({
  17062. readonly: this.props.readonly
  17063. }) },
  17064. _react2.default.createElement('textarea', {
  17065. ref: function ref(c) {
  17066. return _this5.cnt_node = c;
  17067. },
  17068. defaultValue: this.props.code || ''
  17069. })
  17070. );
  17071. }
  17072. }]);
  17073. return Editor;
  17074. }(_react2.default.Component);
  17075. exports.default = Editor;
  17076. /***/ }),
  17077. /* 88 */
  17078. /***/ (function(module, exports, __webpack_require__) {
  17079. "use strict";
  17080. /**
  17081. * kw
  17082. * @author oldj
  17083. * @blog http://oldj.net
  17084. */
  17085. function kw2re(kw) {
  17086. // 模糊搜索
  17087. var r = void 0;
  17088. var m = void 0;
  17089. var flag = [];
  17090. if (kw === '/') {
  17091. return;
  17092. } else if (m = kw.match(/^\/([^\/]+)\/?(\w*)$/)) {
  17093. if (m[2].indexOf('i') > -1) {
  17094. flag.push('i');
  17095. }
  17096. // if (m[2].indexOf('g') > -1) {
  17097. flag.push('g');
  17098. // }
  17099. try {
  17100. r = new RegExp(m[1], flag.join(''));
  17101. } catch (e) {}
  17102. } else if (kw.indexOf('*') > -1) {
  17103. try {
  17104. r = new RegExp(kw.replace(/\*/g, '.*'), 'ig');
  17105. } catch (e) {}
  17106. }
  17107. return r;
  17108. }
  17109. exports.findPositions = function (kw, code) {
  17110. if (!kw || kw === '/') return;
  17111. var r = kw2re(kw);
  17112. if (!r) {
  17113. try {
  17114. r = new RegExp(kw.replace(/([\.\?\*\+\^\$\(\)\-\[\]\{\}])/g, '\\$1'), 'ig');
  17115. } catch (e) {
  17116. console.log(e);
  17117. return;
  17118. }
  17119. }
  17120. var indexes = [];
  17121. var lines = code.split('\n');
  17122. lines.map(function (ln, idx) {
  17123. var match = void 0;
  17124. var max_loop = 30;
  17125. while (match = r.exec(ln)) {
  17126. indexes.push([{ line: idx, ch: match.index }, { line: idx, ch: match.index + match[0].length }]);
  17127. max_loop--;
  17128. if (max_loop < 0) break;
  17129. }
  17130. });
  17131. return indexes;
  17132. };
  17133. exports.kw2re = kw2re;
  17134. /***/ }),
  17135. /* 89 */
  17136. /***/ (function(module, exports, __webpack_require__) {
  17137. "use strict";
  17138. /**
  17139. * @author oldj
  17140. * @blog https://oldj.net
  17141. */
  17142. Object.defineProperty(exports, "__esModule", {
  17143. value: true
  17144. });
  17145. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  17146. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17147. var _react = __webpack_require__(7);
  17148. var _react2 = _interopRequireDefault(_react);
  17149. var _frame = __webpack_require__(90);
  17150. var _frame2 = _interopRequireDefault(_frame);
  17151. var _classnames = __webpack_require__(16);
  17152. var _classnames2 = _interopRequireDefault(_classnames);
  17153. var _group = __webpack_require__(91);
  17154. var _group2 = _interopRequireDefault(_group);
  17155. var _Agent = __webpack_require__(14);
  17156. var _Agent2 = _interopRequireDefault(_Agent);
  17157. var _makeId = __webpack_require__(218);
  17158. var _makeId2 = _interopRequireDefault(_makeId);
  17159. __webpack_require__(115);
  17160. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17161. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17162. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  17163. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  17164. var EditPrompt = function (_React$Component) {
  17165. _inherits(EditPrompt, _React$Component);
  17166. function EditPrompt(props) {
  17167. _classCallCheck(this, EditPrompt);
  17168. var _this = _possibleConstructorReturn(this, (EditPrompt.__proto__ || Object.getPrototypeOf(EditPrompt)).call(this, props));
  17169. _this.state = {
  17170. show: false,
  17171. is_add: true,
  17172. where: 'local',
  17173. title: '',
  17174. url: '',
  17175. last_refresh: null,
  17176. refresh_interval: 0,
  17177. is_loading: false
  17178. };
  17179. _this.current_hosts = null;
  17180. return _this;
  17181. }
  17182. _createClass(EditPrompt, [{
  17183. key: 'tryToFocus',
  17184. value: function tryToFocus() {
  17185. var el = this.refs.body && this.refs.body.querySelector('input[type=text]');
  17186. el && el.focus();
  17187. }
  17188. }, {
  17189. key: 'clear',
  17190. value: function clear() {
  17191. this.setState({
  17192. where: 'local',
  17193. title: '',
  17194. url: '',
  17195. last_refresh: null,
  17196. refresh_interval: 0
  17197. });
  17198. }
  17199. }, {
  17200. key: 'componentDidMount',
  17201. value: function componentDidMount() {
  17202. var _this2 = this;
  17203. _Agent2.default.on('add_hosts', function () {
  17204. _this2.setState({
  17205. show: true,
  17206. is_add: true
  17207. });
  17208. setTimeout(function () {
  17209. _this2.tryToFocus();
  17210. }, 100);
  17211. });
  17212. _Agent2.default.on('edit_hosts', function (hosts) {
  17213. _this2.current_hosts = hosts;
  17214. _this2.setState({
  17215. show: true,
  17216. is_add: false,
  17217. where: hosts.where || 'local',
  17218. title: hosts.title || '',
  17219. url: hosts.url || '',
  17220. last_refresh: hosts.last_refresh || null,
  17221. refresh_interval: hosts.refresh_interval || 0
  17222. });
  17223. setTimeout(function () {
  17224. _this2.tryToFocus();
  17225. }, 100);
  17226. });
  17227. _Agent2.default.on('loading_done', function (old_hosts, data) {
  17228. if (old_hosts === _this2.current_hosts) {
  17229. _this2.setState({
  17230. last_refresh: data.last_refresh,
  17231. is_loading: false
  17232. });
  17233. _Agent2.default.emit('host_refreshed', data, _this2.current_hosts);
  17234. }
  17235. });
  17236. }
  17237. }, {
  17238. key: 'onOK',
  17239. value: function onOK() {
  17240. this.setState({
  17241. title: (this.state.title || '').replace(/^\s+|\s+$/g, ''),
  17242. url: (this.state.url || '').replace(/^\s+|\s+$/g, '')
  17243. });
  17244. if (this.state.title === '') {
  17245. this.refs.title.focus();
  17246. return false;
  17247. }
  17248. if (this.state.where === 'remote' && this.state.url === '') {
  17249. this.refs.url.focus();
  17250. return false;
  17251. }
  17252. var data = Object.assign({}, this.current_hosts, this.state, this.state.is_add ? {
  17253. id: (0, _makeId2.default)(),
  17254. content: '# ' + this.state.title,
  17255. on: false
  17256. } : {});
  17257. if (!data.id) data.id = (0, _makeId2.default)();
  17258. delete data['is_add'];
  17259. _Agent2.default.emit('update_hosts', data);
  17260. this.setState({
  17261. show: false
  17262. });
  17263. this.clear();
  17264. }
  17265. }, {
  17266. key: 'onCancel',
  17267. value: function onCancel() {
  17268. this.setState({
  17269. show: false
  17270. });
  17271. this.clear();
  17272. }
  17273. }, {
  17274. key: 'confirmDel',
  17275. value: function confirmDel() {
  17276. var lang = this.props.lang;
  17277. if (!confirm(lang.confirm_del)) return;
  17278. _Agent2.default.emit('del_hosts', this.current_hosts);
  17279. this.setState({
  17280. show: false
  17281. });
  17282. this.clear();
  17283. }
  17284. }, {
  17285. key: 'getRefreshOptions',
  17286. value: function getRefreshOptions() {
  17287. var lang = this.props.lang;
  17288. var k = [[0, '' + lang.never], [1, '1 ' + lang.hour], [24, '24 ' + lang.hours], [168, '7 ' + lang.days]];
  17289. if (_Agent2.default.IS_DEV) {
  17290. k.splice(1, 0, [0.002778, '10s (for DEV)']); // dev test only
  17291. }
  17292. return k.map(function (_ref, idx) {
  17293. var _ref2 = _slicedToArray(_ref, 2),
  17294. v = _ref2[0],
  17295. n = _ref2[1];
  17296. return _react2.default.createElement(
  17297. 'option',
  17298. { value: v, key: idx },
  17299. n
  17300. );
  17301. });
  17302. }
  17303. }, {
  17304. key: 'getEditOperations',
  17305. value: function getEditOperations() {
  17306. if (this.state.is_add) return null;
  17307. var lang = this.props.lang;
  17308. return _react2.default.createElement(
  17309. 'div',
  17310. null,
  17311. _react2.default.createElement(
  17312. 'div',
  17313. { className: 'ln' },
  17314. _react2.default.createElement(
  17315. 'a',
  17316. { href: '#', className: 'del',
  17317. onClick: this.confirmDel.bind(this)
  17318. },
  17319. _react2.default.createElement('i', { className: 'iconfont icon-delete' }),
  17320. _react2.default.createElement(
  17321. 'span',
  17322. null,
  17323. lang.del_hosts
  17324. )
  17325. )
  17326. )
  17327. );
  17328. }
  17329. }, {
  17330. key: 'refresh',
  17331. value: function refresh() {
  17332. var _this3 = this;
  17333. if (this.state.is_loading) return;
  17334. _Agent2.default.emit('check_host_refresh', this.current_hosts, true);
  17335. this.setState({
  17336. is_loading: true
  17337. }, function () {
  17338. setTimeout(function () {
  17339. _this3.setState({
  17340. is_loading: false
  17341. });
  17342. }, 1000);
  17343. });
  17344. }
  17345. }, {
  17346. key: 'renderGroup',
  17347. value: function renderGroup() {
  17348. if (this.state.where !== 'group') return null;
  17349. return _react2.default.createElement(_group2.default, { list: this.props.list });
  17350. }
  17351. }, {
  17352. key: 'renderRemoteInputs',
  17353. value: function renderRemoteInputs() {
  17354. var _this4 = this;
  17355. if (this.state.where !== 'remote') return null;
  17356. var lang = this.props.lang;
  17357. return _react2.default.createElement(
  17358. 'div',
  17359. { className: 'remote-ipts' },
  17360. _react2.default.createElement(
  17361. 'div',
  17362. { className: 'ln' },
  17363. _react2.default.createElement(
  17364. 'div',
  17365. { className: 'title' },
  17366. lang.url
  17367. ),
  17368. _react2.default.createElement(
  17369. 'div',
  17370. { className: 'cnt' },
  17371. _react2.default.createElement('input', {
  17372. type: 'text',
  17373. ref: 'url',
  17374. value: this.state.url,
  17375. placeholder: 'http://',
  17376. onChange: function onChange(e) {
  17377. return _this4.setState({ url: e.target.value });
  17378. },
  17379. onKeyDown: function onKeyDown(e) {
  17380. return e.keyCode === 13 && _this4.onOK() || e.keyCode === 27 && _this4.onCancel();
  17381. }
  17382. })
  17383. )
  17384. ),
  17385. _react2.default.createElement(
  17386. 'div',
  17387. { className: 'ln' },
  17388. _react2.default.createElement(
  17389. 'div',
  17390. { className: 'title' },
  17391. lang.auto_refresh
  17392. ),
  17393. _react2.default.createElement(
  17394. 'div',
  17395. { className: 'cnt' },
  17396. _react2.default.createElement(
  17397. 'select',
  17398. {
  17399. value: this.state.refresh_interval,
  17400. onChange: function onChange(e) {
  17401. return _this4.setState({ refresh_interval: parseFloat(e.target.value) || 0 });
  17402. }
  17403. },
  17404. this.getRefreshOptions()
  17405. ),
  17406. _react2.default.createElement('i', {
  17407. className: (0, _classnames2.default)({
  17408. iconfont: 1,
  17409. 'icon-refresh': 1,
  17410. 'invisible': !this.current_hosts || this.state.url !== this.current_hosts.url,
  17411. 'loading': this.state.is_loading
  17412. }),
  17413. title: lang.refresh,
  17414. onClick: function onClick() {
  17415. return _this4.refresh();
  17416. }
  17417. }),
  17418. _react2.default.createElement(
  17419. 'span',
  17420. { className: 'last-refresh' },
  17421. lang.last_refresh,
  17422. this.state.last_refresh || 'N/A'
  17423. )
  17424. )
  17425. )
  17426. );
  17427. }
  17428. }, {
  17429. key: 'body',
  17430. value: function body() {
  17431. var _this5 = this;
  17432. var lang = this.props.lang;
  17433. return _react2.default.createElement(
  17434. 'div',
  17435. { ref: 'body' },
  17436. _react2.default.createElement(
  17437. 'div',
  17438. { className: 'ln' },
  17439. _react2.default.createElement('input', { id: 'ipt-local', type: 'radio', name: 'where', value: 'local',
  17440. checked: this.state.where === 'local',
  17441. onChange: function onChange(e) {
  17442. return _this5.setState({ where: e.target.value });
  17443. }
  17444. }),
  17445. _react2.default.createElement(
  17446. 'label',
  17447. { htmlFor: 'ipt-local' },
  17448. lang.where_local
  17449. ),
  17450. _react2.default.createElement('input', { id: 'ipt-remote', type: 'radio', name: 'where', value: 'remote',
  17451. checked: this.state.where === 'remote',
  17452. onChange: function onChange(e) {
  17453. return _this5.setState({ where: e.target.value });
  17454. }
  17455. }),
  17456. _react2.default.createElement(
  17457. 'label',
  17458. { htmlFor: 'ipt-remote' },
  17459. lang.where_remote
  17460. ),
  17461. _react2.default.createElement('input', { id: 'ipt-remote', type: 'radio', name: 'where', value: 'group',
  17462. checked: this.state.where === 'group',
  17463. onChange: function onChange(e) {
  17464. return _this5.setState({ where: e.target.value });
  17465. }
  17466. }),
  17467. _react2.default.createElement(
  17468. 'label',
  17469. { htmlFor: 'ipt-remote' },
  17470. lang.where_group
  17471. )
  17472. ),
  17473. _react2.default.createElement(
  17474. 'div',
  17475. { className: 'ln' },
  17476. _react2.default.createElement(
  17477. 'div',
  17478. { className: 'title' },
  17479. lang.host_title
  17480. ),
  17481. _react2.default.createElement(
  17482. 'div',
  17483. { className: 'cnt' },
  17484. _react2.default.createElement('input', {
  17485. type: 'text',
  17486. ref: 'title',
  17487. name: 'text',
  17488. value: this.state.title,
  17489. onChange: function onChange(e) {
  17490. return _this5.setState({ title: e.target.value });
  17491. },
  17492. onKeyDown: function onKeyDown(e) {
  17493. return e.keyCode === 13 && _this5.onOK() || e.keyCode === 27 && _this5.onCancel();
  17494. }
  17495. })
  17496. )
  17497. ),
  17498. this.renderRemoteInputs(),
  17499. this.renderGroup(),
  17500. this.getEditOperations()
  17501. );
  17502. }
  17503. }, {
  17504. key: 'render',
  17505. value: function render() {
  17506. var _this6 = this;
  17507. var lang = this.props.lang;
  17508. return _react2.default.createElement(_frame2.default, {
  17509. show: this.state.show,
  17510. head: lang[this.state.is_add ? 'add_hosts' : 'edit_hosts'],
  17511. body: this.body(),
  17512. onOK: function onOK() {
  17513. return _this6.onOK();
  17514. },
  17515. onCancel: function onCancel() {
  17516. return _this6.onCancel();
  17517. },
  17518. lang: this.props.lang
  17519. });
  17520. }
  17521. }]);
  17522. return EditPrompt;
  17523. }(_react2.default.Component);
  17524. exports.default = EditPrompt;
  17525. /***/ }),
  17526. /* 90 */
  17527. /***/ (function(module, exports, __webpack_require__) {
  17528. "use strict";
  17529. /**
  17530. * @author oldj
  17531. * @blog http://oldj.net
  17532. */
  17533. Object.defineProperty(exports, "__esModule", {
  17534. value: true
  17535. });
  17536. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17537. var _react = __webpack_require__(7);
  17538. var _react2 = _interopRequireDefault(_react);
  17539. var _Agent = __webpack_require__(14);
  17540. var _Agent2 = _interopRequireDefault(_Agent);
  17541. __webpack_require__(116);
  17542. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17543. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17544. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  17545. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  17546. var MyFrame = function (_React$Component) {
  17547. _inherits(MyFrame, _React$Component);
  17548. function MyFrame(props) {
  17549. _classCallCheck(this, MyFrame);
  17550. return _possibleConstructorReturn(this, (MyFrame.__proto__ || Object.getPrototypeOf(MyFrame)).call(this, props));
  17551. }
  17552. _createClass(MyFrame, [{
  17553. key: 'componentDidMount',
  17554. value: function componentDidMount() {
  17555. var _this2 = this;
  17556. _Agent2.default.on('esc', function () {
  17557. _this2.onCancel();
  17558. });
  17559. }
  17560. }, {
  17561. key: 'onOK',
  17562. value: function onOK() {
  17563. this.props.onOK();
  17564. }
  17565. }, {
  17566. key: 'onCancel',
  17567. value: function onCancel() {
  17568. this.props.onCancel();
  17569. }
  17570. }, {
  17571. key: 'renderFootButtons',
  17572. value: function renderFootButtons() {
  17573. var html = [];
  17574. var lang = this.props.lang;
  17575. html.push(_react2.default.createElement(
  17576. 'div',
  17577. {
  17578. className: 'button btn-cancel',
  17579. key: 'btn-cancel',
  17580. onClick: this.onCancel.bind(this)
  17581. },
  17582. this.props.cancel_title || lang.cancel
  17583. ));
  17584. html.push(_react2.default.createElement(
  17585. 'div',
  17586. {
  17587. className: 'button btn-ok btn-default',
  17588. key: 'btn-ok',
  17589. onClick: this.onOK.bind(this)
  17590. },
  17591. this.props.ok_title || lang.ok
  17592. ));
  17593. return html;
  17594. }
  17595. }, {
  17596. key: 'render',
  17597. value: function render() {
  17598. if (!this.props.show) {
  17599. return null;
  17600. }
  17601. return _react2.default.createElement(
  17602. 'div',
  17603. { className: 'frame', ref: 'frame' },
  17604. _react2.default.createElement('div', { className: 'overlay' }),
  17605. _react2.default.createElement(
  17606. 'div',
  17607. { className: 'prompt' },
  17608. _react2.default.createElement(
  17609. 'div',
  17610. { className: 'head' },
  17611. this.props.head
  17612. ),
  17613. _react2.default.createElement(
  17614. 'div',
  17615. { className: 'body' },
  17616. this.props.body
  17617. ),
  17618. _react2.default.createElement(
  17619. 'div',
  17620. { className: 'foot' },
  17621. this.renderFootButtons()
  17622. )
  17623. )
  17624. );
  17625. }
  17626. }]);
  17627. return MyFrame;
  17628. }(_react2.default.Component);
  17629. exports.default = MyFrame;
  17630. /***/ }),
  17631. /* 91 */
  17632. /***/ (function(module, exports, __webpack_require__) {
  17633. "use strict";
  17634. /**
  17635. * @author oldj
  17636. * @blog https://oldj.net
  17637. */
  17638. Object.defineProperty(exports, "__esModule", {
  17639. value: true
  17640. });
  17641. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  17642. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17643. var _react = __webpack_require__(7);
  17644. var _react2 = _interopRequireDefault(_react);
  17645. var _classnames = __webpack_require__(16);
  17646. var _classnames2 = _interopRequireDefault(_classnames);
  17647. var _sortablejs = __webpack_require__(216);
  17648. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  17649. var _listToArray = __webpack_require__(217);
  17650. var _listToArray2 = _interopRequireDefault(_listToArray);
  17651. __webpack_require__(117);
  17652. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17653. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17654. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  17655. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  17656. var Group = function (_React$Component) {
  17657. _inherits(Group, _React$Component);
  17658. function Group(props) {
  17659. _classCallCheck(this, Group);
  17660. var _this = _possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props));
  17661. _this.state = {
  17662. list: []
  17663. };
  17664. _this.current_hosts = null;
  17665. return _this;
  17666. }
  17667. _createClass(Group, [{
  17668. key: 'makeItem',
  17669. value: function makeItem(item) {
  17670. var attrs = {
  17671. 'data-id': 'id:' + (item.id || '')
  17672. };
  17673. return _react2.default.createElement(
  17674. 'div',
  17675. _extends({ className: 'hosts-item' }, attrs),
  17676. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  17677. 'iconfont': 1,
  17678. 'item-icon': 1,
  17679. 'icon-file': item.where !== 'group',
  17680. 'icon-files': item.where === 'group'
  17681. })
  17682. }),
  17683. _react2.default.createElement(
  17684. 'span',
  17685. null,
  17686. item.title
  17687. )
  17688. );
  17689. }
  17690. }, {
  17691. key: 'makeList',
  17692. value: function makeList() {
  17693. var _this2 = this;
  17694. var items = this.state.list.filter(function (item) {
  17695. return item.where !== 'group';
  17696. }).map(function (item) {
  17697. return _this2.makeItem(item);
  17698. });
  17699. return _react2.default.createElement(
  17700. 'div',
  17701. { id: 'hosts-group-valid' },
  17702. _react2.default.createElement(
  17703. 'div',
  17704. { ref: 'group_valid', className: 'hosts-group-list' },
  17705. items
  17706. )
  17707. );
  17708. }
  17709. }, {
  17710. key: 'currentList',
  17711. value: function currentList() {
  17712. return _react2.default.createElement(
  17713. 'div',
  17714. { id: 'hosts-group-current' },
  17715. _react2.default.createElement('div', { ref: 'group_current', className: 'hosts-group-list' })
  17716. );
  17717. }
  17718. }, {
  17719. key: 'getCurrentListFromDOM',
  17720. value: function getCurrentListFromDOM() {
  17721. var nodes = this.refs.group_current.getElementsByClassName('hosts-item');
  17722. nodes = (0, _listToArray2.default)(nodes);
  17723. console.log(nodes);
  17724. }
  17725. }, {
  17726. key: 'componentWillMount',
  17727. value: function componentWillMount() {
  17728. console.log(1111);
  17729. console.log(this.props);
  17730. this.setState({
  17731. list: this.props.list
  17732. });
  17733. }
  17734. }, {
  17735. key: 'componentDidMount',
  17736. value: function componentDidMount() {
  17737. var _this3 = this;
  17738. _sortablejs2.default.create(this.refs.group_valid, {
  17739. group: 'sorting',
  17740. sort: false
  17741. });
  17742. _sortablejs2.default.create(this.refs.group_current, {
  17743. group: 'sorting',
  17744. sort: true,
  17745. onSort: function onSort(evt) {
  17746. _this3.getCurrentListFromDOM();
  17747. }
  17748. });
  17749. }
  17750. }, {
  17751. key: 'render',
  17752. value: function render() {
  17753. return _react2.default.createElement(
  17754. 'div',
  17755. { id: 'hosts-group' },
  17756. this.makeList(),
  17757. _react2.default.createElement('div', { className: 'arrow' }),
  17758. this.currentList()
  17759. );
  17760. }
  17761. }]);
  17762. return Group;
  17763. }(_react2.default.Component);
  17764. exports.default = Group;
  17765. /***/ }),
  17766. /* 92 */
  17767. /***/ (function(module, exports, __webpack_require__) {
  17768. "use strict";
  17769. /**
  17770. * @author oldj
  17771. * @blog http://oldj.net
  17772. */
  17773. var _react = __webpack_require__(7);
  17774. var _react2 = _interopRequireDefault(_react);
  17775. var _reactDom = __webpack_require__(84);
  17776. var _reactDom2 = _interopRequireDefault(_reactDom);
  17777. var _app = __webpack_require__(83);
  17778. var _app2 = _interopRequireDefault(_app);
  17779. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17780. _reactDom2.default.render(_react2.default.createElement(_app2.default, null), document.getElementById('app'));
  17781. /***/ }),
  17782. /* 93 */
  17783. /***/ (function(module, exports, __webpack_require__) {
  17784. "use strict";
  17785. /**
  17786. * @author oldj
  17787. * @blog https://oldj.net
  17788. */
  17789. Object.defineProperty(exports, "__esModule", {
  17790. value: true
  17791. });
  17792. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17793. var _react = __webpack_require__(7);
  17794. var _react2 = _interopRequireDefault(_react);
  17795. var _classnames = __webpack_require__(16);
  17796. var _classnames2 = _interopRequireDefault(_classnames);
  17797. var _Agent = __webpack_require__(14);
  17798. var _Agent2 = _interopRequireDefault(_Agent);
  17799. __webpack_require__(118);
  17800. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17801. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17802. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  17803. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  17804. var Buttons = function (_React$Component) {
  17805. _inherits(Buttons, _React$Component);
  17806. function Buttons(props) {
  17807. _classCallCheck(this, Buttons);
  17808. var _this = _possibleConstructorReturn(this, (Buttons.__proto__ || Object.getPrototypeOf(Buttons)).call(this, props));
  17809. _this.state = {
  17810. top_toggle_on: true,
  17811. search_on: false
  17812. };
  17813. _this.on_items = null;
  17814. return _this;
  17815. }
  17816. _createClass(Buttons, [{
  17817. key: 'btnToggle',
  17818. value: function btnToggle() {
  17819. var _this2 = this;
  17820. if (this.state.top_toggle_on) {
  17821. _Agent2.default.emit('get_on_hosts', function (items) {
  17822. _this2.on_items = items;
  17823. });
  17824. }
  17825. this.setState({
  17826. top_toggle_on: !this.state.top_toggle_on
  17827. }, function () {
  17828. _Agent2.default.emit('top_toggle', _this2.state.top_toggle_on, _this2.on_items);
  17829. if (_this2.state.top_toggle_on) {
  17830. _this2.on_items = null;
  17831. }
  17832. });
  17833. }
  17834. }, {
  17835. key: 'btnSearch',
  17836. value: function btnSearch() {
  17837. var _this3 = this;
  17838. this.setState({
  17839. search_on: !this.state.search_on
  17840. }, function () {
  17841. _Agent2.default.emit(_this3.state.search_on ? 'search_on' : 'search_off');
  17842. });
  17843. }
  17844. }, {
  17845. key: 'cancelSearch',
  17846. value: function cancelSearch() {
  17847. this.setState({
  17848. search_on: false
  17849. }, function () {
  17850. _Agent2.default.emit('search_off');
  17851. });
  17852. }
  17853. }, {
  17854. key: 'componentDidMount',
  17855. value: function componentDidMount() {
  17856. var _this4 = this;
  17857. _Agent2.default.on('to_search', function () {
  17858. _this4.btnSearch();
  17859. });
  17860. }
  17861. }, {
  17862. key: 'render',
  17863. value: function render() {
  17864. var _this5 = this;
  17865. return _react2.default.createElement(
  17866. 'div',
  17867. { id: 'sh-buttons' },
  17868. _react2.default.createElement(
  17869. 'div',
  17870. { className: 'left' },
  17871. _react2.default.createElement(
  17872. 'a',
  17873. {
  17874. className: 'btn-add',
  17875. href: '#',
  17876. onClick: function onClick() {
  17877. return Buttons.btnAdd();
  17878. }
  17879. },
  17880. '+'
  17881. )
  17882. ),
  17883. _react2.default.createElement(
  17884. 'div',
  17885. { className: 'right' },
  17886. _react2.default.createElement('i', {
  17887. className: (0, _classnames2.default)({
  17888. iconfont: 1,
  17889. 'icon-search': 1,
  17890. 'on': this.state.search_on
  17891. }),
  17892. onClick: function onClick() {
  17893. return _this5.btnSearch();
  17894. }
  17895. }),
  17896. _react2.default.createElement('i', {
  17897. className: (0, _classnames2.default)({
  17898. iconfont: 1,
  17899. 'icon-switchon': this.state.top_toggle_on,
  17900. 'icon-switchoff': !this.state.top_toggle_on
  17901. }),
  17902. onClick: function onClick() {
  17903. return _this5.btnToggle();
  17904. }
  17905. })
  17906. )
  17907. );
  17908. }
  17909. }], [{
  17910. key: 'btnAdd',
  17911. value: function btnAdd() {
  17912. _Agent2.default.emit('add_hosts');
  17913. }
  17914. }]);
  17915. return Buttons;
  17916. }(_react2.default.Component);
  17917. exports.default = Buttons;
  17918. /***/ }),
  17919. /* 94 */
  17920. /***/ (function(module, exports, __webpack_require__) {
  17921. "use strict";
  17922. /**
  17923. * @author oldj
  17924. * @blog https://oldj.net
  17925. */
  17926. Object.defineProperty(exports, "__esModule", {
  17927. value: true
  17928. });
  17929. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17930. var _react = __webpack_require__(7);
  17931. var _react2 = _interopRequireDefault(_react);
  17932. var _classnames = __webpack_require__(16);
  17933. var _classnames2 = _interopRequireDefault(_classnames);
  17934. var _Agent = __webpack_require__(14);
  17935. var _Agent2 = _interopRequireDefault(_Agent);
  17936. __webpack_require__(119);
  17937. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17938. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17939. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  17940. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  17941. var ListItem = function (_React$Component) {
  17942. _inherits(ListItem, _React$Component);
  17943. function ListItem(props) {
  17944. _classCallCheck(this, ListItem);
  17945. var _this = _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).call(this, props));
  17946. _this.is_sys = !!_this.props.sys;
  17947. _this.state = {};
  17948. return _this;
  17949. }
  17950. _createClass(ListItem, [{
  17951. key: 'getTitle',
  17952. value: function getTitle() {
  17953. var lang = this.props.lang;
  17954. return this.is_sys ? lang.sys_host_title : this.props.data.title || lang.untitled;
  17955. }
  17956. }, {
  17957. key: 'beSelected',
  17958. value: function beSelected() {
  17959. this.props.setCurrent(this.props.data);
  17960. }
  17961. }, {
  17962. key: 'toggle',
  17963. value: function toggle() {
  17964. var on = !this.props.data.on;
  17965. _Agent2.default.emit('toggle_hosts', this.props.data, on);
  17966. }
  17967. }, {
  17968. key: 'toEdit',
  17969. value: function toEdit() {
  17970. _Agent2.default.emit('edit_hosts', this.props.data);
  17971. }
  17972. }, {
  17973. key: 'componentDidMount',
  17974. value: function componentDidMount() {
  17975. var _this2 = this;
  17976. _Agent2.default.on('select', function (id) {
  17977. if (id && id === _this2.props.data.id) {
  17978. _this2.beSelected();
  17979. _this2.el && _this2.el.scrollIntoView();
  17980. }
  17981. });
  17982. }
  17983. }, {
  17984. key: 'render',
  17985. value: function render() {
  17986. var _this3 = this;
  17987. var _props = this.props,
  17988. data = _props.data,
  17989. sys = _props.sys,
  17990. current = _props.current;
  17991. var is_selected = data === current;
  17992. if (!data) return null;
  17993. return _react2.default.createElement(
  17994. 'div',
  17995. { className: (0, _classnames2.default)({
  17996. 'list-item': 1
  17997. //, 'hidden': !this.isMatched()
  17998. , 'sys-hosts': sys,
  17999. 'selected': is_selected
  18000. }),
  18001. onClick: this.beSelected.bind(this),
  18002. ref: function ref(el) {
  18003. return _this3.el = el;
  18004. }
  18005. },
  18006. sys ? null : _react2.default.createElement(
  18007. 'div',
  18008. null,
  18009. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  18010. 'switch': 1,
  18011. 'iconfont': 1,
  18012. 'icon-on': data.on,
  18013. 'icon-off': !data.on
  18014. }),
  18015. onClick: this.toggle.bind(this)
  18016. }),
  18017. _react2.default.createElement('i', {
  18018. className: 'iconfont icon-edit',
  18019. onClick: this.toEdit.bind(this)
  18020. })
  18021. ),
  18022. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  18023. 'iconfont': 1,
  18024. 'item-icon': 1,
  18025. 'icon-warn': !!data.error,
  18026. 'icon-file': !sys && !data.error && data.where !== 'group',
  18027. 'icon-files': data.where === 'group',
  18028. 'icon-sysserver': sys && !data.error
  18029. }),
  18030. title: data.error || ''
  18031. }),
  18032. _react2.default.createElement(
  18033. 'span',
  18034. null,
  18035. this.getTitle()
  18036. )
  18037. );
  18038. }
  18039. }]);
  18040. return ListItem;
  18041. }(_react2.default.Component);
  18042. exports.default = ListItem;
  18043. /***/ }),
  18044. /* 95 */
  18045. /***/ (function(module, exports, __webpack_require__) {
  18046. "use strict";
  18047. /**
  18048. * @author oldj
  18049. * @blog https://oldj.net
  18050. */
  18051. Object.defineProperty(exports, "__esModule", {
  18052. value: true
  18053. });
  18054. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  18055. var _react = __webpack_require__(7);
  18056. var _react2 = _interopRequireDefault(_react);
  18057. var _listItem = __webpack_require__(94);
  18058. var _listItem2 = _interopRequireDefault(_listItem);
  18059. __webpack_require__(120);
  18060. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18061. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18062. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  18063. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  18064. var List = function (_React$Component) {
  18065. _inherits(List, _React$Component);
  18066. function List(props) {
  18067. _classCallCheck(this, List);
  18068. var _this = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, props));
  18069. _this.state = {};
  18070. return _this;
  18071. }
  18072. _createClass(List, [{
  18073. key: 'customItems',
  18074. value: function customItems() {
  18075. var _this2 = this;
  18076. return this.props.list.map(function (item, idx) {
  18077. return _react2.default.createElement(_listItem2.default, {
  18078. data: item,
  18079. idx: idx,
  18080. current: _this2.props.current,
  18081. setCurrent: _this2.props.setCurrent
  18082. //onToggle={(success) => this.toggleOne(idx, success)}
  18083. , key: 'hosts-' + idx
  18084. //dragOrder={(sidx, tidx) => this.dragOrder(sidx, tidx)}
  18085. });
  18086. });
  18087. }
  18088. }, {
  18089. key: 'render',
  18090. value: function render() {
  18091. return _react2.default.createElement(
  18092. 'div',
  18093. { id: 'sh-list' },
  18094. _react2.default.createElement(_listItem2.default, {
  18095. data: this.props.sys_hosts,
  18096. lang: this.props.lang,
  18097. current: this.props.current,
  18098. setCurrent: this.props.setCurrent,
  18099. sys: '1' }),
  18100. _react2.default.createElement(
  18101. 'div',
  18102. { ref: 'items', className: 'custom-items' },
  18103. this.customItems()
  18104. )
  18105. );
  18106. }
  18107. }]);
  18108. return List;
  18109. }(_react2.default.Component);
  18110. exports.default = List;
  18111. /***/ }),
  18112. /* 96 */
  18113. /***/ (function(module, exports, __webpack_require__) {
  18114. "use strict";
  18115. /**
  18116. * @author oldj
  18117. * @blog http://oldj.net
  18118. */
  18119. Object.defineProperty(exports, "__esModule", {
  18120. value: true
  18121. });
  18122. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  18123. var _react = __webpack_require__(7);
  18124. var _react2 = _interopRequireDefault(_react);
  18125. var _buttons = __webpack_require__(93);
  18126. var _buttons2 = _interopRequireDefault(_buttons);
  18127. var _searchbar = __webpack_require__(97);
  18128. var _searchbar2 = _interopRequireDefault(_searchbar);
  18129. var _list = __webpack_require__(95);
  18130. var _list2 = _interopRequireDefault(_list);
  18131. __webpack_require__(121);
  18132. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18133. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18134. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  18135. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  18136. var Panel = function (_React$Component) {
  18137. _inherits(Panel, _React$Component);
  18138. function Panel() {
  18139. _classCallCheck(this, Panel);
  18140. return _possibleConstructorReturn(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).apply(this, arguments));
  18141. }
  18142. _createClass(Panel, [{
  18143. key: 'render',
  18144. value: function render() {
  18145. return _react2.default.createElement(
  18146. 'div',
  18147. { id: 'panel' },
  18148. _react2.default.createElement(_list2.default, this.props),
  18149. _react2.default.createElement(_searchbar2.default, null),
  18150. _react2.default.createElement(_buttons2.default, null)
  18151. );
  18152. }
  18153. }]);
  18154. return Panel;
  18155. }(_react2.default.Component);
  18156. exports.default = Panel;
  18157. /***/ }),
  18158. /* 97 */
  18159. /***/ (function(module, exports, __webpack_require__) {
  18160. "use strict";
  18161. /**
  18162. * @author oldj
  18163. * @blog http://oldj.net
  18164. */
  18165. Object.defineProperty(exports, "__esModule", {
  18166. value: true
  18167. });
  18168. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  18169. var _react = __webpack_require__(7);
  18170. var _react2 = _interopRequireDefault(_react);
  18171. var _Agent = __webpack_require__(14);
  18172. var _Agent2 = _interopRequireDefault(_Agent);
  18173. __webpack_require__(122);
  18174. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18175. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18176. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  18177. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  18178. var SearchBar = function (_React$Component) {
  18179. _inherits(SearchBar, _React$Component);
  18180. function SearchBar(props) {
  18181. _classCallCheck(this, SearchBar);
  18182. var _this = _possibleConstructorReturn(this, (SearchBar.__proto__ || Object.getPrototypeOf(SearchBar)).call(this, props));
  18183. _this.state = {
  18184. show: false,
  18185. keyword: ''
  18186. };
  18187. _this._t = null;
  18188. _Agent2.default.on('search_on', function () {
  18189. _this.setState({
  18190. show: true
  18191. }, function () {
  18192. setTimeout(function () {
  18193. _this.refs.keyword.focus();
  18194. }, 100);
  18195. });
  18196. });
  18197. _Agent2.default.on('search_off', function () {
  18198. _this.clearSearch();
  18199. });
  18200. return _this;
  18201. }
  18202. _createClass(SearchBar, [{
  18203. key: 'clearSearch',
  18204. value: function clearSearch() {
  18205. this.setState({
  18206. show: false,
  18207. keyword: ''
  18208. });
  18209. _Agent2.default.emit('search', '');
  18210. }
  18211. }, {
  18212. key: 'doSearch',
  18213. value: function doSearch(kw) {
  18214. this.setState({
  18215. keyword: kw
  18216. });
  18217. clearTimeout(this._t);
  18218. this._t = setTimeout(function () {
  18219. _Agent2.default.emit('search', kw);
  18220. }, 300);
  18221. }
  18222. }, {
  18223. key: 'render',
  18224. value: function render() {
  18225. var _this2 = this;
  18226. if (!this.state.show) {
  18227. return null;
  18228. }
  18229. return _react2.default.createElement(
  18230. 'div',
  18231. { id: 'sh-searchbar' },
  18232. _react2.default.createElement('input', {
  18233. ref: 'keyword',
  18234. type: 'text',
  18235. placeholder: 'keyword',
  18236. value: this.state.keyword,
  18237. onChange: function onChange(e) {
  18238. return _this2.doSearch(e.target.value);
  18239. },
  18240. onKeyDown: function onKeyDown(e) {
  18241. return e.keyCode === 27 && SearchBar.onCancel();
  18242. }
  18243. })
  18244. );
  18245. }
  18246. }], [{
  18247. key: 'onCancel',
  18248. value: function onCancel() {
  18249. _Agent2.default.emit('cancel_search');
  18250. }
  18251. }]);
  18252. return SearchBar;
  18253. }(_react2.default.Component);
  18254. exports.default = SearchBar;
  18255. /***/ }),
  18256. /* 98 */
  18257. /***/ (function(module, exports, __webpack_require__) {
  18258. exports = module.exports = __webpack_require__(6)();
  18259. // imports
  18260. // module
  18261. exports.push([module.i, "html,\nbody {\n margin: 0;\n padding: 0;\n height: 100%;\n font-size: 12px;\n font-family: Arial, Helvetica, sans-serif;\n color: #212121;\n line-height: 20px;\n background: #fff;\n}\na {\n text-decoration: none;\n}\n#app {\n height: 100%;\n}\n", ""]);
  18262. // exports
  18263. /***/ }),
  18264. /* 99 */
  18265. /***/ (function(module, exports, __webpack_require__) {
  18266. exports = module.exports = __webpack_require__(6)();
  18267. // imports
  18268. // module
  18269. exports.push([module.i, "#sh-content {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 240px;\n height: 100%;\n}\n#sh-content .inform {\n position: absolute;\n z-index: 100;\n top: 5px;\n right: 10px;\n opacity: 0.5;\n background: #fff;\n}\n#sh-content .inform i {\n display: none;\n color: #666;\n margin-left: 5px;\n}\n#sh-content .inform i.show {\n display: inline-block;\n}\n#sh-content .inform span {\n display: none;\n}\n#sh-content .inform span.show {\n display: inline-block;\n}\n#sh-content .errorMessage {\n display: none;\n position: absolute;\n z-index: 101;\n top: 0;\n left: 0;\n right: 0;\n padding: 4px 40px;\n text-align: center;\n background: rgba(153, 0, 0, 0.5);\n color: #fff;\n transition: 0.5s;\n}\n#sh-content .errorMessage.show {\n display: block;\n}\n.platform-win32 #sh-content .inform {\n right: 20px;\n}\n", ""]);
  18270. // exports
  18271. /***/ }),
  18272. /* 100 */
  18273. /***/ (function(module, exports, __webpack_require__) {
  18274. exports = module.exports = __webpack_require__(6)();
  18275. // imports
  18276. // module
  18277. exports.push([module.i, "#sh-editor {\n height: 100%;\n font-family: Menlo, \"Source Code Pro\", Monaco, \"Courier New\", sans-serif;\n}\n#sh-editor .cm-s-default .cm-comment {\n color: #090;\n}\n#sh-editor .cm-s-default .cm-ip {\n color: #00a;\n font-weight: bold;\n}\n#sh-editor .cm-s-default .cm-hl {\n background: #ff0;\n}\n#sh-editor .CodeMirror-gutters {\n border-right: none;\n padding-right: 6px;\n}\n#sh-editor .CodeMirror-linenumber {\n cursor: pointer;\n}\n#sh-editor.readonly .CodeMirror .CodeMirror-linenumber {\n cursor: default;\n}\n#sh-editor.readonly .CodeMirror .CodeMirror-cursors {\n display: none;\n}\n", ""]);
  18278. // exports
  18279. /***/ }),
  18280. /* 101 */
  18281. /***/ (function(module, exports, __webpack_require__) {
  18282. exports = module.exports = __webpack_require__(6)();
  18283. // imports
  18284. // module
  18285. exports.push([module.i, "@keyframes loading {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.frame label {\n padding: 0 4em 0 0.5em;\n}\n.frame .spiner {\n transform-origin: right center;\n animation: spin 1s;\n animation-iteration-count: 1;\n -webkit-animation-iteration-count: 1;\n}\n.frame .ln i.icon-refresh {\n display: inline-block;\n color: #999;\n margin: 0 0.6em;\n cursor: pointer;\n}\n.frame .ln i.icon-refresh:hover {\n color: #333;\n}\n.frame .ln i.icon-refresh.loading {\n animation: loading 1s infinite linear;\n}\n.frame .ln i.icon-refresh.invisible {\n visibility: hidden;\n}\n.frame .last-refresh {\n color: #999;\n}\n.frame a.del {\n color: red;\n}\n.frame a.del span {\n padding-left: 0.5em;\n}\n", ""]);
  18286. // exports
  18287. /***/ }),
  18288. /* 102 */
  18289. /***/ (function(module, exports, __webpack_require__) {
  18290. exports = module.exports = __webpack_require__(6)();
  18291. // imports
  18292. // module
  18293. exports.push([module.i, ".frame {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.frame .overlay {\n position: absolute;\n z-index: -1;\n width: 100%;\n height: 100%;\n background: #000;\n opacity: 0.5;\n}\n.frame .prompt {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n min-width: 300px;\n max-width: 600px;\n background: #fff;\n box-shadow: 0 0 4px 4px rgba(0, 0, 0, 0.1);\n}\n.frame .prompt .head {\n padding: 20px;\n font-size: 16px;\n background: #f5f5f5;\n}\n.frame .prompt .body {\n padding: 20px 20px;\n}\n.frame .prompt .body .ln {\n line-height: 30px;\n padding: 2px 0;\n}\n.frame .prompt .body .ln .title {\n float: left;\n width: 100px;\n line-height: 24px;\n}\n.frame .prompt .body .ln .cnt {\n margin-left: 100px;\n line-height: 24px;\n}\n.frame .prompt .body .ln .cnt input[type=text] {\n width: 240px;\n outline: none;\n padding: 6px 10px;\n}\n.frame .prompt .body .ln .cnt textarea {\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\n}\n.frame .prompt .body .ln .inform {\n color: #999;\n line-height: 24px;\n}\n.frame .prompt .body input {\n padding: 6px 4px;\n}\n.frame .prompt .body input[type=password] {\n letter-spacing: 8px;\n width: 240px;\n outline: none;\n padding: 6px 10px;\n}\n.frame .prompt .foot {\n padding: 20px;\n background: #f5f5f5;\n text-align: right;\n}\n.frame .prompt .foot .button {\n display: inline-block;\n background: #ccc;\n padding: 8px 20px;\n margin-left: 1em;\n cursor: pointer;\n}\n.frame .prompt .foot .button:hover {\n background: #ddd;\n}\n.frame .prompt .foot .button.btn-default {\n background: #05a;\n color: #fff;\n}\n.frame .prompt .foot .button.btn-default:hover {\n background: #0077ee;\n}\n", ""]);
  18294. // exports
  18295. /***/ }),
  18296. /* 103 */
  18297. /***/ (function(module, exports, __webpack_require__) {
  18298. exports = module.exports = __webpack_require__(6)();
  18299. // imports
  18300. // module
  18301. exports.push([module.i, "#hosts-group {\n position: relative;\n margin-top: 20px;\n height: 162px;\n overflow: auto;\n}\n#hosts-group::after {\n content: '';\n clear: both;\n}\n#hosts-group .arrow {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 20px;\n height: 20px;\n line-height: 20px;\n text-align: center;\n transform: translate(-50%, -50%);\n}\n#hosts-group .arrow::after {\n content: '\\2192';\n}\n#hosts-group .hosts-group-list {\n height: 160px;\n overflow: auto;\n border: solid 1px #ccc;\n}\n#hosts-group .hosts-group-list .hosts-item {\n cursor: move;\n padding: 2px 6px;\n}\n#hosts-group .hosts-group-list .hosts-item:hover {\n background: #f5f5f5;\n}\n#hosts-group .hosts-group-list .hosts-item i {\n font-size: 12px;\n color: #999;\n}\n#hosts-group .hosts-group-list .hosts-item > span {\n padding-left: 6px;\n}\n#hosts-group-valid {\n width: 45%;\n float: left;\n}\n#hosts-group-current {\n width: 45%;\n float: right;\n}\n", ""]);
  18302. // exports
  18303. /***/ }),
  18304. /* 104 */
  18305. /***/ (function(module, exports, __webpack_require__) {
  18306. exports = module.exports = __webpack_require__(6)();
  18307. // imports
  18308. // module
  18309. exports.push([module.i, "#sh-buttons {\n position: absolute;\n bottom: 0;\n width: 240px;\n height: 30px;\n line-height: 30px;\n background: #373d47;\n}\n#sh-buttons .left {\n float: left;\n padding-left: 10px;\n}\n#sh-buttons .left .btn-add {\n display: inline-block;\n text-align: center;\n width: 20px;\n color: #979da7;\n text-decoration: none;\n}\n#sh-buttons .left .btn-add:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n#sh-buttons .right {\n float: right;\n padding-right: 17px;\n height: 30px;\n}\n#sh-buttons .right i {\n display: inline-block;\n margin-left: 10px;\n cursor: pointer;\n}\n#sh-buttons .right i.icon-switchoff {\n position: relative;\n top: -1px;\n}\n#sh-buttons .right i.icon-search {\n padding: 0 8px;\n}\n#sh-buttons .right i.icon-search.on {\n background: #3d434e;\n}\n", ""]);
  18310. // exports
  18311. /***/ }),
  18312. /* 105 */
  18313. /***/ (function(module, exports, __webpack_require__) {
  18314. exports = module.exports = __webpack_require__(6)();
  18315. // imports
  18316. // module
  18317. exports.push([module.i, "#sh-list .list-item {\n padding: 7px 10px 7px 15px;\n cursor: pointer;\n}\n#sh-list .list-item.hidden {\n display: none;\n}\n#sh-list .list-item.sys-hosts {\n font-size: 14px;\n padding: 8px 10px 8px 12px;\n}\n#sh-list .list-item.sys-hosts i {\n width: 23px;\n}\n#sh-list .list-item.selected {\n background: #2d3138;\n}\n#sh-list .list-item.selected span {\n color: #fff;\n}\n#sh-list .list-item.selected i.item-icon {\n color: #fff;\n}\n#sh-list .list-item.selected:hover i.icon-edit {\n display: block;\n color: #fff;\n}\n#sh-list .list-item i {\n display: inline-block;\n width: 20px;\n text-align: center;\n margin-right: 5px;\n}\n#sh-list .list-item i.item-icon {\n font-size: 12px;\n}\n#sh-list .list-item i.switch {\n float: right;\n cursor: pointer;\n line-height: 23px;\n}\n#sh-list .list-item i.switch.icon-on {\n color: #af9;\n}\n#sh-list .list-item i.icon-edit {\n float: right;\n display: none;\n}\n", ""]);
  18318. // exports
  18319. /***/ }),
  18320. /* 106 */
  18321. /***/ (function(module, exports, __webpack_require__) {
  18322. exports = module.exports = __webpack_require__(6)();
  18323. // imports
  18324. // module
  18325. exports.push([module.i, "#sh-list .custom-items {\n position: fixed;\n width: 240px;\n top: 36px;\n bottom: 30px;\n overflow: auto;\n}\n", ""]);
  18326. // exports
  18327. /***/ }),
  18328. /* 107 */
  18329. /***/ (function(module, exports, __webpack_require__) {
  18330. exports = module.exports = __webpack_require__(6)();
  18331. // imports
  18332. exports.i(__webpack_require__(110), "");
  18333. // module
  18334. exports.push([module.i, "#panel {\n width: 240px;\n height: 100%;\n background: #373d47;\n color: #979da7;\n}\n", ""]);
  18335. // exports
  18336. /***/ }),
  18337. /* 108 */
  18338. /***/ (function(module, exports, __webpack_require__) {
  18339. exports = module.exports = __webpack_require__(6)();
  18340. // imports
  18341. // module
  18342. exports.push([module.i, "#sh-searchbar {\n position: fixed;\n width: 240px;\n left: 0;\n bottom: 30px;\n background: #3d434e;\n padding: 6px 20px 5px 18px;\n border-top: solid 1px #323740;\n}\n#sh-searchbar input {\n background: transparent;\n border: 0;\n outline: 0;\n color: #fff;\n font-size: 13px;\n}\n", ""]);
  18343. // exports
  18344. /***/ }),
  18345. /* 109 */
  18346. /***/ (function(module, exports, __webpack_require__) {
  18347. exports = module.exports = __webpack_require__(6)();
  18348. // imports
  18349. // module
  18350. exports.push([module.i, "/* BASICS */\n\n.CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-family: monospace;\n height: 300px;\n color: black;\n}\n\n/* PADDING */\n\n.CodeMirror-lines {\n padding: 4px 0; /* Vertical padding around content */\n}\n.CodeMirror pre {\n padding: 0 4px; /* Horizontal padding of content */\n}\n\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n background-color: white; /* The little square between H and V scrollbars */\n}\n\n/* GUTTER */\n\n.CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n}\n.CodeMirror-linenumbers {}\n.CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n}\n\n.CodeMirror-guttermarker { color: black; }\n.CodeMirror-guttermarker-subtle { color: #999; }\n\n/* CURSOR */\n\n.CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n}\n/* Shown when moving in bi-directional text */\n.CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n}\n.cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n}\n.cm-fat-cursor div.CodeMirror-cursors {\n z-index: 1;\n}\n\n.cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n}\n@-moz-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@-webkit-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n\n/* Can style cursor different in overwrite (non-insert) mode */\n.CodeMirror-overwrite .CodeMirror-cursor {}\n\n.cm-tab { display: inline-block; text-decoration: inherit; }\n\n.CodeMirror-rulers {\n position: absolute;\n left: 0; right: 0; top: -50px; bottom: -20px;\n overflow: hidden;\n}\n.CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0; bottom: 0;\n position: absolute;\n}\n\n/* DEFAULT THEME */\n\n.cm-s-default .cm-header {color: blue;}\n.cm-s-default .cm-quote {color: #090;}\n.cm-negative {color: #d44;}\n.cm-positive {color: #292;}\n.cm-header, .cm-strong {font-weight: bold;}\n.cm-em {font-style: italic;}\n.cm-link {text-decoration: underline;}\n.cm-strikethrough {text-decoration: line-through;}\n\n.cm-s-default .cm-keyword {color: #708;}\n.cm-s-default .cm-atom {color: #219;}\n.cm-s-default .cm-number {color: #164;}\n.cm-s-default .cm-def {color: #00f;}\n.cm-s-default .cm-variable,\n.cm-s-default .cm-punctuation,\n.cm-s-default .cm-property,\n.cm-s-default .cm-operator {}\n.cm-s-default .cm-variable-2 {color: #05a;}\n.cm-s-default .cm-variable-3 {color: #085;}\n.cm-s-default .cm-comment {color: #a50;}\n.cm-s-default .cm-string {color: #a11;}\n.cm-s-default .cm-string-2 {color: #f50;}\n.cm-s-default .cm-meta {color: #555;}\n.cm-s-default .cm-qualifier {color: #555;}\n.cm-s-default .cm-builtin {color: #30a;}\n.cm-s-default .cm-bracket {color: #997;}\n.cm-s-default .cm-tag {color: #170;}\n.cm-s-default .cm-attribute {color: #00c;}\n.cm-s-default .cm-hr {color: #999;}\n.cm-s-default .cm-link {color: #00c;}\n\n.cm-s-default .cm-error {color: #f00;}\n.cm-invalidchar {color: #f00;}\n\n.CodeMirror-composing { border-bottom: 2px solid; }\n\n/* Default styles for common addons */\n\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\n.CodeMirror-activeline-background {background: #e8f2ff;}\n\n/* STOP */\n\n/* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n.CodeMirror {\n position: relative;\n overflow: hidden;\n background: white;\n}\n\n.CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 30px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -30px; margin-right: -30px;\n padding-bottom: 30px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n}\n.CodeMirror-sizer {\n position: relative;\n border-right: 30px solid transparent;\n}\n\n/* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 6;\n display: none;\n}\n.CodeMirror-vscrollbar {\n right: 0; top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n}\n.CodeMirror-hscrollbar {\n bottom: 0; left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n}\n.CodeMirror-scrollbar-filler {\n right: 0; bottom: 0;\n}\n.CodeMirror-gutter-filler {\n left: 0; bottom: 0;\n}\n\n.CodeMirror-gutters {\n position: absolute; left: 0; top: 0;\n min-height: 100%;\n z-index: 3;\n}\n.CodeMirror-gutter {\n white-space: normal;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n margin-bottom: -30px;\n}\n.CodeMirror-gutter-wrapper {\n position: absolute;\n z-index: 4;\n background: none !important;\n border: none !important;\n}\n.CodeMirror-gutter-background {\n position: absolute;\n top: 0; bottom: 0;\n z-index: 4;\n}\n.CodeMirror-gutter-elt {\n position: absolute;\n cursor: default;\n z-index: 4;\n}\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\n\n.CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n}\n.CodeMirror pre {\n /* Reset some styles that the rest of the page might have set */\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: inherit;\n color: inherit;\n z-index: 2;\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n}\n.CodeMirror-wrap pre {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: normal;\n}\n\n.CodeMirror-linebackground {\n position: absolute;\n left: 0; right: 0; top: 0; bottom: 0;\n z-index: 0;\n}\n\n.CodeMirror-linewidget {\n position: relative;\n z-index: 2;\n overflow: auto;\n}\n\n.CodeMirror-widget {}\n\n.CodeMirror-rtl pre { direction: rtl; }\n\n.CodeMirror-code {\n outline: none;\n}\n\n/* Force content-box sizing for the elements where we expect it */\n.CodeMirror-scroll,\n.CodeMirror-sizer,\n.CodeMirror-gutter,\n.CodeMirror-gutters,\n.CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\n\n.CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n}\n\n.CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n}\n.CodeMirror-measure pre { position: static; }\n\ndiv.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n z-index: 3;\n}\ndiv.CodeMirror-dragcursors {\n visibility: visible;\n}\n\n.CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n}\n\n.CodeMirror-selected { background: #d9d9d9; }\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\n.CodeMirror-crosshair { cursor: crosshair; }\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\n\n.cm-searching {\n background: #ffa;\n background: rgba(255, 255, 0, .4);\n}\n\n/* Used to force a border model for a node */\n.cm-force-border { padding-right: .1px; }\n\n@media print {\n /* Hide the cursor when printing */\n .CodeMirror div.CodeMirror-cursors {\n visibility: hidden;\n }\n}\n\n/* See issue #2901 */\n.cm-tab-wrap-hack:after { content: ''; }\n\n/* Help users use markselection to safely style text background */\nspan.CodeMirror-selectedtext { background: none; }\n", ""]);
  18351. // exports
  18352. /***/ }),
  18353. /* 110 */
  18354. /***/ (function(module, exports, __webpack_require__) {
  18355. exports = module.exports = __webpack_require__(6)();
  18356. // imports
  18357. // module
  18358. exports.push([module.i, "\n@font-face {font-family: \"iconfont\";\n src: url(" + __webpack_require__(54) + "); /* IE9*/\n src: url(" + __webpack_require__(54) + "#iefix) format('embedded-opentype'), \n url(" + __webpack_require__(126) + ") format('woff'), \n url(" + __webpack_require__(125) + ") format('truetype'), \n url(" + __webpack_require__(124) + "#iconfont) format('svg'); /* iOS 4.1- */\n}\n\n.iconfont {\n font-family:\"iconfont\" !important;\n font-size:16px;\n font-style:normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-switchoff:before { content: \"\\E60D\"; }\n\n.icon-icon:before { content: \"\\E600\"; }\n\n.icon-warnfill:before { content: \"\\E607\"; }\n\n.icon-warn:before { content: \"\\E608\"; }\n\n.icon-refresh:before { content: \"\\E616\"; }\n\n.icon-ok:before { content: \"\\E604\"; }\n\n.icon-h:before { content: \"\\E617\"; }\n\n.icon-lock:before { content: \"\\E61D\"; }\n\n.icon-off:before { content: \"\\E613\"; }\n\n.icon-on:before { content: \"\\E614\"; }\n\n.icon-search:before { content: \"\\E61C\"; }\n\n.icon-edit:before { content: \"\\E609\"; }\n\n.icon-info:before { content: \"\\E601\"; }\n\n.icon-add-s:before { content: \"\\E612\"; }\n\n.icon-more:before { content: \"\\E602\"; }\n\n.icon-grid:before { content: \"\\E603\"; }\n\n.icon-movedown:before { content: \"\\E60A\"; }\n\n.icon-moveup:before { content: \"\\E60B\"; }\n\n.icon-add:before { content: \"\\E60C\"; }\n\n.icon-folder:before { content: \"\\E618\"; }\n\n.icon-group:before { content: \"\\E619\"; }\n\n.icon-lock2:before { content: \"\\E61E\"; }\n\n.icon-files:before { content: \"\\E61F\"; }\n\n.icon-timescircle:before { content: \"\\E60E\"; }\n\n.icon-earth:before { content: \"\\E61A\"; }\n\n.icon-move:before { content: \"\\E60F\"; }\n\n.icon-delete:before { content: \"\\E610\"; }\n\n.icon-doc:before { content: \"\\E606\"; }\n\n.icon-line:before { content: \"\\E611\"; }\n\n.icon-file-box:before { content: \"\\E61B\"; }\n\n.icon-switchon:before { content: \"\\E615\"; }\n\n.icon-sysserver:before { content: \"\\E605\"; }\n\n.icon-file:before { content: \"\\E77D\"; }\n\n", ""]);
  18359. // exports
  18360. /***/ }),
  18361. /* 111 */
  18362. /***/ (function(module, exports) {
  18363. /**
  18364. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  18365. * embed the css on the page. This breaks all relative urls because now they are relative to a
  18366. * bundle instead of the current page.
  18367. *
  18368. * One solution is to only use full urls, but that may be impossible.
  18369. *
  18370. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  18371. *
  18372. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  18373. *
  18374. */
  18375. module.exports = function (css) {
  18376. // get current location
  18377. var location = typeof window !== "undefined" && window.location;
  18378. if (!location) {
  18379. throw new Error("fixUrls requires window.location");
  18380. }
  18381. // blank or null?
  18382. if (!css || typeof css !== "string") {
  18383. return css;
  18384. }
  18385. var baseUrl = location.protocol + "//" + location.host;
  18386. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  18387. // convert each url(...)
  18388. /*
  18389. This regular expression is just a way to recursively match brackets within
  18390. a string.
  18391. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  18392. ( = Start a capturing group
  18393. (?: = Start a non-capturing group
  18394. [^)(] = Match anything that isn't a parentheses
  18395. | = OR
  18396. \( = Match a start parentheses
  18397. (?: = Start another non-capturing groups
  18398. [^)(]+ = Match anything that isn't a parentheses
  18399. | = OR
  18400. \( = Match a start parentheses
  18401. [^)(]* = Match anything that isn't a parentheses
  18402. \) = Match a end parentheses
  18403. ) = End Group
  18404. *\) = Match anything and then a close parens
  18405. ) = Close non-capturing group
  18406. * = Match anything
  18407. ) = Close capturing group
  18408. \) = Match a close parens
  18409. /gi = Get all matches, not the first. Be case insensitive.
  18410. */
  18411. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  18412. // strip quotes (if they exist)
  18413. var unquotedOrigUrl = origUrl
  18414. .trim()
  18415. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  18416. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  18417. // already a full url? no change
  18418. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
  18419. return fullMatch;
  18420. }
  18421. // convert the url to a full url
  18422. var newUrl;
  18423. if (unquotedOrigUrl.indexOf("//") === 0) {
  18424. //TODO: should we add protocol?
  18425. newUrl = unquotedOrigUrl;
  18426. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  18427. // path should be relative to the base url
  18428. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  18429. } else {
  18430. // path should be relative to current directory
  18431. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  18432. }
  18433. // send back the fixed url(...)
  18434. return "url(" + JSON.stringify(newUrl) + ")";
  18435. });
  18436. // send back the fixed css
  18437. return fixedCss;
  18438. };
  18439. /***/ }),
  18440. /* 112 */
  18441. /***/ (function(module, exports, __webpack_require__) {
  18442. // style-loader: Adds some css to the DOM by adding a <style> tag
  18443. // load the styles
  18444. var content = __webpack_require__(98);
  18445. if(typeof content === 'string') content = [[module.i, content, '']];
  18446. // add the styles to the DOM
  18447. var update = __webpack_require__(8)(content, {});
  18448. if(content.locals) module.exports = content.locals;
  18449. // Hot Module Replacement
  18450. if(false) {
  18451. // When the styles change, update the <style> tags
  18452. if(!content.locals) {
  18453. module.hot.accept("!!../node_modules/css-loader/index.js!../node_modules/less-loader/dist/index.js!./app.less", function() {
  18454. var newContent = require("!!../node_modules/css-loader/index.js!../node_modules/less-loader/dist/index.js!./app.less");
  18455. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18456. update(newContent);
  18457. });
  18458. }
  18459. // When the module is disposed, remove the <style> tags
  18460. module.hot.dispose(function() { update(); });
  18461. }
  18462. /***/ }),
  18463. /* 113 */
  18464. /***/ (function(module, exports, __webpack_require__) {
  18465. // style-loader: Adds some css to the DOM by adding a <style> tag
  18466. // load the styles
  18467. var content = __webpack_require__(99);
  18468. if(typeof content === 'string') content = [[module.i, content, '']];
  18469. // add the styles to the DOM
  18470. var update = __webpack_require__(8)(content, {});
  18471. if(content.locals) module.exports = content.locals;
  18472. // Hot Module Replacement
  18473. if(false) {
  18474. // When the styles change, update the <style> tags
  18475. if(!content.locals) {
  18476. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./content.less", function() {
  18477. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./content.less");
  18478. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18479. update(newContent);
  18480. });
  18481. }
  18482. // When the module is disposed, remove the <style> tags
  18483. module.hot.dispose(function() { update(); });
  18484. }
  18485. /***/ }),
  18486. /* 114 */
  18487. /***/ (function(module, exports, __webpack_require__) {
  18488. // style-loader: Adds some css to the DOM by adding a <style> tag
  18489. // load the styles
  18490. var content = __webpack_require__(100);
  18491. if(typeof content === 'string') content = [[module.i, content, '']];
  18492. // add the styles to the DOM
  18493. var update = __webpack_require__(8)(content, {});
  18494. if(content.locals) module.exports = content.locals;
  18495. // Hot Module Replacement
  18496. if(false) {
  18497. // When the styles change, update the <style> tags
  18498. if(!content.locals) {
  18499. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./editor.less", function() {
  18500. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./editor.less");
  18501. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18502. update(newContent);
  18503. });
  18504. }
  18505. // When the module is disposed, remove the <style> tags
  18506. module.hot.dispose(function() { update(); });
  18507. }
  18508. /***/ }),
  18509. /* 115 */
  18510. /***/ (function(module, exports, __webpack_require__) {
  18511. // style-loader: Adds some css to the DOM by adding a <style> tag
  18512. // load the styles
  18513. var content = __webpack_require__(101);
  18514. if(typeof content === 'string') content = [[module.i, content, '']];
  18515. // add the styles to the DOM
  18516. var update = __webpack_require__(8)(content, {});
  18517. if(content.locals) module.exports = content.locals;
  18518. // Hot Module Replacement
  18519. if(false) {
  18520. // When the styles change, update the <style> tags
  18521. if(!content.locals) {
  18522. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./edit.less", function() {
  18523. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./edit.less");
  18524. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18525. update(newContent);
  18526. });
  18527. }
  18528. // When the module is disposed, remove the <style> tags
  18529. module.hot.dispose(function() { update(); });
  18530. }
  18531. /***/ }),
  18532. /* 116 */
  18533. /***/ (function(module, exports, __webpack_require__) {
  18534. // style-loader: Adds some css to the DOM by adding a <style> tag
  18535. // load the styles
  18536. var content = __webpack_require__(102);
  18537. if(typeof content === 'string') content = [[module.i, content, '']];
  18538. // add the styles to the DOM
  18539. var update = __webpack_require__(8)(content, {});
  18540. if(content.locals) module.exports = content.locals;
  18541. // Hot Module Replacement
  18542. if(false) {
  18543. // When the styles change, update the <style> tags
  18544. if(!content.locals) {
  18545. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./frame.less", function() {
  18546. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./frame.less");
  18547. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18548. update(newContent);
  18549. });
  18550. }
  18551. // When the module is disposed, remove the <style> tags
  18552. module.hot.dispose(function() { update(); });
  18553. }
  18554. /***/ }),
  18555. /* 117 */
  18556. /***/ (function(module, exports, __webpack_require__) {
  18557. // style-loader: Adds some css to the DOM by adding a <style> tag
  18558. // load the styles
  18559. var content = __webpack_require__(103);
  18560. if(typeof content === 'string') content = [[module.i, content, '']];
  18561. // add the styles to the DOM
  18562. var update = __webpack_require__(8)(content, {});
  18563. if(content.locals) module.exports = content.locals;
  18564. // Hot Module Replacement
  18565. if(false) {
  18566. // When the styles change, update the <style> tags
  18567. if(!content.locals) {
  18568. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./group.less", function() {
  18569. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./group.less");
  18570. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18571. update(newContent);
  18572. });
  18573. }
  18574. // When the module is disposed, remove the <style> tags
  18575. module.hot.dispose(function() { update(); });
  18576. }
  18577. /***/ }),
  18578. /* 118 */
  18579. /***/ (function(module, exports, __webpack_require__) {
  18580. // style-loader: Adds some css to the DOM by adding a <style> tag
  18581. // load the styles
  18582. var content = __webpack_require__(104);
  18583. if(typeof content === 'string') content = [[module.i, content, '']];
  18584. // add the styles to the DOM
  18585. var update = __webpack_require__(8)(content, {});
  18586. if(content.locals) module.exports = content.locals;
  18587. // Hot Module Replacement
  18588. if(false) {
  18589. // When the styles change, update the <style> tags
  18590. if(!content.locals) {
  18591. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./buttons.less", function() {
  18592. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./buttons.less");
  18593. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18594. update(newContent);
  18595. });
  18596. }
  18597. // When the module is disposed, remove the <style> tags
  18598. module.hot.dispose(function() { update(); });
  18599. }
  18600. /***/ }),
  18601. /* 119 */
  18602. /***/ (function(module, exports, __webpack_require__) {
  18603. // style-loader: Adds some css to the DOM by adding a <style> tag
  18604. // load the styles
  18605. var content = __webpack_require__(105);
  18606. if(typeof content === 'string') content = [[module.i, content, '']];
  18607. // add the styles to the DOM
  18608. var update = __webpack_require__(8)(content, {});
  18609. if(content.locals) module.exports = content.locals;
  18610. // Hot Module Replacement
  18611. if(false) {
  18612. // When the styles change, update the <style> tags
  18613. if(!content.locals) {
  18614. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list-item.less", function() {
  18615. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list-item.less");
  18616. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18617. update(newContent);
  18618. });
  18619. }
  18620. // When the module is disposed, remove the <style> tags
  18621. module.hot.dispose(function() { update(); });
  18622. }
  18623. /***/ }),
  18624. /* 120 */
  18625. /***/ (function(module, exports, __webpack_require__) {
  18626. // style-loader: Adds some css to the DOM by adding a <style> tag
  18627. // load the styles
  18628. var content = __webpack_require__(106);
  18629. if(typeof content === 'string') content = [[module.i, content, '']];
  18630. // add the styles to the DOM
  18631. var update = __webpack_require__(8)(content, {});
  18632. if(content.locals) module.exports = content.locals;
  18633. // Hot Module Replacement
  18634. if(false) {
  18635. // When the styles change, update the <style> tags
  18636. if(!content.locals) {
  18637. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list.less", function() {
  18638. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list.less");
  18639. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18640. update(newContent);
  18641. });
  18642. }
  18643. // When the module is disposed, remove the <style> tags
  18644. module.hot.dispose(function() { update(); });
  18645. }
  18646. /***/ }),
  18647. /* 121 */
  18648. /***/ (function(module, exports, __webpack_require__) {
  18649. // style-loader: Adds some css to the DOM by adding a <style> tag
  18650. // load the styles
  18651. var content = __webpack_require__(107);
  18652. if(typeof content === 'string') content = [[module.i, content, '']];
  18653. // add the styles to the DOM
  18654. var update = __webpack_require__(8)(content, {});
  18655. if(content.locals) module.exports = content.locals;
  18656. // Hot Module Replacement
  18657. if(false) {
  18658. // When the styles change, update the <style> tags
  18659. if(!content.locals) {
  18660. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./panel.less", function() {
  18661. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./panel.less");
  18662. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18663. update(newContent);
  18664. });
  18665. }
  18666. // When the module is disposed, remove the <style> tags
  18667. module.hot.dispose(function() { update(); });
  18668. }
  18669. /***/ }),
  18670. /* 122 */
  18671. /***/ (function(module, exports, __webpack_require__) {
  18672. // style-loader: Adds some css to the DOM by adding a <style> tag
  18673. // load the styles
  18674. var content = __webpack_require__(108);
  18675. if(typeof content === 'string') content = [[module.i, content, '']];
  18676. // add the styles to the DOM
  18677. var update = __webpack_require__(8)(content, {});
  18678. if(content.locals) module.exports = content.locals;
  18679. // Hot Module Replacement
  18680. if(false) {
  18681. // When the styles change, update the <style> tags
  18682. if(!content.locals) {
  18683. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./searchbar.less", function() {
  18684. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./searchbar.less");
  18685. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18686. update(newContent);
  18687. });
  18688. }
  18689. // When the module is disposed, remove the <style> tags
  18690. module.hot.dispose(function() { update(); });
  18691. }
  18692. /***/ }),
  18693. /* 123 */
  18694. /***/ (function(module, exports, __webpack_require__) {
  18695. // style-loader: Adds some css to the DOM by adding a <style> tag
  18696. // load the styles
  18697. var content = __webpack_require__(109);
  18698. if(typeof content === 'string') content = [[module.i, content, '']];
  18699. // add the styles to the DOM
  18700. var update = __webpack_require__(8)(content, {});
  18701. if(content.locals) module.exports = content.locals;
  18702. // Hot Module Replacement
  18703. if(false) {
  18704. // When the styles change, update the <style> tags
  18705. if(!content.locals) {
  18706. module.hot.accept("!!../../../../node_modules/css-loader/index.js!./codemirror.css", function() {
  18707. var newContent = require("!!../../../../node_modules/css-loader/index.js!./codemirror.css");
  18708. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18709. update(newContent);
  18710. });
  18711. }
  18712. // When the module is disposed, remove the <style> tags
  18713. module.hot.dispose(function() { update(); });
  18714. }
  18715. /***/ }),
  18716. /* 124 */
  18717. /***/ (function(module, exports) {
  18718. module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiID4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8bWV0YWRhdGE+CkNyZWF0ZWQgYnkgRm9udEZvcmdlIDIwMTIwNzMxIGF0IFRodSBNYXIgMjMgMTA6NTk6MTYgMjAxNwogQnkgYWRtaW4KPC9tZXRhZGF0YT4KPGRlZnM+Cjxmb250IGlkPSJpY29uZm9udCIgaG9yaXotYWR2LXg9IjEwMjQiID4KICA8Zm9udC1mYWNlIAogICAgZm9udC1mYW1pbHk9Imljb25mb250IgogICAgZm9udC13ZWlnaHQ9IjUwMCIKICAgIGZvbnQtc3RyZXRjaD0ibm9ybWFsIgogICAgdW5pdHMtcGVyLWVtPSIxMDI0IgogICAgcGFub3NlLTE9IjIgMCA2IDMgMCAwIDAgMCAwIDAiCiAgICBhc2NlbnQ9Ijg5NiIKICAgIGRlc2NlbnQ9Ii0xMjgiCiAgICB4LWhlaWdodD0iNzkyIgogICAgYmJveD0iMCAtMjEyIDEwMjQgODk2IgogICAgdW5kZXJsaW5lLXRoaWNrbmVzcz0iMCIKICAgIHVuZGVybGluZS1wb3NpdGlvbj0iMCIKICAgIHVuaWNvZGUtcmFuZ2U9IlUrMDA3OC1FNzdEIgogIC8+CjxtaXNzaW5nLWdseXBoIAogLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSIubm90ZGVmIiAKIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iLm5vdGRlZiIgCiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Ii5udWxsIiBob3Jpei1hZHYteD0iMCIgCiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im5vbm1hcmtpbmdyZXR1cm4iIGhvcml6LWFkdi14PSIzNDEiIAogLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJ4IiB1bmljb2RlPSJ4IiBob3Jpei1hZHYteD0iMTAwMSIgCmQ9Ik0yODEgNTQzcS0yNyAtMSAtNTMgLTFoLTgzcS0xOCAwIC0zNi41IC02dC0zMi41IC0xOC41dC0yMyAtMzJ0LTkgLTQ1LjV2LTc2aDkxMnY0MXEwIDE2IC0wLjUgMzB0LTAuNSAxOHEwIDEzIC01IDI5dC0xNyAyOS41dC0zMS41IDIyLjV0LTQ5LjUgOWgtMTMzdi05N2gtNDM4djk3ek05NTUgMzEwdi01MnEwIC0yMyAwLjUgLTUydDAuNSAtNTh0LTEwLjUgLTQ3LjV0LTI2IC0zMHQtMzMgLTE2dC0zMS41IC00LjVxLTE0IC0xIC0yOS41IC0wLjUKdC0yOS41IDAuNWgtMzJsLTQ1IDEyOGgtNDM5bC00NCAtMTI4aC0yOWgtMzRxLTIwIDAgLTQ1IDFxLTI1IDAgLTQxIDkuNXQtMjUuNSAyM3QtMTMuNSAyOS41dC00IDMwdjE2N2g5MTF6TTE2MyAyNDdxLTEyIDAgLTIxIC04LjV0LTkgLTIxLjV0OSAtMjEuNXQyMSAtOC41cTEzIDAgMjIgOC41dDkgMjEuNXQtOSAyMS41dC0yMiA4LjV6TTMxNiAxMjNxLTggLTI2IC0xNCAtNDhxLTUgLTE5IC0xMC41IC0zN3QtNy41IC0yNXQtMyAtMTV0MSAtMTQuNQp0OS41IC0xMC41dDIxLjUgLTRoMzdoNjdoODFoODBoNjRoMzZxMjMgMCAzNCAxMnQyIDM4cS01IDEzIC05LjUgMzAuNXQtOS41IDM0LjVxLTUgMTkgLTExIDM5aC0zNjh6TTMzNiA0OTh2MjI4cTAgMTEgMi41IDIzdDEwIDIxLjV0MjAuNSAxNS41dDM0IDZoMTg4cTMxIDAgNTEuNSAtMTQuNXQyMC41IC01Mi41di0yMjdoLTMyN3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ic3dpdGNob2ZmIiB1bmljb2RlPSImI3hlNjBkOyIgCmQ9Ik04MzIgODEyaC02NDBxLTgwIDAgLTEzNiAtNTZ0LTU2IC0xMzZ2LTY0MHEwIC03OSA1NiAtMTM1LjV0MTM2IC01Ni41aDY0MHE3OSAwIDEzNS41IDU2LjV0NTYuNSAxMzUuNXY2NDBxMCA4MCAtNTYuNSAxMzZ0LTEzNS41IDU2ek0xNjAgLTg0cS0xMyAwIC0yMi41IDkuNXQtOS41IDIyLjV0OS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTE2MCA2MjBxLTEzIDAgLTIyLjUgOS41CnQtOS41IDIyLjV0OS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTcwNCAtMjBxMCAtMjcgLTE4LjUgLTQ1LjV0LTQ1LjUgLTE4LjVoLTI1NnEtMjcgMCAtNDUuNSAxOC41dC0xOC41IDQ1LjV2NjQwcTAgMjYgMTkgNDV0NDUgMTloMjU2cTI3IDAgNDUuNSAtMTguNXQxOC41IC00NS41di02NDB6TTg2NCAtODRxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNQp0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTg2NCA2MjBxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNTc2IDMwMGgtMTI4cS0yNiAwIC00NSAtMTl0LTE5IC00NXYtMTkycTAgLTI3IDE4LjUgLTQ1LjV0NDUuNSAtMTguNWgxMjhxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djE5MgpxMCAyNyAtMTguNSA0NS41dC00NS41IDE4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Imljb24iIHVuaWNvZGU9IiYjeGU2MDA7IiAKZD0iTTQ4OCA3NDVsMTMyIC0yNjlsMjk3IC00M2wtMjE1IC0yMDlsNTEgLTI5NmwtMjY1IDE0MGwtMjY2IC0xNDBsNTEgMjk2bC0yMTUgMjA5bDI5NyA0M3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0id2FybmZpbGwiIHVuaWNvZGU9IiYjeGU2MDc7IiAKZD0iTTk0MyAxMjdsLTM0MSA2MDlxLTM1IDYzIC05MC41IDYzdC05MC41IC02M2wtMzQwIC02MDlxLTM0IC02MiAtNiAtMTExcTI5IC00OCAxMDAgLTQ4aDY3NHE3MSAwIDk5LjUgNDguNXQtNS41IDExMC41ek00ODAgNTc2cTAgMTMgOS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXYtMjg4cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNXQtMjIuNSA5LjV0LTkuNSAyMi41djI4OHpNNTEyIDY0cS0yMCAwIC0zNCAxNHQtMTQgMzQKdDE0IDM0dDM0IDE0dDM0IC0xNHQxNCAtMzR0LTE0IC0zNHQtMzQgLTE0eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJ3YXJuIiB1bmljb2RlPSImI3hlNjA4OyIgCmQ9Ik04NDkgLTMzaC02NzRxLTcxIDAgLTk5LjUgNDl0NS41IDExMWwzNDAgNjA5cTM1IDYzIDkwLjUgNjN0OTAuNSAtNjNsMzQxIC02MDlxMzQgLTYzIDUuNSAtMTExLjV0LTk5LjUgLTQ4LjV6TTUxMiA3MzVxLTE4IDAgLTM1IC0zMGwtMzQwIC02MTBxLTE3IC0zMCAtNyAtNDd0NDUgLTE3aDY3NHEzNSAwIDQ1IDE3dC03IDQ3bC0zNDEgNjEwcS0xNiAzMCAtMzQgMzB6TTUxMiAyNTZxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXYyODgKcTAgMTMgOS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXYtMjg4cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNTEyIDE0NHpNNDY0IDE0NHEwIDIwIDE0IDM0dDM0IDE0dDM0IC0xNHQxNCAtMzR0LTE0IC0zNHQtMzQgLTE0dC0zNCAxNHQtMTQgMzR6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InJlZnJlc2giIHVuaWNvZGU9IiYjeGU2MTY7IiAKZD0iTTUwNCAxN3EtOTcgMCAtMTc5LjUgNDh0LTEzMC41IDEzMC41dC00OCAxNzkuNXEwIDExMCA2MiAyMDFsOTMgLTkzdjI0NWgtMjQ2bDkyIC05MnEtODUgLTExNiAtODUgLTI2MXEwIC05MCAzNSAtMTcxLjV0OTQuNSAtMTQxdDE0MSAtOTQuNXQxNzEuNSAtMzVxODUgMCAxNjMgMzFsLTUwIDcxcS01NSAtMTggLTExMyAtMTh2MHpNNzIwIDI3N3YtMjQ2aDI0NmwtOTYgOTZxNzYgMTEyIDc2IDI0OHEwIDkwIC0zNSAxNzJ0LTk0IDE0MQp0LTE0MSA5NHQtMTcyIDM1cS03MCAwIC0xMzYgLTIxbDUyIC03M3E0MSAxMCA4NCAxMHE5OCAwIDE4MC41IC00Ny41dDEzMCAtMTMwdDQ3LjUgLTE4MC41cTAgLTEwMSAtNTIgLTE4N3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ib2siIHVuaWNvZGU9IiYjeGU2MDQ7IiAKZD0iTTUxMiA3MDlxLTExMSAwIC0yMDUuNSAtNTQuNXQtMTQ5IC0xNDl0LTU0LjUgLTIwNS41dDU0LjUgLTIwNS41dDE0OSAtMTQ5dDIwNS41IC01NC41dDIwNS41IDU0LjV0MTQ5IDE0OXQ1NC41IDIwNS41dC01NC41IDIwNS41dC0xNDkgMTQ5dC0yMDUuNSA1NC41ek0zNzYgMjUzcTAgLTEgNSAtNmw5IC05dDEwIC03LjV0MTAgLTMuNXExNiAwIDEwOSAxMDRsMTM4IDE1OHE3IDggMTUgOXExMyAwIDIxIC03bDQ1IC00NHE3IC04IDcuNSAtMTguNQp0LTYuNSAtMTguNWwtMjUwIC0yNjR2MGwtNTMgLTU3cS03IC03IC0xOCAtNy41dC0xOCA2LjVsLTE1MSAxNDJxLTggNyAtOC41IDE4dDcuNSAxOWwzNSAzN3E3IDggMTggOC41dDE5IC03LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImgiIHVuaWNvZGU9IiYjeGU2MTc7IiAKZD0iTTUxMiA4MDJxLTEwNCAwIC0xOTIuNSAtNTEuNXQtMTQwIC0xNDB0LTUxLjUgLTE5M3Q1MS41IC0xOTN0MTQwIC0xNDB0MTkyLjUgLTUxLjV0MTkyLjUgNTEuNXQxNDAgMTQwdDUxLjUgMTkzdC01MS41IDE5M3QtMTQwIDE0MHQtMTkyLjUgNTEuNXpNNjYwIDIxNGgtNTB2MTc1aC0xOTZ2LTE3NWgtNTB2Mzk1aDUwdi0xNzloMTk2djE3OWg1MHYtMzk1eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJsb2NrIiB1bmljb2RlPSImI3hlNjFkOyIgCmQ9Ik00MjcgMTUxcTAgMzUgMjUgNjB0NjAgMjV0NjAgLTI1dDI1IC02MHEwIC00NyAtMzkgLTcycTkgLTUwIDE4IC0xMTBxMCAtMTMgLTkuNSAtMjIuNXQtMjIuNSAtOS41aC02NHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41bDE4IDExMHEtMzkgMjUgLTM5IDcyek0zNDEgMzg1djE1MHEwIDcwIDUwIDEyMHQxMjEgNTB0MTIxIC01MHQ1MCAtMTIwdi0xNTBoLTM0MnpNMjM1IDUzNXYtMTUwaC02NHEtMzYgMCAtNjEgLTI1dC0yNSAtNjB2LTQyNwpxMCAtMzUgMjUgLTYwdDYxIC0yNWg2ODJxMzYgMCA2MSAyNXQyNSA2MHY0MjdxMCAzNSAtMjUgNjB0LTYxIDI1aC02NHYxNTBxMCAxMTUgLTgxIDE5NnQtMTk2IDgxdC0xOTYgLTgxdC04MSAtMTk2djB6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im9mZiIgdW5pY29kZT0iJiN4ZTYxMzsiIApkPSJNNzI5IDkwaC00MzRxLTExNiAwIC0xOTcuNSA4MS41dC04MS41IDE5Ni41djMycTAgMTE1IDgxLjUgMTk2LjV0MTk3LjUgODEuNWg0MzRxMTE2IDAgMTk3LjUgLTgxLjV0ODEuNSAtMTk2LjV2LTMycTAgLTExNSAtODEuNSAtMTk2LjV0LTE5Ny41IC04MS41ek05NDYgNDAwcTAgOTAgLTYzLjUgMTUzdC0xNTMuNSA2M2gtNDM0cS05MCAwIC0xNTMuNSAtNjN0LTYzLjUgLTE1M3YtMzJxMCAtOTAgNjMuNSAtMTUzLjV0MTUzLjUgLTYzLjVoNDM0CnE5MCAwIDE1My41IDYzLjV0NjMuNSAxNTMuNXYzMnpNMzIyIDIyM3EtNjggMCAtMTE2IDQ4LjV0LTQ4IDExNi41dDQ4IDExNnQxMTYgNDh0MTE2IC00OHQ0OCAtMTE2dC00OCAtMTE2LjV0LTExNiAtNDguNXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ib24iIHVuaWNvZGU9IiYjeGU2MTQ7IiAKZD0iTTcyOSA5MGgtNDM0cS0xMTYgMCAtMTk3LjUgODEuNXQtODEuNSAxOTYuNXYzMnEwIDExNSA4MS41IDE5Ni41dDE5Ny41IDgxLjVoNDM0cTExNiAwIDE5Ny41IC04MS41dDgxLjUgLTE5Ni41di0zMnEwIC0xMTUgLTgxLjUgLTE5Ni41dC0xOTcuNSAtODEuNXpNOTQ3IDM5OXEwIDkwIC02My41IDE1My41dC0xNTMuNSA2My41aC00MzZxLTg5IDAgLTE1Mi41IC02My41dC02My41IC0xNTMuNXYtMzFxMCAtOTAgNjMuNSAtMTUzLjUKdDE1Mi41IC02My41aDQzNnE5MCAwIDE1My41IDYzLjV0NjMuNSAxNTMuNXYzMXYwek03MDIgMjIzcS02OCAwIC0xMTYgNDguNXQtNDggMTE2LjV0NDggMTE2dDExNiA0OHQxMTYuNSAtNDh0NDguNSAtMTE2dC00OC41IC0xMTYuNXQtMTE2LjUgLTQ4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InNlYXJjaCIgdW5pY29kZT0iJiN4ZTYxYzsiIApkPSJNOTk1IDNsLTI3MiAyMjdxLTIgMiAtNiA0cTM3IDc5IDM3IDE2MHEwIDgyIC0zNC41IDE1OHQtOTkuNSAxMzFxLTEwNSA4OSAtMjQzIDg5cS04MiAwIC0xNTggLTM1dC0xMzEgLTEwMHEtODggLTEwNSAtODggLTI0M3EwIC04MiAzNC41IC0xNTguNXQxMDAuNSAtMTMxLjVxMTA1IC04OCAyNDEgLTg4aDFxMTIxIDAgMjIxIDcycTEgMCAyIC0xLjVsMSAtMS41bDI3MiAtMjI3cTI3IC0yMyA2MyAtMTguNXQ1OSAzMy41bDYgNwpxMjQgMjggMjIgNjQuNXQtMjggNTguNXpNNTg1IDIxOXEtNDAgLTQ3IC05NC41IC03MnQtMTEzLjUgLTI1cS05OCAxIC0xNzQgNjRxLTQ3IDM5IC03MiA5NHQtMjUgMTE0cTAgOTkgNjQgMTc0cTM5IDQ4IDkzLjUgNzIuNXQxMTMuNSAyNC41cTk5IDAgMTc0IC02M3E0NyAtNDAgNzIgLTk0LjV0MjUgLTExMy41cTAgLTk5IC02MyAtMTc1eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJlZGl0IiB1bmljb2RlPSImI3hlNjA5OyIgCmQ9Ik0zODQgM2wtMTY5IDE2OXEtNiA1IC02IDEzLjV0NiAxNC41bDM4MCAzODBxNiA2IDE0IDZ0MTQgLTZsMTY5IC0xNjlxNiAtNiA2IC0xNHQtNiAtMTRsLTM4MCAtMzgwcS02IC02IC0xNC41IC02dC0xMy41IDZ6TTY5MyA2NzhxMTggMTggNDIuNSAxOHQ0Mi41IC0xOGwxMTIgLTExMnExOCAtMTggMTggLTQyLjV0LTE4IC00Mi41bC01NiAtNTZsLTE5NyAxOTd6TTExNiAtOTZsNTYgMjU0bDE5OCAtMTk4eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJpbmZvIiB1bmljb2RlPSImI3hlNjAxOyIgCmQ9Ik01MTIgLTIwcS0xMTAgMCAtMjAzIDU0dC0xNDcgMTQ3dC01NCAyMDN0NTQgMjAzdDE0NyAxNDd0MjAzIDU0dDIwMyAtNTR0MTQ3IC0xNDd0NTQgLTIwM3QtNTQgLTIwM3QtMTQ3IC0xNDd0LTIwMyAtNTR6TTU2NyA2MDVxMCA3IC01LjUgMTIuNXQtMTIuNSA1LjVoLTc0cS03IDAgLTEyLjUgLTUuNXQtNS41IC0xMi41di03NHEwIC04IDUuNSAtMTN0MTIuNSAtNWg3NHE3IDAgMTIuNSA1dDUuNSAxM3Y3NHpNNTY3IDQwMnEwIDggLTUuNSAxMy41CnQtMTIuNSA1LjVoLTc0cS03IDAgLTEyLjUgLTUuNXQtNS41IC0xMy41di0yMzlxMCAtNyA1LjUgLTEyLjV0MTIuNSAtNS41aDc0cTcgMCAxMi41IDUuNXQ1LjUgMTIuNXYyMzl6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImFkZC1zIiB1bmljb2RlPSImI3hlNjEyOyIgCmQ9Ik02OTkgMzU4aC0xNTd2LTE1OHEwIC0xMCAtNy41IC0xOHQtMTguNSAtOHQtMTkgOHQtOCAxOHYxNThoLTE1N3EtMTEgMCAtMTguNSA3LjV0LTcuNSAxOC41dDcuNSAxOC41dDE4LjUgNy41aDE1N3YxNTdxMCAxMSA4IDE4LjV0MTkgNy41dDE4LjUgLTcuNXQ3LjUgLTE4LjV2LTE1N2gxNTdxMTEgMCAxOC41IC03LjV0Ny41IC0xOC41dC03LjUgLTE4LjV0LTE4LjUgLTcuNXYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJtb3JlIiB1bmljb2RlPSImI3hlNjAyOyIgCmQ9Ik0xNzQuNSA1MDFxLTQxLjUgMCAtNzEgLTI5LjV0LTI5LjUgLTcxLjV0MjkuNSAtNzEuNXQ3MSAtMjkuNXQ3MS41IDI5LjV0MzAgNzEuNXQtMzAgNzEuNXQtNzEuNSAyOS41ek01MTEgNTAxcS00MiAwIC03MS41IC0yOS41dC0yOS41IC03MS41dDI5LjUgLTcxLjV0NzEuNSAtMjkuNXQ3MS41IDI5LjV0MjkuNSA3MS41dC0yOS41IDcxLjV0LTcxLjUgMjkuNXpNODQ4IDUwMXEtNDIgMCAtNzEuNSAtMjkuNXQtMjkuNSAtNzEuNXQyOS41IC03MS41CnQ3MS41IC0yOS41dDcxLjUgMjkuNXQyOS41IDcxLjV0LTI5LjUgNzEuNXQtNzEuNSAyOS41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJncmlkIiB1bmljb2RlPSImI3hlNjAzOyIgCmQ9Ik02MDEgODMwaC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEyIDkgLTIxdDIxIC05aDE3OXExMiAwIDIxIDl0OSAyMXYxNzlxMCAxMiAtOSAyMXQtMjEgOXpNOTI5IDgzMGgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMiA5IC0yMXQyMSAtOWgxNzlxMTIgMCAyMSA5dDkgMjF2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTI3MyA4MzBoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTIgOSAtMjF0MjEgLTkKaDE3OXExMiAwIDIxIDl0OSAyMXYxNzlxMCAxMiAtOSAyMXQtMjEgOXpNNjAxIDUwMmgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMyA5IC0yMS41dDIxIC04LjVoMTc5cTEyIDAgMjEgOC41dDkgMjEuNXYxNzlxMCAxMiAtOSAyMXQtMjEgOXpNOTI5IDUwMmgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMyA5IC0yMS41dDIxIC04LjVoMTc5cTEyIDAgMjEgOC41dDkgMjEuNXYxNzlxMCAxMiAtOSAyMXQtMjEgOXoKTTI3MyA1MDJoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTMgOSAtMjEuNXQyMSAtOC41aDE3OXExMiAwIDIxIDguNXQ5IDIxLjV2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTYwMSAxNzRoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTMgOSAtMjEuNXQyMSAtOC41aDE3OXExMiAwIDIxIDguNXQ5IDIxLjV2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTkyOSAxNzRoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzkKcTAgLTEzIDkgLTIxLjV0MjEgLTguNWgxNzlxMTIgMCAyMSA4LjV0OSAyMS41djE3OXEwIDEyIC05IDIxdC0yMSA5ek0yNzMgMTc0aC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEzIDkgLTIxLjV0MjEgLTguNWgxNzlxMTIgMCAyMSA4LjV0OSAyMS41djE3OXEwIDEyIC05IDIxdC0yMSA5eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJtb3ZlZG93biIgdW5pY29kZT0iJiN4ZTYwYTsiIApkPSJNNzY4IDEwOHYzODRoLTY0di0zODRoLTE2MGwxOTIgLTE5MmwxOTIgMTkyaC0xNjB6TTMyMCA1NTZ2LTE5MmgtMTkydjE5MmgxOTJ6TTM4NCA2MjBoLTMyMHYtMzIwaDMyMHYzMjB6TTY0IDE3Mmg5NnYtNjRoLTk2djY0ek0xOTIgMTcyaDk2di02NGgtOTZ2NjR6TTMyMCAxNzJoNjR2LTk2aC02NHY5NnpNNjQgLTUyaDY0di05NmgtNjR2OTZ6TTE2MCAtODRoOTZ2LTY0aC05NnY2NHpNMjg4IC04NGg5NnYtNjRoLTk2djY0ek02NCA3Nmg2NAp2LTk2aC02NHY5NnpNMzIwIDQ0aDY0di05NmgtNjR2OTZ6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im1vdmV1cCIgdW5pY29kZT0iJiN4ZTYwYjsiIApkPSJNNzA0IDMwMHYtMzg0aDY0djM4NGgxNjBsLTE5MiAxOTJsLTE5MiAtMTkyaDE2MHpNNjQgNjIwaDk2di02NGgtOTZ2NjR6TTE5MiA2MjBoOTZ2LTY0aC05NnY2NHpNMzIwIDYyMGg2NHYtOTZoLTY0djk2ek02NCAzOTZoNjR2LTk2aC02NHY5NnpNMTYwIDM2NGg5NnYtNjRoLTk2djY0ek0yODggMzY0aDk2di02NGgtOTZ2NjR6TTY0IDUyNGg2NHYtOTZoLTY0djk2ek0zMjAgNDkyaDY0di05NmgtNjR2OTZ6TTMyMCAxMDh2LTE5MmgtMTkydjE5MgpoMTkyek0zODQgMTcyaC0zMjB2LTMyMGgzMjB2MzIweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJhZGQiIHVuaWNvZGU9IiYjeGU2MGM7IiAKZD0iTTUxMiAtNDFxLTExNSAwIC0yMTMgNTd0LTE1NSAxNTV0LTU3IDIxM3Q1NyAyMTN0MTU1IDE1NXQyMTMgNTd0MjEzIC01N3QxNTUgLTE1NXQ1NyAtMjEzdC01NyAtMjEzdC0xNTUgLTE1NXQtMjEzIC01N3pNNzI0IDQyNmgtMTcwdjE3MGgtODR2LTE3MGgtMTcwdi04NGgxNzB2LTE3MGg4NHYxNzBoMTcwdjg0eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJmb2xkZXIiIHVuaWNvZGU9IiYjeGU2MTg7IiAKZD0iTTk2MSA2NDBxMCA0MCAtMjguNSA2OHQtNjcuNSAyOGgtMTg2aC0xaC0xcS02IC0xIC0xMCAtMmwtMSAtMWgtMXEtNSAtMyAtOCAtNnEtMTggLTE3IC0zNSAtODhxLTMgLTEyIC00IC0xNHEtNCAtMTcgLTI3IC0xN2gtNy41aC03LjVoLTQxNnEtNDAgMCAtNjggLTI4LjV0LTI4IC02OS41bDMyIC00MTRxMCAtNDAgMjggLTY4dDY4IC0yOGg2NDBxNDAgMCA2OCAyOHQyOCA2NnpNODY0IDk2cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNQpoLTY0MHEtMTMgMCAtMjIuNSAxMHQtOS41IDI0bC0zMiA0MTRxMCAxMyA5LjUgMjIuNXQyMi41IDkuNWg0MTZoNy41aDcuNXEzNSAwIDU4LjUgMTd0MzAuNSA0OHEyIDQgNCAxNXE4IDM0IDEzIDQ4aDE2OHExMyAwIDIyLjUgLTkuNXQ5LjUgLTIyLjV2LTJ2LTF6TTEyOCA2NzJoNDE2cTEzIDAgMjIuNSA5LjV0OS41IDIyLjV0LTkuNSAyMi41dC0yMi41IDkuNWgtNDE2cS0xMyAwIC0yMi41IC05LjV0LTkuNSAtMjIuNXQ5LjUgLTIyLjUKdDIyLjUgLTkuNXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZ3JvdXAiIHVuaWNvZGU9IiYjeGU2MTk7IiAKZD0iTTUyMSAxOTRsLTM3NiAyNDdsLTUwIC01Mmw0MjYgLTI5MWw0MjYgMjkxbC01MSA1M3pNOTQ3IDU1MGwtNDI2IDI5MWwtNDI2IC0yOTFsNDI2IC0yOTF6TTUyMSA3NTZsMzAyIC0yMDZsLTMwMiAtMjA3bC0zMDIgMjA3ek01MjEgMzNsLTM3NiAyNDhsLTUwIC01Mmw0MjYgLTI5MWw0MjYgMjkxbC01MSA1M3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibG9jazIiIHVuaWNvZGU9IiYjeGU2MWU7IiAKZD0iTTc2OSA0NDh2MTM1djBxLTMgMTA0IC03Ny41IDE3Ni41dC0xNzguNSA3Mi41dC0xNzguNSAtNzIuNXQtNzcuNSAtMTc1LjV2MHYtMTM2aC0xcS0yNyAwIC00NS41IC0xOC41dC0xOC41IC00NS41di0zODRxMCAtMjcgMTguNSAtNDUuNXQ0NS41IC0xOC41aDUxMnEyNyAwIDQ1LjUgMTguNXQxOC41IDQ1LjV2Mzg0cTAgMjYgLTE4LjUgNDV0LTQ0LjUgMTl6TTMyMSA1ODF2MHEyIDc4IDU4IDEzMi41dDEzNCA1NC41dDEzNCAtNTQuNQp0NTggLTEzMi41djB2LTEzM2gtMzg0djEzM3pNNzY4IDMycTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNWgtNDQ4cS0xMyAwIC0yMi41IDkuNXQtOS41IDIyLjV2MzIwcTAgMTMgOS41IDIyLjV0MjIuNSA5LjVoNDQ4cTEzIDAgMjIuNSAtOS41dDkuNSAtMjIuNXYtMzIwek01NDQgMjA2djUycTAgMTMgLTkuNSAyMi41dC0yMi41IDkuNXQtMjIuNSAtOS41dC05LjUgLTIyLjV2LTUycS0yOCAtMTggLTI4IC01MXEwIC0yNSAxNy41IC00Mi41CnQ0Mi41IC0xNy41dDQyLjUgMTcuNXQxNy41IDQyLjVxMCAzMyAtMjggNTF6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImZpbGVzIiB1bmljb2RlPSImI3hlNjFmOyIgCmQ9Ik03NDQgNDM0aC0yNjBxLTEyIDAgLTIwLjUgLTguNXQtOC41IC0yMC41dDguNSAtMjAuNXQyMC41IC04LjVoMjYwcTEyIDAgMjAuNSA4LjV0OC41IDIwLjV0LTguNSAyMC41dC0yMC41IDguNXpNNzQ0IDI5MGgtMjYwcS0xMiAwIC0yMC41IC04LjV0LTguNSAtMjAuNXQ4LjUgLTIwLjV0MjAuNSAtOC41aDI2MHExMiAwIDIwLjUgOC41dDguNSAyMC41dC04LjUgMjAuNXQtMjAuNSA4LjV6TTc0NCA4MzloLTM0N3EtNDUgMCAtODAgLTM1LjUKdC0zNSAtODAuNWgtMzRxLTQ1IDAgLTc4IC0zNXQtMzMgLTgwdi01NzhxMCAtNDUgMzUgLTgwLjV0ODEgLTM1LjVoNDMzcTQ2IDAgODEgMzUuNXQzNSA4MC41aDI5cTQ2IDAgODEgMzUuNXQzNSA3OS41djQwNXY1N3pNNjg2IC0yOGgtNDMzcS0yMyAwIC00MC41IDE4dC0xNy41IDQwdjU3OHEwIDIyIDE2LjUgMzkuNXQzOC41IDE3LjVsMzIgMXYtNTIxcTAgLTQ0IDM1IC03OS41dDgwIC0zNS41aDM0N3EwIC0yMiAtMTcuNSAtNDB0LTQwLjUgLTE4djAKek04ODkgMTQ1cTAgLTIyIC0xNy41IC0zOS41dC00MC41IC0xNy41aC00MzRxLTIyIDAgLTM5LjUgMTcuNXQtMTcuNSAzOS41djU3OHEwIDIzIDE3LjUgNDAuNXQzOS41IDE3LjVoMjg5di0xMTZxMCAtNDUgMzUgLTgwdDgxIC0zNWg4N3YtNDA1ek04MDIgNjA4cS0yMSAwIC0zOS41IDMwLjV0LTE4LjUgNTUuNXY4NnYwbDE0NSAtMTcyaC04N3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0idGltZXNjaXJjbGUiIHVuaWNvZGU9IiYjeGU2MGU7IiAKZD0iTTY1NyAxNzFxMCAxNSAtMTEgMjZsLTEwNCAxMDNsMTA0IDEwM3ExMSAxMSAxMSAyNnEwIDE2IC0xMSAyNmwtNTIgNTJxLTExIDExIC0yNiAxMXQtMjYgLTExbC0xMDMgLTEwNGwtMTA0IDEwNHEtMTAgMTEgLTI1IDExcS0xNiAwIC0yNyAtMTFsLTUxIC01MnEtMTEgLTEwIC0xMSAtMjZxMCAtMTUgMTEgLTI2bDEwMyAtMTAzbC0xMDMgLTEwM3EtMTEgLTExIC0xMSAtMjZxMCAtMTYgMTEgLTI2bDUxIC01MnExMSAtMTEgMjcgLTExCnExNSAwIDI1IDExbDEwNCAxMDRsMTAzIC0xMDRxMTEgLTExIDI2IC0xMXQyNiAxMWw1MiA1MnExMSAxMCAxMSAyNnpNODc4IDMwMHEwIC0xMTkgLTU5IC0yMjB0LTE2MCAtMTYwdC0yMjAuNSAtNTl0LTIyMCA1OXQtMTU5LjUgMTYwdC01OSAyMjB0NTkgMjIwdDE1OS41IDE2MHQyMjAgNTl0MjIwLjUgLTU5dDE2MCAtMTYwdDU5IC0yMjB6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImVhcnRoIiB1bmljb2RlPSImI3hlNjFhOyIgCmQ9Ik04NzQgNjYycS03MyA3MyAtMTY2IDExMS41dC0xOTYgMzguNXQtMTk2IC0zOC41dC0xNjYgLTExMS41dC0xMTEuNSAtMTY2dC0zOC41IC0xOTZ0MzguNSAtMTk2dDExMS41IC0xNjZ0MTY2IC0xMTEuNXQxOTYgLTM4LjV0MTk2IDM4LjV0MTY2IDExMS41dDExMS41IDE2NnQzOC41IDE5NnQtMzguNSAxOTZ0LTExMS41IDE2NnpNOTQyIDQ2NnEtNyAxMiAtMjIgMTkuNXQtNDYgMTguNXEtMTYgNSAtMjguNSAyMHQtMTguNSAyOC41dC0xNSA0MS41CnEtOCAyNCAtMTMuNSAzN3QtMTcgMzF0LTI1LjUgMjlxMTMwIC04MiAxODYgLTIyNXpNNzk4IDI5MHEyIC0xOSAyLjUgLTM1LjV0LTguNSAtMzguNXQtMjkgLTQ1cS0xMiAtMTMgLTI2IC01MHEtOCAtMjIgLTEzLjUgLTMzLjV0LTE2LjUgLTI2dC0yOCAtMjF0LTQxIC02LjVxLTcgOCAtMTIgMzdxLTQgMjQgLTEwIDkwcS04IDExMSAtMjEgMTYwcS0yNSA5MiAtODQgMTEycS0yNiA5IC01NSA5cS0xNCAwIC0zOSAtM3EtMTcgLTIgLTI0IC0ydjAKcS04IDAgLTEzIDEuNXQtMTMgMTAuNXQtMTYgMjZxLTExIDMwIC0xMCA2My41dDIwLjUgNjl0NTMuNSA1Ny41cTU1IDM3IDg5IDM3cTI3IDAgNjkgLTIzcTM5IC0yMCA4MSAtMjBxOCAwIDIyIDFoMTZxMTggMCAzMSAtOXQyMS41IC0yNnQxOS41IC00OHE4IC0yNCAxMy41IC0zNy41dDE2LjUgLTMzdDI3IC0zMnQzNyAtMTkuNXEyMiAtOCAzMSAtMTFxLTkgLTkgLTM2IC0zNHEtMjEgLTE4IC0zMCAtMjdxLTIxIC0xOSAtMjUuNSAtNDZ0MC41IC00Nwp2MHpNNTEgMzA0cTggLTEgMTggLTNxMzQgLTggNDggLTE1cS0zIC02IC0xMiAtMThxLTI4IC00MSAtMjIgLTY1cTUgLTIyIC02IC01NnEtMjYgNzQgLTI2IDE1M3YydjJ2MHpNNTEyIC0xNjFxLTEyOSAwIC0yMzggNjYuNXQtMTY4IDE3Ni41cTQwIDc2IDI3IDEzMnEwIDUgMTQgMjRxNiA4IDkgMTIuNXQ3IDEzdDUuNSAxNC41dDEgMTQuNXQtNC41IDE1LjVxLTEyIDI2IC04MCA0MXEtMTMgMyAtMzEgNnExNCAxMTMgNzggMjA2dDE2NCAxNDYuNQp0MjE2IDUzLjVxMTE5IDAgMjIzIC01OHEtMTkgOCAtNDMgOGgtMTlxLTEzIC0xIC0xOSAtMXEtMjkgMCAtNTcgMTVxLTUzIDI4IC05MyAyOHEtNDkgMCAtMTE3IC00NXEtNjQgLTQyIC04OCAtMTE3cS0yMyAtNzMgNSAtMTM2cTMwIC02OSA4OSAtNjl2MHExMCAwIDMwIDJxMjIgMyAzMyAzcTIwIDAgMzggLTZxMzQgLTExIDUxIC03N3ExMiAtNDQgMjAgLTE1MXE2IC04MCAxMyAtMTEwcTYgLTI2IDE3IC00MXExNiAtMjQgNDEgLTI0CnE2OCAwIDEwOCA0NHEyMSAyNCA0MSA3N3ExMSAyOCAxNiAzNHEyNyAzMCAzOS41IDYxLjV0MTEgNTMuNXQtMi41IDQ0cS0zIDIxIC0xLjUgMzEuNXQ5LjUgMTguNXExMyAxMSAzMCAyNnEzMiAyOSA0MSAzOXEyMiAyNCAxOCA0NHYxcTI3IC03NSAyNyAtMTU2cTAgLTk0IC0zNi41IC0xNzl0LTk4LjUgLTE0N3QtMTQ3LjUgLTk4LjV0LTE3OC41IC0zNi41djB6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im1vdmUiIHVuaWNvZGU9IiYjeGU2MGY7IiAKZD0iTTEwMDggMzMwbC0xNTYgMTU1cS0xNCAxNCAtMzMuNSAxNHQtMzMgLTEzLjV0LTEzLjUgLTMzdDE0IC0zMy41bDc2IC03NmgtMzAzdjMwOWw3NiAtNzVxMTQgLTE0IDMzLjUgLTE0dDMzIDEzLjV0MTMuNSAzM3QtMTQgMzMuNWwtMTU1IDE1NXEtMTQgMTQgLTMzLjUgMTR0LTMyLjUgLTE0bC0xNTYgLTE1NXEtMTQgLTE0IC0xNCAtMzMuNXQxMy41IC0zM3QzMyAtMTMuNXQzMy41IDEzbDc2IDc2di0zMDloLTMwNGw3NiA3NgpxMTQgMTQgMTQgMzMuNXQtMTMuNSAzM3QtMzMgMTMuNXQtMzMuNSAtMTRsLTE1NiAtMTU1cS0xMyAtMTQgLTEzIC0zMy41dDEzIC0zMi41bDE1NiAtMTU2cTE0IC0xNCAzMy41IC0xNHQzMyAxNHQxMy41IDMzdC0xNCAzM2wtNzYgNzZoMzA0di0zMDNsLTc2IDc2cS0xNCAxNCAtMzMuNSAxNHQtMzMgLTEzLjV0LTEzLjUgLTMzdDE0IC0zMy41bDE1NSAtMTU1cTE0IC0xNCAzMy41IC0xNHQzMy41IDE0bDE1NSAxNTVxMTQgMTQgMTQgMzMuNQp0LTEzLjUgMzN0LTMzIDEzLjV0LTMzLjUgLTE0bC03NiAtNzV2MzAyaDMwM2wtNzYgLTc2cS0xNCAtMTQgLTE0IC0zM3QxMy41IC0zM3QzMyAtMTR0MzMuNSAxNGwxNTYgMTU2cTEzIDEzIDEzIDMyLjV0LTEzIDMzLjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImRlbGV0ZSIgdW5pY29kZT0iJiN4ZTYxMDsiIApkPSJNOTI0IDU3M2gtMTU0djEwNXEwIDI5IC0yMC41IDQ5LjV0LTQ5LjUgMjAuNWgtMzc2cS0yOSAwIC00OS41IC0yMC41dC0yMC41IC00OS41di0xMDVoLTE1NXEtMTQgMCAtMjQgLTEwdC0xMCAtMjQuNXQxMCAtMjQuNXQyNCAtMTBoNzl2LTU4MXEwIC0yOSAyMC41IC00OS41dDQ5LjUgLTIwLjVoNTI4cTI5IDAgNDkuNSAyMC41dDIwLjUgNDkuNXY1NTh2MHYyM2g3OHExNSAwIDI1IDEwdDEwIDI0LjV0LTEwIDI0LjV0LTI1IDEwegpNNDEyLjUgLTEwcS0xNC41IDAgLTI0LjUgMTB0LTEwIDI1bC0xIDM3MnEwIDE1IDEwLjUgMjV0MjUgMTB0MjQuNSAtMTB0MTAgLTI1di0zNzJxMCAtMTUgLTEwIC0yNXQtMjQuNSAtMTB6TTYxMS41IC0xMHEtMTQuNSAwIC0yNC41IDEwdC0xMCAyNXYzNzJxMCAxNSAxMCAyNXQyNC41IDEwdDI0LjUgLTEwdDEwIC0yNWwxIC0zNzJxMCAtMTUgLTEwLjUgLTI1dC0yNSAtMTB6TTMyMyA2MzVxMCAxNyAxMyAzMHQzMSAxM2gyOTBxMTggMCAzMSAtMTMKdDEzIC0zMHYtNjJoLTM3OHY2MnoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZG9jIiB1bmljb2RlPSImI3hlNjA2OyIgaG9yaXotYWR2LXg9IjEyODEiIApkPSJNMTI4MCA0MjJ6TTQ5MiAtN3EyIC0xIDMuNSAtMnQ1LjUgLTUuNXQ1LjUgLTkuNXQtMS41IC0xMS41dC0xMiAtMTMuNWgtMTUxcS00IDAgLTEwLjUgMS41dC0yNC41IDkuNXQtMzIgMjAuNXQtMjYuNSAzOHQtMTUuNSA1OC41djM5N3YwcTAgNCAxIDEydDcuNSAyOC41dDE3IDM3dDMyIDMydDQ5LjUgMTkuNWgzNDFxNCAwIDEwLjUgLTEuNXQyNCAtMTAuNXQzMS41IC0yMnQyNi41IC00MHQxNC41IC02MnYtMTAydi0xNjB0MCAtNzUKcS0xIC00IC0yLjUgLTExLjV0LTExLjUgLTI5LjV0LTI0LjUgLTQzdC00MyAtNDh0LTY1LjUgLTQ5aC0yaC01aC03aC04LjVoLTcuNWgtNWgtMnEtMTUgNCAtMTUuNSAyNC41dDAuNSA4Ni41djBxMCAzIDEgOHQ2IDE4LjV0MTIuNSAyNC41dDIzLjUgMjEuNXQzNiAxNC41aDgxdjMyNnEwIDMgLTEgOC41dC01LjUgMjB0LTExLjUgMjUuNXQtMjEgMjEuNXQtMzIgMTIuNWgtMzMycS0zIDAgLTcuNSAtMXQtMTYuNSAtNnQtMjEgLTEzLjUKdC0xNy41IC0yNy41dC0xMC41IC00NHEtMSAtMjAzIC0xIC0zODZxMSAtMyAxLjUgLTl0NSAtMjF0MTEuNSAtMjYuNXQyMS41IC0yMi41dDM0LjUgLTEzaDE0NnpNNzM2IDEwNmgtNzBxLTQgLTEgLTkuNSAtMy41dC0xNi41IC0xNS41dC0xMiAtMzB2LTE2di0zMS41di0xNS41bDggLTFxNSAwIDM0IDI5cTM3IDM3IDY2IDg0ek02NTEgNDMwcTAgLTEwIC03LjUgLTE3LjV0LTE3LjUgLTcuNWgtMjIxcS0xMCAwIC0xNy41IDcuNXQtNy41IDE3LjV2MApxMCAxMSA3LjUgMTguNXQxNy41IDcuNWgyMjFxMTAgMCAxNy41IC03LjV0Ny41IC0xOC41djB6TTY1MiAyODJxMCAtMTEgLTcuNSAtMTguNXQtMTguNSAtNy41aC0yMjBxLTExIDAgLTE4LjUgNy41dC03LjUgMTguNXYwcTAgMTEgNy41IDE4LjV0MTguNSA3LjVoMjIwcTExIDAgMTguNSAtNy41dDcuNSAtMTguNXYwek01MjQgMTMzcTAgLTExIC03LjUgLTE5dC0xOC41IC04aC05MXEtMTEgMCAtMTkgOHQtOCAxOXYwcTAgMTEgOCAxOXQxOSA4aDkxCnExMSAwIDE4LjUgLTh0Ny41IC0xOXYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJsaW5lIiB1bmljb2RlPSImI3hlNjExOyIgCmQ9Ik05NjAgNTUycTAgLTE3IC0xMiAtMjkuNXQtMzAgLTEyLjVoLTgxMnEtMTggMCAtMzAgMTIuNXQtMTIgMjkuNXYwcTAgMTggMTIgMzB0MzAgMTJoODEycTE4IDAgMzAgLTEydDEyIC0zMHYwek05NjAgMzAwcTAgLTE3IC0xMiAtMjkuNXQtMzAgLTEyLjVoLTgxMnEtMTggMCAtMzAgMTIuNXQtMTIgMjkuNXYwcTAgMTcgMTIgMjkuNXQzMCAxMi41aDgxMnExOCAwIDMwIC0xMi41dDEyIC0yOS41djB6TTk2MCA0OHEwIC0xOCAtMTIgLTMwCnQtMzAgLTEyaC04MTJxLTE4IDAgLTMwIDEydC0xMiAzMHYwcTAgMTcgMTIgMjkuNXQzMCAxMi41aDgxMnExOCAwIDMwIC0xMi41dDEyIC0yOS41djB6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImZpbGUtYm94IiB1bmljb2RlPSImI3hlNjFiOyIgCmQ9Ik04MDQgNzcwbDUwIC00MzFsLTU3IC03bC00NSAzODZoLTQ4MGwtNDUgLTM4NmwtNTcgN2w1MCA0MzFoNTg0ek0zMTkgNjc0aDM4NnYtNDhoLTM4NnY0OHpNMzE5IDU3N2gzODZ2LTQ4aC0zODZ2NDh6TTMxOSA0ODFoMzg2di00OWgtMzg2djQ5ek0zMTkgMzg0aDM4NnYtNDhoLTM4NnY0OHpNODc0IDI4N2gtNzI0cS0xMCAwIC0xNSAtNi41dC0yIC0xNS41bDgyIC0yNDRxMyAtMTAgMTIgLTE2LjV0MTkgLTYuNWg1MzJxMTAgMCAxOSA2LjUKdDEyIDE2LjVsODIgMjQ0cTMgOSAtMiAxNS41dC0xNSA2LjV6TTYwOSAxOTFoLTE5NHY0OGgxOTR2LTQ4eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJzd2l0Y2hvbiIgdW5pY29kZT0iJiN4ZTYxNTsiIApkPSJNODMyIDg5NmgtNjQwcS04MCAwIC0xMzYgLTU2dC01NiAtMTM2di02NDBxMCAtNzkgNTYgLTEzNS41dDEzNiAtNTYuNWg2NDBxNzkgMCAxMzUuNSA1Ni41dDU2LjUgMTM1LjV2NjQwcTAgODAgLTU2LjUgMTM2dC0xMzUuNSA1NnpNMTYwIDBxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNMTYwIDcwNHEtMTMgMCAtMjIuNSA5LjUKdC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNzA0IDY0cTAgLTI3IC0xOC41IC00NS41dC00NS41IC0xOC41aC0yNTZxLTI3IDAgLTQ1LjUgMTguNXQtMTguNSA0NS41djY0MHEwIDI2IDE5IDQ1dDQ1IDE5aDI1NnEyNyAwIDQ1LjUgLTE4LjV0MTguNSAtNDUuNXYtNjQwek04NjQgMHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41dDkuNSAyMi41dDIyLjUgOS41CnQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNODY0IDcwNHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41dDkuNSAyMi41dDIyLjUgOS41dDIyLjUgLTkuNXQ5LjUgLTIyLjV0LTkuNSAtMjIuNXQtMjIuNSAtOS41ek01NzYgNzA0aC0xMjhxLTI2IDAgLTQ1IC0xOXQtMTkgLTQ1di0xOTJxMCAtMjYgMTkgLTQ1dDQ1IC0xOWgxMjhxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djE5MnEwIDI3IC0xOC41IDQ1LjUKdC00NS41IDE4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InN5c3NlcnZlciIgdW5pY29kZT0iJiN4ZTYwNTsiIApkPSJNNTE1IDE0NXEtMzYgMCAtNzEgLTEydC02NCAtNDF0LTM2IC02OWgzMzhxLTUgNTMgLTU3IDg3LjV0LTExMCAzNC41ek05NTUgMTU3cS0zIDI2NSAwIDUyOHEwIDM0IC0xMi41IDQ3dC00Ni41IDEzcS00NSAtMSAtMzg0IC0xdjBxLTMzOSAwIC0zOTAgMXEtMjggMCAtNDAuNSAtMTF0LTEyLjUgLTM5cTEgLTIzMSAwIC01NDRxMCAtMjggMTEuNSAtNDAuNXQzOS41IC0xMS41cTM1IDEgMTA3IDAuNXQxMDcgMC41cTI1IDEgNDggMTcKcTU2IDQwIDExNS41IDQ1dDExNi41IC0yOHE2MyAtMzcgMTUwIC0zNXE5NCAyIDEzMiAwcTMzIC0yIDQ2IDExdDEzIDQ3ek04OTIgMjEzaC03NjB2NDU2aDc2MHYtNDU2eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJmaWxlIiB1bmljb2RlPSImI3hlNzdkOyIgCmQ9Ik02NDUgODA5aC0zNzJxLTQ0IDAgLTc1IC0zMXQtMzEgLTc1di02MzhxMCAtNDQgMzEgLTc1dDc1IC0zMWg0NzhxNDQgMCA3NSAzMXQzMSA3NXY1MzJ6TTY0MyA3MjZsMTI3IC0xMjdoLTEwNHEtOSAwIC0xNiA2LjV0LTcgMTYuNXYxMDR6TTc1MSAxOWgtNDc4cS0xOSAwIC0zMi41IDEzLjV0LTEzLjUgMzIuNXY2MzhxMCAxOSAxMy41IDMyLjV0MzIuNSAxMy41aDMxMHYtMTI3cTAgLTM0IDI0LjUgLTU4LjV0NTguNSAtMjQuNWgxMzF2LTQ3NApxMCAtMTkgLTEzLjUgLTMyLjV0LTMyLjUgLTEzLjV6TTY4MiAzODhoLTM0MHEtMTIgMCAtMjEgLTl0LTkgLTIxLjV0OSAtMjF0MjEgLTguNWgzNDBxMTIgMCAyMSA4LjV0OSAyMXQtOSAyMS41dC0yMSA5ek02ODIgMjMyaC0zNDBxLTEyIDAgLTIxIC05dC05IC0yMS41dDkgLTIxdDIxIC04LjVoMzQwcTEyIDAgMjEgOC41dDkgMjF0LTkgMjEuNXQtMjEgOXoiIC8+CiAgPC9mb250Pgo8L2RlZnM+PC9zdmc+Cg=="
  18719. /***/ }),
  18720. /* 125 */
  18721. /***/ (function(module, exports) {
  18722. module.exports = "data:application/x-font-ttf;base64,AAEAAAAQAQAABAAARkZUTXYvd9YAAAEMAAAAHEdERUYAUgAGAAABKAAAACBPUy8yV6halgAAAUgAAABWY21hcNEq7P4AAAGgAAABmmN2dCANZf5MAAAvwAAAACRmcGdtMPeelQAAL+QAAAmWZ2FzcAAAABAAAC+4AAAACGdseWYyewhpAAADPAAAJ8RoZWFkDhEYsQAAKwAAAAA2aGhlYQjeBE8AACs4AAAAJGhtdHh/CAnyAAArXAAAAIxsb2NhmsakygAAK+gAAABMbWF4cAF/CqAAACw0AAAAIG5hbWUPLcEVAAAsVAAAAitwb3N0HGKcfwAALoAAAAE2cHJlcKW5vmYAADl8AAAAlQAAAAEAAAAAzD2izwAAAADU+OqDAAAAANT46oMAAQAAAA4AAAAYAAAAAAACAAEAAwAkAAEABAAAAAIAAAABBAYB9AAFAAgCmQLMAAAAjwKZAswAAAHrADMBCQAAAgAGAwAAAAAAAAAAAAEQAAAAAAAAAAAAAABQZkVkAEAAeOd9A4D/gABcA4AA1AAAAAEAAAAAAAAAAAADAAAAAwAAABwAAQAAAAAAlAADAAEAAAAcAAQAeAAAAAoACAACAAIAAAB45h/nff//AAAAAAB45gDnff//AAD/iwAAGKcAAQAAAAAABgAAAAAABQAQABIAEwAJACMAHwAGAAcADwAUABUAFgAEABsAHQAeACAAEQAMAA0AIgAIAAoAFwAYABwAIQAOAAsAGQAaAAABBgAAAQAAAAAAAAABAgAAAAIAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUALP/hA7wDGAAWADAAOgBSAF4Bd0uwE1BYQEoCAQANDg0ADmYAAw4BDgNeAAEICAFcEAEJCAoGCV4RAQwGBAYMXgALBAtpDwEIAAYMCAZYAAoHBQIECwoEWRIBDg4NUQANDQoOQhtLsBdQWEBLAgEADQ4NAA5mAAMOAQ4DXgABCAgBXBABCQgKCAkKZhEBDAYEBgxeAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CG0uwGFBYQEwCAQANDg0ADmYAAw4BDgNeAAEICAFcEAEJCAoICQpmEQEMBgQGDARmAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CG0BOAgEADQ4NAA5mAAMOAQ4DAWYAAQgOAQhkEAEJCAoICQpmEQEMBgQGDARmAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CWVlZQChTUzs7MjEXF1NeU15bWDtSO1JLQzc1MToyOhcwFzBRETEYESgVQBMWKwEGKwEiDgIdASE1NCY1NC4CKwEVIQUVFBYUDgIjBiYrASchBysBIiciLgI9ARciBhQWMzI2NCYXBgcOAx4BOwYyNicuAScmJwE1ND4COwEyFh0BARkbGlMSJRwSA5ABChgnHoX+SgKiARUfIw4OHw4gLf5JLB0iFBkZIBMIdwwSEgwNEhKMCAYFCwQCBA8OJUNRUEAkFxYJBQkFBQb+pAUPGhW8HykCHwEMGScaTCkQHAQNIBsSYYg0Fzo6JRcJAQGAgAETGyAOpz8RGhERGhF8GhYTJA4QDQgYGg0jERMUAXfkCxgTDB0m4wAABwAA/ywEAAMsAA8AFwAfAC8ANwA/AE8AzkuwGlBYQDEIBgICAAECAVULBwIFBQBRDgEAAApBCgEEBANRDQkCAwMLQQ8BDAwDUQ0JAgMDCwNCG0uwLlBYQC8OAQALBwIFBAAFWQgGAgIAAQIBVQoBBAQDUQ0JAgMDC0EPAQwMA1ENCQIDAwsDQhtAMQ4BAAsHAgUEAAVZCgEEDAMETQ8BDA0JAgMCDANZCAYCAgEBAk0IBgICAgFRAAECAUVZWUAmQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAEjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYlG4AbJSUDLHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExr+rSYawBslJRvAGyUAAAAAAQA6/7gDlgLqAAkABrMEAAEmKwETBQcTJQUTJyUB6IQBKdcz/vf+9jPXASkC6f7zK9H+2IyMASjRKwAAAwBL/+ADtQMfAAwAGAAgAChAJQADAAUEAwVZAAICAFEAAAAKQQAEBAFRAAEBCwFCExMVFDUSBhQrJQEmIgcBBhcWMyEyNgE0NjIWFREUBiImNRYiJjQ2MhYUA6/+qyNvI/6sIhwdRwKiRzn+DxMaExMaEzQoHBwoHH8CYT8//Z8+MTBhAf8NExMN/uANExMN4BwoHBwoAAAFAEv/3wO1Ax8ACwAXACMAJAAsAEVAQiQBBwYBQAAFAAQGBQRZAAYABwMGB1kAAgIBUQABAQpBAAMDAFEIAQAACwBCAgAsKygnHx4ZGBQRDQwHBgALAgsJDisFISImNwE2MhcBFgYAIgcBBhYzITI2JwECIiY1ETQ2MhYVERQHBjQ2MhYUBiIDUf1eRzkiAVQjbyMBVSI5/nokEf6sERQjAqIjFBH+qxUaExMaEyAwHCgcHCghYj4CYT8//Z8/YQMAHv2eHiIiHgJi/j8TDQEgDRMTDf7gDYMUKBwcKBwAAAIAN/+9A8YDMgAWACwASkBHIwEGBSwkGhcUCgcGCAQBEwECAANAAAEGBAYBBGYABAAGBABkAAUABgEFBlkDAQACAgBNAwEAAAJRAAIAAkUjJxITJxcQBxUrJSIuATU0Nxc1IxcGFRQeAjMyNycGIxMVMyc2NTQuAiMiBxc2MzIeARUUBwH4YaVgPl32XFVGd6NaVU4yNzrY9mBMRnakWkZCNCkrYqVfNBFgpWFuW131XHSRWqN3Rh9HEgEE9mBwiFqkdkYVSQpfpWJlVgAAAAACAGb/kgOaAsYACwAqADhANQwBAgUBQAADAAUAAwVmAAUCAAUCZAAAAAIEAAJZAAQBAQRNAAQEAVEAAQQBRRcZFCkVEAYUKwAiDgEUHgEyPgE0JgEUHgIzMj8BNjcyHwEeAQcDMQcOAS8BLgE/AT4BFwJv3r1tbb3evW1t/kwKCAwEEF2KBwgNCC0HAQf6NQcWB5cIAQgjBxYIAsVtvd69bW293r3+pQEKCAdonggBBywIFQj++DkHAQeOBxYIJQgBCAAAAgB/ACEDgQMjAAsAFwBmS7AyUFhAJAcBBQAGAAUGZgQBAgMBAwIBZgADAAEDAVUABgYAUgAAAAoGQhtAKgcBBQAGAAUGZgQBAgMBAwIBZgAAAAYDAAZXAAMCAQNLAAMDAVEAAQMBRVlAChERERERFRUQCBYrACIOARQeATI+ATQmAyM1IxUjETMVMzUzAmjQsWdnsdCxZ2eFMsQyMsQyAyJnsdGxZ2ex0bH+G6+vAYuzswAAAwBV/ywDqwMsABIAGgAzAHFADjMbAgMCERAJBwQBAAJAS7AaUFhAHQYECAMDAAABAwBZAAEABQEFVgACAgdRAAcHCgJCG0AjAAcAAgMHAlkGBAgDAwAAAQMAWQABBQUBTQABAQVSAAUBBUZZQBMTEzEwLSsmIx4cExoTGhg4EgkRKyU0NjIWFRQHFhcUBisBIiY1NyYDNTQ2MhYdASUVIyIGFREUFjMhMjY1ETQmKwE1NCYiBhUBqzJGMicJCRMNQA0TEidWZI5k/kBAJDIyJAKqJDIyJECi5qKXIzIyIy8ZMjwNExMNbhkBGZZGZGRGlpaWMiP+VSMyMiMBqyMylnOionMAAAAAAwAPAFkD8QKnAA8AHwAnADZAMwABAAIFAQJZAAUABAMFBFkAAwAAA00AAwMAUQYBAAMARQIAJSQhIB0aFRIKBwAPAg8HDislISImPQE0NjMhMhYdARQGEzQmIyEiBh0BFBYzITI2NQQiJjQ2MhYUAtn+TnSjo3QBsnSjo2V/Wv5OWn9/WgGyWn/91IhgYIhgWqNzIHOjo3Mgc6MBNlp+flogWn9/WpFhiGBgiAAAAAADAA8AWQPxAqcADwAgACgAPUA6IBACBAUBQAABAAIFAQJZAAUABAMFBFkAAwAAA00AAwMAUQYBAAMARQIAJiUiIR0aFRIKBwAPAg8HDislISImPQE0NjMhMhYdARQGEzQmIyEiBh0BFBYzITI2PQEGIiY0NjIWFALZ/k50o6N0AbJ0o6Nmf1r+TFl/f1kBtFp/sYhgYIhhWqNzIHOjo3Mgc6MBNVp/f1ofWn9/Wh+wYYhgYIgAAAAAAgAA/18EAAMEACEANQBVtQMBAwQBQEuwGlBYQBoAAgMBAwIBZgADAAEDAVUABAQAUQAAAAoEQhtAIAACAwEDAgFmAAAABAMABFkAAwIBA00AAwMBUQABAwFFWbYoLBE4KQUTKy0BJic2NTQmJyYjIgYHBhUUFhcWOwEyNzIWMQUWNj8BNiYlDgEjJicuATU0Nz4BMzIXHgEVFAPj/vACBCVFQWmKUpg3WEVCaYgBeWQBAgEQG0gXBhgE/kwobTtiTC8yQCdtO2NLLzID4wICT1FSmDdZRkFpilKZN1hIA+MXCR0HHEnuLzIBPyduO2NLMDE/KG07YwADAHT/oAOMArgADwAZABwAJkAjGQEAAhsYAgEAAkAcGgIBPQACAAJoAAABAGgAAQFfEhcWAxErJScmNDcBNjIfARYUBwEGIgE2Mh8BFhQPAScBNxcBgKkGBgF8BhAGqQYG/oQGEQEwEjEScBISOMX99zjGA6kFEQYBfAYGqQYQBv6EBgKpEhJwEjESOMX9Mv7GAAAAAwBr/+sDlQMVAAsAGwArAExLsC5QWEAdAAMABAUDBFkAAgIBUQABAQpBAAUFAFEAAAALAEIbQBoAAwAEBQMEWQAFAAAFAFUAAgIBUQABAQoCQlm3NTU1NxUQBhQrBCIuATQ+ATIeARQGAzQmKwEiBh0BFBY7ATI2NRU0JisBIgYdARQWOwEyNjUCbty6bGy63LpsbPELB0oHCwsHSgcLCwdKBwsLB0oHCxRsuty6bGy63LoCBQcLCwdKCAoKCIEICwsI7wcLCwcAAAAAAQEyAK4C1gJSABwAJ0AkAAQDAQRNBQEDBgICAAEDAFkABAQBUQABBAFFEyMTIyMTEAcVKwEjFRQGIiY9ASMiJjQ2OwE1NDYyFh0BMzIWFAYjArudDxYQnQsPDwudEBYPnQsPDwsBZp4KEBAKng8WD50LDw8LnQ8WDwAAAAMASQErA7UB9gAHAA8AFwAhQB4EAgIAAQEATQQCAgAAAVEFAwIBAAFFExMTExMQBhQrEiIGFBYyNjQkIgYUFjI2NCQiBhQWMjY02FM7O1M8ARVUOztUOwEWVDs7VDsB9TtUOztUOztUOztUOztUOztUAAAACQBA/74DvwM+AA8AHwAvAD8ATwBfAG8AfwCPAIdAhBQEEwISBQAFAwIBBgABWRcKFggVBQYLCQIHDAYHWRoQGQ4YBQwNDQxNGhAZDhgFDAwNUREPAg0MDUWCgHJwYmBSUEJAMjAiIBIQAgCKh4CPgo96d3B/cn9qZ2BvYm9aV1BfUl9KR0BPQk86NzA/Mj8qJyAvIi8aFxAfEh8KBwAPAg8bDisBIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JiEjIgYdARQWOwEyNj0BNCYBIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JiEjIgYdARQWOwEyNj0BNCYBIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JiEjIgYdARQWOwEyNj0BNCYCWbMMEhIMswwSEgE8swwSEgyzDBIS/WSzDBISDLMMEhIBPLMMEhIMswwSEgE8swwSEgyzDBIS/WSzDBISDLMMEhIBPLMMEhIMswwSEgE8swwSEgyzDBIS/WSzDBISDLMMEhIDPhIMswwSEgyzDBISDLMMEhIMswwSEgyzDBISDLMMEv64EgyzDRERDbMMEhIMsw0REQ2zDBISDLMNERENswwS/rgSDLMNERENswwSEgyzDRERDbMMEhIMsw0REQ2zDBIACwBA/2sDoAJsAAYACgAOABIAFgAaAB4AIgAmACoALgFNtAUBDwE/S7AKUFhAUQAABAMEAANmCwkCBwYBBgdeEhACDg8OaQAFGAEEAAUEVwADAAYHAwZXCggXAgQBABMMARNXAAwAFRQMFVcAFhEBDw4WD1cAFBQNTwANDQsNQhtLsBhQWEBSAAAEAwQAA2YLCQIHBgEGBwFmEhACDg8OaQAFGAEEAAUEVwADAAYHAwZXCggXAgQBABMMARNXAAwAFRQMFVcAFhEBDw4WD1cAFBQNTwANDQsNQhtAVwAABAMEAANmCwkCBwYBBgcBZhIQAg4PDmkABRgBBAAFBFcAAwAGBwMGVwoIFwIEAQATDAETVwAMABUUDBVXABQADRYUDVcAFg8PFksAFhYPTxEBDxYPQ1lZQDYHBwAALi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLBwoHCgkIAAYABhERGRArJREjESMXNwEVIzUlIREhBTMVIzczFSM3MxUjBTMVIzczFSM3MxUjJzMVIyUzFSMDAECgwMD9oMABAP7AAUD+wGBggGBggEBA/wBAQGBgYIBgYOBAQAEAQEBsAYD+gMDAAcDAwED+wIBAQEBAYIBgQEBAQOBgQGAAAAALAED/bAOhAmwABgAKAA4AEgAWABoAHgAiACYAKgAuAQO0BQERAT9LsApQWEBcBwUCAwQDaBcCAgELCgsBCmYODAIKFRUKXAAAFBMUABNmBgEEAA8IBA9XAAgAERAIEVcAEAAJEhAJVwASDQELARILVwAVGAEUABUUWAATFhYTSwATExZQABYTFkQbQF0HBQIDBANoFwICAQsKCwEKZg4MAgoVCwoVZAAAFBMUABNmBgEEAA8IBA9XAAgAERAIEVcAEAAJEhAJVwASDQELARILVwAVGAEUABUUWAATFhYTSwATExZQABYTFkRZQDYnJwAALi0sKycqJyopKCYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsKCQgHAAYABhERGRArAREzETMnBwEzFSM3MxUjNzMVIwUzFSM3MxUjNzMVIyczFSMlMxUjERUjNSUhESECwECgwMD+IGBggGBggEBA/wBAQGBgYIBgYOBAQAEAQEDAAQD+wAFAASz+gAGAwMABQEBAQEBggGBAQEBA4GBAYP7gwMBA/sAAAgBX/9cDqQMpAAsAFwCUS7AdUFhAJgQBAgMFAwIFZgcBBQYDBQZkAAMDAVEAAQEKQQAGBgBSAAAACwBCG0uwMlBYQCQEAQIDBQMCBWYHAQUGAwUGZAABAAMCAQNXAAYGAFIAAAALAEIbQCkEAQIDBQMCBWYHAQUGAwUGZAABAAMCAQNXAAYAAAZLAAYGAFIAAAYARllZQAoRERERERUVEAgWKwQiLgE0PgEyHgEUBgMjNSMVIxUzFTM1MwJz5sRycsTmxHJyY6pUqqpUqilyxObEcnLE5sQBYaqqVKqqAAADAEAAAAPBAuAAIwBAAEwAS0BICQEHACwrHBsEBQYCQAcBAD4JAgEDAAoIAgcDAAdZAAMABgUDBlkABQQEBU0ABQUEUQAEBQRFQ0FJRkFMQ0wmZTU1ZxURIgsWKwE0JisBMCIxBgcGMCMGBwYHBgcGIyoBIyEiBhUTFBYzITI2NScUBiMhIiY1AzQ2MyE6ATMyNjc2NzY3MzIWHQIlITI2NCYjISIGFBYDwTknugIGBAEBBQMSEQMBBBcBDQH+YCg4IDgoAoAoOEATDf2ADRMgEw0BoAENASMvBwICCAWoDRP8/wGgDRMTDf5gDRMTAoAoOAEBAQMDEUcMAhE5Kf5iKDg4JgINExQOAZ4NEyIfBAsiDhMNAgEjExoTExoTAAAEAF//wQOzA0kABQAJAA0AEwANQAoTEQwKCQcFAwQmKy0BBwkBJzcJAhENASUBJQcJAScCCf6IMgGqAaozM/5W/lYBqgEu/tL+0gEu/ogyAaoBqjPC9zT+3QEjNWwBI/7d/t0B8c7Pz/37+DT+3QEjNQAAAAQAv//AA0ADQAAZACMAMwBDAFdAVCEgGxoJCAIBCAEEOzQCCQgCQAAAAAQBAARZBQoDAwEABwgBB1kACAAJBggJWQAGAgIGTQAGBgJSAAIGAkYAAEA/ODcxLikmIyIeHQAZABk1JCQLESsBNTEuASMiBgcxFSMiBhURFBYzITI2NRE0JiUxPgEyFhcxFSEBFAYjISImNRE0NjMhMhYVBzU0JiIGHQEGFRQWMjY1NAMBA5VoaJUDARslJRsCABslJf4mAnCccAL+gAG/Ew3+QA0TEw0BwA0T4BMaExwjMiMBwIdokZFniCUb/oAbJSUbAYAaJoVObW1Ohf5gDRMTDQFADRMTDZI0DRMTDTQSIRkjIxkhAAYAif+qA7MDSAALABcALgBAAFIAWQCBQH5XAQUNLgEODwJAAAQADQUEDVkABQAJDwUJWRIBDwAOAA8OWRABAAABAgABWREBAgADDAIDWQAMCgEHCAwHWQsBCAYGCE0LAQgIBlEABggGRVRTDgwCAFNZVFlSUE1LRkNAPz07ODYxLyooJiMeHBoYFBEMFw4XCAUACwILEw4rASEiBhQWMyEyNjQmByEiBhQWMyEyNjQmAyEiBhUjIgYVERQWMyEyNjUzMjY1ETUBISImNRE0NjM3ERQWMyEUBiM3FAYjISImNRE0NjMhFRQWOwEnIiY9ATEXAuj+/AwREQwBBAwREQz+/AwREQwBBAwREQz+pS1GIi1CRi4BsS5GHS5G/vv+TxcjIRYgRi0BWyMXyyMX/k4WIyMWASFGLldXFSWRAbIRGBERGBGQERgRERgRAiVHLUYt/b4tR0ctRywBlTn9hSQWAkIWIwH99yxHFiStFiMjFgJCFyN0LUY6PRlWrAAAAAIAAP91A24C4wArADcAL0AsJBkOAwQCAAFAAAUBAQACBQBZAwECBAQCTQMBAgIEUQAEAgRFFRckLiQqBhQrJTQvATc2NTQvASYjIg8BJyYjIg8BBhUUHwEHBhUUHwEWMzI/ARcWMzI/ATYSFA4BIi4BND4BMhYCkQtoaAsLNAsPDwtnaAoPEAszCwtnZwsLMwsQDwpoZwsPDws0C912yu/JdnbJ78qrDwtnZwsPEAo0CwtoaAsLNAoQDwtnZwsPEAo0CwtoaAsLNAoBCO7KdnbK7sp2dgAAAAX///8sBAADLAAPABwAXABsAMMBrkAbhAEGCxsBBwa6VRADAwexfnJwbGdhXQgCDgRAS7ALUFhAQQANAAYHDQZZDAELCAEHAwsHWQADABAOAxBZBQEEDwEOAgQOWRIBCQABCQFVAAoKAFEAAAAKQQACAhFRABERCxFCG0uwDFBYQDsADQAGBw0GWQwBCwgBBwMLB1kFBAIDEA8CDgIDDlkSAQkAAQkBVQAKCgBRAAAACkEAAgIRUQAREQsRQhtLsBpQWEBBAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZEgEJAAEJAVUACgoAUQAAAApBAAICEVEAERELEUIbS7AmUFhAPwAAAAoNAApZAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZEgEJAAEJAVUAAgIRUQAREQsRQhtARgAAAAoNAApZAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZAAIAEQkCEVkSAQkBAQlNEgEJCQFRAAEJAUVZWVlZQCbDwqimnJqYl5aVj42LiYiFg4FubUpHRkRCQDg3NjUzMSgnFxITECsALgEiDgIUHgIyPgI0Jy4BJy4CJy4CJxYDHgEGBwYHDgMjJicmJyYnJicmIyIHBiMxIi4BJyY+ATc2MzIXFjMyNzIzMhceARceAxcWFwYHBgcOARclFhcWFwYHBhcWByY1PAE1ASImJzYnNDc+AyYnJicmJz4CMzIXJiMiIwYjIicmIyIHBgcGFxYzMTI3NjMyFxYXFhcWFxYXFjMyNzY3Njc+ASYnJjY3Njc2NzYnNDEWFRQOAiMDs5K6zrqSTU2Sus66kk1SBx4fEBkMCQgLFw6CWAIBEhQMDggLFiIYBwUEBggNGTsaHQ4ZEQcIChAICwInIjciGyonKggOCgYSDQ0RCwgLFiAVFgkJGxUJFQkF/RUICiIOAwkcBgULGgHNgdo7KA0OBgYIAwEEDEQNEg6AyHR3aBMYCAsNBh0cNSgxREAYFxweOwoUFgsUEiIRDAgGBwYLEBlEKBUUCwUbGQMBAwMIDREgCRYEG0l8q10CTZJNTZK6zrqSTU2Sus4/DA8LBR4bHBgaJAtS/sETISwXDSUWFx0NCB0YQm8xXBQJAwIDEhEeQ0cWJRcUAQkJIh8YGycZBwgDCRkSCRM2FA4BAggHBgwpGBYiSk8BAgH+L4VuTDgFEwgJEQwRBxoPAwNxums6CAEPHC0qS0k/RQIDBgtCLGtQHhoPGCwYNRwGHj8sFhUVCAsPHQoYFAFLUV6qfEkAAAABAAL/LAP+AywASwCkQAwaCQICA0AvAgoJAkBLsBpQWEA3BAECAwADAgBmBgEAAQMAAWQNAQcICQgHCWYLAQkKCAkKZAUBAQwBCAcBCFgACgoDUQADAwoKQhtAPAQBAgMAAwIAZgYBAAEDAAFkDQEHCAkIBwlmCwEJCggJCmQAAwIKA00FAQEMAQgHAQhYAAMDClEACgMKRVlAFUdGQkE+PTg3MjEUFxQTFRUTFBIOFysBJyYiBhQfASERFxYyNjQvASYiDwEGFBYyPwERITc2NCYiDwEGFB8BFjI2NC8BIREnJiIGFB8BFjI/ATY0JiIPAREhBwYUFjI/ATY0A/CcDicbDkz+0UwOJxsOmw4nDZwOGycOTP7QTA4bJw6cDQ2cDicbDkwBMEwOJxsOmw4nDpsOGycOTAEvTA4bJw6cDQFKmw4bJw5MATVLDhsnDpsODpsOJxsNTP7LTA4nGw6bDicNnA4cJg5M/tFMDhsnDpsODpsOJxsOSwEuTA4mHA6cDScABABA/2wDwALsACEALQA5AEMAVUBSGxoCBwMBQAABAAoAAQpZBQEDBwADTQsCDAMACQEHBgAHWQgBBgQEBk0IAQYGBFEABAYERQEAQ0I/PDU0Ly4pKCMiHhwXFBEPDAoHBAAhASENDisBIzU0JiMhIgYdASMiBhQWOwERFBYzITI2NRExNTMyNjQmACImNQM0NjIWFREUFiImNRE0NjIWFRMUATQ2MyEyFh0BIQOcmikd/ogdKZsOFBQOTykdAhAdKU4PFBT+AB0UARUdFLMdFBQdFAH+vBoSASISGv6GAj1pHSkpHWkUHRT9ux0pKR0CLhcUHRT9uRQPAXQPFBQP/owPFBQPAXQPFBQP/owPAnERGhoRPgAAAAYA6P/OBQECXgAAAFIAYABwAIAAkADJQChKERADCQRwaWhhAAUICYB5eHEECguQiYiBIgUGA1xYTDQzDgYFBgVAS7AcUFhANQABAAQJAQRZAAkACAsJCFkACwAKDQsKWQANAwYNTQADDAEGBQMGWQcOAgUFAFECAQAACwBCG0A8AAEABAkBBFkACQAICwkIWQALAAoNCwpZAA0DBg1NAAMMAQYFAwZZBw4CBQAABU0HDgIFBQBRAgEABQBFWUAgAQGOi4aDfnt2c25rZmNeXVRTAVIBUkVDOzowKS4nDxArCQEeAwYHIyIuAyc0ETE0PgM3ITIeAxccAjUOBAcwKgQrAS4BNzE0PgM3MxE0LgMnMCEiDgMHBhUeBBclIw4CBzAcATEXMjc2AxQGKwEiJjUxNDY7ATIWFRcUBisBIiY1MTQ2OwEyFhUHFAYrASImNTE0NjsBMhYVBQD87AIDCAMGCZcEDSQcGQMCDRUrHAFVBA0jHBkCAQMUHTklBAYICQYCAg8BAQIKDyAUUQIJDhwS/rQDCRgSEQIBAQEJDh0UAYZGBAsWAQgFHSU4DwrdCg8PCt0KDwEPC9wLDw8L3AsPgA8LWwsQEAtbCw8Bpv5TAQIJCg0HAxAZMyFNAUAEECkhHwQDEho2IxKomAEEDywqNhYEKUIDChsWFQQBRgMLHRYVAgIKESYZy7cDDB4XFgJxAQUaESAfAR0lAXMKDw8KCw8PC5QLDw8LCw8PC5ULEBALCxAQCwADAD8ABQPBAlMADwAfAC8AQkA/DwgHAAQAAR8YFxAEAgMvKCcgBAQFA0AAAQAAAwEAWQADAAIFAwJZAAUEBAVNAAUFBFEABAUERTU1NTU1MgYUKwEUBiMhIiY1MTQ2MyEyFh0BFAYjISImNTE0NjMhMhYdARQGIyEiJjUxNDYzITIWFQPAGBL81BIYGBIDLBIYGBL81BIYGBIDLBIYGBL81BIYGBIDLBIYAigRGRkREhgYEvwRGRkRERkZEfwSGBgSERkZEQAAAAcAhf/9A3sDAwAHAAsADwATABcAJwArAMi2BgECCQgBQEuwG1BYQEYOAQEAAWgACQgKCgleAAAAAgMAAlcAAwAEBQMEVwAFAAYHBQZXAAcACAkHCFcPAQoADQwKDVgADAsLDEsADAwLUQALDAtFG0BHDgEBAAFoAAkICggJCmYAAAACAwACVwADAAQFAwRXAAUABgcFBlcABwAICQcIVw8BCgANDAoNWAAMCwsMSwAMDAtRAAsMC0VZQCUaGAAAKyopKCIfGCcaJxcWFRQTEhEQDw4NDAsKCQgABwAHExAPKwETBwMhAycTFyEVIRUhFSEVIRUhFSEVIQUhIgYfAR4BMyEyNj8BNiYFIzUzAyQyOS3+IC05MmMBgv5+AYL+fgGC/n4Bgv5+Aiv9LAoKA1IDEgoCFAoSA1IDCv7twsIDAv5RBwGC/n4HAa9gMDEwMDEwMDENCfQKDQ0K9AkNYDAAAAAABwAA/4AEAAOAAA8AFwAfAC8ANwA/AE8AWkBXDgEACwcCBQQABVkADQMEDU0PDAoDBAkBAwIEA1kIBgICAQECTQgGAgICAVEAAQIBRUJAAgBKR0BPQk89PDk4NTQxMC0qJSIdHBkYFRQREAoHAA8CDxAOKwEhIgYVERQWMyEyNjURNCYAIiY0NjIWFAIiJjQ2MhYUARQGIyEiJjURNDYzITIWFRIiJjQ2MhYUAiImNDYyFhQFIyIGHQEUFjsBMjY9ATQmA0D9gFBwcFACgE9xcf0eGhMTGhMTGhMTGhMCACUb/wAbJSYaAQAbJa0aExMaExMaExMaE/7AgBomJhqAGyUlA4BwUP2AT3FxTwKAUHD8gBMaExMaAq0TGhMTGv1tGyUlGwKAGiYlG/1AExoTExoCrRMaExMaEyYawBomJRvAGyUAAwBEABcDvALpAAcAKAAsAD1AOgMBAgAHBgIHVwgBAAQBAE0ABgUBBAEGBFkIAQAAAU8AAQABQwEALCsqKScjHhkTEA8MBQQABwEHCQ4rJSIOAQchLgElAhM0JiMGITEgJyIGFRYDFBY3NhY3Njc+ARcWNzYXFjYnIREhAgMkRjoHAVIFaAF+AwMZIi3+rf6tMxwZAQEXHCOQIxkXOHc5P1deJiEaP/0IAviRGDooNUUMAQkBByIaAQEWHOf+xxwZAQEBAQEQKAohJQICAgIaWgHIAAAFAKb/1gNaAyoADQATACUAMQA9ANRACg4BAgQNAQUCAkBLsB1QWEAwAAIABQYCBVkLAQYABwgGB1kMAQgACQMICVkABAQAUQAAAApBCgEDAwFRAAEBCwFCG0uwMlBYQC4AAAAEAgAEWQACAAUGAgVZCwEGAAcIBgdZDAEIAAkDCAlZCgEDAwFRAAEBCwFCG0A0AAAABAIABFkAAgAFBgIFWQsBBgAHCAYHWQwBCAAJAwgJWQoBAwEBA00KAQMDAVEAAQMBRVlZQB80MigmFhQ6NzI9ND0uKyYxKDEiIB0bFCUWJSU1IA0RKwEhIgYVERQWMyEyNjURJxcjIiY1EyEiJjURNDYzIRUUFjsBERQGAyEiBhQWMyEyNjQmByEiBhQWMyEyNjQmAoX+jCw+PiwB3iw+1n9oCQ5s/iITGxsTATYxIoMbWP6sDBISDAFUDBISDP6sDBISDAFUDBISAyk+LP2CLD4+LAIUgX8NCv2lGxMCfhMbfyIx/iYTGwFxEhkRERkSnBIZEREZEgABAAAAAQAATuFx3V8PPPUACwQAAAAAANT46oQAAAAA1PjqhP///ywFAQOAAAAACAACAAAAAAAAAAEAAAOA/ywAXAUB//8AAAUBAAEAAAAAAAAAAAAAAAAAAAAhBAAAAAAAAAABVQAAA+kALAQAAAAEAAA6BAAASwQAAEsEAAA3BAAAZgQAAH8EAABVBAAADwQAAA8EAAAABAAAdAQAAGsEAAEyBAAASQQAAEAEAABABAAAQAQAAFcEAABABAAAXwQAAL8EAACJBAAAAAQAAAAEAAACBAAAQAUBAOgEAAA/AIUAAABEAKYAAAAAAAAAAAE8AhoCOAKEAvQDXAO+BBgEnAT0BVAFzAYWBnwGugb0B/AI5AmyCiIKsgrsC3YMNgyiDpAPUg/eEPoRXhIQErITHBPiAAEAAAAlAMQACwAAAAAAAgA2AEQAbAAAAKwJlgAAAAAAAAAMAJYAAQAAAAAAAQAIAAAAAQAAAAAAAgAGAAgAAQAAAAAAAwAkAA4AAQAAAAAABAAIADIAAQAAAAAABQBFADoAAQAAAAAABgAIAH8AAwABBAkAAQAQAIcAAwABBAkAAgAMAJcAAwABBAkAAwBIAKMAAwABBAkABAAQAOsAAwABBAkABQCKAPsAAwABBAkABgAQAYVpY29uZm9udE1lZGl1bUZvbnRGb3JnZSAyLjAgOiBpY29uZm9udCA6IDIzLTMtMjAxN2ljb25mb250VmVyc2lvbiAxLjA7IHR0ZmF1dG9oaW50ICh2MC45NCkgLWwgOCAtciA1MCAtRyAyMDAgLXggMTQgLXcgIkciIC1mIC1zaWNvbmZvbnQAaQBjAG8AbgBmAG8AbgB0AE0AZQBkAGkAdQBtAEYAbwBuAHQARgBvAHIAZwBlACAAMgAuADAAIAA6ACAAaQBjAG8AbgBmAG8AbgB0ACAAOgAgADIAMwAtADMALQAyADAAMQA3AGkAYwBvAG4AZgBvAG4AdABWAGUAcgBzAGkAbwBuACAAMQAuADAAOwAgAHQAdABmAGEAdQB0AG8AaABpAG4AdAAgACgAdgAwAC4AOQA0ACkAIAAtAGwAIAA4ACAALQByACAANQAwACAALQBHACAAMgAwADAAIAAtAHgAIAAxADQAIAAtAHcAIAAiAEcAIgAgAC0AZgAgAC0AcwBpAGMAbwBuAGYAbwBuAHQAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJQAAAAEAAgBbAQIBAwEEAQUBBgEHAEsBCAEJAQoBCwEMAQ0BDgEPARABEQESARMBFAEVARYBFwEYARkBGgEbARwBHQEeAR8BIAEhCXN3aXRjaG9mZgRpY29uCHdhcm5maWxsBHdhcm4HcmVmcmVzaAJvawRsb2NrA29mZgJvbgZzZWFyY2gEZWRpdARpbmZvBWFkZC1zBG1vcmUEZ3JpZAhtb3ZlZG93bgZtb3ZldXADYWRkBmZvbGRlcgVncm91cAVsb2NrMgVmaWxlcwt0aW1lc2NpcmNsZQVlYXJ0aARtb3ZlBmRlbGV0ZQNkb2MEbGluZQhmaWxlLWJveAhzd2l0Y2hvbglzeXNzZXJ2ZXIEZmlsZQAAAAEAAf//AA8AAAAAAAAAAAAAAAAAAAAAADIAMgMY/+EDgP8sAxj/4QOA/yywACywIGBmLbABLCBkILDAULAEJlqwBEVbWCEjIRuKWCCwUFBYIbBAWRsgsDhQWCGwOFlZILAKRWFksChQWCGwCkUgsDBQWCGwMFkbILDAUFggZiCKimEgsApQWGAbILAgUFghsApgGyCwNlBYIbA2YBtgWVlZG7AAK1lZI7AAUFhlWVktsAIsIEUgsAQlYWQgsAVDUFiwBSNCsAYjQhshIVmwAWAtsAMsIyEjISBksQViQiCwBiNCsgoAAiohILAGQyCKIIqwACuxMAUlilFYYFAbYVJZWCNZISCwQFNYsAArGyGwQFkjsABQWGVZLbAELLAII0KwByNCsAAjQrAAQ7AHQ1FYsAhDK7IAAQBDYEKwFmUcWS2wBSywAEMgRSCwAkVjsAFFYmBELbAGLLAAQyBFILAAKyOxBAQlYCBFiiNhIGQgsCBQWCGwABuwMFBYsCAbsEBZWSOwAFBYZVmwAyUjYURELbAHLLEFBUWwAWFELbAILLABYCAgsApDSrAAUFggsAojQlmwC0NKsABSWCCwCyNCWS2wCSwguAQAYiC4BABjiiNhsAxDYCCKYCCwDCNCIy2wCixLVFixBwFEWSSwDWUjeC2wCyxLUVhLU1ixBwFEWRshWSSwE2UjeC2wDCyxAA1DVVixDQ1DsAFhQrAJK1mwAEOwAiVCsgABAENgQrEKAiVCsQsCJUKwARYjILADJVBYsABDsAQlQoqKIIojYbAIKiEjsAFhIIojYbAIKiEbsABDsAIlQrACJWGwCCohWbAKQ0ewC0NHYLCAYiCwAkVjsAFFYmCxAAATI0SwAUOwAD6yAQEBQ2BCLbANLLEABUVUWACwDSNCIGCwAWG1Dg4BAAwAQkKKYLEMBCuwaysbIlktsA4ssQANKy2wDyyxAQ0rLbAQLLECDSstsBEssQMNKy2wEiyxBA0rLbATLLEFDSstsBQssQYNKy2wFSyxBw0rLbAWLLEIDSstsBcssQkNKy2wGCywByuxAAVFVFgAsA0jQiBgsAFhtQ4OAQAMAEJCimCxDAQrsGsrGyJZLbAZLLEAGCstsBossQEYKy2wGyyxAhgrLbAcLLEDGCstsB0ssQQYKy2wHiyxBRgrLbAfLLEGGCstsCAssQcYKy2wISyxCBgrLbAiLLEJGCstsCMsIGCwDmAgQyOwAWBDsAIlsAIlUVgjIDywAWAjsBJlHBshIVktsCQssCMrsCMqLbAlLCAgRyAgsAJFY7ABRWJgI2E4IyCKVVggRyAgsAJFY7ABRWJgI2E4GyFZLbAmLLEABUVUWACwARawJSqwARUwGyJZLbAnLLAHK7EABUVUWACwARawJSqwARUwGyJZLbAoLCA1sAFgLbApLACwA0VjsAFFYrAAK7ACRWOwAUVisAArsAAWtAAAAAAARD4jOLEoARUqLbAqLCA8IEcgsAJFY7ABRWJgsABDYTgtsCssLhc8LbAsLCA8IEcgsAJFY7ABRWJgsABDYbABQ2M4LbAtLLECABYlIC4gR7AAI0KwAiVJiopHI0cjYSBYYhshWbABI0KyLAEBFRQqLbAuLLAAFrAEJbAEJUcjRyNhsAZFK2WKLiMgIDyKOC2wLyywABawBCWwBCUgLkcjRyNhILAEI0KwBkUrILBgUFggsEBRWLMCIAMgG7MCJgMaWUJCIyCwCUMgiiNHI0cjYSNGYLAEQ7CAYmAgsAArIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbCAYmEjICCwBCYjRmE4GyOwCUNGsAIlsAlDRyNHI2FgILAEQ7CAYmAjILAAKyOwBENgsAArsAUlYbAFJbCAYrAEJmEgsAQlYGQjsAMlYGRQWCEbIyFZIyAgsAQmI0ZhOFktsDAssAAWICAgsAUmIC5HI0cjYSM8OC2wMSywABYgsAkjQiAgIEYjR7AAKyNhOC2wMiywABawAyWwAiVHI0cjYbAAVFguIDwjIRuwAiWwAiVHI0cjYSCwBSWwBCVHI0cjYbAGJbAFJUmwAiVhsAFFYyMgWGIbIVljsAFFYmAjLiMgIDyKOCMhWS2wMyywABYgsAlDIC5HI0cjYSBgsCBgZrCAYiMgIDyKOC2wNCwjIC5GsAIlRlJYIDxZLrEkARQrLbA1LCMgLkawAiVGUFggPFkusSQBFCstsDYsIyAuRrACJUZSWCA8WSMgLkawAiVGUFggPFkusSQBFCstsDcssC4rIyAuRrACJUZSWCA8WS6xJAEUKy2wOCywLyuKICA8sAQjQoo4IyAuRrACJUZSWCA8WS6xJAEUK7AEQy6wJCstsDkssAAWsAQlsAQmIC5HI0cjYbAGRSsjIDwgLiM4sSQBFCstsDossQkEJUKwABawBCWwBCUgLkcjRyNhILAEI0KwBkUrILBgUFggsEBRWLMCIAMgG7MCJgMaWUJCIyBHsARDsIBiYCCwACsgiophILACQ2BkI7ADQ2FkUFiwAkNhG7ADQ2BZsAMlsIBiYbACJUZhOCMgPCM4GyEgIEYjR7AAKyNhOCFZsSQBFCstsDsssC4rLrEkARQrLbA8LLAvKyEjICA8sAQjQiM4sSQBFCuwBEMusCQrLbA9LLAAFSBHsAAjQrIAAQEVFBMusCoqLbA+LLAAFSBHsAAjQrIAAQEVFBMusCoqLbA/LLEAARQTsCsqLbBALLAtKi2wQSywABZFIyAuIEaKI2E4sSQBFCstsEIssAkjQrBBKy2wQyyyAAA6Ky2wRCyyAAE6Ky2wRSyyAQA6Ky2wRiyyAQE6Ky2wRyyyAAA7Ky2wSCyyAAE7Ky2wSSyyAQA7Ky2wSiyyAQE7Ky2wSyyyAAA3Ky2wTCyyAAE3Ky2wTSyyAQA3Ky2wTiyyAQE3Ky2wTyyyAAA5Ky2wUCyyAAE5Ky2wUSyyAQA5Ky2wUiyyAQE5Ky2wUyyyAAA8Ky2wVCyyAAE8Ky2wVSyyAQA8Ky2wViyyAQE8Ky2wVyyyAAA4Ky2wWCyyAAE4Ky2wWSyyAQA4Ky2wWiyyAQE4Ky2wWyywMCsusSQBFCstsFwssDArsDQrLbBdLLAwK7A1Ky2wXiywABawMCuwNistsF8ssDErLrEkARQrLbBgLLAxK7A0Ky2wYSywMSuwNSstsGIssDErsDYrLbBjLLAyKy6xJAEUKy2wZCywMiuwNCstsGUssDIrsDUrLbBmLLAyK7A2Ky2wZyywMysusSQBFCstsGgssDMrsDQrLbBpLLAzK7A1Ky2waiywMyuwNistsGssK7AIZbADJFB4sAEVMC0AAEu4AMhSWLEBAY5ZuQgACABjILABI0QgsAMjcLAORSAgS7gADlFLsAZTWliwNBuwKFlgZiCKVViwAiVhsAFFYyNisAIjRLMKCQUEK7MKCwUEK7MODwUEK1myBCgJRVJEswoNBgQrsQYBRLEkAYhRWLBAiFixBgNEsSYBiFFYuAQAiFixBgFEWVlZWbgB/4WwBI2xBQBEAAAA"
  18723. /***/ }),
  18724. /* 126 */
  18725. /***/ (function(module, exports) {
  18726. module.exports = "data:application/font-woff;base64,"
  18727. /***/ }),
  18728. /* 127 */
  18729. /***/ (function(module, exports) {
  18730. var g;
  18731. // This works in non-strict mode
  18732. g = (function() {
  18733. return this;
  18734. })();
  18735. try {
  18736. // This works if eval is allowed (see CSP)
  18737. g = g || Function("return this")() || (1,eval)("this");
  18738. } catch(e) {
  18739. // This works if the window reference is available
  18740. if(typeof window === "object")
  18741. g = window;
  18742. }
  18743. // g can still be undefined, but nothing to do about it...
  18744. // We return undefined, instead of nothing here, so it's
  18745. // easier to handle this case. if(!global) { ...}
  18746. module.exports = g;
  18747. /***/ }),
  18748. /* 128 */
  18749. /***/ (function(module, exports, __webpack_require__) {
  18750. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  18751. // Distributed under an MIT license: http://codemirror.net/LICENSE
  18752. (function(mod) {
  18753. if (true) // CommonJS
  18754. mod(__webpack_require__(33));
  18755. else if (typeof define == "function" && define.amd) // AMD
  18756. define(["../../lib/codemirror"], mod);
  18757. else // Plain browser env
  18758. mod(CodeMirror);
  18759. })(function(CodeMirror) {
  18760. "use strict";
  18761. var noOptions = {};
  18762. var nonWS = /[^\s\u00a0]/;
  18763. var Pos = CodeMirror.Pos;
  18764. function firstNonWS(str) {
  18765. var found = str.search(nonWS);
  18766. return found == -1 ? 0 : found;
  18767. }
  18768. CodeMirror.commands.toggleComment = function(cm) {
  18769. cm.toggleComment();
  18770. };
  18771. CodeMirror.defineExtension("toggleComment", function(options) {
  18772. if (!options) options = noOptions;
  18773. var cm = this;
  18774. var minLine = Infinity, ranges = this.listSelections(), mode = null;
  18775. for (var i = ranges.length - 1; i >= 0; i--) {
  18776. var from = ranges[i].from(), to = ranges[i].to();
  18777. if (from.line >= minLine) continue;
  18778. if (to.line >= minLine) to = Pos(minLine, 0);
  18779. minLine = from.line;
  18780. if (mode == null) {
  18781. if (cm.uncomment(from, to, options)) mode = "un";
  18782. else { cm.lineComment(from, to, options); mode = "line"; }
  18783. } else if (mode == "un") {
  18784. cm.uncomment(from, to, options);
  18785. } else {
  18786. cm.lineComment(from, to, options);
  18787. }
  18788. }
  18789. });
  18790. // Rough heuristic to try and detect lines that are part of multi-line string
  18791. function probablyInsideString(cm, pos, line) {
  18792. return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
  18793. }
  18794. function getMode(cm, pos) {
  18795. var mode = cm.getMode()
  18796. return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
  18797. }
  18798. CodeMirror.defineExtension("lineComment", function(from, to, options) {
  18799. if (!options) options = noOptions;
  18800. var self = this, mode = getMode(self, from);
  18801. var firstLine = self.getLine(from.line);
  18802. if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
  18803. var commentString = options.lineComment || mode.lineComment;
  18804. if (!commentString) {
  18805. if (options.blockCommentStart || mode.blockCommentStart) {
  18806. options.fullLines = true;
  18807. self.blockComment(from, to, options);
  18808. }
  18809. return;
  18810. }
  18811. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
  18812. var pad = options.padding == null ? " " : options.padding;
  18813. var blankLines = options.commentBlankLines || from.line == to.line;
  18814. self.operation(function() {
  18815. if (options.indent) {
  18816. var baseString = null;
  18817. for (var i = from.line; i < end; ++i) {
  18818. var line = self.getLine(i);
  18819. var whitespace = line.slice(0, firstNonWS(line));
  18820. if (baseString == null || baseString.length > whitespace.length) {
  18821. baseString = whitespace;
  18822. }
  18823. }
  18824. for (var i = from.line; i < end; ++i) {
  18825. var line = self.getLine(i), cut = baseString.length;
  18826. if (!blankLines && !nonWS.test(line)) continue;
  18827. if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
  18828. self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
  18829. }
  18830. } else {
  18831. for (var i = from.line; i < end; ++i) {
  18832. if (blankLines || nonWS.test(self.getLine(i)))
  18833. self.replaceRange(commentString + pad, Pos(i, 0));
  18834. }
  18835. }
  18836. });
  18837. });
  18838. CodeMirror.defineExtension("blockComment", function(from, to, options) {
  18839. if (!options) options = noOptions;
  18840. var self = this, mode = getMode(self, from);
  18841. var startString = options.blockCommentStart || mode.blockCommentStart;
  18842. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  18843. if (!startString || !endString) {
  18844. if ((options.lineComment || mode.lineComment) && options.fullLines != false)
  18845. self.lineComment(from, to, options);
  18846. return;
  18847. }
  18848. if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
  18849. var end = Math.min(to.line, self.lastLine());
  18850. if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
  18851. var pad = options.padding == null ? " " : options.padding;
  18852. if (from.line > end) return;
  18853. self.operation(function() {
  18854. if (options.fullLines != false) {
  18855. var lastLineHasText = nonWS.test(self.getLine(end));
  18856. self.replaceRange(pad + endString, Pos(end));
  18857. self.replaceRange(startString + pad, Pos(from.line, 0));
  18858. var lead = options.blockCommentLead || mode.blockCommentLead;
  18859. if (lead != null) for (var i = from.line + 1; i <= end; ++i)
  18860. if (i != end || lastLineHasText)
  18861. self.replaceRange(lead + pad, Pos(i, 0));
  18862. } else {
  18863. self.replaceRange(endString, to);
  18864. self.replaceRange(startString, from);
  18865. }
  18866. });
  18867. });
  18868. CodeMirror.defineExtension("uncomment", function(from, to, options) {
  18869. if (!options) options = noOptions;
  18870. var self = this, mode = getMode(self, from);
  18871. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
  18872. // Try finding line comments
  18873. var lineString = options.lineComment || mode.lineComment, lines = [];
  18874. var pad = options.padding == null ? " " : options.padding, didSomething;
  18875. lineComment: {
  18876. if (!lineString) break lineComment;
  18877. for (var i = start; i <= end; ++i) {
  18878. var line = self.getLine(i);
  18879. var found = line.indexOf(lineString);
  18880. if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
  18881. if (found == -1 && nonWS.test(line)) break lineComment;
  18882. if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
  18883. lines.push(line);
  18884. }
  18885. self.operation(function() {
  18886. for (var i = start; i <= end; ++i) {
  18887. var line = lines[i - start];
  18888. var pos = line.indexOf(lineString), endPos = pos + lineString.length;
  18889. if (pos < 0) continue;
  18890. if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
  18891. didSomething = true;
  18892. self.replaceRange("", Pos(i, pos), Pos(i, endPos));
  18893. }
  18894. });
  18895. if (didSomething) return true;
  18896. }
  18897. // Try block comments
  18898. var startString = options.blockCommentStart || mode.blockCommentStart;
  18899. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  18900. if (!startString || !endString) return false;
  18901. var lead = options.blockCommentLead || mode.blockCommentLead;
  18902. var startLine = self.getLine(start), open = startLine.indexOf(startString)
  18903. if (open == -1) return false
  18904. var endLine = end == start ? startLine : self.getLine(end)
  18905. var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
  18906. if (close == -1 && start != end) {
  18907. endLine = self.getLine(--end);
  18908. close = endLine.indexOf(endString);
  18909. }
  18910. var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
  18911. if (close == -1 ||
  18912. !/comment/.test(self.getTokenTypeAt(insideStart)) ||
  18913. !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
  18914. self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
  18915. return false;
  18916. // Avoid killing block comments completely outside the selection.
  18917. // Positions of the last startString before the start of the selection, and the first endString after it.
  18918. var lastStart = startLine.lastIndexOf(startString, from.ch);
  18919. var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
  18920. if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
  18921. // Positions of the first endString after the end of the selection, and the last startString before it.
  18922. firstEnd = endLine.indexOf(endString, to.ch);
  18923. var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
  18924. lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
  18925. if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
  18926. self.operation(function() {
  18927. self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
  18928. Pos(end, close + endString.length));
  18929. var openEnd = open + startString.length;
  18930. if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
  18931. self.replaceRange("", Pos(start, open), Pos(start, openEnd));
  18932. if (lead) for (var i = start + 1; i <= end; ++i) {
  18933. var line = self.getLine(i), found = line.indexOf(lead);
  18934. if (found == -1 || nonWS.test(line.slice(0, found))) continue;
  18935. var foundEnd = found + lead.length;
  18936. if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
  18937. self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
  18938. }
  18939. });
  18940. return true;
  18941. });
  18942. });
  18943. /***/ }),
  18944. /* 129 */
  18945. /***/ (function(module, exports, __webpack_require__) {
  18946. "use strict";
  18947. /**
  18948. * Copyright (c) 2013-present, Facebook, Inc.
  18949. * All rights reserved.
  18950. *
  18951. * This source code is licensed under the BSD-style license found in the
  18952. * LICENSE file in the root directory of this source tree. An additional grant
  18953. * of patent rights can be found in the PATENTS file in the same directory.
  18954. *
  18955. * @typechecks
  18956. */
  18957. var _hyphenPattern = /-(.)/g;
  18958. /**
  18959. * Camelcases a hyphenated string, for example:
  18960. *
  18961. * > camelize('background-color')
  18962. * < "backgroundColor"
  18963. *
  18964. * @param {string} string
  18965. * @return {string}
  18966. */
  18967. function camelize(string) {
  18968. return string.replace(_hyphenPattern, function (_, character) {
  18969. return character.toUpperCase();
  18970. });
  18971. }
  18972. module.exports = camelize;
  18973. /***/ }),
  18974. /* 130 */
  18975. /***/ (function(module, exports, __webpack_require__) {
  18976. "use strict";
  18977. /**
  18978. * Copyright (c) 2013-present, Facebook, Inc.
  18979. * All rights reserved.
  18980. *
  18981. * This source code is licensed under the BSD-style license found in the
  18982. * LICENSE file in the root directory of this source tree. An additional grant
  18983. * of patent rights can be found in the PATENTS file in the same directory.
  18984. *
  18985. * @typechecks
  18986. */
  18987. var camelize = __webpack_require__(129);
  18988. var msPattern = /^-ms-/;
  18989. /**
  18990. * Camelcases a hyphenated CSS property name, for example:
  18991. *
  18992. * > camelizeStyleName('background-color')
  18993. * < "backgroundColor"
  18994. * > camelizeStyleName('-moz-transition')
  18995. * < "MozTransition"
  18996. * > camelizeStyleName('-ms-transition')
  18997. * < "msTransition"
  18998. *
  18999. * As Andi Smith suggests
  19000. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  19001. * is converted to lowercase `ms`.
  19002. *
  19003. * @param {string} string
  19004. * @return {string}
  19005. */
  19006. function camelizeStyleName(string) {
  19007. return camelize(string.replace(msPattern, 'ms-'));
  19008. }
  19009. module.exports = camelizeStyleName;
  19010. /***/ }),
  19011. /* 131 */
  19012. /***/ (function(module, exports, __webpack_require__) {
  19013. "use strict";
  19014. /**
  19015. * Copyright (c) 2013-present, Facebook, Inc.
  19016. * All rights reserved.
  19017. *
  19018. * This source code is licensed under the BSD-style license found in the
  19019. * LICENSE file in the root directory of this source tree. An additional grant
  19020. * of patent rights can be found in the PATENTS file in the same directory.
  19021. *
  19022. *
  19023. */
  19024. var isTextNode = __webpack_require__(139);
  19025. /*eslint-disable no-bitwise */
  19026. /**
  19027. * Checks if a given DOM node contains or is another DOM node.
  19028. */
  19029. function containsNode(outerNode, innerNode) {
  19030. if (!outerNode || !innerNode) {
  19031. return false;
  19032. } else if (outerNode === innerNode) {
  19033. return true;
  19034. } else if (isTextNode(outerNode)) {
  19035. return false;
  19036. } else if (isTextNode(innerNode)) {
  19037. return containsNode(outerNode, innerNode.parentNode);
  19038. } else if ('contains' in outerNode) {
  19039. return outerNode.contains(innerNode);
  19040. } else if (outerNode.compareDocumentPosition) {
  19041. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  19042. } else {
  19043. return false;
  19044. }
  19045. }
  19046. module.exports = containsNode;
  19047. /***/ }),
  19048. /* 132 */
  19049. /***/ (function(module, exports, __webpack_require__) {
  19050. "use strict";
  19051. /**
  19052. * Copyright (c) 2013-present, Facebook, Inc.
  19053. * All rights reserved.
  19054. *
  19055. * This source code is licensed under the BSD-style license found in the
  19056. * LICENSE file in the root directory of this source tree. An additional grant
  19057. * of patent rights can be found in the PATENTS file in the same directory.
  19058. *
  19059. * @typechecks
  19060. */
  19061. var invariant = __webpack_require__(0);
  19062. /**
  19063. * Convert array-like objects to arrays.
  19064. *
  19065. * This API assumes the caller knows the contents of the data type. For less
  19066. * well defined inputs use createArrayFromMixed.
  19067. *
  19068. * @param {object|function|filelist} obj
  19069. * @return {array}
  19070. */
  19071. function toArray(obj) {
  19072. var length = obj.length;
  19073. // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
  19074. // in old versions of Safari).
  19075. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? false ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
  19076. !(typeof length === 'number') ? false ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
  19077. !(length === 0 || length - 1 in obj) ? false ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
  19078. !(typeof obj.callee !== 'function') ? false ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
  19079. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  19080. // without method will throw during the slice call and skip straight to the
  19081. // fallback.
  19082. if (obj.hasOwnProperty) {
  19083. try {
  19084. return Array.prototype.slice.call(obj);
  19085. } catch (e) {
  19086. // IE < 9 does not support Array#slice on collections objects
  19087. }
  19088. }
  19089. // Fall back to copying key by key. This assumes all keys have a value,
  19090. // so will not preserve sparsely populated inputs.
  19091. var ret = Array(length);
  19092. for (var ii = 0; ii < length; ii++) {
  19093. ret[ii] = obj[ii];
  19094. }
  19095. return ret;
  19096. }
  19097. /**
  19098. * Perform a heuristic test to determine if an object is "array-like".
  19099. *
  19100. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  19101. * Joshu replied: "Mu."
  19102. *
  19103. * This function determines if its argument has "array nature": it returns
  19104. * true if the argument is an actual array, an `arguments' object, or an
  19105. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  19106. *
  19107. * It will return false for other array-like objects like Filelist.
  19108. *
  19109. * @param {*} obj
  19110. * @return {boolean}
  19111. */
  19112. function hasArrayNature(obj) {
  19113. return (
  19114. // not null/false
  19115. !!obj && (
  19116. // arrays are objects, NodeLists are functions in Safari
  19117. typeof obj == 'object' || typeof obj == 'function') &&
  19118. // quacks like an array
  19119. 'length' in obj &&
  19120. // not window
  19121. !('setInterval' in obj) &&
  19122. // no DOM node should be considered an array-like
  19123. // a 'select' element has 'length' and 'item' properties on IE8
  19124. typeof obj.nodeType != 'number' && (
  19125. // a real array
  19126. Array.isArray(obj) ||
  19127. // arguments
  19128. 'callee' in obj ||
  19129. // HTMLCollection/NodeList
  19130. 'item' in obj)
  19131. );
  19132. }
  19133. /**
  19134. * Ensure that the argument is an array by wrapping it in an array if it is not.
  19135. * Creates a copy of the argument if it is already an array.
  19136. *
  19137. * This is mostly useful idiomatically:
  19138. *
  19139. * var createArrayFromMixed = require('createArrayFromMixed');
  19140. *
  19141. * function takesOneOrMoreThings(things) {
  19142. * things = createArrayFromMixed(things);
  19143. * ...
  19144. * }
  19145. *
  19146. * This allows you to treat `things' as an array, but accept scalars in the API.
  19147. *
  19148. * If you need to convert an array-like object, like `arguments`, into an array
  19149. * use toArray instead.
  19150. *
  19151. * @param {*} obj
  19152. * @return {array}
  19153. */
  19154. function createArrayFromMixed(obj) {
  19155. if (!hasArrayNature(obj)) {
  19156. return [obj];
  19157. } else if (Array.isArray(obj)) {
  19158. return obj.slice();
  19159. } else {
  19160. return toArray(obj);
  19161. }
  19162. }
  19163. module.exports = createArrayFromMixed;
  19164. /***/ }),
  19165. /* 133 */
  19166. /***/ (function(module, exports, __webpack_require__) {
  19167. "use strict";
  19168. /**
  19169. * Copyright (c) 2013-present, Facebook, Inc.
  19170. * All rights reserved.
  19171. *
  19172. * This source code is licensed under the BSD-style license found in the
  19173. * LICENSE file in the root directory of this source tree. An additional grant
  19174. * of patent rights can be found in the PATENTS file in the same directory.
  19175. *
  19176. * @typechecks
  19177. */
  19178. /*eslint-disable fb-www/unsafe-html*/
  19179. var ExecutionEnvironment = __webpack_require__(5);
  19180. var createArrayFromMixed = __webpack_require__(132);
  19181. var getMarkupWrap = __webpack_require__(134);
  19182. var invariant = __webpack_require__(0);
  19183. /**
  19184. * Dummy container used to render all markup.
  19185. */
  19186. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  19187. /**
  19188. * Pattern used by `getNodeName`.
  19189. */
  19190. var nodeNamePattern = /^\s*<(\w+)/;
  19191. /**
  19192. * Extracts the `nodeName` of the first element in a string of markup.
  19193. *
  19194. * @param {string} markup String of markup.
  19195. * @return {?string} Node name of the supplied markup.
  19196. */
  19197. function getNodeName(markup) {
  19198. var nodeNameMatch = markup.match(nodeNamePattern);
  19199. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  19200. }
  19201. /**
  19202. * Creates an array containing the nodes rendered from the supplied markup. The
  19203. * optionally supplied `handleScript` function will be invoked once for each
  19204. * <script> element that is rendered. If no `handleScript` function is supplied,
  19205. * an exception is thrown if any <script> elements are rendered.
  19206. *
  19207. * @param {string} markup A string of valid HTML markup.
  19208. * @param {?function} handleScript Invoked once for each rendered <script>.
  19209. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  19210. */
  19211. function createNodesFromMarkup(markup, handleScript) {
  19212. var node = dummyNode;
  19213. !!!dummyNode ? false ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
  19214. var nodeName = getNodeName(markup);
  19215. var wrap = nodeName && getMarkupWrap(nodeName);
  19216. if (wrap) {
  19217. node.innerHTML = wrap[1] + markup + wrap[2];
  19218. var wrapDepth = wrap[0];
  19219. while (wrapDepth--) {
  19220. node = node.lastChild;
  19221. }
  19222. } else {
  19223. node.innerHTML = markup;
  19224. }
  19225. var scripts = node.getElementsByTagName('script');
  19226. if (scripts.length) {
  19227. !handleScript ? false ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
  19228. createArrayFromMixed(scripts).forEach(handleScript);
  19229. }
  19230. var nodes = Array.from(node.childNodes);
  19231. while (node.lastChild) {
  19232. node.removeChild(node.lastChild);
  19233. }
  19234. return nodes;
  19235. }
  19236. module.exports = createNodesFromMarkup;
  19237. /***/ }),
  19238. /* 134 */
  19239. /***/ (function(module, exports, __webpack_require__) {
  19240. "use strict";
  19241. /**
  19242. * Copyright (c) 2013-present, Facebook, Inc.
  19243. * All rights reserved.
  19244. *
  19245. * This source code is licensed under the BSD-style license found in the
  19246. * LICENSE file in the root directory of this source tree. An additional grant
  19247. * of patent rights can be found in the PATENTS file in the same directory.
  19248. *
  19249. */
  19250. /*eslint-disable fb-www/unsafe-html */
  19251. var ExecutionEnvironment = __webpack_require__(5);
  19252. var invariant = __webpack_require__(0);
  19253. /**
  19254. * Dummy container used to detect which wraps are necessary.
  19255. */
  19256. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  19257. /**
  19258. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  19259. * so we wrap them, render the wrapped nodes, then extract the desired node.
  19260. *
  19261. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  19262. */
  19263. var shouldWrap = {};
  19264. var selectWrap = [1, '<select multiple="true">', '</select>'];
  19265. var tableWrap = [1, '<table>', '</table>'];
  19266. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  19267. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  19268. var markupWrap = {
  19269. '*': [1, '?<div>', '</div>'],
  19270. 'area': [1, '<map>', '</map>'],
  19271. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  19272. 'legend': [1, '<fieldset>', '</fieldset>'],
  19273. 'param': [1, '<object>', '</object>'],
  19274. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  19275. 'optgroup': selectWrap,
  19276. 'option': selectWrap,
  19277. 'caption': tableWrap,
  19278. 'colgroup': tableWrap,
  19279. 'tbody': tableWrap,
  19280. 'tfoot': tableWrap,
  19281. 'thead': tableWrap,
  19282. 'td': trWrap,
  19283. 'th': trWrap
  19284. };
  19285. // Initialize the SVG elements since we know they'll always need to be wrapped
  19286. // consistently. If they are created inside a <div> they will be initialized in
  19287. // the wrong namespace (and will not display).
  19288. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  19289. svgElements.forEach(function (nodeName) {
  19290. markupWrap[nodeName] = svgWrap;
  19291. shouldWrap[nodeName] = true;
  19292. });
  19293. /**
  19294. * Gets the markup wrap configuration for the supplied `nodeName`.
  19295. *
  19296. * NOTE: This lazily detects which wraps are necessary for the current browser.
  19297. *
  19298. * @param {string} nodeName Lowercase `nodeName`.
  19299. * @return {?array} Markup wrap configuration, if applicable.
  19300. */
  19301. function getMarkupWrap(nodeName) {
  19302. !!!dummyNode ? false ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
  19303. if (!markupWrap.hasOwnProperty(nodeName)) {
  19304. nodeName = '*';
  19305. }
  19306. if (!shouldWrap.hasOwnProperty(nodeName)) {
  19307. if (nodeName === '*') {
  19308. dummyNode.innerHTML = '<link />';
  19309. } else {
  19310. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  19311. }
  19312. shouldWrap[nodeName] = !dummyNode.firstChild;
  19313. }
  19314. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  19315. }
  19316. module.exports = getMarkupWrap;
  19317. /***/ }),
  19318. /* 135 */
  19319. /***/ (function(module, exports, __webpack_require__) {
  19320. "use strict";
  19321. /**
  19322. * Copyright (c) 2013-present, Facebook, Inc.
  19323. * All rights reserved.
  19324. *
  19325. * This source code is licensed under the BSD-style license found in the
  19326. * LICENSE file in the root directory of this source tree. An additional grant
  19327. * of patent rights can be found in the PATENTS file in the same directory.
  19328. *
  19329. * @typechecks
  19330. */
  19331. /**
  19332. * Gets the scroll position of the supplied element or window.
  19333. *
  19334. * The return values are unbounded, unlike `getScrollPosition`. This means they
  19335. * may be negative or exceed the element boundaries (which is possible using
  19336. * inertial scrolling).
  19337. *
  19338. * @param {DOMWindow|DOMElement} scrollable
  19339. * @return {object} Map with `x` and `y` keys.
  19340. */
  19341. function getUnboundedScrollPosition(scrollable) {
  19342. if (scrollable.Window && scrollable instanceof scrollable.Window) {
  19343. return {
  19344. x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
  19345. y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
  19346. };
  19347. }
  19348. return {
  19349. x: scrollable.scrollLeft,
  19350. y: scrollable.scrollTop
  19351. };
  19352. }
  19353. module.exports = getUnboundedScrollPosition;
  19354. /***/ }),
  19355. /* 136 */
  19356. /***/ (function(module, exports, __webpack_require__) {
  19357. "use strict";
  19358. /**
  19359. * Copyright (c) 2013-present, Facebook, Inc.
  19360. * All rights reserved.
  19361. *
  19362. * This source code is licensed under the BSD-style license found in the
  19363. * LICENSE file in the root directory of this source tree. An additional grant
  19364. * of patent rights can be found in the PATENTS file in the same directory.
  19365. *
  19366. * @typechecks
  19367. */
  19368. var _uppercasePattern = /([A-Z])/g;
  19369. /**
  19370. * Hyphenates a camelcased string, for example:
  19371. *
  19372. * > hyphenate('backgroundColor')
  19373. * < "background-color"
  19374. *
  19375. * For CSS style names, use `hyphenateStyleName` instead which works properly
  19376. * with all vendor prefixes, including `ms`.
  19377. *
  19378. * @param {string} string
  19379. * @return {string}
  19380. */
  19381. function hyphenate(string) {
  19382. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  19383. }
  19384. module.exports = hyphenate;
  19385. /***/ }),
  19386. /* 137 */
  19387. /***/ (function(module, exports, __webpack_require__) {
  19388. "use strict";
  19389. /**
  19390. * Copyright (c) 2013-present, Facebook, Inc.
  19391. * All rights reserved.
  19392. *
  19393. * This source code is licensed under the BSD-style license found in the
  19394. * LICENSE file in the root directory of this source tree. An additional grant
  19395. * of patent rights can be found in the PATENTS file in the same directory.
  19396. *
  19397. * @typechecks
  19398. */
  19399. var hyphenate = __webpack_require__(136);
  19400. var msPattern = /^ms-/;
  19401. /**
  19402. * Hyphenates a camelcased CSS property name, for example:
  19403. *
  19404. * > hyphenateStyleName('backgroundColor')
  19405. * < "background-color"
  19406. * > hyphenateStyleName('MozTransition')
  19407. * < "-moz-transition"
  19408. * > hyphenateStyleName('msTransition')
  19409. * < "-ms-transition"
  19410. *
  19411. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  19412. * is converted to `-ms-`.
  19413. *
  19414. * @param {string} string
  19415. * @return {string}
  19416. */
  19417. function hyphenateStyleName(string) {
  19418. return hyphenate(string).replace(msPattern, '-ms-');
  19419. }
  19420. module.exports = hyphenateStyleName;
  19421. /***/ }),
  19422. /* 138 */
  19423. /***/ (function(module, exports, __webpack_require__) {
  19424. "use strict";
  19425. /**
  19426. * Copyright (c) 2013-present, Facebook, Inc.
  19427. * All rights reserved.
  19428. *
  19429. * This source code is licensed under the BSD-style license found in the
  19430. * LICENSE file in the root directory of this source tree. An additional grant
  19431. * of patent rights can be found in the PATENTS file in the same directory.
  19432. *
  19433. * @typechecks
  19434. */
  19435. /**
  19436. * @param {*} object The object to check.
  19437. * @return {boolean} Whether or not the object is a DOM node.
  19438. */
  19439. function isNode(object) {
  19440. var doc = object ? object.ownerDocument || object : document;
  19441. var defaultView = doc.defaultView || window;
  19442. return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  19443. }
  19444. module.exports = isNode;
  19445. /***/ }),
  19446. /* 139 */
  19447. /***/ (function(module, exports, __webpack_require__) {
  19448. "use strict";
  19449. /**
  19450. * Copyright (c) 2013-present, Facebook, Inc.
  19451. * All rights reserved.
  19452. *
  19453. * This source code is licensed under the BSD-style license found in the
  19454. * LICENSE file in the root directory of this source tree. An additional grant
  19455. * of patent rights can be found in the PATENTS file in the same directory.
  19456. *
  19457. * @typechecks
  19458. */
  19459. var isNode = __webpack_require__(138);
  19460. /**
  19461. * @param {*} object The object to check.
  19462. * @return {boolean} Whether or not the object is a DOM text node.
  19463. */
  19464. function isTextNode(object) {
  19465. return isNode(object) && object.nodeType == 3;
  19466. }
  19467. module.exports = isTextNode;
  19468. /***/ }),
  19469. /* 140 */
  19470. /***/ (function(module, exports, __webpack_require__) {
  19471. "use strict";
  19472. /**
  19473. * Copyright (c) 2013-present, Facebook, Inc.
  19474. * All rights reserved.
  19475. *
  19476. * This source code is licensed under the BSD-style license found in the
  19477. * LICENSE file in the root directory of this source tree. An additional grant
  19478. * of patent rights can be found in the PATENTS file in the same directory.
  19479. *
  19480. *
  19481. * @typechecks static-only
  19482. */
  19483. /**
  19484. * Memoizes the return value of a function that accepts one string argument.
  19485. */
  19486. function memoizeStringOnly(callback) {
  19487. var cache = {};
  19488. return function (string) {
  19489. if (!cache.hasOwnProperty(string)) {
  19490. cache[string] = callback.call(this, string);
  19491. }
  19492. return cache[string];
  19493. };
  19494. }
  19495. module.exports = memoizeStringOnly;
  19496. /***/ }),
  19497. /* 141 */
  19498. /***/ (function(module, exports, __webpack_require__) {
  19499. "use strict";
  19500. /**
  19501. * Copyright 2013-present, Facebook, Inc.
  19502. * All rights reserved.
  19503. *
  19504. * This source code is licensed under the BSD-style license found in the
  19505. * LICENSE file in the root directory of this source tree. An additional grant
  19506. * of patent rights can be found in the PATENTS file in the same directory.
  19507. *
  19508. */
  19509. var ARIADOMPropertyConfig = {
  19510. Properties: {
  19511. // Global States and Properties
  19512. 'aria-current': 0, // state
  19513. 'aria-details': 0,
  19514. 'aria-disabled': 0, // state
  19515. 'aria-hidden': 0, // state
  19516. 'aria-invalid': 0, // state
  19517. 'aria-keyshortcuts': 0,
  19518. 'aria-label': 0,
  19519. 'aria-roledescription': 0,
  19520. // Widget Attributes
  19521. 'aria-autocomplete': 0,
  19522. 'aria-checked': 0,
  19523. 'aria-expanded': 0,
  19524. 'aria-haspopup': 0,
  19525. 'aria-level': 0,
  19526. 'aria-modal': 0,
  19527. 'aria-multiline': 0,
  19528. 'aria-multiselectable': 0,
  19529. 'aria-orientation': 0,
  19530. 'aria-placeholder': 0,
  19531. 'aria-pressed': 0,
  19532. 'aria-readonly': 0,
  19533. 'aria-required': 0,
  19534. 'aria-selected': 0,
  19535. 'aria-sort': 0,
  19536. 'aria-valuemax': 0,
  19537. 'aria-valuemin': 0,
  19538. 'aria-valuenow': 0,
  19539. 'aria-valuetext': 0,
  19540. // Live Region Attributes
  19541. 'aria-atomic': 0,
  19542. 'aria-busy': 0,
  19543. 'aria-live': 0,
  19544. 'aria-relevant': 0,
  19545. // Drag-and-Drop Attributes
  19546. 'aria-dropeffect': 0,
  19547. 'aria-grabbed': 0,
  19548. // Relationship Attributes
  19549. 'aria-activedescendant': 0,
  19550. 'aria-colcount': 0,
  19551. 'aria-colindex': 0,
  19552. 'aria-colspan': 0,
  19553. 'aria-controls': 0,
  19554. 'aria-describedby': 0,
  19555. 'aria-errormessage': 0,
  19556. 'aria-flowto': 0,
  19557. 'aria-labelledby': 0,
  19558. 'aria-owns': 0,
  19559. 'aria-posinset': 0,
  19560. 'aria-rowcount': 0,
  19561. 'aria-rowindex': 0,
  19562. 'aria-rowspan': 0,
  19563. 'aria-setsize': 0
  19564. },
  19565. DOMAttributeNames: {},
  19566. DOMPropertyNames: {}
  19567. };
  19568. module.exports = ARIADOMPropertyConfig;
  19569. /***/ }),
  19570. /* 142 */
  19571. /***/ (function(module, exports, __webpack_require__) {
  19572. "use strict";
  19573. /**
  19574. * Copyright 2013-present, Facebook, Inc.
  19575. * All rights reserved.
  19576. *
  19577. * This source code is licensed under the BSD-style license found in the
  19578. * LICENSE file in the root directory of this source tree. An additional grant
  19579. * of patent rights can be found in the PATENTS file in the same directory.
  19580. *
  19581. */
  19582. var ReactDOMComponentTree = __webpack_require__(4);
  19583. var focusNode = __webpack_require__(56);
  19584. var AutoFocusUtils = {
  19585. focusDOMComponent: function () {
  19586. focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
  19587. }
  19588. };
  19589. module.exports = AutoFocusUtils;
  19590. /***/ }),
  19591. /* 143 */
  19592. /***/ (function(module, exports, __webpack_require__) {
  19593. "use strict";
  19594. /**
  19595. * Copyright 2013-present Facebook, Inc.
  19596. * All rights reserved.
  19597. *
  19598. * This source code is licensed under the BSD-style license found in the
  19599. * LICENSE file in the root directory of this source tree. An additional grant
  19600. * of patent rights can be found in the PATENTS file in the same directory.
  19601. *
  19602. */
  19603. var EventPropagators = __webpack_require__(25);
  19604. var ExecutionEnvironment = __webpack_require__(5);
  19605. var FallbackCompositionState = __webpack_require__(149);
  19606. var SyntheticCompositionEvent = __webpack_require__(186);
  19607. var SyntheticInputEvent = __webpack_require__(189);
  19608. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  19609. var START_KEYCODE = 229;
  19610. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  19611. var documentMode = null;
  19612. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  19613. documentMode = document.documentMode;
  19614. }
  19615. // Webkit offers a very useful `textInput` event that can be used to
  19616. // directly represent `beforeInput`. The IE `textinput` event is not as
  19617. // useful, so we don't use it.
  19618. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  19619. // In IE9+, we have access to composition events, but the data supplied
  19620. // by the native compositionend event may be incorrect. Japanese ideographic
  19621. // spaces, for instance (\u3000) are not recorded correctly.
  19622. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  19623. /**
  19624. * Opera <= 12 includes TextEvent in window, but does not fire
  19625. * text input events. Rely on keypress instead.
  19626. */
  19627. function isPresto() {
  19628. var opera = window.opera;
  19629. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  19630. }
  19631. var SPACEBAR_CODE = 32;
  19632. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  19633. // Events and their corresponding property names.
  19634. var eventTypes = {
  19635. beforeInput: {
  19636. phasedRegistrationNames: {
  19637. bubbled: 'onBeforeInput',
  19638. captured: 'onBeforeInputCapture'
  19639. },
  19640. dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
  19641. },
  19642. compositionEnd: {
  19643. phasedRegistrationNames: {
  19644. bubbled: 'onCompositionEnd',
  19645. captured: 'onCompositionEndCapture'
  19646. },
  19647. dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  19648. },
  19649. compositionStart: {
  19650. phasedRegistrationNames: {
  19651. bubbled: 'onCompositionStart',
  19652. captured: 'onCompositionStartCapture'
  19653. },
  19654. dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  19655. },
  19656. compositionUpdate: {
  19657. phasedRegistrationNames: {
  19658. bubbled: 'onCompositionUpdate',
  19659. captured: 'onCompositionUpdateCapture'
  19660. },
  19661. dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  19662. }
  19663. };
  19664. // Track whether we've ever handled a keypress on the space key.
  19665. var hasSpaceKeypress = false;
  19666. /**
  19667. * Return whether a native keypress event is assumed to be a command.
  19668. * This is required because Firefox fires `keypress` events for key commands
  19669. * (cut, copy, select-all, etc.) even though no character is inserted.
  19670. */
  19671. function isKeypressCommand(nativeEvent) {
  19672. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  19673. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  19674. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  19675. }
  19676. /**
  19677. * Translate native top level events into event types.
  19678. *
  19679. * @param {string} topLevelType
  19680. * @return {object}
  19681. */
  19682. function getCompositionEventType(topLevelType) {
  19683. switch (topLevelType) {
  19684. case 'topCompositionStart':
  19685. return eventTypes.compositionStart;
  19686. case 'topCompositionEnd':
  19687. return eventTypes.compositionEnd;
  19688. case 'topCompositionUpdate':
  19689. return eventTypes.compositionUpdate;
  19690. }
  19691. }
  19692. /**
  19693. * Does our fallback best-guess model think this event signifies that
  19694. * composition has begun?
  19695. *
  19696. * @param {string} topLevelType
  19697. * @param {object} nativeEvent
  19698. * @return {boolean}
  19699. */
  19700. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  19701. return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
  19702. }
  19703. /**
  19704. * Does our fallback mode think that this event is the end of composition?
  19705. *
  19706. * @param {string} topLevelType
  19707. * @param {object} nativeEvent
  19708. * @return {boolean}
  19709. */
  19710. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  19711. switch (topLevelType) {
  19712. case 'topKeyUp':
  19713. // Command keys insert or clear IME input.
  19714. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  19715. case 'topKeyDown':
  19716. // Expect IME keyCode on each keydown. If we get any other
  19717. // code we must have exited earlier.
  19718. return nativeEvent.keyCode !== START_KEYCODE;
  19719. case 'topKeyPress':
  19720. case 'topMouseDown':
  19721. case 'topBlur':
  19722. // Events are not possible without cancelling IME.
  19723. return true;
  19724. default:
  19725. return false;
  19726. }
  19727. }
  19728. /**
  19729. * Google Input Tools provides composition data via a CustomEvent,
  19730. * with the `data` property populated in the `detail` object. If this
  19731. * is available on the event object, use it. If not, this is a plain
  19732. * composition event and we have nothing special to extract.
  19733. *
  19734. * @param {object} nativeEvent
  19735. * @return {?string}
  19736. */
  19737. function getDataFromCustomEvent(nativeEvent) {
  19738. var detail = nativeEvent.detail;
  19739. if (typeof detail === 'object' && 'data' in detail) {
  19740. return detail.data;
  19741. }
  19742. return null;
  19743. }
  19744. // Track the current IME composition fallback object, if any.
  19745. var currentComposition = null;
  19746. /**
  19747. * @return {?object} A SyntheticCompositionEvent.
  19748. */
  19749. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  19750. var eventType;
  19751. var fallbackData;
  19752. if (canUseCompositionEvent) {
  19753. eventType = getCompositionEventType(topLevelType);
  19754. } else if (!currentComposition) {
  19755. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  19756. eventType = eventTypes.compositionStart;
  19757. }
  19758. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  19759. eventType = eventTypes.compositionEnd;
  19760. }
  19761. if (!eventType) {
  19762. return null;
  19763. }
  19764. if (useFallbackCompositionData) {
  19765. // The current composition is stored statically and must not be
  19766. // overwritten while composition continues.
  19767. if (!currentComposition && eventType === eventTypes.compositionStart) {
  19768. currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
  19769. } else if (eventType === eventTypes.compositionEnd) {
  19770. if (currentComposition) {
  19771. fallbackData = currentComposition.getData();
  19772. }
  19773. }
  19774. }
  19775. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  19776. if (fallbackData) {
  19777. // Inject data generated from fallback path into the synthetic event.
  19778. // This matches the property of native CompositionEventInterface.
  19779. event.data = fallbackData;
  19780. } else {
  19781. var customData = getDataFromCustomEvent(nativeEvent);
  19782. if (customData !== null) {
  19783. event.data = customData;
  19784. }
  19785. }
  19786. EventPropagators.accumulateTwoPhaseDispatches(event);
  19787. return event;
  19788. }
  19789. /**
  19790. * @param {string} topLevelType Record from `EventConstants`.
  19791. * @param {object} nativeEvent Native browser event.
  19792. * @return {?string} The string corresponding to this `beforeInput` event.
  19793. */
  19794. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  19795. switch (topLevelType) {
  19796. case 'topCompositionEnd':
  19797. return getDataFromCustomEvent(nativeEvent);
  19798. case 'topKeyPress':
  19799. /**
  19800. * If native `textInput` events are available, our goal is to make
  19801. * use of them. However, there is a special case: the spacebar key.
  19802. * In Webkit, preventing default on a spacebar `textInput` event
  19803. * cancels character insertion, but it *also* causes the browser
  19804. * to fall back to its default spacebar behavior of scrolling the
  19805. * page.
  19806. *
  19807. * Tracking at:
  19808. * https://code.google.com/p/chromium/issues/detail?id=355103
  19809. *
  19810. * To avoid this issue, use the keypress event as if no `textInput`
  19811. * event is available.
  19812. */
  19813. var which = nativeEvent.which;
  19814. if (which !== SPACEBAR_CODE) {
  19815. return null;
  19816. }
  19817. hasSpaceKeypress = true;
  19818. return SPACEBAR_CHAR;
  19819. case 'topTextInput':
  19820. // Record the characters to be added to the DOM.
  19821. var chars = nativeEvent.data;
  19822. // If it's a spacebar character, assume that we have already handled
  19823. // it at the keypress level and bail immediately. Android Chrome
  19824. // doesn't give us keycodes, so we need to blacklist it.
  19825. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  19826. return null;
  19827. }
  19828. return chars;
  19829. default:
  19830. // For other native event types, do nothing.
  19831. return null;
  19832. }
  19833. }
  19834. /**
  19835. * For browsers that do not provide the `textInput` event, extract the
  19836. * appropriate string to use for SyntheticInputEvent.
  19837. *
  19838. * @param {string} topLevelType Record from `EventConstants`.
  19839. * @param {object} nativeEvent Native browser event.
  19840. * @return {?string} The fallback string for this `beforeInput` event.
  19841. */
  19842. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  19843. // If we are currently composing (IME) and using a fallback to do so,
  19844. // try to extract the composed characters from the fallback object.
  19845. // If composition event is available, we extract a string only at
  19846. // compositionevent, otherwise extract it at fallback events.
  19847. if (currentComposition) {
  19848. if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  19849. var chars = currentComposition.getData();
  19850. FallbackCompositionState.release(currentComposition);
  19851. currentComposition = null;
  19852. return chars;
  19853. }
  19854. return null;
  19855. }
  19856. switch (topLevelType) {
  19857. case 'topPaste':
  19858. // If a paste event occurs after a keypress, throw out the input
  19859. // chars. Paste events should not lead to BeforeInput events.
  19860. return null;
  19861. case 'topKeyPress':
  19862. /**
  19863. * As of v27, Firefox may fire keypress events even when no character
  19864. * will be inserted. A few possibilities:
  19865. *
  19866. * - `which` is `0`. Arrow keys, Esc key, etc.
  19867. *
  19868. * - `which` is the pressed key code, but no char is available.
  19869. * Ex: 'AltGr + d` in Polish. There is no modified character for
  19870. * this key combination and no character is inserted into the
  19871. * document, but FF fires the keypress for char code `100` anyway.
  19872. * No `input` event will occur.
  19873. *
  19874. * - `which` is the pressed key code, but a command combination is
  19875. * being used. Ex: `Cmd+C`. No character is inserted, and no
  19876. * `input` event will occur.
  19877. */
  19878. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  19879. return String.fromCharCode(nativeEvent.which);
  19880. }
  19881. return null;
  19882. case 'topCompositionEnd':
  19883. return useFallbackCompositionData ? null : nativeEvent.data;
  19884. default:
  19885. return null;
  19886. }
  19887. }
  19888. /**
  19889. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  19890. * `textInput` or fallback behavior.
  19891. *
  19892. * @return {?object} A SyntheticInputEvent.
  19893. */
  19894. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  19895. var chars;
  19896. if (canUseTextInputEvent) {
  19897. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  19898. } else {
  19899. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  19900. }
  19901. // If no characters are being inserted, no BeforeInput event should
  19902. // be fired.
  19903. if (!chars) {
  19904. return null;
  19905. }
  19906. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  19907. event.data = chars;
  19908. EventPropagators.accumulateTwoPhaseDispatches(event);
  19909. return event;
  19910. }
  19911. /**
  19912. * Create an `onBeforeInput` event to match
  19913. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  19914. *
  19915. * This event plugin is based on the native `textInput` event
  19916. * available in Chrome, Safari, Opera, and IE. This event fires after
  19917. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  19918. *
  19919. * `beforeInput` is spec'd but not implemented in any browsers, and
  19920. * the `input` event does not provide any useful information about what has
  19921. * actually been added, contrary to the spec. Thus, `textInput` is the best
  19922. * available event to identify the characters that have actually been inserted
  19923. * into the target node.
  19924. *
  19925. * This plugin is also responsible for emitting `composition` events, thus
  19926. * allowing us to share composition fallback code for both `beforeInput` and
  19927. * `composition` event types.
  19928. */
  19929. var BeforeInputEventPlugin = {
  19930. eventTypes: eventTypes,
  19931. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  19932. return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
  19933. }
  19934. };
  19935. module.exports = BeforeInputEventPlugin;
  19936. /***/ }),
  19937. /* 144 */
  19938. /***/ (function(module, exports, __webpack_require__) {
  19939. "use strict";
  19940. /**
  19941. * Copyright 2013-present, Facebook, Inc.
  19942. * All rights reserved.
  19943. *
  19944. * This source code is licensed under the BSD-style license found in the
  19945. * LICENSE file in the root directory of this source tree. An additional grant
  19946. * of patent rights can be found in the PATENTS file in the same directory.
  19947. *
  19948. */
  19949. var CSSProperty = __webpack_require__(58);
  19950. var ExecutionEnvironment = __webpack_require__(5);
  19951. var ReactInstrumentation = __webpack_require__(10);
  19952. var camelizeStyleName = __webpack_require__(130);
  19953. var dangerousStyleValue = __webpack_require__(195);
  19954. var hyphenateStyleName = __webpack_require__(137);
  19955. var memoizeStringOnly = __webpack_require__(140);
  19956. var warning = __webpack_require__(1);
  19957. var processStyleName = memoizeStringOnly(function (styleName) {
  19958. return hyphenateStyleName(styleName);
  19959. });
  19960. var hasShorthandPropertyBug = false;
  19961. var styleFloatAccessor = 'cssFloat';
  19962. if (ExecutionEnvironment.canUseDOM) {
  19963. var tempStyle = document.createElement('div').style;
  19964. try {
  19965. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  19966. tempStyle.font = '';
  19967. } catch (e) {
  19968. hasShorthandPropertyBug = true;
  19969. }
  19970. // IE8 only supports accessing cssFloat (standard) as styleFloat
  19971. if (document.documentElement.style.cssFloat === undefined) {
  19972. styleFloatAccessor = 'styleFloat';
  19973. }
  19974. }
  19975. if (false) {
  19976. // 'msTransform' is correct, but the other prefixes should be capitalized
  19977. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  19978. // style values shouldn't contain a semicolon
  19979. var badStyleValueWithSemicolonPattern = /;\s*$/;
  19980. var warnedStyleNames = {};
  19981. var warnedStyleValues = {};
  19982. var warnedForNaNValue = false;
  19983. var warnHyphenatedStyleName = function (name, owner) {
  19984. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  19985. return;
  19986. }
  19987. warnedStyleNames[name] = true;
  19988. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
  19989. };
  19990. var warnBadVendoredStyleName = function (name, owner) {
  19991. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  19992. return;
  19993. }
  19994. warnedStyleNames[name] = true;
  19995. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
  19996. };
  19997. var warnStyleValueWithSemicolon = function (name, value, owner) {
  19998. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  19999. return;
  20000. }
  20001. warnedStyleValues[value] = true;
  20002. process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
  20003. };
  20004. var warnStyleValueIsNaN = function (name, value, owner) {
  20005. if (warnedForNaNValue) {
  20006. return;
  20007. }
  20008. warnedForNaNValue = true;
  20009. process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
  20010. };
  20011. var checkRenderMessage = function (owner) {
  20012. if (owner) {
  20013. var name = owner.getName();
  20014. if (name) {
  20015. return ' Check the render method of `' + name + '`.';
  20016. }
  20017. }
  20018. return '';
  20019. };
  20020. /**
  20021. * @param {string} name
  20022. * @param {*} value
  20023. * @param {ReactDOMComponent} component
  20024. */
  20025. var warnValidStyle = function (name, value, component) {
  20026. var owner;
  20027. if (component) {
  20028. owner = component._currentElement._owner;
  20029. }
  20030. if (name.indexOf('-') > -1) {
  20031. warnHyphenatedStyleName(name, owner);
  20032. } else if (badVendoredStyleNamePattern.test(name)) {
  20033. warnBadVendoredStyleName(name, owner);
  20034. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  20035. warnStyleValueWithSemicolon(name, value, owner);
  20036. }
  20037. if (typeof value === 'number' && isNaN(value)) {
  20038. warnStyleValueIsNaN(name, value, owner);
  20039. }
  20040. };
  20041. }
  20042. /**
  20043. * Operations for dealing with CSS properties.
  20044. */
  20045. var CSSPropertyOperations = {
  20046. /**
  20047. * Serializes a mapping of style properties for use as inline styles:
  20048. *
  20049. * > createMarkupForStyles({width: '200px', height: 0})
  20050. * "width:200px;height:0;"
  20051. *
  20052. * Undefined values are ignored so that declarative programming is easier.
  20053. * The result should be HTML-escaped before insertion into the DOM.
  20054. *
  20055. * @param {object} styles
  20056. * @param {ReactDOMComponent} component
  20057. * @return {?string}
  20058. */
  20059. createMarkupForStyles: function (styles, component) {
  20060. var serialized = '';
  20061. for (var styleName in styles) {
  20062. if (!styles.hasOwnProperty(styleName)) {
  20063. continue;
  20064. }
  20065. var styleValue = styles[styleName];
  20066. if (false) {
  20067. warnValidStyle(styleName, styleValue, component);
  20068. }
  20069. if (styleValue != null) {
  20070. serialized += processStyleName(styleName) + ':';
  20071. serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
  20072. }
  20073. }
  20074. return serialized || null;
  20075. },
  20076. /**
  20077. * Sets the value for multiple styles on a node. If a value is specified as
  20078. * '' (empty string), the corresponding style property will be unset.
  20079. *
  20080. * @param {DOMElement} node
  20081. * @param {object} styles
  20082. * @param {ReactDOMComponent} component
  20083. */
  20084. setValueForStyles: function (node, styles, component) {
  20085. if (false) {
  20086. ReactInstrumentation.debugTool.onHostOperation({
  20087. instanceID: component._debugID,
  20088. type: 'update styles',
  20089. payload: styles
  20090. });
  20091. }
  20092. var style = node.style;
  20093. for (var styleName in styles) {
  20094. if (!styles.hasOwnProperty(styleName)) {
  20095. continue;
  20096. }
  20097. if (false) {
  20098. warnValidStyle(styleName, styles[styleName], component);
  20099. }
  20100. var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
  20101. if (styleName === 'float' || styleName === 'cssFloat') {
  20102. styleName = styleFloatAccessor;
  20103. }
  20104. if (styleValue) {
  20105. style[styleName] = styleValue;
  20106. } else {
  20107. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  20108. if (expansion) {
  20109. // Shorthand property that IE8 won't like unsetting, so unset each
  20110. // component to placate it
  20111. for (var individualStyleName in expansion) {
  20112. style[individualStyleName] = '';
  20113. }
  20114. } else {
  20115. style[styleName] = '';
  20116. }
  20117. }
  20118. }
  20119. }
  20120. };
  20121. module.exports = CSSPropertyOperations;
  20122. /***/ }),
  20123. /* 145 */
  20124. /***/ (function(module, exports, __webpack_require__) {
  20125. "use strict";
  20126. /**
  20127. * Copyright 2013-present, Facebook, Inc.
  20128. * All rights reserved.
  20129. *
  20130. * This source code is licensed under the BSD-style license found in the
  20131. * LICENSE file in the root directory of this source tree. An additional grant
  20132. * of patent rights can be found in the PATENTS file in the same directory.
  20133. *
  20134. */
  20135. var EventPluginHub = __webpack_require__(24);
  20136. var EventPropagators = __webpack_require__(25);
  20137. var ExecutionEnvironment = __webpack_require__(5);
  20138. var ReactDOMComponentTree = __webpack_require__(4);
  20139. var ReactUpdates = __webpack_require__(11);
  20140. var SyntheticEvent = __webpack_require__(12);
  20141. var getEventTarget = __webpack_require__(47);
  20142. var isEventSupported = __webpack_require__(48);
  20143. var isTextInputElement = __webpack_require__(75);
  20144. var eventTypes = {
  20145. change: {
  20146. phasedRegistrationNames: {
  20147. bubbled: 'onChange',
  20148. captured: 'onChangeCapture'
  20149. },
  20150. dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
  20151. }
  20152. };
  20153. /**
  20154. * For IE shims
  20155. */
  20156. var activeElement = null;
  20157. var activeElementInst = null;
  20158. var activeElementValue = null;
  20159. var activeElementValueProp = null;
  20160. /**
  20161. * SECTION: handle `change` event
  20162. */
  20163. function shouldUseChangeEvent(elem) {
  20164. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  20165. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  20166. }
  20167. var doesChangeEventBubble = false;
  20168. if (ExecutionEnvironment.canUseDOM) {
  20169. // See `handleChange` comment below
  20170. doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
  20171. }
  20172. function manualDispatchChangeEvent(nativeEvent) {
  20173. var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
  20174. EventPropagators.accumulateTwoPhaseDispatches(event);
  20175. // If change and propertychange bubbled, we'd just bind to it like all the
  20176. // other events and have it go through ReactBrowserEventEmitter. Since it
  20177. // doesn't, we manually listen for the events and so we have to enqueue and
  20178. // process the abstract event manually.
  20179. //
  20180. // Batching is necessary here in order to ensure that all event handlers run
  20181. // before the next rerender (including event handlers attached to ancestor
  20182. // elements instead of directly on the input). Without this, controlled
  20183. // components don't work properly in conjunction with event bubbling because
  20184. // the component is rerendered and the value reverted before all the event
  20185. // handlers can run. See https://github.com/facebook/react/issues/708.
  20186. ReactUpdates.batchedUpdates(runEventInBatch, event);
  20187. }
  20188. function runEventInBatch(event) {
  20189. EventPluginHub.enqueueEvents(event);
  20190. EventPluginHub.processEventQueue(false);
  20191. }
  20192. function startWatchingForChangeEventIE8(target, targetInst) {
  20193. activeElement = target;
  20194. activeElementInst = targetInst;
  20195. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  20196. }
  20197. function stopWatchingForChangeEventIE8() {
  20198. if (!activeElement) {
  20199. return;
  20200. }
  20201. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  20202. activeElement = null;
  20203. activeElementInst = null;
  20204. }
  20205. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  20206. if (topLevelType === 'topChange') {
  20207. return targetInst;
  20208. }
  20209. }
  20210. function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
  20211. if (topLevelType === 'topFocus') {
  20212. // stopWatching() should be a noop here but we call it just in case we
  20213. // missed a blur event somehow.
  20214. stopWatchingForChangeEventIE8();
  20215. startWatchingForChangeEventIE8(target, targetInst);
  20216. } else if (topLevelType === 'topBlur') {
  20217. stopWatchingForChangeEventIE8();
  20218. }
  20219. }
  20220. /**
  20221. * SECTION: handle `input` event
  20222. */
  20223. var isInputEventSupported = false;
  20224. if (ExecutionEnvironment.canUseDOM) {
  20225. // IE9 claims to support the input event but fails to trigger it when
  20226. // deleting text, so we ignore its input events.
  20227. // IE10+ fire input events to often, such when a placeholder
  20228. // changes or when an input with a placeholder is focused.
  20229. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
  20230. }
  20231. /**
  20232. * (For IE <=11) Replacement getter/setter for the `value` property that gets
  20233. * set on the active element.
  20234. */
  20235. var newValueProp = {
  20236. get: function () {
  20237. return activeElementValueProp.get.call(this);
  20238. },
  20239. set: function (val) {
  20240. // Cast to a string so we can do equality checks.
  20241. activeElementValue = '' + val;
  20242. activeElementValueProp.set.call(this, val);
  20243. }
  20244. };
  20245. /**
  20246. * (For IE <=11) Starts tracking propertychange events on the passed-in element
  20247. * and override the value property so that we can distinguish user events from
  20248. * value changes in JS.
  20249. */
  20250. function startWatchingForValueChange(target, targetInst) {
  20251. activeElement = target;
  20252. activeElementInst = targetInst;
  20253. activeElementValue = target.value;
  20254. activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
  20255. // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
  20256. // on DOM elements
  20257. Object.defineProperty(activeElement, 'value', newValueProp);
  20258. if (activeElement.attachEvent) {
  20259. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  20260. } else {
  20261. activeElement.addEventListener('propertychange', handlePropertyChange, false);
  20262. }
  20263. }
  20264. /**
  20265. * (For IE <=11) Removes the event listeners from the currently-tracked element,
  20266. * if any exists.
  20267. */
  20268. function stopWatchingForValueChange() {
  20269. if (!activeElement) {
  20270. return;
  20271. }
  20272. // delete restores the original property definition
  20273. delete activeElement.value;
  20274. if (activeElement.detachEvent) {
  20275. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  20276. } else {
  20277. activeElement.removeEventListener('propertychange', handlePropertyChange, false);
  20278. }
  20279. activeElement = null;
  20280. activeElementInst = null;
  20281. activeElementValue = null;
  20282. activeElementValueProp = null;
  20283. }
  20284. /**
  20285. * (For IE <=11) Handles a propertychange event, sending a `change` event if
  20286. * the value of the active element has changed.
  20287. */
  20288. function handlePropertyChange(nativeEvent) {
  20289. if (nativeEvent.propertyName !== 'value') {
  20290. return;
  20291. }
  20292. var value = nativeEvent.srcElement.value;
  20293. if (value === activeElementValue) {
  20294. return;
  20295. }
  20296. activeElementValue = value;
  20297. manualDispatchChangeEvent(nativeEvent);
  20298. }
  20299. /**
  20300. * If a `change` event should be fired, returns the target's ID.
  20301. */
  20302. function getTargetInstForInputEvent(topLevelType, targetInst) {
  20303. if (topLevelType === 'topInput') {
  20304. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  20305. // what we want so fall through here and trigger an abstract event
  20306. return targetInst;
  20307. }
  20308. }
  20309. function handleEventsForInputEventIE(topLevelType, target, targetInst) {
  20310. if (topLevelType === 'topFocus') {
  20311. // In IE8, we can capture almost all .value changes by adding a
  20312. // propertychange handler and looking for events with propertyName
  20313. // equal to 'value'
  20314. // In IE9-11, propertychange fires for most input events but is buggy and
  20315. // doesn't fire when text is deleted, but conveniently, selectionchange
  20316. // appears to fire in all of the remaining cases so we catch those and
  20317. // forward the event if the value has changed
  20318. // In either case, we don't want to call the event handler if the value
  20319. // is changed from JS so we redefine a setter for `.value` that updates
  20320. // our activeElementValue variable, allowing us to ignore those changes
  20321. //
  20322. // stopWatching() should be a noop here but we call it just in case we
  20323. // missed a blur event somehow.
  20324. stopWatchingForValueChange();
  20325. startWatchingForValueChange(target, targetInst);
  20326. } else if (topLevelType === 'topBlur') {
  20327. stopWatchingForValueChange();
  20328. }
  20329. }
  20330. // For IE8 and IE9.
  20331. function getTargetInstForInputEventIE(topLevelType, targetInst) {
  20332. if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
  20333. // On the selectionchange event, the target is just document which isn't
  20334. // helpful for us so just check activeElement instead.
  20335. //
  20336. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  20337. // propertychange on the first input event after setting `value` from a
  20338. // script and fires only keydown, keypress, keyup. Catching keyup usually
  20339. // gets it and catching keydown lets us fire an event for the first
  20340. // keystroke if user does a key repeat (it'll be a little delayed: right
  20341. // before the second keystroke). Other input methods (e.g., paste) seem to
  20342. // fire selectionchange normally.
  20343. if (activeElement && activeElement.value !== activeElementValue) {
  20344. activeElementValue = activeElement.value;
  20345. return activeElementInst;
  20346. }
  20347. }
  20348. }
  20349. /**
  20350. * SECTION: handle `click` event
  20351. */
  20352. function shouldUseClickEvent(elem) {
  20353. // Use the `click` event to detect changes to checkbox and radio inputs.
  20354. // This approach works across all browsers, whereas `change` does not fire
  20355. // until `blur` in IE8.
  20356. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  20357. }
  20358. function getTargetInstForClickEvent(topLevelType, targetInst) {
  20359. if (topLevelType === 'topClick') {
  20360. return targetInst;
  20361. }
  20362. }
  20363. /**
  20364. * This plugin creates an `onChange` event that normalizes change events
  20365. * across form elements. This event fires at a time when it's possible to
  20366. * change the element's value without seeing a flicker.
  20367. *
  20368. * Supported elements are:
  20369. * - input (see `isTextInputElement`)
  20370. * - textarea
  20371. * - select
  20372. */
  20373. var ChangeEventPlugin = {
  20374. eventTypes: eventTypes,
  20375. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  20376. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  20377. var getTargetInstFunc, handleEventFunc;
  20378. if (shouldUseChangeEvent(targetNode)) {
  20379. if (doesChangeEventBubble) {
  20380. getTargetInstFunc = getTargetInstForChangeEvent;
  20381. } else {
  20382. handleEventFunc = handleEventsForChangeEventIE8;
  20383. }
  20384. } else if (isTextInputElement(targetNode)) {
  20385. if (isInputEventSupported) {
  20386. getTargetInstFunc = getTargetInstForInputEvent;
  20387. } else {
  20388. getTargetInstFunc = getTargetInstForInputEventIE;
  20389. handleEventFunc = handleEventsForInputEventIE;
  20390. }
  20391. } else if (shouldUseClickEvent(targetNode)) {
  20392. getTargetInstFunc = getTargetInstForClickEvent;
  20393. }
  20394. if (getTargetInstFunc) {
  20395. var inst = getTargetInstFunc(topLevelType, targetInst);
  20396. if (inst) {
  20397. var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
  20398. event.type = 'change';
  20399. EventPropagators.accumulateTwoPhaseDispatches(event);
  20400. return event;
  20401. }
  20402. }
  20403. if (handleEventFunc) {
  20404. handleEventFunc(topLevelType, targetNode, targetInst);
  20405. }
  20406. }
  20407. };
  20408. module.exports = ChangeEventPlugin;
  20409. /***/ }),
  20410. /* 146 */
  20411. /***/ (function(module, exports, __webpack_require__) {
  20412. "use strict";
  20413. /**
  20414. * Copyright 2013-present, Facebook, Inc.
  20415. * All rights reserved.
  20416. *
  20417. * This source code is licensed under the BSD-style license found in the
  20418. * LICENSE file in the root directory of this source tree. An additional grant
  20419. * of patent rights can be found in the PATENTS file in the same directory.
  20420. *
  20421. */
  20422. var _prodInvariant = __webpack_require__(2);
  20423. var DOMLazyTree = __webpack_require__(17);
  20424. var ExecutionEnvironment = __webpack_require__(5);
  20425. var createNodesFromMarkup = __webpack_require__(133);
  20426. var emptyFunction = __webpack_require__(9);
  20427. var invariant = __webpack_require__(0);
  20428. var Danger = {
  20429. /**
  20430. * Replaces a node with a string of markup at its current position within its
  20431. * parent. The markup must render into a single root node.
  20432. *
  20433. * @param {DOMElement} oldChild Child node to replace.
  20434. * @param {string} markup Markup to render in place of the child node.
  20435. * @internal
  20436. */
  20437. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  20438. !ExecutionEnvironment.canUseDOM ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0;
  20439. !markup ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
  20440. !(oldChild.nodeName !== 'HTML') ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0;
  20441. if (typeof markup === 'string') {
  20442. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  20443. oldChild.parentNode.replaceChild(newChild, oldChild);
  20444. } else {
  20445. DOMLazyTree.replaceChildWithTree(oldChild, markup);
  20446. }
  20447. }
  20448. };
  20449. module.exports = Danger;
  20450. /***/ }),
  20451. /* 147 */
  20452. /***/ (function(module, exports, __webpack_require__) {
  20453. "use strict";
  20454. /**
  20455. * Copyright 2013-present, Facebook, Inc.
  20456. * All rights reserved.
  20457. *
  20458. * This source code is licensed under the BSD-style license found in the
  20459. * LICENSE file in the root directory of this source tree. An additional grant
  20460. * of patent rights can be found in the PATENTS file in the same directory.
  20461. *
  20462. */
  20463. /**
  20464. * Module that is injectable into `EventPluginHub`, that specifies a
  20465. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  20466. * plugins, without having to package every one of them. This is better than
  20467. * having plugins be ordered in the same order that they are injected because
  20468. * that ordering would be influenced by the packaging order.
  20469. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  20470. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  20471. */
  20472. var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  20473. module.exports = DefaultEventPluginOrder;
  20474. /***/ }),
  20475. /* 148 */
  20476. /***/ (function(module, exports, __webpack_require__) {
  20477. "use strict";
  20478. /**
  20479. * Copyright 2013-present, Facebook, Inc.
  20480. * All rights reserved.
  20481. *
  20482. * This source code is licensed under the BSD-style license found in the
  20483. * LICENSE file in the root directory of this source tree. An additional grant
  20484. * of patent rights can be found in the PATENTS file in the same directory.
  20485. *
  20486. */
  20487. var EventPropagators = __webpack_require__(25);
  20488. var ReactDOMComponentTree = __webpack_require__(4);
  20489. var SyntheticMouseEvent = __webpack_require__(29);
  20490. var eventTypes = {
  20491. mouseEnter: {
  20492. registrationName: 'onMouseEnter',
  20493. dependencies: ['topMouseOut', 'topMouseOver']
  20494. },
  20495. mouseLeave: {
  20496. registrationName: 'onMouseLeave',
  20497. dependencies: ['topMouseOut', 'topMouseOver']
  20498. }
  20499. };
  20500. var EnterLeaveEventPlugin = {
  20501. eventTypes: eventTypes,
  20502. /**
  20503. * For almost every interaction we care about, there will be both a top-level
  20504. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  20505. * we do not extract duplicate events. However, moving the mouse into the
  20506. * browser from outside will not fire a `mouseout` event. In this case, we use
  20507. * the `mouseover` top-level event.
  20508. */
  20509. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  20510. if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  20511. return null;
  20512. }
  20513. if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
  20514. // Must not be a mouse in or mouse out - ignoring.
  20515. return null;
  20516. }
  20517. var win;
  20518. if (nativeEventTarget.window === nativeEventTarget) {
  20519. // `nativeEventTarget` is probably a window object.
  20520. win = nativeEventTarget;
  20521. } else {
  20522. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  20523. var doc = nativeEventTarget.ownerDocument;
  20524. if (doc) {
  20525. win = doc.defaultView || doc.parentWindow;
  20526. } else {
  20527. win = window;
  20528. }
  20529. }
  20530. var from;
  20531. var to;
  20532. if (topLevelType === 'topMouseOut') {
  20533. from = targetInst;
  20534. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  20535. to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
  20536. } else {
  20537. // Moving to a node from outside the window.
  20538. from = null;
  20539. to = targetInst;
  20540. }
  20541. if (from === to) {
  20542. // Nothing pertains to our managed components.
  20543. return null;
  20544. }
  20545. var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
  20546. var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
  20547. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
  20548. leave.type = 'mouseleave';
  20549. leave.target = fromNode;
  20550. leave.relatedTarget = toNode;
  20551. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
  20552. enter.type = 'mouseenter';
  20553. enter.target = toNode;
  20554. enter.relatedTarget = fromNode;
  20555. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
  20556. return [leave, enter];
  20557. }
  20558. };
  20559. module.exports = EnterLeaveEventPlugin;
  20560. /***/ }),
  20561. /* 149 */
  20562. /***/ (function(module, exports, __webpack_require__) {
  20563. "use strict";
  20564. /**
  20565. * Copyright 2013-present, Facebook, Inc.
  20566. * All rights reserved.
  20567. *
  20568. * This source code is licensed under the BSD-style license found in the
  20569. * LICENSE file in the root directory of this source tree. An additional grant
  20570. * of patent rights can be found in the PATENTS file in the same directory.
  20571. *
  20572. */
  20573. var _assign = __webpack_require__(3);
  20574. var PooledClass = __webpack_require__(15);
  20575. var getTextContentAccessor = __webpack_require__(73);
  20576. /**
  20577. * This helper class stores information about text content of a target node,
  20578. * allowing comparison of content before and after a given event.
  20579. *
  20580. * Identify the node where selection currently begins, then observe
  20581. * both its text content and its current position in the DOM. Since the
  20582. * browser may natively replace the target node during composition, we can
  20583. * use its position to find its replacement.
  20584. *
  20585. * @param {DOMEventTarget} root
  20586. */
  20587. function FallbackCompositionState(root) {
  20588. this._root = root;
  20589. this._startText = this.getText();
  20590. this._fallbackText = null;
  20591. }
  20592. _assign(FallbackCompositionState.prototype, {
  20593. destructor: function () {
  20594. this._root = null;
  20595. this._startText = null;
  20596. this._fallbackText = null;
  20597. },
  20598. /**
  20599. * Get current text of input.
  20600. *
  20601. * @return {string}
  20602. */
  20603. getText: function () {
  20604. if ('value' in this._root) {
  20605. return this._root.value;
  20606. }
  20607. return this._root[getTextContentAccessor()];
  20608. },
  20609. /**
  20610. * Determine the differing substring between the initially stored
  20611. * text content and the current content.
  20612. *
  20613. * @return {string}
  20614. */
  20615. getData: function () {
  20616. if (this._fallbackText) {
  20617. return this._fallbackText;
  20618. }
  20619. var start;
  20620. var startValue = this._startText;
  20621. var startLength = startValue.length;
  20622. var end;
  20623. var endValue = this.getText();
  20624. var endLength = endValue.length;
  20625. for (start = 0; start < startLength; start++) {
  20626. if (startValue[start] !== endValue[start]) {
  20627. break;
  20628. }
  20629. }
  20630. var minEnd = startLength - start;
  20631. for (end = 1; end <= minEnd; end++) {
  20632. if (startValue[startLength - end] !== endValue[endLength - end]) {
  20633. break;
  20634. }
  20635. }
  20636. var sliceTail = end > 1 ? 1 - end : undefined;
  20637. this._fallbackText = endValue.slice(start, sliceTail);
  20638. return this._fallbackText;
  20639. }
  20640. });
  20641. PooledClass.addPoolingTo(FallbackCompositionState);
  20642. module.exports = FallbackCompositionState;
  20643. /***/ }),
  20644. /* 150 */
  20645. /***/ (function(module, exports, __webpack_require__) {
  20646. "use strict";
  20647. /**
  20648. * Copyright 2013-present, Facebook, Inc.
  20649. * All rights reserved.
  20650. *
  20651. * This source code is licensed under the BSD-style license found in the
  20652. * LICENSE file in the root directory of this source tree. An additional grant
  20653. * of patent rights can be found in the PATENTS file in the same directory.
  20654. *
  20655. */
  20656. var DOMProperty = __webpack_require__(18);
  20657. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  20658. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  20659. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  20660. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  20661. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  20662. var HTMLDOMPropertyConfig = {
  20663. isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  20664. Properties: {
  20665. /**
  20666. * Standard Properties
  20667. */
  20668. accept: 0,
  20669. acceptCharset: 0,
  20670. accessKey: 0,
  20671. action: 0,
  20672. allowFullScreen: HAS_BOOLEAN_VALUE,
  20673. allowTransparency: 0,
  20674. alt: 0,
  20675. // specifies target context for links with `preload` type
  20676. as: 0,
  20677. async: HAS_BOOLEAN_VALUE,
  20678. autoComplete: 0,
  20679. // autoFocus is polyfilled/normalized by AutoFocusUtils
  20680. // autoFocus: HAS_BOOLEAN_VALUE,
  20681. autoPlay: HAS_BOOLEAN_VALUE,
  20682. capture: HAS_BOOLEAN_VALUE,
  20683. cellPadding: 0,
  20684. cellSpacing: 0,
  20685. charSet: 0,
  20686. challenge: 0,
  20687. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  20688. cite: 0,
  20689. classID: 0,
  20690. className: 0,
  20691. cols: HAS_POSITIVE_NUMERIC_VALUE,
  20692. colSpan: 0,
  20693. content: 0,
  20694. contentEditable: 0,
  20695. contextMenu: 0,
  20696. controls: HAS_BOOLEAN_VALUE,
  20697. coords: 0,
  20698. crossOrigin: 0,
  20699. data: 0, // For `<object />` acts as `src`.
  20700. dateTime: 0,
  20701. 'default': HAS_BOOLEAN_VALUE,
  20702. defer: HAS_BOOLEAN_VALUE,
  20703. dir: 0,
  20704. disabled: HAS_BOOLEAN_VALUE,
  20705. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  20706. draggable: 0,
  20707. encType: 0,
  20708. form: 0,
  20709. formAction: 0,
  20710. formEncType: 0,
  20711. formMethod: 0,
  20712. formNoValidate: HAS_BOOLEAN_VALUE,
  20713. formTarget: 0,
  20714. frameBorder: 0,
  20715. headers: 0,
  20716. height: 0,
  20717. hidden: HAS_BOOLEAN_VALUE,
  20718. high: 0,
  20719. href: 0,
  20720. hrefLang: 0,
  20721. htmlFor: 0,
  20722. httpEquiv: 0,
  20723. icon: 0,
  20724. id: 0,
  20725. inputMode: 0,
  20726. integrity: 0,
  20727. is: 0,
  20728. keyParams: 0,
  20729. keyType: 0,
  20730. kind: 0,
  20731. label: 0,
  20732. lang: 0,
  20733. list: 0,
  20734. loop: HAS_BOOLEAN_VALUE,
  20735. low: 0,
  20736. manifest: 0,
  20737. marginHeight: 0,
  20738. marginWidth: 0,
  20739. max: 0,
  20740. maxLength: 0,
  20741. media: 0,
  20742. mediaGroup: 0,
  20743. method: 0,
  20744. min: 0,
  20745. minLength: 0,
  20746. // Caution; `option.selected` is not updated if `select.multiple` is
  20747. // disabled with `removeAttribute`.
  20748. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  20749. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  20750. name: 0,
  20751. nonce: 0,
  20752. noValidate: HAS_BOOLEAN_VALUE,
  20753. open: HAS_BOOLEAN_VALUE,
  20754. optimum: 0,
  20755. pattern: 0,
  20756. placeholder: 0,
  20757. playsInline: HAS_BOOLEAN_VALUE,
  20758. poster: 0,
  20759. preload: 0,
  20760. profile: 0,
  20761. radioGroup: 0,
  20762. readOnly: HAS_BOOLEAN_VALUE,
  20763. referrerPolicy: 0,
  20764. rel: 0,
  20765. required: HAS_BOOLEAN_VALUE,
  20766. reversed: HAS_BOOLEAN_VALUE,
  20767. role: 0,
  20768. rows: HAS_POSITIVE_NUMERIC_VALUE,
  20769. rowSpan: HAS_NUMERIC_VALUE,
  20770. sandbox: 0,
  20771. scope: 0,
  20772. scoped: HAS_BOOLEAN_VALUE,
  20773. scrolling: 0,
  20774. seamless: HAS_BOOLEAN_VALUE,
  20775. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  20776. shape: 0,
  20777. size: HAS_POSITIVE_NUMERIC_VALUE,
  20778. sizes: 0,
  20779. span: HAS_POSITIVE_NUMERIC_VALUE,
  20780. spellCheck: 0,
  20781. src: 0,
  20782. srcDoc: 0,
  20783. srcLang: 0,
  20784. srcSet: 0,
  20785. start: HAS_NUMERIC_VALUE,
  20786. step: 0,
  20787. style: 0,
  20788. summary: 0,
  20789. tabIndex: 0,
  20790. target: 0,
  20791. title: 0,
  20792. // Setting .type throws on non-<input> tags
  20793. type: 0,
  20794. useMap: 0,
  20795. value: 0,
  20796. width: 0,
  20797. wmode: 0,
  20798. wrap: 0,
  20799. /**
  20800. * RDFa Properties
  20801. */
  20802. about: 0,
  20803. datatype: 0,
  20804. inlist: 0,
  20805. prefix: 0,
  20806. // property is also supported for OpenGraph in meta tags.
  20807. property: 0,
  20808. resource: 0,
  20809. 'typeof': 0,
  20810. vocab: 0,
  20811. /**
  20812. * Non-standard Properties
  20813. */
  20814. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  20815. // keyboard hints.
  20816. autoCapitalize: 0,
  20817. autoCorrect: 0,
  20818. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  20819. autoSave: 0,
  20820. // color is for Safari mask-icon link
  20821. color: 0,
  20822. // itemProp, itemScope, itemType are for
  20823. // Microdata support. See http://schema.org/docs/gs.html
  20824. itemProp: 0,
  20825. itemScope: HAS_BOOLEAN_VALUE,
  20826. itemType: 0,
  20827. // itemID and itemRef are for Microdata support as well but
  20828. // only specified in the WHATWG spec document. See
  20829. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  20830. itemID: 0,
  20831. itemRef: 0,
  20832. // results show looking glass icon and recent searches on input
  20833. // search fields in WebKit/Blink
  20834. results: 0,
  20835. // IE-only attribute that specifies security restrictions on an iframe
  20836. // as an alternative to the sandbox attribute on IE<10
  20837. security: 0,
  20838. // IE-only attribute that controls focus behavior
  20839. unselectable: 0
  20840. },
  20841. DOMAttributeNames: {
  20842. acceptCharset: 'accept-charset',
  20843. className: 'class',
  20844. htmlFor: 'for',
  20845. httpEquiv: 'http-equiv'
  20846. },
  20847. DOMPropertyNames: {}
  20848. };
  20849. module.exports = HTMLDOMPropertyConfig;
  20850. /***/ }),
  20851. /* 151 */
  20852. /***/ (function(module, exports, __webpack_require__) {
  20853. "use strict";
  20854. /* WEBPACK VAR INJECTION */(function(process) {/**
  20855. * Copyright 2014-present, Facebook, Inc.
  20856. * All rights reserved.
  20857. *
  20858. * This source code is licensed under the BSD-style license found in the
  20859. * LICENSE file in the root directory of this source tree. An additional grant
  20860. * of patent rights can be found in the PATENTS file in the same directory.
  20861. *
  20862. */
  20863. var ReactReconciler = __webpack_require__(19);
  20864. var instantiateReactComponent = __webpack_require__(74);
  20865. var KeyEscapeUtils = __webpack_require__(39);
  20866. var shouldUpdateReactComponent = __webpack_require__(49);
  20867. var traverseAllChildren = __webpack_require__(77);
  20868. var warning = __webpack_require__(1);
  20869. var ReactComponentTreeHook;
  20870. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  20871. // Temporary hack.
  20872. // Inline requires don't work well with Jest:
  20873. // https://github.com/facebook/react/issues/7240
  20874. // Remove the inline requires when we don't need them anymore:
  20875. // https://github.com/facebook/react/pull/7178
  20876. ReactComponentTreeHook = __webpack_require__(78);
  20877. }
  20878. function instantiateChild(childInstances, child, name, selfDebugID) {
  20879. // We found a component instance.
  20880. var keyUnique = childInstances[name] === undefined;
  20881. if (false) {
  20882. if (!ReactComponentTreeHook) {
  20883. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  20884. }
  20885. if (!keyUnique) {
  20886. process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
  20887. }
  20888. }
  20889. if (child != null && keyUnique) {
  20890. childInstances[name] = instantiateReactComponent(child, true);
  20891. }
  20892. }
  20893. /**
  20894. * ReactChildReconciler provides helpers for initializing or updating a set of
  20895. * children. Its output is suitable for passing it onto ReactMultiChild which
  20896. * does diffed reordering and insertion.
  20897. */
  20898. var ReactChildReconciler = {
  20899. /**
  20900. * Generates a "mount image" for each of the supplied children. In the case
  20901. * of `ReactDOMComponent`, a mount image is a string of markup.
  20902. *
  20903. * @param {?object} nestedChildNodes Nested child maps.
  20904. * @return {?object} A set of child instances.
  20905. * @internal
  20906. */
  20907. instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
  20908. ) {
  20909. if (nestedChildNodes == null) {
  20910. return null;
  20911. }
  20912. var childInstances = {};
  20913. if (false) {
  20914. traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
  20915. return instantiateChild(childInsts, child, name, selfDebugID);
  20916. }, childInstances);
  20917. } else {
  20918. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  20919. }
  20920. return childInstances;
  20921. },
  20922. /**
  20923. * Updates the rendered children and returns a new set of children.
  20924. *
  20925. * @param {?object} prevChildren Previously initialized set of children.
  20926. * @param {?object} nextChildren Flat child element maps.
  20927. * @param {ReactReconcileTransaction} transaction
  20928. * @param {object} context
  20929. * @return {?object} A new set of child instances.
  20930. * @internal
  20931. */
  20932. updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
  20933. ) {
  20934. // We currently don't have a way to track moves here but if we use iterators
  20935. // instead of for..in we can zip the iterators and check if an item has
  20936. // moved.
  20937. // TODO: If nothing has changed, return the prevChildren object so that we
  20938. // can quickly bailout if nothing has changed.
  20939. if (!nextChildren && !prevChildren) {
  20940. return;
  20941. }
  20942. var name;
  20943. var prevChild;
  20944. for (name in nextChildren) {
  20945. if (!nextChildren.hasOwnProperty(name)) {
  20946. continue;
  20947. }
  20948. prevChild = prevChildren && prevChildren[name];
  20949. var prevElement = prevChild && prevChild._currentElement;
  20950. var nextElement = nextChildren[name];
  20951. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  20952. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  20953. nextChildren[name] = prevChild;
  20954. } else {
  20955. if (prevChild) {
  20956. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  20957. ReactReconciler.unmountComponent(prevChild, false);
  20958. }
  20959. // The child must be instantiated before it's mounted.
  20960. var nextChildInstance = instantiateReactComponent(nextElement, true);
  20961. nextChildren[name] = nextChildInstance;
  20962. // Creating mount image now ensures refs are resolved in right order
  20963. // (see https://github.com/facebook/react/pull/7101 for explanation).
  20964. var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
  20965. mountImages.push(nextChildMountImage);
  20966. }
  20967. }
  20968. // Unmount children that are no longer present.
  20969. for (name in prevChildren) {
  20970. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  20971. prevChild = prevChildren[name];
  20972. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  20973. ReactReconciler.unmountComponent(prevChild, false);
  20974. }
  20975. }
  20976. },
  20977. /**
  20978. * Unmounts all rendered children. This should be used to clean up children
  20979. * when this component is unmounted.
  20980. *
  20981. * @param {?object} renderedChildren Previously initialized set of children.
  20982. * @internal
  20983. */
  20984. unmountChildren: function (renderedChildren, safely) {
  20985. for (var name in renderedChildren) {
  20986. if (renderedChildren.hasOwnProperty(name)) {
  20987. var renderedChild = renderedChildren[name];
  20988. ReactReconciler.unmountComponent(renderedChild, safely);
  20989. }
  20990. }
  20991. }
  20992. };
  20993. module.exports = ReactChildReconciler;
  20994. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(53)))
  20995. /***/ }),
  20996. /* 152 */
  20997. /***/ (function(module, exports, __webpack_require__) {
  20998. "use strict";
  20999. /**
  21000. * Copyright 2013-present, Facebook, Inc.
  21001. * All rights reserved.
  21002. *
  21003. * This source code is licensed under the BSD-style license found in the
  21004. * LICENSE file in the root directory of this source tree. An additional grant
  21005. * of patent rights can be found in the PATENTS file in the same directory.
  21006. *
  21007. */
  21008. var DOMChildrenOperations = __webpack_require__(35);
  21009. var ReactDOMIDOperations = __webpack_require__(159);
  21010. /**
  21011. * Abstracts away all functionality of the reconciler that requires knowledge of
  21012. * the browser context. TODO: These callers should be refactored to avoid the
  21013. * need for this injection.
  21014. */
  21015. var ReactComponentBrowserEnvironment = {
  21016. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  21017. replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
  21018. };
  21019. module.exports = ReactComponentBrowserEnvironment;
  21020. /***/ }),
  21021. /* 153 */
  21022. /***/ (function(module, exports, __webpack_require__) {
  21023. "use strict";
  21024. /**
  21025. * Copyright 2013-present, Facebook, Inc.
  21026. * All rights reserved.
  21027. *
  21028. * This source code is licensed under the BSD-style license found in the
  21029. * LICENSE file in the root directory of this source tree. An additional grant
  21030. * of patent rights can be found in the PATENTS file in the same directory.
  21031. *
  21032. */
  21033. var _prodInvariant = __webpack_require__(2),
  21034. _assign = __webpack_require__(3);
  21035. var React = __webpack_require__(20);
  21036. var ReactComponentEnvironment = __webpack_require__(41);
  21037. var ReactCurrentOwner = __webpack_require__(13);
  21038. var ReactErrorUtils = __webpack_require__(42);
  21039. var ReactInstanceMap = __webpack_require__(26);
  21040. var ReactInstrumentation = __webpack_require__(10);
  21041. var ReactNodeTypes = __webpack_require__(68);
  21042. var ReactReconciler = __webpack_require__(19);
  21043. if (false) {
  21044. var checkReactTypeSpec = require('./checkReactTypeSpec');
  21045. }
  21046. var emptyObject = __webpack_require__(23);
  21047. var invariant = __webpack_require__(0);
  21048. var shallowEqual = __webpack_require__(34);
  21049. var shouldUpdateReactComponent = __webpack_require__(49);
  21050. var warning = __webpack_require__(1);
  21051. var CompositeTypes = {
  21052. ImpureClass: 0,
  21053. PureClass: 1,
  21054. StatelessFunctional: 2
  21055. };
  21056. function StatelessComponent(Component) {}
  21057. StatelessComponent.prototype.render = function () {
  21058. var Component = ReactInstanceMap.get(this)._currentElement.type;
  21059. var element = Component(this.props, this.context, this.updater);
  21060. warnIfInvalidElement(Component, element);
  21061. return element;
  21062. };
  21063. function warnIfInvalidElement(Component, element) {
  21064. if (false) {
  21065. process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
  21066. process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
  21067. }
  21068. }
  21069. function shouldConstruct(Component) {
  21070. return !!(Component.prototype && Component.prototype.isReactComponent);
  21071. }
  21072. function isPureComponent(Component) {
  21073. return !!(Component.prototype && Component.prototype.isPureReactComponent);
  21074. }
  21075. // Separated into a function to contain deoptimizations caused by try/finally.
  21076. function measureLifeCyclePerf(fn, debugID, timerType) {
  21077. if (debugID === 0) {
  21078. // Top-level wrappers (see ReactMount) and empty components (see
  21079. // ReactDOMEmptyComponent) are invisible to hooks and devtools.
  21080. // Both are implementation details that should go away in the future.
  21081. return fn();
  21082. }
  21083. ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
  21084. try {
  21085. return fn();
  21086. } finally {
  21087. ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
  21088. }
  21089. }
  21090. /**
  21091. * ------------------ The Life-Cycle of a Composite Component ------------------
  21092. *
  21093. * - constructor: Initialization of state. The instance is now retained.
  21094. * - componentWillMount
  21095. * - render
  21096. * - [children's constructors]
  21097. * - [children's componentWillMount and render]
  21098. * - [children's componentDidMount]
  21099. * - componentDidMount
  21100. *
  21101. * Update Phases:
  21102. * - componentWillReceiveProps (only called if parent updated)
  21103. * - shouldComponentUpdate
  21104. * - componentWillUpdate
  21105. * - render
  21106. * - [children's constructors or receive props phases]
  21107. * - componentDidUpdate
  21108. *
  21109. * - componentWillUnmount
  21110. * - [children's componentWillUnmount]
  21111. * - [children destroyed]
  21112. * - (destroyed): The instance is now blank, released by React and ready for GC.
  21113. *
  21114. * -----------------------------------------------------------------------------
  21115. */
  21116. /**
  21117. * An incrementing ID assigned to each component when it is mounted. This is
  21118. * used to enforce the order in which `ReactUpdates` updates dirty components.
  21119. *
  21120. * @private
  21121. */
  21122. var nextMountID = 1;
  21123. /**
  21124. * @lends {ReactCompositeComponent.prototype}
  21125. */
  21126. var ReactCompositeComponent = {
  21127. /**
  21128. * Base constructor for all composite component.
  21129. *
  21130. * @param {ReactElement} element
  21131. * @final
  21132. * @internal
  21133. */
  21134. construct: function (element) {
  21135. this._currentElement = element;
  21136. this._rootNodeID = 0;
  21137. this._compositeType = null;
  21138. this._instance = null;
  21139. this._hostParent = null;
  21140. this._hostContainerInfo = null;
  21141. // See ReactUpdateQueue
  21142. this._updateBatchNumber = null;
  21143. this._pendingElement = null;
  21144. this._pendingStateQueue = null;
  21145. this._pendingReplaceState = false;
  21146. this._pendingForceUpdate = false;
  21147. this._renderedNodeType = null;
  21148. this._renderedComponent = null;
  21149. this._context = null;
  21150. this._mountOrder = 0;
  21151. this._topLevelWrapper = null;
  21152. // See ReactUpdates and ReactUpdateQueue.
  21153. this._pendingCallbacks = null;
  21154. // ComponentWillUnmount shall only be called once
  21155. this._calledComponentWillUnmount = false;
  21156. if (false) {
  21157. this._warnedAboutRefsInRender = false;
  21158. }
  21159. },
  21160. /**
  21161. * Initializes the component, renders markup, and registers event listeners.
  21162. *
  21163. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  21164. * @param {?object} hostParent
  21165. * @param {?object} hostContainerInfo
  21166. * @param {?object} context
  21167. * @return {?string} Rendered markup to be inserted into the DOM.
  21168. * @final
  21169. * @internal
  21170. */
  21171. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  21172. var _this = this;
  21173. this._context = context;
  21174. this._mountOrder = nextMountID++;
  21175. this._hostParent = hostParent;
  21176. this._hostContainerInfo = hostContainerInfo;
  21177. var publicProps = this._currentElement.props;
  21178. var publicContext = this._processContext(context);
  21179. var Component = this._currentElement.type;
  21180. var updateQueue = transaction.getUpdateQueue();
  21181. // Initialize the public class
  21182. var doConstruct = shouldConstruct(Component);
  21183. var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
  21184. var renderedElement;
  21185. // Support functional components
  21186. if (!doConstruct && (inst == null || inst.render == null)) {
  21187. renderedElement = inst;
  21188. warnIfInvalidElement(Component, renderedElement);
  21189. !(inst === null || inst === false || React.isValidElement(inst)) ? false ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0;
  21190. inst = new StatelessComponent(Component);
  21191. this._compositeType = CompositeTypes.StatelessFunctional;
  21192. } else {
  21193. if (isPureComponent(Component)) {
  21194. this._compositeType = CompositeTypes.PureClass;
  21195. } else {
  21196. this._compositeType = CompositeTypes.ImpureClass;
  21197. }
  21198. }
  21199. if (false) {
  21200. // This will throw later in _renderValidatedComponent, but add an early
  21201. // warning now to help debugging
  21202. if (inst.render == null) {
  21203. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
  21204. }
  21205. var propsMutated = inst.props !== publicProps;
  21206. var componentName = Component.displayName || Component.name || 'Component';
  21207. process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0;
  21208. }
  21209. // These should be set up in the constructor, but as a convenience for
  21210. // simpler class abstractions, we set them up after the fact.
  21211. inst.props = publicProps;
  21212. inst.context = publicContext;
  21213. inst.refs = emptyObject;
  21214. inst.updater = updateQueue;
  21215. this._instance = inst;
  21216. // Store a reference from the instance back to the internal representation
  21217. ReactInstanceMap.set(inst, this);
  21218. if (false) {
  21219. // Since plain JS classes are defined without any special initialization
  21220. // logic, we can not catch common errors early. Therefore, we have to
  21221. // catch them here, at initialization time, instead.
  21222. process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, '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?', this.getName() || 'a component') : void 0;
  21223. process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, '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.', this.getName() || 'a component') : void 0;
  21224. process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
  21225. process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
  21226. process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%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.', this.getName() || 'A component') : void 0;
  21227. process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
  21228. process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
  21229. }
  21230. var initialState = inst.state;
  21231. if (initialState === undefined) {
  21232. inst.state = initialState = null;
  21233. }
  21234. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? false ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0;
  21235. this._pendingStateQueue = null;
  21236. this._pendingReplaceState = false;
  21237. this._pendingForceUpdate = false;
  21238. var markup;
  21239. if (inst.unstable_handleError) {
  21240. markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
  21241. } else {
  21242. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  21243. }
  21244. if (inst.componentDidMount) {
  21245. if (false) {
  21246. transaction.getReactMountReady().enqueue(function () {
  21247. measureLifeCyclePerf(function () {
  21248. return inst.componentDidMount();
  21249. }, _this._debugID, 'componentDidMount');
  21250. });
  21251. } else {
  21252. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  21253. }
  21254. }
  21255. return markup;
  21256. },
  21257. _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
  21258. if (false) {
  21259. ReactCurrentOwner.current = this;
  21260. try {
  21261. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  21262. } finally {
  21263. ReactCurrentOwner.current = null;
  21264. }
  21265. } else {
  21266. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  21267. }
  21268. },
  21269. _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
  21270. var Component = this._currentElement.type;
  21271. if (doConstruct) {
  21272. if (false) {
  21273. return measureLifeCyclePerf(function () {
  21274. return new Component(publicProps, publicContext, updateQueue);
  21275. }, this._debugID, 'ctor');
  21276. } else {
  21277. return new Component(publicProps, publicContext, updateQueue);
  21278. }
  21279. }
  21280. // This can still be an instance in case of factory components
  21281. // but we'll count this as time spent rendering as the more common case.
  21282. if (false) {
  21283. return measureLifeCyclePerf(function () {
  21284. return Component(publicProps, publicContext, updateQueue);
  21285. }, this._debugID, 'render');
  21286. } else {
  21287. return Component(publicProps, publicContext, updateQueue);
  21288. }
  21289. },
  21290. performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  21291. var markup;
  21292. var checkpoint = transaction.checkpoint();
  21293. try {
  21294. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  21295. } catch (e) {
  21296. // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
  21297. transaction.rollback(checkpoint);
  21298. this._instance.unstable_handleError(e);
  21299. if (this._pendingStateQueue) {
  21300. this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
  21301. }
  21302. checkpoint = transaction.checkpoint();
  21303. this._renderedComponent.unmountComponent(true);
  21304. transaction.rollback(checkpoint);
  21305. // Try again - we've informed the component about the error, so they can render an error message this time.
  21306. // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
  21307. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  21308. }
  21309. return markup;
  21310. },
  21311. performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  21312. var inst = this._instance;
  21313. var debugID = 0;
  21314. if (false) {
  21315. debugID = this._debugID;
  21316. }
  21317. if (inst.componentWillMount) {
  21318. if (false) {
  21319. measureLifeCyclePerf(function () {
  21320. return inst.componentWillMount();
  21321. }, debugID, 'componentWillMount');
  21322. } else {
  21323. inst.componentWillMount();
  21324. }
  21325. // When mounting, calls to `setState` by `componentWillMount` will set
  21326. // `this._pendingStateQueue` without triggering a re-render.
  21327. if (this._pendingStateQueue) {
  21328. inst.state = this._processPendingState(inst.props, inst.context);
  21329. }
  21330. }
  21331. // If not a stateless component, we now render
  21332. if (renderedElement === undefined) {
  21333. renderedElement = this._renderValidatedComponent();
  21334. }
  21335. var nodeType = ReactNodeTypes.getType(renderedElement);
  21336. this._renderedNodeType = nodeType;
  21337. var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  21338. );
  21339. this._renderedComponent = child;
  21340. var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
  21341. if (false) {
  21342. if (debugID !== 0) {
  21343. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  21344. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  21345. }
  21346. }
  21347. return markup;
  21348. },
  21349. getHostNode: function () {
  21350. return ReactReconciler.getHostNode(this._renderedComponent);
  21351. },
  21352. /**
  21353. * Releases any resources allocated by `mountComponent`.
  21354. *
  21355. * @final
  21356. * @internal
  21357. */
  21358. unmountComponent: function (safely) {
  21359. if (!this._renderedComponent) {
  21360. return;
  21361. }
  21362. var inst = this._instance;
  21363. if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
  21364. inst._calledComponentWillUnmount = true;
  21365. if (safely) {
  21366. var name = this.getName() + '.componentWillUnmount()';
  21367. ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
  21368. } else {
  21369. if (false) {
  21370. measureLifeCyclePerf(function () {
  21371. return inst.componentWillUnmount();
  21372. }, this._debugID, 'componentWillUnmount');
  21373. } else {
  21374. inst.componentWillUnmount();
  21375. }
  21376. }
  21377. }
  21378. if (this._renderedComponent) {
  21379. ReactReconciler.unmountComponent(this._renderedComponent, safely);
  21380. this._renderedNodeType = null;
  21381. this._renderedComponent = null;
  21382. this._instance = null;
  21383. }
  21384. // Reset pending fields
  21385. // Even if this component is scheduled for another update in ReactUpdates,
  21386. // it would still be ignored because these fields are reset.
  21387. this._pendingStateQueue = null;
  21388. this._pendingReplaceState = false;
  21389. this._pendingForceUpdate = false;
  21390. this._pendingCallbacks = null;
  21391. this._pendingElement = null;
  21392. // These fields do not really need to be reset since this object is no
  21393. // longer accessible.
  21394. this._context = null;
  21395. this._rootNodeID = 0;
  21396. this._topLevelWrapper = null;
  21397. // Delete the reference from the instance to this internal representation
  21398. // which allow the internals to be properly cleaned up even if the user
  21399. // leaks a reference to the public instance.
  21400. ReactInstanceMap.remove(inst);
  21401. // Some existing components rely on inst.props even after they've been
  21402. // destroyed (in event handlers).
  21403. // TODO: inst.props = null;
  21404. // TODO: inst.state = null;
  21405. // TODO: inst.context = null;
  21406. },
  21407. /**
  21408. * Filters the context object to only contain keys specified in
  21409. * `contextTypes`
  21410. *
  21411. * @param {object} context
  21412. * @return {?object}
  21413. * @private
  21414. */
  21415. _maskContext: function (context) {
  21416. var Component = this._currentElement.type;
  21417. var contextTypes = Component.contextTypes;
  21418. if (!contextTypes) {
  21419. return emptyObject;
  21420. }
  21421. var maskedContext = {};
  21422. for (var contextName in contextTypes) {
  21423. maskedContext[contextName] = context[contextName];
  21424. }
  21425. return maskedContext;
  21426. },
  21427. /**
  21428. * Filters the context object to only contain keys specified in
  21429. * `contextTypes`, and asserts that they are valid.
  21430. *
  21431. * @param {object} context
  21432. * @return {?object}
  21433. * @private
  21434. */
  21435. _processContext: function (context) {
  21436. var maskedContext = this._maskContext(context);
  21437. if (false) {
  21438. var Component = this._currentElement.type;
  21439. if (Component.contextTypes) {
  21440. this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
  21441. }
  21442. }
  21443. return maskedContext;
  21444. },
  21445. /**
  21446. * @param {object} currentContext
  21447. * @return {object}
  21448. * @private
  21449. */
  21450. _processChildContext: function (currentContext) {
  21451. var Component = this._currentElement.type;
  21452. var inst = this._instance;
  21453. var childContext;
  21454. if (inst.getChildContext) {
  21455. if (false) {
  21456. ReactInstrumentation.debugTool.onBeginProcessingChildContext();
  21457. try {
  21458. childContext = inst.getChildContext();
  21459. } finally {
  21460. ReactInstrumentation.debugTool.onEndProcessingChildContext();
  21461. }
  21462. } else {
  21463. childContext = inst.getChildContext();
  21464. }
  21465. }
  21466. if (childContext) {
  21467. !(typeof Component.childContextTypes === 'object') ? false ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0;
  21468. if (false) {
  21469. this._checkContextTypes(Component.childContextTypes, childContext, 'childContext');
  21470. }
  21471. for (var name in childContext) {
  21472. !(name in Component.childContextTypes) ? false ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0;
  21473. }
  21474. return _assign({}, currentContext, childContext);
  21475. }
  21476. return currentContext;
  21477. },
  21478. /**
  21479. * Assert that the context types are valid
  21480. *
  21481. * @param {object} typeSpecs Map of context field to a ReactPropType
  21482. * @param {object} values Runtime values that need to be type-checked
  21483. * @param {string} location e.g. "prop", "context", "child context"
  21484. * @private
  21485. */
  21486. _checkContextTypes: function (typeSpecs, values, location) {
  21487. if (false) {
  21488. checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
  21489. }
  21490. },
  21491. receiveComponent: function (nextElement, transaction, nextContext) {
  21492. var prevElement = this._currentElement;
  21493. var prevContext = this._context;
  21494. this._pendingElement = null;
  21495. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  21496. },
  21497. /**
  21498. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  21499. * is set, update the component.
  21500. *
  21501. * @param {ReactReconcileTransaction} transaction
  21502. * @internal
  21503. */
  21504. performUpdateIfNecessary: function (transaction) {
  21505. if (this._pendingElement != null) {
  21506. ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
  21507. } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  21508. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  21509. } else {
  21510. this._updateBatchNumber = null;
  21511. }
  21512. },
  21513. /**
  21514. * Perform an update to a mounted component. The componentWillReceiveProps and
  21515. * shouldComponentUpdate methods are called, then (assuming the update isn't
  21516. * skipped) the remaining update lifecycle methods are called and the DOM
  21517. * representation is updated.
  21518. *
  21519. * By default, this implements React's rendering and reconciliation algorithm.
  21520. * Sophisticated clients may wish to override this.
  21521. *
  21522. * @param {ReactReconcileTransaction} transaction
  21523. * @param {ReactElement} prevParentElement
  21524. * @param {ReactElement} nextParentElement
  21525. * @internal
  21526. * @overridable
  21527. */
  21528. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  21529. var inst = this._instance;
  21530. !(inst != null) ? false ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0;
  21531. var willReceive = false;
  21532. var nextContext;
  21533. // Determine if the context has changed or not
  21534. if (this._context === nextUnmaskedContext) {
  21535. nextContext = inst.context;
  21536. } else {
  21537. nextContext = this._processContext(nextUnmaskedContext);
  21538. willReceive = true;
  21539. }
  21540. var prevProps = prevParentElement.props;
  21541. var nextProps = nextParentElement.props;
  21542. // Not a simple state update but a props update
  21543. if (prevParentElement !== nextParentElement) {
  21544. willReceive = true;
  21545. }
  21546. // An update here will schedule an update but immediately set
  21547. // _pendingStateQueue which will ensure that any state updates gets
  21548. // immediately reconciled instead of waiting for the next batch.
  21549. if (willReceive && inst.componentWillReceiveProps) {
  21550. if (false) {
  21551. measureLifeCyclePerf(function () {
  21552. return inst.componentWillReceiveProps(nextProps, nextContext);
  21553. }, this._debugID, 'componentWillReceiveProps');
  21554. } else {
  21555. inst.componentWillReceiveProps(nextProps, nextContext);
  21556. }
  21557. }
  21558. var nextState = this._processPendingState(nextProps, nextContext);
  21559. var shouldUpdate = true;
  21560. if (!this._pendingForceUpdate) {
  21561. if (inst.shouldComponentUpdate) {
  21562. if (false) {
  21563. shouldUpdate = measureLifeCyclePerf(function () {
  21564. return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  21565. }, this._debugID, 'shouldComponentUpdate');
  21566. } else {
  21567. shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  21568. }
  21569. } else {
  21570. if (this._compositeType === CompositeTypes.PureClass) {
  21571. shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
  21572. }
  21573. }
  21574. }
  21575. if (false) {
  21576. process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
  21577. }
  21578. this._updateBatchNumber = null;
  21579. if (shouldUpdate) {
  21580. this._pendingForceUpdate = false;
  21581. // Will set `this.props`, `this.state` and `this.context`.
  21582. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  21583. } else {
  21584. // If it's determined that a component should not update, we still want
  21585. // to set props and state but we shortcut the rest of the update.
  21586. this._currentElement = nextParentElement;
  21587. this._context = nextUnmaskedContext;
  21588. inst.props = nextProps;
  21589. inst.state = nextState;
  21590. inst.context = nextContext;
  21591. }
  21592. },
  21593. _processPendingState: function (props, context) {
  21594. var inst = this._instance;
  21595. var queue = this._pendingStateQueue;
  21596. var replace = this._pendingReplaceState;
  21597. this._pendingReplaceState = false;
  21598. this._pendingStateQueue = null;
  21599. if (!queue) {
  21600. return inst.state;
  21601. }
  21602. if (replace && queue.length === 1) {
  21603. return queue[0];
  21604. }
  21605. var nextState = _assign({}, replace ? queue[0] : inst.state);
  21606. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  21607. var partial = queue[i];
  21608. _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  21609. }
  21610. return nextState;
  21611. },
  21612. /**
  21613. * Merges new props and state, notifies delegate methods of update and
  21614. * performs update.
  21615. *
  21616. * @param {ReactElement} nextElement Next element
  21617. * @param {object} nextProps Next public object to set as properties.
  21618. * @param {?object} nextState Next object to set as state.
  21619. * @param {?object} nextContext Next public object to set as context.
  21620. * @param {ReactReconcileTransaction} transaction
  21621. * @param {?object} unmaskedContext
  21622. * @private
  21623. */
  21624. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  21625. var _this2 = this;
  21626. var inst = this._instance;
  21627. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  21628. var prevProps;
  21629. var prevState;
  21630. var prevContext;
  21631. if (hasComponentDidUpdate) {
  21632. prevProps = inst.props;
  21633. prevState = inst.state;
  21634. prevContext = inst.context;
  21635. }
  21636. if (inst.componentWillUpdate) {
  21637. if (false) {
  21638. measureLifeCyclePerf(function () {
  21639. return inst.componentWillUpdate(nextProps, nextState, nextContext);
  21640. }, this._debugID, 'componentWillUpdate');
  21641. } else {
  21642. inst.componentWillUpdate(nextProps, nextState, nextContext);
  21643. }
  21644. }
  21645. this._currentElement = nextElement;
  21646. this._context = unmaskedContext;
  21647. inst.props = nextProps;
  21648. inst.state = nextState;
  21649. inst.context = nextContext;
  21650. this._updateRenderedComponent(transaction, unmaskedContext);
  21651. if (hasComponentDidUpdate) {
  21652. if (false) {
  21653. transaction.getReactMountReady().enqueue(function () {
  21654. measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
  21655. });
  21656. } else {
  21657. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  21658. }
  21659. }
  21660. },
  21661. /**
  21662. * Call the component's `render` method and update the DOM accordingly.
  21663. *
  21664. * @param {ReactReconcileTransaction} transaction
  21665. * @internal
  21666. */
  21667. _updateRenderedComponent: function (transaction, context) {
  21668. var prevComponentInstance = this._renderedComponent;
  21669. var prevRenderedElement = prevComponentInstance._currentElement;
  21670. var nextRenderedElement = this._renderValidatedComponent();
  21671. var debugID = 0;
  21672. if (false) {
  21673. debugID = this._debugID;
  21674. }
  21675. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  21676. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  21677. } else {
  21678. var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
  21679. ReactReconciler.unmountComponent(prevComponentInstance, false);
  21680. var nodeType = ReactNodeTypes.getType(nextRenderedElement);
  21681. this._renderedNodeType = nodeType;
  21682. var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  21683. );
  21684. this._renderedComponent = child;
  21685. var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
  21686. if (false) {
  21687. if (debugID !== 0) {
  21688. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  21689. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  21690. }
  21691. }
  21692. this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
  21693. }
  21694. },
  21695. /**
  21696. * Overridden in shallow rendering.
  21697. *
  21698. * @protected
  21699. */
  21700. _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
  21701. ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
  21702. },
  21703. /**
  21704. * @protected
  21705. */
  21706. _renderValidatedComponentWithoutOwnerOrContext: function () {
  21707. var inst = this._instance;
  21708. var renderedElement;
  21709. if (false) {
  21710. renderedElement = measureLifeCyclePerf(function () {
  21711. return inst.render();
  21712. }, this._debugID, 'render');
  21713. } else {
  21714. renderedElement = inst.render();
  21715. }
  21716. if (false) {
  21717. // We allow auto-mocks to proceed as if they're returning null.
  21718. if (renderedElement === undefined && inst.render._isMockFunction) {
  21719. // This is probably bad practice. Consider warning here and
  21720. // deprecating this convenience.
  21721. renderedElement = null;
  21722. }
  21723. }
  21724. return renderedElement;
  21725. },
  21726. /**
  21727. * @private
  21728. */
  21729. _renderValidatedComponent: function () {
  21730. var renderedElement;
  21731. if ("production" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
  21732. ReactCurrentOwner.current = this;
  21733. try {
  21734. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  21735. } finally {
  21736. ReactCurrentOwner.current = null;
  21737. }
  21738. } else {
  21739. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  21740. }
  21741. !(
  21742. // TODO: An `isValidNode` function would probably be more appropriate
  21743. renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? false ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0;
  21744. return renderedElement;
  21745. },
  21746. /**
  21747. * Lazily allocates the refs object and stores `component` as `ref`.
  21748. *
  21749. * @param {string} ref Reference name.
  21750. * @param {component} component Component to store as `ref`.
  21751. * @final
  21752. * @private
  21753. */
  21754. attachRef: function (ref, component) {
  21755. var inst = this.getPublicInstance();
  21756. !(inst != null) ? false ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
  21757. var publicComponentInstance = component.getPublicInstance();
  21758. if (false) {
  21759. var componentName = component && component.getName ? component.getName() : 'a component';
  21760. process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
  21761. }
  21762. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  21763. refs[ref] = publicComponentInstance;
  21764. },
  21765. /**
  21766. * Detaches a reference name.
  21767. *
  21768. * @param {string} ref Name to dereference.
  21769. * @final
  21770. * @private
  21771. */
  21772. detachRef: function (ref) {
  21773. var refs = this.getPublicInstance().refs;
  21774. delete refs[ref];
  21775. },
  21776. /**
  21777. * Get a text description of the component that can be used to identify it
  21778. * in error messages.
  21779. * @return {string} The name or null.
  21780. * @internal
  21781. */
  21782. getName: function () {
  21783. var type = this._currentElement.type;
  21784. var constructor = this._instance && this._instance.constructor;
  21785. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  21786. },
  21787. /**
  21788. * Get the publicly accessible representation of this component - i.e. what
  21789. * is exposed by refs and returned by render. Can be null for stateless
  21790. * components.
  21791. *
  21792. * @return {ReactComponent} the public component instance.
  21793. * @internal
  21794. */
  21795. getPublicInstance: function () {
  21796. var inst = this._instance;
  21797. if (this._compositeType === CompositeTypes.StatelessFunctional) {
  21798. return null;
  21799. }
  21800. return inst;
  21801. },
  21802. // Stub
  21803. _instantiateReactComponent: null
  21804. };
  21805. module.exports = ReactCompositeComponent;
  21806. /***/ }),
  21807. /* 154 */
  21808. /***/ (function(module, exports, __webpack_require__) {
  21809. "use strict";
  21810. /**
  21811. * Copyright 2013-present, Facebook, Inc.
  21812. * All rights reserved.
  21813. *
  21814. * This source code is licensed under the BSD-style license found in the
  21815. * LICENSE file in the root directory of this source tree. An additional grant
  21816. * of patent rights can be found in the PATENTS file in the same directory.
  21817. *
  21818. */
  21819. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  21820. var ReactDOMComponentTree = __webpack_require__(4);
  21821. var ReactDefaultInjection = __webpack_require__(167);
  21822. var ReactMount = __webpack_require__(67);
  21823. var ReactReconciler = __webpack_require__(19);
  21824. var ReactUpdates = __webpack_require__(11);
  21825. var ReactVersion = __webpack_require__(180);
  21826. var findDOMNode = __webpack_require__(196);
  21827. var getHostComponentFromComposite = __webpack_require__(72);
  21828. var renderSubtreeIntoContainer = __webpack_require__(204);
  21829. var warning = __webpack_require__(1);
  21830. ReactDefaultInjection.inject();
  21831. var ReactDOM = {
  21832. findDOMNode: findDOMNode,
  21833. render: ReactMount.render,
  21834. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  21835. version: ReactVersion,
  21836. /* eslint-disable camelcase */
  21837. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  21838. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  21839. };
  21840. // Inject the runtime into a devtools global hook regardless of browser.
  21841. // Allows for debugging when the hook is injected on the page.
  21842. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  21843. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  21844. ComponentTree: {
  21845. getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
  21846. getNodeFromInstance: function (inst) {
  21847. // inst is an internal instance (but could be a composite)
  21848. if (inst._renderedComponent) {
  21849. inst = getHostComponentFromComposite(inst);
  21850. }
  21851. if (inst) {
  21852. return ReactDOMComponentTree.getNodeFromInstance(inst);
  21853. } else {
  21854. return null;
  21855. }
  21856. }
  21857. },
  21858. Mount: ReactMount,
  21859. Reconciler: ReactReconciler
  21860. });
  21861. }
  21862. if (false) {
  21863. var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
  21864. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  21865. // First check if devtools is not installed
  21866. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  21867. // If we're in Chrome or Firefox, provide a download link if not installed.
  21868. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  21869. // Firefox does not have the issue with devtools loaded over file://
  21870. var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
  21871. console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
  21872. }
  21873. }
  21874. var testFunc = function testFn() {};
  21875. process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
  21876. // If we're in IE8, check to see if we are in compatibility mode and provide
  21877. // information on preventing compatibility mode
  21878. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  21879. process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
  21880. var expectedFeatures = [
  21881. // shims
  21882. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
  21883. for (var i = 0; i < expectedFeatures.length; i++) {
  21884. if (!expectedFeatures[i]) {
  21885. process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
  21886. break;
  21887. }
  21888. }
  21889. }
  21890. }
  21891. if (false) {
  21892. var ReactInstrumentation = require('./ReactInstrumentation');
  21893. var ReactDOMUnknownPropertyHook = require('./ReactDOMUnknownPropertyHook');
  21894. var ReactDOMNullInputValuePropHook = require('./ReactDOMNullInputValuePropHook');
  21895. var ReactDOMInvalidARIAHook = require('./ReactDOMInvalidARIAHook');
  21896. ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
  21897. ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
  21898. ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
  21899. }
  21900. module.exports = ReactDOM;
  21901. /***/ }),
  21902. /* 155 */
  21903. /***/ (function(module, exports, __webpack_require__) {
  21904. "use strict";
  21905. /**
  21906. * Copyright 2013-present, Facebook, Inc.
  21907. * All rights reserved.
  21908. *
  21909. * This source code is licensed under the BSD-style license found in the
  21910. * LICENSE file in the root directory of this source tree. An additional grant
  21911. * of patent rights can be found in the PATENTS file in the same directory.
  21912. *
  21913. */
  21914. /* global hasOwnProperty:true */
  21915. var _prodInvariant = __webpack_require__(2),
  21916. _assign = __webpack_require__(3);
  21917. var AutoFocusUtils = __webpack_require__(142);
  21918. var CSSPropertyOperations = __webpack_require__(144);
  21919. var DOMLazyTree = __webpack_require__(17);
  21920. var DOMNamespaces = __webpack_require__(36);
  21921. var DOMProperty = __webpack_require__(18);
  21922. var DOMPropertyOperations = __webpack_require__(60);
  21923. var EventPluginHub = __webpack_require__(24);
  21924. var EventPluginRegistry = __webpack_require__(37);
  21925. var ReactBrowserEventEmitter = __webpack_require__(28);
  21926. var ReactDOMComponentFlags = __webpack_require__(61);
  21927. var ReactDOMComponentTree = __webpack_require__(4);
  21928. var ReactDOMInput = __webpack_require__(160);
  21929. var ReactDOMOption = __webpack_require__(161);
  21930. var ReactDOMSelect = __webpack_require__(62);
  21931. var ReactDOMTextarea = __webpack_require__(164);
  21932. var ReactInstrumentation = __webpack_require__(10);
  21933. var ReactMultiChild = __webpack_require__(173);
  21934. var ReactServerRenderingTransaction = __webpack_require__(178);
  21935. var emptyFunction = __webpack_require__(9);
  21936. var escapeTextContentForBrowser = __webpack_require__(31);
  21937. var invariant = __webpack_require__(0);
  21938. var isEventSupported = __webpack_require__(48);
  21939. var shallowEqual = __webpack_require__(34);
  21940. var validateDOMNesting = __webpack_require__(50);
  21941. var warning = __webpack_require__(1);
  21942. var Flags = ReactDOMComponentFlags;
  21943. var deleteListener = EventPluginHub.deleteListener;
  21944. var getNode = ReactDOMComponentTree.getNodeFromInstance;
  21945. var listenTo = ReactBrowserEventEmitter.listenTo;
  21946. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  21947. // For quickly matching children type, to test if can be treated as content.
  21948. var CONTENT_TYPES = { 'string': true, 'number': true };
  21949. var STYLE = 'style';
  21950. var HTML = '__html';
  21951. var RESERVED_PROPS = {
  21952. children: null,
  21953. dangerouslySetInnerHTML: null,
  21954. suppressContentEditableWarning: null
  21955. };
  21956. // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
  21957. var DOC_FRAGMENT_TYPE = 11;
  21958. function getDeclarationErrorAddendum(internalInstance) {
  21959. if (internalInstance) {
  21960. var owner = internalInstance._currentElement._owner || null;
  21961. if (owner) {
  21962. var name = owner.getName();
  21963. if (name) {
  21964. return ' This DOM node was rendered by `' + name + '`.';
  21965. }
  21966. }
  21967. }
  21968. return '';
  21969. }
  21970. function friendlyStringify(obj) {
  21971. if (typeof obj === 'object') {
  21972. if (Array.isArray(obj)) {
  21973. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  21974. } else {
  21975. var pairs = [];
  21976. for (var key in obj) {
  21977. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  21978. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  21979. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  21980. }
  21981. }
  21982. return '{' + pairs.join(', ') + '}';
  21983. }
  21984. } else if (typeof obj === 'string') {
  21985. return JSON.stringify(obj);
  21986. } else if (typeof obj === 'function') {
  21987. return '[function object]';
  21988. }
  21989. // Differs from JSON.stringify in that undefined because undefined and that
  21990. // inf and nan don't become null
  21991. return String(obj);
  21992. }
  21993. var styleMutationWarning = {};
  21994. function checkAndWarnForMutatedStyle(style1, style2, component) {
  21995. if (style1 == null || style2 == null) {
  21996. return;
  21997. }
  21998. if (shallowEqual(style1, style2)) {
  21999. return;
  22000. }
  22001. var componentName = component._tag;
  22002. var owner = component._currentElement._owner;
  22003. var ownerName;
  22004. if (owner) {
  22005. ownerName = owner.getName();
  22006. }
  22007. var hash = ownerName + '|' + componentName;
  22008. if (styleMutationWarning.hasOwnProperty(hash)) {
  22009. return;
  22010. }
  22011. styleMutationWarning[hash] = true;
  22012. false ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
  22013. }
  22014. /**
  22015. * @param {object} component
  22016. * @param {?object} props
  22017. */
  22018. function assertValidProps(component, props) {
  22019. if (!props) {
  22020. return;
  22021. }
  22022. // Note the use of `==` which checks for null or undefined.
  22023. if (voidElementTags[component._tag]) {
  22024. !(props.children == null && props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0;
  22025. }
  22026. if (props.dangerouslySetInnerHTML != null) {
  22027. !(props.children == null) ? false ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
  22028. !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? false ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : _prodInvariant('61') : void 0;
  22029. }
  22030. if (false) {
  22031. process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
  22032. process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, '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.') : void 0;
  22033. process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, '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.') : void 0;
  22034. }
  22035. !(props.style == null || typeof props.style === 'object') ? false ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(component)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0;
  22036. }
  22037. function enqueuePutListener(inst, registrationName, listener, transaction) {
  22038. if (transaction instanceof ReactServerRenderingTransaction) {
  22039. return;
  22040. }
  22041. if (false) {
  22042. // IE8 has no API for event capturing and the `onScroll` event doesn't
  22043. // bubble.
  22044. process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
  22045. }
  22046. var containerInfo = inst._hostContainerInfo;
  22047. var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
  22048. var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
  22049. listenTo(registrationName, doc);
  22050. transaction.getReactMountReady().enqueue(putListener, {
  22051. inst: inst,
  22052. registrationName: registrationName,
  22053. listener: listener
  22054. });
  22055. }
  22056. function putListener() {
  22057. var listenerToPut = this;
  22058. EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
  22059. }
  22060. function inputPostMount() {
  22061. var inst = this;
  22062. ReactDOMInput.postMountWrapper(inst);
  22063. }
  22064. function textareaPostMount() {
  22065. var inst = this;
  22066. ReactDOMTextarea.postMountWrapper(inst);
  22067. }
  22068. function optionPostMount() {
  22069. var inst = this;
  22070. ReactDOMOption.postMountWrapper(inst);
  22071. }
  22072. var setAndValidateContentChildDev = emptyFunction;
  22073. if (false) {
  22074. setAndValidateContentChildDev = function (content) {
  22075. var hasExistingContent = this._contentDebugID != null;
  22076. var debugID = this._debugID;
  22077. // This ID represents the inlined child that has no backing instance:
  22078. var contentDebugID = -debugID;
  22079. if (content == null) {
  22080. if (hasExistingContent) {
  22081. ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
  22082. }
  22083. this._contentDebugID = null;
  22084. return;
  22085. }
  22086. validateDOMNesting(null, String(content), this, this._ancestorInfo);
  22087. this._contentDebugID = contentDebugID;
  22088. if (hasExistingContent) {
  22089. ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
  22090. ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
  22091. } else {
  22092. ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
  22093. ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
  22094. ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
  22095. }
  22096. };
  22097. }
  22098. // There are so many media events, it makes sense to just
  22099. // maintain a list rather than create a `trapBubbledEvent` for each
  22100. var mediaEvents = {
  22101. topAbort: 'abort',
  22102. topCanPlay: 'canplay',
  22103. topCanPlayThrough: 'canplaythrough',
  22104. topDurationChange: 'durationchange',
  22105. topEmptied: 'emptied',
  22106. topEncrypted: 'encrypted',
  22107. topEnded: 'ended',
  22108. topError: 'error',
  22109. topLoadedData: 'loadeddata',
  22110. topLoadedMetadata: 'loadedmetadata',
  22111. topLoadStart: 'loadstart',
  22112. topPause: 'pause',
  22113. topPlay: 'play',
  22114. topPlaying: 'playing',
  22115. topProgress: 'progress',
  22116. topRateChange: 'ratechange',
  22117. topSeeked: 'seeked',
  22118. topSeeking: 'seeking',
  22119. topStalled: 'stalled',
  22120. topSuspend: 'suspend',
  22121. topTimeUpdate: 'timeupdate',
  22122. topVolumeChange: 'volumechange',
  22123. topWaiting: 'waiting'
  22124. };
  22125. function trapBubbledEventsLocal() {
  22126. var inst = this;
  22127. // If a component renders to null or if another component fatals and causes
  22128. // the state of the tree to be corrupted, `node` here can be null.
  22129. !inst._rootNodeID ? false ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
  22130. var node = getNode(inst);
  22131. !node ? false ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
  22132. switch (inst._tag) {
  22133. case 'iframe':
  22134. case 'object':
  22135. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  22136. break;
  22137. case 'video':
  22138. case 'audio':
  22139. inst._wrapperState.listeners = [];
  22140. // Create listener for each media event
  22141. for (var event in mediaEvents) {
  22142. if (mediaEvents.hasOwnProperty(event)) {
  22143. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
  22144. }
  22145. }
  22146. break;
  22147. case 'source':
  22148. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
  22149. break;
  22150. case 'img':
  22151. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  22152. break;
  22153. case 'form':
  22154. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
  22155. break;
  22156. case 'input':
  22157. case 'select':
  22158. case 'textarea':
  22159. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
  22160. break;
  22161. }
  22162. }
  22163. function postUpdateSelectWrapper() {
  22164. ReactDOMSelect.postUpdateWrapper(this);
  22165. }
  22166. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  22167. // those special-case tags.
  22168. var omittedCloseTags = {
  22169. 'area': true,
  22170. 'base': true,
  22171. 'br': true,
  22172. 'col': true,
  22173. 'embed': true,
  22174. 'hr': true,
  22175. 'img': true,
  22176. 'input': true,
  22177. 'keygen': true,
  22178. 'link': true,
  22179. 'meta': true,
  22180. 'param': true,
  22181. 'source': true,
  22182. 'track': true,
  22183. 'wbr': true
  22184. };
  22185. var newlineEatingTags = {
  22186. 'listing': true,
  22187. 'pre': true,
  22188. 'textarea': true
  22189. };
  22190. // For HTML, certain tags cannot have children. This has the same purpose as
  22191. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  22192. var voidElementTags = _assign({
  22193. 'menuitem': true
  22194. }, omittedCloseTags);
  22195. // We accept any tag to be rendered but since this gets injected into arbitrary
  22196. // HTML, we want to make sure that it's a safe tag.
  22197. // http://www.w3.org/TR/REC-xml/#NT-Name
  22198. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  22199. var validatedTagCache = {};
  22200. var hasOwnProperty = {}.hasOwnProperty;
  22201. function validateDangerousTag(tag) {
  22202. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  22203. !VALID_TAG_REGEX.test(tag) ? false ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
  22204. validatedTagCache[tag] = true;
  22205. }
  22206. }
  22207. function isCustomComponent(tagName, props) {
  22208. return tagName.indexOf('-') >= 0 || props.is != null;
  22209. }
  22210. var globalIdCounter = 1;
  22211. /**
  22212. * Creates a new React class that is idempotent and capable of containing other
  22213. * React components. It accepts event listeners and DOM properties that are
  22214. * valid according to `DOMProperty`.
  22215. *
  22216. * - Event listeners: `onClick`, `onMouseDown`, etc.
  22217. * - DOM properties: `className`, `name`, `title`, etc.
  22218. *
  22219. * The `style` property functions differently from the DOM API. It accepts an
  22220. * object mapping of style properties to values.
  22221. *
  22222. * @constructor ReactDOMComponent
  22223. * @extends ReactMultiChild
  22224. */
  22225. function ReactDOMComponent(element) {
  22226. var tag = element.type;
  22227. validateDangerousTag(tag);
  22228. this._currentElement = element;
  22229. this._tag = tag.toLowerCase();
  22230. this._namespaceURI = null;
  22231. this._renderedChildren = null;
  22232. this._previousStyle = null;
  22233. this._previousStyleCopy = null;
  22234. this._hostNode = null;
  22235. this._hostParent = null;
  22236. this._rootNodeID = 0;
  22237. this._domID = 0;
  22238. this._hostContainerInfo = null;
  22239. this._wrapperState = null;
  22240. this._topLevelWrapper = null;
  22241. this._flags = 0;
  22242. if (false) {
  22243. this._ancestorInfo = null;
  22244. setAndValidateContentChildDev.call(this, null);
  22245. }
  22246. }
  22247. ReactDOMComponent.displayName = 'ReactDOMComponent';
  22248. ReactDOMComponent.Mixin = {
  22249. /**
  22250. * Generates root tag markup then recurses. This method has side effects and
  22251. * is not idempotent.
  22252. *
  22253. * @internal
  22254. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  22255. * @param {?ReactDOMComponent} the parent component instance
  22256. * @param {?object} info about the host container
  22257. * @param {object} context
  22258. * @return {string} The computed markup.
  22259. */
  22260. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  22261. this._rootNodeID = globalIdCounter++;
  22262. this._domID = hostContainerInfo._idCounter++;
  22263. this._hostParent = hostParent;
  22264. this._hostContainerInfo = hostContainerInfo;
  22265. var props = this._currentElement.props;
  22266. switch (this._tag) {
  22267. case 'audio':
  22268. case 'form':
  22269. case 'iframe':
  22270. case 'img':
  22271. case 'link':
  22272. case 'object':
  22273. case 'source':
  22274. case 'video':
  22275. this._wrapperState = {
  22276. listeners: null
  22277. };
  22278. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  22279. break;
  22280. case 'input':
  22281. ReactDOMInput.mountWrapper(this, props, hostParent);
  22282. props = ReactDOMInput.getHostProps(this, props);
  22283. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  22284. break;
  22285. case 'option':
  22286. ReactDOMOption.mountWrapper(this, props, hostParent);
  22287. props = ReactDOMOption.getHostProps(this, props);
  22288. break;
  22289. case 'select':
  22290. ReactDOMSelect.mountWrapper(this, props, hostParent);
  22291. props = ReactDOMSelect.getHostProps(this, props);
  22292. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  22293. break;
  22294. case 'textarea':
  22295. ReactDOMTextarea.mountWrapper(this, props, hostParent);
  22296. props = ReactDOMTextarea.getHostProps(this, props);
  22297. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  22298. break;
  22299. }
  22300. assertValidProps(this, props);
  22301. // We create tags in the namespace of their parent container, except HTML
  22302. // tags get no namespace.
  22303. var namespaceURI;
  22304. var parentTag;
  22305. if (hostParent != null) {
  22306. namespaceURI = hostParent._namespaceURI;
  22307. parentTag = hostParent._tag;
  22308. } else if (hostContainerInfo._tag) {
  22309. namespaceURI = hostContainerInfo._namespaceURI;
  22310. parentTag = hostContainerInfo._tag;
  22311. }
  22312. if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
  22313. namespaceURI = DOMNamespaces.html;
  22314. }
  22315. if (namespaceURI === DOMNamespaces.html) {
  22316. if (this._tag === 'svg') {
  22317. namespaceURI = DOMNamespaces.svg;
  22318. } else if (this._tag === 'math') {
  22319. namespaceURI = DOMNamespaces.mathml;
  22320. }
  22321. }
  22322. this._namespaceURI = namespaceURI;
  22323. if (false) {
  22324. var parentInfo;
  22325. if (hostParent != null) {
  22326. parentInfo = hostParent._ancestorInfo;
  22327. } else if (hostContainerInfo._tag) {
  22328. parentInfo = hostContainerInfo._ancestorInfo;
  22329. }
  22330. if (parentInfo) {
  22331. // parentInfo should always be present except for the top-level
  22332. // component when server rendering
  22333. validateDOMNesting(this._tag, null, this, parentInfo);
  22334. }
  22335. this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
  22336. }
  22337. var mountImage;
  22338. if (transaction.useCreateElement) {
  22339. var ownerDocument = hostContainerInfo._ownerDocument;
  22340. var el;
  22341. if (namespaceURI === DOMNamespaces.html) {
  22342. if (this._tag === 'script') {
  22343. // Create the script via .innerHTML so its "parser-inserted" flag is
  22344. // set to true and it does not execute
  22345. var div = ownerDocument.createElement('div');
  22346. var type = this._currentElement.type;
  22347. div.innerHTML = '<' + type + '></' + type + '>';
  22348. el = div.removeChild(div.firstChild);
  22349. } else if (props.is) {
  22350. el = ownerDocument.createElement(this._currentElement.type, props.is);
  22351. } else {
  22352. // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
  22353. // See discussion in https://github.com/facebook/react/pull/6896
  22354. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  22355. el = ownerDocument.createElement(this._currentElement.type);
  22356. }
  22357. } else {
  22358. el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
  22359. }
  22360. ReactDOMComponentTree.precacheNode(this, el);
  22361. this._flags |= Flags.hasCachedChildNodes;
  22362. if (!this._hostParent) {
  22363. DOMPropertyOperations.setAttributeForRoot(el);
  22364. }
  22365. this._updateDOMProperties(null, props, transaction);
  22366. var lazyTree = DOMLazyTree(el);
  22367. this._createInitialChildren(transaction, props, context, lazyTree);
  22368. mountImage = lazyTree;
  22369. } else {
  22370. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  22371. var tagContent = this._createContentMarkup(transaction, props, context);
  22372. if (!tagContent && omittedCloseTags[this._tag]) {
  22373. mountImage = tagOpen + '/>';
  22374. } else {
  22375. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  22376. }
  22377. }
  22378. switch (this._tag) {
  22379. case 'input':
  22380. transaction.getReactMountReady().enqueue(inputPostMount, this);
  22381. if (props.autoFocus) {
  22382. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  22383. }
  22384. break;
  22385. case 'textarea':
  22386. transaction.getReactMountReady().enqueue(textareaPostMount, this);
  22387. if (props.autoFocus) {
  22388. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  22389. }
  22390. break;
  22391. case 'select':
  22392. if (props.autoFocus) {
  22393. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  22394. }
  22395. break;
  22396. case 'button':
  22397. if (props.autoFocus) {
  22398. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  22399. }
  22400. break;
  22401. case 'option':
  22402. transaction.getReactMountReady().enqueue(optionPostMount, this);
  22403. break;
  22404. }
  22405. return mountImage;
  22406. },
  22407. /**
  22408. * Creates markup for the open tag and all attributes.
  22409. *
  22410. * This method has side effects because events get registered.
  22411. *
  22412. * Iterating over object properties is faster than iterating over arrays.
  22413. * @see http://jsperf.com/obj-vs-arr-iteration
  22414. *
  22415. * @private
  22416. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  22417. * @param {object} props
  22418. * @return {string} Markup of opening tag.
  22419. */
  22420. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  22421. var ret = '<' + this._currentElement.type;
  22422. for (var propKey in props) {
  22423. if (!props.hasOwnProperty(propKey)) {
  22424. continue;
  22425. }
  22426. var propValue = props[propKey];
  22427. if (propValue == null) {
  22428. continue;
  22429. }
  22430. if (registrationNameModules.hasOwnProperty(propKey)) {
  22431. if (propValue) {
  22432. enqueuePutListener(this, propKey, propValue, transaction);
  22433. }
  22434. } else {
  22435. if (propKey === STYLE) {
  22436. if (propValue) {
  22437. if (false) {
  22438. // See `_updateDOMProperties`. style block
  22439. this._previousStyle = propValue;
  22440. }
  22441. propValue = this._previousStyleCopy = _assign({}, props.style);
  22442. }
  22443. propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
  22444. }
  22445. var markup = null;
  22446. if (this._tag != null && isCustomComponent(this._tag, props)) {
  22447. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  22448. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  22449. }
  22450. } else {
  22451. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  22452. }
  22453. if (markup) {
  22454. ret += ' ' + markup;
  22455. }
  22456. }
  22457. }
  22458. // For static pages, no need to put React ID and checksum. Saves lots of
  22459. // bytes.
  22460. if (transaction.renderToStaticMarkup) {
  22461. return ret;
  22462. }
  22463. if (!this._hostParent) {
  22464. ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
  22465. }
  22466. ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
  22467. return ret;
  22468. },
  22469. /**
  22470. * Creates markup for the content between the tags.
  22471. *
  22472. * @private
  22473. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  22474. * @param {object} props
  22475. * @param {object} context
  22476. * @return {string} Content markup.
  22477. */
  22478. _createContentMarkup: function (transaction, props, context) {
  22479. var ret = '';
  22480. // Intentional use of != to avoid catching zero/false.
  22481. var innerHTML = props.dangerouslySetInnerHTML;
  22482. if (innerHTML != null) {
  22483. if (innerHTML.__html != null) {
  22484. ret = innerHTML.__html;
  22485. }
  22486. } else {
  22487. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  22488. var childrenToUse = contentToUse != null ? null : props.children;
  22489. if (contentToUse != null) {
  22490. // TODO: Validate that text is allowed as a child of this node
  22491. ret = escapeTextContentForBrowser(contentToUse);
  22492. if (false) {
  22493. setAndValidateContentChildDev.call(this, contentToUse);
  22494. }
  22495. } else if (childrenToUse != null) {
  22496. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  22497. ret = mountImages.join('');
  22498. }
  22499. }
  22500. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  22501. // text/html ignores the first character in these tags if it's a newline
  22502. // Prefer to break application/xml over text/html (for now) by adding
  22503. // a newline specifically to get eaten by the parser. (Alternately for
  22504. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  22505. // \r is normalized out by HTMLTextAreaElement#value.)
  22506. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  22507. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  22508. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  22509. // See: Parsing of "textarea" "listing" and "pre" elements
  22510. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  22511. return '\n' + ret;
  22512. } else {
  22513. return ret;
  22514. }
  22515. },
  22516. _createInitialChildren: function (transaction, props, context, lazyTree) {
  22517. // Intentional use of != to avoid catching zero/false.
  22518. var innerHTML = props.dangerouslySetInnerHTML;
  22519. if (innerHTML != null) {
  22520. if (innerHTML.__html != null) {
  22521. DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
  22522. }
  22523. } else {
  22524. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  22525. var childrenToUse = contentToUse != null ? null : props.children;
  22526. // TODO: Validate that text is allowed as a child of this node
  22527. if (contentToUse != null) {
  22528. // Avoid setting textContent when the text is empty. In IE11 setting
  22529. // textContent on a text area will cause the placeholder to not
  22530. // show within the textarea until it has been focused and blurred again.
  22531. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  22532. if (contentToUse !== '') {
  22533. if (false) {
  22534. setAndValidateContentChildDev.call(this, contentToUse);
  22535. }
  22536. DOMLazyTree.queueText(lazyTree, contentToUse);
  22537. }
  22538. } else if (childrenToUse != null) {
  22539. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  22540. for (var i = 0; i < mountImages.length; i++) {
  22541. DOMLazyTree.queueChild(lazyTree, mountImages[i]);
  22542. }
  22543. }
  22544. }
  22545. },
  22546. /**
  22547. * Receives a next element and updates the component.
  22548. *
  22549. * @internal
  22550. * @param {ReactElement} nextElement
  22551. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  22552. * @param {object} context
  22553. */
  22554. receiveComponent: function (nextElement, transaction, context) {
  22555. var prevElement = this._currentElement;
  22556. this._currentElement = nextElement;
  22557. this.updateComponent(transaction, prevElement, nextElement, context);
  22558. },
  22559. /**
  22560. * Updates a DOM component after it has already been allocated and
  22561. * attached to the DOM. Reconciles the root DOM node, then recurses.
  22562. *
  22563. * @param {ReactReconcileTransaction} transaction
  22564. * @param {ReactElement} prevElement
  22565. * @param {ReactElement} nextElement
  22566. * @internal
  22567. * @overridable
  22568. */
  22569. updateComponent: function (transaction, prevElement, nextElement, context) {
  22570. var lastProps = prevElement.props;
  22571. var nextProps = this._currentElement.props;
  22572. switch (this._tag) {
  22573. case 'input':
  22574. lastProps = ReactDOMInput.getHostProps(this, lastProps);
  22575. nextProps = ReactDOMInput.getHostProps(this, nextProps);
  22576. break;
  22577. case 'option':
  22578. lastProps = ReactDOMOption.getHostProps(this, lastProps);
  22579. nextProps = ReactDOMOption.getHostProps(this, nextProps);
  22580. break;
  22581. case 'select':
  22582. lastProps = ReactDOMSelect.getHostProps(this, lastProps);
  22583. nextProps = ReactDOMSelect.getHostProps(this, nextProps);
  22584. break;
  22585. case 'textarea':
  22586. lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
  22587. nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
  22588. break;
  22589. }
  22590. assertValidProps(this, nextProps);
  22591. this._updateDOMProperties(lastProps, nextProps, transaction);
  22592. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  22593. switch (this._tag) {
  22594. case 'input':
  22595. // Update the wrapper around inputs *after* updating props. This has to
  22596. // happen after `_updateDOMProperties`. Otherwise HTML5 input validations
  22597. // raise warnings and prevent the new value from being assigned.
  22598. ReactDOMInput.updateWrapper(this);
  22599. break;
  22600. case 'textarea':
  22601. ReactDOMTextarea.updateWrapper(this);
  22602. break;
  22603. case 'select':
  22604. // <select> value update needs to occur after <option> children
  22605. // reconciliation
  22606. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  22607. break;
  22608. }
  22609. },
  22610. /**
  22611. * Reconciles the properties by detecting differences in property values and
  22612. * updating the DOM as necessary. This function is probably the single most
  22613. * critical path for performance optimization.
  22614. *
  22615. * TODO: Benchmark whether checking for changed values in memory actually
  22616. * improves performance (especially statically positioned elements).
  22617. * TODO: Benchmark the effects of putting this at the top since 99% of props
  22618. * do not change for a given reconciliation.
  22619. * TODO: Benchmark areas that can be improved with caching.
  22620. *
  22621. * @private
  22622. * @param {object} lastProps
  22623. * @param {object} nextProps
  22624. * @param {?DOMElement} node
  22625. */
  22626. _updateDOMProperties: function (lastProps, nextProps, transaction) {
  22627. var propKey;
  22628. var styleName;
  22629. var styleUpdates;
  22630. for (propKey in lastProps) {
  22631. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  22632. continue;
  22633. }
  22634. if (propKey === STYLE) {
  22635. var lastStyle = this._previousStyleCopy;
  22636. for (styleName in lastStyle) {
  22637. if (lastStyle.hasOwnProperty(styleName)) {
  22638. styleUpdates = styleUpdates || {};
  22639. styleUpdates[styleName] = '';
  22640. }
  22641. }
  22642. this._previousStyleCopy = null;
  22643. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  22644. if (lastProps[propKey]) {
  22645. // Only call deleteListener if there was a listener previously or
  22646. // else willDeleteListener gets called when there wasn't actually a
  22647. // listener (e.g., onClick={null})
  22648. deleteListener(this, propKey);
  22649. }
  22650. } else if (isCustomComponent(this._tag, lastProps)) {
  22651. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  22652. DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
  22653. }
  22654. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  22655. DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
  22656. }
  22657. }
  22658. for (propKey in nextProps) {
  22659. var nextProp = nextProps[propKey];
  22660. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
  22661. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  22662. continue;
  22663. }
  22664. if (propKey === STYLE) {
  22665. if (nextProp) {
  22666. if (false) {
  22667. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  22668. this._previousStyle = nextProp;
  22669. }
  22670. nextProp = this._previousStyleCopy = _assign({}, nextProp);
  22671. } else {
  22672. this._previousStyleCopy = null;
  22673. }
  22674. if (lastProp) {
  22675. // Unset styles on `lastProp` but not on `nextProp`.
  22676. for (styleName in lastProp) {
  22677. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  22678. styleUpdates = styleUpdates || {};
  22679. styleUpdates[styleName] = '';
  22680. }
  22681. }
  22682. // Update styles that changed since `lastProp`.
  22683. for (styleName in nextProp) {
  22684. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  22685. styleUpdates = styleUpdates || {};
  22686. styleUpdates[styleName] = nextProp[styleName];
  22687. }
  22688. }
  22689. } else {
  22690. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  22691. styleUpdates = nextProp;
  22692. }
  22693. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  22694. if (nextProp) {
  22695. enqueuePutListener(this, propKey, nextProp, transaction);
  22696. } else if (lastProp) {
  22697. deleteListener(this, propKey);
  22698. }
  22699. } else if (isCustomComponent(this._tag, nextProps)) {
  22700. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  22701. DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
  22702. }
  22703. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  22704. var node = getNode(this);
  22705. // If we're updating to null or undefined, we should remove the property
  22706. // from the DOM node instead of inadvertently setting to a string. This
  22707. // brings us in line with the same behavior we have on initial render.
  22708. if (nextProp != null) {
  22709. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  22710. } else {
  22711. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  22712. }
  22713. }
  22714. }
  22715. if (styleUpdates) {
  22716. CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
  22717. }
  22718. },
  22719. /**
  22720. * Reconciles the children with the various properties that affect the
  22721. * children content.
  22722. *
  22723. * @param {object} lastProps
  22724. * @param {object} nextProps
  22725. * @param {ReactReconcileTransaction} transaction
  22726. * @param {object} context
  22727. */
  22728. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  22729. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  22730. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  22731. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  22732. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  22733. // Note the use of `!=` which checks for null or undefined.
  22734. var lastChildren = lastContent != null ? null : lastProps.children;
  22735. var nextChildren = nextContent != null ? null : nextProps.children;
  22736. // If we're switching from children to content/html or vice versa, remove
  22737. // the old content
  22738. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  22739. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  22740. if (lastChildren != null && nextChildren == null) {
  22741. this.updateChildren(null, transaction, context);
  22742. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  22743. this.updateTextContent('');
  22744. if (false) {
  22745. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  22746. }
  22747. }
  22748. if (nextContent != null) {
  22749. if (lastContent !== nextContent) {
  22750. this.updateTextContent('' + nextContent);
  22751. if (false) {
  22752. setAndValidateContentChildDev.call(this, nextContent);
  22753. }
  22754. }
  22755. } else if (nextHtml != null) {
  22756. if (lastHtml !== nextHtml) {
  22757. this.updateMarkup('' + nextHtml);
  22758. }
  22759. if (false) {
  22760. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  22761. }
  22762. } else if (nextChildren != null) {
  22763. if (false) {
  22764. setAndValidateContentChildDev.call(this, null);
  22765. }
  22766. this.updateChildren(nextChildren, transaction, context);
  22767. }
  22768. },
  22769. getHostNode: function () {
  22770. return getNode(this);
  22771. },
  22772. /**
  22773. * Destroys all event registrations for this instance. Does not remove from
  22774. * the DOM. That must be done by the parent.
  22775. *
  22776. * @internal
  22777. */
  22778. unmountComponent: function (safely) {
  22779. switch (this._tag) {
  22780. case 'audio':
  22781. case 'form':
  22782. case 'iframe':
  22783. case 'img':
  22784. case 'link':
  22785. case 'object':
  22786. case 'source':
  22787. case 'video':
  22788. var listeners = this._wrapperState.listeners;
  22789. if (listeners) {
  22790. for (var i = 0; i < listeners.length; i++) {
  22791. listeners[i].remove();
  22792. }
  22793. }
  22794. break;
  22795. case 'html':
  22796. case 'head':
  22797. case 'body':
  22798. /**
  22799. * Components like <html> <head> and <body> can't be removed or added
  22800. * easily in a cross-browser way, however it's valuable to be able to
  22801. * take advantage of React's reconciliation for styling and <title>
  22802. * management. So we just document it and throw in dangerous cases.
  22803. */
  22804. true ? false ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.', this._tag) : _prodInvariant('66', this._tag) : void 0;
  22805. break;
  22806. }
  22807. this.unmountChildren(safely);
  22808. ReactDOMComponentTree.uncacheNode(this);
  22809. EventPluginHub.deleteAllListeners(this);
  22810. this._rootNodeID = 0;
  22811. this._domID = 0;
  22812. this._wrapperState = null;
  22813. if (false) {
  22814. setAndValidateContentChildDev.call(this, null);
  22815. }
  22816. },
  22817. getPublicInstance: function () {
  22818. return getNode(this);
  22819. }
  22820. };
  22821. _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  22822. module.exports = ReactDOMComponent;
  22823. /***/ }),
  22824. /* 156 */
  22825. /***/ (function(module, exports, __webpack_require__) {
  22826. "use strict";
  22827. /**
  22828. * Copyright 2013-present, Facebook, Inc.
  22829. * All rights reserved.
  22830. *
  22831. * This source code is licensed under the BSD-style license found in the
  22832. * LICENSE file in the root directory of this source tree. An additional grant
  22833. * of patent rights can be found in the PATENTS file in the same directory.
  22834. *
  22835. */
  22836. var validateDOMNesting = __webpack_require__(50);
  22837. var DOC_NODE_TYPE = 9;
  22838. function ReactDOMContainerInfo(topLevelWrapper, node) {
  22839. var info = {
  22840. _topLevelWrapper: topLevelWrapper,
  22841. _idCounter: 1,
  22842. _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
  22843. _node: node,
  22844. _tag: node ? node.nodeName.toLowerCase() : null,
  22845. _namespaceURI: node ? node.namespaceURI : null
  22846. };
  22847. if (false) {
  22848. info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
  22849. }
  22850. return info;
  22851. }
  22852. module.exports = ReactDOMContainerInfo;
  22853. /***/ }),
  22854. /* 157 */
  22855. /***/ (function(module, exports, __webpack_require__) {
  22856. "use strict";
  22857. /**
  22858. * Copyright 2014-present, Facebook, Inc.
  22859. * All rights reserved.
  22860. *
  22861. * This source code is licensed under the BSD-style license found in the
  22862. * LICENSE file in the root directory of this source tree. An additional grant
  22863. * of patent rights can be found in the PATENTS file in the same directory.
  22864. *
  22865. */
  22866. var _assign = __webpack_require__(3);
  22867. var DOMLazyTree = __webpack_require__(17);
  22868. var ReactDOMComponentTree = __webpack_require__(4);
  22869. var ReactDOMEmptyComponent = function (instantiate) {
  22870. // ReactCompositeComponent uses this:
  22871. this._currentElement = null;
  22872. // ReactDOMComponentTree uses these:
  22873. this._hostNode = null;
  22874. this._hostParent = null;
  22875. this._hostContainerInfo = null;
  22876. this._domID = 0;
  22877. };
  22878. _assign(ReactDOMEmptyComponent.prototype, {
  22879. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  22880. var domID = hostContainerInfo._idCounter++;
  22881. this._domID = domID;
  22882. this._hostParent = hostParent;
  22883. this._hostContainerInfo = hostContainerInfo;
  22884. var nodeValue = ' react-empty: ' + this._domID + ' ';
  22885. if (transaction.useCreateElement) {
  22886. var ownerDocument = hostContainerInfo._ownerDocument;
  22887. var node = ownerDocument.createComment(nodeValue);
  22888. ReactDOMComponentTree.precacheNode(this, node);
  22889. return DOMLazyTree(node);
  22890. } else {
  22891. if (transaction.renderToStaticMarkup) {
  22892. // Normally we'd insert a comment node, but since this is a situation
  22893. // where React won't take over (static pages), we can simply return
  22894. // nothing.
  22895. return '';
  22896. }
  22897. return '<!--' + nodeValue + '-->';
  22898. }
  22899. },
  22900. receiveComponent: function () {},
  22901. getHostNode: function () {
  22902. return ReactDOMComponentTree.getNodeFromInstance(this);
  22903. },
  22904. unmountComponent: function () {
  22905. ReactDOMComponentTree.uncacheNode(this);
  22906. }
  22907. });
  22908. module.exports = ReactDOMEmptyComponent;
  22909. /***/ }),
  22910. /* 158 */
  22911. /***/ (function(module, exports, __webpack_require__) {
  22912. "use strict";
  22913. /**
  22914. * Copyright 2013-present, Facebook, Inc.
  22915. * All rights reserved.
  22916. *
  22917. * This source code is licensed under the BSD-style license found in the
  22918. * LICENSE file in the root directory of this source tree. An additional grant
  22919. * of patent rights can be found in the PATENTS file in the same directory.
  22920. *
  22921. */
  22922. var ReactDOMFeatureFlags = {
  22923. useCreateElement: true,
  22924. useFiber: false
  22925. };
  22926. module.exports = ReactDOMFeatureFlags;
  22927. /***/ }),
  22928. /* 159 */
  22929. /***/ (function(module, exports, __webpack_require__) {
  22930. "use strict";
  22931. /**
  22932. * Copyright 2013-present, Facebook, Inc.
  22933. * All rights reserved.
  22934. *
  22935. * This source code is licensed under the BSD-style license found in the
  22936. * LICENSE file in the root directory of this source tree. An additional grant
  22937. * of patent rights can be found in the PATENTS file in the same directory.
  22938. *
  22939. */
  22940. var DOMChildrenOperations = __webpack_require__(35);
  22941. var ReactDOMComponentTree = __webpack_require__(4);
  22942. /**
  22943. * Operations used to process updates to DOM nodes.
  22944. */
  22945. var ReactDOMIDOperations = {
  22946. /**
  22947. * Updates a component's children by processing a series of updates.
  22948. *
  22949. * @param {array<object>} updates List of update configurations.
  22950. * @internal
  22951. */
  22952. dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
  22953. var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
  22954. DOMChildrenOperations.processUpdates(node, updates);
  22955. }
  22956. };
  22957. module.exports = ReactDOMIDOperations;
  22958. /***/ }),
  22959. /* 160 */
  22960. /***/ (function(module, exports, __webpack_require__) {
  22961. "use strict";
  22962. /**
  22963. * Copyright 2013-present, Facebook, Inc.
  22964. * All rights reserved.
  22965. *
  22966. * This source code is licensed under the BSD-style license found in the
  22967. * LICENSE file in the root directory of this source tree. An additional grant
  22968. * of patent rights can be found in the PATENTS file in the same directory.
  22969. *
  22970. */
  22971. var _prodInvariant = __webpack_require__(2),
  22972. _assign = __webpack_require__(3);
  22973. var DOMPropertyOperations = __webpack_require__(60);
  22974. var LinkedValueUtils = __webpack_require__(40);
  22975. var ReactDOMComponentTree = __webpack_require__(4);
  22976. var ReactUpdates = __webpack_require__(11);
  22977. var invariant = __webpack_require__(0);
  22978. var warning = __webpack_require__(1);
  22979. var didWarnValueLink = false;
  22980. var didWarnCheckedLink = false;
  22981. var didWarnValueDefaultValue = false;
  22982. var didWarnCheckedDefaultChecked = false;
  22983. var didWarnControlledToUncontrolled = false;
  22984. var didWarnUncontrolledToControlled = false;
  22985. function forceUpdateIfMounted() {
  22986. if (this._rootNodeID) {
  22987. // DOM component is still mounted; update
  22988. ReactDOMInput.updateWrapper(this);
  22989. }
  22990. }
  22991. function isControlled(props) {
  22992. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  22993. return usesChecked ? props.checked != null : props.value != null;
  22994. }
  22995. /**
  22996. * Implements an <input> host component that allows setting these optional
  22997. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  22998. *
  22999. * If `checked` or `value` are not supplied (or null/undefined), user actions
  23000. * that affect the checked state or value will trigger updates to the element.
  23001. *
  23002. * If they are supplied (and not null/undefined), the rendered element will not
  23003. * trigger updates to the element. Instead, the props must change in order for
  23004. * the rendered element to be updated.
  23005. *
  23006. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  23007. * with an empty value (or `defaultValue`).
  23008. *
  23009. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  23010. */
  23011. var ReactDOMInput = {
  23012. getHostProps: function (inst, props) {
  23013. var value = LinkedValueUtils.getValue(props);
  23014. var checked = LinkedValueUtils.getChecked(props);
  23015. var hostProps = _assign({
  23016. // Make sure we set .type before any other properties (setting .value
  23017. // before .type means .value is lost in IE11 and below)
  23018. type: undefined,
  23019. // Make sure we set .step before .value (setting .value before .step
  23020. // means .value is rounded on mount, based upon step precision)
  23021. step: undefined,
  23022. // Make sure we set .min & .max before .value (to ensure proper order
  23023. // in corner cases such as min or max deriving from value, e.g. Issue #7170)
  23024. min: undefined,
  23025. max: undefined
  23026. }, props, {
  23027. defaultChecked: undefined,
  23028. defaultValue: undefined,
  23029. value: value != null ? value : inst._wrapperState.initialValue,
  23030. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  23031. onChange: inst._wrapperState.onChange
  23032. });
  23033. return hostProps;
  23034. },
  23035. mountWrapper: function (inst, props) {
  23036. if (false) {
  23037. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  23038. var owner = inst._currentElement._owner;
  23039. if (props.valueLink !== undefined && !didWarnValueLink) {
  23040. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  23041. didWarnValueLink = true;
  23042. }
  23043. if (props.checkedLink !== undefined && !didWarnCheckedLink) {
  23044. process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  23045. didWarnCheckedLink = true;
  23046. }
  23047. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  23048. process.env.NODE_ENV !== 'production' ? warning(false, '%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', owner && owner.getName() || 'A component', props.type) : void 0;
  23049. didWarnCheckedDefaultChecked = true;
  23050. }
  23051. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  23052. process.env.NODE_ENV !== 'production' ? warning(false, '%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', owner && owner.getName() || 'A component', props.type) : void 0;
  23053. didWarnValueDefaultValue = true;
  23054. }
  23055. }
  23056. var defaultValue = props.defaultValue;
  23057. inst._wrapperState = {
  23058. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  23059. initialValue: props.value != null ? props.value : defaultValue,
  23060. listeners: null,
  23061. onChange: _handleChange.bind(inst)
  23062. };
  23063. if (false) {
  23064. inst._wrapperState.controlled = isControlled(props);
  23065. }
  23066. },
  23067. updateWrapper: function (inst) {
  23068. var props = inst._currentElement.props;
  23069. if (false) {
  23070. var controlled = isControlled(props);
  23071. var owner = inst._currentElement._owner;
  23072. if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  23073. process.env.NODE_ENV !== 'production' ? warning(false, '%s 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', owner && owner.getName() || 'A component', props.type) : void 0;
  23074. didWarnUncontrolledToControlled = true;
  23075. }
  23076. if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  23077. process.env.NODE_ENV !== 'production' ? warning(false, '%s 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', owner && owner.getName() || 'A component', props.type) : void 0;
  23078. didWarnControlledToUncontrolled = true;
  23079. }
  23080. }
  23081. // TODO: Shouldn't this be getChecked(props)?
  23082. var checked = props.checked;
  23083. if (checked != null) {
  23084. DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
  23085. }
  23086. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  23087. var value = LinkedValueUtils.getValue(props);
  23088. if (value != null) {
  23089. // Cast `value` to a string to ensure the value is set correctly. While
  23090. // browsers typically do this as necessary, jsdom doesn't.
  23091. var newValue = '' + value;
  23092. // To avoid side effects (such as losing text selection), only set value if changed
  23093. if (newValue !== node.value) {
  23094. node.value = newValue;
  23095. }
  23096. } else {
  23097. if (props.value == null && props.defaultValue != null) {
  23098. // In Chrome, assigning defaultValue to certain input types triggers input validation.
  23099. // For number inputs, the display value loses trailing decimal points. For email inputs,
  23100. // Chrome raises "The specified value <x> is not a valid email address".
  23101. //
  23102. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  23103. // when the user is inputting text
  23104. //
  23105. // https://github.com/facebook/react/issues/7253
  23106. if (node.defaultValue !== '' + props.defaultValue) {
  23107. node.defaultValue = '' + props.defaultValue;
  23108. }
  23109. }
  23110. if (props.checked == null && props.defaultChecked != null) {
  23111. node.defaultChecked = !!props.defaultChecked;
  23112. }
  23113. }
  23114. },
  23115. postMountWrapper: function (inst) {
  23116. var props = inst._currentElement.props;
  23117. // This is in postMount because we need access to the DOM node, which is not
  23118. // available until after the component has mounted.
  23119. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  23120. // Detach value from defaultValue. We won't do anything if we're working on
  23121. // submit or reset inputs as those values & defaultValues are linked. They
  23122. // are not resetable nodes so this operation doesn't matter and actually
  23123. // removes browser-default values (eg "Submit Query") when no value is
  23124. // provided.
  23125. switch (props.type) {
  23126. case 'submit':
  23127. case 'reset':
  23128. break;
  23129. case 'color':
  23130. case 'date':
  23131. case 'datetime':
  23132. case 'datetime-local':
  23133. case 'month':
  23134. case 'time':
  23135. case 'week':
  23136. // This fixes the no-show issue on iOS Safari and Android Chrome:
  23137. // https://github.com/facebook/react/issues/7233
  23138. node.value = '';
  23139. node.value = node.defaultValue;
  23140. break;
  23141. default:
  23142. node.value = node.value;
  23143. break;
  23144. }
  23145. // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  23146. // this is needed to work around a chrome bug where setting defaultChecked
  23147. // will sometimes influence the value of checked (even after detachment).
  23148. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  23149. // We need to temporarily unset name to avoid disrupting radio button groups.
  23150. var name = node.name;
  23151. if (name !== '') {
  23152. node.name = '';
  23153. }
  23154. node.defaultChecked = !node.defaultChecked;
  23155. node.defaultChecked = !node.defaultChecked;
  23156. if (name !== '') {
  23157. node.name = name;
  23158. }
  23159. }
  23160. };
  23161. function _handleChange(event) {
  23162. var props = this._currentElement.props;
  23163. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  23164. // Here we use asap to wait until all updates have propagated, which
  23165. // is important when using controlled components within layers:
  23166. // https://github.com/facebook/react/issues/1698
  23167. ReactUpdates.asap(forceUpdateIfMounted, this);
  23168. var name = props.name;
  23169. if (props.type === 'radio' && name != null) {
  23170. var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
  23171. var queryRoot = rootNode;
  23172. while (queryRoot.parentNode) {
  23173. queryRoot = queryRoot.parentNode;
  23174. }
  23175. // If `rootNode.form` was non-null, then we could try `form.elements`,
  23176. // but that sometimes behaves strangely in IE8. We could also try using
  23177. // `form.getElementsByName`, but that will only return direct children
  23178. // and won't include inputs that use the HTML5 `form=` attribute. Since
  23179. // the input might not even be in a form, let's just use the global
  23180. // `querySelectorAll` to ensure we don't miss anything.
  23181. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  23182. for (var i = 0; i < group.length; i++) {
  23183. var otherNode = group[i];
  23184. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  23185. continue;
  23186. }
  23187. // This will throw if radio buttons rendered by different copies of React
  23188. // and the same name are rendered into the same form (same as #1939).
  23189. // That's probably okay; we don't support it just as we don't support
  23190. // mixing React radio buttons with non-React ones.
  23191. var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
  23192. !otherInstance ? false ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
  23193. // If this is a controlled radio button group, forcing the input that
  23194. // was previously checked to update will cause it to be come re-checked
  23195. // as appropriate.
  23196. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  23197. }
  23198. }
  23199. return returnValue;
  23200. }
  23201. module.exports = ReactDOMInput;
  23202. /***/ }),
  23203. /* 161 */
  23204. /***/ (function(module, exports, __webpack_require__) {
  23205. "use strict";
  23206. /**
  23207. * Copyright 2013-present, Facebook, Inc.
  23208. * All rights reserved.
  23209. *
  23210. * This source code is licensed under the BSD-style license found in the
  23211. * LICENSE file in the root directory of this source tree. An additional grant
  23212. * of patent rights can be found in the PATENTS file in the same directory.
  23213. *
  23214. */
  23215. var _assign = __webpack_require__(3);
  23216. var React = __webpack_require__(20);
  23217. var ReactDOMComponentTree = __webpack_require__(4);
  23218. var ReactDOMSelect = __webpack_require__(62);
  23219. var warning = __webpack_require__(1);
  23220. var didWarnInvalidOptionChildren = false;
  23221. function flattenChildren(children) {
  23222. var content = '';
  23223. // Flatten children and warn if they aren't strings or numbers;
  23224. // invalid types are ignored.
  23225. React.Children.forEach(children, function (child) {
  23226. if (child == null) {
  23227. return;
  23228. }
  23229. if (typeof child === 'string' || typeof child === 'number') {
  23230. content += child;
  23231. } else if (!didWarnInvalidOptionChildren) {
  23232. didWarnInvalidOptionChildren = true;
  23233. false ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
  23234. }
  23235. });
  23236. return content;
  23237. }
  23238. /**
  23239. * Implements an <option> host component that warns when `selected` is set.
  23240. */
  23241. var ReactDOMOption = {
  23242. mountWrapper: function (inst, props, hostParent) {
  23243. // TODO (yungsters): Remove support for `selected` in <option>.
  23244. if (false) {
  23245. process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
  23246. }
  23247. // Look up whether this option is 'selected'
  23248. var selectValue = null;
  23249. if (hostParent != null) {
  23250. var selectParent = hostParent;
  23251. if (selectParent._tag === 'optgroup') {
  23252. selectParent = selectParent._hostParent;
  23253. }
  23254. if (selectParent != null && selectParent._tag === 'select') {
  23255. selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
  23256. }
  23257. }
  23258. // If the value is null (e.g., no specified value or after initial mount)
  23259. // or missing (e.g., for <datalist>), we don't change props.selected
  23260. var selected = null;
  23261. if (selectValue != null) {
  23262. var value;
  23263. if (props.value != null) {
  23264. value = props.value + '';
  23265. } else {
  23266. value = flattenChildren(props.children);
  23267. }
  23268. selected = false;
  23269. if (Array.isArray(selectValue)) {
  23270. // multiple
  23271. for (var i = 0; i < selectValue.length; i++) {
  23272. if ('' + selectValue[i] === value) {
  23273. selected = true;
  23274. break;
  23275. }
  23276. }
  23277. } else {
  23278. selected = '' + selectValue === value;
  23279. }
  23280. }
  23281. inst._wrapperState = { selected: selected };
  23282. },
  23283. postMountWrapper: function (inst) {
  23284. // value="" should make a value attribute (#6219)
  23285. var props = inst._currentElement.props;
  23286. if (props.value != null) {
  23287. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  23288. node.setAttribute('value', props.value);
  23289. }
  23290. },
  23291. getHostProps: function (inst, props) {
  23292. var hostProps = _assign({ selected: undefined, children: undefined }, props);
  23293. // Read state only from initial mount because <select> updates value
  23294. // manually; we need the initial state only for server rendering
  23295. if (inst._wrapperState.selected != null) {
  23296. hostProps.selected = inst._wrapperState.selected;
  23297. }
  23298. var content = flattenChildren(props.children);
  23299. if (content) {
  23300. hostProps.children = content;
  23301. }
  23302. return hostProps;
  23303. }
  23304. };
  23305. module.exports = ReactDOMOption;
  23306. /***/ }),
  23307. /* 162 */
  23308. /***/ (function(module, exports, __webpack_require__) {
  23309. "use strict";
  23310. /**
  23311. * Copyright 2013-present, Facebook, Inc.
  23312. * All rights reserved.
  23313. *
  23314. * This source code is licensed under the BSD-style license found in the
  23315. * LICENSE file in the root directory of this source tree. An additional grant
  23316. * of patent rights can be found in the PATENTS file in the same directory.
  23317. *
  23318. */
  23319. var ExecutionEnvironment = __webpack_require__(5);
  23320. var getNodeForCharacterOffset = __webpack_require__(201);
  23321. var getTextContentAccessor = __webpack_require__(73);
  23322. /**
  23323. * While `isCollapsed` is available on the Selection object and `collapsed`
  23324. * is available on the Range object, IE11 sometimes gets them wrong.
  23325. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  23326. */
  23327. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  23328. return anchorNode === focusNode && anchorOffset === focusOffset;
  23329. }
  23330. /**
  23331. * Get the appropriate anchor and focus node/offset pairs for IE.
  23332. *
  23333. * The catch here is that IE's selection API doesn't provide information
  23334. * about whether the selection is forward or backward, so we have to
  23335. * behave as though it's always forward.
  23336. *
  23337. * IE text differs from modern selection in that it behaves as though
  23338. * block elements end with a new line. This means character offsets will
  23339. * differ between the two APIs.
  23340. *
  23341. * @param {DOMElement} node
  23342. * @return {object}
  23343. */
  23344. function getIEOffsets(node) {
  23345. var selection = document.selection;
  23346. var selectedRange = selection.createRange();
  23347. var selectedLength = selectedRange.text.length;
  23348. // Duplicate selection so we can move range without breaking user selection.
  23349. var fromStart = selectedRange.duplicate();
  23350. fromStart.moveToElementText(node);
  23351. fromStart.setEndPoint('EndToStart', selectedRange);
  23352. var startOffset = fromStart.text.length;
  23353. var endOffset = startOffset + selectedLength;
  23354. return {
  23355. start: startOffset,
  23356. end: endOffset
  23357. };
  23358. }
  23359. /**
  23360. * @param {DOMElement} node
  23361. * @return {?object}
  23362. */
  23363. function getModernOffsets(node) {
  23364. var selection = window.getSelection && window.getSelection();
  23365. if (!selection || selection.rangeCount === 0) {
  23366. return null;
  23367. }
  23368. var anchorNode = selection.anchorNode;
  23369. var anchorOffset = selection.anchorOffset;
  23370. var focusNode = selection.focusNode;
  23371. var focusOffset = selection.focusOffset;
  23372. var currentRange = selection.getRangeAt(0);
  23373. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  23374. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  23375. // divs do not seem to expose properties, triggering a "Permission denied
  23376. // error" if any of its properties are accessed. The only seemingly possible
  23377. // way to avoid erroring is to access a property that typically works for
  23378. // non-anonymous divs and catch any error that may otherwise arise. See
  23379. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  23380. try {
  23381. /* eslint-disable no-unused-expressions */
  23382. currentRange.startContainer.nodeType;
  23383. currentRange.endContainer.nodeType;
  23384. /* eslint-enable no-unused-expressions */
  23385. } catch (e) {
  23386. return null;
  23387. }
  23388. // If the node and offset values are the same, the selection is collapsed.
  23389. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  23390. // this value wrong.
  23391. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  23392. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  23393. var tempRange = currentRange.cloneRange();
  23394. tempRange.selectNodeContents(node);
  23395. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  23396. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  23397. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  23398. var end = start + rangeLength;
  23399. // Detect whether the selection is backward.
  23400. var detectionRange = document.createRange();
  23401. detectionRange.setStart(anchorNode, anchorOffset);
  23402. detectionRange.setEnd(focusNode, focusOffset);
  23403. var isBackward = detectionRange.collapsed;
  23404. return {
  23405. start: isBackward ? end : start,
  23406. end: isBackward ? start : end
  23407. };
  23408. }
  23409. /**
  23410. * @param {DOMElement|DOMTextNode} node
  23411. * @param {object} offsets
  23412. */
  23413. function setIEOffsets(node, offsets) {
  23414. var range = document.selection.createRange().duplicate();
  23415. var start, end;
  23416. if (offsets.end === undefined) {
  23417. start = offsets.start;
  23418. end = start;
  23419. } else if (offsets.start > offsets.end) {
  23420. start = offsets.end;
  23421. end = offsets.start;
  23422. } else {
  23423. start = offsets.start;
  23424. end = offsets.end;
  23425. }
  23426. range.moveToElementText(node);
  23427. range.moveStart('character', start);
  23428. range.setEndPoint('EndToStart', range);
  23429. range.moveEnd('character', end - start);
  23430. range.select();
  23431. }
  23432. /**
  23433. * In modern non-IE browsers, we can support both forward and backward
  23434. * selections.
  23435. *
  23436. * Note: IE10+ supports the Selection object, but it does not support
  23437. * the `extend` method, which means that even in modern IE, it's not possible
  23438. * to programmatically create a backward selection. Thus, for all IE
  23439. * versions, we use the old IE API to create our selections.
  23440. *
  23441. * @param {DOMElement|DOMTextNode} node
  23442. * @param {object} offsets
  23443. */
  23444. function setModernOffsets(node, offsets) {
  23445. if (!window.getSelection) {
  23446. return;
  23447. }
  23448. var selection = window.getSelection();
  23449. var length = node[getTextContentAccessor()].length;
  23450. var start = Math.min(offsets.start, length);
  23451. var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  23452. // IE 11 uses modern selection, but doesn't support the extend method.
  23453. // Flip backward selections, so we can set with a single range.
  23454. if (!selection.extend && start > end) {
  23455. var temp = end;
  23456. end = start;
  23457. start = temp;
  23458. }
  23459. var startMarker = getNodeForCharacterOffset(node, start);
  23460. var endMarker = getNodeForCharacterOffset(node, end);
  23461. if (startMarker && endMarker) {
  23462. var range = document.createRange();
  23463. range.setStart(startMarker.node, startMarker.offset);
  23464. selection.removeAllRanges();
  23465. if (start > end) {
  23466. selection.addRange(range);
  23467. selection.extend(endMarker.node, endMarker.offset);
  23468. } else {
  23469. range.setEnd(endMarker.node, endMarker.offset);
  23470. selection.addRange(range);
  23471. }
  23472. }
  23473. }
  23474. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  23475. var ReactDOMSelection = {
  23476. /**
  23477. * @param {DOMElement} node
  23478. */
  23479. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  23480. /**
  23481. * @param {DOMElement|DOMTextNode} node
  23482. * @param {object} offsets
  23483. */
  23484. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  23485. };
  23486. module.exports = ReactDOMSelection;
  23487. /***/ }),
  23488. /* 163 */
  23489. /***/ (function(module, exports, __webpack_require__) {
  23490. "use strict";
  23491. /**
  23492. * Copyright 2013-present, Facebook, Inc.
  23493. * All rights reserved.
  23494. *
  23495. * This source code is licensed under the BSD-style license found in the
  23496. * LICENSE file in the root directory of this source tree. An additional grant
  23497. * of patent rights can be found in the PATENTS file in the same directory.
  23498. *
  23499. */
  23500. var _prodInvariant = __webpack_require__(2),
  23501. _assign = __webpack_require__(3);
  23502. var DOMChildrenOperations = __webpack_require__(35);
  23503. var DOMLazyTree = __webpack_require__(17);
  23504. var ReactDOMComponentTree = __webpack_require__(4);
  23505. var escapeTextContentForBrowser = __webpack_require__(31);
  23506. var invariant = __webpack_require__(0);
  23507. var validateDOMNesting = __webpack_require__(50);
  23508. /**
  23509. * Text nodes violate a couple assumptions that React makes about components:
  23510. *
  23511. * - When mounting text into the DOM, adjacent text nodes are merged.
  23512. * - Text nodes cannot be assigned a React root ID.
  23513. *
  23514. * This component is used to wrap strings between comment nodes so that they
  23515. * can undergo the same reconciliation that is applied to elements.
  23516. *
  23517. * TODO: Investigate representing React components in the DOM with text nodes.
  23518. *
  23519. * @class ReactDOMTextComponent
  23520. * @extends ReactComponent
  23521. * @internal
  23522. */
  23523. var ReactDOMTextComponent = function (text) {
  23524. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  23525. this._currentElement = text;
  23526. this._stringText = '' + text;
  23527. // ReactDOMComponentTree uses these:
  23528. this._hostNode = null;
  23529. this._hostParent = null;
  23530. // Properties
  23531. this._domID = 0;
  23532. this._mountIndex = 0;
  23533. this._closingComment = null;
  23534. this._commentNodes = null;
  23535. };
  23536. _assign(ReactDOMTextComponent.prototype, {
  23537. /**
  23538. * Creates the markup for this text node. This node is not intended to have
  23539. * any features besides containing text content.
  23540. *
  23541. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  23542. * @return {string} Markup for this text node.
  23543. * @internal
  23544. */
  23545. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  23546. if (false) {
  23547. var parentInfo;
  23548. if (hostParent != null) {
  23549. parentInfo = hostParent._ancestorInfo;
  23550. } else if (hostContainerInfo != null) {
  23551. parentInfo = hostContainerInfo._ancestorInfo;
  23552. }
  23553. if (parentInfo) {
  23554. // parentInfo should always be present except for the top-level
  23555. // component when server rendering
  23556. validateDOMNesting(null, this._stringText, this, parentInfo);
  23557. }
  23558. }
  23559. var domID = hostContainerInfo._idCounter++;
  23560. var openingValue = ' react-text: ' + domID + ' ';
  23561. var closingValue = ' /react-text ';
  23562. this._domID = domID;
  23563. this._hostParent = hostParent;
  23564. if (transaction.useCreateElement) {
  23565. var ownerDocument = hostContainerInfo._ownerDocument;
  23566. var openingComment = ownerDocument.createComment(openingValue);
  23567. var closingComment = ownerDocument.createComment(closingValue);
  23568. var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
  23569. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
  23570. if (this._stringText) {
  23571. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
  23572. }
  23573. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
  23574. ReactDOMComponentTree.precacheNode(this, openingComment);
  23575. this._closingComment = closingComment;
  23576. return lazyTree;
  23577. } else {
  23578. var escapedText = escapeTextContentForBrowser(this._stringText);
  23579. if (transaction.renderToStaticMarkup) {
  23580. // Normally we'd wrap this between comment nodes for the reasons stated
  23581. // above, but since this is a situation where React won't take over
  23582. // (static pages), we can simply return the text as it is.
  23583. return escapedText;
  23584. }
  23585. return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
  23586. }
  23587. },
  23588. /**
  23589. * Updates this component by updating the text content.
  23590. *
  23591. * @param {ReactText} nextText The next text content
  23592. * @param {ReactReconcileTransaction} transaction
  23593. * @internal
  23594. */
  23595. receiveComponent: function (nextText, transaction) {
  23596. if (nextText !== this._currentElement) {
  23597. this._currentElement = nextText;
  23598. var nextStringText = '' + nextText;
  23599. if (nextStringText !== this._stringText) {
  23600. // TODO: Save this as pending props and use performUpdateIfNecessary
  23601. // and/or updateComponent to do the actual update for consistency with
  23602. // other component types?
  23603. this._stringText = nextStringText;
  23604. var commentNodes = this.getHostNode();
  23605. DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
  23606. }
  23607. }
  23608. },
  23609. getHostNode: function () {
  23610. var hostNode = this._commentNodes;
  23611. if (hostNode) {
  23612. return hostNode;
  23613. }
  23614. if (!this._closingComment) {
  23615. var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
  23616. var node = openingComment.nextSibling;
  23617. while (true) {
  23618. !(node != null) ? false ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
  23619. if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
  23620. this._closingComment = node;
  23621. break;
  23622. }
  23623. node = node.nextSibling;
  23624. }
  23625. }
  23626. hostNode = [this._hostNode, this._closingComment];
  23627. this._commentNodes = hostNode;
  23628. return hostNode;
  23629. },
  23630. unmountComponent: function () {
  23631. this._closingComment = null;
  23632. this._commentNodes = null;
  23633. ReactDOMComponentTree.uncacheNode(this);
  23634. }
  23635. });
  23636. module.exports = ReactDOMTextComponent;
  23637. /***/ }),
  23638. /* 164 */
  23639. /***/ (function(module, exports, __webpack_require__) {
  23640. "use strict";
  23641. /**
  23642. * Copyright 2013-present, Facebook, Inc.
  23643. * All rights reserved.
  23644. *
  23645. * This source code is licensed under the BSD-style license found in the
  23646. * LICENSE file in the root directory of this source tree. An additional grant
  23647. * of patent rights can be found in the PATENTS file in the same directory.
  23648. *
  23649. */
  23650. var _prodInvariant = __webpack_require__(2),
  23651. _assign = __webpack_require__(3);
  23652. var LinkedValueUtils = __webpack_require__(40);
  23653. var ReactDOMComponentTree = __webpack_require__(4);
  23654. var ReactUpdates = __webpack_require__(11);
  23655. var invariant = __webpack_require__(0);
  23656. var warning = __webpack_require__(1);
  23657. var didWarnValueLink = false;
  23658. var didWarnValDefaultVal = false;
  23659. function forceUpdateIfMounted() {
  23660. if (this._rootNodeID) {
  23661. // DOM component is still mounted; update
  23662. ReactDOMTextarea.updateWrapper(this);
  23663. }
  23664. }
  23665. /**
  23666. * Implements a <textarea> host component that allows setting `value`, and
  23667. * `defaultValue`. This differs from the traditional DOM API because value is
  23668. * usually set as PCDATA children.
  23669. *
  23670. * If `value` is not supplied (or null/undefined), user actions that affect the
  23671. * value will trigger updates to the element.
  23672. *
  23673. * If `value` is supplied (and not null/undefined), the rendered element will
  23674. * not trigger updates to the element. Instead, the `value` prop must change in
  23675. * order for the rendered element to be updated.
  23676. *
  23677. * The rendered element will be initialized with an empty value, the prop
  23678. * `defaultValue` if specified, or the children content (deprecated).
  23679. */
  23680. var ReactDOMTextarea = {
  23681. getHostProps: function (inst, props) {
  23682. !(props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
  23683. // Always set children to the same thing. In IE9, the selection range will
  23684. // get reset if `textContent` is mutated. We could add a check in setTextContent
  23685. // to only set the value if/when the value differs from the node value (which would
  23686. // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
  23687. // The value can be a boolean or object so that's why it's forced to be a string.
  23688. var hostProps = _assign({}, props, {
  23689. value: undefined,
  23690. defaultValue: undefined,
  23691. children: '' + inst._wrapperState.initialValue,
  23692. onChange: inst._wrapperState.onChange
  23693. });
  23694. return hostProps;
  23695. },
  23696. mountWrapper: function (inst, props) {
  23697. if (false) {
  23698. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  23699. if (props.valueLink !== undefined && !didWarnValueLink) {
  23700. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
  23701. didWarnValueLink = true;
  23702. }
  23703. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  23704. process.env.NODE_ENV !== 'production' ? warning(false, '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') : void 0;
  23705. didWarnValDefaultVal = true;
  23706. }
  23707. }
  23708. var value = LinkedValueUtils.getValue(props);
  23709. var initialValue = value;
  23710. // Only bother fetching default value if we're going to use it
  23711. if (value == null) {
  23712. var defaultValue = props.defaultValue;
  23713. // TODO (yungsters): Remove support for children content in <textarea>.
  23714. var children = props.children;
  23715. if (children != null) {
  23716. if (false) {
  23717. process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
  23718. }
  23719. !(defaultValue == null) ? false ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
  23720. if (Array.isArray(children)) {
  23721. !(children.length <= 1) ? false ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
  23722. children = children[0];
  23723. }
  23724. defaultValue = '' + children;
  23725. }
  23726. if (defaultValue == null) {
  23727. defaultValue = '';
  23728. }
  23729. initialValue = defaultValue;
  23730. }
  23731. inst._wrapperState = {
  23732. initialValue: '' + initialValue,
  23733. listeners: null,
  23734. onChange: _handleChange.bind(inst)
  23735. };
  23736. },
  23737. updateWrapper: function (inst) {
  23738. var props = inst._currentElement.props;
  23739. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  23740. var value = LinkedValueUtils.getValue(props);
  23741. if (value != null) {
  23742. // Cast `value` to a string to ensure the value is set correctly. While
  23743. // browsers typically do this as necessary, jsdom doesn't.
  23744. var newValue = '' + value;
  23745. // To avoid side effects (such as losing text selection), only set value if changed
  23746. if (newValue !== node.value) {
  23747. node.value = newValue;
  23748. }
  23749. if (props.defaultValue == null) {
  23750. node.defaultValue = newValue;
  23751. }
  23752. }
  23753. if (props.defaultValue != null) {
  23754. node.defaultValue = props.defaultValue;
  23755. }
  23756. },
  23757. postMountWrapper: function (inst) {
  23758. // This is in postMount because we need access to the DOM node, which is not
  23759. // available until after the component has mounted.
  23760. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  23761. var textContent = node.textContent;
  23762. // Only set node.value if textContent is equal to the expected
  23763. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  23764. // will populate textContent as well.
  23765. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  23766. if (textContent === inst._wrapperState.initialValue) {
  23767. node.value = textContent;
  23768. }
  23769. }
  23770. };
  23771. function _handleChange(event) {
  23772. var props = this._currentElement.props;
  23773. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  23774. ReactUpdates.asap(forceUpdateIfMounted, this);
  23775. return returnValue;
  23776. }
  23777. module.exports = ReactDOMTextarea;
  23778. /***/ }),
  23779. /* 165 */
  23780. /***/ (function(module, exports, __webpack_require__) {
  23781. "use strict";
  23782. /**
  23783. * Copyright 2015-present, Facebook, Inc.
  23784. * All rights reserved.
  23785. *
  23786. * This source code is licensed under the BSD-style license found in the
  23787. * LICENSE file in the root directory of this source tree. An additional grant
  23788. * of patent rights can be found in the PATENTS file in the same directory.
  23789. *
  23790. */
  23791. var _prodInvariant = __webpack_require__(2);
  23792. var invariant = __webpack_require__(0);
  23793. /**
  23794. * Return the lowest common ancestor of A and B, or null if they are in
  23795. * different trees.
  23796. */
  23797. function getLowestCommonAncestor(instA, instB) {
  23798. !('_hostNode' in instA) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  23799. !('_hostNode' in instB) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  23800. var depthA = 0;
  23801. for (var tempA = instA; tempA; tempA = tempA._hostParent) {
  23802. depthA++;
  23803. }
  23804. var depthB = 0;
  23805. for (var tempB = instB; tempB; tempB = tempB._hostParent) {
  23806. depthB++;
  23807. }
  23808. // If A is deeper, crawl up.
  23809. while (depthA - depthB > 0) {
  23810. instA = instA._hostParent;
  23811. depthA--;
  23812. }
  23813. // If B is deeper, crawl up.
  23814. while (depthB - depthA > 0) {
  23815. instB = instB._hostParent;
  23816. depthB--;
  23817. }
  23818. // Walk in lockstep until we find a match.
  23819. var depth = depthA;
  23820. while (depth--) {
  23821. if (instA === instB) {
  23822. return instA;
  23823. }
  23824. instA = instA._hostParent;
  23825. instB = instB._hostParent;
  23826. }
  23827. return null;
  23828. }
  23829. /**
  23830. * Return if A is an ancestor of B.
  23831. */
  23832. function isAncestor(instA, instB) {
  23833. !('_hostNode' in instA) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  23834. !('_hostNode' in instB) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  23835. while (instB) {
  23836. if (instB === instA) {
  23837. return true;
  23838. }
  23839. instB = instB._hostParent;
  23840. }
  23841. return false;
  23842. }
  23843. /**
  23844. * Return the parent instance of the passed-in instance.
  23845. */
  23846. function getParentInstance(inst) {
  23847. !('_hostNode' in inst) ? false ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
  23848. return inst._hostParent;
  23849. }
  23850. /**
  23851. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  23852. */
  23853. function traverseTwoPhase(inst, fn, arg) {
  23854. var path = [];
  23855. while (inst) {
  23856. path.push(inst);
  23857. inst = inst._hostParent;
  23858. }
  23859. var i;
  23860. for (i = path.length; i-- > 0;) {
  23861. fn(path[i], 'captured', arg);
  23862. }
  23863. for (i = 0; i < path.length; i++) {
  23864. fn(path[i], 'bubbled', arg);
  23865. }
  23866. }
  23867. /**
  23868. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  23869. * should would receive a `mouseEnter` or `mouseLeave` event.
  23870. *
  23871. * Does not invoke the callback on the nearest common ancestor because nothing
  23872. * "entered" or "left" that element.
  23873. */
  23874. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  23875. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  23876. var pathFrom = [];
  23877. while (from && from !== common) {
  23878. pathFrom.push(from);
  23879. from = from._hostParent;
  23880. }
  23881. var pathTo = [];
  23882. while (to && to !== common) {
  23883. pathTo.push(to);
  23884. to = to._hostParent;
  23885. }
  23886. var i;
  23887. for (i = 0; i < pathFrom.length; i++) {
  23888. fn(pathFrom[i], 'bubbled', argFrom);
  23889. }
  23890. for (i = pathTo.length; i-- > 0;) {
  23891. fn(pathTo[i], 'captured', argTo);
  23892. }
  23893. }
  23894. module.exports = {
  23895. isAncestor: isAncestor,
  23896. getLowestCommonAncestor: getLowestCommonAncestor,
  23897. getParentInstance: getParentInstance,
  23898. traverseTwoPhase: traverseTwoPhase,
  23899. traverseEnterLeave: traverseEnterLeave
  23900. };
  23901. /***/ }),
  23902. /* 166 */
  23903. /***/ (function(module, exports, __webpack_require__) {
  23904. "use strict";
  23905. /**
  23906. * Copyright 2013-present, Facebook, Inc.
  23907. * All rights reserved.
  23908. *
  23909. * This source code is licensed under the BSD-style license found in the
  23910. * LICENSE file in the root directory of this source tree. An additional grant
  23911. * of patent rights can be found in the PATENTS file in the same directory.
  23912. *
  23913. */
  23914. var _assign = __webpack_require__(3);
  23915. var ReactUpdates = __webpack_require__(11);
  23916. var Transaction = __webpack_require__(30);
  23917. var emptyFunction = __webpack_require__(9);
  23918. var RESET_BATCHED_UPDATES = {
  23919. initialize: emptyFunction,
  23920. close: function () {
  23921. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  23922. }
  23923. };
  23924. var FLUSH_BATCHED_UPDATES = {
  23925. initialize: emptyFunction,
  23926. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  23927. };
  23928. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  23929. function ReactDefaultBatchingStrategyTransaction() {
  23930. this.reinitializeTransaction();
  23931. }
  23932. _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
  23933. getTransactionWrappers: function () {
  23934. return TRANSACTION_WRAPPERS;
  23935. }
  23936. });
  23937. var transaction = new ReactDefaultBatchingStrategyTransaction();
  23938. var ReactDefaultBatchingStrategy = {
  23939. isBatchingUpdates: false,
  23940. /**
  23941. * Call the provided function in a context within which calls to `setState`
  23942. * and friends are batched such that components aren't updated unnecessarily.
  23943. */
  23944. batchedUpdates: function (callback, a, b, c, d, e) {
  23945. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  23946. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  23947. // The code is written this way to avoid extra allocations
  23948. if (alreadyBatchingUpdates) {
  23949. return callback(a, b, c, d, e);
  23950. } else {
  23951. return transaction.perform(callback, null, a, b, c, d, e);
  23952. }
  23953. }
  23954. };
  23955. module.exports = ReactDefaultBatchingStrategy;
  23956. /***/ }),
  23957. /* 167 */
  23958. /***/ (function(module, exports, __webpack_require__) {
  23959. "use strict";
  23960. /**
  23961. * Copyright 2013-present, Facebook, Inc.
  23962. * All rights reserved.
  23963. *
  23964. * This source code is licensed under the BSD-style license found in the
  23965. * LICENSE file in the root directory of this source tree. An additional grant
  23966. * of patent rights can be found in the PATENTS file in the same directory.
  23967. *
  23968. */
  23969. var ARIADOMPropertyConfig = __webpack_require__(141);
  23970. var BeforeInputEventPlugin = __webpack_require__(143);
  23971. var ChangeEventPlugin = __webpack_require__(145);
  23972. var DefaultEventPluginOrder = __webpack_require__(147);
  23973. var EnterLeaveEventPlugin = __webpack_require__(148);
  23974. var HTMLDOMPropertyConfig = __webpack_require__(150);
  23975. var ReactComponentBrowserEnvironment = __webpack_require__(152);
  23976. var ReactDOMComponent = __webpack_require__(155);
  23977. var ReactDOMComponentTree = __webpack_require__(4);
  23978. var ReactDOMEmptyComponent = __webpack_require__(157);
  23979. var ReactDOMTreeTraversal = __webpack_require__(165);
  23980. var ReactDOMTextComponent = __webpack_require__(163);
  23981. var ReactDefaultBatchingStrategy = __webpack_require__(166);
  23982. var ReactEventListener = __webpack_require__(170);
  23983. var ReactInjection = __webpack_require__(171);
  23984. var ReactReconcileTransaction = __webpack_require__(176);
  23985. var SVGDOMPropertyConfig = __webpack_require__(181);
  23986. var SelectEventPlugin = __webpack_require__(182);
  23987. var SimpleEventPlugin = __webpack_require__(183);
  23988. var alreadyInjected = false;
  23989. function inject() {
  23990. if (alreadyInjected) {
  23991. // TODO: This is currently true because these injections are shared between
  23992. // the client and the server package. They should be built independently
  23993. // and not share any injection state. Then this problem will be solved.
  23994. return;
  23995. }
  23996. alreadyInjected = true;
  23997. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  23998. /**
  23999. * Inject modules for resolving DOM hierarchy and plugin ordering.
  24000. */
  24001. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  24002. ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
  24003. ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
  24004. /**
  24005. * Some important event plugins included by default (without having to require
  24006. * them).
  24007. */
  24008. ReactInjection.EventPluginHub.injectEventPluginsByName({
  24009. SimpleEventPlugin: SimpleEventPlugin,
  24010. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  24011. ChangeEventPlugin: ChangeEventPlugin,
  24012. SelectEventPlugin: SelectEventPlugin,
  24013. BeforeInputEventPlugin: BeforeInputEventPlugin
  24014. });
  24015. ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
  24016. ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
  24017. ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
  24018. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  24019. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  24020. ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
  24021. return new ReactDOMEmptyComponent(instantiate);
  24022. });
  24023. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  24024. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  24025. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  24026. }
  24027. module.exports = {
  24028. inject: inject
  24029. };
  24030. /***/ }),
  24031. /* 168 */
  24032. /***/ (function(module, exports, __webpack_require__) {
  24033. "use strict";
  24034. /**
  24035. * Copyright 2014-present, Facebook, Inc.
  24036. * All rights reserved.
  24037. *
  24038. * This source code is licensed under the BSD-style license found in the
  24039. * LICENSE file in the root directory of this source tree. An additional grant
  24040. * of patent rights can be found in the PATENTS file in the same directory.
  24041. *
  24042. *
  24043. */
  24044. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  24045. // nor polyfill, then a plain number is used for performance.
  24046. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  24047. module.exports = REACT_ELEMENT_TYPE;
  24048. /***/ }),
  24049. /* 169 */
  24050. /***/ (function(module, exports, __webpack_require__) {
  24051. "use strict";
  24052. /**
  24053. * Copyright 2013-present, Facebook, Inc.
  24054. * All rights reserved.
  24055. *
  24056. * This source code is licensed under the BSD-style license found in the
  24057. * LICENSE file in the root directory of this source tree. An additional grant
  24058. * of patent rights can be found in the PATENTS file in the same directory.
  24059. *
  24060. */
  24061. var EventPluginHub = __webpack_require__(24);
  24062. function runEventQueueInBatch(events) {
  24063. EventPluginHub.enqueueEvents(events);
  24064. EventPluginHub.processEventQueue(false);
  24065. }
  24066. var ReactEventEmitterMixin = {
  24067. /**
  24068. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  24069. * opportunity to create `ReactEvent`s to be dispatched.
  24070. */
  24071. handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  24072. var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  24073. runEventQueueInBatch(events);
  24074. }
  24075. };
  24076. module.exports = ReactEventEmitterMixin;
  24077. /***/ }),
  24078. /* 170 */
  24079. /***/ (function(module, exports, __webpack_require__) {
  24080. "use strict";
  24081. /**
  24082. * Copyright 2013-present, Facebook, Inc.
  24083. * All rights reserved.
  24084. *
  24085. * This source code is licensed under the BSD-style license found in the
  24086. * LICENSE file in the root directory of this source tree. An additional grant
  24087. * of patent rights can be found in the PATENTS file in the same directory.
  24088. *
  24089. */
  24090. var _assign = __webpack_require__(3);
  24091. var EventListener = __webpack_require__(55);
  24092. var ExecutionEnvironment = __webpack_require__(5);
  24093. var PooledClass = __webpack_require__(15);
  24094. var ReactDOMComponentTree = __webpack_require__(4);
  24095. var ReactUpdates = __webpack_require__(11);
  24096. var getEventTarget = __webpack_require__(47);
  24097. var getUnboundedScrollPosition = __webpack_require__(135);
  24098. /**
  24099. * Find the deepest React component completely containing the root of the
  24100. * passed-in instance (for use when entire React trees are nested within each
  24101. * other). If React trees are not nested, returns null.
  24102. */
  24103. function findParent(inst) {
  24104. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  24105. // traversal, but caching is difficult to do correctly without using a
  24106. // mutation observer to listen for all DOM changes.
  24107. while (inst._hostParent) {
  24108. inst = inst._hostParent;
  24109. }
  24110. var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  24111. var container = rootNode.parentNode;
  24112. return ReactDOMComponentTree.getClosestInstanceFromNode(container);
  24113. }
  24114. // Used to store ancestor hierarchy in top level callback
  24115. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  24116. this.topLevelType = topLevelType;
  24117. this.nativeEvent = nativeEvent;
  24118. this.ancestors = [];
  24119. }
  24120. _assign(TopLevelCallbackBookKeeping.prototype, {
  24121. destructor: function () {
  24122. this.topLevelType = null;
  24123. this.nativeEvent = null;
  24124. this.ancestors.length = 0;
  24125. }
  24126. });
  24127. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  24128. function handleTopLevelImpl(bookKeeping) {
  24129. var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
  24130. var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
  24131. // Loop through the hierarchy, in case there's any nested components.
  24132. // It's important that we build the array of ancestors before calling any
  24133. // event handlers, because event handlers can modify the DOM, leading to
  24134. // inconsistencies with ReactMount's node cache. See #1105.
  24135. var ancestor = targetInst;
  24136. do {
  24137. bookKeeping.ancestors.push(ancestor);
  24138. ancestor = ancestor && findParent(ancestor);
  24139. } while (ancestor);
  24140. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  24141. targetInst = bookKeeping.ancestors[i];
  24142. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  24143. }
  24144. }
  24145. function scrollValueMonitor(cb) {
  24146. var scrollPosition = getUnboundedScrollPosition(window);
  24147. cb(scrollPosition);
  24148. }
  24149. var ReactEventListener = {
  24150. _enabled: true,
  24151. _handleTopLevel: null,
  24152. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  24153. setHandleTopLevel: function (handleTopLevel) {
  24154. ReactEventListener._handleTopLevel = handleTopLevel;
  24155. },
  24156. setEnabled: function (enabled) {
  24157. ReactEventListener._enabled = !!enabled;
  24158. },
  24159. isEnabled: function () {
  24160. return ReactEventListener._enabled;
  24161. },
  24162. /**
  24163. * Traps top-level events by using event bubbling.
  24164. *
  24165. * @param {string} topLevelType Record from `EventConstants`.
  24166. * @param {string} handlerBaseName Event name (e.g. "click").
  24167. * @param {object} element Element on which to attach listener.
  24168. * @return {?object} An object with a remove function which will forcefully
  24169. * remove the listener.
  24170. * @internal
  24171. */
  24172. trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
  24173. if (!element) {
  24174. return null;
  24175. }
  24176. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  24177. },
  24178. /**
  24179. * Traps a top-level event by using event capturing.
  24180. *
  24181. * @param {string} topLevelType Record from `EventConstants`.
  24182. * @param {string} handlerBaseName Event name (e.g. "click").
  24183. * @param {object} element Element on which to attach listener.
  24184. * @return {?object} An object with a remove function which will forcefully
  24185. * remove the listener.
  24186. * @internal
  24187. */
  24188. trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
  24189. if (!element) {
  24190. return null;
  24191. }
  24192. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  24193. },
  24194. monitorScrollValue: function (refresh) {
  24195. var callback = scrollValueMonitor.bind(null, refresh);
  24196. EventListener.listen(window, 'scroll', callback);
  24197. },
  24198. dispatchEvent: function (topLevelType, nativeEvent) {
  24199. if (!ReactEventListener._enabled) {
  24200. return;
  24201. }
  24202. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  24203. try {
  24204. // Event queue being processed in the same cycle allows
  24205. // `preventDefault`.
  24206. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  24207. } finally {
  24208. TopLevelCallbackBookKeeping.release(bookKeeping);
  24209. }
  24210. }
  24211. };
  24212. module.exports = ReactEventListener;
  24213. /***/ }),
  24214. /* 171 */
  24215. /***/ (function(module, exports, __webpack_require__) {
  24216. "use strict";
  24217. /**
  24218. * Copyright 2013-present, Facebook, Inc.
  24219. * All rights reserved.
  24220. *
  24221. * This source code is licensed under the BSD-style license found in the
  24222. * LICENSE file in the root directory of this source tree. An additional grant
  24223. * of patent rights can be found in the PATENTS file in the same directory.
  24224. *
  24225. */
  24226. var DOMProperty = __webpack_require__(18);
  24227. var EventPluginHub = __webpack_require__(24);
  24228. var EventPluginUtils = __webpack_require__(38);
  24229. var ReactComponentEnvironment = __webpack_require__(41);
  24230. var ReactEmptyComponent = __webpack_require__(63);
  24231. var ReactBrowserEventEmitter = __webpack_require__(28);
  24232. var ReactHostComponent = __webpack_require__(65);
  24233. var ReactUpdates = __webpack_require__(11);
  24234. var ReactInjection = {
  24235. Component: ReactComponentEnvironment.injection,
  24236. DOMProperty: DOMProperty.injection,
  24237. EmptyComponent: ReactEmptyComponent.injection,
  24238. EventPluginHub: EventPluginHub.injection,
  24239. EventPluginUtils: EventPluginUtils.injection,
  24240. EventEmitter: ReactBrowserEventEmitter.injection,
  24241. HostComponent: ReactHostComponent.injection,
  24242. Updates: ReactUpdates.injection
  24243. };
  24244. module.exports = ReactInjection;
  24245. /***/ }),
  24246. /* 172 */
  24247. /***/ (function(module, exports, __webpack_require__) {
  24248. "use strict";
  24249. /**
  24250. * Copyright 2013-present, Facebook, Inc.
  24251. * All rights reserved.
  24252. *
  24253. * This source code is licensed under the BSD-style license found in the
  24254. * LICENSE file in the root directory of this source tree. An additional grant
  24255. * of patent rights can be found in the PATENTS file in the same directory.
  24256. *
  24257. */
  24258. var adler32 = __webpack_require__(194);
  24259. var TAG_END = /\/?>/;
  24260. var COMMENT_START = /^<\!\-\-/;
  24261. var ReactMarkupChecksum = {
  24262. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  24263. /**
  24264. * @param {string} markup Markup string
  24265. * @return {string} Markup string with checksum attribute attached
  24266. */
  24267. addChecksumToMarkup: function (markup) {
  24268. var checksum = adler32(markup);
  24269. // Add checksum (handle both parent tags, comments and self-closing tags)
  24270. if (COMMENT_START.test(markup)) {
  24271. return markup;
  24272. } else {
  24273. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  24274. }
  24275. },
  24276. /**
  24277. * @param {string} markup to use
  24278. * @param {DOMElement} element root React element
  24279. * @returns {boolean} whether or not the markup is the same
  24280. */
  24281. canReuseMarkup: function (markup, element) {
  24282. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  24283. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  24284. var markupChecksum = adler32(markup);
  24285. return markupChecksum === existingChecksum;
  24286. }
  24287. };
  24288. module.exports = ReactMarkupChecksum;
  24289. /***/ }),
  24290. /* 173 */
  24291. /***/ (function(module, exports, __webpack_require__) {
  24292. "use strict";
  24293. /**
  24294. * Copyright 2013-present, Facebook, Inc.
  24295. * All rights reserved.
  24296. *
  24297. * This source code is licensed under the BSD-style license found in the
  24298. * LICENSE file in the root directory of this source tree. An additional grant
  24299. * of patent rights can be found in the PATENTS file in the same directory.
  24300. *
  24301. */
  24302. var _prodInvariant = __webpack_require__(2);
  24303. var ReactComponentEnvironment = __webpack_require__(41);
  24304. var ReactInstanceMap = __webpack_require__(26);
  24305. var ReactInstrumentation = __webpack_require__(10);
  24306. var ReactCurrentOwner = __webpack_require__(13);
  24307. var ReactReconciler = __webpack_require__(19);
  24308. var ReactChildReconciler = __webpack_require__(151);
  24309. var emptyFunction = __webpack_require__(9);
  24310. var flattenChildren = __webpack_require__(197);
  24311. var invariant = __webpack_require__(0);
  24312. /**
  24313. * Make an update for markup to be rendered and inserted at a supplied index.
  24314. *
  24315. * @param {string} markup Markup that renders into an element.
  24316. * @param {number} toIndex Destination index.
  24317. * @private
  24318. */
  24319. function makeInsertMarkup(markup, afterNode, toIndex) {
  24320. // NOTE: Null values reduce hidden classes.
  24321. return {
  24322. type: 'INSERT_MARKUP',
  24323. content: markup,
  24324. fromIndex: null,
  24325. fromNode: null,
  24326. toIndex: toIndex,
  24327. afterNode: afterNode
  24328. };
  24329. }
  24330. /**
  24331. * Make an update for moving an existing element to another index.
  24332. *
  24333. * @param {number} fromIndex Source index of the existing element.
  24334. * @param {number} toIndex Destination index of the element.
  24335. * @private
  24336. */
  24337. function makeMove(child, afterNode, toIndex) {
  24338. // NOTE: Null values reduce hidden classes.
  24339. return {
  24340. type: 'MOVE_EXISTING',
  24341. content: null,
  24342. fromIndex: child._mountIndex,
  24343. fromNode: ReactReconciler.getHostNode(child),
  24344. toIndex: toIndex,
  24345. afterNode: afterNode
  24346. };
  24347. }
  24348. /**
  24349. * Make an update for removing an element at an index.
  24350. *
  24351. * @param {number} fromIndex Index of the element to remove.
  24352. * @private
  24353. */
  24354. function makeRemove(child, node) {
  24355. // NOTE: Null values reduce hidden classes.
  24356. return {
  24357. type: 'REMOVE_NODE',
  24358. content: null,
  24359. fromIndex: child._mountIndex,
  24360. fromNode: node,
  24361. toIndex: null,
  24362. afterNode: null
  24363. };
  24364. }
  24365. /**
  24366. * Make an update for setting the markup of a node.
  24367. *
  24368. * @param {string} markup Markup that renders into an element.
  24369. * @private
  24370. */
  24371. function makeSetMarkup(markup) {
  24372. // NOTE: Null values reduce hidden classes.
  24373. return {
  24374. type: 'SET_MARKUP',
  24375. content: markup,
  24376. fromIndex: null,
  24377. fromNode: null,
  24378. toIndex: null,
  24379. afterNode: null
  24380. };
  24381. }
  24382. /**
  24383. * Make an update for setting the text content.
  24384. *
  24385. * @param {string} textContent Text content to set.
  24386. * @private
  24387. */
  24388. function makeTextContent(textContent) {
  24389. // NOTE: Null values reduce hidden classes.
  24390. return {
  24391. type: 'TEXT_CONTENT',
  24392. content: textContent,
  24393. fromIndex: null,
  24394. fromNode: null,
  24395. toIndex: null,
  24396. afterNode: null
  24397. };
  24398. }
  24399. /**
  24400. * Push an update, if any, onto the queue. Creates a new queue if none is
  24401. * passed and always returns the queue. Mutative.
  24402. */
  24403. function enqueue(queue, update) {
  24404. if (update) {
  24405. queue = queue || [];
  24406. queue.push(update);
  24407. }
  24408. return queue;
  24409. }
  24410. /**
  24411. * Processes any enqueued updates.
  24412. *
  24413. * @private
  24414. */
  24415. function processQueue(inst, updateQueue) {
  24416. ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
  24417. }
  24418. var setChildrenForInstrumentation = emptyFunction;
  24419. if (false) {
  24420. var getDebugID = function (inst) {
  24421. if (!inst._debugID) {
  24422. // Check for ART-like instances. TODO: This is silly/gross.
  24423. var internal;
  24424. if (internal = ReactInstanceMap.get(inst)) {
  24425. inst = internal;
  24426. }
  24427. }
  24428. return inst._debugID;
  24429. };
  24430. setChildrenForInstrumentation = function (children) {
  24431. var debugID = getDebugID(this);
  24432. // TODO: React Native empty components are also multichild.
  24433. // This means they still get into this method but don't have _debugID.
  24434. if (debugID !== 0) {
  24435. ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
  24436. return children[key]._debugID;
  24437. }) : []);
  24438. }
  24439. };
  24440. }
  24441. /**
  24442. * ReactMultiChild are capable of reconciling multiple children.
  24443. *
  24444. * @class ReactMultiChild
  24445. * @internal
  24446. */
  24447. var ReactMultiChild = {
  24448. /**
  24449. * Provides common functionality for components that must reconcile multiple
  24450. * children. This is used by `ReactDOMComponent` to mount, update, and
  24451. * unmount child components.
  24452. *
  24453. * @lends {ReactMultiChild.prototype}
  24454. */
  24455. Mixin: {
  24456. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  24457. if (false) {
  24458. var selfDebugID = getDebugID(this);
  24459. if (this._currentElement) {
  24460. try {
  24461. ReactCurrentOwner.current = this._currentElement._owner;
  24462. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
  24463. } finally {
  24464. ReactCurrentOwner.current = null;
  24465. }
  24466. }
  24467. }
  24468. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  24469. },
  24470. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
  24471. var nextChildren;
  24472. var selfDebugID = 0;
  24473. if (false) {
  24474. selfDebugID = getDebugID(this);
  24475. if (this._currentElement) {
  24476. try {
  24477. ReactCurrentOwner.current = this._currentElement._owner;
  24478. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  24479. } finally {
  24480. ReactCurrentOwner.current = null;
  24481. }
  24482. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  24483. return nextChildren;
  24484. }
  24485. }
  24486. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  24487. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  24488. return nextChildren;
  24489. },
  24490. /**
  24491. * Generates a "mount image" for each of the supplied children. In the case
  24492. * of `ReactDOMComponent`, a mount image is a string of markup.
  24493. *
  24494. * @param {?object} nestedChildren Nested child maps.
  24495. * @return {array} An array of mounted representations.
  24496. * @internal
  24497. */
  24498. mountChildren: function (nestedChildren, transaction, context) {
  24499. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  24500. this._renderedChildren = children;
  24501. var mountImages = [];
  24502. var index = 0;
  24503. for (var name in children) {
  24504. if (children.hasOwnProperty(name)) {
  24505. var child = children[name];
  24506. var selfDebugID = 0;
  24507. if (false) {
  24508. selfDebugID = getDebugID(this);
  24509. }
  24510. var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
  24511. child._mountIndex = index++;
  24512. mountImages.push(mountImage);
  24513. }
  24514. }
  24515. if (false) {
  24516. setChildrenForInstrumentation.call(this, children);
  24517. }
  24518. return mountImages;
  24519. },
  24520. /**
  24521. * Replaces any rendered children with a text content string.
  24522. *
  24523. * @param {string} nextContent String of content.
  24524. * @internal
  24525. */
  24526. updateTextContent: function (nextContent) {
  24527. var prevChildren = this._renderedChildren;
  24528. // Remove any rendered children.
  24529. ReactChildReconciler.unmountChildren(prevChildren, false);
  24530. for (var name in prevChildren) {
  24531. if (prevChildren.hasOwnProperty(name)) {
  24532. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  24533. }
  24534. }
  24535. // Set new text content.
  24536. var updates = [makeTextContent(nextContent)];
  24537. processQueue(this, updates);
  24538. },
  24539. /**
  24540. * Replaces any rendered children with a markup string.
  24541. *
  24542. * @param {string} nextMarkup String of markup.
  24543. * @internal
  24544. */
  24545. updateMarkup: function (nextMarkup) {
  24546. var prevChildren = this._renderedChildren;
  24547. // Remove any rendered children.
  24548. ReactChildReconciler.unmountChildren(prevChildren, false);
  24549. for (var name in prevChildren) {
  24550. if (prevChildren.hasOwnProperty(name)) {
  24551. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  24552. }
  24553. }
  24554. var updates = [makeSetMarkup(nextMarkup)];
  24555. processQueue(this, updates);
  24556. },
  24557. /**
  24558. * Updates the rendered children with new children.
  24559. *
  24560. * @param {?object} nextNestedChildrenElements Nested child element maps.
  24561. * @param {ReactReconcileTransaction} transaction
  24562. * @internal
  24563. */
  24564. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  24565. // Hook used by React ART
  24566. this._updateChildren(nextNestedChildrenElements, transaction, context);
  24567. },
  24568. /**
  24569. * @param {?object} nextNestedChildrenElements Nested child element maps.
  24570. * @param {ReactReconcileTransaction} transaction
  24571. * @final
  24572. * @protected
  24573. */
  24574. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  24575. var prevChildren = this._renderedChildren;
  24576. var removedNodes = {};
  24577. var mountImages = [];
  24578. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
  24579. if (!nextChildren && !prevChildren) {
  24580. return;
  24581. }
  24582. var updates = null;
  24583. var name;
  24584. // `nextIndex` will increment for each child in `nextChildren`, but
  24585. // `lastIndex` will be the last index visited in `prevChildren`.
  24586. var nextIndex = 0;
  24587. var lastIndex = 0;
  24588. // `nextMountIndex` will increment for each newly mounted child.
  24589. var nextMountIndex = 0;
  24590. var lastPlacedNode = null;
  24591. for (name in nextChildren) {
  24592. if (!nextChildren.hasOwnProperty(name)) {
  24593. continue;
  24594. }
  24595. var prevChild = prevChildren && prevChildren[name];
  24596. var nextChild = nextChildren[name];
  24597. if (prevChild === nextChild) {
  24598. updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
  24599. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  24600. prevChild._mountIndex = nextIndex;
  24601. } else {
  24602. if (prevChild) {
  24603. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  24604. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  24605. // The `removedNodes` loop below will actually remove the child.
  24606. }
  24607. // The child must be instantiated before it's mounted.
  24608. updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
  24609. nextMountIndex++;
  24610. }
  24611. nextIndex++;
  24612. lastPlacedNode = ReactReconciler.getHostNode(nextChild);
  24613. }
  24614. // Remove children that are no longer present.
  24615. for (name in removedNodes) {
  24616. if (removedNodes.hasOwnProperty(name)) {
  24617. updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
  24618. }
  24619. }
  24620. if (updates) {
  24621. processQueue(this, updates);
  24622. }
  24623. this._renderedChildren = nextChildren;
  24624. if (false) {
  24625. setChildrenForInstrumentation.call(this, nextChildren);
  24626. }
  24627. },
  24628. /**
  24629. * Unmounts all rendered children. This should be used to clean up children
  24630. * when this component is unmounted. It does not actually perform any
  24631. * backend operations.
  24632. *
  24633. * @internal
  24634. */
  24635. unmountChildren: function (safely) {
  24636. var renderedChildren = this._renderedChildren;
  24637. ReactChildReconciler.unmountChildren(renderedChildren, safely);
  24638. this._renderedChildren = null;
  24639. },
  24640. /**
  24641. * Moves a child component to the supplied index.
  24642. *
  24643. * @param {ReactComponent} child Component to move.
  24644. * @param {number} toIndex Destination index of the element.
  24645. * @param {number} lastIndex Last index visited of the siblings of `child`.
  24646. * @protected
  24647. */
  24648. moveChild: function (child, afterNode, toIndex, lastIndex) {
  24649. // If the index of `child` is less than `lastIndex`, then it needs to
  24650. // be moved. Otherwise, we do not need to move it because a child will be
  24651. // inserted or moved before `child`.
  24652. if (child._mountIndex < lastIndex) {
  24653. return makeMove(child, afterNode, toIndex);
  24654. }
  24655. },
  24656. /**
  24657. * Creates a child component.
  24658. *
  24659. * @param {ReactComponent} child Component to create.
  24660. * @param {string} mountImage Markup to insert.
  24661. * @protected
  24662. */
  24663. createChild: function (child, afterNode, mountImage) {
  24664. return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
  24665. },
  24666. /**
  24667. * Removes a child component.
  24668. *
  24669. * @param {ReactComponent} child Child to remove.
  24670. * @protected
  24671. */
  24672. removeChild: function (child, node) {
  24673. return makeRemove(child, node);
  24674. },
  24675. /**
  24676. * Mounts a child with the supplied name.
  24677. *
  24678. * NOTE: This is part of `updateChildren` and is here for readability.
  24679. *
  24680. * @param {ReactComponent} child Component to mount.
  24681. * @param {string} name Name of the child.
  24682. * @param {number} index Index at which to insert the child.
  24683. * @param {ReactReconcileTransaction} transaction
  24684. * @private
  24685. */
  24686. _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
  24687. child._mountIndex = index;
  24688. return this.createChild(child, afterNode, mountImage);
  24689. },
  24690. /**
  24691. * Unmounts a rendered child.
  24692. *
  24693. * NOTE: This is part of `updateChildren` and is here for readability.
  24694. *
  24695. * @param {ReactComponent} child Component to unmount.
  24696. * @private
  24697. */
  24698. _unmountChild: function (child, node) {
  24699. var update = this.removeChild(child, node);
  24700. child._mountIndex = null;
  24701. return update;
  24702. }
  24703. }
  24704. };
  24705. module.exports = ReactMultiChild;
  24706. /***/ }),
  24707. /* 174 */
  24708. /***/ (function(module, exports, __webpack_require__) {
  24709. "use strict";
  24710. /**
  24711. * Copyright 2013-present, Facebook, Inc.
  24712. * All rights reserved.
  24713. *
  24714. * This source code is licensed under the BSD-style license found in the
  24715. * LICENSE file in the root directory of this source tree. An additional grant
  24716. * of patent rights can be found in the PATENTS file in the same directory.
  24717. *
  24718. *
  24719. */
  24720. var _prodInvariant = __webpack_require__(2);
  24721. var invariant = __webpack_require__(0);
  24722. /**
  24723. * @param {?object} object
  24724. * @return {boolean} True if `object` is a valid owner.
  24725. * @final
  24726. */
  24727. function isValidOwner(object) {
  24728. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  24729. }
  24730. /**
  24731. * ReactOwners are capable of storing references to owned components.
  24732. *
  24733. * All components are capable of //being// referenced by owner components, but
  24734. * only ReactOwner components are capable of //referencing// owned components.
  24735. * The named reference is known as a "ref".
  24736. *
  24737. * Refs are available when mounted and updated during reconciliation.
  24738. *
  24739. * var MyComponent = React.createClass({
  24740. * render: function() {
  24741. * return (
  24742. * <div onClick={this.handleClick}>
  24743. * <CustomComponent ref="custom" />
  24744. * </div>
  24745. * );
  24746. * },
  24747. * handleClick: function() {
  24748. * this.refs.custom.handleClick();
  24749. * },
  24750. * componentDidMount: function() {
  24751. * this.refs.custom.initialize();
  24752. * }
  24753. * });
  24754. *
  24755. * Refs should rarely be used. When refs are used, they should only be done to
  24756. * control data that is not handled by React's data flow.
  24757. *
  24758. * @class ReactOwner
  24759. */
  24760. var ReactOwner = {
  24761. /**
  24762. * Adds a component by ref to an owner component.
  24763. *
  24764. * @param {ReactComponent} component Component to reference.
  24765. * @param {string} ref Name by which to refer to the component.
  24766. * @param {ReactOwner} owner Component on which to record the ref.
  24767. * @final
  24768. * @internal
  24769. */
  24770. addComponentAsRefTo: function (component, ref, owner) {
  24771. !isValidOwner(owner) ? false ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0;
  24772. owner.attachRef(ref, component);
  24773. },
  24774. /**
  24775. * Removes a component by ref from an owner component.
  24776. *
  24777. * @param {ReactComponent} component Component to dereference.
  24778. * @param {string} ref Name of the ref to remove.
  24779. * @param {ReactOwner} owner Component on which the ref is recorded.
  24780. * @final
  24781. * @internal
  24782. */
  24783. removeComponentAsRefFrom: function (component, ref, owner) {
  24784. !isValidOwner(owner) ? false ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0;
  24785. var ownerPublicInstance = owner.getPublicInstance();
  24786. // Check that `component`'s owner is still alive and that `component` is still the current ref
  24787. // because we do not want to detach the ref if another component stole it.
  24788. if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
  24789. owner.detachRef(ref);
  24790. }
  24791. }
  24792. };
  24793. module.exports = ReactOwner;
  24794. /***/ }),
  24795. /* 175 */
  24796. /***/ (function(module, exports, __webpack_require__) {
  24797. "use strict";
  24798. /**
  24799. * Copyright 2013-present, Facebook, Inc.
  24800. * All rights reserved.
  24801. *
  24802. * This source code is licensed under the BSD-style license found in the
  24803. * LICENSE file in the root directory of this source tree. An additional grant
  24804. * of patent rights can be found in the PATENTS file in the same directory.
  24805. *
  24806. *
  24807. */
  24808. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  24809. module.exports = ReactPropTypesSecret;
  24810. /***/ }),
  24811. /* 176 */
  24812. /***/ (function(module, exports, __webpack_require__) {
  24813. "use strict";
  24814. /**
  24815. * Copyright 2013-present, Facebook, Inc.
  24816. * All rights reserved.
  24817. *
  24818. * This source code is licensed under the BSD-style license found in the
  24819. * LICENSE file in the root directory of this source tree. An additional grant
  24820. * of patent rights can be found in the PATENTS file in the same directory.
  24821. *
  24822. */
  24823. var _assign = __webpack_require__(3);
  24824. var CallbackQueue = __webpack_require__(59);
  24825. var PooledClass = __webpack_require__(15);
  24826. var ReactBrowserEventEmitter = __webpack_require__(28);
  24827. var ReactInputSelection = __webpack_require__(66);
  24828. var ReactInstrumentation = __webpack_require__(10);
  24829. var Transaction = __webpack_require__(30);
  24830. var ReactUpdateQueue = __webpack_require__(43);
  24831. /**
  24832. * Ensures that, when possible, the selection range (currently selected text
  24833. * input) is not disturbed by performing the transaction.
  24834. */
  24835. var SELECTION_RESTORATION = {
  24836. /**
  24837. * @return {Selection} Selection information.
  24838. */
  24839. initialize: ReactInputSelection.getSelectionInformation,
  24840. /**
  24841. * @param {Selection} sel Selection information returned from `initialize`.
  24842. */
  24843. close: ReactInputSelection.restoreSelection
  24844. };
  24845. /**
  24846. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  24847. * high level DOM manipulations (like temporarily removing a text input from the
  24848. * DOM).
  24849. */
  24850. var EVENT_SUPPRESSION = {
  24851. /**
  24852. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  24853. * the reconciliation.
  24854. */
  24855. initialize: function () {
  24856. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  24857. ReactBrowserEventEmitter.setEnabled(false);
  24858. return currentlyEnabled;
  24859. },
  24860. /**
  24861. * @param {boolean} previouslyEnabled Enabled status of
  24862. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  24863. * restores the previous value.
  24864. */
  24865. close: function (previouslyEnabled) {
  24866. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  24867. }
  24868. };
  24869. /**
  24870. * Provides a queue for collecting `componentDidMount` and
  24871. * `componentDidUpdate` callbacks during the transaction.
  24872. */
  24873. var ON_DOM_READY_QUEUEING = {
  24874. /**
  24875. * Initializes the internal `onDOMReady` queue.
  24876. */
  24877. initialize: function () {
  24878. this.reactMountReady.reset();
  24879. },
  24880. /**
  24881. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  24882. */
  24883. close: function () {
  24884. this.reactMountReady.notifyAll();
  24885. }
  24886. };
  24887. /**
  24888. * Executed within the scope of the `Transaction` instance. Consider these as
  24889. * being member methods, but with an implied ordering while being isolated from
  24890. * each other.
  24891. */
  24892. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  24893. if (false) {
  24894. TRANSACTION_WRAPPERS.push({
  24895. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  24896. close: ReactInstrumentation.debugTool.onEndFlush
  24897. });
  24898. }
  24899. /**
  24900. * Currently:
  24901. * - The order that these are listed in the transaction is critical:
  24902. * - Suppresses events.
  24903. * - Restores selection range.
  24904. *
  24905. * Future:
  24906. * - Restore document/overflow scroll positions that were unintentionally
  24907. * modified via DOM insertions above the top viewport boundary.
  24908. * - Implement/integrate with customized constraint based layout system and keep
  24909. * track of which dimensions must be remeasured.
  24910. *
  24911. * @class ReactReconcileTransaction
  24912. */
  24913. function ReactReconcileTransaction(useCreateElement) {
  24914. this.reinitializeTransaction();
  24915. // Only server-side rendering really needs this option (see
  24916. // `ReactServerRendering`), but server-side uses
  24917. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  24918. // accessible and defaults to false when `ReactDOMComponent` and
  24919. // `ReactDOMTextComponent` checks it in `mountComponent`.`
  24920. this.renderToStaticMarkup = false;
  24921. this.reactMountReady = CallbackQueue.getPooled(null);
  24922. this.useCreateElement = useCreateElement;
  24923. }
  24924. var Mixin = {
  24925. /**
  24926. * @see Transaction
  24927. * @abstract
  24928. * @final
  24929. * @return {array<object>} List of operation wrap procedures.
  24930. * TODO: convert to array<TransactionWrapper>
  24931. */
  24932. getTransactionWrappers: function () {
  24933. return TRANSACTION_WRAPPERS;
  24934. },
  24935. /**
  24936. * @return {object} The queue to collect `onDOMReady` callbacks with.
  24937. */
  24938. getReactMountReady: function () {
  24939. return this.reactMountReady;
  24940. },
  24941. /**
  24942. * @return {object} The queue to collect React async events.
  24943. */
  24944. getUpdateQueue: function () {
  24945. return ReactUpdateQueue;
  24946. },
  24947. /**
  24948. * Save current transaction state -- if the return value from this method is
  24949. * passed to `rollback`, the transaction will be reset to that state.
  24950. */
  24951. checkpoint: function () {
  24952. // reactMountReady is the our only stateful wrapper
  24953. return this.reactMountReady.checkpoint();
  24954. },
  24955. rollback: function (checkpoint) {
  24956. this.reactMountReady.rollback(checkpoint);
  24957. },
  24958. /**
  24959. * `PooledClass` looks for this, and will invoke this before allowing this
  24960. * instance to be reused.
  24961. */
  24962. destructor: function () {
  24963. CallbackQueue.release(this.reactMountReady);
  24964. this.reactMountReady = null;
  24965. }
  24966. };
  24967. _assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
  24968. PooledClass.addPoolingTo(ReactReconcileTransaction);
  24969. module.exports = ReactReconcileTransaction;
  24970. /***/ }),
  24971. /* 177 */
  24972. /***/ (function(module, exports, __webpack_require__) {
  24973. "use strict";
  24974. /**
  24975. * Copyright 2013-present, Facebook, Inc.
  24976. * All rights reserved.
  24977. *
  24978. * This source code is licensed under the BSD-style license found in the
  24979. * LICENSE file in the root directory of this source tree. An additional grant
  24980. * of patent rights can be found in the PATENTS file in the same directory.
  24981. *
  24982. *
  24983. */
  24984. var ReactOwner = __webpack_require__(174);
  24985. var ReactRef = {};
  24986. function attachRef(ref, component, owner) {
  24987. if (typeof ref === 'function') {
  24988. ref(component.getPublicInstance());
  24989. } else {
  24990. // Legacy ref
  24991. ReactOwner.addComponentAsRefTo(component, ref, owner);
  24992. }
  24993. }
  24994. function detachRef(ref, component, owner) {
  24995. if (typeof ref === 'function') {
  24996. ref(null);
  24997. } else {
  24998. // Legacy ref
  24999. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  25000. }
  25001. }
  25002. ReactRef.attachRefs = function (instance, element) {
  25003. if (element === null || typeof element !== 'object') {
  25004. return;
  25005. }
  25006. var ref = element.ref;
  25007. if (ref != null) {
  25008. attachRef(ref, instance, element._owner);
  25009. }
  25010. };
  25011. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  25012. // If either the owner or a `ref` has changed, make sure the newest owner
  25013. // has stored a reference to `this`, and the previous owner (if different)
  25014. // has forgotten the reference to `this`. We use the element instead
  25015. // of the public this.props because the post processing cannot determine
  25016. // a ref. The ref conceptually lives on the element.
  25017. // TODO: Should this even be possible? The owner cannot change because
  25018. // it's forbidden by shouldUpdateReactComponent. The ref can change
  25019. // if you swap the keys of but not the refs. Reconsider where this check
  25020. // is made. It probably belongs where the key checking and
  25021. // instantiateReactComponent is done.
  25022. var prevRef = null;
  25023. var prevOwner = null;
  25024. if (prevElement !== null && typeof prevElement === 'object') {
  25025. prevRef = prevElement.ref;
  25026. prevOwner = prevElement._owner;
  25027. }
  25028. var nextRef = null;
  25029. var nextOwner = null;
  25030. if (nextElement !== null && typeof nextElement === 'object') {
  25031. nextRef = nextElement.ref;
  25032. nextOwner = nextElement._owner;
  25033. }
  25034. return prevRef !== nextRef ||
  25035. // If owner changes but we have an unchanged function ref, don't update refs
  25036. typeof nextRef === 'string' && nextOwner !== prevOwner;
  25037. };
  25038. ReactRef.detachRefs = function (instance, element) {
  25039. if (element === null || typeof element !== 'object') {
  25040. return;
  25041. }
  25042. var ref = element.ref;
  25043. if (ref != null) {
  25044. detachRef(ref, instance, element._owner);
  25045. }
  25046. };
  25047. module.exports = ReactRef;
  25048. /***/ }),
  25049. /* 178 */
  25050. /***/ (function(module, exports, __webpack_require__) {
  25051. "use strict";
  25052. /**
  25053. * Copyright 2014-present, Facebook, Inc.
  25054. * All rights reserved.
  25055. *
  25056. * This source code is licensed under the BSD-style license found in the
  25057. * LICENSE file in the root directory of this source tree. An additional grant
  25058. * of patent rights can be found in the PATENTS file in the same directory.
  25059. *
  25060. */
  25061. var _assign = __webpack_require__(3);
  25062. var PooledClass = __webpack_require__(15);
  25063. var Transaction = __webpack_require__(30);
  25064. var ReactInstrumentation = __webpack_require__(10);
  25065. var ReactServerUpdateQueue = __webpack_require__(179);
  25066. /**
  25067. * Executed within the scope of the `Transaction` instance. Consider these as
  25068. * being member methods, but with an implied ordering while being isolated from
  25069. * each other.
  25070. */
  25071. var TRANSACTION_WRAPPERS = [];
  25072. if (false) {
  25073. TRANSACTION_WRAPPERS.push({
  25074. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  25075. close: ReactInstrumentation.debugTool.onEndFlush
  25076. });
  25077. }
  25078. var noopCallbackQueue = {
  25079. enqueue: function () {}
  25080. };
  25081. /**
  25082. * @class ReactServerRenderingTransaction
  25083. * @param {boolean} renderToStaticMarkup
  25084. */
  25085. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  25086. this.reinitializeTransaction();
  25087. this.renderToStaticMarkup = renderToStaticMarkup;
  25088. this.useCreateElement = false;
  25089. this.updateQueue = new ReactServerUpdateQueue(this);
  25090. }
  25091. var Mixin = {
  25092. /**
  25093. * @see Transaction
  25094. * @abstract
  25095. * @final
  25096. * @return {array} Empty list of operation wrap procedures.
  25097. */
  25098. getTransactionWrappers: function () {
  25099. return TRANSACTION_WRAPPERS;
  25100. },
  25101. /**
  25102. * @return {object} The queue to collect `onDOMReady` callbacks with.
  25103. */
  25104. getReactMountReady: function () {
  25105. return noopCallbackQueue;
  25106. },
  25107. /**
  25108. * @return {object} The queue to collect React async events.
  25109. */
  25110. getUpdateQueue: function () {
  25111. return this.updateQueue;
  25112. },
  25113. /**
  25114. * `PooledClass` looks for this, and will invoke this before allowing this
  25115. * instance to be reused.
  25116. */
  25117. destructor: function () {},
  25118. checkpoint: function () {},
  25119. rollback: function () {}
  25120. };
  25121. _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
  25122. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  25123. module.exports = ReactServerRenderingTransaction;
  25124. /***/ }),
  25125. /* 179 */
  25126. /***/ (function(module, exports, __webpack_require__) {
  25127. "use strict";
  25128. /**
  25129. * Copyright 2015-present, Facebook, Inc.
  25130. * All rights reserved.
  25131. *
  25132. * This source code is licensed under the BSD-style license found in the
  25133. * LICENSE file in the root directory of this source tree. An additional grant
  25134. * of patent rights can be found in the PATENTS file in the same directory.
  25135. *
  25136. *
  25137. */
  25138. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  25139. var ReactUpdateQueue = __webpack_require__(43);
  25140. var warning = __webpack_require__(1);
  25141. function warnNoop(publicInstance, callerName) {
  25142. if (false) {
  25143. var constructor = publicInstance.constructor;
  25144. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
  25145. }
  25146. }
  25147. /**
  25148. * This is the update queue used for server rendering.
  25149. * It delegates to ReactUpdateQueue while server rendering is in progress and
  25150. * switches to ReactNoopUpdateQueue after the transaction has completed.
  25151. * @class ReactServerUpdateQueue
  25152. * @param {Transaction} transaction
  25153. */
  25154. var ReactServerUpdateQueue = function () {
  25155. function ReactServerUpdateQueue(transaction) {
  25156. _classCallCheck(this, ReactServerUpdateQueue);
  25157. this.transaction = transaction;
  25158. }
  25159. /**
  25160. * Checks whether or not this composite component is mounted.
  25161. * @param {ReactClass} publicInstance The instance we want to test.
  25162. * @return {boolean} True if mounted, false otherwise.
  25163. * @protected
  25164. * @final
  25165. */
  25166. ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
  25167. return false;
  25168. };
  25169. /**
  25170. * Enqueue a callback that will be executed after all the pending updates
  25171. * have processed.
  25172. *
  25173. * @param {ReactClass} publicInstance The instance to use as `this` context.
  25174. * @param {?function} callback Called after state is updated.
  25175. * @internal
  25176. */
  25177. ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
  25178. if (this.transaction.isInTransaction()) {
  25179. ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
  25180. }
  25181. };
  25182. /**
  25183. * Forces an update. This should only be invoked when it is known with
  25184. * certainty that we are **not** in a DOM transaction.
  25185. *
  25186. * You may want to call this when you know that some deeper aspect of the
  25187. * component's state has changed but `setState` was not called.
  25188. *
  25189. * This will not invoke `shouldComponentUpdate`, but it will invoke
  25190. * `componentWillUpdate` and `componentDidUpdate`.
  25191. *
  25192. * @param {ReactClass} publicInstance The instance that should rerender.
  25193. * @internal
  25194. */
  25195. ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
  25196. if (this.transaction.isInTransaction()) {
  25197. ReactUpdateQueue.enqueueForceUpdate(publicInstance);
  25198. } else {
  25199. warnNoop(publicInstance, 'forceUpdate');
  25200. }
  25201. };
  25202. /**
  25203. * Replaces all of the state. Always use this or `setState` to mutate state.
  25204. * You should treat `this.state` as immutable.
  25205. *
  25206. * There is no guarantee that `this.state` will be immediately updated, so
  25207. * accessing `this.state` after calling this method may return the old value.
  25208. *
  25209. * @param {ReactClass} publicInstance The instance that should rerender.
  25210. * @param {object|function} completeState Next state.
  25211. * @internal
  25212. */
  25213. ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
  25214. if (this.transaction.isInTransaction()) {
  25215. ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
  25216. } else {
  25217. warnNoop(publicInstance, 'replaceState');
  25218. }
  25219. };
  25220. /**
  25221. * Sets a subset of the state. This only exists because _pendingState is
  25222. * internal. This provides a merging strategy that is not available to deep
  25223. * properties which is confusing. TODO: Expose pendingState or don't use it
  25224. * during the merge.
  25225. *
  25226. * @param {ReactClass} publicInstance The instance that should rerender.
  25227. * @param {object|function} partialState Next partial state to be merged with state.
  25228. * @internal
  25229. */
  25230. ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
  25231. if (this.transaction.isInTransaction()) {
  25232. ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
  25233. } else {
  25234. warnNoop(publicInstance, 'setState');
  25235. }
  25236. };
  25237. return ReactServerUpdateQueue;
  25238. }();
  25239. module.exports = ReactServerUpdateQueue;
  25240. /***/ }),
  25241. /* 180 */
  25242. /***/ (function(module, exports, __webpack_require__) {
  25243. "use strict";
  25244. /**
  25245. * Copyright 2013-present, Facebook, Inc.
  25246. * All rights reserved.
  25247. *
  25248. * This source code is licensed under the BSD-style license found in the
  25249. * LICENSE file in the root directory of this source tree. An additional grant
  25250. * of patent rights can be found in the PATENTS file in the same directory.
  25251. *
  25252. */
  25253. module.exports = '15.4.2';
  25254. /***/ }),
  25255. /* 181 */
  25256. /***/ (function(module, exports, __webpack_require__) {
  25257. "use strict";
  25258. /**
  25259. * Copyright 2013-present, Facebook, Inc.
  25260. * All rights reserved.
  25261. *
  25262. * This source code is licensed under the BSD-style license found in the
  25263. * LICENSE file in the root directory of this source tree. An additional grant
  25264. * of patent rights can be found in the PATENTS file in the same directory.
  25265. *
  25266. */
  25267. var NS = {
  25268. xlink: 'http://www.w3.org/1999/xlink',
  25269. xml: 'http://www.w3.org/XML/1998/namespace'
  25270. };
  25271. // We use attributes for everything SVG so let's avoid some duplication and run
  25272. // code instead.
  25273. // The following are all specified in the HTML config already so we exclude here.
  25274. // - class (as className)
  25275. // - color
  25276. // - height
  25277. // - id
  25278. // - lang
  25279. // - max
  25280. // - media
  25281. // - method
  25282. // - min
  25283. // - name
  25284. // - style
  25285. // - target
  25286. // - type
  25287. // - width
  25288. var ATTRS = {
  25289. accentHeight: 'accent-height',
  25290. accumulate: 0,
  25291. additive: 0,
  25292. alignmentBaseline: 'alignment-baseline',
  25293. allowReorder: 'allowReorder',
  25294. alphabetic: 0,
  25295. amplitude: 0,
  25296. arabicForm: 'arabic-form',
  25297. ascent: 0,
  25298. attributeName: 'attributeName',
  25299. attributeType: 'attributeType',
  25300. autoReverse: 'autoReverse',
  25301. azimuth: 0,
  25302. baseFrequency: 'baseFrequency',
  25303. baseProfile: 'baseProfile',
  25304. baselineShift: 'baseline-shift',
  25305. bbox: 0,
  25306. begin: 0,
  25307. bias: 0,
  25308. by: 0,
  25309. calcMode: 'calcMode',
  25310. capHeight: 'cap-height',
  25311. clip: 0,
  25312. clipPath: 'clip-path',
  25313. clipRule: 'clip-rule',
  25314. clipPathUnits: 'clipPathUnits',
  25315. colorInterpolation: 'color-interpolation',
  25316. colorInterpolationFilters: 'color-interpolation-filters',
  25317. colorProfile: 'color-profile',
  25318. colorRendering: 'color-rendering',
  25319. contentScriptType: 'contentScriptType',
  25320. contentStyleType: 'contentStyleType',
  25321. cursor: 0,
  25322. cx: 0,
  25323. cy: 0,
  25324. d: 0,
  25325. decelerate: 0,
  25326. descent: 0,
  25327. diffuseConstant: 'diffuseConstant',
  25328. direction: 0,
  25329. display: 0,
  25330. divisor: 0,
  25331. dominantBaseline: 'dominant-baseline',
  25332. dur: 0,
  25333. dx: 0,
  25334. dy: 0,
  25335. edgeMode: 'edgeMode',
  25336. elevation: 0,
  25337. enableBackground: 'enable-background',
  25338. end: 0,
  25339. exponent: 0,
  25340. externalResourcesRequired: 'externalResourcesRequired',
  25341. fill: 0,
  25342. fillOpacity: 'fill-opacity',
  25343. fillRule: 'fill-rule',
  25344. filter: 0,
  25345. filterRes: 'filterRes',
  25346. filterUnits: 'filterUnits',
  25347. floodColor: 'flood-color',
  25348. floodOpacity: 'flood-opacity',
  25349. focusable: 0,
  25350. fontFamily: 'font-family',
  25351. fontSize: 'font-size',
  25352. fontSizeAdjust: 'font-size-adjust',
  25353. fontStretch: 'font-stretch',
  25354. fontStyle: 'font-style',
  25355. fontVariant: 'font-variant',
  25356. fontWeight: 'font-weight',
  25357. format: 0,
  25358. from: 0,
  25359. fx: 0,
  25360. fy: 0,
  25361. g1: 0,
  25362. g2: 0,
  25363. glyphName: 'glyph-name',
  25364. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  25365. glyphOrientationVertical: 'glyph-orientation-vertical',
  25366. glyphRef: 'glyphRef',
  25367. gradientTransform: 'gradientTransform',
  25368. gradientUnits: 'gradientUnits',
  25369. hanging: 0,
  25370. horizAdvX: 'horiz-adv-x',
  25371. horizOriginX: 'horiz-origin-x',
  25372. ideographic: 0,
  25373. imageRendering: 'image-rendering',
  25374. 'in': 0,
  25375. in2: 0,
  25376. intercept: 0,
  25377. k: 0,
  25378. k1: 0,
  25379. k2: 0,
  25380. k3: 0,
  25381. k4: 0,
  25382. kernelMatrix: 'kernelMatrix',
  25383. kernelUnitLength: 'kernelUnitLength',
  25384. kerning: 0,
  25385. keyPoints: 'keyPoints',
  25386. keySplines: 'keySplines',
  25387. keyTimes: 'keyTimes',
  25388. lengthAdjust: 'lengthAdjust',
  25389. letterSpacing: 'letter-spacing',
  25390. lightingColor: 'lighting-color',
  25391. limitingConeAngle: 'limitingConeAngle',
  25392. local: 0,
  25393. markerEnd: 'marker-end',
  25394. markerMid: 'marker-mid',
  25395. markerStart: 'marker-start',
  25396. markerHeight: 'markerHeight',
  25397. markerUnits: 'markerUnits',
  25398. markerWidth: 'markerWidth',
  25399. mask: 0,
  25400. maskContentUnits: 'maskContentUnits',
  25401. maskUnits: 'maskUnits',
  25402. mathematical: 0,
  25403. mode: 0,
  25404. numOctaves: 'numOctaves',
  25405. offset: 0,
  25406. opacity: 0,
  25407. operator: 0,
  25408. order: 0,
  25409. orient: 0,
  25410. orientation: 0,
  25411. origin: 0,
  25412. overflow: 0,
  25413. overlinePosition: 'overline-position',
  25414. overlineThickness: 'overline-thickness',
  25415. paintOrder: 'paint-order',
  25416. panose1: 'panose-1',
  25417. pathLength: 'pathLength',
  25418. patternContentUnits: 'patternContentUnits',
  25419. patternTransform: 'patternTransform',
  25420. patternUnits: 'patternUnits',
  25421. pointerEvents: 'pointer-events',
  25422. points: 0,
  25423. pointsAtX: 'pointsAtX',
  25424. pointsAtY: 'pointsAtY',
  25425. pointsAtZ: 'pointsAtZ',
  25426. preserveAlpha: 'preserveAlpha',
  25427. preserveAspectRatio: 'preserveAspectRatio',
  25428. primitiveUnits: 'primitiveUnits',
  25429. r: 0,
  25430. radius: 0,
  25431. refX: 'refX',
  25432. refY: 'refY',
  25433. renderingIntent: 'rendering-intent',
  25434. repeatCount: 'repeatCount',
  25435. repeatDur: 'repeatDur',
  25436. requiredExtensions: 'requiredExtensions',
  25437. requiredFeatures: 'requiredFeatures',
  25438. restart: 0,
  25439. result: 0,
  25440. rotate: 0,
  25441. rx: 0,
  25442. ry: 0,
  25443. scale: 0,
  25444. seed: 0,
  25445. shapeRendering: 'shape-rendering',
  25446. slope: 0,
  25447. spacing: 0,
  25448. specularConstant: 'specularConstant',
  25449. specularExponent: 'specularExponent',
  25450. speed: 0,
  25451. spreadMethod: 'spreadMethod',
  25452. startOffset: 'startOffset',
  25453. stdDeviation: 'stdDeviation',
  25454. stemh: 0,
  25455. stemv: 0,
  25456. stitchTiles: 'stitchTiles',
  25457. stopColor: 'stop-color',
  25458. stopOpacity: 'stop-opacity',
  25459. strikethroughPosition: 'strikethrough-position',
  25460. strikethroughThickness: 'strikethrough-thickness',
  25461. string: 0,
  25462. stroke: 0,
  25463. strokeDasharray: 'stroke-dasharray',
  25464. strokeDashoffset: 'stroke-dashoffset',
  25465. strokeLinecap: 'stroke-linecap',
  25466. strokeLinejoin: 'stroke-linejoin',
  25467. strokeMiterlimit: 'stroke-miterlimit',
  25468. strokeOpacity: 'stroke-opacity',
  25469. strokeWidth: 'stroke-width',
  25470. surfaceScale: 'surfaceScale',
  25471. systemLanguage: 'systemLanguage',
  25472. tableValues: 'tableValues',
  25473. targetX: 'targetX',
  25474. targetY: 'targetY',
  25475. textAnchor: 'text-anchor',
  25476. textDecoration: 'text-decoration',
  25477. textRendering: 'text-rendering',
  25478. textLength: 'textLength',
  25479. to: 0,
  25480. transform: 0,
  25481. u1: 0,
  25482. u2: 0,
  25483. underlinePosition: 'underline-position',
  25484. underlineThickness: 'underline-thickness',
  25485. unicode: 0,
  25486. unicodeBidi: 'unicode-bidi',
  25487. unicodeRange: 'unicode-range',
  25488. unitsPerEm: 'units-per-em',
  25489. vAlphabetic: 'v-alphabetic',
  25490. vHanging: 'v-hanging',
  25491. vIdeographic: 'v-ideographic',
  25492. vMathematical: 'v-mathematical',
  25493. values: 0,
  25494. vectorEffect: 'vector-effect',
  25495. version: 0,
  25496. vertAdvY: 'vert-adv-y',
  25497. vertOriginX: 'vert-origin-x',
  25498. vertOriginY: 'vert-origin-y',
  25499. viewBox: 'viewBox',
  25500. viewTarget: 'viewTarget',
  25501. visibility: 0,
  25502. widths: 0,
  25503. wordSpacing: 'word-spacing',
  25504. writingMode: 'writing-mode',
  25505. x: 0,
  25506. xHeight: 'x-height',
  25507. x1: 0,
  25508. x2: 0,
  25509. xChannelSelector: 'xChannelSelector',
  25510. xlinkActuate: 'xlink:actuate',
  25511. xlinkArcrole: 'xlink:arcrole',
  25512. xlinkHref: 'xlink:href',
  25513. xlinkRole: 'xlink:role',
  25514. xlinkShow: 'xlink:show',
  25515. xlinkTitle: 'xlink:title',
  25516. xlinkType: 'xlink:type',
  25517. xmlBase: 'xml:base',
  25518. xmlns: 0,
  25519. xmlnsXlink: 'xmlns:xlink',
  25520. xmlLang: 'xml:lang',
  25521. xmlSpace: 'xml:space',
  25522. y: 0,
  25523. y1: 0,
  25524. y2: 0,
  25525. yChannelSelector: 'yChannelSelector',
  25526. z: 0,
  25527. zoomAndPan: 'zoomAndPan'
  25528. };
  25529. var SVGDOMPropertyConfig = {
  25530. Properties: {},
  25531. DOMAttributeNamespaces: {
  25532. xlinkActuate: NS.xlink,
  25533. xlinkArcrole: NS.xlink,
  25534. xlinkHref: NS.xlink,
  25535. xlinkRole: NS.xlink,
  25536. xlinkShow: NS.xlink,
  25537. xlinkTitle: NS.xlink,
  25538. xlinkType: NS.xlink,
  25539. xmlBase: NS.xml,
  25540. xmlLang: NS.xml,
  25541. xmlSpace: NS.xml
  25542. },
  25543. DOMAttributeNames: {}
  25544. };
  25545. Object.keys(ATTRS).forEach(function (key) {
  25546. SVGDOMPropertyConfig.Properties[key] = 0;
  25547. if (ATTRS[key]) {
  25548. SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  25549. }
  25550. });
  25551. module.exports = SVGDOMPropertyConfig;
  25552. /***/ }),
  25553. /* 182 */
  25554. /***/ (function(module, exports, __webpack_require__) {
  25555. "use strict";
  25556. /**
  25557. * Copyright 2013-present, Facebook, Inc.
  25558. * All rights reserved.
  25559. *
  25560. * This source code is licensed under the BSD-style license found in the
  25561. * LICENSE file in the root directory of this source tree. An additional grant
  25562. * of patent rights can be found in the PATENTS file in the same directory.
  25563. *
  25564. */
  25565. var EventPropagators = __webpack_require__(25);
  25566. var ExecutionEnvironment = __webpack_require__(5);
  25567. var ReactDOMComponentTree = __webpack_require__(4);
  25568. var ReactInputSelection = __webpack_require__(66);
  25569. var SyntheticEvent = __webpack_require__(12);
  25570. var getActiveElement = __webpack_require__(57);
  25571. var isTextInputElement = __webpack_require__(75);
  25572. var shallowEqual = __webpack_require__(34);
  25573. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  25574. var eventTypes = {
  25575. select: {
  25576. phasedRegistrationNames: {
  25577. bubbled: 'onSelect',
  25578. captured: 'onSelectCapture'
  25579. },
  25580. dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
  25581. }
  25582. };
  25583. var activeElement = null;
  25584. var activeElementInst = null;
  25585. var lastSelection = null;
  25586. var mouseDown = false;
  25587. // Track whether a listener exists for this plugin. If none exist, we do
  25588. // not extract events. See #3639.
  25589. var hasListener = false;
  25590. /**
  25591. * Get an object which is a unique representation of the current selection.
  25592. *
  25593. * The return value will not be consistent across nodes or browsers, but
  25594. * two identical selections on the same node will return identical objects.
  25595. *
  25596. * @param {DOMElement} node
  25597. * @return {object}
  25598. */
  25599. function getSelection(node) {
  25600. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  25601. return {
  25602. start: node.selectionStart,
  25603. end: node.selectionEnd
  25604. };
  25605. } else if (window.getSelection) {
  25606. var selection = window.getSelection();
  25607. return {
  25608. anchorNode: selection.anchorNode,
  25609. anchorOffset: selection.anchorOffset,
  25610. focusNode: selection.focusNode,
  25611. focusOffset: selection.focusOffset
  25612. };
  25613. } else if (document.selection) {
  25614. var range = document.selection.createRange();
  25615. return {
  25616. parentElement: range.parentElement(),
  25617. text: range.text,
  25618. top: range.boundingTop,
  25619. left: range.boundingLeft
  25620. };
  25621. }
  25622. }
  25623. /**
  25624. * Poll selection to see whether it's changed.
  25625. *
  25626. * @param {object} nativeEvent
  25627. * @return {?SyntheticEvent}
  25628. */
  25629. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  25630. // Ensure we have the right element, and that the user is not dragging a
  25631. // selection (this matches native `select` event behavior). In HTML5, select
  25632. // fires only on input and textarea thus if there's no focused element we
  25633. // won't dispatch.
  25634. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  25635. return null;
  25636. }
  25637. // Only fire when selection has actually changed.
  25638. var currentSelection = getSelection(activeElement);
  25639. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  25640. lastSelection = currentSelection;
  25641. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
  25642. syntheticEvent.type = 'select';
  25643. syntheticEvent.target = activeElement;
  25644. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  25645. return syntheticEvent;
  25646. }
  25647. return null;
  25648. }
  25649. /**
  25650. * This plugin creates an `onSelect` event that normalizes select events
  25651. * across form elements.
  25652. *
  25653. * Supported elements are:
  25654. * - input (see `isTextInputElement`)
  25655. * - textarea
  25656. * - contentEditable
  25657. *
  25658. * This differs from native browser implementations in the following ways:
  25659. * - Fires on contentEditable fields as well as inputs.
  25660. * - Fires for collapsed selection.
  25661. * - Fires after user input.
  25662. */
  25663. var SelectEventPlugin = {
  25664. eventTypes: eventTypes,
  25665. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  25666. if (!hasListener) {
  25667. return null;
  25668. }
  25669. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  25670. switch (topLevelType) {
  25671. // Track the input node that has focus.
  25672. case 'topFocus':
  25673. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  25674. activeElement = targetNode;
  25675. activeElementInst = targetInst;
  25676. lastSelection = null;
  25677. }
  25678. break;
  25679. case 'topBlur':
  25680. activeElement = null;
  25681. activeElementInst = null;
  25682. lastSelection = null;
  25683. break;
  25684. // Don't fire the event while the user is dragging. This matches the
  25685. // semantics of the native select event.
  25686. case 'topMouseDown':
  25687. mouseDown = true;
  25688. break;
  25689. case 'topContextMenu':
  25690. case 'topMouseUp':
  25691. mouseDown = false;
  25692. return constructSelectEvent(nativeEvent, nativeEventTarget);
  25693. // Chrome and IE fire non-standard event when selection is changed (and
  25694. // sometimes when it hasn't). IE's event fires out of order with respect
  25695. // to key and input events on deletion, so we discard it.
  25696. //
  25697. // Firefox doesn't support selectionchange, so check selection status
  25698. // after each key entry. The selection changes after keydown and before
  25699. // keyup, but we check on keydown as well in the case of holding down a
  25700. // key, when multiple keydown events are fired but only one keyup is.
  25701. // This is also our approach for IE handling, for the reason above.
  25702. case 'topSelectionChange':
  25703. if (skipSelectionChangeEvent) {
  25704. break;
  25705. }
  25706. // falls through
  25707. case 'topKeyDown':
  25708. case 'topKeyUp':
  25709. return constructSelectEvent(nativeEvent, nativeEventTarget);
  25710. }
  25711. return null;
  25712. },
  25713. didPutListener: function (inst, registrationName, listener) {
  25714. if (registrationName === 'onSelect') {
  25715. hasListener = true;
  25716. }
  25717. }
  25718. };
  25719. module.exports = SelectEventPlugin;
  25720. /***/ }),
  25721. /* 183 */
  25722. /***/ (function(module, exports, __webpack_require__) {
  25723. "use strict";
  25724. /**
  25725. * Copyright 2013-present, Facebook, Inc.
  25726. * All rights reserved.
  25727. *
  25728. * This source code is licensed under the BSD-style license found in the
  25729. * LICENSE file in the root directory of this source tree. An additional grant
  25730. * of patent rights can be found in the PATENTS file in the same directory.
  25731. *
  25732. *
  25733. */
  25734. var _prodInvariant = __webpack_require__(2);
  25735. var EventListener = __webpack_require__(55);
  25736. var EventPropagators = __webpack_require__(25);
  25737. var ReactDOMComponentTree = __webpack_require__(4);
  25738. var SyntheticAnimationEvent = __webpack_require__(184);
  25739. var SyntheticClipboardEvent = __webpack_require__(185);
  25740. var SyntheticEvent = __webpack_require__(12);
  25741. var SyntheticFocusEvent = __webpack_require__(188);
  25742. var SyntheticKeyboardEvent = __webpack_require__(190);
  25743. var SyntheticMouseEvent = __webpack_require__(29);
  25744. var SyntheticDragEvent = __webpack_require__(187);
  25745. var SyntheticTouchEvent = __webpack_require__(191);
  25746. var SyntheticTransitionEvent = __webpack_require__(192);
  25747. var SyntheticUIEvent = __webpack_require__(27);
  25748. var SyntheticWheelEvent = __webpack_require__(193);
  25749. var emptyFunction = __webpack_require__(9);
  25750. var getEventCharCode = __webpack_require__(45);
  25751. var invariant = __webpack_require__(0);
  25752. /**
  25753. * Turns
  25754. * ['abort', ...]
  25755. * into
  25756. * eventTypes = {
  25757. * 'abort': {
  25758. * phasedRegistrationNames: {
  25759. * bubbled: 'onAbort',
  25760. * captured: 'onAbortCapture',
  25761. * },
  25762. * dependencies: ['topAbort'],
  25763. * },
  25764. * ...
  25765. * };
  25766. * topLevelEventsToDispatchConfig = {
  25767. * 'topAbort': { sameConfig }
  25768. * };
  25769. */
  25770. var eventTypes = {};
  25771. var topLevelEventsToDispatchConfig = {};
  25772. ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) {
  25773. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  25774. var onEvent = 'on' + capitalizedEvent;
  25775. var topEvent = 'top' + capitalizedEvent;
  25776. var type = {
  25777. phasedRegistrationNames: {
  25778. bubbled: onEvent,
  25779. captured: onEvent + 'Capture'
  25780. },
  25781. dependencies: [topEvent]
  25782. };
  25783. eventTypes[event] = type;
  25784. topLevelEventsToDispatchConfig[topEvent] = type;
  25785. });
  25786. var onClickListeners = {};
  25787. function getDictionaryKey(inst) {
  25788. // Prevents V8 performance issue:
  25789. // https://github.com/facebook/react/pull/7232
  25790. return '.' + inst._rootNodeID;
  25791. }
  25792. function isInteractive(tag) {
  25793. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  25794. }
  25795. var SimpleEventPlugin = {
  25796. eventTypes: eventTypes,
  25797. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  25798. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  25799. if (!dispatchConfig) {
  25800. return null;
  25801. }
  25802. var EventConstructor;
  25803. switch (topLevelType) {
  25804. case 'topAbort':
  25805. case 'topCanPlay':
  25806. case 'topCanPlayThrough':
  25807. case 'topDurationChange':
  25808. case 'topEmptied':
  25809. case 'topEncrypted':
  25810. case 'topEnded':
  25811. case 'topError':
  25812. case 'topInput':
  25813. case 'topInvalid':
  25814. case 'topLoad':
  25815. case 'topLoadedData':
  25816. case 'topLoadedMetadata':
  25817. case 'topLoadStart':
  25818. case 'topPause':
  25819. case 'topPlay':
  25820. case 'topPlaying':
  25821. case 'topProgress':
  25822. case 'topRateChange':
  25823. case 'topReset':
  25824. case 'topSeeked':
  25825. case 'topSeeking':
  25826. case 'topStalled':
  25827. case 'topSubmit':
  25828. case 'topSuspend':
  25829. case 'topTimeUpdate':
  25830. case 'topVolumeChange':
  25831. case 'topWaiting':
  25832. // HTML Events
  25833. // @see http://www.w3.org/TR/html5/index.html#events-0
  25834. EventConstructor = SyntheticEvent;
  25835. break;
  25836. case 'topKeyPress':
  25837. // Firefox creates a keypress event for function keys too. This removes
  25838. // the unwanted keypress events. Enter is however both printable and
  25839. // non-printable. One would expect Tab to be as well (but it isn't).
  25840. if (getEventCharCode(nativeEvent) === 0) {
  25841. return null;
  25842. }
  25843. /* falls through */
  25844. case 'topKeyDown':
  25845. case 'topKeyUp':
  25846. EventConstructor = SyntheticKeyboardEvent;
  25847. break;
  25848. case 'topBlur':
  25849. case 'topFocus':
  25850. EventConstructor = SyntheticFocusEvent;
  25851. break;
  25852. case 'topClick':
  25853. // Firefox creates a click event on right mouse clicks. This removes the
  25854. // unwanted click events.
  25855. if (nativeEvent.button === 2) {
  25856. return null;
  25857. }
  25858. /* falls through */
  25859. case 'topDoubleClick':
  25860. case 'topMouseDown':
  25861. case 'topMouseMove':
  25862. case 'topMouseUp':
  25863. // TODO: Disabled elements should not respond to mouse events
  25864. /* falls through */
  25865. case 'topMouseOut':
  25866. case 'topMouseOver':
  25867. case 'topContextMenu':
  25868. EventConstructor = SyntheticMouseEvent;
  25869. break;
  25870. case 'topDrag':
  25871. case 'topDragEnd':
  25872. case 'topDragEnter':
  25873. case 'topDragExit':
  25874. case 'topDragLeave':
  25875. case 'topDragOver':
  25876. case 'topDragStart':
  25877. case 'topDrop':
  25878. EventConstructor = SyntheticDragEvent;
  25879. break;
  25880. case 'topTouchCancel':
  25881. case 'topTouchEnd':
  25882. case 'topTouchMove':
  25883. case 'topTouchStart':
  25884. EventConstructor = SyntheticTouchEvent;
  25885. break;
  25886. case 'topAnimationEnd':
  25887. case 'topAnimationIteration':
  25888. case 'topAnimationStart':
  25889. EventConstructor = SyntheticAnimationEvent;
  25890. break;
  25891. case 'topTransitionEnd':
  25892. EventConstructor = SyntheticTransitionEvent;
  25893. break;
  25894. case 'topScroll':
  25895. EventConstructor = SyntheticUIEvent;
  25896. break;
  25897. case 'topWheel':
  25898. EventConstructor = SyntheticWheelEvent;
  25899. break;
  25900. case 'topCopy':
  25901. case 'topCut':
  25902. case 'topPaste':
  25903. EventConstructor = SyntheticClipboardEvent;
  25904. break;
  25905. }
  25906. !EventConstructor ? false ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
  25907. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  25908. EventPropagators.accumulateTwoPhaseDispatches(event);
  25909. return event;
  25910. },
  25911. didPutListener: function (inst, registrationName, listener) {
  25912. // Mobile Safari does not fire properly bubble click events on
  25913. // non-interactive elements, which means delegated click listeners do not
  25914. // fire. The workaround for this bug involves attaching an empty click
  25915. // listener on the target node.
  25916. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  25917. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  25918. var key = getDictionaryKey(inst);
  25919. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25920. if (!onClickListeners[key]) {
  25921. onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
  25922. }
  25923. }
  25924. },
  25925. willDeleteListener: function (inst, registrationName) {
  25926. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  25927. var key = getDictionaryKey(inst);
  25928. onClickListeners[key].remove();
  25929. delete onClickListeners[key];
  25930. }
  25931. }
  25932. };
  25933. module.exports = SimpleEventPlugin;
  25934. /***/ }),
  25935. /* 184 */
  25936. /***/ (function(module, exports, __webpack_require__) {
  25937. "use strict";
  25938. /**
  25939. * Copyright 2013-present, Facebook, Inc.
  25940. * All rights reserved.
  25941. *
  25942. * This source code is licensed under the BSD-style license found in the
  25943. * LICENSE file in the root directory of this source tree. An additional grant
  25944. * of patent rights can be found in the PATENTS file in the same directory.
  25945. *
  25946. */
  25947. var SyntheticEvent = __webpack_require__(12);
  25948. /**
  25949. * @interface Event
  25950. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  25951. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  25952. */
  25953. var AnimationEventInterface = {
  25954. animationName: null,
  25955. elapsedTime: null,
  25956. pseudoElement: null
  25957. };
  25958. /**
  25959. * @param {object} dispatchConfig Configuration used to dispatch this event.
  25960. * @param {string} dispatchMarker Marker identifying the event target.
  25961. * @param {object} nativeEvent Native browser event.
  25962. * @extends {SyntheticEvent}
  25963. */
  25964. function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  25965. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  25966. }
  25967. SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
  25968. module.exports = SyntheticAnimationEvent;
  25969. /***/ }),
  25970. /* 185 */
  25971. /***/ (function(module, exports, __webpack_require__) {
  25972. "use strict";
  25973. /**
  25974. * Copyright 2013-present, Facebook, Inc.
  25975. * All rights reserved.
  25976. *
  25977. * This source code is licensed under the BSD-style license found in the
  25978. * LICENSE file in the root directory of this source tree. An additional grant
  25979. * of patent rights can be found in the PATENTS file in the same directory.
  25980. *
  25981. */
  25982. var SyntheticEvent = __webpack_require__(12);
  25983. /**
  25984. * @interface Event
  25985. * @see http://www.w3.org/TR/clipboard-apis/
  25986. */
  25987. var ClipboardEventInterface = {
  25988. clipboardData: function (event) {
  25989. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  25990. }
  25991. };
  25992. /**
  25993. * @param {object} dispatchConfig Configuration used to dispatch this event.
  25994. * @param {string} dispatchMarker Marker identifying the event target.
  25995. * @param {object} nativeEvent Native browser event.
  25996. * @extends {SyntheticUIEvent}
  25997. */
  25998. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  25999. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26000. }
  26001. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  26002. module.exports = SyntheticClipboardEvent;
  26003. /***/ }),
  26004. /* 186 */
  26005. /***/ (function(module, exports, __webpack_require__) {
  26006. "use strict";
  26007. /**
  26008. * Copyright 2013-present, Facebook, Inc.
  26009. * All rights reserved.
  26010. *
  26011. * This source code is licensed under the BSD-style license found in the
  26012. * LICENSE file in the root directory of this source tree. An additional grant
  26013. * of patent rights can be found in the PATENTS file in the same directory.
  26014. *
  26015. */
  26016. var SyntheticEvent = __webpack_require__(12);
  26017. /**
  26018. * @interface Event
  26019. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  26020. */
  26021. var CompositionEventInterface = {
  26022. data: null
  26023. };
  26024. /**
  26025. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26026. * @param {string} dispatchMarker Marker identifying the event target.
  26027. * @param {object} nativeEvent Native browser event.
  26028. * @extends {SyntheticUIEvent}
  26029. */
  26030. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26031. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26032. }
  26033. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  26034. module.exports = SyntheticCompositionEvent;
  26035. /***/ }),
  26036. /* 187 */
  26037. /***/ (function(module, exports, __webpack_require__) {
  26038. "use strict";
  26039. /**
  26040. * Copyright 2013-present, Facebook, Inc.
  26041. * All rights reserved.
  26042. *
  26043. * This source code is licensed under the BSD-style license found in the
  26044. * LICENSE file in the root directory of this source tree. An additional grant
  26045. * of patent rights can be found in the PATENTS file in the same directory.
  26046. *
  26047. */
  26048. var SyntheticMouseEvent = __webpack_require__(29);
  26049. /**
  26050. * @interface DragEvent
  26051. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  26052. */
  26053. var DragEventInterface = {
  26054. dataTransfer: null
  26055. };
  26056. /**
  26057. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26058. * @param {string} dispatchMarker Marker identifying the event target.
  26059. * @param {object} nativeEvent Native browser event.
  26060. * @extends {SyntheticUIEvent}
  26061. */
  26062. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26063. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26064. }
  26065. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  26066. module.exports = SyntheticDragEvent;
  26067. /***/ }),
  26068. /* 188 */
  26069. /***/ (function(module, exports, __webpack_require__) {
  26070. "use strict";
  26071. /**
  26072. * Copyright 2013-present, Facebook, Inc.
  26073. * All rights reserved.
  26074. *
  26075. * This source code is licensed under the BSD-style license found in the
  26076. * LICENSE file in the root directory of this source tree. An additional grant
  26077. * of patent rights can be found in the PATENTS file in the same directory.
  26078. *
  26079. */
  26080. var SyntheticUIEvent = __webpack_require__(27);
  26081. /**
  26082. * @interface FocusEvent
  26083. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  26084. */
  26085. var FocusEventInterface = {
  26086. relatedTarget: null
  26087. };
  26088. /**
  26089. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26090. * @param {string} dispatchMarker Marker identifying the event target.
  26091. * @param {object} nativeEvent Native browser event.
  26092. * @extends {SyntheticUIEvent}
  26093. */
  26094. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26095. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26096. }
  26097. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  26098. module.exports = SyntheticFocusEvent;
  26099. /***/ }),
  26100. /* 189 */
  26101. /***/ (function(module, exports, __webpack_require__) {
  26102. "use strict";
  26103. /**
  26104. * Copyright 2013-present, Facebook, Inc.
  26105. * All rights reserved.
  26106. *
  26107. * This source code is licensed under the BSD-style license found in the
  26108. * LICENSE file in the root directory of this source tree. An additional grant
  26109. * of patent rights can be found in the PATENTS file in the same directory.
  26110. *
  26111. */
  26112. var SyntheticEvent = __webpack_require__(12);
  26113. /**
  26114. * @interface Event
  26115. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  26116. * /#events-inputevents
  26117. */
  26118. var InputEventInterface = {
  26119. data: null
  26120. };
  26121. /**
  26122. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26123. * @param {string} dispatchMarker Marker identifying the event target.
  26124. * @param {object} nativeEvent Native browser event.
  26125. * @extends {SyntheticUIEvent}
  26126. */
  26127. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26128. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26129. }
  26130. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  26131. module.exports = SyntheticInputEvent;
  26132. /***/ }),
  26133. /* 190 */
  26134. /***/ (function(module, exports, __webpack_require__) {
  26135. "use strict";
  26136. /**
  26137. * Copyright 2013-present, Facebook, Inc.
  26138. * All rights reserved.
  26139. *
  26140. * This source code is licensed under the BSD-style license found in the
  26141. * LICENSE file in the root directory of this source tree. An additional grant
  26142. * of patent rights can be found in the PATENTS file in the same directory.
  26143. *
  26144. */
  26145. var SyntheticUIEvent = __webpack_require__(27);
  26146. var getEventCharCode = __webpack_require__(45);
  26147. var getEventKey = __webpack_require__(198);
  26148. var getEventModifierState = __webpack_require__(46);
  26149. /**
  26150. * @interface KeyboardEvent
  26151. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  26152. */
  26153. var KeyboardEventInterface = {
  26154. key: getEventKey,
  26155. location: null,
  26156. ctrlKey: null,
  26157. shiftKey: null,
  26158. altKey: null,
  26159. metaKey: null,
  26160. repeat: null,
  26161. locale: null,
  26162. getModifierState: getEventModifierState,
  26163. // Legacy Interface
  26164. charCode: function (event) {
  26165. // `charCode` is the result of a KeyPress event and represents the value of
  26166. // the actual printable character.
  26167. // KeyPress is deprecated, but its replacement is not yet final and not
  26168. // implemented in any major browser. Only KeyPress has charCode.
  26169. if (event.type === 'keypress') {
  26170. return getEventCharCode(event);
  26171. }
  26172. return 0;
  26173. },
  26174. keyCode: function (event) {
  26175. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  26176. // physical keyboard key.
  26177. // The actual meaning of the value depends on the users' keyboard layout
  26178. // which cannot be detected. Assuming that it is a US keyboard layout
  26179. // provides a surprisingly accurate mapping for US and European users.
  26180. // Due to this, it is left to the user to implement at this time.
  26181. if (event.type === 'keydown' || event.type === 'keyup') {
  26182. return event.keyCode;
  26183. }
  26184. return 0;
  26185. },
  26186. which: function (event) {
  26187. // `which` is an alias for either `keyCode` or `charCode` depending on the
  26188. // type of the event.
  26189. if (event.type === 'keypress') {
  26190. return getEventCharCode(event);
  26191. }
  26192. if (event.type === 'keydown' || event.type === 'keyup') {
  26193. return event.keyCode;
  26194. }
  26195. return 0;
  26196. }
  26197. };
  26198. /**
  26199. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26200. * @param {string} dispatchMarker Marker identifying the event target.
  26201. * @param {object} nativeEvent Native browser event.
  26202. * @extends {SyntheticUIEvent}
  26203. */
  26204. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26205. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26206. }
  26207. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  26208. module.exports = SyntheticKeyboardEvent;
  26209. /***/ }),
  26210. /* 191 */
  26211. /***/ (function(module, exports, __webpack_require__) {
  26212. "use strict";
  26213. /**
  26214. * Copyright 2013-present, Facebook, Inc.
  26215. * All rights reserved.
  26216. *
  26217. * This source code is licensed under the BSD-style license found in the
  26218. * LICENSE file in the root directory of this source tree. An additional grant
  26219. * of patent rights can be found in the PATENTS file in the same directory.
  26220. *
  26221. */
  26222. var SyntheticUIEvent = __webpack_require__(27);
  26223. var getEventModifierState = __webpack_require__(46);
  26224. /**
  26225. * @interface TouchEvent
  26226. * @see http://www.w3.org/TR/touch-events/
  26227. */
  26228. var TouchEventInterface = {
  26229. touches: null,
  26230. targetTouches: null,
  26231. changedTouches: null,
  26232. altKey: null,
  26233. metaKey: null,
  26234. ctrlKey: null,
  26235. shiftKey: null,
  26236. getModifierState: getEventModifierState
  26237. };
  26238. /**
  26239. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26240. * @param {string} dispatchMarker Marker identifying the event target.
  26241. * @param {object} nativeEvent Native browser event.
  26242. * @extends {SyntheticUIEvent}
  26243. */
  26244. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26245. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26246. }
  26247. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  26248. module.exports = SyntheticTouchEvent;
  26249. /***/ }),
  26250. /* 192 */
  26251. /***/ (function(module, exports, __webpack_require__) {
  26252. "use strict";
  26253. /**
  26254. * Copyright 2013-present, Facebook, Inc.
  26255. * All rights reserved.
  26256. *
  26257. * This source code is licensed under the BSD-style license found in the
  26258. * LICENSE file in the root directory of this source tree. An additional grant
  26259. * of patent rights can be found in the PATENTS file in the same directory.
  26260. *
  26261. */
  26262. var SyntheticEvent = __webpack_require__(12);
  26263. /**
  26264. * @interface Event
  26265. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  26266. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  26267. */
  26268. var TransitionEventInterface = {
  26269. propertyName: null,
  26270. elapsedTime: null,
  26271. pseudoElement: null
  26272. };
  26273. /**
  26274. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26275. * @param {string} dispatchMarker Marker identifying the event target.
  26276. * @param {object} nativeEvent Native browser event.
  26277. * @extends {SyntheticEvent}
  26278. */
  26279. function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26280. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26281. }
  26282. SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
  26283. module.exports = SyntheticTransitionEvent;
  26284. /***/ }),
  26285. /* 193 */
  26286. /***/ (function(module, exports, __webpack_require__) {
  26287. "use strict";
  26288. /**
  26289. * Copyright 2013-present, Facebook, Inc.
  26290. * All rights reserved.
  26291. *
  26292. * This source code is licensed under the BSD-style license found in the
  26293. * LICENSE file in the root directory of this source tree. An additional grant
  26294. * of patent rights can be found in the PATENTS file in the same directory.
  26295. *
  26296. */
  26297. var SyntheticMouseEvent = __webpack_require__(29);
  26298. /**
  26299. * @interface WheelEvent
  26300. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  26301. */
  26302. var WheelEventInterface = {
  26303. deltaX: function (event) {
  26304. return 'deltaX' in event ? event.deltaX :
  26305. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  26306. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  26307. },
  26308. deltaY: function (event) {
  26309. return 'deltaY' in event ? event.deltaY :
  26310. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  26311. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  26312. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  26313. 'wheelDelta' in event ? -event.wheelDelta : 0;
  26314. },
  26315. deltaZ: null,
  26316. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  26317. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  26318. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  26319. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  26320. deltaMode: null
  26321. };
  26322. /**
  26323. * @param {object} dispatchConfig Configuration used to dispatch this event.
  26324. * @param {string} dispatchMarker Marker identifying the event target.
  26325. * @param {object} nativeEvent Native browser event.
  26326. * @extends {SyntheticMouseEvent}
  26327. */
  26328. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  26329. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  26330. }
  26331. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  26332. module.exports = SyntheticWheelEvent;
  26333. /***/ }),
  26334. /* 194 */
  26335. /***/ (function(module, exports, __webpack_require__) {
  26336. "use strict";
  26337. /**
  26338. * Copyright 2013-present, Facebook, Inc.
  26339. * All rights reserved.
  26340. *
  26341. * This source code is licensed under the BSD-style license found in the
  26342. * LICENSE file in the root directory of this source tree. An additional grant
  26343. * of patent rights can be found in the PATENTS file in the same directory.
  26344. *
  26345. *
  26346. */
  26347. var MOD = 65521;
  26348. // adler32 is not cryptographically strong, and is only used to sanity check that
  26349. // markup generated on the server matches the markup generated on the client.
  26350. // This implementation (a modified version of the SheetJS version) has been optimized
  26351. // for our use case, at the expense of conforming to the adler32 specification
  26352. // for non-ascii inputs.
  26353. function adler32(data) {
  26354. var a = 1;
  26355. var b = 0;
  26356. var i = 0;
  26357. var l = data.length;
  26358. var m = l & ~0x3;
  26359. while (i < m) {
  26360. var n = Math.min(i + 4096, m);
  26361. for (; i < n; i += 4) {
  26362. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  26363. }
  26364. a %= MOD;
  26365. b %= MOD;
  26366. }
  26367. for (; i < l; i++) {
  26368. b += a += data.charCodeAt(i);
  26369. }
  26370. a %= MOD;
  26371. b %= MOD;
  26372. return a | b << 16;
  26373. }
  26374. module.exports = adler32;
  26375. /***/ }),
  26376. /* 195 */
  26377. /***/ (function(module, exports, __webpack_require__) {
  26378. "use strict";
  26379. /**
  26380. * Copyright 2013-present, Facebook, Inc.
  26381. * All rights reserved.
  26382. *
  26383. * This source code is licensed under the BSD-style license found in the
  26384. * LICENSE file in the root directory of this source tree. An additional grant
  26385. * of patent rights can be found in the PATENTS file in the same directory.
  26386. *
  26387. */
  26388. var CSSProperty = __webpack_require__(58);
  26389. var warning = __webpack_require__(1);
  26390. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  26391. var styleWarnings = {};
  26392. /**
  26393. * Convert a value into the proper css writable value. The style name `name`
  26394. * should be logical (no hyphens), as specified
  26395. * in `CSSProperty.isUnitlessNumber`.
  26396. *
  26397. * @param {string} name CSS property name such as `topMargin`.
  26398. * @param {*} value CSS property value such as `10px`.
  26399. * @param {ReactDOMComponent} component
  26400. * @return {string} Normalized style value with dimensions applied.
  26401. */
  26402. function dangerousStyleValue(name, value, component) {
  26403. // Note that we've removed escapeTextForBrowser() calls here since the
  26404. // whole string will be escaped when the attribute is injected into
  26405. // the markup. If you provide unsafe user data here they can inject
  26406. // arbitrary CSS which may be problematic (I couldn't repro this):
  26407. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  26408. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  26409. // This is not an XSS hole but instead a potential CSS injection issue
  26410. // which has lead to a greater discussion about how we're going to
  26411. // trust URLs moving forward. See #2115901
  26412. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  26413. if (isEmpty) {
  26414. return '';
  26415. }
  26416. var isNonNumeric = isNaN(value);
  26417. if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  26418. return '' + value; // cast to string
  26419. }
  26420. if (typeof value === 'string') {
  26421. if (false) {
  26422. // Allow '0' to pass through without warning. 0 is already special and
  26423. // doesn't require units, so we don't need to warn about it.
  26424. if (component && value !== '0') {
  26425. var owner = component._currentElement._owner;
  26426. var ownerName = owner ? owner.getName() : null;
  26427. if (ownerName && !styleWarnings[ownerName]) {
  26428. styleWarnings[ownerName] = {};
  26429. }
  26430. var warned = false;
  26431. if (ownerName) {
  26432. var warnings = styleWarnings[ownerName];
  26433. warned = warnings[name];
  26434. if (!warned) {
  26435. warnings[name] = true;
  26436. }
  26437. }
  26438. if (!warned) {
  26439. process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
  26440. }
  26441. }
  26442. }
  26443. value = value.trim();
  26444. }
  26445. return value + 'px';
  26446. }
  26447. module.exports = dangerousStyleValue;
  26448. /***/ }),
  26449. /* 196 */
  26450. /***/ (function(module, exports, __webpack_require__) {
  26451. "use strict";
  26452. /**
  26453. * Copyright 2013-present, Facebook, Inc.
  26454. * All rights reserved.
  26455. *
  26456. * This source code is licensed under the BSD-style license found in the
  26457. * LICENSE file in the root directory of this source tree. An additional grant
  26458. * of patent rights can be found in the PATENTS file in the same directory.
  26459. *
  26460. */
  26461. var _prodInvariant = __webpack_require__(2);
  26462. var ReactCurrentOwner = __webpack_require__(13);
  26463. var ReactDOMComponentTree = __webpack_require__(4);
  26464. var ReactInstanceMap = __webpack_require__(26);
  26465. var getHostComponentFromComposite = __webpack_require__(72);
  26466. var invariant = __webpack_require__(0);
  26467. var warning = __webpack_require__(1);
  26468. /**
  26469. * Returns the DOM node rendered by this element.
  26470. *
  26471. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
  26472. *
  26473. * @param {ReactComponent|DOMElement} componentOrElement
  26474. * @return {?DOMElement} The root node of this element.
  26475. */
  26476. function findDOMNode(componentOrElement) {
  26477. if (false) {
  26478. var owner = ReactCurrentOwner.current;
  26479. if (owner !== null) {
  26480. process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%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.', owner.getName() || 'A component') : void 0;
  26481. owner._warnedAboutRefsInRender = true;
  26482. }
  26483. }
  26484. if (componentOrElement == null) {
  26485. return null;
  26486. }
  26487. if (componentOrElement.nodeType === 1) {
  26488. return componentOrElement;
  26489. }
  26490. var inst = ReactInstanceMap.get(componentOrElement);
  26491. if (inst) {
  26492. inst = getHostComponentFromComposite(inst);
  26493. return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
  26494. }
  26495. if (typeof componentOrElement.render === 'function') {
  26496. true ? false ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
  26497. } else {
  26498. true ? false ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
  26499. }
  26500. }
  26501. module.exports = findDOMNode;
  26502. /***/ }),
  26503. /* 197 */
  26504. /***/ (function(module, exports, __webpack_require__) {
  26505. "use strict";
  26506. /* WEBPACK VAR INJECTION */(function(process) {/**
  26507. * Copyright 2013-present, Facebook, Inc.
  26508. * All rights reserved.
  26509. *
  26510. * This source code is licensed under the BSD-style license found in the
  26511. * LICENSE file in the root directory of this source tree. An additional grant
  26512. * of patent rights can be found in the PATENTS file in the same directory.
  26513. *
  26514. *
  26515. */
  26516. var KeyEscapeUtils = __webpack_require__(39);
  26517. var traverseAllChildren = __webpack_require__(77);
  26518. var warning = __webpack_require__(1);
  26519. var ReactComponentTreeHook;
  26520. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  26521. // Temporary hack.
  26522. // Inline requires don't work well with Jest:
  26523. // https://github.com/facebook/react/issues/7240
  26524. // Remove the inline requires when we don't need them anymore:
  26525. // https://github.com/facebook/react/pull/7178
  26526. ReactComponentTreeHook = __webpack_require__(78);
  26527. }
  26528. /**
  26529. * @param {function} traverseContext Context passed through traversal.
  26530. * @param {?ReactComponent} child React child component.
  26531. * @param {!string} name String name of key path to child.
  26532. * @param {number=} selfDebugID Optional debugID of the current internal instance.
  26533. */
  26534. function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
  26535. // We found a component instance.
  26536. if (traverseContext && typeof traverseContext === 'object') {
  26537. var result = traverseContext;
  26538. var keyUnique = result[name] === undefined;
  26539. if (false) {
  26540. if (!ReactComponentTreeHook) {
  26541. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  26542. }
  26543. if (!keyUnique) {
  26544. process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
  26545. }
  26546. }
  26547. if (keyUnique && child != null) {
  26548. result[name] = child;
  26549. }
  26550. }
  26551. }
  26552. /**
  26553. * Flattens children that are typically specified as `props.children`. Any null
  26554. * children will not be included in the resulting object.
  26555. * @return {!object} flattened children keyed by name.
  26556. */
  26557. function flattenChildren(children, selfDebugID) {
  26558. if (children == null) {
  26559. return children;
  26560. }
  26561. var result = {};
  26562. if (false) {
  26563. traverseAllChildren(children, function (traverseContext, child, name) {
  26564. return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
  26565. }, result);
  26566. } else {
  26567. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  26568. }
  26569. return result;
  26570. }
  26571. module.exports = flattenChildren;
  26572. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(53)))
  26573. /***/ }),
  26574. /* 198 */
  26575. /***/ (function(module, exports, __webpack_require__) {
  26576. "use strict";
  26577. /**
  26578. * Copyright 2013-present, Facebook, Inc.
  26579. * All rights reserved.
  26580. *
  26581. * This source code is licensed under the BSD-style license found in the
  26582. * LICENSE file in the root directory of this source tree. An additional grant
  26583. * of patent rights can be found in the PATENTS file in the same directory.
  26584. *
  26585. */
  26586. var getEventCharCode = __webpack_require__(45);
  26587. /**
  26588. * Normalization of deprecated HTML5 `key` values
  26589. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  26590. */
  26591. var normalizeKey = {
  26592. 'Esc': 'Escape',
  26593. 'Spacebar': ' ',
  26594. 'Left': 'ArrowLeft',
  26595. 'Up': 'ArrowUp',
  26596. 'Right': 'ArrowRight',
  26597. 'Down': 'ArrowDown',
  26598. 'Del': 'Delete',
  26599. 'Win': 'OS',
  26600. 'Menu': 'ContextMenu',
  26601. 'Apps': 'ContextMenu',
  26602. 'Scroll': 'ScrollLock',
  26603. 'MozPrintableKey': 'Unidentified'
  26604. };
  26605. /**
  26606. * Translation from legacy `keyCode` to HTML5 `key`
  26607. * Only special keys supported, all others depend on keyboard layout or browser
  26608. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  26609. */
  26610. var translateToKey = {
  26611. 8: 'Backspace',
  26612. 9: 'Tab',
  26613. 12: 'Clear',
  26614. 13: 'Enter',
  26615. 16: 'Shift',
  26616. 17: 'Control',
  26617. 18: 'Alt',
  26618. 19: 'Pause',
  26619. 20: 'CapsLock',
  26620. 27: 'Escape',
  26621. 32: ' ',
  26622. 33: 'PageUp',
  26623. 34: 'PageDown',
  26624. 35: 'End',
  26625. 36: 'Home',
  26626. 37: 'ArrowLeft',
  26627. 38: 'ArrowUp',
  26628. 39: 'ArrowRight',
  26629. 40: 'ArrowDown',
  26630. 45: 'Insert',
  26631. 46: 'Delete',
  26632. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  26633. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  26634. 144: 'NumLock',
  26635. 145: 'ScrollLock',
  26636. 224: 'Meta'
  26637. };
  26638. /**
  26639. * @param {object} nativeEvent Native browser event.
  26640. * @return {string} Normalized `key` property.
  26641. */
  26642. function getEventKey(nativeEvent) {
  26643. if (nativeEvent.key) {
  26644. // Normalize inconsistent values reported by browsers due to
  26645. // implementations of a working draft specification.
  26646. // FireFox implements `key` but returns `MozPrintableKey` for all
  26647. // printable characters (normalized to `Unidentified`), ignore it.
  26648. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  26649. if (key !== 'Unidentified') {
  26650. return key;
  26651. }
  26652. }
  26653. // Browser does not implement `key`, polyfill as much of it as we can.
  26654. if (nativeEvent.type === 'keypress') {
  26655. var charCode = getEventCharCode(nativeEvent);
  26656. // The enter-key is technically both printable and non-printable and can
  26657. // thus be captured by `keypress`, no other non-printable key should.
  26658. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  26659. }
  26660. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  26661. // While user keyboard layout determines the actual meaning of each
  26662. // `keyCode` value, almost all function keys have a universal value.
  26663. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  26664. }
  26665. return '';
  26666. }
  26667. module.exports = getEventKey;
  26668. /***/ }),
  26669. /* 199 */
  26670. /***/ (function(module, exports, __webpack_require__) {
  26671. "use strict";
  26672. /**
  26673. * Copyright 2013-present, Facebook, Inc.
  26674. * All rights reserved.
  26675. *
  26676. * This source code is licensed under the BSD-style license found in the
  26677. * LICENSE file in the root directory of this source tree. An additional grant
  26678. * of patent rights can be found in the PATENTS file in the same directory.
  26679. *
  26680. *
  26681. */
  26682. /* global Symbol */
  26683. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  26684. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  26685. /**
  26686. * Returns the iterator method function contained on the iterable object.
  26687. *
  26688. * Be sure to invoke the function with the iterable as context:
  26689. *
  26690. * var iteratorFn = getIteratorFn(myIterable);
  26691. * if (iteratorFn) {
  26692. * var iterator = iteratorFn.call(myIterable);
  26693. * ...
  26694. * }
  26695. *
  26696. * @param {?object} maybeIterable
  26697. * @return {?function}
  26698. */
  26699. function getIteratorFn(maybeIterable) {
  26700. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  26701. if (typeof iteratorFn === 'function') {
  26702. return iteratorFn;
  26703. }
  26704. }
  26705. module.exports = getIteratorFn;
  26706. /***/ }),
  26707. /* 200 */
  26708. /***/ (function(module, exports, __webpack_require__) {
  26709. "use strict";
  26710. /**
  26711. * Copyright 2013-present, Facebook, Inc.
  26712. * All rights reserved.
  26713. *
  26714. * This source code is licensed under the BSD-style license found in the
  26715. * LICENSE file in the root directory of this source tree. An additional grant
  26716. * of patent rights can be found in the PATENTS file in the same directory.
  26717. *
  26718. *
  26719. */
  26720. var nextDebugID = 1;
  26721. function getNextDebugID() {
  26722. return nextDebugID++;
  26723. }
  26724. module.exports = getNextDebugID;
  26725. /***/ }),
  26726. /* 201 */
  26727. /***/ (function(module, exports, __webpack_require__) {
  26728. "use strict";
  26729. /**
  26730. * Copyright 2013-present, Facebook, Inc.
  26731. * All rights reserved.
  26732. *
  26733. * This source code is licensed under the BSD-style license found in the
  26734. * LICENSE file in the root directory of this source tree. An additional grant
  26735. * of patent rights can be found in the PATENTS file in the same directory.
  26736. *
  26737. */
  26738. /**
  26739. * Given any node return the first leaf node without children.
  26740. *
  26741. * @param {DOMElement|DOMTextNode} node
  26742. * @return {DOMElement|DOMTextNode}
  26743. */
  26744. function getLeafNode(node) {
  26745. while (node && node.firstChild) {
  26746. node = node.firstChild;
  26747. }
  26748. return node;
  26749. }
  26750. /**
  26751. * Get the next sibling within a container. This will walk up the
  26752. * DOM if a node's siblings have been exhausted.
  26753. *
  26754. * @param {DOMElement|DOMTextNode} node
  26755. * @return {?DOMElement|DOMTextNode}
  26756. */
  26757. function getSiblingNode(node) {
  26758. while (node) {
  26759. if (node.nextSibling) {
  26760. return node.nextSibling;
  26761. }
  26762. node = node.parentNode;
  26763. }
  26764. }
  26765. /**
  26766. * Get object describing the nodes which contain characters at offset.
  26767. *
  26768. * @param {DOMElement|DOMTextNode} root
  26769. * @param {number} offset
  26770. * @return {?object}
  26771. */
  26772. function getNodeForCharacterOffset(root, offset) {
  26773. var node = getLeafNode(root);
  26774. var nodeStart = 0;
  26775. var nodeEnd = 0;
  26776. while (node) {
  26777. if (node.nodeType === 3) {
  26778. nodeEnd = nodeStart + node.textContent.length;
  26779. if (nodeStart <= offset && nodeEnd >= offset) {
  26780. return {
  26781. node: node,
  26782. offset: offset - nodeStart
  26783. };
  26784. }
  26785. nodeStart = nodeEnd;
  26786. }
  26787. node = getLeafNode(getSiblingNode(node));
  26788. }
  26789. }
  26790. module.exports = getNodeForCharacterOffset;
  26791. /***/ }),
  26792. /* 202 */
  26793. /***/ (function(module, exports, __webpack_require__) {
  26794. "use strict";
  26795. /**
  26796. * Copyright 2013-present, Facebook, Inc.
  26797. * All rights reserved.
  26798. *
  26799. * This source code is licensed under the BSD-style license found in the
  26800. * LICENSE file in the root directory of this source tree. An additional grant
  26801. * of patent rights can be found in the PATENTS file in the same directory.
  26802. *
  26803. */
  26804. var ExecutionEnvironment = __webpack_require__(5);
  26805. /**
  26806. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  26807. *
  26808. * @param {string} styleProp
  26809. * @param {string} eventName
  26810. * @returns {object}
  26811. */
  26812. function makePrefixMap(styleProp, eventName) {
  26813. var prefixes = {};
  26814. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  26815. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  26816. prefixes['Moz' + styleProp] = 'moz' + eventName;
  26817. prefixes['ms' + styleProp] = 'MS' + eventName;
  26818. prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
  26819. return prefixes;
  26820. }
  26821. /**
  26822. * A list of event names to a configurable list of vendor prefixes.
  26823. */
  26824. var vendorPrefixes = {
  26825. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  26826. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  26827. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  26828. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  26829. };
  26830. /**
  26831. * Event names that have already been detected and prefixed (if applicable).
  26832. */
  26833. var prefixedEventNames = {};
  26834. /**
  26835. * Element to check for prefixes on.
  26836. */
  26837. var style = {};
  26838. /**
  26839. * Bootstrap if a DOM exists.
  26840. */
  26841. if (ExecutionEnvironment.canUseDOM) {
  26842. style = document.createElement('div').style;
  26843. // On some platforms, in particular some releases of Android 4.x,
  26844. // the un-prefixed "animation" and "transition" properties are defined on the
  26845. // style object but the events that fire will still be prefixed, so we need
  26846. // to check if the un-prefixed events are usable, and if not remove them from the map.
  26847. if (!('AnimationEvent' in window)) {
  26848. delete vendorPrefixes.animationend.animation;
  26849. delete vendorPrefixes.animationiteration.animation;
  26850. delete vendorPrefixes.animationstart.animation;
  26851. }
  26852. // Same as above
  26853. if (!('TransitionEvent' in window)) {
  26854. delete vendorPrefixes.transitionend.transition;
  26855. }
  26856. }
  26857. /**
  26858. * Attempts to determine the correct vendor prefixed event name.
  26859. *
  26860. * @param {string} eventName
  26861. * @returns {string}
  26862. */
  26863. function getVendorPrefixedEventName(eventName) {
  26864. if (prefixedEventNames[eventName]) {
  26865. return prefixedEventNames[eventName];
  26866. } else if (!vendorPrefixes[eventName]) {
  26867. return eventName;
  26868. }
  26869. var prefixMap = vendorPrefixes[eventName];
  26870. for (var styleProp in prefixMap) {
  26871. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  26872. return prefixedEventNames[eventName] = prefixMap[styleProp];
  26873. }
  26874. }
  26875. return '';
  26876. }
  26877. module.exports = getVendorPrefixedEventName;
  26878. /***/ }),
  26879. /* 203 */
  26880. /***/ (function(module, exports, __webpack_require__) {
  26881. "use strict";
  26882. /**
  26883. * Copyright 2013-present, Facebook, Inc.
  26884. * All rights reserved.
  26885. *
  26886. * This source code is licensed under the BSD-style license found in the
  26887. * LICENSE file in the root directory of this source tree. An additional grant
  26888. * of patent rights can be found in the PATENTS file in the same directory.
  26889. *
  26890. */
  26891. var escapeTextContentForBrowser = __webpack_require__(31);
  26892. /**
  26893. * Escapes attribute value to prevent scripting attacks.
  26894. *
  26895. * @param {*} value Value to escape.
  26896. * @return {string} An escaped string.
  26897. */
  26898. function quoteAttributeValueForBrowser(value) {
  26899. return '"' + escapeTextContentForBrowser(value) + '"';
  26900. }
  26901. module.exports = quoteAttributeValueForBrowser;
  26902. /***/ }),
  26903. /* 204 */
  26904. /***/ (function(module, exports, __webpack_require__) {
  26905. "use strict";
  26906. /**
  26907. * Copyright 2013-present, Facebook, Inc.
  26908. * All rights reserved.
  26909. *
  26910. * This source code is licensed under the BSD-style license found in the
  26911. * LICENSE file in the root directory of this source tree. An additional grant
  26912. * of patent rights can be found in the PATENTS file in the same directory.
  26913. *
  26914. */
  26915. var ReactMount = __webpack_require__(67);
  26916. module.exports = ReactMount.renderSubtreeIntoContainer;
  26917. /***/ }),
  26918. /* 205 */
  26919. /***/ (function(module, exports, __webpack_require__) {
  26920. "use strict";
  26921. /**
  26922. * Copyright 2013-present, Facebook, Inc.
  26923. * All rights reserved.
  26924. *
  26925. * This source code is licensed under the BSD-style license found in the
  26926. * LICENSE file in the root directory of this source tree. An additional grant
  26927. * of patent rights can be found in the PATENTS file in the same directory.
  26928. *
  26929. *
  26930. */
  26931. /**
  26932. * Escape and wrap key so it is safe to use as a reactid
  26933. *
  26934. * @param {string} key to be escaped.
  26935. * @return {string} the escaped key.
  26936. */
  26937. function escape(key) {
  26938. var escapeRegex = /[=:]/g;
  26939. var escaperLookup = {
  26940. '=': '=0',
  26941. ':': '=2'
  26942. };
  26943. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  26944. return escaperLookup[match];
  26945. });
  26946. return '$' + escapedString;
  26947. }
  26948. /**
  26949. * Unescape and unwrap key for human-readable display
  26950. *
  26951. * @param {string} key to unescape.
  26952. * @return {string} the unescaped key.
  26953. */
  26954. function unescape(key) {
  26955. var unescapeRegex = /(=0|=2)/g;
  26956. var unescaperLookup = {
  26957. '=0': '=',
  26958. '=2': ':'
  26959. };
  26960. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  26961. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  26962. return unescaperLookup[match];
  26963. });
  26964. }
  26965. var KeyEscapeUtils = {
  26966. escape: escape,
  26967. unescape: unescape
  26968. };
  26969. module.exports = KeyEscapeUtils;
  26970. /***/ }),
  26971. /* 206 */
  26972. /***/ (function(module, exports, __webpack_require__) {
  26973. "use strict";
  26974. /**
  26975. * Copyright 2013-present, Facebook, Inc.
  26976. * All rights reserved.
  26977. *
  26978. * This source code is licensed under the BSD-style license found in the
  26979. * LICENSE file in the root directory of this source tree. An additional grant
  26980. * of patent rights can be found in the PATENTS file in the same directory.
  26981. *
  26982. *
  26983. */
  26984. var _prodInvariant = __webpack_require__(22);
  26985. var invariant = __webpack_require__(0);
  26986. /**
  26987. * Static poolers. Several custom versions for each potential number of
  26988. * arguments. A completely generic pooler is easy to implement, but would
  26989. * require accessing the `arguments` object. In each of these, `this` refers to
  26990. * the Class itself, not an instance. If any others are needed, simply add them
  26991. * here, or in their own files.
  26992. */
  26993. var oneArgumentPooler = function (copyFieldsFrom) {
  26994. var Klass = this;
  26995. if (Klass.instancePool.length) {
  26996. var instance = Klass.instancePool.pop();
  26997. Klass.call(instance, copyFieldsFrom);
  26998. return instance;
  26999. } else {
  27000. return new Klass(copyFieldsFrom);
  27001. }
  27002. };
  27003. var twoArgumentPooler = function (a1, a2) {
  27004. var Klass = this;
  27005. if (Klass.instancePool.length) {
  27006. var instance = Klass.instancePool.pop();
  27007. Klass.call(instance, a1, a2);
  27008. return instance;
  27009. } else {
  27010. return new Klass(a1, a2);
  27011. }
  27012. };
  27013. var threeArgumentPooler = function (a1, a2, a3) {
  27014. var Klass = this;
  27015. if (Klass.instancePool.length) {
  27016. var instance = Klass.instancePool.pop();
  27017. Klass.call(instance, a1, a2, a3);
  27018. return instance;
  27019. } else {
  27020. return new Klass(a1, a2, a3);
  27021. }
  27022. };
  27023. var fourArgumentPooler = function (a1, a2, a3, a4) {
  27024. var Klass = this;
  27025. if (Klass.instancePool.length) {
  27026. var instance = Klass.instancePool.pop();
  27027. Klass.call(instance, a1, a2, a3, a4);
  27028. return instance;
  27029. } else {
  27030. return new Klass(a1, a2, a3, a4);
  27031. }
  27032. };
  27033. var standardReleaser = function (instance) {
  27034. var Klass = this;
  27035. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  27036. instance.destructor();
  27037. if (Klass.instancePool.length < Klass.poolSize) {
  27038. Klass.instancePool.push(instance);
  27039. }
  27040. };
  27041. var DEFAULT_POOL_SIZE = 10;
  27042. var DEFAULT_POOLER = oneArgumentPooler;
  27043. /**
  27044. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  27045. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  27046. * you give this may have a `poolSize` property, and will look for a
  27047. * prototypical `destructor` on instances.
  27048. *
  27049. * @param {Function} CopyConstructor Constructor that can be used to reset.
  27050. * @param {Function} pooler Customizable pooler.
  27051. */
  27052. var addPoolingTo = function (CopyConstructor, pooler) {
  27053. // Casting as any so that flow ignores the actual implementation and trusts
  27054. // it to match the type we declared
  27055. var NewKlass = CopyConstructor;
  27056. NewKlass.instancePool = [];
  27057. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  27058. if (!NewKlass.poolSize) {
  27059. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  27060. }
  27061. NewKlass.release = standardReleaser;
  27062. return NewKlass;
  27063. };
  27064. var PooledClass = {
  27065. addPoolingTo: addPoolingTo,
  27066. oneArgumentPooler: oneArgumentPooler,
  27067. twoArgumentPooler: twoArgumentPooler,
  27068. threeArgumentPooler: threeArgumentPooler,
  27069. fourArgumentPooler: fourArgumentPooler
  27070. };
  27071. module.exports = PooledClass;
  27072. /***/ }),
  27073. /* 207 */
  27074. /***/ (function(module, exports, __webpack_require__) {
  27075. "use strict";
  27076. /**
  27077. * Copyright 2013-present, Facebook, Inc.
  27078. * All rights reserved.
  27079. *
  27080. * This source code is licensed under the BSD-style license found in the
  27081. * LICENSE file in the root directory of this source tree. An additional grant
  27082. * of patent rights can be found in the PATENTS file in the same directory.
  27083. *
  27084. */
  27085. var PooledClass = __webpack_require__(206);
  27086. var ReactElement = __webpack_require__(21);
  27087. var emptyFunction = __webpack_require__(9);
  27088. var traverseAllChildren = __webpack_require__(215);
  27089. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  27090. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  27091. var userProvidedKeyEscapeRegex = /\/+/g;
  27092. function escapeUserProvidedKey(text) {
  27093. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  27094. }
  27095. /**
  27096. * PooledClass representing the bookkeeping associated with performing a child
  27097. * traversal. Allows avoiding binding callbacks.
  27098. *
  27099. * @constructor ForEachBookKeeping
  27100. * @param {!function} forEachFunction Function to perform traversal with.
  27101. * @param {?*} forEachContext Context to perform context with.
  27102. */
  27103. function ForEachBookKeeping(forEachFunction, forEachContext) {
  27104. this.func = forEachFunction;
  27105. this.context = forEachContext;
  27106. this.count = 0;
  27107. }
  27108. ForEachBookKeeping.prototype.destructor = function () {
  27109. this.func = null;
  27110. this.context = null;
  27111. this.count = 0;
  27112. };
  27113. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  27114. function forEachSingleChild(bookKeeping, child, name) {
  27115. var func = bookKeeping.func,
  27116. context = bookKeeping.context;
  27117. func.call(context, child, bookKeeping.count++);
  27118. }
  27119. /**
  27120. * Iterates through children that are typically specified as `props.children`.
  27121. *
  27122. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
  27123. *
  27124. * The provided forEachFunc(child, index) will be called for each
  27125. * leaf child.
  27126. *
  27127. * @param {?*} children Children tree container.
  27128. * @param {function(*, int)} forEachFunc
  27129. * @param {*} forEachContext Context for forEachContext.
  27130. */
  27131. function forEachChildren(children, forEachFunc, forEachContext) {
  27132. if (children == null) {
  27133. return children;
  27134. }
  27135. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  27136. traverseAllChildren(children, forEachSingleChild, traverseContext);
  27137. ForEachBookKeeping.release(traverseContext);
  27138. }
  27139. /**
  27140. * PooledClass representing the bookkeeping associated with performing a child
  27141. * mapping. Allows avoiding binding callbacks.
  27142. *
  27143. * @constructor MapBookKeeping
  27144. * @param {!*} mapResult Object containing the ordered map of results.
  27145. * @param {!function} mapFunction Function to perform mapping with.
  27146. * @param {?*} mapContext Context to perform mapping with.
  27147. */
  27148. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  27149. this.result = mapResult;
  27150. this.keyPrefix = keyPrefix;
  27151. this.func = mapFunction;
  27152. this.context = mapContext;
  27153. this.count = 0;
  27154. }
  27155. MapBookKeeping.prototype.destructor = function () {
  27156. this.result = null;
  27157. this.keyPrefix = null;
  27158. this.func = null;
  27159. this.context = null;
  27160. this.count = 0;
  27161. };
  27162. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  27163. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  27164. var result = bookKeeping.result,
  27165. keyPrefix = bookKeeping.keyPrefix,
  27166. func = bookKeeping.func,
  27167. context = bookKeeping.context;
  27168. var mappedChild = func.call(context, child, bookKeeping.count++);
  27169. if (Array.isArray(mappedChild)) {
  27170. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  27171. } else if (mappedChild != null) {
  27172. if (ReactElement.isValidElement(mappedChild)) {
  27173. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  27174. // Keep both the (mapped) and old keys if they differ, just as
  27175. // traverseAllChildren used to do for objects as children
  27176. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  27177. }
  27178. result.push(mappedChild);
  27179. }
  27180. }
  27181. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  27182. var escapedPrefix = '';
  27183. if (prefix != null) {
  27184. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  27185. }
  27186. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  27187. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  27188. MapBookKeeping.release(traverseContext);
  27189. }
  27190. /**
  27191. * Maps children that are typically specified as `props.children`.
  27192. *
  27193. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
  27194. *
  27195. * The provided mapFunction(child, key, index) will be called for each
  27196. * leaf child.
  27197. *
  27198. * @param {?*} children Children tree container.
  27199. * @param {function(*, int)} func The map function.
  27200. * @param {*} context Context for mapFunction.
  27201. * @return {object} Object containing the ordered map of results.
  27202. */
  27203. function mapChildren(children, func, context) {
  27204. if (children == null) {
  27205. return children;
  27206. }
  27207. var result = [];
  27208. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  27209. return result;
  27210. }
  27211. function forEachSingleChildDummy(traverseContext, child, name) {
  27212. return null;
  27213. }
  27214. /**
  27215. * Count the number of children that are typically specified as
  27216. * `props.children`.
  27217. *
  27218. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
  27219. *
  27220. * @param {?*} children Children tree container.
  27221. * @return {number} The number of children.
  27222. */
  27223. function countChildren(children, context) {
  27224. return traverseAllChildren(children, forEachSingleChildDummy, null);
  27225. }
  27226. /**
  27227. * Flatten a children object (typically specified as `props.children`) and
  27228. * return an array with appropriately re-keyed children.
  27229. *
  27230. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
  27231. */
  27232. function toArray(children) {
  27233. var result = [];
  27234. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  27235. return result;
  27236. }
  27237. var ReactChildren = {
  27238. forEach: forEachChildren,
  27239. map: mapChildren,
  27240. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  27241. count: countChildren,
  27242. toArray: toArray
  27243. };
  27244. module.exports = ReactChildren;
  27245. /***/ }),
  27246. /* 208 */
  27247. /***/ (function(module, exports, __webpack_require__) {
  27248. "use strict";
  27249. /**
  27250. * Copyright 2013-present, Facebook, Inc.
  27251. * All rights reserved.
  27252. *
  27253. * This source code is licensed under the BSD-style license found in the
  27254. * LICENSE file in the root directory of this source tree. An additional grant
  27255. * of patent rights can be found in the PATENTS file in the same directory.
  27256. *
  27257. */
  27258. var _prodInvariant = __webpack_require__(22),
  27259. _assign = __webpack_require__(3);
  27260. var ReactComponent = __webpack_require__(51);
  27261. var ReactElement = __webpack_require__(21);
  27262. var ReactPropTypeLocationNames = __webpack_require__(80);
  27263. var ReactNoopUpdateQueue = __webpack_require__(52);
  27264. var emptyObject = __webpack_require__(23);
  27265. var invariant = __webpack_require__(0);
  27266. var warning = __webpack_require__(1);
  27267. var MIXINS_KEY = 'mixins';
  27268. // Helper function to allow the creation of anonymous functions which do not
  27269. // have .name set to the name of the variable being assigned to.
  27270. function identity(fn) {
  27271. return fn;
  27272. }
  27273. /**
  27274. * Policies that describe methods in `ReactClassInterface`.
  27275. */
  27276. var injectedMixins = [];
  27277. /**
  27278. * Composite components are higher-level components that compose other composite
  27279. * or host components.
  27280. *
  27281. * To create a new type of `ReactClass`, pass a specification of
  27282. * your new class to `React.createClass`. The only requirement of your class
  27283. * specification is that you implement a `render` method.
  27284. *
  27285. * var MyComponent = React.createClass({
  27286. * render: function() {
  27287. * return <div>Hello World</div>;
  27288. * }
  27289. * });
  27290. *
  27291. * The class specification supports a specific protocol of methods that have
  27292. * special meaning (e.g. `render`). See `ReactClassInterface` for
  27293. * more the comprehensive protocol. Any other properties and methods in the
  27294. * class specification will be available on the prototype.
  27295. *
  27296. * @interface ReactClassInterface
  27297. * @internal
  27298. */
  27299. var ReactClassInterface = {
  27300. /**
  27301. * An array of Mixin objects to include when defining your component.
  27302. *
  27303. * @type {array}
  27304. * @optional
  27305. */
  27306. mixins: 'DEFINE_MANY',
  27307. /**
  27308. * An object containing properties and methods that should be defined on
  27309. * the component's constructor instead of its prototype (static methods).
  27310. *
  27311. * @type {object}
  27312. * @optional
  27313. */
  27314. statics: 'DEFINE_MANY',
  27315. /**
  27316. * Definition of prop types for this component.
  27317. *
  27318. * @type {object}
  27319. * @optional
  27320. */
  27321. propTypes: 'DEFINE_MANY',
  27322. /**
  27323. * Definition of context types for this component.
  27324. *
  27325. * @type {object}
  27326. * @optional
  27327. */
  27328. contextTypes: 'DEFINE_MANY',
  27329. /**
  27330. * Definition of context types this component sets for its children.
  27331. *
  27332. * @type {object}
  27333. * @optional
  27334. */
  27335. childContextTypes: 'DEFINE_MANY',
  27336. // ==== Definition methods ====
  27337. /**
  27338. * Invoked when the component is mounted. Values in the mapping will be set on
  27339. * `this.props` if that prop is not specified (i.e. using an `in` check).
  27340. *
  27341. * This method is invoked before `getInitialState` and therefore cannot rely
  27342. * on `this.state` or use `this.setState`.
  27343. *
  27344. * @return {object}
  27345. * @optional
  27346. */
  27347. getDefaultProps: 'DEFINE_MANY_MERGED',
  27348. /**
  27349. * Invoked once before the component is mounted. The return value will be used
  27350. * as the initial value of `this.state`.
  27351. *
  27352. * getInitialState: function() {
  27353. * return {
  27354. * isOn: false,
  27355. * fooBaz: new BazFoo()
  27356. * }
  27357. * }
  27358. *
  27359. * @return {object}
  27360. * @optional
  27361. */
  27362. getInitialState: 'DEFINE_MANY_MERGED',
  27363. /**
  27364. * @return {object}
  27365. * @optional
  27366. */
  27367. getChildContext: 'DEFINE_MANY_MERGED',
  27368. /**
  27369. * Uses props from `this.props` and state from `this.state` to render the
  27370. * structure of the component.
  27371. *
  27372. * No guarantees are made about when or how often this method is invoked, so
  27373. * it must not have side effects.
  27374. *
  27375. * render: function() {
  27376. * var name = this.props.name;
  27377. * return <div>Hello, {name}!</div>;
  27378. * }
  27379. *
  27380. * @return {ReactComponent}
  27381. * @nosideeffects
  27382. * @required
  27383. */
  27384. render: 'DEFINE_ONCE',
  27385. // ==== Delegate methods ====
  27386. /**
  27387. * Invoked when the component is initially created and about to be mounted.
  27388. * This may have side effects, but any external subscriptions or data created
  27389. * by this method must be cleaned up in `componentWillUnmount`.
  27390. *
  27391. * @optional
  27392. */
  27393. componentWillMount: 'DEFINE_MANY',
  27394. /**
  27395. * Invoked when the component has been mounted and has a DOM representation.
  27396. * However, there is no guarantee that the DOM node is in the document.
  27397. *
  27398. * Use this as an opportunity to operate on the DOM when the component has
  27399. * been mounted (initialized and rendered) for the first time.
  27400. *
  27401. * @param {DOMElement} rootNode DOM element representing the component.
  27402. * @optional
  27403. */
  27404. componentDidMount: 'DEFINE_MANY',
  27405. /**
  27406. * Invoked before the component receives new props.
  27407. *
  27408. * Use this as an opportunity to react to a prop transition by updating the
  27409. * state using `this.setState`. Current props are accessed via `this.props`.
  27410. *
  27411. * componentWillReceiveProps: function(nextProps, nextContext) {
  27412. * this.setState({
  27413. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  27414. * });
  27415. * }
  27416. *
  27417. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  27418. * transition may cause a state change, but the opposite is not true. If you
  27419. * need it, you are probably looking for `componentWillUpdate`.
  27420. *
  27421. * @param {object} nextProps
  27422. * @optional
  27423. */
  27424. componentWillReceiveProps: 'DEFINE_MANY',
  27425. /**
  27426. * Invoked while deciding if the component should be updated as a result of
  27427. * receiving new props, state and/or context.
  27428. *
  27429. * Use this as an opportunity to `return false` when you're certain that the
  27430. * transition to the new props/state/context will not require a component
  27431. * update.
  27432. *
  27433. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  27434. * return !equal(nextProps, this.props) ||
  27435. * !equal(nextState, this.state) ||
  27436. * !equal(nextContext, this.context);
  27437. * }
  27438. *
  27439. * @param {object} nextProps
  27440. * @param {?object} nextState
  27441. * @param {?object} nextContext
  27442. * @return {boolean} True if the component should update.
  27443. * @optional
  27444. */
  27445. shouldComponentUpdate: 'DEFINE_ONCE',
  27446. /**
  27447. * Invoked when the component is about to update due to a transition from
  27448. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  27449. * and `nextContext`.
  27450. *
  27451. * Use this as an opportunity to perform preparation before an update occurs.
  27452. *
  27453. * NOTE: You **cannot** use `this.setState()` in this method.
  27454. *
  27455. * @param {object} nextProps
  27456. * @param {?object} nextState
  27457. * @param {?object} nextContext
  27458. * @param {ReactReconcileTransaction} transaction
  27459. * @optional
  27460. */
  27461. componentWillUpdate: 'DEFINE_MANY',
  27462. /**
  27463. * Invoked when the component's DOM representation has been updated.
  27464. *
  27465. * Use this as an opportunity to operate on the DOM when the component has
  27466. * been updated.
  27467. *
  27468. * @param {object} prevProps
  27469. * @param {?object} prevState
  27470. * @param {?object} prevContext
  27471. * @param {DOMElement} rootNode DOM element representing the component.
  27472. * @optional
  27473. */
  27474. componentDidUpdate: 'DEFINE_MANY',
  27475. /**
  27476. * Invoked when the component is about to be removed from its parent and have
  27477. * its DOM representation destroyed.
  27478. *
  27479. * Use this as an opportunity to deallocate any external resources.
  27480. *
  27481. * NOTE: There is no `componentDidUnmount` since your component will have been
  27482. * destroyed by that point.
  27483. *
  27484. * @optional
  27485. */
  27486. componentWillUnmount: 'DEFINE_MANY',
  27487. // ==== Advanced methods ====
  27488. /**
  27489. * Updates the component's currently mounted DOM representation.
  27490. *
  27491. * By default, this implements React's rendering and reconciliation algorithm.
  27492. * Sophisticated clients may wish to override this.
  27493. *
  27494. * @param {ReactReconcileTransaction} transaction
  27495. * @internal
  27496. * @overridable
  27497. */
  27498. updateComponent: 'OVERRIDE_BASE'
  27499. };
  27500. /**
  27501. * Mapping from class specification keys to special processing functions.
  27502. *
  27503. * Although these are declared like instance properties in the specification
  27504. * when defining classes using `React.createClass`, they are actually static
  27505. * and are accessible on the constructor instead of the prototype. Despite
  27506. * being static, they must be defined outside of the "statics" key under
  27507. * which all other static methods are defined.
  27508. */
  27509. var RESERVED_SPEC_KEYS = {
  27510. displayName: function (Constructor, displayName) {
  27511. Constructor.displayName = displayName;
  27512. },
  27513. mixins: function (Constructor, mixins) {
  27514. if (mixins) {
  27515. for (var i = 0; i < mixins.length; i++) {
  27516. mixSpecIntoComponent(Constructor, mixins[i]);
  27517. }
  27518. }
  27519. },
  27520. childContextTypes: function (Constructor, childContextTypes) {
  27521. if (false) {
  27522. validateTypeDef(Constructor, childContextTypes, 'childContext');
  27523. }
  27524. Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
  27525. },
  27526. contextTypes: function (Constructor, contextTypes) {
  27527. if (false) {
  27528. validateTypeDef(Constructor, contextTypes, 'context');
  27529. }
  27530. Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
  27531. },
  27532. /**
  27533. * Special case getDefaultProps which should move into statics but requires
  27534. * automatic merging.
  27535. */
  27536. getDefaultProps: function (Constructor, getDefaultProps) {
  27537. if (Constructor.getDefaultProps) {
  27538. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  27539. } else {
  27540. Constructor.getDefaultProps = getDefaultProps;
  27541. }
  27542. },
  27543. propTypes: function (Constructor, propTypes) {
  27544. if (false) {
  27545. validateTypeDef(Constructor, propTypes, 'prop');
  27546. }
  27547. Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
  27548. },
  27549. statics: function (Constructor, statics) {
  27550. mixStaticSpecIntoComponent(Constructor, statics);
  27551. },
  27552. autobind: function () {} };
  27553. function validateTypeDef(Constructor, typeDef, location) {
  27554. for (var propName in typeDef) {
  27555. if (typeDef.hasOwnProperty(propName)) {
  27556. // use a warning instead of an invariant so components
  27557. // don't show up in prod but only in __DEV__
  27558. false ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
  27559. }
  27560. }
  27561. }
  27562. function validateMethodOverride(isAlreadyDefined, name) {
  27563. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  27564. // Disallow overriding of base class methods unless explicitly allowed.
  27565. if (ReactClassMixin.hasOwnProperty(name)) {
  27566. !(specPolicy === 'OVERRIDE_BASE') ? false ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0;
  27567. }
  27568. // Disallow defining methods more than once unless explicitly allowed.
  27569. if (isAlreadyDefined) {
  27570. !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? false ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0;
  27571. }
  27572. }
  27573. /**
  27574. * Mixin helper which handles policy validation and reserved
  27575. * specification keys when building React classes.
  27576. */
  27577. function mixSpecIntoComponent(Constructor, spec) {
  27578. if (!spec) {
  27579. if (false) {
  27580. var typeofSpec = typeof spec;
  27581. var isMixinValid = typeofSpec === 'object' && spec !== null;
  27582. process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
  27583. }
  27584. return;
  27585. }
  27586. !(typeof spec !== 'function') ? false ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
  27587. !!ReactElement.isValidElement(spec) ? false ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
  27588. var proto = Constructor.prototype;
  27589. var autoBindPairs = proto.__reactAutoBindPairs;
  27590. // By handling mixins before any other properties, we ensure the same
  27591. // chaining order is applied to methods with DEFINE_MANY policy, whether
  27592. // mixins are listed before or after these methods in the spec.
  27593. if (spec.hasOwnProperty(MIXINS_KEY)) {
  27594. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  27595. }
  27596. for (var name in spec) {
  27597. if (!spec.hasOwnProperty(name)) {
  27598. continue;
  27599. }
  27600. if (name === MIXINS_KEY) {
  27601. // We have already handled mixins in a special case above.
  27602. continue;
  27603. }
  27604. var property = spec[name];
  27605. var isAlreadyDefined = proto.hasOwnProperty(name);
  27606. validateMethodOverride(isAlreadyDefined, name);
  27607. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  27608. RESERVED_SPEC_KEYS[name](Constructor, property);
  27609. } else {
  27610. // Setup methods on prototype:
  27611. // The following member methods should not be automatically bound:
  27612. // 1. Expected ReactClass methods (in the "interface").
  27613. // 2. Overridden methods (that were mixed in).
  27614. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  27615. var isFunction = typeof property === 'function';
  27616. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  27617. if (shouldAutoBind) {
  27618. autoBindPairs.push(name, property);
  27619. proto[name] = property;
  27620. } else {
  27621. if (isAlreadyDefined) {
  27622. var specPolicy = ReactClassInterface[name];
  27623. // These cases should already be caught by validateMethodOverride.
  27624. !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? false ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
  27625. // For methods which are defined more than once, call the existing
  27626. // methods before calling the new property, merging if appropriate.
  27627. if (specPolicy === 'DEFINE_MANY_MERGED') {
  27628. proto[name] = createMergedResultFunction(proto[name], property);
  27629. } else if (specPolicy === 'DEFINE_MANY') {
  27630. proto[name] = createChainedFunction(proto[name], property);
  27631. }
  27632. } else {
  27633. proto[name] = property;
  27634. if (false) {
  27635. // Add verbose displayName to the function, which helps when looking
  27636. // at profiling tools.
  27637. if (typeof property === 'function' && spec.displayName) {
  27638. proto[name].displayName = spec.displayName + '_' + name;
  27639. }
  27640. }
  27641. }
  27642. }
  27643. }
  27644. }
  27645. }
  27646. function mixStaticSpecIntoComponent(Constructor, statics) {
  27647. if (!statics) {
  27648. return;
  27649. }
  27650. for (var name in statics) {
  27651. var property = statics[name];
  27652. if (!statics.hasOwnProperty(name)) {
  27653. continue;
  27654. }
  27655. var isReserved = name in RESERVED_SPEC_KEYS;
  27656. !!isReserved ? false ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0;
  27657. var isInherited = name in Constructor;
  27658. !!isInherited ? false ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0;
  27659. Constructor[name] = property;
  27660. }
  27661. }
  27662. /**
  27663. * Merge two objects, but throw if both contain the same key.
  27664. *
  27665. * @param {object} one The first object, which is mutated.
  27666. * @param {object} two The second object
  27667. * @return {object} one after it has been mutated to contain everything in two.
  27668. */
  27669. function mergeIntoWithNoDuplicateKeys(one, two) {
  27670. !(one && two && typeof one === 'object' && typeof two === 'object') ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
  27671. for (var key in two) {
  27672. if (two.hasOwnProperty(key)) {
  27673. !(one[key] === undefined) ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0;
  27674. one[key] = two[key];
  27675. }
  27676. }
  27677. return one;
  27678. }
  27679. /**
  27680. * Creates a function that invokes two functions and merges their return values.
  27681. *
  27682. * @param {function} one Function to invoke first.
  27683. * @param {function} two Function to invoke second.
  27684. * @return {function} Function that invokes the two argument functions.
  27685. * @private
  27686. */
  27687. function createMergedResultFunction(one, two) {
  27688. return function mergedResult() {
  27689. var a = one.apply(this, arguments);
  27690. var b = two.apply(this, arguments);
  27691. if (a == null) {
  27692. return b;
  27693. } else if (b == null) {
  27694. return a;
  27695. }
  27696. var c = {};
  27697. mergeIntoWithNoDuplicateKeys(c, a);
  27698. mergeIntoWithNoDuplicateKeys(c, b);
  27699. return c;
  27700. };
  27701. }
  27702. /**
  27703. * Creates a function that invokes two functions and ignores their return vales.
  27704. *
  27705. * @param {function} one Function to invoke first.
  27706. * @param {function} two Function to invoke second.
  27707. * @return {function} Function that invokes the two argument functions.
  27708. * @private
  27709. */
  27710. function createChainedFunction(one, two) {
  27711. return function chainedFunction() {
  27712. one.apply(this, arguments);
  27713. two.apply(this, arguments);
  27714. };
  27715. }
  27716. /**
  27717. * Binds a method to the component.
  27718. *
  27719. * @param {object} component Component whose method is going to be bound.
  27720. * @param {function} method Method to be bound.
  27721. * @return {function} The bound method.
  27722. */
  27723. function bindAutoBindMethod(component, method) {
  27724. var boundMethod = method.bind(component);
  27725. if (false) {
  27726. boundMethod.__reactBoundContext = component;
  27727. boundMethod.__reactBoundMethod = method;
  27728. boundMethod.__reactBoundArguments = null;
  27729. var componentName = component.constructor.displayName;
  27730. var _bind = boundMethod.bind;
  27731. boundMethod.bind = function (newThis) {
  27732. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  27733. args[_key - 1] = arguments[_key];
  27734. }
  27735. // User is trying to bind() an autobound method; we effectively will
  27736. // ignore the value of "this" that the user is trying to use, so
  27737. // let's warn.
  27738. if (newThis !== component && newThis !== null) {
  27739. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
  27740. } else if (!args.length) {
  27741. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
  27742. return boundMethod;
  27743. }
  27744. var reboundMethod = _bind.apply(boundMethod, arguments);
  27745. reboundMethod.__reactBoundContext = component;
  27746. reboundMethod.__reactBoundMethod = method;
  27747. reboundMethod.__reactBoundArguments = args;
  27748. return reboundMethod;
  27749. };
  27750. }
  27751. return boundMethod;
  27752. }
  27753. /**
  27754. * Binds all auto-bound methods in a component.
  27755. *
  27756. * @param {object} component Component whose method is going to be bound.
  27757. */
  27758. function bindAutoBindMethods(component) {
  27759. var pairs = component.__reactAutoBindPairs;
  27760. for (var i = 0; i < pairs.length; i += 2) {
  27761. var autoBindKey = pairs[i];
  27762. var method = pairs[i + 1];
  27763. component[autoBindKey] = bindAutoBindMethod(component, method);
  27764. }
  27765. }
  27766. /**
  27767. * Add more to the ReactClass base class. These are all legacy features and
  27768. * therefore not already part of the modern ReactComponent.
  27769. */
  27770. var ReactClassMixin = {
  27771. /**
  27772. * TODO: This will be deprecated because state should always keep a consistent
  27773. * type signature and the only use case for this, is to avoid that.
  27774. */
  27775. replaceState: function (newState, callback) {
  27776. this.updater.enqueueReplaceState(this, newState);
  27777. if (callback) {
  27778. this.updater.enqueueCallback(this, callback, 'replaceState');
  27779. }
  27780. },
  27781. /**
  27782. * Checks whether or not this composite component is mounted.
  27783. * @return {boolean} True if mounted, false otherwise.
  27784. * @protected
  27785. * @final
  27786. */
  27787. isMounted: function () {
  27788. return this.updater.isMounted(this);
  27789. }
  27790. };
  27791. var ReactClassComponent = function () {};
  27792. _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  27793. /**
  27794. * Module for creating composite components.
  27795. *
  27796. * @class ReactClass
  27797. */
  27798. var ReactClass = {
  27799. /**
  27800. * Creates a composite component class given a class specification.
  27801. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
  27802. *
  27803. * @param {object} spec Class specification (which must define `render`).
  27804. * @return {function} Component constructor function.
  27805. * @public
  27806. */
  27807. createClass: function (spec) {
  27808. // To keep our warnings more understandable, we'll use a little hack here to
  27809. // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
  27810. // unnecessarily identify a class without displayName as 'Constructor'.
  27811. var Constructor = identity(function (props, context, updater) {
  27812. // This constructor gets overridden by mocks. The argument is used
  27813. // by mocks to assert on what gets mounted.
  27814. if (false) {
  27815. process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
  27816. }
  27817. // Wire up auto-binding
  27818. if (this.__reactAutoBindPairs.length) {
  27819. bindAutoBindMethods(this);
  27820. }
  27821. this.props = props;
  27822. this.context = context;
  27823. this.refs = emptyObject;
  27824. this.updater = updater || ReactNoopUpdateQueue;
  27825. this.state = null;
  27826. // ReactClasses doesn't have constructors. Instead, they use the
  27827. // getInitialState and componentWillMount methods for initialization.
  27828. var initialState = this.getInitialState ? this.getInitialState() : null;
  27829. if (false) {
  27830. // We allow auto-mocks to proceed as if they're returning null.
  27831. if (initialState === undefined && this.getInitialState._isMockFunction) {
  27832. // This is probably bad practice. Consider warning here and
  27833. // deprecating this convenience.
  27834. initialState = null;
  27835. }
  27836. }
  27837. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? false ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
  27838. this.state = initialState;
  27839. });
  27840. Constructor.prototype = new ReactClassComponent();
  27841. Constructor.prototype.constructor = Constructor;
  27842. Constructor.prototype.__reactAutoBindPairs = [];
  27843. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  27844. mixSpecIntoComponent(Constructor, spec);
  27845. // Initialize the defaultProps property after all mixins have been merged.
  27846. if (Constructor.getDefaultProps) {
  27847. Constructor.defaultProps = Constructor.getDefaultProps();
  27848. }
  27849. if (false) {
  27850. // This is a tag to indicate that the use of these method names is ok,
  27851. // since it's used with createClass. If it's not, then it's likely a
  27852. // mistake so we'll warn you to use the static property, property
  27853. // initializer or constructor respectively.
  27854. if (Constructor.getDefaultProps) {
  27855. Constructor.getDefaultProps.isReactClassApproved = {};
  27856. }
  27857. if (Constructor.prototype.getInitialState) {
  27858. Constructor.prototype.getInitialState.isReactClassApproved = {};
  27859. }
  27860. }
  27861. !Constructor.prototype.render ? false ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
  27862. if (false) {
  27863. process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%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.', spec.displayName || 'A component') : void 0;
  27864. process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
  27865. }
  27866. // Reduce time spent doing lookups by setting these on the prototype.
  27867. for (var methodName in ReactClassInterface) {
  27868. if (!Constructor.prototype[methodName]) {
  27869. Constructor.prototype[methodName] = null;
  27870. }
  27871. }
  27872. return Constructor;
  27873. },
  27874. injection: {
  27875. injectMixin: function (mixin) {
  27876. injectedMixins.push(mixin);
  27877. }
  27878. }
  27879. };
  27880. module.exports = ReactClass;
  27881. /***/ }),
  27882. /* 209 */
  27883. /***/ (function(module, exports, __webpack_require__) {
  27884. "use strict";
  27885. /**
  27886. * Copyright 2013-present, Facebook, Inc.
  27887. * All rights reserved.
  27888. *
  27889. * This source code is licensed under the BSD-style license found in the
  27890. * LICENSE file in the root directory of this source tree. An additional grant
  27891. * of patent rights can be found in the PATENTS file in the same directory.
  27892. *
  27893. */
  27894. var ReactElement = __webpack_require__(21);
  27895. /**
  27896. * Create a factory that creates HTML tag elements.
  27897. *
  27898. * @private
  27899. */
  27900. var createDOMFactory = ReactElement.createFactory;
  27901. if (false) {
  27902. var ReactElementValidator = require('./ReactElementValidator');
  27903. createDOMFactory = ReactElementValidator.createFactory;
  27904. }
  27905. /**
  27906. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  27907. * This is also accessible via `React.DOM`.
  27908. *
  27909. * @public
  27910. */
  27911. var ReactDOMFactories = {
  27912. a: createDOMFactory('a'),
  27913. abbr: createDOMFactory('abbr'),
  27914. address: createDOMFactory('address'),
  27915. area: createDOMFactory('area'),
  27916. article: createDOMFactory('article'),
  27917. aside: createDOMFactory('aside'),
  27918. audio: createDOMFactory('audio'),
  27919. b: createDOMFactory('b'),
  27920. base: createDOMFactory('base'),
  27921. bdi: createDOMFactory('bdi'),
  27922. bdo: createDOMFactory('bdo'),
  27923. big: createDOMFactory('big'),
  27924. blockquote: createDOMFactory('blockquote'),
  27925. body: createDOMFactory('body'),
  27926. br: createDOMFactory('br'),
  27927. button: createDOMFactory('button'),
  27928. canvas: createDOMFactory('canvas'),
  27929. caption: createDOMFactory('caption'),
  27930. cite: createDOMFactory('cite'),
  27931. code: createDOMFactory('code'),
  27932. col: createDOMFactory('col'),
  27933. colgroup: createDOMFactory('colgroup'),
  27934. data: createDOMFactory('data'),
  27935. datalist: createDOMFactory('datalist'),
  27936. dd: createDOMFactory('dd'),
  27937. del: createDOMFactory('del'),
  27938. details: createDOMFactory('details'),
  27939. dfn: createDOMFactory('dfn'),
  27940. dialog: createDOMFactory('dialog'),
  27941. div: createDOMFactory('div'),
  27942. dl: createDOMFactory('dl'),
  27943. dt: createDOMFactory('dt'),
  27944. em: createDOMFactory('em'),
  27945. embed: createDOMFactory('embed'),
  27946. fieldset: createDOMFactory('fieldset'),
  27947. figcaption: createDOMFactory('figcaption'),
  27948. figure: createDOMFactory('figure'),
  27949. footer: createDOMFactory('footer'),
  27950. form: createDOMFactory('form'),
  27951. h1: createDOMFactory('h1'),
  27952. h2: createDOMFactory('h2'),
  27953. h3: createDOMFactory('h3'),
  27954. h4: createDOMFactory('h4'),
  27955. h5: createDOMFactory('h5'),
  27956. h6: createDOMFactory('h6'),
  27957. head: createDOMFactory('head'),
  27958. header: createDOMFactory('header'),
  27959. hgroup: createDOMFactory('hgroup'),
  27960. hr: createDOMFactory('hr'),
  27961. html: createDOMFactory('html'),
  27962. i: createDOMFactory('i'),
  27963. iframe: createDOMFactory('iframe'),
  27964. img: createDOMFactory('img'),
  27965. input: createDOMFactory('input'),
  27966. ins: createDOMFactory('ins'),
  27967. kbd: createDOMFactory('kbd'),
  27968. keygen: createDOMFactory('keygen'),
  27969. label: createDOMFactory('label'),
  27970. legend: createDOMFactory('legend'),
  27971. li: createDOMFactory('li'),
  27972. link: createDOMFactory('link'),
  27973. main: createDOMFactory('main'),
  27974. map: createDOMFactory('map'),
  27975. mark: createDOMFactory('mark'),
  27976. menu: createDOMFactory('menu'),
  27977. menuitem: createDOMFactory('menuitem'),
  27978. meta: createDOMFactory('meta'),
  27979. meter: createDOMFactory('meter'),
  27980. nav: createDOMFactory('nav'),
  27981. noscript: createDOMFactory('noscript'),
  27982. object: createDOMFactory('object'),
  27983. ol: createDOMFactory('ol'),
  27984. optgroup: createDOMFactory('optgroup'),
  27985. option: createDOMFactory('option'),
  27986. output: createDOMFactory('output'),
  27987. p: createDOMFactory('p'),
  27988. param: createDOMFactory('param'),
  27989. picture: createDOMFactory('picture'),
  27990. pre: createDOMFactory('pre'),
  27991. progress: createDOMFactory('progress'),
  27992. q: createDOMFactory('q'),
  27993. rp: createDOMFactory('rp'),
  27994. rt: createDOMFactory('rt'),
  27995. ruby: createDOMFactory('ruby'),
  27996. s: createDOMFactory('s'),
  27997. samp: createDOMFactory('samp'),
  27998. script: createDOMFactory('script'),
  27999. section: createDOMFactory('section'),
  28000. select: createDOMFactory('select'),
  28001. small: createDOMFactory('small'),
  28002. source: createDOMFactory('source'),
  28003. span: createDOMFactory('span'),
  28004. strong: createDOMFactory('strong'),
  28005. style: createDOMFactory('style'),
  28006. sub: createDOMFactory('sub'),
  28007. summary: createDOMFactory('summary'),
  28008. sup: createDOMFactory('sup'),
  28009. table: createDOMFactory('table'),
  28010. tbody: createDOMFactory('tbody'),
  28011. td: createDOMFactory('td'),
  28012. textarea: createDOMFactory('textarea'),
  28013. tfoot: createDOMFactory('tfoot'),
  28014. th: createDOMFactory('th'),
  28015. thead: createDOMFactory('thead'),
  28016. time: createDOMFactory('time'),
  28017. title: createDOMFactory('title'),
  28018. tr: createDOMFactory('tr'),
  28019. track: createDOMFactory('track'),
  28020. u: createDOMFactory('u'),
  28021. ul: createDOMFactory('ul'),
  28022. 'var': createDOMFactory('var'),
  28023. video: createDOMFactory('video'),
  28024. wbr: createDOMFactory('wbr'),
  28025. // SVG
  28026. circle: createDOMFactory('circle'),
  28027. clipPath: createDOMFactory('clipPath'),
  28028. defs: createDOMFactory('defs'),
  28029. ellipse: createDOMFactory('ellipse'),
  28030. g: createDOMFactory('g'),
  28031. image: createDOMFactory('image'),
  28032. line: createDOMFactory('line'),
  28033. linearGradient: createDOMFactory('linearGradient'),
  28034. mask: createDOMFactory('mask'),
  28035. path: createDOMFactory('path'),
  28036. pattern: createDOMFactory('pattern'),
  28037. polygon: createDOMFactory('polygon'),
  28038. polyline: createDOMFactory('polyline'),
  28039. radialGradient: createDOMFactory('radialGradient'),
  28040. rect: createDOMFactory('rect'),
  28041. stop: createDOMFactory('stop'),
  28042. svg: createDOMFactory('svg'),
  28043. text: createDOMFactory('text'),
  28044. tspan: createDOMFactory('tspan')
  28045. };
  28046. module.exports = ReactDOMFactories;
  28047. /***/ }),
  28048. /* 210 */
  28049. /***/ (function(module, exports, __webpack_require__) {
  28050. "use strict";
  28051. /**
  28052. * Copyright 2013-present, Facebook, Inc.
  28053. * All rights reserved.
  28054. *
  28055. * This source code is licensed under the BSD-style license found in the
  28056. * LICENSE file in the root directory of this source tree. An additional grant
  28057. * of patent rights can be found in the PATENTS file in the same directory.
  28058. *
  28059. */
  28060. var ReactElement = __webpack_require__(21);
  28061. var ReactPropTypeLocationNames = __webpack_require__(80);
  28062. var ReactPropTypesSecret = __webpack_require__(211);
  28063. var emptyFunction = __webpack_require__(9);
  28064. var getIteratorFn = __webpack_require__(82);
  28065. var warning = __webpack_require__(1);
  28066. /**
  28067. * Collection of methods that allow declaration and validation of props that are
  28068. * supplied to React components. Example usage:
  28069. *
  28070. * var Props = require('ReactPropTypes');
  28071. * var MyArticle = React.createClass({
  28072. * propTypes: {
  28073. * // An optional string prop named "description".
  28074. * description: Props.string,
  28075. *
  28076. * // A required enum prop named "category".
  28077. * category: Props.oneOf(['News','Photos']).isRequired,
  28078. *
  28079. * // A prop named "dialog" that requires an instance of Dialog.
  28080. * dialog: Props.instanceOf(Dialog).isRequired
  28081. * },
  28082. * render: function() { ... }
  28083. * });
  28084. *
  28085. * A more formal specification of how these methods are used:
  28086. *
  28087. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  28088. * decl := ReactPropTypes.{type}(.isRequired)?
  28089. *
  28090. * Each and every declaration produces a function with the same signature. This
  28091. * allows the creation of custom validation functions. For example:
  28092. *
  28093. * var MyLink = React.createClass({
  28094. * propTypes: {
  28095. * // An optional string or URI prop named "href".
  28096. * href: function(props, propName, componentName) {
  28097. * var propValue = props[propName];
  28098. * if (propValue != null && typeof propValue !== 'string' &&
  28099. * !(propValue instanceof URI)) {
  28100. * return new Error(
  28101. * 'Expected a string or an URI for ' + propName + ' in ' +
  28102. * componentName
  28103. * );
  28104. * }
  28105. * }
  28106. * },
  28107. * render: function() {...}
  28108. * });
  28109. *
  28110. * @internal
  28111. */
  28112. var ANONYMOUS = '<<anonymous>>';
  28113. var ReactPropTypes = {
  28114. array: createPrimitiveTypeChecker('array'),
  28115. bool: createPrimitiveTypeChecker('boolean'),
  28116. func: createPrimitiveTypeChecker('function'),
  28117. number: createPrimitiveTypeChecker('number'),
  28118. object: createPrimitiveTypeChecker('object'),
  28119. string: createPrimitiveTypeChecker('string'),
  28120. symbol: createPrimitiveTypeChecker('symbol'),
  28121. any: createAnyTypeChecker(),
  28122. arrayOf: createArrayOfTypeChecker,
  28123. element: createElementTypeChecker(),
  28124. instanceOf: createInstanceTypeChecker,
  28125. node: createNodeChecker(),
  28126. objectOf: createObjectOfTypeChecker,
  28127. oneOf: createEnumTypeChecker,
  28128. oneOfType: createUnionTypeChecker,
  28129. shape: createShapeTypeChecker
  28130. };
  28131. /**
  28132. * inlined Object.is polyfill to avoid requiring consumers ship their own
  28133. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  28134. */
  28135. /*eslint-disable no-self-compare*/
  28136. function is(x, y) {
  28137. // SameValue algorithm
  28138. if (x === y) {
  28139. // Steps 1-5, 7-10
  28140. // Steps 6.b-6.e: +0 != -0
  28141. return x !== 0 || 1 / x === 1 / y;
  28142. } else {
  28143. // Step 6.a: NaN == NaN
  28144. return x !== x && y !== y;
  28145. }
  28146. }
  28147. /*eslint-enable no-self-compare*/
  28148. /**
  28149. * We use an Error-like object for backward compatibility as people may call
  28150. * PropTypes directly and inspect their output. However we don't use real
  28151. * Errors anymore. We don't inspect their stack anyway, and creating them
  28152. * is prohibitively expensive if they are created too often, such as what
  28153. * happens in oneOfType() for any type before the one that matched.
  28154. */
  28155. function PropTypeError(message) {
  28156. this.message = message;
  28157. this.stack = '';
  28158. }
  28159. // Make `instanceof Error` still work for returned errors.
  28160. PropTypeError.prototype = Error.prototype;
  28161. function createChainableTypeChecker(validate) {
  28162. if (false) {
  28163. var manualPropTypeCallCache = {};
  28164. }
  28165. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  28166. componentName = componentName || ANONYMOUS;
  28167. propFullName = propFullName || propName;
  28168. if (false) {
  28169. if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
  28170. var cacheKey = componentName + ':' + propName;
  28171. if (!manualPropTypeCallCache[cacheKey]) {
  28172. process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;
  28173. manualPropTypeCallCache[cacheKey] = true;
  28174. }
  28175. }
  28176. }
  28177. if (props[propName] == null) {
  28178. var locationName = ReactPropTypeLocationNames[location];
  28179. if (isRequired) {
  28180. if (props[propName] === null) {
  28181. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  28182. }
  28183. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  28184. }
  28185. return null;
  28186. } else {
  28187. return validate(props, propName, componentName, location, propFullName);
  28188. }
  28189. }
  28190. var chainedCheckType = checkType.bind(null, false);
  28191. chainedCheckType.isRequired = checkType.bind(null, true);
  28192. return chainedCheckType;
  28193. }
  28194. function createPrimitiveTypeChecker(expectedType) {
  28195. function validate(props, propName, componentName, location, propFullName, secret) {
  28196. var propValue = props[propName];
  28197. var propType = getPropType(propValue);
  28198. if (propType !== expectedType) {
  28199. var locationName = ReactPropTypeLocationNames[location];
  28200. // `propValue` being instance of, say, date/regexp, pass the 'object'
  28201. // check, but we can offer a more precise error message here rather than
  28202. // 'of type `object`'.
  28203. var preciseType = getPreciseType(propValue);
  28204. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  28205. }
  28206. return null;
  28207. }
  28208. return createChainableTypeChecker(validate);
  28209. }
  28210. function createAnyTypeChecker() {
  28211. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  28212. }
  28213. function createArrayOfTypeChecker(typeChecker) {
  28214. function validate(props, propName, componentName, location, propFullName) {
  28215. if (typeof typeChecker !== 'function') {
  28216. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  28217. }
  28218. var propValue = props[propName];
  28219. if (!Array.isArray(propValue)) {
  28220. var locationName = ReactPropTypeLocationNames[location];
  28221. var propType = getPropType(propValue);
  28222. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  28223. }
  28224. for (var i = 0; i < propValue.length; i++) {
  28225. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  28226. if (error instanceof Error) {
  28227. return error;
  28228. }
  28229. }
  28230. return null;
  28231. }
  28232. return createChainableTypeChecker(validate);
  28233. }
  28234. function createElementTypeChecker() {
  28235. function validate(props, propName, componentName, location, propFullName) {
  28236. var propValue = props[propName];
  28237. if (!ReactElement.isValidElement(propValue)) {
  28238. var locationName = ReactPropTypeLocationNames[location];
  28239. var propType = getPropType(propValue);
  28240. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  28241. }
  28242. return null;
  28243. }
  28244. return createChainableTypeChecker(validate);
  28245. }
  28246. function createInstanceTypeChecker(expectedClass) {
  28247. function validate(props, propName, componentName, location, propFullName) {
  28248. if (!(props[propName] instanceof expectedClass)) {
  28249. var locationName = ReactPropTypeLocationNames[location];
  28250. var expectedClassName = expectedClass.name || ANONYMOUS;
  28251. var actualClassName = getClassName(props[propName]);
  28252. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  28253. }
  28254. return null;
  28255. }
  28256. return createChainableTypeChecker(validate);
  28257. }
  28258. function createEnumTypeChecker(expectedValues) {
  28259. if (!Array.isArray(expectedValues)) {
  28260. false ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  28261. return emptyFunction.thatReturnsNull;
  28262. }
  28263. function validate(props, propName, componentName, location, propFullName) {
  28264. var propValue = props[propName];
  28265. for (var i = 0; i < expectedValues.length; i++) {
  28266. if (is(propValue, expectedValues[i])) {
  28267. return null;
  28268. }
  28269. }
  28270. var locationName = ReactPropTypeLocationNames[location];
  28271. var valuesString = JSON.stringify(expectedValues);
  28272. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  28273. }
  28274. return createChainableTypeChecker(validate);
  28275. }
  28276. function createObjectOfTypeChecker(typeChecker) {
  28277. function validate(props, propName, componentName, location, propFullName) {
  28278. if (typeof typeChecker !== 'function') {
  28279. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  28280. }
  28281. var propValue = props[propName];
  28282. var propType = getPropType(propValue);
  28283. if (propType !== 'object') {
  28284. var locationName = ReactPropTypeLocationNames[location];
  28285. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  28286. }
  28287. for (var key in propValue) {
  28288. if (propValue.hasOwnProperty(key)) {
  28289. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  28290. if (error instanceof Error) {
  28291. return error;
  28292. }
  28293. }
  28294. }
  28295. return null;
  28296. }
  28297. return createChainableTypeChecker(validate);
  28298. }
  28299. function createUnionTypeChecker(arrayOfTypeCheckers) {
  28300. if (!Array.isArray(arrayOfTypeCheckers)) {
  28301. false ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  28302. return emptyFunction.thatReturnsNull;
  28303. }
  28304. function validate(props, propName, componentName, location, propFullName) {
  28305. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  28306. var checker = arrayOfTypeCheckers[i];
  28307. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  28308. return null;
  28309. }
  28310. }
  28311. var locationName = ReactPropTypeLocationNames[location];
  28312. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  28313. }
  28314. return createChainableTypeChecker(validate);
  28315. }
  28316. function createNodeChecker() {
  28317. function validate(props, propName, componentName, location, propFullName) {
  28318. if (!isNode(props[propName])) {
  28319. var locationName = ReactPropTypeLocationNames[location];
  28320. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  28321. }
  28322. return null;
  28323. }
  28324. return createChainableTypeChecker(validate);
  28325. }
  28326. function createShapeTypeChecker(shapeTypes) {
  28327. function validate(props, propName, componentName, location, propFullName) {
  28328. var propValue = props[propName];
  28329. var propType = getPropType(propValue);
  28330. if (propType !== 'object') {
  28331. var locationName = ReactPropTypeLocationNames[location];
  28332. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  28333. }
  28334. for (var key in shapeTypes) {
  28335. var checker = shapeTypes[key];
  28336. if (!checker) {
  28337. continue;
  28338. }
  28339. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  28340. if (error) {
  28341. return error;
  28342. }
  28343. }
  28344. return null;
  28345. }
  28346. return createChainableTypeChecker(validate);
  28347. }
  28348. function isNode(propValue) {
  28349. switch (typeof propValue) {
  28350. case 'number':
  28351. case 'string':
  28352. case 'undefined':
  28353. return true;
  28354. case 'boolean':
  28355. return !propValue;
  28356. case 'object':
  28357. if (Array.isArray(propValue)) {
  28358. return propValue.every(isNode);
  28359. }
  28360. if (propValue === null || ReactElement.isValidElement(propValue)) {
  28361. return true;
  28362. }
  28363. var iteratorFn = getIteratorFn(propValue);
  28364. if (iteratorFn) {
  28365. var iterator = iteratorFn.call(propValue);
  28366. var step;
  28367. if (iteratorFn !== propValue.entries) {
  28368. while (!(step = iterator.next()).done) {
  28369. if (!isNode(step.value)) {
  28370. return false;
  28371. }
  28372. }
  28373. } else {
  28374. // Iterator will provide entry [k,v] tuples rather than values.
  28375. while (!(step = iterator.next()).done) {
  28376. var entry = step.value;
  28377. if (entry) {
  28378. if (!isNode(entry[1])) {
  28379. return false;
  28380. }
  28381. }
  28382. }
  28383. }
  28384. } else {
  28385. return false;
  28386. }
  28387. return true;
  28388. default:
  28389. return false;
  28390. }
  28391. }
  28392. function isSymbol(propType, propValue) {
  28393. // Native Symbol.
  28394. if (propType === 'symbol') {
  28395. return true;
  28396. }
  28397. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  28398. if (propValue['@@toStringTag'] === 'Symbol') {
  28399. return true;
  28400. }
  28401. // Fallback for non-spec compliant Symbols which are polyfilled.
  28402. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  28403. return true;
  28404. }
  28405. return false;
  28406. }
  28407. // Equivalent of `typeof` but with special handling for array and regexp.
  28408. function getPropType(propValue) {
  28409. var propType = typeof propValue;
  28410. if (Array.isArray(propValue)) {
  28411. return 'array';
  28412. }
  28413. if (propValue instanceof RegExp) {
  28414. // Old webkits (at least until Android 4.0) return 'function' rather than
  28415. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  28416. // passes PropTypes.object.
  28417. return 'object';
  28418. }
  28419. if (isSymbol(propType, propValue)) {
  28420. return 'symbol';
  28421. }
  28422. return propType;
  28423. }
  28424. // This handles more types than `getPropType`. Only used for error messages.
  28425. // See `createPrimitiveTypeChecker`.
  28426. function getPreciseType(propValue) {
  28427. var propType = getPropType(propValue);
  28428. if (propType === 'object') {
  28429. if (propValue instanceof Date) {
  28430. return 'date';
  28431. } else if (propValue instanceof RegExp) {
  28432. return 'regexp';
  28433. }
  28434. }
  28435. return propType;
  28436. }
  28437. // Returns class name of the object, if any.
  28438. function getClassName(propValue) {
  28439. if (!propValue.constructor || !propValue.constructor.name) {
  28440. return ANONYMOUS;
  28441. }
  28442. return propValue.constructor.name;
  28443. }
  28444. module.exports = ReactPropTypes;
  28445. /***/ }),
  28446. /* 211 */
  28447. /***/ (function(module, exports, __webpack_require__) {
  28448. "use strict";
  28449. /**
  28450. * Copyright 2013-present, Facebook, Inc.
  28451. * All rights reserved.
  28452. *
  28453. * This source code is licensed under the BSD-style license found in the
  28454. * LICENSE file in the root directory of this source tree. An additional grant
  28455. * of patent rights can be found in the PATENTS file in the same directory.
  28456. *
  28457. *
  28458. */
  28459. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  28460. module.exports = ReactPropTypesSecret;
  28461. /***/ }),
  28462. /* 212 */
  28463. /***/ (function(module, exports, __webpack_require__) {
  28464. "use strict";
  28465. /**
  28466. * Copyright 2013-present, Facebook, Inc.
  28467. * All rights reserved.
  28468. *
  28469. * This source code is licensed under the BSD-style license found in the
  28470. * LICENSE file in the root directory of this source tree. An additional grant
  28471. * of patent rights can be found in the PATENTS file in the same directory.
  28472. *
  28473. */
  28474. var _assign = __webpack_require__(3);
  28475. var ReactComponent = __webpack_require__(51);
  28476. var ReactNoopUpdateQueue = __webpack_require__(52);
  28477. var emptyObject = __webpack_require__(23);
  28478. /**
  28479. * Base class helpers for the updating state of a component.
  28480. */
  28481. function ReactPureComponent(props, context, updater) {
  28482. // Duplicated from ReactComponent.
  28483. this.props = props;
  28484. this.context = context;
  28485. this.refs = emptyObject;
  28486. // We initialize the default updater but the real one gets injected by the
  28487. // renderer.
  28488. this.updater = updater || ReactNoopUpdateQueue;
  28489. }
  28490. function ComponentDummy() {}
  28491. ComponentDummy.prototype = ReactComponent.prototype;
  28492. ReactPureComponent.prototype = new ComponentDummy();
  28493. ReactPureComponent.prototype.constructor = ReactPureComponent;
  28494. // Avoid an extra prototype jump for these methods.
  28495. _assign(ReactPureComponent.prototype, ReactComponent.prototype);
  28496. ReactPureComponent.prototype.isPureReactComponent = true;
  28497. module.exports = ReactPureComponent;
  28498. /***/ }),
  28499. /* 213 */
  28500. /***/ (function(module, exports, __webpack_require__) {
  28501. "use strict";
  28502. /**
  28503. * Copyright 2013-present, Facebook, Inc.
  28504. * All rights reserved.
  28505. *
  28506. * This source code is licensed under the BSD-style license found in the
  28507. * LICENSE file in the root directory of this source tree. An additional grant
  28508. * of patent rights can be found in the PATENTS file in the same directory.
  28509. *
  28510. */
  28511. module.exports = '15.4.2';
  28512. /***/ }),
  28513. /* 214 */
  28514. /***/ (function(module, exports, __webpack_require__) {
  28515. "use strict";
  28516. /**
  28517. * Copyright 2013-present, Facebook, Inc.
  28518. * All rights reserved.
  28519. *
  28520. * This source code is licensed under the BSD-style license found in the
  28521. * LICENSE file in the root directory of this source tree. An additional grant
  28522. * of patent rights can be found in the PATENTS file in the same directory.
  28523. *
  28524. */
  28525. var _prodInvariant = __webpack_require__(22);
  28526. var ReactElement = __webpack_require__(21);
  28527. var invariant = __webpack_require__(0);
  28528. /**
  28529. * Returns the first child in a collection of children and verifies that there
  28530. * is only one child in the collection.
  28531. *
  28532. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
  28533. *
  28534. * The current implementation of this function assumes that a single child gets
  28535. * passed without a wrapper, but the purpose of this helper function is to
  28536. * abstract away the particular structure of children.
  28537. *
  28538. * @param {?object} children Child collection structure.
  28539. * @return {ReactElement} The first and only `ReactElement` contained in the
  28540. * structure.
  28541. */
  28542. function onlyChild(children) {
  28543. !ReactElement.isValidElement(children) ? false ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
  28544. return children;
  28545. }
  28546. module.exports = onlyChild;
  28547. /***/ }),
  28548. /* 215 */
  28549. /***/ (function(module, exports, __webpack_require__) {
  28550. "use strict";
  28551. /**
  28552. * Copyright 2013-present, Facebook, Inc.
  28553. * All rights reserved.
  28554. *
  28555. * This source code is licensed under the BSD-style license found in the
  28556. * LICENSE file in the root directory of this source tree. An additional grant
  28557. * of patent rights can be found in the PATENTS file in the same directory.
  28558. *
  28559. */
  28560. var _prodInvariant = __webpack_require__(22);
  28561. var ReactCurrentOwner = __webpack_require__(13);
  28562. var REACT_ELEMENT_TYPE = __webpack_require__(79);
  28563. var getIteratorFn = __webpack_require__(82);
  28564. var invariant = __webpack_require__(0);
  28565. var KeyEscapeUtils = __webpack_require__(205);
  28566. var warning = __webpack_require__(1);
  28567. var SEPARATOR = '.';
  28568. var SUBSEPARATOR = ':';
  28569. /**
  28570. * This is inlined from ReactElement since this file is shared between
  28571. * isomorphic and renderers. We could extract this to a
  28572. *
  28573. */
  28574. /**
  28575. * TODO: Test that a single child and an array with one item have the same key
  28576. * pattern.
  28577. */
  28578. var didWarnAboutMaps = false;
  28579. /**
  28580. * Generate a key string that identifies a component within a set.
  28581. *
  28582. * @param {*} component A component that could contain a manual key.
  28583. * @param {number} index Index that is used if a manual key is not provided.
  28584. * @return {string}
  28585. */
  28586. function getComponentKey(component, index) {
  28587. // Do some typechecking here since we call this blindly. We want to ensure
  28588. // that we don't block potential future ES APIs.
  28589. if (component && typeof component === 'object' && component.key != null) {
  28590. // Explicit key
  28591. return KeyEscapeUtils.escape(component.key);
  28592. }
  28593. // Implicit key determined by the index in the set
  28594. return index.toString(36);
  28595. }
  28596. /**
  28597. * @param {?*} children Children tree container.
  28598. * @param {!string} nameSoFar Name of the key path so far.
  28599. * @param {!function} callback Callback to invoke with each child found.
  28600. * @param {?*} traverseContext Used to pass information throughout the traversal
  28601. * process.
  28602. * @return {!number} The number of children in this subtree.
  28603. */
  28604. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  28605. var type = typeof children;
  28606. if (type === 'undefined' || type === 'boolean') {
  28607. // All of the above are perceived as null.
  28608. children = null;
  28609. }
  28610. if (children === null || type === 'string' || type === 'number' ||
  28611. // The following is inlined from ReactElement. This means we can optimize
  28612. // some checks. React Fiber also inlines this logic for similar purposes.
  28613. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  28614. callback(traverseContext, children,
  28615. // If it's the only child, treat the name as if it was wrapped in an array
  28616. // so that it's consistent if the number of children grows.
  28617. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  28618. return 1;
  28619. }
  28620. var child;
  28621. var nextName;
  28622. var subtreeCount = 0; // Count of children found in the current subtree.
  28623. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  28624. if (Array.isArray(children)) {
  28625. for (var i = 0; i < children.length; i++) {
  28626. child = children[i];
  28627. nextName = nextNamePrefix + getComponentKey(child, i);
  28628. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  28629. }
  28630. } else {
  28631. var iteratorFn = getIteratorFn(children);
  28632. if (iteratorFn) {
  28633. var iterator = iteratorFn.call(children);
  28634. var step;
  28635. if (iteratorFn !== children.entries) {
  28636. var ii = 0;
  28637. while (!(step = iterator.next()).done) {
  28638. child = step.value;
  28639. nextName = nextNamePrefix + getComponentKey(child, ii++);
  28640. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  28641. }
  28642. } else {
  28643. if (false) {
  28644. var mapsAsChildrenAddendum = '';
  28645. if (ReactCurrentOwner.current) {
  28646. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  28647. if (mapsAsChildrenOwnerName) {
  28648. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  28649. }
  28650. }
  28651. process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
  28652. didWarnAboutMaps = true;
  28653. }
  28654. // Iterator will provide entry [k,v] tuples rather than values.
  28655. while (!(step = iterator.next()).done) {
  28656. var entry = step.value;
  28657. if (entry) {
  28658. child = entry[1];
  28659. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  28660. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  28661. }
  28662. }
  28663. }
  28664. } else if (type === 'object') {
  28665. var addendum = '';
  28666. if (false) {
  28667. addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
  28668. if (children._isReactElement) {
  28669. addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
  28670. }
  28671. if (ReactCurrentOwner.current) {
  28672. var name = ReactCurrentOwner.current.getName();
  28673. if (name) {
  28674. addendum += ' Check the render method of `' + name + '`.';
  28675. }
  28676. }
  28677. }
  28678. var childrenString = String(children);
  28679. true ? false ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
  28680. }
  28681. }
  28682. return subtreeCount;
  28683. }
  28684. /**
  28685. * Traverses children that are typically specified as `props.children`, but
  28686. * might also be specified through attributes:
  28687. *
  28688. * - `traverseAllChildren(this.props.children, ...)`
  28689. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  28690. *
  28691. * The `traverseContext` is an optional argument that is passed through the
  28692. * entire traversal. It can be used to store accumulations or anything else that
  28693. * the callback might find relevant.
  28694. *
  28695. * @param {?*} children Children tree object.
  28696. * @param {!function} callback To invoke upon traversing each child.
  28697. * @param {?*} traverseContext Context for traversal.
  28698. * @return {!number} The number of children in this subtree.
  28699. */
  28700. function traverseAllChildren(children, callback, traverseContext) {
  28701. if (children == null) {
  28702. return 0;
  28703. }
  28704. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  28705. }
  28706. module.exports = traverseAllChildren;
  28707. /***/ }),
  28708. /* 216 */
  28709. /***/ (function(module, exports, __webpack_require__) {
  28710. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**!
  28711. * Sortable
  28712. * @author RubaXa <[email protected]>
  28713. * @license MIT
  28714. */
  28715. (function sortableModule(factory) {
  28716. "use strict";
  28717. if (true) {
  28718. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  28719. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  28720. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  28721. __WEBPACK_AMD_DEFINE_FACTORY__),
  28722. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  28723. }
  28724. else if (typeof module != "undefined" && typeof module.exports != "undefined") {
  28725. module.exports = factory();
  28726. }
  28727. else {
  28728. /* jshint sub:true */
  28729. window["Sortable"] = factory();
  28730. }
  28731. })(function sortableFactory() {
  28732. "use strict";
  28733. if (typeof window == "undefined" || !window.document) {
  28734. return function sortableError() {
  28735. throw new Error("Sortable.js requires a window with a document");
  28736. };
  28737. }
  28738. var dragEl,
  28739. parentEl,
  28740. ghostEl,
  28741. cloneEl,
  28742. rootEl,
  28743. nextEl,
  28744. lastDownEl,
  28745. scrollEl,
  28746. scrollParentEl,
  28747. scrollCustomFn,
  28748. lastEl,
  28749. lastCSS,
  28750. lastParentCSS,
  28751. oldIndex,
  28752. newIndex,
  28753. activeGroup,
  28754. putSortable,
  28755. autoScroll = {},
  28756. tapEvt,
  28757. touchEvt,
  28758. moved,
  28759. /** @const */
  28760. R_SPACE = /\s+/g,
  28761. R_FLOAT = /left|right|inline/,
  28762. expando = 'Sortable' + (new Date).getTime(),
  28763. win = window,
  28764. document = win.document,
  28765. parseInt = win.parseInt,
  28766. $ = win.jQuery || win.Zepto,
  28767. Polymer = win.Polymer,
  28768. captureMode = false,
  28769. supportDraggable = !!('draggable' in document.createElement('div')),
  28770. supportCssPointerEvents = (function (el) {
  28771. // false when IE11
  28772. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  28773. return false;
  28774. }
  28775. el = document.createElement('x');
  28776. el.style.cssText = 'pointer-events:auto';
  28777. return el.style.pointerEvents === 'auto';
  28778. })(),
  28779. _silent = false,
  28780. abs = Math.abs,
  28781. min = Math.min,
  28782. savedInputChecked = [],
  28783. touchDragOverListeners = [],
  28784. _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  28785. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  28786. if (rootEl && options.scroll) {
  28787. var _this = rootEl[expando],
  28788. el,
  28789. rect,
  28790. sens = options.scrollSensitivity,
  28791. speed = options.scrollSpeed,
  28792. x = evt.clientX,
  28793. y = evt.clientY,
  28794. winWidth = window.innerWidth,
  28795. winHeight = window.innerHeight,
  28796. vx,
  28797. vy,
  28798. scrollOffsetX,
  28799. scrollOffsetY
  28800. ;
  28801. // Delect scrollEl
  28802. if (scrollParentEl !== rootEl) {
  28803. scrollEl = options.scroll;
  28804. scrollParentEl = rootEl;
  28805. scrollCustomFn = options.scrollFn;
  28806. if (scrollEl === true) {
  28807. scrollEl = rootEl;
  28808. do {
  28809. if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
  28810. (scrollEl.offsetHeight < scrollEl.scrollHeight)
  28811. ) {
  28812. break;
  28813. }
  28814. /* jshint boss:true */
  28815. } while (scrollEl = scrollEl.parentNode);
  28816. }
  28817. }
  28818. if (scrollEl) {
  28819. el = scrollEl;
  28820. rect = scrollEl.getBoundingClientRect();
  28821. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  28822. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  28823. }
  28824. if (!(vx || vy)) {
  28825. vx = (winWidth - x <= sens) - (x <= sens);
  28826. vy = (winHeight - y <= sens) - (y <= sens);
  28827. /* jshint expr:true */
  28828. (vx || vy) && (el = win);
  28829. }
  28830. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  28831. autoScroll.el = el;
  28832. autoScroll.vx = vx;
  28833. autoScroll.vy = vy;
  28834. clearInterval(autoScroll.pid);
  28835. if (el) {
  28836. autoScroll.pid = setInterval(function () {
  28837. scrollOffsetY = vy ? vy * speed : 0;
  28838. scrollOffsetX = vx ? vx * speed : 0;
  28839. if ('function' === typeof(scrollCustomFn)) {
  28840. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  28841. }
  28842. if (el === win) {
  28843. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  28844. } else {
  28845. el.scrollTop += scrollOffsetY;
  28846. el.scrollLeft += scrollOffsetX;
  28847. }
  28848. }, 24);
  28849. }
  28850. }
  28851. }
  28852. }, 30),
  28853. _prepareGroup = function (options) {
  28854. function toFn(value, pull) {
  28855. if (value === void 0 || value === true) {
  28856. value = group.name;
  28857. }
  28858. if (typeof value === 'function') {
  28859. return value;
  28860. } else {
  28861. return function (to, from) {
  28862. var fromGroup = from.options.group.name;
  28863. return pull
  28864. ? value
  28865. : value && (value.join
  28866. ? value.indexOf(fromGroup) > -1
  28867. : (fromGroup == value)
  28868. );
  28869. };
  28870. }
  28871. }
  28872. var group = {};
  28873. var originalGroup = options.group;
  28874. if (!originalGroup || typeof originalGroup != 'object') {
  28875. originalGroup = {name: originalGroup};
  28876. }
  28877. group.name = originalGroup.name;
  28878. group.checkPull = toFn(originalGroup.pull, true);
  28879. group.checkPut = toFn(originalGroup.put);
  28880. group.revertClone = originalGroup.revertClone;
  28881. options.group = group;
  28882. }
  28883. ;
  28884. /**
  28885. * @class Sortable
  28886. * @param {HTMLElement} el
  28887. * @param {Object} [options]
  28888. */
  28889. function Sortable(el, options) {
  28890. if (!(el && el.nodeType && el.nodeType === 1)) {
  28891. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  28892. }
  28893. this.el = el; // root element
  28894. this.options = options = _extend({}, options);
  28895. // Export instance
  28896. el[expando] = this;
  28897. // Default options
  28898. var defaults = {
  28899. group: Math.random(),
  28900. sort: true,
  28901. disabled: false,
  28902. store: null,
  28903. handle: null,
  28904. scroll: true,
  28905. scrollSensitivity: 30,
  28906. scrollSpeed: 10,
  28907. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  28908. ghostClass: 'sortable-ghost',
  28909. chosenClass: 'sortable-chosen',
  28910. dragClass: 'sortable-drag',
  28911. ignore: 'a, img',
  28912. filter: null,
  28913. preventOnFilter: true,
  28914. animation: 0,
  28915. setData: function (dataTransfer, dragEl) {
  28916. dataTransfer.setData('Text', dragEl.textContent);
  28917. },
  28918. dropBubble: false,
  28919. dragoverBubble: false,
  28920. dataIdAttr: 'data-id',
  28921. delay: 0,
  28922. forceFallback: false,
  28923. fallbackClass: 'sortable-fallback',
  28924. fallbackOnBody: false,
  28925. fallbackTolerance: 0,
  28926. fallbackOffset: {x: 0, y: 0}
  28927. };
  28928. // Set default options
  28929. for (var name in defaults) {
  28930. !(name in options) && (options[name] = defaults[name]);
  28931. }
  28932. _prepareGroup(options);
  28933. // Bind all private methods
  28934. for (var fn in this) {
  28935. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  28936. this[fn] = this[fn].bind(this);
  28937. }
  28938. }
  28939. // Setup drag mode
  28940. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  28941. // Bind events
  28942. _on(el, 'mousedown', this._onTapStart);
  28943. _on(el, 'touchstart', this._onTapStart);
  28944. _on(el, 'pointerdown', this._onTapStart);
  28945. if (this.nativeDraggable) {
  28946. _on(el, 'dragover', this);
  28947. _on(el, 'dragenter', this);
  28948. }
  28949. touchDragOverListeners.push(this._onDragOver);
  28950. // Restore sorting
  28951. options.store && this.sort(options.store.get(this));
  28952. }
  28953. Sortable.prototype = /** @lends Sortable.prototype */ {
  28954. constructor: Sortable,
  28955. _onTapStart: function (/** Event|TouchEvent */evt) {
  28956. var _this = this,
  28957. el = this.el,
  28958. options = this.options,
  28959. preventOnFilter = options.preventOnFilter,
  28960. type = evt.type,
  28961. touch = evt.touches && evt.touches[0],
  28962. target = (touch || evt).target,
  28963. originalTarget = evt.target.shadowRoot && evt.path[0] || target,
  28964. filter = options.filter,
  28965. startIndex;
  28966. _saveInputCheckedState(el);
  28967. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  28968. if (dragEl) {
  28969. return;
  28970. }
  28971. if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
  28972. return; // only left button or enabled
  28973. }
  28974. target = _closest(target, options.draggable, el);
  28975. if (!target) {
  28976. return;
  28977. }
  28978. if (lastDownEl === target) {
  28979. // Ignoring duplicate `down`
  28980. return;
  28981. }
  28982. // Get the index of the dragged element within its parent
  28983. startIndex = _index(target, options.draggable);
  28984. // Check filter
  28985. if (typeof filter === 'function') {
  28986. if (filter.call(this, evt, target, this)) {
  28987. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  28988. preventOnFilter && evt.preventDefault();
  28989. return; // cancel dnd
  28990. }
  28991. }
  28992. else if (filter) {
  28993. filter = filter.split(',').some(function (criteria) {
  28994. criteria = _closest(originalTarget, criteria.trim(), el);
  28995. if (criteria) {
  28996. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  28997. return true;
  28998. }
  28999. });
  29000. if (filter) {
  29001. preventOnFilter && evt.preventDefault();
  29002. return; // cancel dnd
  29003. }
  29004. }
  29005. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  29006. return;
  29007. }
  29008. // Prepare `dragstart`
  29009. this._prepareDragStart(evt, touch, target, startIndex);
  29010. },
  29011. _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  29012. var _this = this,
  29013. el = _this.el,
  29014. options = _this.options,
  29015. ownerDocument = el.ownerDocument,
  29016. dragStartFn;
  29017. if (target && !dragEl && (target.parentNode === el)) {
  29018. tapEvt = evt;
  29019. rootEl = el;
  29020. dragEl = target;
  29021. parentEl = dragEl.parentNode;
  29022. nextEl = dragEl.nextSibling;
  29023. lastDownEl = target;
  29024. activeGroup = options.group;
  29025. oldIndex = startIndex;
  29026. this._lastX = (touch || evt).clientX;
  29027. this._lastY = (touch || evt).clientY;
  29028. dragEl.style['will-change'] = 'transform';
  29029. dragStartFn = function () {
  29030. // Delayed drag has been triggered
  29031. // we can re-enable the events: touchmove/mousemove
  29032. _this._disableDelayedDrag();
  29033. // Make the element draggable
  29034. dragEl.draggable = _this.nativeDraggable;
  29035. // Chosen item
  29036. _toggleClass(dragEl, options.chosenClass, true);
  29037. // Bind the events: dragstart/dragend
  29038. _this._triggerDragStart(evt, touch);
  29039. // Drag start event
  29040. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  29041. };
  29042. // Disable "draggable"
  29043. options.ignore.split(',').forEach(function (criteria) {
  29044. _find(dragEl, criteria.trim(), _disableDraggable);
  29045. });
  29046. _on(ownerDocument, 'mouseup', _this._onDrop);
  29047. _on(ownerDocument, 'touchend', _this._onDrop);
  29048. _on(ownerDocument, 'touchcancel', _this._onDrop);
  29049. _on(ownerDocument, 'pointercancel', _this._onDrop);
  29050. _on(ownerDocument, 'selectstart', _this);
  29051. if (options.delay) {
  29052. // If the user moves the pointer or let go the click or touch
  29053. // before the delay has been reached:
  29054. // disable the delayed drag
  29055. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  29056. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  29057. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  29058. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  29059. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  29060. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  29061. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  29062. } else {
  29063. dragStartFn();
  29064. }
  29065. }
  29066. },
  29067. _disableDelayedDrag: function () {
  29068. var ownerDocument = this.el.ownerDocument;
  29069. clearTimeout(this._dragStartTimer);
  29070. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  29071. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  29072. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  29073. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  29074. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  29075. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  29076. },
  29077. _triggerDragStart: function (/** Event */evt, /** Touch */touch) {
  29078. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  29079. if (touch) {
  29080. // Touch device support
  29081. tapEvt = {
  29082. target: dragEl,
  29083. clientX: touch.clientX,
  29084. clientY: touch.clientY
  29085. };
  29086. this._onDragStart(tapEvt, 'touch');
  29087. }
  29088. else if (!this.nativeDraggable) {
  29089. this._onDragStart(tapEvt, true);
  29090. }
  29091. else {
  29092. _on(dragEl, 'dragend', this);
  29093. _on(rootEl, 'dragstart', this._onDragStart);
  29094. }
  29095. try {
  29096. if (document.selection) {
  29097. // Timeout neccessary for IE9
  29098. setTimeout(function () {
  29099. document.selection.empty();
  29100. });
  29101. } else {
  29102. window.getSelection().removeAllRanges();
  29103. }
  29104. } catch (err) {
  29105. }
  29106. },
  29107. _dragStarted: function () {
  29108. if (rootEl && dragEl) {
  29109. var options = this.options;
  29110. // Apply effect
  29111. _toggleClass(dragEl, options.ghostClass, true);
  29112. _toggleClass(dragEl, options.dragClass, false);
  29113. Sortable.active = this;
  29114. // Drag start event
  29115. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  29116. } else {
  29117. this._nulling();
  29118. }
  29119. },
  29120. _emulateDragOver: function () {
  29121. if (touchEvt) {
  29122. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  29123. return;
  29124. }
  29125. this._lastX = touchEvt.clientX;
  29126. this._lastY = touchEvt.clientY;
  29127. if (!supportCssPointerEvents) {
  29128. _css(ghostEl, 'display', 'none');
  29129. }
  29130. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  29131. parent = target,
  29132. i = touchDragOverListeners.length;
  29133. if (parent) {
  29134. do {
  29135. if (parent[expando]) {
  29136. while (i--) {
  29137. touchDragOverListeners[i]({
  29138. clientX: touchEvt.clientX,
  29139. clientY: touchEvt.clientY,
  29140. target: target,
  29141. rootEl: parent
  29142. });
  29143. }
  29144. break;
  29145. }
  29146. target = parent; // store last element
  29147. }
  29148. /* jshint boss:true */
  29149. while (parent = parent.parentNode);
  29150. }
  29151. if (!supportCssPointerEvents) {
  29152. _css(ghostEl, 'display', '');
  29153. }
  29154. }
  29155. },
  29156. _onTouchMove: function (/**TouchEvent*/evt) {
  29157. if (tapEvt) {
  29158. var options = this.options,
  29159. fallbackTolerance = options.fallbackTolerance,
  29160. fallbackOffset = options.fallbackOffset,
  29161. touch = evt.touches ? evt.touches[0] : evt,
  29162. dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
  29163. dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
  29164. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  29165. // only set the status to dragging, when we are actually dragging
  29166. if (!Sortable.active) {
  29167. if (fallbackTolerance &&
  29168. min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
  29169. ) {
  29170. return;
  29171. }
  29172. this._dragStarted();
  29173. }
  29174. // as well as creating the ghost element on the document body
  29175. this._appendGhost();
  29176. moved = true;
  29177. touchEvt = touch;
  29178. _css(ghostEl, 'webkitTransform', translate3d);
  29179. _css(ghostEl, 'mozTransform', translate3d);
  29180. _css(ghostEl, 'msTransform', translate3d);
  29181. _css(ghostEl, 'transform', translate3d);
  29182. evt.preventDefault();
  29183. }
  29184. },
  29185. _appendGhost: function () {
  29186. if (!ghostEl) {
  29187. var rect = dragEl.getBoundingClientRect(),
  29188. css = _css(dragEl),
  29189. options = this.options,
  29190. ghostRect;
  29191. ghostEl = dragEl.cloneNode(true);
  29192. _toggleClass(ghostEl, options.ghostClass, false);
  29193. _toggleClass(ghostEl, options.fallbackClass, true);
  29194. _toggleClass(ghostEl, options.dragClass, true);
  29195. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  29196. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  29197. _css(ghostEl, 'width', rect.width);
  29198. _css(ghostEl, 'height', rect.height);
  29199. _css(ghostEl, 'opacity', '0.8');
  29200. _css(ghostEl, 'position', 'fixed');
  29201. _css(ghostEl, 'zIndex', '100000');
  29202. _css(ghostEl, 'pointerEvents', 'none');
  29203. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  29204. // Fixing dimensions.
  29205. ghostRect = ghostEl.getBoundingClientRect();
  29206. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  29207. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  29208. }
  29209. },
  29210. _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
  29211. var dataTransfer = evt.dataTransfer,
  29212. options = this.options;
  29213. this._offUpEvents();
  29214. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  29215. cloneEl = _clone(dragEl);
  29216. cloneEl.draggable = false;
  29217. cloneEl.style['will-change'] = '';
  29218. _css(cloneEl, 'display', 'none');
  29219. _toggleClass(cloneEl, this.options.chosenClass, false);
  29220. rootEl.insertBefore(cloneEl, dragEl);
  29221. _dispatchEvent(this, rootEl, 'clone', dragEl);
  29222. }
  29223. _toggleClass(dragEl, options.dragClass, true);
  29224. if (useFallback) {
  29225. if (useFallback === 'touch') {
  29226. // Bind touch events
  29227. _on(document, 'touchmove', this._onTouchMove);
  29228. _on(document, 'touchend', this._onDrop);
  29229. _on(document, 'touchcancel', this._onDrop);
  29230. _on(document, 'pointermove', this._onTouchMove);
  29231. _on(document, 'pointerup', this._onDrop);
  29232. } else {
  29233. // Old brwoser
  29234. _on(document, 'mousemove', this._onTouchMove);
  29235. _on(document, 'mouseup', this._onDrop);
  29236. }
  29237. this._loopId = setInterval(this._emulateDragOver, 50);
  29238. }
  29239. else {
  29240. if (dataTransfer) {
  29241. dataTransfer.effectAllowed = 'move';
  29242. options.setData && options.setData.call(this, dataTransfer, dragEl);
  29243. }
  29244. _on(document, 'drop', this);
  29245. setTimeout(this._dragStarted, 0);
  29246. }
  29247. },
  29248. _onDragOver: function (/**Event*/evt) {
  29249. var el = this.el,
  29250. target,
  29251. dragRect,
  29252. targetRect,
  29253. revert,
  29254. options = this.options,
  29255. group = options.group,
  29256. activeSortable = Sortable.active,
  29257. isOwner = (activeGroup === group),
  29258. isMovingBetweenSortable = false,
  29259. canSort = options.sort;
  29260. if (evt.preventDefault !== void 0) {
  29261. evt.preventDefault();
  29262. !options.dragoverBubble && evt.stopPropagation();
  29263. }
  29264. if (dragEl.animated) {
  29265. return;
  29266. }
  29267. moved = true;
  29268. if (activeSortable && !options.disabled &&
  29269. (isOwner
  29270. ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  29271. : (
  29272. putSortable === this ||
  29273. (
  29274. (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
  29275. group.checkPut(this, activeSortable, dragEl, evt)
  29276. )
  29277. )
  29278. ) &&
  29279. (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  29280. ) {
  29281. // Smart auto-scrolling
  29282. _autoScroll(evt, options, this.el);
  29283. if (_silent) {
  29284. return;
  29285. }
  29286. target = _closest(evt.target, options.draggable, el);
  29287. dragRect = dragEl.getBoundingClientRect();
  29288. if (putSortable !== this) {
  29289. putSortable = this;
  29290. isMovingBetweenSortable = true;
  29291. }
  29292. if (revert) {
  29293. _cloneHide(activeSortable, true);
  29294. parentEl = rootEl; // actualization
  29295. if (cloneEl || nextEl) {
  29296. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  29297. }
  29298. else if (!canSort) {
  29299. rootEl.appendChild(dragEl);
  29300. }
  29301. return;
  29302. }
  29303. if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
  29304. (el === evt.target) && (target = _ghostIsLast(el, evt))
  29305. ) {
  29306. if (target) {
  29307. if (target.animated) {
  29308. return;
  29309. }
  29310. targetRect = target.getBoundingClientRect();
  29311. }
  29312. _cloneHide(activeSortable, isOwner);
  29313. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  29314. if (!dragEl.contains(el)) {
  29315. el.appendChild(dragEl);
  29316. parentEl = el; // actualization
  29317. }
  29318. this._animate(dragRect, dragEl);
  29319. target && this._animate(targetRect, target);
  29320. }
  29321. }
  29322. else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
  29323. if (lastEl !== target) {
  29324. lastEl = target;
  29325. lastCSS = _css(target);
  29326. lastParentCSS = _css(target.parentNode);
  29327. }
  29328. targetRect = target.getBoundingClientRect();
  29329. var width = targetRect.right - targetRect.left,
  29330. height = targetRect.bottom - targetRect.top,
  29331. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
  29332. || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
  29333. isWide = (target.offsetWidth > dragEl.offsetWidth),
  29334. isLong = (target.offsetHeight > dragEl.offsetHeight),
  29335. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  29336. nextSibling = target.nextElementSibling,
  29337. moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
  29338. after = false
  29339. ;
  29340. if (moveVector !== false) {
  29341. _silent = true;
  29342. setTimeout(_unsilent, 30);
  29343. _cloneHide(activeSortable, isOwner);
  29344. if (moveVector === 1 || moveVector === -1) {
  29345. after = (moveVector === 1);
  29346. }
  29347. else if (floating) {
  29348. var elTop = dragEl.offsetTop,
  29349. tgTop = target.offsetTop;
  29350. if (elTop === tgTop) {
  29351. after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
  29352. }
  29353. else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  29354. after = (evt.clientY - targetRect.top) / height > 0.5;
  29355. } else {
  29356. after = tgTop > elTop;
  29357. }
  29358. } else if (!isMovingBetweenSortable) {
  29359. after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
  29360. }
  29361. if (!dragEl.contains(el)) {
  29362. if (after && !nextSibling) {
  29363. el.appendChild(dragEl);
  29364. } else {
  29365. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  29366. }
  29367. }
  29368. parentEl = dragEl.parentNode; // actualization
  29369. this._animate(dragRect, dragEl);
  29370. this._animate(targetRect, target);
  29371. }
  29372. }
  29373. }
  29374. },
  29375. _animate: function (prevRect, target) {
  29376. var ms = this.options.animation;
  29377. if (ms) {
  29378. var currentRect = target.getBoundingClientRect();
  29379. if (prevRect.nodeType === 1) {
  29380. prevRect = prevRect.getBoundingClientRect();
  29381. }
  29382. _css(target, 'transition', 'none');
  29383. _css(target, 'transform', 'translate3d('
  29384. + (prevRect.left - currentRect.left) + 'px,'
  29385. + (prevRect.top - currentRect.top) + 'px,0)'
  29386. );
  29387. target.offsetWidth; // repaint
  29388. _css(target, 'transition', 'all ' + ms + 'ms');
  29389. _css(target, 'transform', 'translate3d(0,0,0)');
  29390. clearTimeout(target.animated);
  29391. target.animated = setTimeout(function () {
  29392. _css(target, 'transition', '');
  29393. _css(target, 'transform', '');
  29394. target.animated = false;
  29395. }, ms);
  29396. }
  29397. },
  29398. _offUpEvents: function () {
  29399. var ownerDocument = this.el.ownerDocument;
  29400. _off(document, 'touchmove', this._onTouchMove);
  29401. _off(document, 'pointermove', this._onTouchMove);
  29402. _off(ownerDocument, 'mouseup', this._onDrop);
  29403. _off(ownerDocument, 'touchend', this._onDrop);
  29404. _off(ownerDocument, 'pointerup', this._onDrop);
  29405. _off(ownerDocument, 'touchcancel', this._onDrop);
  29406. _off(ownerDocument, 'selectstart', this);
  29407. },
  29408. _onDrop: function (/**Event*/evt) {
  29409. var el = this.el,
  29410. options = this.options;
  29411. clearInterval(this._loopId);
  29412. clearInterval(autoScroll.pid);
  29413. clearTimeout(this._dragStartTimer);
  29414. // Unbind events
  29415. _off(document, 'mousemove', this._onTouchMove);
  29416. if (this.nativeDraggable) {
  29417. _off(document, 'drop', this);
  29418. _off(el, 'dragstart', this._onDragStart);
  29419. }
  29420. this._offUpEvents();
  29421. if (evt) {
  29422. if (moved) {
  29423. evt.preventDefault();
  29424. !options.dropBubble && evt.stopPropagation();
  29425. }
  29426. ghostEl && ghostEl.parentNode.removeChild(ghostEl);
  29427. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  29428. // Remove clone
  29429. cloneEl && cloneEl.parentNode.removeChild(cloneEl);
  29430. }
  29431. if (dragEl) {
  29432. if (this.nativeDraggable) {
  29433. _off(dragEl, 'dragend', this);
  29434. }
  29435. _disableDraggable(dragEl);
  29436. dragEl.style['will-change'] = '';
  29437. // Remove class's
  29438. _toggleClass(dragEl, this.options.ghostClass, false);
  29439. _toggleClass(dragEl, this.options.chosenClass, false);
  29440. if (rootEl !== parentEl) {
  29441. newIndex = _index(dragEl, options.draggable);
  29442. if (newIndex >= 0) {
  29443. // Add event
  29444. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  29445. // Remove event
  29446. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  29447. // drag from one list and drop into another
  29448. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  29449. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  29450. }
  29451. }
  29452. else {
  29453. if (dragEl.nextSibling !== nextEl) {
  29454. // Get the index of the dragged element within its parent
  29455. newIndex = _index(dragEl, options.draggable);
  29456. if (newIndex >= 0) {
  29457. // drag & drop within the same list
  29458. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  29459. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  29460. }
  29461. }
  29462. }
  29463. if (Sortable.active) {
  29464. /* jshint eqnull:true */
  29465. if (newIndex == null || newIndex === -1) {
  29466. newIndex = oldIndex;
  29467. }
  29468. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  29469. // Save sorting
  29470. this.save();
  29471. }
  29472. }
  29473. }
  29474. this._nulling();
  29475. },
  29476. _nulling: function() {
  29477. rootEl =
  29478. dragEl =
  29479. parentEl =
  29480. ghostEl =
  29481. nextEl =
  29482. cloneEl =
  29483. lastDownEl =
  29484. scrollEl =
  29485. scrollParentEl =
  29486. tapEvt =
  29487. touchEvt =
  29488. moved =
  29489. newIndex =
  29490. lastEl =
  29491. lastCSS =
  29492. putSortable =
  29493. activeGroup =
  29494. Sortable.active = null;
  29495. savedInputChecked.forEach(function (el) {
  29496. el.checked = true;
  29497. });
  29498. savedInputChecked.length = 0;
  29499. },
  29500. handleEvent: function (/**Event*/evt) {
  29501. switch (evt.type) {
  29502. case 'drop':
  29503. case 'dragend':
  29504. this._onDrop(evt);
  29505. break;
  29506. case 'dragover':
  29507. case 'dragenter':
  29508. if (dragEl) {
  29509. this._onDragOver(evt);
  29510. _globalDragOver(evt);
  29511. }
  29512. break;
  29513. case 'selectstart':
  29514. evt.preventDefault();
  29515. break;
  29516. }
  29517. },
  29518. /**
  29519. * Serializes the item into an array of string.
  29520. * @returns {String[]}
  29521. */
  29522. toArray: function () {
  29523. var order = [],
  29524. el,
  29525. children = this.el.children,
  29526. i = 0,
  29527. n = children.length,
  29528. options = this.options;
  29529. for (; i < n; i++) {
  29530. el = children[i];
  29531. if (_closest(el, options.draggable, this.el)) {
  29532. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  29533. }
  29534. }
  29535. return order;
  29536. },
  29537. /**
  29538. * Sorts the elements according to the array.
  29539. * @param {String[]} order order of the items
  29540. */
  29541. sort: function (order) {
  29542. var items = {}, rootEl = this.el;
  29543. this.toArray().forEach(function (id, i) {
  29544. var el = rootEl.children[i];
  29545. if (_closest(el, this.options.draggable, rootEl)) {
  29546. items[id] = el;
  29547. }
  29548. }, this);
  29549. order.forEach(function (id) {
  29550. if (items[id]) {
  29551. rootEl.removeChild(items[id]);
  29552. rootEl.appendChild(items[id]);
  29553. }
  29554. });
  29555. },
  29556. /**
  29557. * Save the current sorting
  29558. */
  29559. save: function () {
  29560. var store = this.options.store;
  29561. store && store.set(this);
  29562. },
  29563. /**
  29564. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  29565. * @param {HTMLElement} el
  29566. * @param {String} [selector] default: `options.draggable`
  29567. * @returns {HTMLElement|null}
  29568. */
  29569. closest: function (el, selector) {
  29570. return _closest(el, selector || this.options.draggable, this.el);
  29571. },
  29572. /**
  29573. * Set/get option
  29574. * @param {string} name
  29575. * @param {*} [value]
  29576. * @returns {*}
  29577. */
  29578. option: function (name, value) {
  29579. var options = this.options;
  29580. if (value === void 0) {
  29581. return options[name];
  29582. } else {
  29583. options[name] = value;
  29584. if (name === 'group') {
  29585. _prepareGroup(options);
  29586. }
  29587. }
  29588. },
  29589. /**
  29590. * Destroy
  29591. */
  29592. destroy: function () {
  29593. var el = this.el;
  29594. el[expando] = null;
  29595. _off(el, 'mousedown', this._onTapStart);
  29596. _off(el, 'touchstart', this._onTapStart);
  29597. _off(el, 'pointerdown', this._onTapStart);
  29598. if (this.nativeDraggable) {
  29599. _off(el, 'dragover', this);
  29600. _off(el, 'dragenter', this);
  29601. }
  29602. // Remove draggable attributes
  29603. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  29604. el.removeAttribute('draggable');
  29605. });
  29606. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  29607. this._onDrop();
  29608. this.el = el = null;
  29609. }
  29610. };
  29611. function _cloneHide(sortable, state) {
  29612. if (sortable.lastPullMode !== 'clone') {
  29613. state = true;
  29614. }
  29615. if (cloneEl && (cloneEl.state !== state)) {
  29616. _css(cloneEl, 'display', state ? 'none' : '');
  29617. if (!state) {
  29618. if (cloneEl.state) {
  29619. if (sortable.options.group.revertClone) {
  29620. rootEl.insertBefore(cloneEl, nextEl);
  29621. sortable._animate(dragEl, cloneEl);
  29622. } else {
  29623. rootEl.insertBefore(cloneEl, dragEl);
  29624. }
  29625. }
  29626. }
  29627. cloneEl.state = state;
  29628. }
  29629. }
  29630. function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  29631. if (el) {
  29632. ctx = ctx || document;
  29633. do {
  29634. if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
  29635. return el;
  29636. }
  29637. /* jshint boss:true */
  29638. } while (el = _getParentOrHost(el));
  29639. }
  29640. return null;
  29641. }
  29642. function _getParentOrHost(el) {
  29643. var parent = el.host;
  29644. return (parent && parent.nodeType) ? parent : el.parentNode;
  29645. }
  29646. function _globalDragOver(/**Event*/evt) {
  29647. if (evt.dataTransfer) {
  29648. evt.dataTransfer.dropEffect = 'move';
  29649. }
  29650. evt.preventDefault();
  29651. }
  29652. function _on(el, event, fn) {
  29653. el.addEventListener(event, fn, captureMode);
  29654. }
  29655. function _off(el, event, fn) {
  29656. el.removeEventListener(event, fn, captureMode);
  29657. }
  29658. function _toggleClass(el, name, state) {
  29659. if (el) {
  29660. if (el.classList) {
  29661. el.classList[state ? 'add' : 'remove'](name);
  29662. }
  29663. else {
  29664. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  29665. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  29666. }
  29667. }
  29668. }
  29669. function _css(el, prop, val) {
  29670. var style = el && el.style;
  29671. if (style) {
  29672. if (val === void 0) {
  29673. if (document.defaultView && document.defaultView.getComputedStyle) {
  29674. val = document.defaultView.getComputedStyle(el, '');
  29675. }
  29676. else if (el.currentStyle) {
  29677. val = el.currentStyle;
  29678. }
  29679. return prop === void 0 ? val : val[prop];
  29680. }
  29681. else {
  29682. if (!(prop in style)) {
  29683. prop = '-webkit-' + prop;
  29684. }
  29685. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  29686. }
  29687. }
  29688. }
  29689. function _find(ctx, tagName, iterator) {
  29690. if (ctx) {
  29691. var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
  29692. if (iterator) {
  29693. for (; i < n; i++) {
  29694. iterator(list[i], i);
  29695. }
  29696. }
  29697. return list;
  29698. }
  29699. return [];
  29700. }
  29701. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  29702. sortable = (sortable || rootEl[expando]);
  29703. var evt = document.createEvent('Event'),
  29704. options = sortable.options,
  29705. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  29706. evt.initEvent(name, true, true);
  29707. evt.to = rootEl;
  29708. evt.from = fromEl || rootEl;
  29709. evt.item = targetEl || rootEl;
  29710. evt.clone = cloneEl;
  29711. evt.oldIndex = startIndex;
  29712. evt.newIndex = newIndex;
  29713. rootEl.dispatchEvent(evt);
  29714. if (options[onName]) {
  29715. options[onName].call(sortable, evt);
  29716. }
  29717. }
  29718. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) {
  29719. var evt,
  29720. sortable = fromEl[expando],
  29721. onMoveFn = sortable.options.onMove,
  29722. retVal;
  29723. evt = document.createEvent('Event');
  29724. evt.initEvent('move', true, true);
  29725. evt.to = toEl;
  29726. evt.from = fromEl;
  29727. evt.dragged = dragEl;
  29728. evt.draggedRect = dragRect;
  29729. evt.related = targetEl || toEl;
  29730. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  29731. fromEl.dispatchEvent(evt);
  29732. if (onMoveFn) {
  29733. retVal = onMoveFn.call(sortable, evt, originalEvt);
  29734. }
  29735. return retVal;
  29736. }
  29737. function _disableDraggable(el) {
  29738. el.draggable = false;
  29739. }
  29740. function _unsilent() {
  29741. _silent = false;
  29742. }
  29743. /** @returns {HTMLElement|false} */
  29744. function _ghostIsLast(el, evt) {
  29745. var lastEl = el.lastElementChild,
  29746. rect = lastEl.getBoundingClientRect();
  29747. // 5 — min delta
  29748. // abs — нельзя добавлять, а то глюки при наведении сверху
  29749. return (
  29750. (evt.clientY - (rect.top + rect.height) > 5) ||
  29751. (evt.clientX - (rect.right + rect.width) > 5)
  29752. ) && lastEl;
  29753. }
  29754. /**
  29755. * Generate id
  29756. * @param {HTMLElement} el
  29757. * @returns {String}
  29758. * @private
  29759. */
  29760. function _generateId(el) {
  29761. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  29762. i = str.length,
  29763. sum = 0;
  29764. while (i--) {
  29765. sum += str.charCodeAt(i);
  29766. }
  29767. return sum.toString(36);
  29768. }
  29769. /**
  29770. * Returns the index of an element within its parent for a selected set of
  29771. * elements
  29772. * @param {HTMLElement} el
  29773. * @param {selector} selector
  29774. * @return {number}
  29775. */
  29776. function _index(el, selector) {
  29777. var index = 0;
  29778. if (!el || !el.parentNode) {
  29779. return -1;
  29780. }
  29781. while (el && (el = el.previousElementSibling)) {
  29782. if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
  29783. index++;
  29784. }
  29785. }
  29786. return index;
  29787. }
  29788. function _matches(/**HTMLElement*/el, /**String*/selector) {
  29789. if (el) {
  29790. selector = selector.split('.');
  29791. var tag = selector.shift().toUpperCase(),
  29792. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  29793. return (
  29794. (tag === '' || el.nodeName.toUpperCase() == tag) &&
  29795. (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
  29796. );
  29797. }
  29798. return false;
  29799. }
  29800. function _throttle(callback, ms) {
  29801. var args, _this;
  29802. return function () {
  29803. if (args === void 0) {
  29804. args = arguments;
  29805. _this = this;
  29806. setTimeout(function () {
  29807. if (args.length === 1) {
  29808. callback.call(_this, args[0]);
  29809. } else {
  29810. callback.apply(_this, args);
  29811. }
  29812. args = void 0;
  29813. }, ms);
  29814. }
  29815. };
  29816. }
  29817. function _extend(dst, src) {
  29818. if (dst && src) {
  29819. for (var key in src) {
  29820. if (src.hasOwnProperty(key)) {
  29821. dst[key] = src[key];
  29822. }
  29823. }
  29824. }
  29825. return dst;
  29826. }
  29827. function _clone(el) {
  29828. return $
  29829. ? $(el).clone(true)[0]
  29830. : (Polymer && Polymer.dom
  29831. ? Polymer.dom(el).cloneNode(true)
  29832. : el.cloneNode(true)
  29833. );
  29834. }
  29835. function _saveInputCheckedState(root) {
  29836. var inputs = root.getElementsByTagName('input');
  29837. var idx = inputs.length;
  29838. while (idx--) {
  29839. var el = inputs[idx];
  29840. el.checked && savedInputChecked.push(el);
  29841. }
  29842. }
  29843. // Fixed #973:
  29844. _on(document, 'touchmove', function (evt) {
  29845. if (Sortable.active) {
  29846. evt.preventDefault();
  29847. }
  29848. });
  29849. try {
  29850. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  29851. get: function () {
  29852. captureMode = {
  29853. capture: false,
  29854. passive: false
  29855. };
  29856. }
  29857. }));
  29858. } catch (err) {}
  29859. // Export utils
  29860. Sortable.utils = {
  29861. on: _on,
  29862. off: _off,
  29863. css: _css,
  29864. find: _find,
  29865. is: function (el, selector) {
  29866. return !!_closest(el, selector, el);
  29867. },
  29868. extend: _extend,
  29869. throttle: _throttle,
  29870. closest: _closest,
  29871. toggleClass: _toggleClass,
  29872. clone: _clone,
  29873. index: _index
  29874. };
  29875. /**
  29876. * Create sortable instance
  29877. * @param {HTMLElement} el
  29878. * @param {Object} [options]
  29879. */
  29880. Sortable.create = function (el, options) {
  29881. return new Sortable(el, options);
  29882. };
  29883. // Export
  29884. Sortable.version = '1.5.1';
  29885. return Sortable;
  29886. });
  29887. /***/ }),
  29888. /* 217 */
  29889. /***/ (function(module, exports, __webpack_require__) {
  29890. "use strict";
  29891. /**
  29892. * @author oldj
  29893. * @blog https://oldj.net
  29894. */
  29895. /**
  29896. * 将一个 node list 转为数组
  29897. * @param list {NodeList}
  29898. * 参见:http://www.planabc.net/2010/01/06/arguments_to_array/
  29899. */
  29900. module.exports = (list) => {
  29901. let arr
  29902. let length
  29903. try {
  29904. // works in every browser except IE
  29905. arr = [].slice.call(list);
  29906. return arr;
  29907. } catch(err) {
  29908. // slower, but works in IE
  29909. arr = [];
  29910. length = list.length;
  29911. for (let i = 0; i < length; i++) {
  29912. arr.push(list[i]);
  29913. }
  29914. return arr;
  29915. }
  29916. }
  29917. /***/ }),
  29918. /* 218 */
  29919. /***/ (function(module, exports, __webpack_require__) {
  29920. "use strict";
  29921. /**
  29922. * @author oldj
  29923. * @blog https://oldj.net
  29924. */
  29925. module.exports = function () {
  29926. return new Date().getTime() + '-' + Math.floor(Math.random() * 1e6);
  29927. };
  29928. /***/ }),
  29929. /* 219 */
  29930. /***/ (function(module, exports, __webpack_require__) {
  29931. "use strict";
  29932. /**
  29933. * @author oldj
  29934. * @blog https://oldj.net
  29935. */
  29936. var _Agent = __webpack_require__(14);
  29937. var _Agent2 = _interopRequireDefault(_Agent);
  29938. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  29939. var req = __webpack_require__(225);
  29940. exports.reg = function (app) {
  29941. req.keys().map(function (fn) {
  29942. var m = fn.match(/^\.\/([\w\-]+)\.js$/);
  29943. var name = m ? m[1] : null;
  29944. if (!name || name === 'index') return;
  29945. _Agent2.default.on(name, function () {
  29946. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  29947. args[_key] = arguments[_key];
  29948. }
  29949. var fn = __webpack_require__(221)("./" + name);
  29950. fn.apply(undefined, [app].concat(args));
  29951. });
  29952. });
  29953. };
  29954. /***/ }),
  29955. /* 220 */
  29956. /***/ (function(module, exports, __webpack_require__) {
  29957. "use strict";
  29958. /**
  29959. * @author oldj
  29960. * @blog https://oldj.net
  29961. */
  29962. var _Agent = __webpack_require__(14);
  29963. var _Agent2 = _interopRequireDefault(_Agent);
  29964. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  29965. module.exports = function (app, hosts, on) {
  29966. _Agent2.default.pact('toggleHosts', hosts.id, on).then(function () {
  29967. hosts.on = on;
  29968. app.setState({
  29969. list: app.state.list
  29970. });
  29971. }).catch(function (e) {
  29972. console.log(e);
  29973. });
  29974. };
  29975. /***/ }),
  29976. /* 221 */
  29977. /***/ (function(module, exports, __webpack_require__) {
  29978. var map = {
  29979. "./del_hosts": 227,
  29980. "./del_hosts.js": 227,
  29981. "./index": 219,
  29982. "./index.js": 219,
  29983. "./save": 222,
  29984. "./save.js": 222,
  29985. "./toggle_hosts": 220,
  29986. "./toggle_hosts.js": 220,
  29987. "./update_hosts": 228,
  29988. "./update_hosts.js": 228
  29989. };
  29990. function webpackContext(req) {
  29991. return __webpack_require__(webpackContextResolve(req));
  29992. };
  29993. function webpackContextResolve(req) {
  29994. var id = map[req];
  29995. if(!(id + 1)) // check for number or string
  29996. throw new Error("Cannot find module '" + req + "'.");
  29997. return id;
  29998. };
  29999. webpackContext.keys = function webpackContextKeys() {
  30000. return Object.keys(map);
  30001. };
  30002. webpackContext.resolve = webpackContextResolve;
  30003. module.exports = webpackContext;
  30004. webpackContext.id = 221;
  30005. /***/ }),
  30006. /* 222 */
  30007. /***/ (function(module, exports, __webpack_require__) {
  30008. "use strict";
  30009. /**
  30010. * @author oldj
  30011. * @blog https://oldj.net
  30012. */
  30013. var _Agent = __webpack_require__(14);
  30014. var _Agent2 = _interopRequireDefault(_Agent);
  30015. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  30016. module.exports = function (app, list) {
  30017. _Agent2.default.pact('saveHosts', list);
  30018. };
  30019. /***/ }),
  30020. /* 223 */,
  30021. /* 224 */,
  30022. /* 225 */
  30023. /***/ (function(module, exports, __webpack_require__) {
  30024. var map = {
  30025. "./del_hosts.js": 227,
  30026. "./index.js": 219,
  30027. "./save.js": 222,
  30028. "./toggle_hosts.js": 220,
  30029. "./update_hosts.js": 228
  30030. };
  30031. function webpackContext(req) {
  30032. return __webpack_require__(webpackContextResolve(req));
  30033. };
  30034. function webpackContextResolve(req) {
  30035. var id = map[req];
  30036. if(!(id + 1)) // check for number or string
  30037. throw new Error("Cannot find module '" + req + "'.");
  30038. return id;
  30039. };
  30040. webpackContext.keys = function webpackContextKeys() {
  30041. return Object.keys(map);
  30042. };
  30043. webpackContext.resolve = webpackContextResolve;
  30044. module.exports = webpackContext;
  30045. webpackContext.id = 225;
  30046. /***/ }),
  30047. /* 226 */,
  30048. /* 227 */
  30049. /***/ (function(module, exports, __webpack_require__) {
  30050. "use strict";
  30051. /**
  30052. * @author oldj
  30053. * @blog https://oldj.net
  30054. */
  30055. var _Agent = __webpack_require__(14);
  30056. var _Agent2 = _interopRequireDefault(_Agent);
  30057. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  30058. module.exports = function (app, hosts) {
  30059. var list = app.state.list;
  30060. var idx = list.findIndex(function (item) {
  30061. return item.id === hosts.id;
  30062. });
  30063. if (idx === -1) {
  30064. return;
  30065. }
  30066. list.splice(idx, 1);
  30067. _Agent2.default.pact('saveHosts', list).then(function () {
  30068. app.setState({ list: list }, function () {
  30069. // 选中下一个 hosts
  30070. var id = (list[idx] || list[idx - 1] || {}).id;
  30071. if (id) {
  30072. _Agent2.default.emit('select', id);
  30073. }
  30074. });
  30075. });
  30076. };
  30077. /***/ }),
  30078. /* 228 */
  30079. /***/ (function(module, exports, __webpack_require__) {
  30080. "use strict";
  30081. /**
  30082. * @author oldj
  30083. * @blog https://oldj.net
  30084. */
  30085. var _Agent = __webpack_require__(14);
  30086. var _Agent2 = _interopRequireDefault(_Agent);
  30087. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  30088. module.exports = function (app, hosts) {
  30089. var list = app.state.list;
  30090. var inner = list.find(function (item) {
  30091. return item.id === hosts.id;
  30092. });
  30093. if (!inner) {
  30094. list.push(Object.assign({}, hosts));
  30095. } else {
  30096. Object.assign(inner, hosts);
  30097. }
  30098. _Agent2.default.pact('saveHosts', list).then(function () {
  30099. app.setState({ list: list }, function () {
  30100. _Agent2.default.emit('select', hosts.id);
  30101. });
  30102. });
  30103. };
  30104. /***/ })
  30105. /******/ ]);
  30106. //# sourceMappingURL=bundle.js.map