bundle.js 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085
  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 = 115);
  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__(10);
  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) {
  292. /**
  293. * @author oldj
  294. * @blog https://oldj.net
  295. */
  296. 'use strict';
  297. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  298. var IS_DEV = process.env.ENV === 'dev';
  299. var _require = require('electron'),
  300. ipcRenderer = _require.ipcRenderer;
  301. var platform = process.platform;
  302. var EventEmitter = require('events');
  303. var evt = new EventEmitter();
  304. var max_listener_count = 20;
  305. evt.setMaxListeners(max_listener_count);
  306. ipcRenderer.setMaxListeners(max_listener_count);
  307. var x_get_idx = 0;
  308. /**
  309. * act
  310. * @param action {String}
  311. * @param args {Array}
  312. */
  313. function act(action) {
  314. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  315. args[_key - 1] = arguments[_key];
  316. }
  317. var fn = ['_cb', new Date().getTime(), x_get_idx++].join('_');
  318. var callback = void 0;
  319. if (args.length > 0 && typeof args[args.length - 1] === 'function') {
  320. callback = args.pop();
  321. }
  322. if (typeof callback === 'function') {
  323. ipcRenderer.once(fn, function (e, d) {
  324. return callback.apply(null, d);
  325. });
  326. }
  327. ipcRenderer.send('x', {
  328. action: action,
  329. data: args,
  330. callback: fn
  331. });
  332. }
  333. function pact(action) {
  334. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  335. args[_key2 - 1] = arguments[_key2];
  336. }
  337. return new Promise(function (resolve, reject) {
  338. args.push(function (err, result) {
  339. return err ? reject(err) : resolve(result);
  340. });
  341. act.apply(undefined, [action].concat(args));
  342. });
  343. }
  344. ipcRenderer.on('y', function (sender, d) {
  345. evt.emit.apply(evt, [d.event].concat(_toConsumableArray(d.data || [])));
  346. });
  347. module.exports = {
  348. IS_DEV: IS_DEV,
  349. platform: platform,
  350. act: act,
  351. pact: pact,
  352. on: function on() {
  353. return evt.on.apply(evt, arguments);
  354. },
  355. emit: function emit() {
  356. return evt.emit.apply(evt, arguments);
  357. }
  358. };
  359. /***/ }),
  360. /* 5 */
  361. /***/ (function(module, exports, __webpack_require__) {
  362. "use strict";
  363. /**
  364. * Copyright 2013-present, Facebook, Inc.
  365. * All rights reserved.
  366. *
  367. * This source code is licensed under the BSD-style license found in the
  368. * LICENSE file in the root directory of this source tree. An additional grant
  369. * of patent rights can be found in the PATENTS file in the same directory.
  370. *
  371. */
  372. var _prodInvariant = __webpack_require__(2);
  373. var DOMProperty = __webpack_require__(19);
  374. var ReactDOMComponentFlags = __webpack_require__(78);
  375. var invariant = __webpack_require__(0);
  376. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  377. var Flags = ReactDOMComponentFlags;
  378. var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
  379. /**
  380. * Check if a given node should be cached.
  381. */
  382. function shouldPrecacheNode(node, nodeID) {
  383. 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 + ' ';
  384. }
  385. /**
  386. * Drill down (through composites and empty components) until we get a host or
  387. * host text component.
  388. *
  389. * This is pretty polymorphic but unavoidable with the current structure we have
  390. * for `_renderedChildren`.
  391. */
  392. function getRenderedHostOrTextFromComponent(component) {
  393. var rendered;
  394. while (rendered = component._renderedComponent) {
  395. component = rendered;
  396. }
  397. return component;
  398. }
  399. /**
  400. * Populate `_hostNode` on the rendered host/text component with the given
  401. * DOM node. The passed `inst` can be a composite.
  402. */
  403. function precacheNode(inst, node) {
  404. var hostInst = getRenderedHostOrTextFromComponent(inst);
  405. hostInst._hostNode = node;
  406. node[internalInstanceKey] = hostInst;
  407. }
  408. function uncacheNode(inst) {
  409. var node = inst._hostNode;
  410. if (node) {
  411. delete node[internalInstanceKey];
  412. inst._hostNode = null;
  413. }
  414. }
  415. /**
  416. * Populate `_hostNode` on each child of `inst`, assuming that the children
  417. * match up with the DOM (element) children of `node`.
  418. *
  419. * We cache entire levels at once to avoid an n^2 problem where we access the
  420. * children of a node sequentially and have to walk from the start to our target
  421. * node every time.
  422. *
  423. * Since we update `_renderedChildren` and the actual DOM at (slightly)
  424. * different times, we could race here and see a newer `_renderedChildren` than
  425. * the DOM nodes we see. To avoid this, ReactMultiChild calls
  426. * `prepareToManageChildren` before we change `_renderedChildren`, at which
  427. * time the container's child nodes are always cached (until it unmounts).
  428. */
  429. function precacheChildNodes(inst, node) {
  430. if (inst._flags & Flags.hasCachedChildNodes) {
  431. return;
  432. }
  433. var children = inst._renderedChildren;
  434. var childNode = node.firstChild;
  435. outer: for (var name in children) {
  436. if (!children.hasOwnProperty(name)) {
  437. continue;
  438. }
  439. var childInst = children[name];
  440. var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
  441. if (childID === 0) {
  442. // We're currently unmounting this child in ReactMultiChild; skip it.
  443. continue;
  444. }
  445. // We assume the child nodes are in the same order as the child instances.
  446. for (; childNode !== null; childNode = childNode.nextSibling) {
  447. if (shouldPrecacheNode(childNode, childID)) {
  448. precacheNode(childInst, childNode);
  449. continue outer;
  450. }
  451. }
  452. // We reached the end of the DOM children without finding an ID match.
  453. true ? false ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
  454. }
  455. inst._flags |= Flags.hasCachedChildNodes;
  456. }
  457. /**
  458. * Given a DOM node, return the closest ReactDOMComponent or
  459. * ReactDOMTextComponent instance ancestor.
  460. */
  461. function getClosestInstanceFromNode(node) {
  462. if (node[internalInstanceKey]) {
  463. return node[internalInstanceKey];
  464. }
  465. // Walk up the tree until we find an ancestor whose instance we have cached.
  466. var parents = [];
  467. while (!node[internalInstanceKey]) {
  468. parents.push(node);
  469. if (node.parentNode) {
  470. node = node.parentNode;
  471. } else {
  472. // Top of the tree. This node must not be part of a React tree (or is
  473. // unmounted, potentially).
  474. return null;
  475. }
  476. }
  477. var closest;
  478. var inst;
  479. for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
  480. closest = inst;
  481. if (parents.length) {
  482. precacheChildNodes(inst, node);
  483. }
  484. }
  485. return closest;
  486. }
  487. /**
  488. * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
  489. * instance, or null if the node was not rendered by this React.
  490. */
  491. function getInstanceFromNode(node) {
  492. var inst = getClosestInstanceFromNode(node);
  493. if (inst != null && inst._hostNode === node) {
  494. return inst;
  495. } else {
  496. return null;
  497. }
  498. }
  499. /**
  500. * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
  501. * DOM node.
  502. */
  503. function getNodeFromInstance(inst) {
  504. // Without this first invariant, passing a non-DOM-component triggers the next
  505. // invariant for a missing parent, which is super confusing.
  506. !(inst._hostNode !== undefined) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  507. if (inst._hostNode) {
  508. return inst._hostNode;
  509. }
  510. // Walk up the tree until we find an ancestor whose DOM node we have cached.
  511. var parents = [];
  512. while (!inst._hostNode) {
  513. parents.push(inst);
  514. !inst._hostParent ? false ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
  515. inst = inst._hostParent;
  516. }
  517. // Now parents contains each ancestor that does *not* have a cached native
  518. // node, and `inst` is the deepest ancestor that does.
  519. for (; parents.length; inst = parents.pop()) {
  520. precacheChildNodes(inst, inst._hostNode);
  521. }
  522. return inst._hostNode;
  523. }
  524. var ReactDOMComponentTree = {
  525. getClosestInstanceFromNode: getClosestInstanceFromNode,
  526. getInstanceFromNode: getInstanceFromNode,
  527. getNodeFromInstance: getNodeFromInstance,
  528. precacheChildNodes: precacheChildNodes,
  529. precacheNode: precacheNode,
  530. uncacheNode: uncacheNode
  531. };
  532. module.exports = ReactDOMComponentTree;
  533. /***/ }),
  534. /* 6 */
  535. /***/ (function(module, exports) {
  536. /*
  537. MIT License http://www.opensource.org/licenses/mit-license.php
  538. Author Tobias Koppers @sokra
  539. */
  540. // css base code, injected by the css-loader
  541. module.exports = function() {
  542. var list = [];
  543. // return the list of modules as css string
  544. list.toString = function toString() {
  545. var result = [];
  546. for(var i = 0; i < this.length; i++) {
  547. var item = this[i];
  548. if(item[2]) {
  549. result.push("@media " + item[2] + "{" + item[1] + "}");
  550. } else {
  551. result.push(item[1]);
  552. }
  553. }
  554. return result.join("");
  555. };
  556. // import a list of modules into the list
  557. list.i = function(modules, mediaQuery) {
  558. if(typeof modules === "string")
  559. modules = [[null, modules, ""]];
  560. var alreadyImportedModules = {};
  561. for(var i = 0; i < this.length; i++) {
  562. var id = this[i][0];
  563. if(typeof id === "number")
  564. alreadyImportedModules[id] = true;
  565. }
  566. for(i = 0; i < modules.length; i++) {
  567. var item = modules[i];
  568. // skip already imported module
  569. // this implementation is not 100% perfect for weird media query combinations
  570. // when a module is imported multiple times with different media queries.
  571. // I hope this will never occur (Hey this way we have smaller bundles)
  572. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  573. if(mediaQuery && !item[2]) {
  574. item[2] = mediaQuery;
  575. } else if(mediaQuery) {
  576. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  577. }
  578. list.push(item);
  579. }
  580. }
  581. };
  582. return list;
  583. };
  584. /***/ }),
  585. /* 7 */
  586. /***/ (function(module, exports, __webpack_require__) {
  587. "use strict";
  588. module.exports = __webpack_require__(21);
  589. /***/ }),
  590. /* 8 */
  591. /***/ (function(module, exports, __webpack_require__) {
  592. "use strict";
  593. /**
  594. * Copyright (c) 2013-present, Facebook, Inc.
  595. * All rights reserved.
  596. *
  597. * This source code is licensed under the BSD-style license found in the
  598. * LICENSE file in the root directory of this source tree. An additional grant
  599. * of patent rights can be found in the PATENTS file in the same directory.
  600. *
  601. */
  602. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  603. /**
  604. * Simple, lightweight module assisting with the detection and context of
  605. * Worker. Helps avoid circular dependencies and allows code to reason about
  606. * whether or not they are in a Worker, even if they never include the main
  607. * `ReactWorker` dependency.
  608. */
  609. var ExecutionEnvironment = {
  610. canUseDOM: canUseDOM,
  611. canUseWorkers: typeof Worker !== 'undefined',
  612. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  613. canUseViewport: canUseDOM && !!window.screen,
  614. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  615. };
  616. module.exports = ExecutionEnvironment;
  617. /***/ }),
  618. /* 9 */
  619. /***/ (function(module, exports, __webpack_require__) {
  620. /*
  621. MIT License http://www.opensource.org/licenses/mit-license.php
  622. Author Tobias Koppers @sokra
  623. */
  624. var stylesInDom = {},
  625. memoize = function(fn) {
  626. var memo;
  627. return function () {
  628. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  629. return memo;
  630. };
  631. },
  632. isOldIE = memoize(function() {
  633. // Test for IE <= 9 as proposed by Browserhacks
  634. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  635. // Tests for existence of standard globals is to allow style-loader
  636. // to operate correctly into non-standard environments
  637. // @see https://github.com/webpack-contrib/style-loader/issues/177
  638. return window && document && document.all && !window.atob;
  639. }),
  640. getElement = (function(fn) {
  641. var memo = {};
  642. return function(selector) {
  643. if (typeof memo[selector] === "undefined") {
  644. memo[selector] = fn.call(this, selector);
  645. }
  646. return memo[selector]
  647. };
  648. })(function (styleTarget) {
  649. return document.querySelector(styleTarget)
  650. }),
  651. singletonElement = null,
  652. singletonCounter = 0,
  653. styleElementsInsertedAtTop = [],
  654. fixUrls = __webpack_require__(224);
  655. module.exports = function(list, options) {
  656. if(typeof DEBUG !== "undefined" && DEBUG) {
  657. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  658. }
  659. options = options || {};
  660. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  661. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  662. // tags it will allow on a page
  663. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  664. // By default, add <style> tags to the <head> element
  665. if (typeof options.insertInto === "undefined") options.insertInto = "head";
  666. // By default, add <style> tags to the bottom of the target
  667. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  668. var styles = listToStyles(list);
  669. addStylesToDom(styles, options);
  670. return function update(newList) {
  671. var mayRemove = [];
  672. for(var i = 0; i < styles.length; i++) {
  673. var item = styles[i];
  674. var domStyle = stylesInDom[item.id];
  675. domStyle.refs--;
  676. mayRemove.push(domStyle);
  677. }
  678. if(newList) {
  679. var newStyles = listToStyles(newList);
  680. addStylesToDom(newStyles, options);
  681. }
  682. for(var i = 0; i < mayRemove.length; i++) {
  683. var domStyle = mayRemove[i];
  684. if(domStyle.refs === 0) {
  685. for(var j = 0; j < domStyle.parts.length; j++)
  686. domStyle.parts[j]();
  687. delete stylesInDom[domStyle.id];
  688. }
  689. }
  690. };
  691. };
  692. function addStylesToDom(styles, options) {
  693. for(var i = 0; i < styles.length; i++) {
  694. var item = styles[i];
  695. var domStyle = stylesInDom[item.id];
  696. if(domStyle) {
  697. domStyle.refs++;
  698. for(var j = 0; j < domStyle.parts.length; j++) {
  699. domStyle.parts[j](item.parts[j]);
  700. }
  701. for(; j < item.parts.length; j++) {
  702. domStyle.parts.push(addStyle(item.parts[j], options));
  703. }
  704. } else {
  705. var parts = [];
  706. for(var j = 0; j < item.parts.length; j++) {
  707. parts.push(addStyle(item.parts[j], options));
  708. }
  709. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  710. }
  711. }
  712. }
  713. function listToStyles(list) {
  714. var styles = [];
  715. var newStyles = {};
  716. for(var i = 0; i < list.length; i++) {
  717. var item = list[i];
  718. var id = item[0];
  719. var css = item[1];
  720. var media = item[2];
  721. var sourceMap = item[3];
  722. var part = {css: css, media: media, sourceMap: sourceMap};
  723. if(!newStyles[id])
  724. styles.push(newStyles[id] = {id: id, parts: [part]});
  725. else
  726. newStyles[id].parts.push(part);
  727. }
  728. return styles;
  729. }
  730. function insertStyleElement(options, styleElement) {
  731. var styleTarget = getElement(options.insertInto)
  732. if (!styleTarget) {
  733. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  734. }
  735. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  736. if (options.insertAt === "top") {
  737. if(!lastStyleElementInsertedAtTop) {
  738. styleTarget.insertBefore(styleElement, styleTarget.firstChild);
  739. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  740. styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  741. } else {
  742. styleTarget.appendChild(styleElement);
  743. }
  744. styleElementsInsertedAtTop.push(styleElement);
  745. } else if (options.insertAt === "bottom") {
  746. styleTarget.appendChild(styleElement);
  747. } else {
  748. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  749. }
  750. }
  751. function removeStyleElement(styleElement) {
  752. styleElement.parentNode.removeChild(styleElement);
  753. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  754. if(idx >= 0) {
  755. styleElementsInsertedAtTop.splice(idx, 1);
  756. }
  757. }
  758. function createStyleElement(options) {
  759. var styleElement = document.createElement("style");
  760. options.attrs.type = "text/css";
  761. attachTagAttrs(styleElement, options.attrs);
  762. insertStyleElement(options, styleElement);
  763. return styleElement;
  764. }
  765. function createLinkElement(options) {
  766. var linkElement = document.createElement("link");
  767. options.attrs.type = "text/css";
  768. options.attrs.rel = "stylesheet";
  769. attachTagAttrs(linkElement, options.attrs);
  770. insertStyleElement(options, linkElement);
  771. return linkElement;
  772. }
  773. function attachTagAttrs(element, attrs) {
  774. Object.keys(attrs).forEach(function (key) {
  775. element.setAttribute(key, attrs[key]);
  776. });
  777. }
  778. function addStyle(obj, options) {
  779. var styleElement, update, remove;
  780. if (options.singleton) {
  781. var styleIndex = singletonCounter++;
  782. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  783. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  784. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  785. } else if(obj.sourceMap &&
  786. typeof URL === "function" &&
  787. typeof URL.createObjectURL === "function" &&
  788. typeof URL.revokeObjectURL === "function" &&
  789. typeof Blob === "function" &&
  790. typeof btoa === "function") {
  791. styleElement = createLinkElement(options);
  792. update = updateLink.bind(null, styleElement, options);
  793. remove = function() {
  794. removeStyleElement(styleElement);
  795. if(styleElement.href)
  796. URL.revokeObjectURL(styleElement.href);
  797. };
  798. } else {
  799. styleElement = createStyleElement(options);
  800. update = applyToTag.bind(null, styleElement);
  801. remove = function() {
  802. removeStyleElement(styleElement);
  803. };
  804. }
  805. update(obj);
  806. return function updateStyle(newObj) {
  807. if(newObj) {
  808. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  809. return;
  810. update(obj = newObj);
  811. } else {
  812. remove();
  813. }
  814. };
  815. }
  816. var replaceText = (function () {
  817. var textStore = [];
  818. return function (index, replacement) {
  819. textStore[index] = replacement;
  820. return textStore.filter(Boolean).join('\n');
  821. };
  822. })();
  823. function applyToSingletonTag(styleElement, index, remove, obj) {
  824. var css = remove ? "" : obj.css;
  825. if (styleElement.styleSheet) {
  826. styleElement.styleSheet.cssText = replaceText(index, css);
  827. } else {
  828. var cssNode = document.createTextNode(css);
  829. var childNodes = styleElement.childNodes;
  830. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  831. if (childNodes.length) {
  832. styleElement.insertBefore(cssNode, childNodes[index]);
  833. } else {
  834. styleElement.appendChild(cssNode);
  835. }
  836. }
  837. }
  838. function applyToTag(styleElement, obj) {
  839. var css = obj.css;
  840. var media = obj.media;
  841. if(media) {
  842. styleElement.setAttribute("media", media)
  843. }
  844. if(styleElement.styleSheet) {
  845. styleElement.styleSheet.cssText = css;
  846. } else {
  847. while(styleElement.firstChild) {
  848. styleElement.removeChild(styleElement.firstChild);
  849. }
  850. styleElement.appendChild(document.createTextNode(css));
  851. }
  852. }
  853. function updateLink(linkElement, options, obj) {
  854. var css = obj.css;
  855. var sourceMap = obj.sourceMap;
  856. /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  857. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  858. on by default. Otherwise default to the convertToAbsoluteUrls option
  859. directly
  860. */
  861. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  862. if (options.convertToAbsoluteUrls || autoFixUrls){
  863. css = fixUrls(css);
  864. }
  865. if(sourceMap) {
  866. // http://stackoverflow.com/a/26603875
  867. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  868. }
  869. var blob = new Blob([css], { type: "text/css" });
  870. var oldSrc = linkElement.href;
  871. linkElement.href = URL.createObjectURL(blob);
  872. if(oldSrc)
  873. URL.revokeObjectURL(oldSrc);
  874. }
  875. /***/ }),
  876. /* 10 */
  877. /***/ (function(module, exports, __webpack_require__) {
  878. "use strict";
  879. /**
  880. * Copyright (c) 2013-present, Facebook, Inc.
  881. * All rights reserved.
  882. *
  883. * This source code is licensed under the BSD-style license found in the
  884. * LICENSE file in the root directory of this source tree. An additional grant
  885. * of patent rights can be found in the PATENTS file in the same directory.
  886. *
  887. *
  888. */
  889. function makeEmptyFunction(arg) {
  890. return function () {
  891. return arg;
  892. };
  893. }
  894. /**
  895. * This function accepts and discards inputs; it has no side effects. This is
  896. * primarily useful idiomatically for overridable function endpoints which
  897. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  898. */
  899. var emptyFunction = function emptyFunction() {};
  900. emptyFunction.thatReturns = makeEmptyFunction;
  901. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  902. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  903. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  904. emptyFunction.thatReturnsThis = function () {
  905. return this;
  906. };
  907. emptyFunction.thatReturnsArgument = function (arg) {
  908. return arg;
  909. };
  910. module.exports = emptyFunction;
  911. /***/ }),
  912. /* 11 */
  913. /***/ (function(module, exports, __webpack_require__) {
  914. "use strict";
  915. /**
  916. * Copyright 2016-present, Facebook, Inc.
  917. * All rights reserved.
  918. *
  919. * This source code is licensed under the BSD-style license found in the
  920. * LICENSE file in the root directory of this source tree. An additional grant
  921. * of patent rights can be found in the PATENTS file in the same directory.
  922. *
  923. *
  924. */
  925. // Trust the developer to only use ReactInstrumentation with a __DEV__ check
  926. var debugTool = null;
  927. if (false) {
  928. var ReactDebugTool = require('./ReactDebugTool');
  929. debugTool = ReactDebugTool;
  930. }
  931. module.exports = { debugTool: debugTool };
  932. /***/ }),
  933. /* 12 */
  934. /***/ (function(module, exports, __webpack_require__) {
  935. "use strict";
  936. /**
  937. * Copyright 2013-present, Facebook, Inc.
  938. * All rights reserved.
  939. *
  940. * This source code is licensed under the BSD-style license found in the
  941. * LICENSE file in the root directory of this source tree. An additional grant
  942. * of patent rights can be found in the PATENTS file in the same directory.
  943. *
  944. */
  945. var _prodInvariant = __webpack_require__(2),
  946. _assign = __webpack_require__(3);
  947. var CallbackQueue = __webpack_require__(76);
  948. var PooledClass = __webpack_require__(16);
  949. var ReactFeatureFlags = __webpack_require__(81);
  950. var ReactReconciler = __webpack_require__(20);
  951. var Transaction = __webpack_require__(33);
  952. var invariant = __webpack_require__(0);
  953. var dirtyComponents = [];
  954. var updateBatchNumber = 0;
  955. var asapCallbackQueue = CallbackQueue.getPooled();
  956. var asapEnqueued = false;
  957. var batchingStrategy = null;
  958. function ensureInjected() {
  959. !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? false ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
  960. }
  961. var NESTED_UPDATES = {
  962. initialize: function () {
  963. this.dirtyComponentsLength = dirtyComponents.length;
  964. },
  965. close: function () {
  966. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  967. // Additional updates were enqueued by componentDidUpdate handlers or
  968. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  969. // these new updates so that if A's componentDidUpdate calls setState on
  970. // B, B will update before the callback A's updater provided when calling
  971. // setState.
  972. dirtyComponents.splice(0, this.dirtyComponentsLength);
  973. flushBatchedUpdates();
  974. } else {
  975. dirtyComponents.length = 0;
  976. }
  977. }
  978. };
  979. var UPDATE_QUEUEING = {
  980. initialize: function () {
  981. this.callbackQueue.reset();
  982. },
  983. close: function () {
  984. this.callbackQueue.notifyAll();
  985. }
  986. };
  987. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  988. function ReactUpdatesFlushTransaction() {
  989. this.reinitializeTransaction();
  990. this.dirtyComponentsLength = null;
  991. this.callbackQueue = CallbackQueue.getPooled();
  992. this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  993. /* useCreateElement */true);
  994. }
  995. _assign(ReactUpdatesFlushTransaction.prototype, Transaction, {
  996. getTransactionWrappers: function () {
  997. return TRANSACTION_WRAPPERS;
  998. },
  999. destructor: function () {
  1000. this.dirtyComponentsLength = null;
  1001. CallbackQueue.release(this.callbackQueue);
  1002. this.callbackQueue = null;
  1003. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  1004. this.reconcileTransaction = null;
  1005. },
  1006. perform: function (method, scope, a) {
  1007. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  1008. // with this transaction's wrappers around it.
  1009. return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
  1010. }
  1011. });
  1012. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  1013. function batchedUpdates(callback, a, b, c, d, e) {
  1014. ensureInjected();
  1015. return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
  1016. }
  1017. /**
  1018. * Array comparator for ReactComponents by mount ordering.
  1019. *
  1020. * @param {ReactComponent} c1 first component you're comparing
  1021. * @param {ReactComponent} c2 second component you're comparing
  1022. * @return {number} Return value usable by Array.prototype.sort().
  1023. */
  1024. function mountOrderComparator(c1, c2) {
  1025. return c1._mountOrder - c2._mountOrder;
  1026. }
  1027. function runBatchedUpdates(transaction) {
  1028. var len = transaction.dirtyComponentsLength;
  1029. !(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;
  1030. // Since reconciling a component higher in the owner hierarchy usually (not
  1031. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  1032. // them before their children by sorting the array.
  1033. dirtyComponents.sort(mountOrderComparator);
  1034. // Any updates enqueued while reconciling must be performed after this entire
  1035. // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
  1036. // C, B could update twice in a single batch if C's render enqueues an update
  1037. // to B (since B would have already updated, we should skip it, and the only
  1038. // way we can know to do so is by checking the batch counter).
  1039. updateBatchNumber++;
  1040. for (var i = 0; i < len; i++) {
  1041. // If a component is unmounted before pending changes apply, it will still
  1042. // be here, but we assume that it has cleared its _pendingCallbacks and
  1043. // that performUpdateIfNecessary is a noop.
  1044. var component = dirtyComponents[i];
  1045. // If performUpdateIfNecessary happens to enqueue any new updates, we
  1046. // shouldn't execute the callbacks until the next render happens, so
  1047. // stash the callbacks first
  1048. var callbacks = component._pendingCallbacks;
  1049. component._pendingCallbacks = null;
  1050. var markerName;
  1051. if (ReactFeatureFlags.logTopLevelRenders) {
  1052. var namedComponent = component;
  1053. // Duck type TopLevelWrapper. This is probably always true.
  1054. if (component._currentElement.type.isReactTopLevelWrapper) {
  1055. namedComponent = component._renderedComponent;
  1056. }
  1057. markerName = 'React update: ' + namedComponent.getName();
  1058. console.time(markerName);
  1059. }
  1060. ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
  1061. if (markerName) {
  1062. console.timeEnd(markerName);
  1063. }
  1064. if (callbacks) {
  1065. for (var j = 0; j < callbacks.length; j++) {
  1066. transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
  1067. }
  1068. }
  1069. }
  1070. }
  1071. var flushBatchedUpdates = function () {
  1072. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  1073. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  1074. // componentDidUpdate) but we need to check here too in order to catch
  1075. // updates enqueued by setState callbacks and asap calls.
  1076. while (dirtyComponents.length || asapEnqueued) {
  1077. if (dirtyComponents.length) {
  1078. var transaction = ReactUpdatesFlushTransaction.getPooled();
  1079. transaction.perform(runBatchedUpdates, null, transaction);
  1080. ReactUpdatesFlushTransaction.release(transaction);
  1081. }
  1082. if (asapEnqueued) {
  1083. asapEnqueued = false;
  1084. var queue = asapCallbackQueue;
  1085. asapCallbackQueue = CallbackQueue.getPooled();
  1086. queue.notifyAll();
  1087. CallbackQueue.release(queue);
  1088. }
  1089. }
  1090. };
  1091. /**
  1092. * Mark a component as needing a rerender, adding an optional callback to a
  1093. * list of functions which will be executed once the rerender occurs.
  1094. */
  1095. function enqueueUpdate(component) {
  1096. ensureInjected();
  1097. // Various parts of our code (such as ReactCompositeComponent's
  1098. // _renderValidatedComponent) assume that calls to render aren't nested;
  1099. // verify that that's the case. (This is called by each top-level update
  1100. // function, like setState, forceUpdate, etc.; creation and
  1101. // destruction of top-level components is guarded in ReactMount.)
  1102. if (!batchingStrategy.isBatchingUpdates) {
  1103. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  1104. return;
  1105. }
  1106. dirtyComponents.push(component);
  1107. if (component._updateBatchNumber == null) {
  1108. component._updateBatchNumber = updateBatchNumber + 1;
  1109. }
  1110. }
  1111. /**
  1112. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  1113. * if no updates are currently being performed.
  1114. */
  1115. function asap(callback, context) {
  1116. !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;
  1117. asapCallbackQueue.enqueue(callback, context);
  1118. asapEnqueued = true;
  1119. }
  1120. var ReactUpdatesInjection = {
  1121. injectReconcileTransaction: function (ReconcileTransaction) {
  1122. !ReconcileTransaction ? false ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
  1123. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  1124. },
  1125. injectBatchingStrategy: function (_batchingStrategy) {
  1126. !_batchingStrategy ? false ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
  1127. !(typeof _batchingStrategy.batchedUpdates === 'function') ? false ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
  1128. !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? false ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
  1129. batchingStrategy = _batchingStrategy;
  1130. }
  1131. };
  1132. var ReactUpdates = {
  1133. /**
  1134. * React references `ReactReconcileTransaction` using this property in order
  1135. * to allow dependency injection.
  1136. *
  1137. * @internal
  1138. */
  1139. ReactReconcileTransaction: null,
  1140. batchedUpdates: batchedUpdates,
  1141. enqueueUpdate: enqueueUpdate,
  1142. flushBatchedUpdates: flushBatchedUpdates,
  1143. injection: ReactUpdatesInjection,
  1144. asap: asap
  1145. };
  1146. module.exports = ReactUpdates;
  1147. /***/ }),
  1148. /* 13 */
  1149. /***/ (function(module, exports, __webpack_require__) {
  1150. "use strict";
  1151. /**
  1152. * Copyright 2013-present, Facebook, Inc.
  1153. * All rights reserved.
  1154. *
  1155. * This source code is licensed under the BSD-style license found in the
  1156. * LICENSE file in the root directory of this source tree. An additional grant
  1157. * of patent rights can be found in the PATENTS file in the same directory.
  1158. *
  1159. */
  1160. var _assign = __webpack_require__(3);
  1161. var PooledClass = __webpack_require__(16);
  1162. var emptyFunction = __webpack_require__(10);
  1163. var warning = __webpack_require__(1);
  1164. var didWarnForAddedNewProperty = false;
  1165. var isProxySupported = typeof Proxy === 'function';
  1166. var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
  1167. /**
  1168. * @interface Event
  1169. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  1170. */
  1171. var EventInterface = {
  1172. type: null,
  1173. target: null,
  1174. // currentTarget is set when dispatching; no use in copying it here
  1175. currentTarget: emptyFunction.thatReturnsNull,
  1176. eventPhase: null,
  1177. bubbles: null,
  1178. cancelable: null,
  1179. timeStamp: function (event) {
  1180. return event.timeStamp || Date.now();
  1181. },
  1182. defaultPrevented: null,
  1183. isTrusted: null
  1184. };
  1185. /**
  1186. * Synthetic events are dispatched by event plugins, typically in response to a
  1187. * top-level event delegation handler.
  1188. *
  1189. * These systems should generally use pooling to reduce the frequency of garbage
  1190. * collection. The system should check `isPersistent` to determine whether the
  1191. * event should be released into the pool after being dispatched. Users that
  1192. * need a persisted event should invoke `persist`.
  1193. *
  1194. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  1195. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  1196. * DOM interface; custom application-specific events can also subclass this.
  1197. *
  1198. * @param {object} dispatchConfig Configuration used to dispatch this event.
  1199. * @param {*} targetInst Marker identifying the event target.
  1200. * @param {object} nativeEvent Native browser event.
  1201. * @param {DOMEventTarget} nativeEventTarget Target node.
  1202. */
  1203. function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
  1204. if (false) {
  1205. // these have a getter/setter for warnings
  1206. delete this.nativeEvent;
  1207. delete this.preventDefault;
  1208. delete this.stopPropagation;
  1209. }
  1210. this.dispatchConfig = dispatchConfig;
  1211. this._targetInst = targetInst;
  1212. this.nativeEvent = nativeEvent;
  1213. var Interface = this.constructor.Interface;
  1214. for (var propName in Interface) {
  1215. if (!Interface.hasOwnProperty(propName)) {
  1216. continue;
  1217. }
  1218. if (false) {
  1219. delete this[propName]; // this has a getter/setter for warnings
  1220. }
  1221. var normalize = Interface[propName];
  1222. if (normalize) {
  1223. this[propName] = normalize(nativeEvent);
  1224. } else {
  1225. if (propName === 'target') {
  1226. this.target = nativeEventTarget;
  1227. } else {
  1228. this[propName] = nativeEvent[propName];
  1229. }
  1230. }
  1231. }
  1232. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  1233. if (defaultPrevented) {
  1234. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1235. } else {
  1236. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  1237. }
  1238. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  1239. return this;
  1240. }
  1241. _assign(SyntheticEvent.prototype, {
  1242. preventDefault: function () {
  1243. this.defaultPrevented = true;
  1244. var event = this.nativeEvent;
  1245. if (!event) {
  1246. return;
  1247. }
  1248. if (event.preventDefault) {
  1249. event.preventDefault();
  1250. } else if (typeof event.returnValue !== 'unknown') {
  1251. // eslint-disable-line valid-typeof
  1252. event.returnValue = false;
  1253. }
  1254. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1255. },
  1256. stopPropagation: function () {
  1257. var event = this.nativeEvent;
  1258. if (!event) {
  1259. return;
  1260. }
  1261. if (event.stopPropagation) {
  1262. event.stopPropagation();
  1263. } else if (typeof event.cancelBubble !== 'unknown') {
  1264. // eslint-disable-line valid-typeof
  1265. // The ChangeEventPlugin registers a "propertychange" event for
  1266. // IE. This event does not support bubbling or cancelling, and
  1267. // any references to cancelBubble throw "Member not found". A
  1268. // typeof check of "unknown" circumvents this issue (and is also
  1269. // IE specific).
  1270. event.cancelBubble = true;
  1271. }
  1272. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  1273. },
  1274. /**
  1275. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  1276. * them back into the pool. This allows a way to hold onto a reference that
  1277. * won't be added back into the pool.
  1278. */
  1279. persist: function () {
  1280. this.isPersistent = emptyFunction.thatReturnsTrue;
  1281. },
  1282. /**
  1283. * Checks if this event should be released back into the pool.
  1284. *
  1285. * @return {boolean} True if this should not be released, false otherwise.
  1286. */
  1287. isPersistent: emptyFunction.thatReturnsFalse,
  1288. /**
  1289. * `PooledClass` looks for `destructor` on each instance it releases.
  1290. */
  1291. destructor: function () {
  1292. var Interface = this.constructor.Interface;
  1293. for (var propName in Interface) {
  1294. if (false) {
  1295. Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
  1296. } else {
  1297. this[propName] = null;
  1298. }
  1299. }
  1300. for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
  1301. this[shouldBeReleasedProperties[i]] = null;
  1302. }
  1303. if (false) {
  1304. Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
  1305. Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
  1306. Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
  1307. }
  1308. }
  1309. });
  1310. SyntheticEvent.Interface = EventInterface;
  1311. if (false) {
  1312. if (isProxySupported) {
  1313. /*eslint-disable no-func-assign */
  1314. SyntheticEvent = new Proxy(SyntheticEvent, {
  1315. construct: function (target, args) {
  1316. return this.apply(target, Object.create(target.prototype), args);
  1317. },
  1318. apply: function (constructor, that, args) {
  1319. return new Proxy(constructor.apply(that, args), {
  1320. set: function (target, prop, value) {
  1321. if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
  1322. 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;
  1323. didWarnForAddedNewProperty = true;
  1324. }
  1325. target[prop] = value;
  1326. return true;
  1327. }
  1328. });
  1329. }
  1330. });
  1331. /*eslint-enable no-func-assign */
  1332. }
  1333. }
  1334. /**
  1335. * Helper to reduce boilerplate when creating subclasses.
  1336. *
  1337. * @param {function} Class
  1338. * @param {?object} Interface
  1339. */
  1340. SyntheticEvent.augmentClass = function (Class, Interface) {
  1341. var Super = this;
  1342. var E = function () {};
  1343. E.prototype = Super.prototype;
  1344. var prototype = new E();
  1345. _assign(prototype, Class.prototype);
  1346. Class.prototype = prototype;
  1347. Class.prototype.constructor = Class;
  1348. Class.Interface = _assign({}, Super.Interface, Interface);
  1349. Class.augmentClass = Super.augmentClass;
  1350. PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
  1351. };
  1352. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
  1353. module.exports = SyntheticEvent;
  1354. /**
  1355. * Helper to nullify syntheticEvent instance properties when destructing
  1356. *
  1357. * @param {object} SyntheticEvent
  1358. * @param {String} propName
  1359. * @return {object} defineProperty object
  1360. */
  1361. function getPooledWarningPropertyDefinition(propName, getVal) {
  1362. var isFunction = typeof getVal === 'function';
  1363. return {
  1364. configurable: true,
  1365. set: set,
  1366. get: get
  1367. };
  1368. function set(val) {
  1369. var action = isFunction ? 'setting the method' : 'setting the property';
  1370. warn(action, 'This is effectively a no-op');
  1371. return val;
  1372. }
  1373. function get() {
  1374. var action = isFunction ? 'accessing the method' : 'accessing the property';
  1375. var result = isFunction ? 'This is a no-op function' : 'This is set to null';
  1376. warn(action, result);
  1377. return getVal;
  1378. }
  1379. function warn(action, result) {
  1380. var warningCondition = false;
  1381. 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;
  1382. }
  1383. }
  1384. /***/ }),
  1385. /* 14 */
  1386. /***/ (function(module, exports, __webpack_require__) {
  1387. "use strict";
  1388. /**
  1389. * Copyright 2013-present, Facebook, Inc.
  1390. * All rights reserved.
  1391. *
  1392. * This source code is licensed under the BSD-style license found in the
  1393. * LICENSE file in the root directory of this source tree. An additional grant
  1394. * of patent rights can be found in the PATENTS file in the same directory.
  1395. *
  1396. *
  1397. */
  1398. /**
  1399. * Keeps track of the current owner.
  1400. *
  1401. * The current owner is the component who should own any components that are
  1402. * currently being constructed.
  1403. */
  1404. var ReactCurrentOwner = {
  1405. /**
  1406. * @internal
  1407. * @type {ReactComponent}
  1408. */
  1409. current: null
  1410. };
  1411. module.exports = ReactCurrentOwner;
  1412. /***/ }),
  1413. /* 15 */
  1414. /***/ (function(module, exports, __webpack_require__) {
  1415. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1416. Copyright (c) 2016 Jed Watson.
  1417. Licensed under the MIT License (MIT), see
  1418. http://jedwatson.github.io/classnames
  1419. */
  1420. /* global define */
  1421. (function () {
  1422. 'use strict';
  1423. var hasOwn = {}.hasOwnProperty;
  1424. function classNames () {
  1425. var classes = [];
  1426. for (var i = 0; i < arguments.length; i++) {
  1427. var arg = arguments[i];
  1428. if (!arg) continue;
  1429. var argType = typeof arg;
  1430. if (argType === 'string' || argType === 'number') {
  1431. classes.push(arg);
  1432. } else if (Array.isArray(arg)) {
  1433. classes.push(classNames.apply(null, arg));
  1434. } else if (argType === 'object') {
  1435. for (var key in arg) {
  1436. if (hasOwn.call(arg, key) && arg[key]) {
  1437. classes.push(key);
  1438. }
  1439. }
  1440. }
  1441. }
  1442. return classes.join(' ');
  1443. }
  1444. if (typeof module !== 'undefined' && module.exports) {
  1445. module.exports = classNames;
  1446. } else if (true) {
  1447. // register as 'classnames', consistent with npm package name
  1448. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
  1449. return classNames;
  1450. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1451. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1452. } else {
  1453. window.classNames = classNames;
  1454. }
  1455. }());
  1456. /***/ }),
  1457. /* 16 */
  1458. /***/ (function(module, exports, __webpack_require__) {
  1459. "use strict";
  1460. /**
  1461. * Copyright 2013-present, Facebook, Inc.
  1462. * All rights reserved.
  1463. *
  1464. * This source code is licensed under the BSD-style license found in the
  1465. * LICENSE file in the root directory of this source tree. An additional grant
  1466. * of patent rights can be found in the PATENTS file in the same directory.
  1467. *
  1468. *
  1469. */
  1470. var _prodInvariant = __webpack_require__(2);
  1471. var invariant = __webpack_require__(0);
  1472. /**
  1473. * Static poolers. Several custom versions for each potential number of
  1474. * arguments. A completely generic pooler is easy to implement, but would
  1475. * require accessing the `arguments` object. In each of these, `this` refers to
  1476. * the Class itself, not an instance. If any others are needed, simply add them
  1477. * here, or in their own files.
  1478. */
  1479. var oneArgumentPooler = function (copyFieldsFrom) {
  1480. var Klass = this;
  1481. if (Klass.instancePool.length) {
  1482. var instance = Klass.instancePool.pop();
  1483. Klass.call(instance, copyFieldsFrom);
  1484. return instance;
  1485. } else {
  1486. return new Klass(copyFieldsFrom);
  1487. }
  1488. };
  1489. var twoArgumentPooler = function (a1, a2) {
  1490. var Klass = this;
  1491. if (Klass.instancePool.length) {
  1492. var instance = Klass.instancePool.pop();
  1493. Klass.call(instance, a1, a2);
  1494. return instance;
  1495. } else {
  1496. return new Klass(a1, a2);
  1497. }
  1498. };
  1499. var threeArgumentPooler = function (a1, a2, a3) {
  1500. var Klass = this;
  1501. if (Klass.instancePool.length) {
  1502. var instance = Klass.instancePool.pop();
  1503. Klass.call(instance, a1, a2, a3);
  1504. return instance;
  1505. } else {
  1506. return new Klass(a1, a2, a3);
  1507. }
  1508. };
  1509. var fourArgumentPooler = function (a1, a2, a3, a4) {
  1510. var Klass = this;
  1511. if (Klass.instancePool.length) {
  1512. var instance = Klass.instancePool.pop();
  1513. Klass.call(instance, a1, a2, a3, a4);
  1514. return instance;
  1515. } else {
  1516. return new Klass(a1, a2, a3, a4);
  1517. }
  1518. };
  1519. var standardReleaser = function (instance) {
  1520. var Klass = this;
  1521. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  1522. instance.destructor();
  1523. if (Klass.instancePool.length < Klass.poolSize) {
  1524. Klass.instancePool.push(instance);
  1525. }
  1526. };
  1527. var DEFAULT_POOL_SIZE = 10;
  1528. var DEFAULT_POOLER = oneArgumentPooler;
  1529. /**
  1530. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  1531. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  1532. * you give this may have a `poolSize` property, and will look for a
  1533. * prototypical `destructor` on instances.
  1534. *
  1535. * @param {Function} CopyConstructor Constructor that can be used to reset.
  1536. * @param {Function} pooler Customizable pooler.
  1537. */
  1538. var addPoolingTo = function (CopyConstructor, pooler) {
  1539. // Casting as any so that flow ignores the actual implementation and trusts
  1540. // it to match the type we declared
  1541. var NewKlass = CopyConstructor;
  1542. NewKlass.instancePool = [];
  1543. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  1544. if (!NewKlass.poolSize) {
  1545. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  1546. }
  1547. NewKlass.release = standardReleaser;
  1548. return NewKlass;
  1549. };
  1550. var PooledClass = {
  1551. addPoolingTo: addPoolingTo,
  1552. oneArgumentPooler: oneArgumentPooler,
  1553. twoArgumentPooler: twoArgumentPooler,
  1554. threeArgumentPooler: threeArgumentPooler,
  1555. fourArgumentPooler: fourArgumentPooler
  1556. };
  1557. module.exports = PooledClass;
  1558. /***/ }),
  1559. /* 17 */
  1560. /***/ (function(module, exports, __webpack_require__) {
  1561. "use strict";
  1562. /**
  1563. * @author oldj
  1564. * @blog https://oldj.net
  1565. */
  1566. var _Agent = __webpack_require__(4);
  1567. var _Agent2 = _interopRequireDefault(_Agent);
  1568. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1569. module.exports = function (app, new_list) {
  1570. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1571. var state = { list: new_list };
  1572. return _Agent2.default.pact('getSysHosts').then(function (sys_hosts) {
  1573. state.sys_hosts = sys_hosts;
  1574. if (hosts) {
  1575. state.current = hosts;
  1576. } else if (app.state.current) {
  1577. var c = new_list.find(function (i) {
  1578. return i.id === app.state.current.id;
  1579. });
  1580. if (c) {
  1581. state.current = c;
  1582. }
  1583. }
  1584. var current = app.state.current;
  1585. if (current.is_sys) {
  1586. state.current = sys_hosts;
  1587. }
  1588. app.setState(state, function () {
  1589. if (hosts) {
  1590. _Agent2.default.emit('select', hosts.id);
  1591. }
  1592. });
  1593. });
  1594. };
  1595. /***/ }),
  1596. /* 18 */
  1597. /***/ (function(module, exports, __webpack_require__) {
  1598. "use strict";
  1599. /**
  1600. * Copyright 2015-present, Facebook, Inc.
  1601. * All rights reserved.
  1602. *
  1603. * This source code is licensed under the BSD-style license found in the
  1604. * LICENSE file in the root directory of this source tree. An additional grant
  1605. * of patent rights can be found in the PATENTS file in the same directory.
  1606. *
  1607. */
  1608. var DOMNamespaces = __webpack_require__(52);
  1609. var setInnerHTML = __webpack_require__(35);
  1610. var createMicrosoftUnsafeLocalFunction = __webpack_require__(60);
  1611. var setTextContent = __webpack_require__(93);
  1612. var ELEMENT_NODE_TYPE = 1;
  1613. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  1614. /**
  1615. * In IE (8-11) and Edge, appending nodes with no children is dramatically
  1616. * faster than appending a full subtree, so we essentially queue up the
  1617. * .appendChild calls here and apply them so each node is added to its parent
  1618. * before any children are added.
  1619. *
  1620. * In other browsers, doing so is slower or neutral compared to the other order
  1621. * (in Firefox, twice as slow) so we only do this inversion in IE.
  1622. *
  1623. * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
  1624. */
  1625. var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
  1626. function insertTreeChildren(tree) {
  1627. if (!enableLazy) {
  1628. return;
  1629. }
  1630. var node = tree.node;
  1631. var children = tree.children;
  1632. if (children.length) {
  1633. for (var i = 0; i < children.length; i++) {
  1634. insertTreeBefore(node, children[i], null);
  1635. }
  1636. } else if (tree.html != null) {
  1637. setInnerHTML(node, tree.html);
  1638. } else if (tree.text != null) {
  1639. setTextContent(node, tree.text);
  1640. }
  1641. }
  1642. var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
  1643. // DocumentFragments aren't actually part of the DOM after insertion so
  1644. // appending children won't update the DOM. We need to ensure the fragment
  1645. // is properly populated first, breaking out of our lazy approach for just
  1646. // this level. Also, some <object> plugins (like Flash Player) will read
  1647. // <param> nodes immediately upon insertion into the DOM, so <object>
  1648. // must also be populated prior to insertion into the DOM.
  1649. 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)) {
  1650. insertTreeChildren(tree);
  1651. parentNode.insertBefore(tree.node, referenceNode);
  1652. } else {
  1653. parentNode.insertBefore(tree.node, referenceNode);
  1654. insertTreeChildren(tree);
  1655. }
  1656. });
  1657. function replaceChildWithTree(oldNode, newTree) {
  1658. oldNode.parentNode.replaceChild(newTree.node, oldNode);
  1659. insertTreeChildren(newTree);
  1660. }
  1661. function queueChild(parentTree, childTree) {
  1662. if (enableLazy) {
  1663. parentTree.children.push(childTree);
  1664. } else {
  1665. parentTree.node.appendChild(childTree.node);
  1666. }
  1667. }
  1668. function queueHTML(tree, html) {
  1669. if (enableLazy) {
  1670. tree.html = html;
  1671. } else {
  1672. setInnerHTML(tree.node, html);
  1673. }
  1674. }
  1675. function queueText(tree, text) {
  1676. if (enableLazy) {
  1677. tree.text = text;
  1678. } else {
  1679. setTextContent(tree.node, text);
  1680. }
  1681. }
  1682. function toString() {
  1683. return this.node.nodeName;
  1684. }
  1685. function DOMLazyTree(node) {
  1686. return {
  1687. node: node,
  1688. children: [],
  1689. html: null,
  1690. text: null,
  1691. toString: toString
  1692. };
  1693. }
  1694. DOMLazyTree.insertTreeBefore = insertTreeBefore;
  1695. DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
  1696. DOMLazyTree.queueChild = queueChild;
  1697. DOMLazyTree.queueHTML = queueHTML;
  1698. DOMLazyTree.queueText = queueText;
  1699. module.exports = DOMLazyTree;
  1700. /***/ }),
  1701. /* 19 */
  1702. /***/ (function(module, exports, __webpack_require__) {
  1703. "use strict";
  1704. /**
  1705. * Copyright 2013-present, Facebook, Inc.
  1706. * All rights reserved.
  1707. *
  1708. * This source code is licensed under the BSD-style license found in the
  1709. * LICENSE file in the root directory of this source tree. An additional grant
  1710. * of patent rights can be found in the PATENTS file in the same directory.
  1711. *
  1712. */
  1713. var _prodInvariant = __webpack_require__(2);
  1714. var invariant = __webpack_require__(0);
  1715. function checkMask(value, bitmask) {
  1716. return (value & bitmask) === bitmask;
  1717. }
  1718. var DOMPropertyInjection = {
  1719. /**
  1720. * Mapping from normalized, camelcased property names to a configuration that
  1721. * specifies how the associated DOM property should be accessed or rendered.
  1722. */
  1723. MUST_USE_PROPERTY: 0x1,
  1724. HAS_BOOLEAN_VALUE: 0x4,
  1725. HAS_NUMERIC_VALUE: 0x8,
  1726. HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  1727. HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
  1728. /**
  1729. * Inject some specialized knowledge about the DOM. This takes a config object
  1730. * with the following properties:
  1731. *
  1732. * isCustomAttribute: function that given an attribute name will return true
  1733. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1734. * attributes where it's impossible to enumerate all of the possible
  1735. * attribute names,
  1736. *
  1737. * Properties: object mapping DOM property name to one of the
  1738. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1739. * it won't get written to the DOM.
  1740. *
  1741. * DOMAttributeNames: object mapping React attribute name to the DOM
  1742. * attribute name. Attribute names not specified use the **lowercase**
  1743. * normalized name.
  1744. *
  1745. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1746. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1747. *
  1748. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1749. * Property names not specified use the normalized name.
  1750. *
  1751. * DOMMutationMethods: Properties that require special mutation methods. If
  1752. * `value` is undefined, the mutation method should unset the property.
  1753. *
  1754. * @param {object} domPropertyConfig the config as described above.
  1755. */
  1756. injectDOMPropertyConfig: function (domPropertyConfig) {
  1757. var Injection = DOMPropertyInjection;
  1758. var Properties = domPropertyConfig.Properties || {};
  1759. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1760. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1761. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1762. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1763. if (domPropertyConfig.isCustomAttribute) {
  1764. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1765. }
  1766. for (var propName in Properties) {
  1767. !!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;
  1768. var lowerCased = propName.toLowerCase();
  1769. var propConfig = Properties[propName];
  1770. var propertyInfo = {
  1771. attributeName: lowerCased,
  1772. attributeNamespace: null,
  1773. propertyName: propName,
  1774. mutationMethod: null,
  1775. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1776. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1777. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1778. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1779. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1780. };
  1781. !(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;
  1782. if (false) {
  1783. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1784. }
  1785. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1786. var attributeName = DOMAttributeNames[propName];
  1787. propertyInfo.attributeName = attributeName;
  1788. if (false) {
  1789. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1790. }
  1791. }
  1792. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1793. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1794. }
  1795. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1796. propertyInfo.propertyName = DOMPropertyNames[propName];
  1797. }
  1798. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1799. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1800. }
  1801. DOMProperty.properties[propName] = propertyInfo;
  1802. }
  1803. }
  1804. };
  1805. /* eslint-disable max-len */
  1806. 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';
  1807. /* eslint-enable max-len */
  1808. /**
  1809. * DOMProperty exports lookup objects that can be used like functions:
  1810. *
  1811. * > DOMProperty.isValid['id']
  1812. * true
  1813. * > DOMProperty.isValid['foobar']
  1814. * undefined
  1815. *
  1816. * Although this may be confusing, it performs better in general.
  1817. *
  1818. * @see http://jsperf.com/key-exists
  1819. * @see http://jsperf.com/key-missing
  1820. */
  1821. var DOMProperty = {
  1822. ID_ATTRIBUTE_NAME: 'data-reactid',
  1823. ROOT_ATTRIBUTE_NAME: 'data-reactroot',
  1824. ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  1825. ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
  1826. /**
  1827. * Map from property "standard name" to an object with info about how to set
  1828. * the property in the DOM. Each object contains:
  1829. *
  1830. * attributeName:
  1831. * Used when rendering markup or with `*Attribute()`.
  1832. * attributeNamespace
  1833. * propertyName:
  1834. * Used on DOM node instances. (This includes properties that mutate due to
  1835. * external factors.)
  1836. * mutationMethod:
  1837. * If non-null, used instead of the property or `setAttribute()` after
  1838. * initial render.
  1839. * mustUseProperty:
  1840. * Whether the property must be accessed and mutated as an object property.
  1841. * hasBooleanValue:
  1842. * Whether the property should be removed when set to a falsey value.
  1843. * hasNumericValue:
  1844. * Whether the property must be numeric or parse as a numeric and should be
  1845. * removed when set to a falsey value.
  1846. * hasPositiveNumericValue:
  1847. * Whether the property must be positive numeric or parse as a positive
  1848. * numeric and should be removed when set to a falsey value.
  1849. * hasOverloadedBooleanValue:
  1850. * Whether the property can be used as a flag as well as with a value.
  1851. * Removed when strictly equal to false; present without a value when
  1852. * strictly equal to true; present with a value otherwise.
  1853. */
  1854. properties: {},
  1855. /**
  1856. * Mapping from lowercase property names to the properly cased version, used
  1857. * to warn in the case of missing properties. Available only in __DEV__.
  1858. *
  1859. * autofocus is predefined, because adding it to the property whitelist
  1860. * causes unintended side effects.
  1861. *
  1862. * @type {Object}
  1863. */
  1864. getPossibleStandardName: false ? { autofocus: 'autoFocus' } : null,
  1865. /**
  1866. * All of the isCustomAttribute() functions that have been injected.
  1867. */
  1868. _isCustomAttributeFunctions: [],
  1869. /**
  1870. * Checks whether a property name is a custom attribute.
  1871. * @method
  1872. */
  1873. isCustomAttribute: function (attributeName) {
  1874. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1875. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1876. if (isCustomAttributeFn(attributeName)) {
  1877. return true;
  1878. }
  1879. }
  1880. return false;
  1881. },
  1882. injection: DOMPropertyInjection
  1883. };
  1884. module.exports = DOMProperty;
  1885. /***/ }),
  1886. /* 20 */
  1887. /***/ (function(module, exports, __webpack_require__) {
  1888. "use strict";
  1889. /**
  1890. * Copyright 2013-present, Facebook, Inc.
  1891. * All rights reserved.
  1892. *
  1893. * This source code is licensed under the BSD-style license found in the
  1894. * LICENSE file in the root directory of this source tree. An additional grant
  1895. * of patent rights can be found in the PATENTS file in the same directory.
  1896. *
  1897. */
  1898. var ReactRef = __webpack_require__(185);
  1899. var ReactInstrumentation = __webpack_require__(11);
  1900. var warning = __webpack_require__(1);
  1901. /**
  1902. * Helper to call ReactRef.attachRefs with this composite component, split out
  1903. * to avoid allocations in the transaction mount-ready queue.
  1904. */
  1905. function attachRefs() {
  1906. ReactRef.attachRefs(this, this._currentElement);
  1907. }
  1908. var ReactReconciler = {
  1909. /**
  1910. * Initializes the component, renders markup, and registers event listeners.
  1911. *
  1912. * @param {ReactComponent} internalInstance
  1913. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  1914. * @param {?object} the containing host component instance
  1915. * @param {?object} info about the host container
  1916. * @return {?string} Rendered markup to be inserted into the DOM.
  1917. * @final
  1918. * @internal
  1919. */
  1920. mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
  1921. ) {
  1922. if (false) {
  1923. if (internalInstance._debugID !== 0) {
  1924. ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
  1925. }
  1926. }
  1927. var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
  1928. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1929. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1930. }
  1931. if (false) {
  1932. if (internalInstance._debugID !== 0) {
  1933. ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
  1934. }
  1935. }
  1936. return markup;
  1937. },
  1938. /**
  1939. * Returns a value that can be passed to
  1940. * ReactComponentEnvironment.replaceNodeWithMarkup.
  1941. */
  1942. getHostNode: function (internalInstance) {
  1943. return internalInstance.getHostNode();
  1944. },
  1945. /**
  1946. * Releases any resources allocated by `mountComponent`.
  1947. *
  1948. * @final
  1949. * @internal
  1950. */
  1951. unmountComponent: function (internalInstance, safely) {
  1952. if (false) {
  1953. if (internalInstance._debugID !== 0) {
  1954. ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
  1955. }
  1956. }
  1957. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  1958. internalInstance.unmountComponent(safely);
  1959. if (false) {
  1960. if (internalInstance._debugID !== 0) {
  1961. ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
  1962. }
  1963. }
  1964. },
  1965. /**
  1966. * Update a component using a new element.
  1967. *
  1968. * @param {ReactComponent} internalInstance
  1969. * @param {ReactElement} nextElement
  1970. * @param {ReactReconcileTransaction} transaction
  1971. * @param {object} context
  1972. * @internal
  1973. */
  1974. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  1975. var prevElement = internalInstance._currentElement;
  1976. if (nextElement === prevElement && context === internalInstance._context) {
  1977. // Since elements are immutable after the owner is rendered,
  1978. // we can do a cheap identity compare here to determine if this is a
  1979. // superfluous reconcile. It's possible for state to be mutable but such
  1980. // change should trigger an update of the owner which would recreate
  1981. // the element. We explicitly check for the existence of an owner since
  1982. // it's possible for an element created outside a composite to be
  1983. // deeply mutated and reused.
  1984. // TODO: Bailing out early is just a perf optimization right?
  1985. // TODO: Removing the return statement should affect correctness?
  1986. return;
  1987. }
  1988. if (false) {
  1989. if (internalInstance._debugID !== 0) {
  1990. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
  1991. }
  1992. }
  1993. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  1994. if (refsChanged) {
  1995. ReactRef.detachRefs(internalInstance, prevElement);
  1996. }
  1997. internalInstance.receiveComponent(nextElement, transaction, context);
  1998. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1999. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  2000. }
  2001. if (false) {
  2002. if (internalInstance._debugID !== 0) {
  2003. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2004. }
  2005. }
  2006. },
  2007. /**
  2008. * Flush any dirty changes in a component.
  2009. *
  2010. * @param {ReactComponent} internalInstance
  2011. * @param {ReactReconcileTransaction} transaction
  2012. * @internal
  2013. */
  2014. performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
  2015. if (internalInstance._updateBatchNumber !== updateBatchNumber) {
  2016. // The component's enqueued batch number should always be the current
  2017. // batch or the following one.
  2018. false ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
  2019. return;
  2020. }
  2021. if (false) {
  2022. if (internalInstance._debugID !== 0) {
  2023. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
  2024. }
  2025. }
  2026. internalInstance.performUpdateIfNecessary(transaction);
  2027. if (false) {
  2028. if (internalInstance._debugID !== 0) {
  2029. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2030. }
  2031. }
  2032. }
  2033. };
  2034. module.exports = ReactReconciler;
  2035. /***/ }),
  2036. /* 21 */
  2037. /***/ (function(module, exports, __webpack_require__) {
  2038. "use strict";
  2039. /**
  2040. * Copyright 2013-present, Facebook, Inc.
  2041. * All rights reserved.
  2042. *
  2043. * This source code is licensed under the BSD-style license found in the
  2044. * LICENSE file in the root directory of this source tree. An additional grant
  2045. * of patent rights can be found in the PATENTS file in the same directory.
  2046. *
  2047. */
  2048. var _assign = __webpack_require__(3);
  2049. var ReactChildren = __webpack_require__(215);
  2050. var ReactComponent = __webpack_require__(67);
  2051. var ReactPureComponent = __webpack_require__(220);
  2052. var ReactClass = __webpack_require__(216);
  2053. var ReactDOMFactories = __webpack_require__(217);
  2054. var ReactElement = __webpack_require__(22);
  2055. var ReactPropTypes = __webpack_require__(218);
  2056. var ReactVersion = __webpack_require__(221);
  2057. var onlyChild = __webpack_require__(222);
  2058. var warning = __webpack_require__(1);
  2059. var createElement = ReactElement.createElement;
  2060. var createFactory = ReactElement.createFactory;
  2061. var cloneElement = ReactElement.cloneElement;
  2062. if (false) {
  2063. var ReactElementValidator = require('./ReactElementValidator');
  2064. createElement = ReactElementValidator.createElement;
  2065. createFactory = ReactElementValidator.createFactory;
  2066. cloneElement = ReactElementValidator.cloneElement;
  2067. }
  2068. var __spread = _assign;
  2069. if (false) {
  2070. var warned = false;
  2071. __spread = function () {
  2072. 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;
  2073. warned = true;
  2074. return _assign.apply(null, arguments);
  2075. };
  2076. }
  2077. var React = {
  2078. // Modern
  2079. Children: {
  2080. map: ReactChildren.map,
  2081. forEach: ReactChildren.forEach,
  2082. count: ReactChildren.count,
  2083. toArray: ReactChildren.toArray,
  2084. only: onlyChild
  2085. },
  2086. Component: ReactComponent,
  2087. PureComponent: ReactPureComponent,
  2088. createElement: createElement,
  2089. cloneElement: cloneElement,
  2090. isValidElement: ReactElement.isValidElement,
  2091. // Classic
  2092. PropTypes: ReactPropTypes,
  2093. createClass: ReactClass.createClass,
  2094. createFactory: createFactory,
  2095. createMixin: function (mixin) {
  2096. // Currently a noop. Will be used to validate and trace mixins.
  2097. return mixin;
  2098. },
  2099. // This looks DOM specific but these are actually isomorphic helpers
  2100. // since they are just generating DOM strings.
  2101. DOM: ReactDOMFactories,
  2102. version: ReactVersion,
  2103. // Deprecated hook for JSX spread, don't use this for anything.
  2104. __spread: __spread
  2105. };
  2106. module.exports = React;
  2107. /***/ }),
  2108. /* 22 */
  2109. /***/ (function(module, exports, __webpack_require__) {
  2110. "use strict";
  2111. /**
  2112. * Copyright 2014-present, Facebook, Inc.
  2113. * All rights reserved.
  2114. *
  2115. * This source code is licensed under the BSD-style license found in the
  2116. * LICENSE file in the root directory of this source tree. An additional grant
  2117. * of patent rights can be found in the PATENTS file in the same directory.
  2118. *
  2119. */
  2120. var _assign = __webpack_require__(3);
  2121. var ReactCurrentOwner = __webpack_require__(14);
  2122. var warning = __webpack_require__(1);
  2123. var canDefineProperty = __webpack_require__(98);
  2124. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2125. var REACT_ELEMENT_TYPE = __webpack_require__(96);
  2126. var RESERVED_PROPS = {
  2127. key: true,
  2128. ref: true,
  2129. __self: true,
  2130. __source: true
  2131. };
  2132. var specialPropKeyWarningShown, specialPropRefWarningShown;
  2133. function hasValidRef(config) {
  2134. if (false) {
  2135. if (hasOwnProperty.call(config, 'ref')) {
  2136. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  2137. if (getter && getter.isReactWarning) {
  2138. return false;
  2139. }
  2140. }
  2141. }
  2142. return config.ref !== undefined;
  2143. }
  2144. function hasValidKey(config) {
  2145. if (false) {
  2146. if (hasOwnProperty.call(config, 'key')) {
  2147. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  2148. if (getter && getter.isReactWarning) {
  2149. return false;
  2150. }
  2151. }
  2152. }
  2153. return config.key !== undefined;
  2154. }
  2155. function defineKeyPropWarningGetter(props, displayName) {
  2156. var warnAboutAccessingKey = function () {
  2157. if (!specialPropKeyWarningShown) {
  2158. specialPropKeyWarningShown = true;
  2159. 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;
  2160. }
  2161. };
  2162. warnAboutAccessingKey.isReactWarning = true;
  2163. Object.defineProperty(props, 'key', {
  2164. get: warnAboutAccessingKey,
  2165. configurable: true
  2166. });
  2167. }
  2168. function defineRefPropWarningGetter(props, displayName) {
  2169. var warnAboutAccessingRef = function () {
  2170. if (!specialPropRefWarningShown) {
  2171. specialPropRefWarningShown = true;
  2172. 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;
  2173. }
  2174. };
  2175. warnAboutAccessingRef.isReactWarning = true;
  2176. Object.defineProperty(props, 'ref', {
  2177. get: warnAboutAccessingRef,
  2178. configurable: true
  2179. });
  2180. }
  2181. /**
  2182. * Factory method to create a new React element. This no longer adheres to
  2183. * the class pattern, so do not use new to call it. Also, no instanceof check
  2184. * will work. Instead test $$typeof field against Symbol.for('react.element') to check
  2185. * if something is a React Element.
  2186. *
  2187. * @param {*} type
  2188. * @param {*} key
  2189. * @param {string|object} ref
  2190. * @param {*} self A *temporary* helper to detect places where `this` is
  2191. * different from the `owner` when React.createElement is called, so that we
  2192. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  2193. * functions, and as long as `this` and owner are the same, there will be no
  2194. * change in behavior.
  2195. * @param {*} source An annotation object (added by a transpiler or otherwise)
  2196. * indicating filename, line number, and/or other information.
  2197. * @param {*} owner
  2198. * @param {*} props
  2199. * @internal
  2200. */
  2201. var ReactElement = function (type, key, ref, self, source, owner, props) {
  2202. var element = {
  2203. // This tag allow us to uniquely identify this as a React Element
  2204. $$typeof: REACT_ELEMENT_TYPE,
  2205. // Built-in properties that belong on the element
  2206. type: type,
  2207. key: key,
  2208. ref: ref,
  2209. props: props,
  2210. // Record the component responsible for creating this element.
  2211. _owner: owner
  2212. };
  2213. if (false) {
  2214. // The validation flag is currently mutative. We put it on
  2215. // an external backing store so that we can freeze the whole object.
  2216. // This can be replaced with a WeakMap once they are implemented in
  2217. // commonly used development environments.
  2218. element._store = {};
  2219. // To make comparing ReactElements easier for testing purposes, we make
  2220. // the validation flag non-enumerable (where possible, which should
  2221. // include every environment we run tests in), so the test framework
  2222. // ignores it.
  2223. if (canDefineProperty) {
  2224. Object.defineProperty(element._store, 'validated', {
  2225. configurable: false,
  2226. enumerable: false,
  2227. writable: true,
  2228. value: false
  2229. });
  2230. // self and source are DEV only properties.
  2231. Object.defineProperty(element, '_self', {
  2232. configurable: false,
  2233. enumerable: false,
  2234. writable: false,
  2235. value: self
  2236. });
  2237. // Two elements created in two different places should be considered
  2238. // equal for testing purposes and therefore we hide it from enumeration.
  2239. Object.defineProperty(element, '_source', {
  2240. configurable: false,
  2241. enumerable: false,
  2242. writable: false,
  2243. value: source
  2244. });
  2245. } else {
  2246. element._store.validated = false;
  2247. element._self = self;
  2248. element._source = source;
  2249. }
  2250. if (Object.freeze) {
  2251. Object.freeze(element.props);
  2252. Object.freeze(element);
  2253. }
  2254. }
  2255. return element;
  2256. };
  2257. /**
  2258. * Create and return a new ReactElement of the given type.
  2259. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
  2260. */
  2261. ReactElement.createElement = function (type, config, children) {
  2262. var propName;
  2263. // Reserved names are extracted
  2264. var props = {};
  2265. var key = null;
  2266. var ref = null;
  2267. var self = null;
  2268. var source = null;
  2269. if (config != null) {
  2270. if (hasValidRef(config)) {
  2271. ref = config.ref;
  2272. }
  2273. if (hasValidKey(config)) {
  2274. key = '' + config.key;
  2275. }
  2276. self = config.__self === undefined ? null : config.__self;
  2277. source = config.__source === undefined ? null : config.__source;
  2278. // Remaining properties are added to a new props object
  2279. for (propName in config) {
  2280. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2281. props[propName] = config[propName];
  2282. }
  2283. }
  2284. }
  2285. // Children can be more than one argument, and those are transferred onto
  2286. // the newly allocated props object.
  2287. var childrenLength = arguments.length - 2;
  2288. if (childrenLength === 1) {
  2289. props.children = children;
  2290. } else if (childrenLength > 1) {
  2291. var childArray = Array(childrenLength);
  2292. for (var i = 0; i < childrenLength; i++) {
  2293. childArray[i] = arguments[i + 2];
  2294. }
  2295. if (false) {
  2296. if (Object.freeze) {
  2297. Object.freeze(childArray);
  2298. }
  2299. }
  2300. props.children = childArray;
  2301. }
  2302. // Resolve default props
  2303. if (type && type.defaultProps) {
  2304. var defaultProps = type.defaultProps;
  2305. for (propName in defaultProps) {
  2306. if (props[propName] === undefined) {
  2307. props[propName] = defaultProps[propName];
  2308. }
  2309. }
  2310. }
  2311. if (false) {
  2312. if (key || ref) {
  2313. if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
  2314. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  2315. if (key) {
  2316. defineKeyPropWarningGetter(props, displayName);
  2317. }
  2318. if (ref) {
  2319. defineRefPropWarningGetter(props, displayName);
  2320. }
  2321. }
  2322. }
  2323. }
  2324. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  2325. };
  2326. /**
  2327. * Return a function that produces ReactElements of a given type.
  2328. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
  2329. */
  2330. ReactElement.createFactory = function (type) {
  2331. var factory = ReactElement.createElement.bind(null, type);
  2332. // Expose the type on the factory and the prototype so that it can be
  2333. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  2334. // This should not be named `constructor` since this may not be the function
  2335. // that created the element, and it may not even be a constructor.
  2336. // Legacy hook TODO: Warn if this is accessed
  2337. factory.type = type;
  2338. return factory;
  2339. };
  2340. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  2341. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  2342. return newElement;
  2343. };
  2344. /**
  2345. * Clone and return a new ReactElement using element as the starting point.
  2346. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
  2347. */
  2348. ReactElement.cloneElement = function (element, config, children) {
  2349. var propName;
  2350. // Original props are copied
  2351. var props = _assign({}, element.props);
  2352. // Reserved names are extracted
  2353. var key = element.key;
  2354. var ref = element.ref;
  2355. // Self is preserved since the owner is preserved.
  2356. var self = element._self;
  2357. // Source is preserved since cloneElement is unlikely to be targeted by a
  2358. // transpiler, and the original source is probably a better indicator of the
  2359. // true owner.
  2360. var source = element._source;
  2361. // Owner will be preserved, unless ref is overridden
  2362. var owner = element._owner;
  2363. if (config != null) {
  2364. if (hasValidRef(config)) {
  2365. // Silently steal the ref from the parent.
  2366. ref = config.ref;
  2367. owner = ReactCurrentOwner.current;
  2368. }
  2369. if (hasValidKey(config)) {
  2370. key = '' + config.key;
  2371. }
  2372. // Remaining properties override existing props
  2373. var defaultProps;
  2374. if (element.type && element.type.defaultProps) {
  2375. defaultProps = element.type.defaultProps;
  2376. }
  2377. for (propName in config) {
  2378. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2379. if (config[propName] === undefined && defaultProps !== undefined) {
  2380. // Resolve default props
  2381. props[propName] = defaultProps[propName];
  2382. } else {
  2383. props[propName] = config[propName];
  2384. }
  2385. }
  2386. }
  2387. }
  2388. // Children can be more than one argument, and those are transferred onto
  2389. // the newly allocated props object.
  2390. var childrenLength = arguments.length - 2;
  2391. if (childrenLength === 1) {
  2392. props.children = children;
  2393. } else if (childrenLength > 1) {
  2394. var childArray = Array(childrenLength);
  2395. for (var i = 0; i < childrenLength; i++) {
  2396. childArray[i] = arguments[i + 2];
  2397. }
  2398. props.children = childArray;
  2399. }
  2400. return ReactElement(element.type, key, ref, self, source, owner, props);
  2401. };
  2402. /**
  2403. * Verifies the object is a ReactElement.
  2404. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
  2405. * @param {?object} object
  2406. * @return {boolean} True if `object` is a valid component.
  2407. * @final
  2408. */
  2409. ReactElement.isValidElement = function (object) {
  2410. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  2411. };
  2412. module.exports = ReactElement;
  2413. /***/ }),
  2414. /* 23 */
  2415. /***/ (function(module, exports, __webpack_require__) {
  2416. "use strict";
  2417. /**
  2418. * Copyright (c) 2013-present, Facebook, Inc.
  2419. * All rights reserved.
  2420. *
  2421. * This source code is licensed under the BSD-style license found in the
  2422. * LICENSE file in the root directory of this source tree. An additional grant
  2423. * of patent rights can be found in the PATENTS file in the same directory.
  2424. *
  2425. *
  2426. */
  2427. /**
  2428. * WARNING: DO NOT manually require this module.
  2429. * This is a replacement for `invariant(...)` used by the error code system
  2430. * and will _only_ be required by the corresponding babel pass.
  2431. * It always throws.
  2432. */
  2433. function reactProdInvariant(code) {
  2434. var argCount = arguments.length - 1;
  2435. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  2436. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  2437. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  2438. }
  2439. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  2440. var error = new Error(message);
  2441. error.name = 'Invariant Violation';
  2442. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  2443. throw error;
  2444. }
  2445. module.exports = reactProdInvariant;
  2446. /***/ }),
  2447. /* 24 */
  2448. /***/ (function(module, exports, __webpack_require__) {
  2449. "use strict";
  2450. /**
  2451. * @author oldj
  2452. * @blog https://oldj.net
  2453. */
  2454. var _Agent = __webpack_require__(4);
  2455. var _Agent2 = _interopRequireDefault(_Agent);
  2456. var _list_updated = __webpack_require__(17);
  2457. var _list_updated2 = _interopRequireDefault(_list_updated);
  2458. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2459. module.exports = function (app, list) {
  2460. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  2461. return _Agent2.default.pact('saveHosts', list).then(function (new_list) {
  2462. (0, _list_updated2.default)(app, new_list, hosts);
  2463. }).catch(function (e) {
  2464. console.log(e);
  2465. });
  2466. };
  2467. /***/ }),
  2468. /* 25 */
  2469. /***/ (function(module, exports, __webpack_require__) {
  2470. "use strict";
  2471. /**
  2472. * Copyright (c) 2013-present, Facebook, Inc.
  2473. * All rights reserved.
  2474. *
  2475. * This source code is licensed under the BSD-style license found in the
  2476. * LICENSE file in the root directory of this source tree. An additional grant
  2477. * of patent rights can be found in the PATENTS file in the same directory.
  2478. *
  2479. */
  2480. var emptyObject = {};
  2481. if (false) {
  2482. Object.freeze(emptyObject);
  2483. }
  2484. module.exports = emptyObject;
  2485. /***/ }),
  2486. /* 26 */
  2487. /***/ (function(module, exports, __webpack_require__) {
  2488. "use strict";
  2489. /**
  2490. * Copyright 2013-present, Facebook, Inc.
  2491. * All rights reserved.
  2492. *
  2493. * This source code is licensed under the BSD-style license found in the
  2494. * LICENSE file in the root directory of this source tree. An additional grant
  2495. * of patent rights can be found in the PATENTS file in the same directory.
  2496. *
  2497. */
  2498. var _prodInvariant = __webpack_require__(2);
  2499. var EventPluginRegistry = __webpack_require__(53);
  2500. var EventPluginUtils = __webpack_require__(54);
  2501. var ReactErrorUtils = __webpack_require__(58);
  2502. var accumulateInto = __webpack_require__(87);
  2503. var forEachAccumulated = __webpack_require__(88);
  2504. var invariant = __webpack_require__(0);
  2505. /**
  2506. * Internal store for event listeners
  2507. */
  2508. var listenerBank = {};
  2509. /**
  2510. * Internal queue of events that have accumulated their dispatches and are
  2511. * waiting to have their dispatches executed.
  2512. */
  2513. var eventQueue = null;
  2514. /**
  2515. * Dispatches an event and releases it back into the pool, unless persistent.
  2516. *
  2517. * @param {?object} event Synthetic event to be dispatched.
  2518. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2519. * @private
  2520. */
  2521. var executeDispatchesAndRelease = function (event, simulated) {
  2522. if (event) {
  2523. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2524. if (!event.isPersistent()) {
  2525. event.constructor.release(event);
  2526. }
  2527. }
  2528. };
  2529. var executeDispatchesAndReleaseSimulated = function (e) {
  2530. return executeDispatchesAndRelease(e, true);
  2531. };
  2532. var executeDispatchesAndReleaseTopLevel = function (e) {
  2533. return executeDispatchesAndRelease(e, false);
  2534. };
  2535. var getDictionaryKey = function (inst) {
  2536. // Prevents V8 performance issue:
  2537. // https://github.com/facebook/react/pull/7232
  2538. return '.' + inst._rootNodeID;
  2539. };
  2540. function isInteractive(tag) {
  2541. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  2542. }
  2543. function shouldPreventMouseEvent(name, type, props) {
  2544. switch (name) {
  2545. case 'onClick':
  2546. case 'onClickCapture':
  2547. case 'onDoubleClick':
  2548. case 'onDoubleClickCapture':
  2549. case 'onMouseDown':
  2550. case 'onMouseDownCapture':
  2551. case 'onMouseMove':
  2552. case 'onMouseMoveCapture':
  2553. case 'onMouseUp':
  2554. case 'onMouseUpCapture':
  2555. return !!(props.disabled && isInteractive(type));
  2556. default:
  2557. return false;
  2558. }
  2559. }
  2560. /**
  2561. * This is a unified interface for event plugins to be installed and configured.
  2562. *
  2563. * Event plugins can implement the following properties:
  2564. *
  2565. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2566. * Required. When a top-level event is fired, this method is expected to
  2567. * extract synthetic events that will in turn be queued and dispatched.
  2568. *
  2569. * `eventTypes` {object}
  2570. * Optional, plugins that fire events must publish a mapping of registration
  2571. * names that are used to register listeners. Values of this mapping must
  2572. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2573. *
  2574. * `executeDispatch` {function(object, function, string)}
  2575. * Optional, allows plugins to override how an event gets dispatched. By
  2576. * default, the listener is simply invoked.
  2577. *
  2578. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2579. *
  2580. * @public
  2581. */
  2582. var EventPluginHub = {
  2583. /**
  2584. * Methods for injecting dependencies.
  2585. */
  2586. injection: {
  2587. /**
  2588. * @param {array} InjectedEventPluginOrder
  2589. * @public
  2590. */
  2591. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2592. /**
  2593. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2594. */
  2595. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2596. },
  2597. /**
  2598. * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
  2599. *
  2600. * @param {object} inst The instance, which is the source of events.
  2601. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2602. * @param {function} listener The callback to store.
  2603. */
  2604. putListener: function (inst, registrationName, listener) {
  2605. !(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;
  2606. var key = getDictionaryKey(inst);
  2607. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2608. bankForRegistrationName[key] = listener;
  2609. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2610. if (PluginModule && PluginModule.didPutListener) {
  2611. PluginModule.didPutListener(inst, registrationName, listener);
  2612. }
  2613. },
  2614. /**
  2615. * @param {object} inst The instance, which is the source of events.
  2616. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2617. * @return {?function} The stored callback.
  2618. */
  2619. getListener: function (inst, registrationName) {
  2620. // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  2621. // live here; needs to be moved to a better place soon
  2622. var bankForRegistrationName = listenerBank[registrationName];
  2623. if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
  2624. return null;
  2625. }
  2626. var key = getDictionaryKey(inst);
  2627. return bankForRegistrationName && bankForRegistrationName[key];
  2628. },
  2629. /**
  2630. * Deletes a listener from the registration bank.
  2631. *
  2632. * @param {object} inst The instance, which is the source of events.
  2633. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2634. */
  2635. deleteListener: function (inst, registrationName) {
  2636. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2637. if (PluginModule && PluginModule.willDeleteListener) {
  2638. PluginModule.willDeleteListener(inst, registrationName);
  2639. }
  2640. var bankForRegistrationName = listenerBank[registrationName];
  2641. // TODO: This should never be null -- when is it?
  2642. if (bankForRegistrationName) {
  2643. var key = getDictionaryKey(inst);
  2644. delete bankForRegistrationName[key];
  2645. }
  2646. },
  2647. /**
  2648. * Deletes all listeners for the DOM element with the supplied ID.
  2649. *
  2650. * @param {object} inst The instance, which is the source of events.
  2651. */
  2652. deleteAllListeners: function (inst) {
  2653. var key = getDictionaryKey(inst);
  2654. for (var registrationName in listenerBank) {
  2655. if (!listenerBank.hasOwnProperty(registrationName)) {
  2656. continue;
  2657. }
  2658. if (!listenerBank[registrationName][key]) {
  2659. continue;
  2660. }
  2661. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2662. if (PluginModule && PluginModule.willDeleteListener) {
  2663. PluginModule.willDeleteListener(inst, registrationName);
  2664. }
  2665. delete listenerBank[registrationName][key];
  2666. }
  2667. },
  2668. /**
  2669. * Allows registered plugins an opportunity to extract events from top-level
  2670. * native browser events.
  2671. *
  2672. * @return {*} An accumulation of synthetic events.
  2673. * @internal
  2674. */
  2675. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  2676. var events;
  2677. var plugins = EventPluginRegistry.plugins;
  2678. for (var i = 0; i < plugins.length; i++) {
  2679. // Not every plugin in the ordering may be loaded at runtime.
  2680. var possiblePlugin = plugins[i];
  2681. if (possiblePlugin) {
  2682. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  2683. if (extractedEvents) {
  2684. events = accumulateInto(events, extractedEvents);
  2685. }
  2686. }
  2687. }
  2688. return events;
  2689. },
  2690. /**
  2691. * Enqueues a synthetic event that should be dispatched when
  2692. * `processEventQueue` is invoked.
  2693. *
  2694. * @param {*} events An accumulation of synthetic events.
  2695. * @internal
  2696. */
  2697. enqueueEvents: function (events) {
  2698. if (events) {
  2699. eventQueue = accumulateInto(eventQueue, events);
  2700. }
  2701. },
  2702. /**
  2703. * Dispatches all synthetic events on the event queue.
  2704. *
  2705. * @internal
  2706. */
  2707. processEventQueue: function (simulated) {
  2708. // Set `eventQueue` to null before processing it so that we can tell if more
  2709. // events get enqueued while processing.
  2710. var processingEventQueue = eventQueue;
  2711. eventQueue = null;
  2712. if (simulated) {
  2713. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2714. } else {
  2715. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2716. }
  2717. !!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;
  2718. // This would be a good time to rethrow if any of the event handlers threw.
  2719. ReactErrorUtils.rethrowCaughtError();
  2720. },
  2721. /**
  2722. * These are needed for tests only. Do not use!
  2723. */
  2724. __purge: function () {
  2725. listenerBank = {};
  2726. },
  2727. __getListenerBank: function () {
  2728. return listenerBank;
  2729. }
  2730. };
  2731. module.exports = EventPluginHub;
  2732. /***/ }),
  2733. /* 27 */
  2734. /***/ (function(module, exports, __webpack_require__) {
  2735. "use strict";
  2736. /**
  2737. * Copyright 2013-present, Facebook, Inc.
  2738. * All rights reserved.
  2739. *
  2740. * This source code is licensed under the BSD-style license found in the
  2741. * LICENSE file in the root directory of this source tree. An additional grant
  2742. * of patent rights can be found in the PATENTS file in the same directory.
  2743. *
  2744. */
  2745. var EventPluginHub = __webpack_require__(26);
  2746. var EventPluginUtils = __webpack_require__(54);
  2747. var accumulateInto = __webpack_require__(87);
  2748. var forEachAccumulated = __webpack_require__(88);
  2749. var warning = __webpack_require__(1);
  2750. var getListener = EventPluginHub.getListener;
  2751. /**
  2752. * Some event types have a notion of different registration names for different
  2753. * "phases" of propagation. This finds listeners by a given phase.
  2754. */
  2755. function listenerAtPhase(inst, event, propagationPhase) {
  2756. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2757. return getListener(inst, registrationName);
  2758. }
  2759. /**
  2760. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2761. * here, allows us to not have to bind or create functions for each event.
  2762. * Mutating the event's members allows us to not have to create a wrapping
  2763. * "dispatch" object that pairs the event with the listener.
  2764. */
  2765. function accumulateDirectionalDispatches(inst, phase, event) {
  2766. if (false) {
  2767. process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
  2768. }
  2769. var listener = listenerAtPhase(inst, event, phase);
  2770. if (listener) {
  2771. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2772. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2773. }
  2774. }
  2775. /**
  2776. * Collect dispatches (must be entirely collected before dispatching - see unit
  2777. * tests). Lazily allocate the array to conserve memory. We must loop through
  2778. * each event and perform the traversal for each one. We cannot perform a
  2779. * single traversal for the entire collection of events because each event may
  2780. * have a different target.
  2781. */
  2782. function accumulateTwoPhaseDispatchesSingle(event) {
  2783. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2784. EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  2785. }
  2786. }
  2787. /**
  2788. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2789. */
  2790. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2791. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2792. var targetInst = event._targetInst;
  2793. var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
  2794. EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
  2795. }
  2796. }
  2797. /**
  2798. * Accumulates without regard to direction, does not look for phased
  2799. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2800. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2801. */
  2802. function accumulateDispatches(inst, ignoredDirection, event) {
  2803. if (event && event.dispatchConfig.registrationName) {
  2804. var registrationName = event.dispatchConfig.registrationName;
  2805. var listener = getListener(inst, registrationName);
  2806. if (listener) {
  2807. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2808. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2809. }
  2810. }
  2811. }
  2812. /**
  2813. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2814. * `dispatchMarker`.
  2815. * @param {SyntheticEvent} event
  2816. */
  2817. function accumulateDirectDispatchesSingle(event) {
  2818. if (event && event.dispatchConfig.registrationName) {
  2819. accumulateDispatches(event._targetInst, null, event);
  2820. }
  2821. }
  2822. function accumulateTwoPhaseDispatches(events) {
  2823. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2824. }
  2825. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2826. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2827. }
  2828. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  2829. EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  2830. }
  2831. function accumulateDirectDispatches(events) {
  2832. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2833. }
  2834. /**
  2835. * A small set of propagation patterns, each of which will accept a small amount
  2836. * of information, and generate a set of "dispatch ready event objects" - which
  2837. * are sets of events that have already been annotated with a set of dispatched
  2838. * listener functions/ids. The API is designed this way to discourage these
  2839. * propagation strategies from actually executing the dispatches, since we
  2840. * always want to collect the entire set of dispatches before executing event a
  2841. * single one.
  2842. *
  2843. * @constructor EventPropagators
  2844. */
  2845. var EventPropagators = {
  2846. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2847. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2848. accumulateDirectDispatches: accumulateDirectDispatches,
  2849. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2850. };
  2851. module.exports = EventPropagators;
  2852. /***/ }),
  2853. /* 28 */
  2854. /***/ (function(module, exports, __webpack_require__) {
  2855. "use strict";
  2856. /**
  2857. * Copyright 2013-present, Facebook, Inc.
  2858. * All rights reserved.
  2859. *
  2860. * This source code is licensed under the BSD-style license found in the
  2861. * LICENSE file in the root directory of this source tree. An additional grant
  2862. * of patent rights can be found in the PATENTS file in the same directory.
  2863. *
  2864. */
  2865. /**
  2866. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  2867. * instance (key) and the internal representation (value). This allows public
  2868. * methods to accept the user facing instance as an argument and map them back
  2869. * to internal methods.
  2870. */
  2871. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  2872. var ReactInstanceMap = {
  2873. /**
  2874. * This API should be called `delete` but we'd have to make sure to always
  2875. * transform these to strings for IE support. When this transform is fully
  2876. * supported we can rename it.
  2877. */
  2878. remove: function (key) {
  2879. key._reactInternalInstance = undefined;
  2880. },
  2881. get: function (key) {
  2882. return key._reactInternalInstance;
  2883. },
  2884. has: function (key) {
  2885. return key._reactInternalInstance !== undefined;
  2886. },
  2887. set: function (key, value) {
  2888. key._reactInternalInstance = value;
  2889. }
  2890. };
  2891. module.exports = ReactInstanceMap;
  2892. /***/ }),
  2893. /* 29 */
  2894. /***/ (function(module, exports, __webpack_require__) {
  2895. "use strict";
  2896. /**
  2897. * Copyright 2013-present, Facebook, Inc.
  2898. * All rights reserved.
  2899. *
  2900. * This source code is licensed under the BSD-style license found in the
  2901. * LICENSE file in the root directory of this source tree. An additional grant
  2902. * of patent rights can be found in the PATENTS file in the same directory.
  2903. *
  2904. */
  2905. var SyntheticEvent = __webpack_require__(13);
  2906. var getEventTarget = __webpack_require__(63);
  2907. /**
  2908. * @interface UIEvent
  2909. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  2910. */
  2911. var UIEventInterface = {
  2912. view: function (event) {
  2913. if (event.view) {
  2914. return event.view;
  2915. }
  2916. var target = getEventTarget(event);
  2917. if (target.window === target) {
  2918. // target is a window object
  2919. return target;
  2920. }
  2921. var doc = target.ownerDocument;
  2922. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2923. if (doc) {
  2924. return doc.defaultView || doc.parentWindow;
  2925. } else {
  2926. return window;
  2927. }
  2928. },
  2929. detail: function (event) {
  2930. return event.detail || 0;
  2931. }
  2932. };
  2933. /**
  2934. * @param {object} dispatchConfig Configuration used to dispatch this event.
  2935. * @param {string} dispatchMarker Marker identifying the event target.
  2936. * @param {object} nativeEvent Native browser event.
  2937. * @extends {SyntheticEvent}
  2938. */
  2939. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  2940. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  2941. }
  2942. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  2943. module.exports = SyntheticUIEvent;
  2944. /***/ }),
  2945. /* 30 */
  2946. /***/ (function(module, exports, __webpack_require__) {
  2947. "use strict";
  2948. /**
  2949. * @author oldj
  2950. * @blog https://oldj.net
  2951. */
  2952. var _Agent = __webpack_require__(4);
  2953. var _Agent2 = _interopRequireDefault(_Agent);
  2954. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2955. var req = __webpack_require__(244);
  2956. exports.reg = function (app) {
  2957. req.keys().map(function (fn) {
  2958. var m = fn.match(/^\.\/([\w\-]+)\.js$/);
  2959. var name = m ? m[1] : null;
  2960. if (!name || name === 'index') return;
  2961. _Agent2.default.on(name, function () {
  2962. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2963. args[_key] = arguments[_key];
  2964. }
  2965. var fn = __webpack_require__(243)("./" + name);
  2966. fn.apply(undefined, [app].concat(args));
  2967. });
  2968. });
  2969. };
  2970. /***/ }),
  2971. /* 31 */
  2972. /***/ (function(module, exports, __webpack_require__) {
  2973. "use strict";
  2974. /**
  2975. * Copyright 2013-present, Facebook, Inc.
  2976. * All rights reserved.
  2977. *
  2978. * This source code is licensed under the BSD-style license found in the
  2979. * LICENSE file in the root directory of this source tree. An additional grant
  2980. * of patent rights can be found in the PATENTS file in the same directory.
  2981. *
  2982. */
  2983. var _assign = __webpack_require__(3);
  2984. var EventPluginRegistry = __webpack_require__(53);
  2985. var ReactEventEmitterMixin = __webpack_require__(177);
  2986. var ViewportMetrics = __webpack_require__(86);
  2987. var getVendorPrefixedEventName = __webpack_require__(210);
  2988. var isEventSupported = __webpack_require__(64);
  2989. /**
  2990. * Summary of `ReactBrowserEventEmitter` event handling:
  2991. *
  2992. * - Top-level delegation is used to trap most native browser events. This
  2993. * may only occur in the main thread and is the responsibility of
  2994. * ReactEventListener, which is injected and can therefore support pluggable
  2995. * event sources. This is the only work that occurs in the main thread.
  2996. *
  2997. * - We normalize and de-duplicate events to account for browser quirks. This
  2998. * may be done in the worker thread.
  2999. *
  3000. * - Forward these native events (with the associated top-level type used to
  3001. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3002. * to extract any synthetic events.
  3003. *
  3004. * - The `EventPluginHub` will then process each event by annotating them with
  3005. * "dispatches", a sequence of listeners and IDs that care about that event.
  3006. *
  3007. * - The `EventPluginHub` then dispatches the events.
  3008. *
  3009. * Overview of React and the event system:
  3010. *
  3011. * +------------+ .
  3012. * | DOM | .
  3013. * +------------+ .
  3014. * | .
  3015. * v .
  3016. * +------------+ .
  3017. * | ReactEvent | .
  3018. * | Listener | .
  3019. * +------------+ . +-----------+
  3020. * | . +--------+|SimpleEvent|
  3021. * | . | |Plugin |
  3022. * +-----|------+ . v +-----------+
  3023. * | | | . +--------------+ +------------+
  3024. * | +-----------.--->|EventPluginHub| | Event |
  3025. * | | . | | +-----------+ | Propagators|
  3026. * | ReactEvent | . | | |TapEvent | |------------|
  3027. * | Emitter | . | |<---+|Plugin | |other plugin|
  3028. * | | . | | +-----------+ | utilities |
  3029. * | +-----------.--->| | +------------+
  3030. * | | | . +--------------+
  3031. * +-----|------+ . ^ +-----------+
  3032. * | . | |Enter/Leave|
  3033. * + . +-------+|Plugin |
  3034. * +-------------+ . +-----------+
  3035. * | application | .
  3036. * |-------------| .
  3037. * | | .
  3038. * | | .
  3039. * +-------------+ .
  3040. * .
  3041. * React Core . General Purpose Event Plugin System
  3042. */
  3043. var hasEventPageXY;
  3044. var alreadyListeningTo = {};
  3045. var isMonitoringScrollValue = false;
  3046. var reactTopListenersCounter = 0;
  3047. // For events like 'submit' which don't consistently bubble (which we trap at a
  3048. // lower node than `document`), binding at `document` would cause duplicate
  3049. // events so we don't include them here
  3050. var topEventMapping = {
  3051. topAbort: 'abort',
  3052. topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
  3053. topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
  3054. topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
  3055. topBlur: 'blur',
  3056. topCanPlay: 'canplay',
  3057. topCanPlayThrough: 'canplaythrough',
  3058. topChange: 'change',
  3059. topClick: 'click',
  3060. topCompositionEnd: 'compositionend',
  3061. topCompositionStart: 'compositionstart',
  3062. topCompositionUpdate: 'compositionupdate',
  3063. topContextMenu: 'contextmenu',
  3064. topCopy: 'copy',
  3065. topCut: 'cut',
  3066. topDoubleClick: 'dblclick',
  3067. topDrag: 'drag',
  3068. topDragEnd: 'dragend',
  3069. topDragEnter: 'dragenter',
  3070. topDragExit: 'dragexit',
  3071. topDragLeave: 'dragleave',
  3072. topDragOver: 'dragover',
  3073. topDragStart: 'dragstart',
  3074. topDrop: 'drop',
  3075. topDurationChange: 'durationchange',
  3076. topEmptied: 'emptied',
  3077. topEncrypted: 'encrypted',
  3078. topEnded: 'ended',
  3079. topError: 'error',
  3080. topFocus: 'focus',
  3081. topInput: 'input',
  3082. topKeyDown: 'keydown',
  3083. topKeyPress: 'keypress',
  3084. topKeyUp: 'keyup',
  3085. topLoadedData: 'loadeddata',
  3086. topLoadedMetadata: 'loadedmetadata',
  3087. topLoadStart: 'loadstart',
  3088. topMouseDown: 'mousedown',
  3089. topMouseMove: 'mousemove',
  3090. topMouseOut: 'mouseout',
  3091. topMouseOver: 'mouseover',
  3092. topMouseUp: 'mouseup',
  3093. topPaste: 'paste',
  3094. topPause: 'pause',
  3095. topPlay: 'play',
  3096. topPlaying: 'playing',
  3097. topProgress: 'progress',
  3098. topRateChange: 'ratechange',
  3099. topScroll: 'scroll',
  3100. topSeeked: 'seeked',
  3101. topSeeking: 'seeking',
  3102. topSelectionChange: 'selectionchange',
  3103. topStalled: 'stalled',
  3104. topSuspend: 'suspend',
  3105. topTextInput: 'textInput',
  3106. topTimeUpdate: 'timeupdate',
  3107. topTouchCancel: 'touchcancel',
  3108. topTouchEnd: 'touchend',
  3109. topTouchMove: 'touchmove',
  3110. topTouchStart: 'touchstart',
  3111. topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
  3112. topVolumeChange: 'volumechange',
  3113. topWaiting: 'waiting',
  3114. topWheel: 'wheel'
  3115. };
  3116. /**
  3117. * To ensure no conflicts with other potential React instances on the page
  3118. */
  3119. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3120. function getListeningForDocument(mountAt) {
  3121. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3122. // directly.
  3123. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3124. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3125. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3126. }
  3127. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3128. }
  3129. /**
  3130. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3131. * example:
  3132. *
  3133. * EventPluginHub.putListener('myID', 'onClick', myFunction);
  3134. *
  3135. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3136. *
  3137. * @internal
  3138. */
  3139. var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
  3140. /**
  3141. * Injectable event backend
  3142. */
  3143. ReactEventListener: null,
  3144. injection: {
  3145. /**
  3146. * @param {object} ReactEventListener
  3147. */
  3148. injectReactEventListener: function (ReactEventListener) {
  3149. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3150. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3151. }
  3152. },
  3153. /**
  3154. * Sets whether or not any created callbacks should be enabled.
  3155. *
  3156. * @param {boolean} enabled True if callbacks should be enabled.
  3157. */
  3158. setEnabled: function (enabled) {
  3159. if (ReactBrowserEventEmitter.ReactEventListener) {
  3160. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3161. }
  3162. },
  3163. /**
  3164. * @return {boolean} True if callbacks are enabled.
  3165. */
  3166. isEnabled: function () {
  3167. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3168. },
  3169. /**
  3170. * We listen for bubbled touch events on the document object.
  3171. *
  3172. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3173. * mounting `onmousemove` events at some node that was not the document
  3174. * element. The symptoms were that if your mouse is not moving over something
  3175. * contained within that mount point (for example on the background) the
  3176. * top-level listeners for `onmousemove` won't be called. However, if you
  3177. * register the `mousemove` on the document object, then it will of course
  3178. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3179. * top-level listeners to the document object only, at least for these
  3180. * movement types of events and possibly all events.
  3181. *
  3182. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3183. *
  3184. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3185. * they bubble to document.
  3186. *
  3187. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3188. * @param {object} contentDocumentHandle Document which owns the container
  3189. */
  3190. listenTo: function (registrationName, contentDocumentHandle) {
  3191. var mountAt = contentDocumentHandle;
  3192. var isListening = getListeningForDocument(mountAt);
  3193. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3194. for (var i = 0; i < dependencies.length; i++) {
  3195. var dependency = dependencies[i];
  3196. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3197. if (dependency === 'topWheel') {
  3198. if (isEventSupported('wheel')) {
  3199. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
  3200. } else if (isEventSupported('mousewheel')) {
  3201. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
  3202. } else {
  3203. // Firefox needs to capture a different mouse scroll event.
  3204. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3205. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
  3206. }
  3207. } else if (dependency === 'topScroll') {
  3208. if (isEventSupported('scroll', true)) {
  3209. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
  3210. } else {
  3211. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3212. }
  3213. } else if (dependency === 'topFocus' || dependency === 'topBlur') {
  3214. if (isEventSupported('focus', true)) {
  3215. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
  3216. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
  3217. } else if (isEventSupported('focusin')) {
  3218. // IE has `focusin` and `focusout` events which bubble.
  3219. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3220. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
  3221. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
  3222. }
  3223. // to make sure blur and focus event listeners are only attached once
  3224. isListening.topBlur = true;
  3225. isListening.topFocus = true;
  3226. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3227. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3228. }
  3229. isListening[dependency] = true;
  3230. }
  3231. }
  3232. },
  3233. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3234. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3235. },
  3236. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3237. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3238. },
  3239. /**
  3240. * Protect against document.createEvent() returning null
  3241. * Some popup blocker extensions appear to do this:
  3242. * https://github.com/facebook/react/issues/6887
  3243. */
  3244. supportsEventPageXY: function () {
  3245. if (!document.createEvent) {
  3246. return false;
  3247. }
  3248. var ev = document.createEvent('MouseEvent');
  3249. return ev != null && 'pageX' in ev;
  3250. },
  3251. /**
  3252. * Listens to window scroll and resize events. We cache scroll values so that
  3253. * application code can access them without triggering reflows.
  3254. *
  3255. * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
  3256. * pageX/pageY isn't supported (legacy browsers).
  3257. *
  3258. * NOTE: Scroll events do not bubble.
  3259. *
  3260. * @see http://www.quirksmode.org/dom/events/scroll.html
  3261. */
  3262. ensureScrollValueMonitoring: function () {
  3263. if (hasEventPageXY === undefined) {
  3264. hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
  3265. }
  3266. if (!hasEventPageXY && !isMonitoringScrollValue) {
  3267. var refresh = ViewportMetrics.refreshScrollValues;
  3268. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3269. isMonitoringScrollValue = true;
  3270. }
  3271. }
  3272. });
  3273. module.exports = ReactBrowserEventEmitter;
  3274. /***/ }),
  3275. /* 32 */
  3276. /***/ (function(module, exports, __webpack_require__) {
  3277. "use strict";
  3278. /**
  3279. * Copyright 2013-present, Facebook, Inc.
  3280. * All rights reserved.
  3281. *
  3282. * This source code is licensed under the BSD-style license found in the
  3283. * LICENSE file in the root directory of this source tree. An additional grant
  3284. * of patent rights can be found in the PATENTS file in the same directory.
  3285. *
  3286. */
  3287. var SyntheticUIEvent = __webpack_require__(29);
  3288. var ViewportMetrics = __webpack_require__(86);
  3289. var getEventModifierState = __webpack_require__(62);
  3290. /**
  3291. * @interface MouseEvent
  3292. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  3293. */
  3294. var MouseEventInterface = {
  3295. screenX: null,
  3296. screenY: null,
  3297. clientX: null,
  3298. clientY: null,
  3299. ctrlKey: null,
  3300. shiftKey: null,
  3301. altKey: null,
  3302. metaKey: null,
  3303. getModifierState: getEventModifierState,
  3304. button: function (event) {
  3305. // Webkit, Firefox, IE9+
  3306. // which: 1 2 3
  3307. // button: 0 1 2 (standard)
  3308. var button = event.button;
  3309. if ('which' in event) {
  3310. return button;
  3311. }
  3312. // IE<9
  3313. // which: undefined
  3314. // button: 0 0 0
  3315. // button: 1 4 2 (onmouseup)
  3316. return button === 2 ? 2 : button === 4 ? 1 : 0;
  3317. },
  3318. buttons: null,
  3319. relatedTarget: function (event) {
  3320. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  3321. },
  3322. // "Proprietary" Interface.
  3323. pageX: function (event) {
  3324. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  3325. },
  3326. pageY: function (event) {
  3327. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  3328. }
  3329. };
  3330. /**
  3331. * @param {object} dispatchConfig Configuration used to dispatch this event.
  3332. * @param {string} dispatchMarker Marker identifying the event target.
  3333. * @param {object} nativeEvent Native browser event.
  3334. * @extends {SyntheticUIEvent}
  3335. */
  3336. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  3337. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  3338. }
  3339. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  3340. module.exports = SyntheticMouseEvent;
  3341. /***/ }),
  3342. /* 33 */
  3343. /***/ (function(module, exports, __webpack_require__) {
  3344. "use strict";
  3345. /**
  3346. * Copyright 2013-present, Facebook, Inc.
  3347. * All rights reserved.
  3348. *
  3349. * This source code is licensed under the BSD-style license found in the
  3350. * LICENSE file in the root directory of this source tree. An additional grant
  3351. * of patent rights can be found in the PATENTS file in the same directory.
  3352. *
  3353. *
  3354. */
  3355. var _prodInvariant = __webpack_require__(2);
  3356. var invariant = __webpack_require__(0);
  3357. var OBSERVED_ERROR = {};
  3358. /**
  3359. * `Transaction` creates a black box that is able to wrap any method such that
  3360. * certain invariants are maintained before and after the method is invoked
  3361. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  3362. * instantiates a transaction can provide enforcers of the invariants at
  3363. * creation time. The `Transaction` class itself will supply one additional
  3364. * automatic invariant for you - the invariant that any transaction instance
  3365. * should not be run while it is already being run. You would typically create a
  3366. * single instance of a `Transaction` for reuse multiple times, that potentially
  3367. * is used to wrap several different methods. Wrappers are extremely simple -
  3368. * they only require implementing two methods.
  3369. *
  3370. * <pre>
  3371. * wrappers (injected at creation time)
  3372. * + +
  3373. * | |
  3374. * +-----------------|--------|--------------+
  3375. * | v | |
  3376. * | +---------------+ | |
  3377. * | +--| wrapper1 |---|----+ |
  3378. * | | +---------------+ v | |
  3379. * | | +-------------+ | |
  3380. * | | +----| wrapper2 |--------+ |
  3381. * | | | +-------------+ | | |
  3382. * | | | | | |
  3383. * | v v v v | wrapper
  3384. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  3385. * perform(anyMethod) | | | | | | | | | | | | maintained
  3386. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  3387. * | | | | | | | | | | | |
  3388. * | | | | | | | | | | | |
  3389. * | | | | | | | | | | | |
  3390. * | +---+ +---+ +---------+ +---+ +---+ |
  3391. * | initialize close |
  3392. * +-----------------------------------------+
  3393. * </pre>
  3394. *
  3395. * Use cases:
  3396. * - Preserving the input selection ranges before/after reconciliation.
  3397. * Restoring selection even in the event of an unexpected error.
  3398. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  3399. * while guaranteeing that afterwards, the event system is reactivated.
  3400. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  3401. * reconciliation takes place in a worker thread.
  3402. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  3403. * content.
  3404. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  3405. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  3406. * - (Future use case): Layout calculations before and after DOM updates.
  3407. *
  3408. * Transactional plugin API:
  3409. * - A module that has an `initialize` method that returns any precomputation.
  3410. * - and a `close` method that accepts the precomputation. `close` is invoked
  3411. * when the wrapped process is completed, or has failed.
  3412. *
  3413. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  3414. * that implement `initialize` and `close`.
  3415. * @return {Transaction} Single transaction for reuse in thread.
  3416. *
  3417. * @class Transaction
  3418. */
  3419. var TransactionImpl = {
  3420. /**
  3421. * Sets up this instance so that it is prepared for collecting metrics. Does
  3422. * so such that this setup method may be used on an instance that is already
  3423. * initialized, in a way that does not consume additional memory upon reuse.
  3424. * That can be useful if you decide to make your subclass of this mixin a
  3425. * "PooledClass".
  3426. */
  3427. reinitializeTransaction: function () {
  3428. this.transactionWrappers = this.getTransactionWrappers();
  3429. if (this.wrapperInitData) {
  3430. this.wrapperInitData.length = 0;
  3431. } else {
  3432. this.wrapperInitData = [];
  3433. }
  3434. this._isInTransaction = false;
  3435. },
  3436. _isInTransaction: false,
  3437. /**
  3438. * @abstract
  3439. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  3440. */
  3441. getTransactionWrappers: null,
  3442. isInTransaction: function () {
  3443. return !!this._isInTransaction;
  3444. },
  3445. /**
  3446. * Executes the function within a safety window. Use this for the top level
  3447. * methods that result in large amounts of computation/mutations that would
  3448. * need to be safety checked. The optional arguments helps prevent the need
  3449. * to bind in many cases.
  3450. *
  3451. * @param {function} method Member of scope to call.
  3452. * @param {Object} scope Scope to invoke from.
  3453. * @param {Object?=} a Argument to pass to the method.
  3454. * @param {Object?=} b Argument to pass to the method.
  3455. * @param {Object?=} c Argument to pass to the method.
  3456. * @param {Object?=} d Argument to pass to the method.
  3457. * @param {Object?=} e Argument to pass to the method.
  3458. * @param {Object?=} f Argument to pass to the method.
  3459. *
  3460. * @return {*} Return value from `method`.
  3461. */
  3462. perform: function (method, scope, a, b, c, d, e, f) {
  3463. !!this.isInTransaction() ? false ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
  3464. var errorThrown;
  3465. var ret;
  3466. try {
  3467. this._isInTransaction = true;
  3468. // Catching errors makes debugging more difficult, so we start with
  3469. // errorThrown set to true before setting it to false after calling
  3470. // close -- if it's still set to true in the finally block, it means
  3471. // one of these calls threw.
  3472. errorThrown = true;
  3473. this.initializeAll(0);
  3474. ret = method.call(scope, a, b, c, d, e, f);
  3475. errorThrown = false;
  3476. } finally {
  3477. try {
  3478. if (errorThrown) {
  3479. // If `method` throws, prefer to show that stack trace over any thrown
  3480. // by invoking `closeAll`.
  3481. try {
  3482. this.closeAll(0);
  3483. } catch (err) {}
  3484. } else {
  3485. // Since `method` didn't throw, we don't want to silence the exception
  3486. // here.
  3487. this.closeAll(0);
  3488. }
  3489. } finally {
  3490. this._isInTransaction = false;
  3491. }
  3492. }
  3493. return ret;
  3494. },
  3495. initializeAll: function (startIndex) {
  3496. var transactionWrappers = this.transactionWrappers;
  3497. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3498. var wrapper = transactionWrappers[i];
  3499. try {
  3500. // Catching errors makes debugging more difficult, so we start with the
  3501. // OBSERVED_ERROR state before overwriting it with the real return value
  3502. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  3503. // block, it means wrapper.initialize threw.
  3504. this.wrapperInitData[i] = OBSERVED_ERROR;
  3505. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  3506. } finally {
  3507. if (this.wrapperInitData[i] === OBSERVED_ERROR) {
  3508. // The initializer for wrapper i threw an error; initialize the
  3509. // remaining wrappers but silence any exceptions from them to ensure
  3510. // that the first error is the one to bubble up.
  3511. try {
  3512. this.initializeAll(i + 1);
  3513. } catch (err) {}
  3514. }
  3515. }
  3516. }
  3517. },
  3518. /**
  3519. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  3520. * them the respective return values of `this.transactionWrappers.init[i]`
  3521. * (`close`rs that correspond to initializers that failed will not be
  3522. * invoked).
  3523. */
  3524. closeAll: function (startIndex) {
  3525. !this.isInTransaction() ? false ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
  3526. var transactionWrappers = this.transactionWrappers;
  3527. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3528. var wrapper = transactionWrappers[i];
  3529. var initData = this.wrapperInitData[i];
  3530. var errorThrown;
  3531. try {
  3532. // Catching errors makes debugging more difficult, so we start with
  3533. // errorThrown set to true before setting it to false after calling
  3534. // close -- if it's still set to true in the finally block, it means
  3535. // wrapper.close threw.
  3536. errorThrown = true;
  3537. if (initData !== OBSERVED_ERROR && wrapper.close) {
  3538. wrapper.close.call(this, initData);
  3539. }
  3540. errorThrown = false;
  3541. } finally {
  3542. if (errorThrown) {
  3543. // The closer for wrapper i threw an error; close the remaining
  3544. // wrappers but silence any exceptions from them to ensure that the
  3545. // first error is the one to bubble up.
  3546. try {
  3547. this.closeAll(i + 1);
  3548. } catch (e) {}
  3549. }
  3550. }
  3551. }
  3552. this.wrapperInitData.length = 0;
  3553. }
  3554. };
  3555. module.exports = TransactionImpl;
  3556. /***/ }),
  3557. /* 34 */
  3558. /***/ (function(module, exports, __webpack_require__) {
  3559. "use strict";
  3560. /**
  3561. * Copyright 2016-present, Facebook, Inc.
  3562. * All rights reserved.
  3563. *
  3564. * This source code is licensed under the BSD-style license found in the
  3565. * LICENSE file in the root directory of this source tree. An additional grant
  3566. * of patent rights can be found in the PATENTS file in the same directory.
  3567. *
  3568. * Based on the escape-html library, which is used under the MIT License below:
  3569. *
  3570. * Copyright (c) 2012-2013 TJ Holowaychuk
  3571. * Copyright (c) 2015 Andreas Lubbe
  3572. * Copyright (c) 2015 Tiancheng "Timothy" Gu
  3573. *
  3574. * Permission is hereby granted, free of charge, to any person obtaining
  3575. * a copy of this software and associated documentation files (the
  3576. * 'Software'), to deal in the Software without restriction, including
  3577. * without limitation the rights to use, copy, modify, merge, publish,
  3578. * distribute, sublicense, and/or sell copies of the Software, and to
  3579. * permit persons to whom the Software is furnished to do so, subject to
  3580. * the following conditions:
  3581. *
  3582. * The above copyright notice and this permission notice shall be
  3583. * included in all copies or substantial portions of the Software.
  3584. *
  3585. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  3586. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3587. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  3588. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  3589. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  3590. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  3591. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3592. *
  3593. */
  3594. // code copied and modified from escape-html
  3595. /**
  3596. * Module variables.
  3597. * @private
  3598. */
  3599. var matchHtmlRegExp = /["'&<>]/;
  3600. /**
  3601. * Escape special characters in the given string of html.
  3602. *
  3603. * @param {string} string The string to escape for inserting into HTML
  3604. * @return {string}
  3605. * @public
  3606. */
  3607. function escapeHtml(string) {
  3608. var str = '' + string;
  3609. var match = matchHtmlRegExp.exec(str);
  3610. if (!match) {
  3611. return str;
  3612. }
  3613. var escape;
  3614. var html = '';
  3615. var index = 0;
  3616. var lastIndex = 0;
  3617. for (index = match.index; index < str.length; index++) {
  3618. switch (str.charCodeAt(index)) {
  3619. case 34:
  3620. // "
  3621. escape = '&quot;';
  3622. break;
  3623. case 38:
  3624. // &
  3625. escape = '&amp;';
  3626. break;
  3627. case 39:
  3628. // '
  3629. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  3630. break;
  3631. case 60:
  3632. // <
  3633. escape = '&lt;';
  3634. break;
  3635. case 62:
  3636. // >
  3637. escape = '&gt;';
  3638. break;
  3639. default:
  3640. continue;
  3641. }
  3642. if (lastIndex !== index) {
  3643. html += str.substring(lastIndex, index);
  3644. }
  3645. lastIndex = index + 1;
  3646. html += escape;
  3647. }
  3648. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  3649. }
  3650. // end code copied and modified from escape-html
  3651. /**
  3652. * Escapes text to prevent scripting attacks.
  3653. *
  3654. * @param {*} text Text value to escape.
  3655. * @return {string} An escaped string.
  3656. */
  3657. function escapeTextContentForBrowser(text) {
  3658. if (typeof text === 'boolean' || typeof text === 'number') {
  3659. // this shortcircuit helps perf for types that we know will never have
  3660. // special characters, especially given that this function is used often
  3661. // for numeric dom ids.
  3662. return '' + text;
  3663. }
  3664. return escapeHtml(text);
  3665. }
  3666. module.exports = escapeTextContentForBrowser;
  3667. /***/ }),
  3668. /* 35 */
  3669. /***/ (function(module, exports, __webpack_require__) {
  3670. "use strict";
  3671. /**
  3672. * Copyright 2013-present, Facebook, Inc.
  3673. * All rights reserved.
  3674. *
  3675. * This source code is licensed under the BSD-style license found in the
  3676. * LICENSE file in the root directory of this source tree. An additional grant
  3677. * of patent rights can be found in the PATENTS file in the same directory.
  3678. *
  3679. */
  3680. var ExecutionEnvironment = __webpack_require__(8);
  3681. var DOMNamespaces = __webpack_require__(52);
  3682. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  3683. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  3684. var createMicrosoftUnsafeLocalFunction = __webpack_require__(60);
  3685. // SVG temp container for IE lacking innerHTML
  3686. var reusableSVGContainer;
  3687. /**
  3688. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  3689. * even in IE8.
  3690. *
  3691. * @param {DOMElement} node
  3692. * @param {string} html
  3693. * @internal
  3694. */
  3695. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  3696. // IE does not have innerHTML for SVG nodes, so instead we inject the
  3697. // new markup in a temp node and then move the child nodes across into
  3698. // the target node
  3699. if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
  3700. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  3701. reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  3702. var svgNode = reusableSVGContainer.firstChild;
  3703. while (svgNode.firstChild) {
  3704. node.appendChild(svgNode.firstChild);
  3705. }
  3706. } else {
  3707. node.innerHTML = html;
  3708. }
  3709. });
  3710. if (ExecutionEnvironment.canUseDOM) {
  3711. // IE8: When updating a just created node with innerHTML only leading
  3712. // whitespace is removed. When updating an existing node with innerHTML
  3713. // whitespace in root TextNodes is also collapsed.
  3714. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  3715. // Feature detection; only IE8 is known to behave improperly like this.
  3716. var testElement = document.createElement('div');
  3717. testElement.innerHTML = ' ';
  3718. if (testElement.innerHTML === '') {
  3719. setInnerHTML = function (node, html) {
  3720. // Magic theory: IE8 supposedly differentiates between added and updated
  3721. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  3722. // from worse whitespace behavior. Re-adding a node like this triggers
  3723. // the initial and more favorable whitespace behavior.
  3724. // TODO: What to do on a detached node?
  3725. if (node.parentNode) {
  3726. node.parentNode.replaceChild(node, node);
  3727. }
  3728. // We also implement a workaround for non-visible tags disappearing into
  3729. // thin air on IE8, this only happens if there is no visible text
  3730. // in-front of the non-visible tags. Piggyback on the whitespace fix
  3731. // and simply check if any non-visible tags appear in the source.
  3732. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  3733. // Recover leading whitespace by temporarily prepending any character.
  3734. // \uFEFF has the potential advantage of being zero-width/invisible.
  3735. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  3736. // in hopes that this is preserved even if "\uFEFF" is transformed to
  3737. // the actual Unicode character (by Babel, for example).
  3738. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  3739. node.innerHTML = String.fromCharCode(0xFEFF) + html;
  3740. // deleteData leaves an empty `TextNode` which offsets the index of all
  3741. // children. Definitely want to avoid this.
  3742. var textNode = node.firstChild;
  3743. if (textNode.data.length === 1) {
  3744. node.removeChild(textNode);
  3745. } else {
  3746. textNode.deleteData(0, 1);
  3747. }
  3748. } else {
  3749. node.innerHTML = html;
  3750. }
  3751. };
  3752. }
  3753. testElement = null;
  3754. }
  3755. module.exports = setInnerHTML;
  3756. /***/ }),
  3757. /* 36 */
  3758. /***/ (function(module, exports, __webpack_require__) {
  3759. "use strict";
  3760. /**
  3761. * @author oldj
  3762. * @blog http://oldj.net
  3763. */
  3764. module.exports = function (app, msg) {
  3765. alert(msg);
  3766. };
  3767. /***/ }),
  3768. /* 37 */
  3769. /***/ (function(module, exports, __webpack_require__) {
  3770. "use strict";
  3771. /**
  3772. * @author oldj
  3773. * @blog https://oldj.net
  3774. */
  3775. var _Agent = __webpack_require__(4);
  3776. var _Agent2 = _interopRequireDefault(_Agent);
  3777. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3778. module.exports = function (app, hosts) {
  3779. var list = app.state.list;
  3780. _Agent2.default.pact('checkNeedRemoteRefresh', list, hosts).then(function (list) {
  3781. if (!list) return;
  3782. _Agent2.default.emit('list_updated', list);
  3783. }).catch(function (e) {
  3784. console.log(e);
  3785. });
  3786. };
  3787. /***/ }),
  3788. /* 38 */
  3789. /***/ (function(module, exports, __webpack_require__) {
  3790. "use strict";
  3791. /**
  3792. * @author oldj
  3793. * @blog https://oldj.net
  3794. */
  3795. var _Agent = __webpack_require__(4);
  3796. var _Agent2 = _interopRequireDefault(_Agent);
  3797. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3798. module.exports = function (app, hosts) {
  3799. var list = app.state.list;
  3800. var idx = list.findIndex(function (item) {
  3801. return item.id === hosts.id;
  3802. });
  3803. if (idx === -1) {
  3804. return;
  3805. }
  3806. list.splice(idx, 1);
  3807. _Agent2.default.pact('saveHosts', list).then(function () {
  3808. app.setState({ list: list }, function () {
  3809. // 选中下一个 hosts
  3810. var next_hosts = list[idx] || list[idx - 1] || null;
  3811. if (next_hosts) {
  3812. app.setState({ current: next_hosts });
  3813. }
  3814. });
  3815. }).catch(function (e) {
  3816. return console.log(e);
  3817. });
  3818. };
  3819. /***/ }),
  3820. /* 39 */
  3821. /***/ (function(module, exports, __webpack_require__) {
  3822. "use strict";
  3823. /**
  3824. * @author oldj
  3825. * @blog https://oldj.net
  3826. */
  3827. var _Agent = __webpack_require__(4);
  3828. var _Agent2 = _interopRequireDefault(_Agent);
  3829. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3830. module.exports = function () {
  3831. _Agent2.default.pact('esc');
  3832. _Agent2.default.pact('sudoCancel');
  3833. };
  3834. /***/ }),
  3835. /* 40 */
  3836. /***/ (function(module, exports, __webpack_require__) {
  3837. "use strict";
  3838. /**
  3839. * @author oldj
  3840. * @blog https://oldj.net
  3841. */
  3842. module.exports = function (app, callback) {
  3843. var list = app.state.list;
  3844. var ids = list.filter(function (item) {
  3845. return item.on;
  3846. }).map(function (item) {
  3847. return item.id;
  3848. });
  3849. callback(ids);
  3850. };
  3851. /***/ }),
  3852. /* 41 */
  3853. /***/ (function(module, exports, __webpack_require__) {
  3854. "use strict";
  3855. /**
  3856. * @author oldj
  3857. * @blog https://oldj.net
  3858. */
  3859. module.exports = function (app) {
  3860. app.loadHosts();
  3861. };
  3862. /***/ }),
  3863. /* 42 */
  3864. /***/ (function(module, exports, __webpack_require__) {
  3865. "use strict";
  3866. /**
  3867. * @author oldj
  3868. * @blog https://oldj.net
  3869. */
  3870. var _Agent = __webpack_require__(4);
  3871. var _Agent2 = _interopRequireDefault(_Agent);
  3872. var _list_updated = __webpack_require__(17);
  3873. var _list_updated2 = _interopRequireDefault(_list_updated);
  3874. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3875. module.exports = function (app, ids) {
  3876. var list = app.state.list;
  3877. var new_list = [];
  3878. ids.map(function (id) {
  3879. var item = list.find(function (i) {
  3880. return i.id === id;
  3881. });
  3882. if (item) {
  3883. new_list.push(item);
  3884. }
  3885. });
  3886. _Agent2.default.pact('saveHosts', new_list).then(function (list) {
  3887. (0, _list_updated2.default)(app, list);
  3888. }).catch(function (e) {
  3889. return console.log(e);
  3890. });
  3891. };
  3892. /***/ }),
  3893. /* 43 */
  3894. /***/ (function(module, exports, __webpack_require__) {
  3895. "use strict";
  3896. /**
  3897. * @author oldj
  3898. * @blog https://oldj.net
  3899. */
  3900. var _Agent = __webpack_require__(4);
  3901. var _Agent2 = _interopRequireDefault(_Agent);
  3902. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3903. module.exports = function () {
  3904. _Agent2.default.pact('sudoCancel');
  3905. };
  3906. /***/ }),
  3907. /* 44 */
  3908. /***/ (function(module, exports, __webpack_require__) {
  3909. "use strict";
  3910. /**
  3911. * @author oldj
  3912. * @blog https://oldj.net
  3913. */
  3914. var _Agent = __webpack_require__(4);
  3915. var _Agent2 = _interopRequireDefault(_Agent);
  3916. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3917. module.exports = function (app, pswd) {
  3918. _Agent2.default.pact('sudoPSWD', pswd);
  3919. };
  3920. /***/ }),
  3921. /* 45 */
  3922. /***/ (function(module, exports, __webpack_require__) {
  3923. "use strict";
  3924. /**
  3925. * @author oldj
  3926. * @blog https://oldj.net
  3927. */
  3928. var _Agent = __webpack_require__(4);
  3929. var _Agent2 = _interopRequireDefault(_Agent);
  3930. var _save = __webpack_require__(24);
  3931. var _save2 = _interopRequireDefault(_save);
  3932. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3933. module.exports = function (app, hosts) {
  3934. hosts.on = !hosts.on;
  3935. var lang = app.state.lang;
  3936. return _Agent2.default.pact('getPref').then(function (pref) {
  3937. var list = app.state.list.slice(0);
  3938. var is_single = pref.choice_mode === 'single';
  3939. if (is_single && hosts.on) {
  3940. list.map(function (item) {
  3941. if (item.id !== hosts.id) {
  3942. item.on = false;
  3943. }
  3944. });
  3945. }
  3946. return list;
  3947. }).then(function (list) {
  3948. var idx = list.findIndex(function (item) {
  3949. return item.id === hosts.id;
  3950. });
  3951. if (idx === -1) {
  3952. list.push(Object.assign({}, hosts));
  3953. } else {
  3954. var old_hosts = list[idx];
  3955. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  3956. }
  3957. return (0, _save2.default)(app, list, hosts);
  3958. }).then(function () {
  3959. _Agent2.default.pact('statRecord', 'switch');
  3960. return _Agent2.default.pact('notify', 'SwitchHosts!', lang.hosts_switched);
  3961. });
  3962. };
  3963. /***/ }),
  3964. /* 46 */
  3965. /***/ (function(module, exports, __webpack_require__) {
  3966. "use strict";
  3967. /**
  3968. * @author oldj
  3969. * @blog https://oldj.net
  3970. */
  3971. var _Agent = __webpack_require__(4);
  3972. var _Agent2 = _interopRequireDefault(_Agent);
  3973. var _list_updated = __webpack_require__(17);
  3974. var _list_updated2 = _interopRequireDefault(_list_updated);
  3975. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3976. module.exports = function (app, on, on_ids, callback) {
  3977. var list = app.state.list;
  3978. var new_list = list.map(function (item) {
  3979. var new_item = Object.assign({}, item);
  3980. new_item.on = !!(on && on_ids.includes(item.id));
  3981. return new_item;
  3982. });
  3983. _Agent2.default.pact('saveHosts', new_list).then(function () {
  3984. //app.setState({list: new_list})
  3985. (0, _list_updated2.default)(app, new_list);
  3986. //app.forceUpdate()
  3987. callback();
  3988. }).catch(function (e) {
  3989. return callback(e);
  3990. });
  3991. };
  3992. /***/ }),
  3993. /* 47 */
  3994. /***/ (function(module, exports, __webpack_require__) {
  3995. "use strict";
  3996. /**
  3997. * @author oldj
  3998. * @blog https://oldj.net
  3999. */
  4000. //import Agent from '../Agent'
  4001. //import cleanData from '../../app/server/cleanData'
  4002. var _save = __webpack_require__(24);
  4003. var _save2 = _interopRequireDefault(_save);
  4004. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4005. module.exports = function (app, hosts) {
  4006. var list = app.state.list.slice(0);
  4007. var idx = list.findIndex(function (item) {
  4008. return item.id === hosts.id;
  4009. });
  4010. if (idx === -1) {
  4011. list.push(Object.assign({}, hosts));
  4012. } else {
  4013. var old_hosts = list[idx];
  4014. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  4015. }
  4016. //list = cleanData(list)
  4017. (0, _save2.default)(app, list, hosts);
  4018. };
  4019. /***/ }),
  4020. /* 48 */
  4021. /***/ (function(module, exports, __webpack_require__) {
  4022. "use strict";
  4023. /**
  4024. * @author oldj
  4025. * @blog http://oldj.net
  4026. */
  4027. Object.defineProperty(exports, "__esModule", {
  4028. value: true
  4029. });
  4030. 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; }; }();
  4031. var _react = __webpack_require__(7);
  4032. var _react2 = _interopRequireDefault(_react);
  4033. var _Agent = __webpack_require__(4);
  4034. var _Agent2 = _interopRequireDefault(_Agent);
  4035. __webpack_require__(230);
  4036. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4037. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4038. 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; }
  4039. 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; }
  4040. var MyFrame = function (_React$Component) {
  4041. _inherits(MyFrame, _React$Component);
  4042. function MyFrame(props) {
  4043. _classCallCheck(this, MyFrame);
  4044. return _possibleConstructorReturn(this, (MyFrame.__proto__ || Object.getPrototypeOf(MyFrame)).call(this, props));
  4045. }
  4046. _createClass(MyFrame, [{
  4047. key: 'componentDidMount',
  4048. value: function componentDidMount() {
  4049. var _this2 = this;
  4050. _Agent2.default.on('esc', function () {
  4051. _this2.onCancel();
  4052. });
  4053. }
  4054. }, {
  4055. key: 'onOK',
  4056. value: function onOK() {
  4057. this.props.onOK();
  4058. }
  4059. }, {
  4060. key: 'onCancel',
  4061. value: function onCancel() {
  4062. this.props.onCancel();
  4063. }
  4064. }, {
  4065. key: 'renderFootButtons',
  4066. value: function renderFootButtons() {
  4067. var html = [];
  4068. var lang = this.props.lang;
  4069. html.push(_react2.default.createElement(
  4070. 'div',
  4071. {
  4072. className: 'button btn-cancel',
  4073. key: 'btn-cancel',
  4074. onClick: this.onCancel.bind(this)
  4075. },
  4076. this.props.cancel_title || lang.cancel
  4077. ));
  4078. html.push(_react2.default.createElement(
  4079. 'div',
  4080. {
  4081. className: 'button btn-ok btn-default',
  4082. key: 'btn-ok',
  4083. onClick: this.onOK.bind(this)
  4084. },
  4085. this.props.ok_title || lang.ok
  4086. ));
  4087. return html;
  4088. }
  4089. }, {
  4090. key: 'render',
  4091. value: function render() {
  4092. if (!this.props.show) {
  4093. return null;
  4094. }
  4095. return _react2.default.createElement(
  4096. 'div',
  4097. { className: 'frame', ref: 'frame' },
  4098. _react2.default.createElement('div', { className: 'overlay' }),
  4099. _react2.default.createElement(
  4100. 'div',
  4101. { className: 'prompt' },
  4102. _react2.default.createElement(
  4103. 'div',
  4104. { className: 'head' },
  4105. this.props.head
  4106. ),
  4107. _react2.default.createElement(
  4108. 'div',
  4109. { className: 'body' },
  4110. this.props.body
  4111. ),
  4112. _react2.default.createElement(
  4113. 'div',
  4114. { className: 'foot' },
  4115. this.renderFootButtons()
  4116. )
  4117. )
  4118. );
  4119. }
  4120. }]);
  4121. return MyFrame;
  4122. }(_react2.default.Component);
  4123. exports.default = MyFrame;
  4124. /***/ }),
  4125. /* 49 */
  4126. /***/ (function(module, exports, __webpack_require__) {
  4127. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  4128. // Distributed under an MIT license: http://codemirror.net/LICENSE
  4129. // This is CodeMirror (http://codemirror.net), a code editor
  4130. // implemented in JavaScript on top of the browser's DOM.
  4131. //
  4132. // You can find some technical background for some of the code below
  4133. // at http://marijnhaverbeke.nl/blog/#cm-internals .
  4134. (function (global, factory) {
  4135. true ? module.exports = factory() :
  4136. typeof define === 'function' && define.amd ? define(factory) :
  4137. (global.CodeMirror = factory());
  4138. }(this, (function () { 'use strict';
  4139. // Kludges for bugs and behavior differences that can't be feature
  4140. // detected are enabled based on userAgent etc sniffing.
  4141. var userAgent = navigator.userAgent;
  4142. var platform = navigator.platform;
  4143. var gecko = /gecko\/\d/i.test(userAgent);
  4144. var ie_upto10 = /MSIE \d/.test(userAgent);
  4145. var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  4146. var edge = /Edge\/(\d+)/.exec(userAgent);
  4147. var ie = ie_upto10 || ie_11up || edge;
  4148. var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  4149. var webkit = !edge && /WebKit\//.test(userAgent);
  4150. var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  4151. var chrome = !edge && /Chrome\//.test(userAgent);
  4152. var presto = /Opera\//.test(userAgent);
  4153. var safari = /Apple Computer/.test(navigator.vendor);
  4154. var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  4155. var phantom = /PhantomJS/.test(userAgent);
  4156. var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
  4157. var android = /Android/.test(userAgent);
  4158. // This is woefully incomplete. Suggestions for alternative methods welcome.
  4159. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  4160. var mac = ios || /Mac/.test(platform);
  4161. var chromeOS = /\bCrOS\b/.test(userAgent);
  4162. var windows = /win/i.test(platform);
  4163. var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  4164. if (presto_version) { presto_version = Number(presto_version[1]); }
  4165. if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  4166. // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  4167. var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  4168. var captureRightClick = gecko || (ie && ie_version >= 9);
  4169. function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
  4170. var rmClass = function(node, cls) {
  4171. var current = node.className;
  4172. var match = classTest(cls).exec(current);
  4173. if (match) {
  4174. var after = current.slice(match.index + match[0].length);
  4175. node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
  4176. }
  4177. };
  4178. function removeChildren(e) {
  4179. for (var count = e.childNodes.length; count > 0; --count)
  4180. { e.removeChild(e.firstChild); }
  4181. return e
  4182. }
  4183. function removeChildrenAndAdd(parent, e) {
  4184. return removeChildren(parent).appendChild(e)
  4185. }
  4186. function elt(tag, content, className, style) {
  4187. var e = document.createElement(tag);
  4188. if (className) { e.className = className; }
  4189. if (style) { e.style.cssText = style; }
  4190. if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
  4191. else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
  4192. return e
  4193. }
  4194. // wrapper for elt, which removes the elt from the accessibility tree
  4195. function eltP(tag, content, className, style) {
  4196. var e = elt(tag, content, className, style);
  4197. e.setAttribute("role", "presentation");
  4198. return e
  4199. }
  4200. var range;
  4201. if (document.createRange) { range = function(node, start, end, endNode) {
  4202. var r = document.createRange();
  4203. r.setEnd(endNode || node, end);
  4204. r.setStart(node, start);
  4205. return r
  4206. }; }
  4207. else { range = function(node, start, end) {
  4208. var r = document.body.createTextRange();
  4209. try { r.moveToElementText(node.parentNode); }
  4210. catch(e) { return r }
  4211. r.collapse(true);
  4212. r.moveEnd("character", end);
  4213. r.moveStart("character", start);
  4214. return r
  4215. }; }
  4216. function contains(parent, child) {
  4217. if (child.nodeType == 3) // Android browser always returns false when child is a textnode
  4218. { child = child.parentNode; }
  4219. if (parent.contains)
  4220. { return parent.contains(child) }
  4221. do {
  4222. if (child.nodeType == 11) { child = child.host; }
  4223. if (child == parent) { return true }
  4224. } while (child = child.parentNode)
  4225. }
  4226. function activeElt() {
  4227. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
  4228. // IE < 10 will throw when accessed while the page is loading or in an iframe.
  4229. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
  4230. var activeElement;
  4231. try {
  4232. activeElement = document.activeElement;
  4233. } catch(e) {
  4234. activeElement = document.body || null;
  4235. }
  4236. while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
  4237. { activeElement = activeElement.shadowRoot.activeElement; }
  4238. return activeElement
  4239. }
  4240. function addClass(node, cls) {
  4241. var current = node.className;
  4242. if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  4243. }
  4244. function joinClasses(a, b) {
  4245. var as = a.split(" ");
  4246. for (var i = 0; i < as.length; i++)
  4247. { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
  4248. return b
  4249. }
  4250. var selectInput = function(node) { node.select(); };
  4251. if (ios) // Mobile Safari apparently has a bug where select() is broken.
  4252. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  4253. else if (ie) // Suppress mysterious IE10 errors
  4254. { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
  4255. function bind(f) {
  4256. var args = Array.prototype.slice.call(arguments, 1);
  4257. return function(){return f.apply(null, args)}
  4258. }
  4259. function copyObj(obj, target, overwrite) {
  4260. if (!target) { target = {}; }
  4261. for (var prop in obj)
  4262. { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
  4263. { target[prop] = obj[prop]; } }
  4264. return target
  4265. }
  4266. // Counts the column offset in a string, taking tabs into account.
  4267. // Used mostly to find indentation.
  4268. function countColumn(string, end, tabSize, startIndex, startValue) {
  4269. if (end == null) {
  4270. end = string.search(/[^\s\u00a0]/);
  4271. if (end == -1) { end = string.length; }
  4272. }
  4273. for (var i = startIndex || 0, n = startValue || 0;;) {
  4274. var nextTab = string.indexOf("\t", i);
  4275. if (nextTab < 0 || nextTab >= end)
  4276. { return n + (end - i) }
  4277. n += nextTab - i;
  4278. n += tabSize - (n % tabSize);
  4279. i = nextTab + 1;
  4280. }
  4281. }
  4282. var Delayed = function() {this.id = null;};
  4283. Delayed.prototype.set = function (ms, f) {
  4284. clearTimeout(this.id);
  4285. this.id = setTimeout(f, ms);
  4286. };
  4287. function indexOf(array, elt) {
  4288. for (var i = 0; i < array.length; ++i)
  4289. { if (array[i] == elt) { return i } }
  4290. return -1
  4291. }
  4292. // Number of pixels added to scroller and sizer to hide scrollbar
  4293. var scrollerGap = 30;
  4294. // Returned or thrown by various protocols to signal 'I'm not
  4295. // handling this'.
  4296. var Pass = {toString: function(){return "CodeMirror.Pass"}};
  4297. // Reused option objects for setSelection & friends
  4298. var sel_dontScroll = {scroll: false};
  4299. var sel_mouse = {origin: "*mouse"};
  4300. var sel_move = {origin: "+move"};
  4301. // The inverse of countColumn -- find the offset that corresponds to
  4302. // a particular column.
  4303. function findColumn(string, goal, tabSize) {
  4304. for (var pos = 0, col = 0;;) {
  4305. var nextTab = string.indexOf("\t", pos);
  4306. if (nextTab == -1) { nextTab = string.length; }
  4307. var skipped = nextTab - pos;
  4308. if (nextTab == string.length || col + skipped >= goal)
  4309. { return pos + Math.min(skipped, goal - col) }
  4310. col += nextTab - pos;
  4311. col += tabSize - (col % tabSize);
  4312. pos = nextTab + 1;
  4313. if (col >= goal) { return pos }
  4314. }
  4315. }
  4316. var spaceStrs = [""];
  4317. function spaceStr(n) {
  4318. while (spaceStrs.length <= n)
  4319. { spaceStrs.push(lst(spaceStrs) + " "); }
  4320. return spaceStrs[n]
  4321. }
  4322. function lst(arr) { return arr[arr.length-1] }
  4323. function map(array, f) {
  4324. var out = [];
  4325. for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
  4326. return out
  4327. }
  4328. function insertSorted(array, value, score) {
  4329. var pos = 0, priority = score(value);
  4330. while (pos < array.length && score(array[pos]) <= priority) { pos++; }
  4331. array.splice(pos, 0, value);
  4332. }
  4333. function nothing() {}
  4334. function createObj(base, props) {
  4335. var inst;
  4336. if (Object.create) {
  4337. inst = Object.create(base);
  4338. } else {
  4339. nothing.prototype = base;
  4340. inst = new nothing();
  4341. }
  4342. if (props) { copyObj(props, inst); }
  4343. return inst
  4344. }
  4345. var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  4346. function isWordCharBasic(ch) {
  4347. return /\w/.test(ch) || ch > "\x80" &&
  4348. (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  4349. }
  4350. function isWordChar(ch, helper) {
  4351. if (!helper) { return isWordCharBasic(ch) }
  4352. if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
  4353. return helper.test(ch)
  4354. }
  4355. function isEmpty(obj) {
  4356. for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
  4357. return true
  4358. }
  4359. // Extending unicode characters. A series of a non-extending char +
  4360. // any number of extending chars is treated as a single unit as far
  4361. // as editing and measuring is concerned. This is not fully correct,
  4362. // since some scripts/fonts/browsers also treat other configurations
  4363. // of code points as a group.
  4364. 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]/;
  4365. function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
  4366. // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
  4367. function skipExtendingChars(str, pos, dir) {
  4368. while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
  4369. return pos
  4370. }
  4371. // Returns the value from the range [`from`; `to`] that satisfies
  4372. // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
  4373. function findFirst(pred, from, to) {
  4374. for (;;) {
  4375. if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
  4376. var mid = Math.floor((from + to) / 2);
  4377. if (pred(mid)) { to = mid; }
  4378. else { from = mid; }
  4379. }
  4380. }
  4381. // The display handles the DOM integration, both for input reading
  4382. // and content drawing. It holds references to DOM nodes and
  4383. // display-related state.
  4384. function Display(place, doc, input) {
  4385. var d = this;
  4386. this.input = input;
  4387. // Covers bottom-right square when both scrollbars are present.
  4388. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
  4389. d.scrollbarFiller.setAttribute("cm-not-content", "true");
  4390. // Covers bottom of gutter when coverGutterNextToScrollbar is on
  4391. // and h scrollbar is present.
  4392. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
  4393. d.gutterFiller.setAttribute("cm-not-content", "true");
  4394. // Will contain the actual code, positioned to cover the viewport.
  4395. d.lineDiv = eltP("div", null, "CodeMirror-code");
  4396. // Elements are added to these to represent selection and cursors.
  4397. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
  4398. d.cursorDiv = elt("div", null, "CodeMirror-cursors");
  4399. // A visibility: hidden element used to find the size of things.
  4400. d.measure = elt("div", null, "CodeMirror-measure");
  4401. // When lines outside of the viewport are measured, they are drawn in this.
  4402. d.lineMeasure = elt("div", null, "CodeMirror-measure");
  4403. // Wraps everything that needs to exist inside the vertically-padded coordinate system
  4404. d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
  4405. null, "position: relative; outline: none");
  4406. var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
  4407. // Moved around its parent to cover visible view.
  4408. d.mover = elt("div", [lines], null, "position: relative");
  4409. // Set to the height of the document, allowing scrolling.
  4410. d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  4411. d.sizerWidth = null;
  4412. // Behavior of elts with overflow: auto and padding is
  4413. // inconsistent across browsers. This is used to ensure the
  4414. // scrollable area is big enough.
  4415. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
  4416. // Will contain the gutters, if any.
  4417. d.gutters = elt("div", null, "CodeMirror-gutters");
  4418. d.lineGutter = null;
  4419. // Actual scrollable element.
  4420. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
  4421. d.scroller.setAttribute("tabIndex", "-1");
  4422. // The element in which the editor lives.
  4423. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
  4424. // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
  4425. if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  4426. if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
  4427. if (place) {
  4428. if (place.appendChild) { place.appendChild(d.wrapper); }
  4429. else { place(d.wrapper); }
  4430. }
  4431. // Current rendered range (may be bigger than the view window).
  4432. d.viewFrom = d.viewTo = doc.first;
  4433. d.reportedViewFrom = d.reportedViewTo = doc.first;
  4434. // Information about the rendered lines.
  4435. d.view = [];
  4436. d.renderedView = null;
  4437. // Holds info about a single rendered line when it was rendered
  4438. // for measurement, while not in view.
  4439. d.externalMeasured = null;
  4440. // Empty space (in pixels) above the view
  4441. d.viewOffset = 0;
  4442. d.lastWrapHeight = d.lastWrapWidth = 0;
  4443. d.updateLineNumbers = null;
  4444. d.nativeBarWidth = d.barHeight = d.barWidth = 0;
  4445. d.scrollbarsClipped = false;
  4446. // Used to only resize the line number gutter when necessary (when
  4447. // the amount of lines crosses a boundary that makes its width change)
  4448. d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  4449. // Set to true when a non-horizontal-scrolling line widget is
  4450. // added. As an optimization, line widget aligning is skipped when
  4451. // this is false.
  4452. d.alignWidgets = false;
  4453. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  4454. // Tracks the maximum line length so that the horizontal scrollbar
  4455. // can be kept static when scrolling.
  4456. d.maxLine = null;
  4457. d.maxLineLength = 0;
  4458. d.maxLineChanged = false;
  4459. // Used for measuring wheel scrolling granularity
  4460. d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
  4461. // True when shift is held down.
  4462. d.shift = false;
  4463. // Used to track whether anything happened since the context menu
  4464. // was opened.
  4465. d.selForContextMenu = null;
  4466. d.activeTouch = null;
  4467. input.init(d);
  4468. }
  4469. // Find the line object corresponding to the given line number.
  4470. function getLine(doc, n) {
  4471. n -= doc.first;
  4472. if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
  4473. var chunk = doc;
  4474. while (!chunk.lines) {
  4475. for (var i = 0;; ++i) {
  4476. var child = chunk.children[i], sz = child.chunkSize();
  4477. if (n < sz) { chunk = child; break }
  4478. n -= sz;
  4479. }
  4480. }
  4481. return chunk.lines[n]
  4482. }
  4483. // Get the part of a document between two positions, as an array of
  4484. // strings.
  4485. function getBetween(doc, start, end) {
  4486. var out = [], n = start.line;
  4487. doc.iter(start.line, end.line + 1, function (line) {
  4488. var text = line.text;
  4489. if (n == end.line) { text = text.slice(0, end.ch); }
  4490. if (n == start.line) { text = text.slice(start.ch); }
  4491. out.push(text);
  4492. ++n;
  4493. });
  4494. return out
  4495. }
  4496. // Get the lines between from and to, as array of strings.
  4497. function getLines(doc, from, to) {
  4498. var out = [];
  4499. doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
  4500. return out
  4501. }
  4502. // Update the height of a line, propagating the height change
  4503. // upwards to parent nodes.
  4504. function updateLineHeight(line, height) {
  4505. var diff = height - line.height;
  4506. if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  4507. }
  4508. // Given a line object, find its line number by walking up through
  4509. // its parent links.
  4510. function lineNo(line) {
  4511. if (line.parent == null) { return null }
  4512. var cur = line.parent, no = indexOf(cur.lines, line);
  4513. for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
  4514. for (var i = 0;; ++i) {
  4515. if (chunk.children[i] == cur) { break }
  4516. no += chunk.children[i].chunkSize();
  4517. }
  4518. }
  4519. return no + cur.first
  4520. }
  4521. // Find the line at the given vertical position, using the height
  4522. // information in the document tree.
  4523. function lineAtHeight(chunk, h) {
  4524. var n = chunk.first;
  4525. outer: do {
  4526. for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
  4527. var child = chunk.children[i$1], ch = child.height;
  4528. if (h < ch) { chunk = child; continue outer }
  4529. h -= ch;
  4530. n += child.chunkSize();
  4531. }
  4532. return n
  4533. } while (!chunk.lines)
  4534. var i = 0;
  4535. for (; i < chunk.lines.length; ++i) {
  4536. var line = chunk.lines[i], lh = line.height;
  4537. if (h < lh) { break }
  4538. h -= lh;
  4539. }
  4540. return n + i
  4541. }
  4542. function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
  4543. function lineNumberFor(options, i) {
  4544. return String(options.lineNumberFormatter(i + options.firstLineNumber))
  4545. }
  4546. // A Pos instance represents a position within the text.
  4547. function Pos(line, ch, sticky) {
  4548. if ( sticky === void 0 ) sticky = null;
  4549. if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
  4550. this.line = line;
  4551. this.ch = ch;
  4552. this.sticky = sticky;
  4553. }
  4554. // Compare two positions, return 0 if they are the same, a negative
  4555. // number when a is less, and a positive number otherwise.
  4556. function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
  4557. function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
  4558. function copyPos(x) {return Pos(x.line, x.ch)}
  4559. function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  4560. function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
  4561. // Most of the external API clips given positions to make sure they
  4562. // actually exist within the document.
  4563. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  4564. function clipPos(doc, pos) {
  4565. if (pos.line < doc.first) { return Pos(doc.first, 0) }
  4566. var last = doc.first + doc.size - 1;
  4567. if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
  4568. return clipToLen(pos, getLine(doc, pos.line).text.length)
  4569. }
  4570. function clipToLen(pos, linelen) {
  4571. var ch = pos.ch;
  4572. if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
  4573. else if (ch < 0) { return Pos(pos.line, 0) }
  4574. else { return pos }
  4575. }
  4576. function clipPosArray(doc, array) {
  4577. var out = [];
  4578. for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
  4579. return out
  4580. }
  4581. // Optimize some code when these features are not used.
  4582. var sawReadOnlySpans = false;
  4583. var sawCollapsedSpans = false;
  4584. function seeReadOnlySpans() {
  4585. sawReadOnlySpans = true;
  4586. }
  4587. function seeCollapsedSpans() {
  4588. sawCollapsedSpans = true;
  4589. }
  4590. // TEXTMARKER SPANS
  4591. function MarkedSpan(marker, from, to) {
  4592. this.marker = marker;
  4593. this.from = from; this.to = to;
  4594. }
  4595. // Search an array of spans for a span matching the given marker.
  4596. function getMarkedSpanFor(spans, marker) {
  4597. if (spans) { for (var i = 0; i < spans.length; ++i) {
  4598. var span = spans[i];
  4599. if (span.marker == marker) { return span }
  4600. } }
  4601. }
  4602. // Remove a span from an array, returning undefined if no spans are
  4603. // left (we don't store arrays for lines without spans).
  4604. function removeMarkedSpan(spans, span) {
  4605. var r;
  4606. for (var i = 0; i < spans.length; ++i)
  4607. { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
  4608. return r
  4609. }
  4610. // Add a span to a line.
  4611. function addMarkedSpan(line, span) {
  4612. line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
  4613. span.marker.attachLine(line);
  4614. }
  4615. // Used for the algorithm that adjusts markers for a change in the
  4616. // document. These functions cut an array of spans at a given
  4617. // character position, returning an array of remaining chunks (or
  4618. // undefined if nothing remains).
  4619. function markedSpansBefore(old, startCh, isInsert) {
  4620. var nw;
  4621. if (old) { for (var i = 0; i < old.length; ++i) {
  4622. var span = old[i], marker = span.marker;
  4623. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
  4624. if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
  4625. 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));
  4626. }
  4627. } }
  4628. return nw
  4629. }
  4630. function markedSpansAfter(old, endCh, isInsert) {
  4631. var nw;
  4632. if (old) { for (var i = 0; i < old.length; ++i) {
  4633. var span = old[i], marker = span.marker;
  4634. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
  4635. if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
  4636. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
  4637. span.to == null ? null : span.to - endCh));
  4638. }
  4639. } }
  4640. return nw
  4641. }
  4642. // Given a change object, compute the new set of marker spans that
  4643. // cover the line in which the change took place. Removes spans
  4644. // entirely within the change, reconnects spans belonging to the
  4645. // same marker that appear on both sides of the change, and cuts off
  4646. // spans partially within the change. Returns an array of span
  4647. // arrays with one element for each line in (after) the change.
  4648. function stretchSpansOverChange(doc, change) {
  4649. if (change.full) { return null }
  4650. var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
  4651. var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
  4652. if (!oldFirst && !oldLast) { return null }
  4653. var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
  4654. // Get the spans that 'stick out' on both sides
  4655. var first = markedSpansBefore(oldFirst, startCh, isInsert);
  4656. var last = markedSpansAfter(oldLast, endCh, isInsert);
  4657. // Next, merge those two ends
  4658. var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
  4659. if (first) {
  4660. // Fix up .to properties of first
  4661. for (var i = 0; i < first.length; ++i) {
  4662. var span = first[i];
  4663. if (span.to == null) {
  4664. var found = getMarkedSpanFor(last, span.marker);
  4665. if (!found) { span.to = startCh; }
  4666. else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
  4667. }
  4668. }
  4669. }
  4670. if (last) {
  4671. // Fix up .from in last (or move them into first in case of sameLine)
  4672. for (var i$1 = 0; i$1 < last.length; ++i$1) {
  4673. var span$1 = last[i$1];
  4674. if (span$1.to != null) { span$1.to += offset; }
  4675. if (span$1.from == null) {
  4676. var found$1 = getMarkedSpanFor(first, span$1.marker);
  4677. if (!found$1) {
  4678. span$1.from = offset;
  4679. if (sameLine) { (first || (first = [])).push(span$1); }
  4680. }
  4681. } else {
  4682. span$1.from += offset;
  4683. if (sameLine) { (first || (first = [])).push(span$1); }
  4684. }
  4685. }
  4686. }
  4687. // Make sure we didn't create any zero-length spans
  4688. if (first) { first = clearEmptySpans(first); }
  4689. if (last && last != first) { last = clearEmptySpans(last); }
  4690. var newMarkers = [first];
  4691. if (!sameLine) {
  4692. // Fill gap with whole-line-spans
  4693. var gap = change.text.length - 2, gapMarkers;
  4694. if (gap > 0 && first)
  4695. { for (var i$2 = 0; i$2 < first.length; ++i$2)
  4696. { if (first[i$2].to == null)
  4697. { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
  4698. for (var i$3 = 0; i$3 < gap; ++i$3)
  4699. { newMarkers.push(gapMarkers); }
  4700. newMarkers.push(last);
  4701. }
  4702. return newMarkers
  4703. }
  4704. // Remove spans that are empty and don't have a clearWhenEmpty
  4705. // option of false.
  4706. function clearEmptySpans(spans) {
  4707. for (var i = 0; i < spans.length; ++i) {
  4708. var span = spans[i];
  4709. if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
  4710. { spans.splice(i--, 1); }
  4711. }
  4712. if (!spans.length) { return null }
  4713. return spans
  4714. }
  4715. // Used to 'clip' out readOnly ranges when making a change.
  4716. function removeReadOnlyRanges(doc, from, to) {
  4717. var markers = null;
  4718. doc.iter(from.line, to.line + 1, function (line) {
  4719. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  4720. var mark = line.markedSpans[i].marker;
  4721. if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
  4722. { (markers || (markers = [])).push(mark); }
  4723. } }
  4724. });
  4725. if (!markers) { return null }
  4726. var parts = [{from: from, to: to}];
  4727. for (var i = 0; i < markers.length; ++i) {
  4728. var mk = markers[i], m = mk.find(0);
  4729. for (var j = 0; j < parts.length; ++j) {
  4730. var p = parts[j];
  4731. if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
  4732. var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
  4733. if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
  4734. { newParts.push({from: p.from, to: m.from}); }
  4735. if (dto > 0 || !mk.inclusiveRight && !dto)
  4736. { newParts.push({from: m.to, to: p.to}); }
  4737. parts.splice.apply(parts, newParts);
  4738. j += newParts.length - 3;
  4739. }
  4740. }
  4741. return parts
  4742. }
  4743. // Connect or disconnect spans from a line.
  4744. function detachMarkedSpans(line) {
  4745. var spans = line.markedSpans;
  4746. if (!spans) { return }
  4747. for (var i = 0; i < spans.length; ++i)
  4748. { spans[i].marker.detachLine(line); }
  4749. line.markedSpans = null;
  4750. }
  4751. function attachMarkedSpans(line, spans) {
  4752. if (!spans) { return }
  4753. for (var i = 0; i < spans.length; ++i)
  4754. { spans[i].marker.attachLine(line); }
  4755. line.markedSpans = spans;
  4756. }
  4757. // Helpers used when computing which overlapping collapsed span
  4758. // counts as the larger one.
  4759. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  4760. function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
  4761. // Returns a number indicating which of two overlapping collapsed
  4762. // spans is larger (and thus includes the other). Falls back to
  4763. // comparing ids when the spans cover exactly the same range.
  4764. function compareCollapsedMarkers(a, b) {
  4765. var lenDiff = a.lines.length - b.lines.length;
  4766. if (lenDiff != 0) { return lenDiff }
  4767. var aPos = a.find(), bPos = b.find();
  4768. var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
  4769. if (fromCmp) { return -fromCmp }
  4770. var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
  4771. if (toCmp) { return toCmp }
  4772. return b.id - a.id
  4773. }
  4774. // Find out whether a line ends or starts in a collapsed span. If
  4775. // so, return the marker for that span.
  4776. function collapsedSpanAtSide(line, start) {
  4777. var sps = sawCollapsedSpans && line.markedSpans, found;
  4778. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  4779. sp = sps[i];
  4780. if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
  4781. (!found || compareCollapsedMarkers(found, sp.marker) < 0))
  4782. { found = sp.marker; }
  4783. } }
  4784. return found
  4785. }
  4786. function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  4787. function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
  4788. // Test whether there exists a collapsed span that partially
  4789. // overlaps (covers the start or end, but not both) of a new span.
  4790. // Such overlap is not allowed.
  4791. function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
  4792. var line = getLine(doc, lineNo$$1);
  4793. var sps = sawCollapsedSpans && line.markedSpans;
  4794. if (sps) { for (var i = 0; i < sps.length; ++i) {
  4795. var sp = sps[i];
  4796. if (!sp.marker.collapsed) { continue }
  4797. var found = sp.marker.find(0);
  4798. var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
  4799. var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
  4800. if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
  4801. if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
  4802. fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
  4803. { return true }
  4804. } }
  4805. }
  4806. // A visual line is a line as drawn on the screen. Folding, for
  4807. // example, can cause multiple logical lines to appear on the same
  4808. // visual line. This finds the start of the visual line that the
  4809. // given line is part of (usually that is the line itself).
  4810. function visualLine(line) {
  4811. var merged;
  4812. while (merged = collapsedSpanAtStart(line))
  4813. { line = merged.find(-1, true).line; }
  4814. return line
  4815. }
  4816. function visualLineEnd(line) {
  4817. var merged;
  4818. while (merged = collapsedSpanAtEnd(line))
  4819. { line = merged.find(1, true).line; }
  4820. return line
  4821. }
  4822. // Returns an array of logical lines that continue the visual line
  4823. // started by the argument, or undefined if there are no such lines.
  4824. function visualLineContinued(line) {
  4825. var merged, lines;
  4826. while (merged = collapsedSpanAtEnd(line)) {
  4827. line = merged.find(1, true).line
  4828. ;(lines || (lines = [])).push(line);
  4829. }
  4830. return lines
  4831. }
  4832. // Get the line number of the start of the visual line that the
  4833. // given line number is part of.
  4834. function visualLineNo(doc, lineN) {
  4835. var line = getLine(doc, lineN), vis = visualLine(line);
  4836. if (line == vis) { return lineN }
  4837. return lineNo(vis)
  4838. }
  4839. // Get the line number of the start of the next visual line after
  4840. // the given line.
  4841. function visualLineEndNo(doc, lineN) {
  4842. if (lineN > doc.lastLine()) { return lineN }
  4843. var line = getLine(doc, lineN), merged;
  4844. if (!lineIsHidden(doc, line)) { return lineN }
  4845. while (merged = collapsedSpanAtEnd(line))
  4846. { line = merged.find(1, true).line; }
  4847. return lineNo(line) + 1
  4848. }
  4849. // Compute whether a line is hidden. Lines count as hidden when they
  4850. // are part of a visual line that starts with another line, or when
  4851. // they are entirely covered by collapsed, non-widget span.
  4852. function lineIsHidden(doc, line) {
  4853. var sps = sawCollapsedSpans && line.markedSpans;
  4854. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  4855. sp = sps[i];
  4856. if (!sp.marker.collapsed) { continue }
  4857. if (sp.from == null) { return true }
  4858. if (sp.marker.widgetNode) { continue }
  4859. if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
  4860. { return true }
  4861. } }
  4862. }
  4863. function lineIsHiddenInner(doc, line, span) {
  4864. if (span.to == null) {
  4865. var end = span.marker.find(1, true);
  4866. return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
  4867. }
  4868. if (span.marker.inclusiveRight && span.to == line.text.length)
  4869. { return true }
  4870. for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
  4871. sp = line.markedSpans[i];
  4872. if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
  4873. (sp.to == null || sp.to != span.from) &&
  4874. (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
  4875. lineIsHiddenInner(doc, line, sp)) { return true }
  4876. }
  4877. }
  4878. // Find the height above the given line.
  4879. function heightAtLine(lineObj) {
  4880. lineObj = visualLine(lineObj);
  4881. var h = 0, chunk = lineObj.parent;
  4882. for (var i = 0; i < chunk.lines.length; ++i) {
  4883. var line = chunk.lines[i];
  4884. if (line == lineObj) { break }
  4885. else { h += line.height; }
  4886. }
  4887. for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
  4888. for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
  4889. var cur = p.children[i$1];
  4890. if (cur == chunk) { break }
  4891. else { h += cur.height; }
  4892. }
  4893. }
  4894. return h
  4895. }
  4896. // Compute the character length of a line, taking into account
  4897. // collapsed ranges (see markText) that might hide parts, and join
  4898. // other lines onto it.
  4899. function lineLength(line) {
  4900. if (line.height == 0) { return 0 }
  4901. var len = line.text.length, merged, cur = line;
  4902. while (merged = collapsedSpanAtStart(cur)) {
  4903. var found = merged.find(0, true);
  4904. cur = found.from.line;
  4905. len += found.from.ch - found.to.ch;
  4906. }
  4907. cur = line;
  4908. while (merged = collapsedSpanAtEnd(cur)) {
  4909. var found$1 = merged.find(0, true);
  4910. len -= cur.text.length - found$1.from.ch;
  4911. cur = found$1.to.line;
  4912. len += cur.text.length - found$1.to.ch;
  4913. }
  4914. return len
  4915. }
  4916. // Find the longest line in the document.
  4917. function findMaxLine(cm) {
  4918. var d = cm.display, doc = cm.doc;
  4919. d.maxLine = getLine(doc, doc.first);
  4920. d.maxLineLength = lineLength(d.maxLine);
  4921. d.maxLineChanged = true;
  4922. doc.iter(function (line) {
  4923. var len = lineLength(line);
  4924. if (len > d.maxLineLength) {
  4925. d.maxLineLength = len;
  4926. d.maxLine = line;
  4927. }
  4928. });
  4929. }
  4930. // BIDI HELPERS
  4931. function iterateBidiSections(order, from, to, f) {
  4932. if (!order) { return f(from, to, "ltr") }
  4933. var found = false;
  4934. for (var i = 0; i < order.length; ++i) {
  4935. var part = order[i];
  4936. if (part.from < to && part.to > from || from == to && part.to == from) {
  4937. f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
  4938. found = true;
  4939. }
  4940. }
  4941. if (!found) { f(from, to, "ltr"); }
  4942. }
  4943. var bidiOther = null;
  4944. function getBidiPartAt(order, ch, sticky) {
  4945. var found;
  4946. bidiOther = null;
  4947. for (var i = 0; i < order.length; ++i) {
  4948. var cur = order[i];
  4949. if (cur.from < ch && cur.to > ch) { return i }
  4950. if (cur.to == ch) {
  4951. if (cur.from != cur.to && sticky == "before") { found = i; }
  4952. else { bidiOther = i; }
  4953. }
  4954. if (cur.from == ch) {
  4955. if (cur.from != cur.to && sticky != "before") { found = i; }
  4956. else { bidiOther = i; }
  4957. }
  4958. }
  4959. return found != null ? found : bidiOther
  4960. }
  4961. // Bidirectional ordering algorithm
  4962. // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  4963. // that this (partially) implements.
  4964. // One-char codes used for character types:
  4965. // L (L): Left-to-Right
  4966. // R (R): Right-to-Left
  4967. // r (AL): Right-to-Left Arabic
  4968. // 1 (EN): European Number
  4969. // + (ES): European Number Separator
  4970. // % (ET): European Number Terminator
  4971. // n (AN): Arabic Number
  4972. // , (CS): Common Number Separator
  4973. // m (NSM): Non-Spacing Mark
  4974. // b (BN): Boundary Neutral
  4975. // s (B): Paragraph Separator
  4976. // t (S): Segment Separator
  4977. // w (WS): Whitespace
  4978. // N (ON): Other Neutrals
  4979. // Returns null if characters are ordered as they appear
  4980. // (left-to-right), or an array of sections ({from, to, level}
  4981. // objects) in the order in which they occur visually.
  4982. var bidiOrdering = (function() {
  4983. // Character types for codepoints 0 to 0xff
  4984. var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
  4985. // Character types for codepoints 0x600 to 0x6f9
  4986. var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
  4987. function charType(code) {
  4988. if (code <= 0xf7) { return lowTypes.charAt(code) }
  4989. else if (0x590 <= code && code <= 0x5f4) { return "R" }
  4990. else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
  4991. else if (0x6ee <= code && code <= 0x8ac) { return "r" }
  4992. else if (0x2000 <= code && code <= 0x200b) { return "w" }
  4993. else if (code == 0x200c) { return "b" }
  4994. else { return "L" }
  4995. }
  4996. var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  4997. var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
  4998. function BidiSpan(level, from, to) {
  4999. this.level = level;
  5000. this.from = from; this.to = to;
  5001. }
  5002. return function(str, direction) {
  5003. var outerType = direction == "ltr" ? "L" : "R";
  5004. if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
  5005. var len = str.length, types = [];
  5006. for (var i = 0; i < len; ++i)
  5007. { types.push(charType(str.charCodeAt(i))); }
  5008. // W1. Examine each non-spacing mark (NSM) in the level run, and
  5009. // change the type of the NSM to the type of the previous
  5010. // character. If the NSM is at the start of the level run, it will
  5011. // get the type of sor.
  5012. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
  5013. var type = types[i$1];
  5014. if (type == "m") { types[i$1] = prev; }
  5015. else { prev = type; }
  5016. }
  5017. // W2. Search backwards from each instance of a European number
  5018. // until the first strong type (R, L, AL, or sor) is found. If an
  5019. // AL is found, change the type of the European number to Arabic
  5020. // number.
  5021. // W3. Change all ALs to R.
  5022. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
  5023. var type$1 = types[i$2];
  5024. if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
  5025. else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
  5026. }
  5027. // W4. A single European separator between two European numbers
  5028. // changes to a European number. A single common separator between
  5029. // two numbers of the same type changes to that type.
  5030. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
  5031. var type$2 = types[i$3];
  5032. if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
  5033. else if (type$2 == "," && prev$1 == types[i$3+1] &&
  5034. (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
  5035. prev$1 = type$2;
  5036. }
  5037. // W5. A sequence of European terminators adjacent to European
  5038. // numbers changes to all European numbers.
  5039. // W6. Otherwise, separators and terminators change to Other
  5040. // Neutral.
  5041. for (var i$4 = 0; i$4 < len; ++i$4) {
  5042. var type$3 = types[i$4];
  5043. if (type$3 == ",") { types[i$4] = "N"; }
  5044. else if (type$3 == "%") {
  5045. var end = (void 0);
  5046. for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
  5047. var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
  5048. for (var j = i$4; j < end; ++j) { types[j] = replace; }
  5049. i$4 = end - 1;
  5050. }
  5051. }
  5052. // W7. Search backwards from each instance of a European number
  5053. // until the first strong type (R, L, or sor) is found. If an L is
  5054. // found, then change the type of the European number to L.
  5055. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
  5056. var type$4 = types[i$5];
  5057. if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
  5058. else if (isStrong.test(type$4)) { cur$1 = type$4; }
  5059. }
  5060. // N1. A sequence of neutrals takes the direction of the
  5061. // surrounding strong text if the text on both sides has the same
  5062. // direction. European and Arabic numbers act as if they were R in
  5063. // terms of their influence on neutrals. Start-of-level-run (sor)
  5064. // and end-of-level-run (eor) are used at level run boundaries.
  5065. // N2. Any remaining neutrals take the embedding direction.
  5066. for (var i$6 = 0; i$6 < len; ++i$6) {
  5067. if (isNeutral.test(types[i$6])) {
  5068. var end$1 = (void 0);
  5069. for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
  5070. var before = (i$6 ? types[i$6-1] : outerType) == "L";
  5071. var after = (end$1 < len ? types[end$1] : outerType) == "L";
  5072. var replace$1 = before == after ? (before ? "L" : "R") : outerType;
  5073. for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
  5074. i$6 = end$1 - 1;
  5075. }
  5076. }
  5077. // Here we depart from the documented algorithm, in order to avoid
  5078. // building up an actual levels array. Since there are only three
  5079. // levels (0, 1, 2) in an implementation that doesn't take
  5080. // explicit embedding into account, we can build up the order on
  5081. // the fly, without following the level-based algorithm.
  5082. var order = [], m;
  5083. for (var i$7 = 0; i$7 < len;) {
  5084. if (countsAsLeft.test(types[i$7])) {
  5085. var start = i$7;
  5086. for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
  5087. order.push(new BidiSpan(0, start, i$7));
  5088. } else {
  5089. var pos = i$7, at = order.length;
  5090. for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
  5091. for (var j$2 = pos; j$2 < i$7;) {
  5092. if (countsAsNum.test(types[j$2])) {
  5093. if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
  5094. var nstart = j$2;
  5095. for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
  5096. order.splice(at, 0, new BidiSpan(2, nstart, j$2));
  5097. pos = j$2;
  5098. } else { ++j$2; }
  5099. }
  5100. if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
  5101. }
  5102. }
  5103. if (order[0].level == 1 && (m = str.match(/^\s+/))) {
  5104. order[0].from = m[0].length;
  5105. order.unshift(new BidiSpan(0, 0, m[0].length));
  5106. }
  5107. if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
  5108. lst(order).to -= m[0].length;
  5109. order.push(new BidiSpan(0, len - m[0].length, len));
  5110. }
  5111. return direction == "rtl" ? order.reverse() : order
  5112. }
  5113. })();
  5114. // Get the bidi ordering for the given line (and cache it). Returns
  5115. // false for lines that are fully left-to-right, and an array of
  5116. // BidiSpan objects otherwise.
  5117. function getOrder(line, direction) {
  5118. var order = line.order;
  5119. if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
  5120. return order
  5121. }
  5122. function moveCharLogically(line, ch, dir) {
  5123. var target = skipExtendingChars(line.text, ch + dir, dir);
  5124. return target < 0 || target > line.text.length ? null : target
  5125. }
  5126. function moveLogically(line, start, dir) {
  5127. var ch = moveCharLogically(line, start.ch, dir);
  5128. return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  5129. }
  5130. function endOfLine(visually, cm, lineObj, lineNo, dir) {
  5131. if (visually) {
  5132. var order = getOrder(lineObj, cm.doc.direction);
  5133. if (order) {
  5134. var part = dir < 0 ? lst(order) : order[0];
  5135. var moveInStorageOrder = (dir < 0) == (part.level == 1);
  5136. var sticky = moveInStorageOrder ? "after" : "before";
  5137. var ch;
  5138. // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
  5139. // it could be that the last bidi part is not on the last visual line,
  5140. // since visual lines contain content order-consecutive chunks.
  5141. // Thus, in rtl, we are looking for the first (content-order) character
  5142. // in the rtl chunk that is on the last line (that is, the same line
  5143. // as the last (content-order) character).
  5144. if (part.level > 0) {
  5145. var prep = prepareMeasureForLine(cm, lineObj);
  5146. ch = dir < 0 ? lineObj.text.length - 1 : 0;
  5147. var targetTop = measureCharPrepared(cm, prep, ch).top;
  5148. ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
  5149. if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); }
  5150. } else { ch = dir < 0 ? part.to : part.from; }
  5151. return new Pos(lineNo, ch, sticky)
  5152. }
  5153. }
  5154. return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  5155. }
  5156. function moveVisually(cm, line, start, dir) {
  5157. var bidi = getOrder(line, cm.doc.direction);
  5158. if (!bidi) { return moveLogically(line, start, dir) }
  5159. if (start.ch >= line.text.length) {
  5160. start.ch = line.text.length;
  5161. start.sticky = "before";
  5162. } else if (start.ch <= 0) {
  5163. start.ch = 0;
  5164. start.sticky = "after";
  5165. }
  5166. var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
  5167. if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
  5168. // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
  5169. // nothing interesting happens.
  5170. return moveLogically(line, start, dir)
  5171. }
  5172. var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
  5173. var prep;
  5174. var getWrappedLineExtent = function (ch) {
  5175. if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
  5176. prep = prep || prepareMeasureForLine(cm, line);
  5177. return wrappedLineExtentChar(cm, line, prep, ch)
  5178. };
  5179. var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
  5180. if (cm.doc.direction == "rtl" || part.level == 1) {
  5181. var moveInStorageOrder = (part.level == 1) == (dir < 0);
  5182. var ch = mv(start, moveInStorageOrder ? 1 : -1);
  5183. if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
  5184. // Case 2: We move within an rtl part or in an rtl editor on the same visual line
  5185. var sticky = moveInStorageOrder ? "before" : "after";
  5186. return new Pos(start.line, ch, sticky)
  5187. }
  5188. }
  5189. // Case 3: Could not move within this bidi part in this visual line, so leave
  5190. // the current bidi part
  5191. var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
  5192. var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
  5193. ? new Pos(start.line, mv(ch, 1), "before")
  5194. : new Pos(start.line, ch, "after"); };
  5195. for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
  5196. var part = bidi[partPos];
  5197. var moveInStorageOrder = (dir > 0) == (part.level != 1);
  5198. var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
  5199. if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
  5200. ch = moveInStorageOrder ? part.from : mv(part.to, -1);
  5201. if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
  5202. }
  5203. };
  5204. // Case 3a: Look for other bidi parts on the same visual line
  5205. var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
  5206. if (res) { return res }
  5207. // Case 3b: Look for other bidi parts on the next visual line
  5208. var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
  5209. if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
  5210. res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
  5211. if (res) { return res }
  5212. }
  5213. // Case 4: Nowhere to move
  5214. return null
  5215. }
  5216. // EVENT HANDLING
  5217. // Lightweight event framework. on/off also work on DOM nodes,
  5218. // registering native DOM handlers.
  5219. var noHandlers = [];
  5220. var on = function(emitter, type, f) {
  5221. if (emitter.addEventListener) {
  5222. emitter.addEventListener(type, f, false);
  5223. } else if (emitter.attachEvent) {
  5224. emitter.attachEvent("on" + type, f);
  5225. } else {
  5226. var map$$1 = emitter._handlers || (emitter._handlers = {});
  5227. map$$1[type] = (map$$1[type] || noHandlers).concat(f);
  5228. }
  5229. };
  5230. function getHandlers(emitter, type) {
  5231. return emitter._handlers && emitter._handlers[type] || noHandlers
  5232. }
  5233. function off(emitter, type, f) {
  5234. if (emitter.removeEventListener) {
  5235. emitter.removeEventListener(type, f, false);
  5236. } else if (emitter.detachEvent) {
  5237. emitter.detachEvent("on" + type, f);
  5238. } else {
  5239. var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
  5240. if (arr) {
  5241. var index = indexOf(arr, f);
  5242. if (index > -1)
  5243. { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
  5244. }
  5245. }
  5246. }
  5247. function signal(emitter, type /*, values...*/) {
  5248. var handlers = getHandlers(emitter, type);
  5249. if (!handlers.length) { return }
  5250. var args = Array.prototype.slice.call(arguments, 2);
  5251. for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  5252. }
  5253. // The DOM events that CodeMirror handles can be overridden by
  5254. // registering a (non-DOM) handler on the editor for the event name,
  5255. // and preventDefault-ing the event in that handler.
  5256. function signalDOMEvent(cm, e, override) {
  5257. if (typeof e == "string")
  5258. { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
  5259. signal(cm, override || e.type, cm, e);
  5260. return e_defaultPrevented(e) || e.codemirrorIgnore
  5261. }
  5262. function signalCursorActivity(cm) {
  5263. var arr = cm._handlers && cm._handlers.cursorActivity;
  5264. if (!arr) { return }
  5265. var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
  5266. for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
  5267. { set.push(arr[i]); } }
  5268. }
  5269. function hasHandler(emitter, type) {
  5270. return getHandlers(emitter, type).length > 0
  5271. }
  5272. // Add on and off methods to a constructor's prototype, to make
  5273. // registering events on such objects more convenient.
  5274. function eventMixin(ctor) {
  5275. ctor.prototype.on = function(type, f) {on(this, type, f);};
  5276. ctor.prototype.off = function(type, f) {off(this, type, f);};
  5277. }
  5278. // Due to the fact that we still support jurassic IE versions, some
  5279. // compatibility wrappers are needed.
  5280. function e_preventDefault(e) {
  5281. if (e.preventDefault) { e.preventDefault(); }
  5282. else { e.returnValue = false; }
  5283. }
  5284. function e_stopPropagation(e) {
  5285. if (e.stopPropagation) { e.stopPropagation(); }
  5286. else { e.cancelBubble = true; }
  5287. }
  5288. function e_defaultPrevented(e) {
  5289. return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  5290. }
  5291. function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
  5292. function e_target(e) {return e.target || e.srcElement}
  5293. function e_button(e) {
  5294. var b = e.which;
  5295. if (b == null) {
  5296. if (e.button & 1) { b = 1; }
  5297. else if (e.button & 2) { b = 3; }
  5298. else if (e.button & 4) { b = 2; }
  5299. }
  5300. if (mac && e.ctrlKey && b == 1) { b = 3; }
  5301. return b
  5302. }
  5303. // Detect drag-and-drop
  5304. var dragAndDrop = function() {
  5305. // There is *some* kind of drag-and-drop support in IE6-8, but I
  5306. // couldn't get it to work yet.
  5307. if (ie && ie_version < 9) { return false }
  5308. var div = elt('div');
  5309. return "draggable" in div || "dragDrop" in div
  5310. }();
  5311. var zwspSupported;
  5312. function zeroWidthElement(measure) {
  5313. if (zwspSupported == null) {
  5314. var test = elt("span", "\u200b");
  5315. removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
  5316. if (measure.firstChild.offsetHeight != 0)
  5317. { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
  5318. }
  5319. var node = zwspSupported ? elt("span", "\u200b") :
  5320. elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
  5321. node.setAttribute("cm-text", "");
  5322. return node
  5323. }
  5324. // Feature-detect IE's crummy client rect reporting for bidi text
  5325. var badBidiRects;
  5326. function hasBadBidiRects(measure) {
  5327. if (badBidiRects != null) { return badBidiRects }
  5328. var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
  5329. var r0 = range(txt, 0, 1).getBoundingClientRect();
  5330. var r1 = range(txt, 1, 2).getBoundingClientRect();
  5331. removeChildren(measure);
  5332. if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
  5333. return badBidiRects = (r1.right - r0.right < 3)
  5334. }
  5335. // See if "".split is the broken IE version, if so, provide an
  5336. // alternative way to split lines.
  5337. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
  5338. var pos = 0, result = [], l = string.length;
  5339. while (pos <= l) {
  5340. var nl = string.indexOf("\n", pos);
  5341. if (nl == -1) { nl = string.length; }
  5342. var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
  5343. var rt = line.indexOf("\r");
  5344. if (rt != -1) {
  5345. result.push(line.slice(0, rt));
  5346. pos += rt + 1;
  5347. } else {
  5348. result.push(line);
  5349. pos = nl + 1;
  5350. }
  5351. }
  5352. return result
  5353. } : function (string) { return string.split(/\r\n?|\n/); };
  5354. var hasSelection = window.getSelection ? function (te) {
  5355. try { return te.selectionStart != te.selectionEnd }
  5356. catch(e) { return false }
  5357. } : function (te) {
  5358. var range$$1;
  5359. try {range$$1 = te.ownerDocument.selection.createRange();}
  5360. catch(e) {}
  5361. if (!range$$1 || range$$1.parentElement() != te) { return false }
  5362. return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
  5363. };
  5364. var hasCopyEvent = (function () {
  5365. var e = elt("div");
  5366. if ("oncopy" in e) { return true }
  5367. e.setAttribute("oncopy", "return;");
  5368. return typeof e.oncopy == "function"
  5369. })();
  5370. var badZoomedRects = null;
  5371. function hasBadZoomedRects(measure) {
  5372. if (badZoomedRects != null) { return badZoomedRects }
  5373. var node = removeChildrenAndAdd(measure, elt("span", "x"));
  5374. var normal = node.getBoundingClientRect();
  5375. var fromRange = range(node, 0, 1).getBoundingClientRect();
  5376. return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  5377. }
  5378. // Known modes, by name and by MIME
  5379. var modes = {};
  5380. var mimeModes = {};
  5381. // Extra arguments are stored as the mode's dependencies, which is
  5382. // used by (legacy) mechanisms like loadmode.js to automatically
  5383. // load a mode. (Preferred mechanism is the require/define calls.)
  5384. function defineMode(name, mode) {
  5385. if (arguments.length > 2)
  5386. { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
  5387. modes[name] = mode;
  5388. }
  5389. function defineMIME(mime, spec) {
  5390. mimeModes[mime] = spec;
  5391. }
  5392. // Given a MIME type, a {name, ...options} config object, or a name
  5393. // string, return a mode config object.
  5394. function resolveMode(spec) {
  5395. if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
  5396. spec = mimeModes[spec];
  5397. } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
  5398. var found = mimeModes[spec.name];
  5399. if (typeof found == "string") { found = {name: found}; }
  5400. spec = createObj(found, spec);
  5401. spec.name = found.name;
  5402. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
  5403. return resolveMode("application/xml")
  5404. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
  5405. return resolveMode("application/json")
  5406. }
  5407. if (typeof spec == "string") { return {name: spec} }
  5408. else { return spec || {name: "null"} }
  5409. }
  5410. // Given a mode spec (anything that resolveMode accepts), find and
  5411. // initialize an actual mode object.
  5412. function getMode(options, spec) {
  5413. spec = resolveMode(spec);
  5414. var mfactory = modes[spec.name];
  5415. if (!mfactory) { return getMode(options, "text/plain") }
  5416. var modeObj = mfactory(options, spec);
  5417. if (modeExtensions.hasOwnProperty(spec.name)) {
  5418. var exts = modeExtensions[spec.name];
  5419. for (var prop in exts) {
  5420. if (!exts.hasOwnProperty(prop)) { continue }
  5421. if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
  5422. modeObj[prop] = exts[prop];
  5423. }
  5424. }
  5425. modeObj.name = spec.name;
  5426. if (spec.helperType) { modeObj.helperType = spec.helperType; }
  5427. if (spec.modeProps) { for (var prop$1 in spec.modeProps)
  5428. { modeObj[prop$1] = spec.modeProps[prop$1]; } }
  5429. return modeObj
  5430. }
  5431. // This can be used to attach properties to mode objects from
  5432. // outside the actual mode definition.
  5433. var modeExtensions = {};
  5434. function extendMode(mode, properties) {
  5435. var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
  5436. copyObj(properties, exts);
  5437. }
  5438. function copyState(mode, state) {
  5439. if (state === true) { return state }
  5440. if (mode.copyState) { return mode.copyState(state) }
  5441. var nstate = {};
  5442. for (var n in state) {
  5443. var val = state[n];
  5444. if (val instanceof Array) { val = val.concat([]); }
  5445. nstate[n] = val;
  5446. }
  5447. return nstate
  5448. }
  5449. // Given a mode and a state (for that mode), find the inner mode and
  5450. // state at the position that the state refers to.
  5451. function innerMode(mode, state) {
  5452. var info;
  5453. while (mode.innerMode) {
  5454. info = mode.innerMode(state);
  5455. if (!info || info.mode == mode) { break }
  5456. state = info.state;
  5457. mode = info.mode;
  5458. }
  5459. return info || {mode: mode, state: state}
  5460. }
  5461. function startState(mode, a1, a2) {
  5462. return mode.startState ? mode.startState(a1, a2) : true
  5463. }
  5464. // STRING STREAM
  5465. // Fed to the mode parsers, provides helper functions to make
  5466. // parsers more succinct.
  5467. var StringStream = function(string, tabSize) {
  5468. this.pos = this.start = 0;
  5469. this.string = string;
  5470. this.tabSize = tabSize || 8;
  5471. this.lastColumnPos = this.lastColumnValue = 0;
  5472. this.lineStart = 0;
  5473. };
  5474. StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  5475. StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  5476. StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  5477. StringStream.prototype.next = function () {
  5478. if (this.pos < this.string.length)
  5479. { return this.string.charAt(this.pos++) }
  5480. };
  5481. StringStream.prototype.eat = function (match) {
  5482. var ch = this.string.charAt(this.pos);
  5483. var ok;
  5484. if (typeof match == "string") { ok = ch == match; }
  5485. else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
  5486. if (ok) {++this.pos; return ch}
  5487. };
  5488. StringStream.prototype.eatWhile = function (match) {
  5489. var start = this.pos;
  5490. while (this.eat(match)){}
  5491. return this.pos > start
  5492. };
  5493. StringStream.prototype.eatSpace = function () {
  5494. var this$1 = this;
  5495. var start = this.pos;
  5496. while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
  5497. return this.pos > start
  5498. };
  5499. StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  5500. StringStream.prototype.skipTo = function (ch) {
  5501. var found = this.string.indexOf(ch, this.pos);
  5502. if (found > -1) {this.pos = found; return true}
  5503. };
  5504. StringStream.prototype.backUp = function (n) {this.pos -= n;};
  5505. StringStream.prototype.column = function () {
  5506. if (this.lastColumnPos < this.start) {
  5507. this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
  5508. this.lastColumnPos = this.start;
  5509. }
  5510. return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  5511. };
  5512. StringStream.prototype.indentation = function () {
  5513. return countColumn(this.string, null, this.tabSize) -
  5514. (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  5515. };
  5516. StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
  5517. if (typeof pattern == "string") {
  5518. var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
  5519. var substr = this.string.substr(this.pos, pattern.length);
  5520. if (cased(substr) == cased(pattern)) {
  5521. if (consume !== false) { this.pos += pattern.length; }
  5522. return true
  5523. }
  5524. } else {
  5525. var match = this.string.slice(this.pos).match(pattern);
  5526. if (match && match.index > 0) { return null }
  5527. if (match && consume !== false) { this.pos += match[0].length; }
  5528. return match
  5529. }
  5530. };
  5531. StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  5532. StringStream.prototype.hideFirstChars = function (n, inner) {
  5533. this.lineStart += n;
  5534. try { return inner() }
  5535. finally { this.lineStart -= n; }
  5536. };
  5537. // Compute a style array (an array starting with a mode generation
  5538. // -- for invalidation -- followed by pairs of end positions and
  5539. // style strings), which is used to highlight the tokens on the
  5540. // line.
  5541. function highlightLine(cm, line, state, forceToEnd) {
  5542. // A styles array always starts with a number identifying the
  5543. // mode/overlays that it is based on (for easy invalidation).
  5544. var st = [cm.state.modeGen], lineClasses = {};
  5545. // Compute the base array of styles
  5546. runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
  5547. lineClasses, forceToEnd);
  5548. // Run overlays, adjust style array.
  5549. var loop = function ( o ) {
  5550. var overlay = cm.state.overlays[o], i = 1, at = 0;
  5551. runMode(cm, line.text, overlay.mode, true, function (end, style) {
  5552. var start = i;
  5553. // Ensure there's a token end at the current position, and that i points at it
  5554. while (at < end) {
  5555. var i_end = st[i];
  5556. if (i_end > end)
  5557. { st.splice(i, 1, end, st[i+1], i_end); }
  5558. i += 2;
  5559. at = Math.min(end, i_end);
  5560. }
  5561. if (!style) { return }
  5562. if (overlay.opaque) {
  5563. st.splice(start, i - start, end, "overlay " + style);
  5564. i = start + 2;
  5565. } else {
  5566. for (; start < i; start += 2) {
  5567. var cur = st[start+1];
  5568. st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
  5569. }
  5570. }
  5571. }, lineClasses);
  5572. };
  5573. for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
  5574. return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  5575. }
  5576. function getLineStyles(cm, line, updateFrontier) {
  5577. if (!line.styles || line.styles[0] != cm.state.modeGen) {
  5578. var state = getStateBefore(cm, lineNo(line));
  5579. var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
  5580. line.stateAfter = state;
  5581. line.styles = result.styles;
  5582. if (result.classes) { line.styleClasses = result.classes; }
  5583. else if (line.styleClasses) { line.styleClasses = null; }
  5584. if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; }
  5585. }
  5586. return line.styles
  5587. }
  5588. function getStateBefore(cm, n, precise) {
  5589. var doc = cm.doc, display = cm.display;
  5590. if (!doc.mode.startState) { return true }
  5591. var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
  5592. if (!state) { state = startState(doc.mode); }
  5593. else { state = copyState(doc.mode, state); }
  5594. doc.iter(pos, n, function (line) {
  5595. processLine(cm, line.text, state);
  5596. var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
  5597. line.stateAfter = save ? copyState(doc.mode, state) : null;
  5598. ++pos;
  5599. });
  5600. if (precise) { doc.frontier = pos; }
  5601. return state
  5602. }
  5603. // Lightweight form of highlight -- proceed over this line and
  5604. // update state, but don't save a style array. Used for lines that
  5605. // aren't currently visible.
  5606. function processLine(cm, text, state, startAt) {
  5607. var mode = cm.doc.mode;
  5608. var stream = new StringStream(text, cm.options.tabSize);
  5609. stream.start = stream.pos = startAt || 0;
  5610. if (text == "") { callBlankLine(mode, state); }
  5611. while (!stream.eol()) {
  5612. readToken(mode, stream, state);
  5613. stream.start = stream.pos;
  5614. }
  5615. }
  5616. function callBlankLine(mode, state) {
  5617. if (mode.blankLine) { return mode.blankLine(state) }
  5618. if (!mode.innerMode) { return }
  5619. var inner = innerMode(mode, state);
  5620. if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  5621. }
  5622. function readToken(mode, stream, state, inner) {
  5623. for (var i = 0; i < 10; i++) {
  5624. if (inner) { inner[0] = innerMode(mode, state).mode; }
  5625. var style = mode.token(stream, state);
  5626. if (stream.pos > stream.start) { return style }
  5627. }
  5628. throw new Error("Mode " + mode.name + " failed to advance stream.")
  5629. }
  5630. // Utility for getTokenAt and getLineTokens
  5631. function takeToken(cm, pos, precise, asArray) {
  5632. var getObj = function (copy) { return ({
  5633. start: stream.start, end: stream.pos,
  5634. string: stream.current(),
  5635. type: style || null,
  5636. state: copy ? copyState(doc.mode, state) : state
  5637. }); };
  5638. var doc = cm.doc, mode = doc.mode, style;
  5639. pos = clipPos(doc, pos);
  5640. var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
  5641. var stream = new StringStream(line.text, cm.options.tabSize), tokens;
  5642. if (asArray) { tokens = []; }
  5643. while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
  5644. stream.start = stream.pos;
  5645. style = readToken(mode, stream, state);
  5646. if (asArray) { tokens.push(getObj(true)); }
  5647. }
  5648. return asArray ? tokens : getObj()
  5649. }
  5650. function extractLineClasses(type, output) {
  5651. if (type) { for (;;) {
  5652. var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
  5653. if (!lineClass) { break }
  5654. type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
  5655. var prop = lineClass[1] ? "bgClass" : "textClass";
  5656. if (output[prop] == null)
  5657. { output[prop] = lineClass[2]; }
  5658. else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
  5659. { output[prop] += " " + lineClass[2]; }
  5660. } }
  5661. return type
  5662. }
  5663. // Run the given mode's parser over a line, calling f for each token.
  5664. function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
  5665. var flattenSpans = mode.flattenSpans;
  5666. if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
  5667. var curStart = 0, curStyle = null;
  5668. var stream = new StringStream(text, cm.options.tabSize), style;
  5669. var inner = cm.options.addModeClass && [null];
  5670. if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); }
  5671. while (!stream.eol()) {
  5672. if (stream.pos > cm.options.maxHighlightLength) {
  5673. flattenSpans = false;
  5674. if (forceToEnd) { processLine(cm, text, state, stream.pos); }
  5675. stream.pos = text.length;
  5676. style = null;
  5677. } else {
  5678. style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
  5679. }
  5680. if (inner) {
  5681. var mName = inner[0].name;
  5682. if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
  5683. }
  5684. if (!flattenSpans || curStyle != style) {
  5685. while (curStart < stream.start) {
  5686. curStart = Math.min(stream.start, curStart + 5000);
  5687. f(curStart, curStyle);
  5688. }
  5689. curStyle = style;
  5690. }
  5691. stream.start = stream.pos;
  5692. }
  5693. while (curStart < stream.pos) {
  5694. // Webkit seems to refuse to render text nodes longer than 57444
  5695. // characters, and returns inaccurate measurements in nodes
  5696. // starting around 5000 chars.
  5697. var pos = Math.min(stream.pos, curStart + 5000);
  5698. f(pos, curStyle);
  5699. curStart = pos;
  5700. }
  5701. }
  5702. // Finds the line to start with when starting a parse. Tries to
  5703. // find a line with a stateAfter, so that it can start with a
  5704. // valid state. If that fails, it returns the line with the
  5705. // smallest indentation, which tends to need the least context to
  5706. // parse correctly.
  5707. function findStartLine(cm, n, precise) {
  5708. var minindent, minline, doc = cm.doc;
  5709. var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
  5710. for (var search = n; search > lim; --search) {
  5711. if (search <= doc.first) { return doc.first }
  5712. var line = getLine(doc, search - 1);
  5713. if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
  5714. var indented = countColumn(line.text, null, cm.options.tabSize);
  5715. if (minline == null || minindent > indented) {
  5716. minline = search - 1;
  5717. minindent = indented;
  5718. }
  5719. }
  5720. return minline
  5721. }
  5722. // LINE DATA STRUCTURE
  5723. // Line objects. These hold state related to a line, including
  5724. // highlighting info (the styles array).
  5725. var Line = function(text, markedSpans, estimateHeight) {
  5726. this.text = text;
  5727. attachMarkedSpans(this, markedSpans);
  5728. this.height = estimateHeight ? estimateHeight(this) : 1;
  5729. };
  5730. Line.prototype.lineNo = function () { return lineNo(this) };
  5731. eventMixin(Line);
  5732. // Change the content (text, markers) of a line. Automatically
  5733. // invalidates cached information and tries to re-estimate the
  5734. // line's height.
  5735. function updateLine(line, text, markedSpans, estimateHeight) {
  5736. line.text = text;
  5737. if (line.stateAfter) { line.stateAfter = null; }
  5738. if (line.styles) { line.styles = null; }
  5739. if (line.order != null) { line.order = null; }
  5740. detachMarkedSpans(line);
  5741. attachMarkedSpans(line, markedSpans);
  5742. var estHeight = estimateHeight ? estimateHeight(line) : 1;
  5743. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  5744. }
  5745. // Detach a line from the document tree and its markers.
  5746. function cleanUpLine(line) {
  5747. line.parent = null;
  5748. detachMarkedSpans(line);
  5749. }
  5750. // Convert a style as returned by a mode (either null, or a string
  5751. // containing one or more styles) to a CSS style. This is cached,
  5752. // and also looks for line-wide styles.
  5753. var styleToClassCache = {};
  5754. var styleToClassCacheWithMode = {};
  5755. function interpretTokenStyle(style, options) {
  5756. if (!style || /^\s*$/.test(style)) { return null }
  5757. var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
  5758. return cache[style] ||
  5759. (cache[style] = style.replace(/\S+/g, "cm-$&"))
  5760. }
  5761. // Render the DOM representation of the text of a line. Also builds
  5762. // up a 'line map', which points at the DOM nodes that represent
  5763. // specific stretches of text, and is used by the measuring code.
  5764. // The returned object contains the DOM node, this map, and
  5765. // information about line-wide styles that were set by the mode.
  5766. function buildLineContent(cm, lineView) {
  5767. // The padding-right forces the element to have a 'border', which
  5768. // is needed on Webkit to be able to get line-level bounding
  5769. // rectangles for it (in measureChar).
  5770. var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
  5771. var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
  5772. col: 0, pos: 0, cm: cm,
  5773. trailingSpace: false,
  5774. splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
  5775. lineView.measure = {};
  5776. // Iterate over the logical lines that make up this visual line.
  5777. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
  5778. var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
  5779. builder.pos = 0;
  5780. builder.addToken = buildToken;
  5781. // Optionally wire in some hacks into the token-rendering
  5782. // algorithm, to deal with browser quirks.
  5783. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
  5784. { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
  5785. builder.map = [];
  5786. var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
  5787. insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
  5788. if (line.styleClasses) {
  5789. if (line.styleClasses.bgClass)
  5790. { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
  5791. if (line.styleClasses.textClass)
  5792. { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
  5793. }
  5794. // Ensure at least a single node is present, for measuring.
  5795. if (builder.map.length == 0)
  5796. { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
  5797. // Store the map and a cache object for the current logical line
  5798. if (i == 0) {
  5799. lineView.measure.map = builder.map;
  5800. lineView.measure.cache = {};
  5801. } else {
  5802. (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
  5803. ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
  5804. }
  5805. }
  5806. // See issue #2901
  5807. if (webkit) {
  5808. var last = builder.content.lastChild;
  5809. if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
  5810. { builder.content.className = "cm-tab-wrap-hack"; }
  5811. }
  5812. signal(cm, "renderLine", cm, lineView.line, builder.pre);
  5813. if (builder.pre.className)
  5814. { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
  5815. return builder
  5816. }
  5817. function defaultSpecialCharPlaceholder(ch) {
  5818. var token = elt("span", "\u2022", "cm-invalidchar");
  5819. token.title = "\\u" + ch.charCodeAt(0).toString(16);
  5820. token.setAttribute("aria-label", token.title);
  5821. return token
  5822. }
  5823. // Build up the DOM representation for a single token, and add it to
  5824. // the line map. Takes care to render special characters separately.
  5825. function buildToken(builder, text, style, startStyle, endStyle, title, css) {
  5826. if (!text) { return }
  5827. var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
  5828. var special = builder.cm.state.specialChars, mustWrap = false;
  5829. var content;
  5830. if (!special.test(text)) {
  5831. builder.col += text.length;
  5832. content = document.createTextNode(displayText);
  5833. builder.map.push(builder.pos, builder.pos + text.length, content);
  5834. if (ie && ie_version < 9) { mustWrap = true; }
  5835. builder.pos += text.length;
  5836. } else {
  5837. content = document.createDocumentFragment();
  5838. var pos = 0;
  5839. while (true) {
  5840. special.lastIndex = pos;
  5841. var m = special.exec(text);
  5842. var skipped = m ? m.index - pos : text.length - pos;
  5843. if (skipped) {
  5844. var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
  5845. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
  5846. else { content.appendChild(txt); }
  5847. builder.map.push(builder.pos, builder.pos + skipped, txt);
  5848. builder.col += skipped;
  5849. builder.pos += skipped;
  5850. }
  5851. if (!m) { break }
  5852. pos += skipped + 1;
  5853. var txt$1 = (void 0);
  5854. if (m[0] == "\t") {
  5855. var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
  5856. txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
  5857. txt$1.setAttribute("role", "presentation");
  5858. txt$1.setAttribute("cm-text", "\t");
  5859. builder.col += tabWidth;
  5860. } else if (m[0] == "\r" || m[0] == "\n") {
  5861. txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
  5862. txt$1.setAttribute("cm-text", m[0]);
  5863. builder.col += 1;
  5864. } else {
  5865. txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
  5866. txt$1.setAttribute("cm-text", m[0]);
  5867. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
  5868. else { content.appendChild(txt$1); }
  5869. builder.col += 1;
  5870. }
  5871. builder.map.push(builder.pos, builder.pos + 1, txt$1);
  5872. builder.pos++;
  5873. }
  5874. }
  5875. builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
  5876. if (style || startStyle || endStyle || mustWrap || css) {
  5877. var fullStyle = style || "";
  5878. if (startStyle) { fullStyle += startStyle; }
  5879. if (endStyle) { fullStyle += endStyle; }
  5880. var token = elt("span", [content], fullStyle, css);
  5881. if (title) { token.title = title; }
  5882. return builder.content.appendChild(token)
  5883. }
  5884. builder.content.appendChild(content);
  5885. }
  5886. function splitSpaces(text, trailingBefore) {
  5887. if (text.length > 1 && !/ /.test(text)) { return text }
  5888. var spaceBefore = trailingBefore, result = "";
  5889. for (var i = 0; i < text.length; i++) {
  5890. var ch = text.charAt(i);
  5891. if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
  5892. { ch = "\u00a0"; }
  5893. result += ch;
  5894. spaceBefore = ch == " ";
  5895. }
  5896. return result
  5897. }
  5898. // Work around nonsense dimensions being reported for stretches of
  5899. // right-to-left text.
  5900. function buildTokenBadBidi(inner, order) {
  5901. return function (builder, text, style, startStyle, endStyle, title, css) {
  5902. style = style ? style + " cm-force-border" : "cm-force-border";
  5903. var start = builder.pos, end = start + text.length;
  5904. for (;;) {
  5905. // Find the part that overlaps with the start of this text
  5906. var part = (void 0);
  5907. for (var i = 0; i < order.length; i++) {
  5908. part = order[i];
  5909. if (part.to > start && part.from <= start) { break }
  5910. }
  5911. if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
  5912. inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
  5913. startStyle = null;
  5914. text = text.slice(part.to - start);
  5915. start = part.to;
  5916. }
  5917. }
  5918. }
  5919. function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
  5920. var widget = !ignoreWidget && marker.widgetNode;
  5921. if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
  5922. if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
  5923. if (!widget)
  5924. { widget = builder.content.appendChild(document.createElement("span")); }
  5925. widget.setAttribute("cm-marker", marker.id);
  5926. }
  5927. if (widget) {
  5928. builder.cm.display.input.setUneditable(widget);
  5929. builder.content.appendChild(widget);
  5930. }
  5931. builder.pos += size;
  5932. builder.trailingSpace = false;
  5933. }
  5934. // Outputs a number of spans to make up a line, taking highlighting
  5935. // and marked text into account.
  5936. function insertLineContent(line, builder, styles) {
  5937. var spans = line.markedSpans, allText = line.text, at = 0;
  5938. if (!spans) {
  5939. for (var i$1 = 1; i$1 < styles.length; i$1+=2)
  5940. { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
  5941. return
  5942. }
  5943. var len = allText.length, pos = 0, i = 1, text = "", style, css;
  5944. var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
  5945. for (;;) {
  5946. if (nextChange == pos) { // Update current marker set
  5947. spanStyle = spanEndStyle = spanStartStyle = title = css = "";
  5948. collapsed = null; nextChange = Infinity;
  5949. var foundBookmarks = [], endStyles = (void 0);
  5950. for (var j = 0; j < spans.length; ++j) {
  5951. var sp = spans[j], m = sp.marker;
  5952. if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
  5953. foundBookmarks.push(m);
  5954. } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
  5955. if (sp.to != null && sp.to != pos && nextChange > sp.to) {
  5956. nextChange = sp.to;
  5957. spanEndStyle = "";
  5958. }
  5959. if (m.className) { spanStyle += " " + m.className; }
  5960. if (m.css) { css = (css ? css + ";" : "") + m.css; }
  5961. if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
  5962. if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
  5963. if (m.title && !title) { title = m.title; }
  5964. if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
  5965. { collapsed = sp; }
  5966. } else if (sp.from > pos && nextChange > sp.from) {
  5967. nextChange = sp.from;
  5968. }
  5969. }
  5970. if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
  5971. { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
  5972. if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
  5973. { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
  5974. if (collapsed && (collapsed.from || 0) == pos) {
  5975. buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
  5976. collapsed.marker, collapsed.from == null);
  5977. if (collapsed.to == null) { return }
  5978. if (collapsed.to == pos) { collapsed = false; }
  5979. }
  5980. }
  5981. if (pos >= len) { break }
  5982. var upto = Math.min(len, nextChange);
  5983. while (true) {
  5984. if (text) {
  5985. var end = pos + text.length;
  5986. if (!collapsed) {
  5987. var tokenText = end > upto ? text.slice(0, upto - pos) : text;
  5988. builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
  5989. spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
  5990. }
  5991. if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
  5992. pos = end;
  5993. spanStartStyle = "";
  5994. }
  5995. text = allText.slice(at, at = styles[i++]);
  5996. style = interpretTokenStyle(styles[i++], builder.cm.options);
  5997. }
  5998. }
  5999. }
  6000. // These objects are used to represent the visible (currently drawn)
  6001. // part of the document. A LineView may correspond to multiple
  6002. // logical lines, if those are connected by collapsed ranges.
  6003. function LineView(doc, line, lineN) {
  6004. // The starting line
  6005. this.line = line;
  6006. // Continuing lines, if any
  6007. this.rest = visualLineContinued(line);
  6008. // Number of logical lines in this visual line
  6009. this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
  6010. this.node = this.text = null;
  6011. this.hidden = lineIsHidden(doc, line);
  6012. }
  6013. // Create a range of LineView objects for the given lines.
  6014. function buildViewArray(cm, from, to) {
  6015. var array = [], nextPos;
  6016. for (var pos = from; pos < to; pos = nextPos) {
  6017. var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
  6018. nextPos = pos + view.size;
  6019. array.push(view);
  6020. }
  6021. return array
  6022. }
  6023. var operationGroup = null;
  6024. function pushOperation(op) {
  6025. if (operationGroup) {
  6026. operationGroup.ops.push(op);
  6027. } else {
  6028. op.ownsGroup = operationGroup = {
  6029. ops: [op],
  6030. delayedCallbacks: []
  6031. };
  6032. }
  6033. }
  6034. function fireCallbacksForOps(group) {
  6035. // Calls delayed callbacks and cursorActivity handlers until no
  6036. // new ones appear
  6037. var callbacks = group.delayedCallbacks, i = 0;
  6038. do {
  6039. for (; i < callbacks.length; i++)
  6040. { callbacks[i].call(null); }
  6041. for (var j = 0; j < group.ops.length; j++) {
  6042. var op = group.ops[j];
  6043. if (op.cursorActivityHandlers)
  6044. { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
  6045. { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
  6046. }
  6047. } while (i < callbacks.length)
  6048. }
  6049. function finishOperation(op, endCb) {
  6050. var group = op.ownsGroup;
  6051. if (!group) { return }
  6052. try { fireCallbacksForOps(group); }
  6053. finally {
  6054. operationGroup = null;
  6055. endCb(group);
  6056. }
  6057. }
  6058. var orphanDelayedCallbacks = null;
  6059. // Often, we want to signal events at a point where we are in the
  6060. // middle of some work, but don't want the handler to start calling
  6061. // other methods on the editor, which might be in an inconsistent
  6062. // state or simply not expect any other events to happen.
  6063. // signalLater looks whether there are any handlers, and schedules
  6064. // them to be executed when the last operation ends, or, if no
  6065. // operation is active, when a timeout fires.
  6066. function signalLater(emitter, type /*, values...*/) {
  6067. var arr = getHandlers(emitter, type);
  6068. if (!arr.length) { return }
  6069. var args = Array.prototype.slice.call(arguments, 2), list;
  6070. if (operationGroup) {
  6071. list = operationGroup.delayedCallbacks;
  6072. } else if (orphanDelayedCallbacks) {
  6073. list = orphanDelayedCallbacks;
  6074. } else {
  6075. list = orphanDelayedCallbacks = [];
  6076. setTimeout(fireOrphanDelayed, 0);
  6077. }
  6078. var loop = function ( i ) {
  6079. list.push(function () { return arr[i].apply(null, args); });
  6080. };
  6081. for (var i = 0; i < arr.length; ++i)
  6082. loop( i );
  6083. }
  6084. function fireOrphanDelayed() {
  6085. var delayed = orphanDelayedCallbacks;
  6086. orphanDelayedCallbacks = null;
  6087. for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  6088. }
  6089. // When an aspect of a line changes, a string is added to
  6090. // lineView.changes. This updates the relevant part of the line's
  6091. // DOM structure.
  6092. function updateLineForChanges(cm, lineView, lineN, dims) {
  6093. for (var j = 0; j < lineView.changes.length; j++) {
  6094. var type = lineView.changes[j];
  6095. if (type == "text") { updateLineText(cm, lineView); }
  6096. else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
  6097. else if (type == "class") { updateLineClasses(cm, lineView); }
  6098. else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
  6099. }
  6100. lineView.changes = null;
  6101. }
  6102. // Lines with gutter elements, widgets or a background class need to
  6103. // be wrapped, and have the extra elements added to the wrapper div
  6104. function ensureLineWrapped(lineView) {
  6105. if (lineView.node == lineView.text) {
  6106. lineView.node = elt("div", null, null, "position: relative");
  6107. if (lineView.text.parentNode)
  6108. { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
  6109. lineView.node.appendChild(lineView.text);
  6110. if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
  6111. }
  6112. return lineView.node
  6113. }
  6114. function updateLineBackground(cm, lineView) {
  6115. var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
  6116. if (cls) { cls += " CodeMirror-linebackground"; }
  6117. if (lineView.background) {
  6118. if (cls) { lineView.background.className = cls; }
  6119. else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
  6120. } else if (cls) {
  6121. var wrap = ensureLineWrapped(lineView);
  6122. lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
  6123. cm.display.input.setUneditable(lineView.background);
  6124. }
  6125. }
  6126. // Wrapper around buildLineContent which will reuse the structure
  6127. // in display.externalMeasured when possible.
  6128. function getLineContent(cm, lineView) {
  6129. var ext = cm.display.externalMeasured;
  6130. if (ext && ext.line == lineView.line) {
  6131. cm.display.externalMeasured = null;
  6132. lineView.measure = ext.measure;
  6133. return ext.built
  6134. }
  6135. return buildLineContent(cm, lineView)
  6136. }
  6137. // Redraw the line's text. Interacts with the background and text
  6138. // classes because the mode may output tokens that influence these
  6139. // classes.
  6140. function updateLineText(cm, lineView) {
  6141. var cls = lineView.text.className;
  6142. var built = getLineContent(cm, lineView);
  6143. if (lineView.text == lineView.node) { lineView.node = built.pre; }
  6144. lineView.text.parentNode.replaceChild(built.pre, lineView.text);
  6145. lineView.text = built.pre;
  6146. if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
  6147. lineView.bgClass = built.bgClass;
  6148. lineView.textClass = built.textClass;
  6149. updateLineClasses(cm, lineView);
  6150. } else if (cls) {
  6151. lineView.text.className = cls;
  6152. }
  6153. }
  6154. function updateLineClasses(cm, lineView) {
  6155. updateLineBackground(cm, lineView);
  6156. if (lineView.line.wrapClass)
  6157. { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
  6158. else if (lineView.node != lineView.text)
  6159. { lineView.node.className = ""; }
  6160. var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
  6161. lineView.text.className = textClass || "";
  6162. }
  6163. function updateLineGutter(cm, lineView, lineN, dims) {
  6164. if (lineView.gutter) {
  6165. lineView.node.removeChild(lineView.gutter);
  6166. lineView.gutter = null;
  6167. }
  6168. if (lineView.gutterBackground) {
  6169. lineView.node.removeChild(lineView.gutterBackground);
  6170. lineView.gutterBackground = null;
  6171. }
  6172. if (lineView.line.gutterClass) {
  6173. var wrap = ensureLineWrapped(lineView);
  6174. lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
  6175. ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
  6176. cm.display.input.setUneditable(lineView.gutterBackground);
  6177. wrap.insertBefore(lineView.gutterBackground, lineView.text);
  6178. }
  6179. var markers = lineView.line.gutterMarkers;
  6180. if (cm.options.lineNumbers || markers) {
  6181. var wrap$1 = ensureLineWrapped(lineView);
  6182. var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
  6183. cm.display.input.setUneditable(gutterWrap);
  6184. wrap$1.insertBefore(gutterWrap, lineView.text);
  6185. if (lineView.line.gutterClass)
  6186. { gutterWrap.className += " " + lineView.line.gutterClass; }
  6187. if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  6188. { lineView.lineNumber = gutterWrap.appendChild(
  6189. elt("div", lineNumberFor(cm.options, lineN),
  6190. "CodeMirror-linenumber CodeMirror-gutter-elt",
  6191. ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
  6192. if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
  6193. var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
  6194. if (found)
  6195. { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
  6196. ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
  6197. } }
  6198. }
  6199. }
  6200. function updateLineWidgets(cm, lineView, dims) {
  6201. if (lineView.alignable) { lineView.alignable = null; }
  6202. for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
  6203. next = node.nextSibling;
  6204. if (node.className == "CodeMirror-linewidget")
  6205. { lineView.node.removeChild(node); }
  6206. }
  6207. insertLineWidgets(cm, lineView, dims);
  6208. }
  6209. // Build a line's DOM representation from scratch
  6210. function buildLineElement(cm, lineView, lineN, dims) {
  6211. var built = getLineContent(cm, lineView);
  6212. lineView.text = lineView.node = built.pre;
  6213. if (built.bgClass) { lineView.bgClass = built.bgClass; }
  6214. if (built.textClass) { lineView.textClass = built.textClass; }
  6215. updateLineClasses(cm, lineView);
  6216. updateLineGutter(cm, lineView, lineN, dims);
  6217. insertLineWidgets(cm, lineView, dims);
  6218. return lineView.node
  6219. }
  6220. // A lineView may contain multiple logical lines (when merged by
  6221. // collapsed spans). The widgets for all of them need to be drawn.
  6222. function insertLineWidgets(cm, lineView, dims) {
  6223. insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
  6224. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  6225. { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  6226. }
  6227. function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
  6228. if (!line.widgets) { return }
  6229. var wrap = ensureLineWrapped(lineView);
  6230. for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  6231. var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
  6232. if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
  6233. positionLineWidget(widget, node, lineView, dims);
  6234. cm.display.input.setUneditable(node);
  6235. if (allowAbove && widget.above)
  6236. { wrap.insertBefore(node, lineView.gutter || lineView.text); }
  6237. else
  6238. { wrap.appendChild(node); }
  6239. signalLater(widget, "redraw");
  6240. }
  6241. }
  6242. function positionLineWidget(widget, node, lineView, dims) {
  6243. if (widget.noHScroll) {
  6244. (lineView.alignable || (lineView.alignable = [])).push(node);
  6245. var width = dims.wrapperWidth;
  6246. node.style.left = dims.fixedPos + "px";
  6247. if (!widget.coverGutter) {
  6248. width -= dims.gutterTotalWidth;
  6249. node.style.paddingLeft = dims.gutterTotalWidth + "px";
  6250. }
  6251. node.style.width = width + "px";
  6252. }
  6253. if (widget.coverGutter) {
  6254. node.style.zIndex = 5;
  6255. node.style.position = "relative";
  6256. if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
  6257. }
  6258. }
  6259. function widgetHeight(widget) {
  6260. if (widget.height != null) { return widget.height }
  6261. var cm = widget.doc.cm;
  6262. if (!cm) { return 0 }
  6263. if (!contains(document.body, widget.node)) {
  6264. var parentStyle = "position: relative;";
  6265. if (widget.coverGutter)
  6266. { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
  6267. if (widget.noHScroll)
  6268. { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
  6269. removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
  6270. }
  6271. return widget.height = widget.node.parentNode.offsetHeight
  6272. }
  6273. // Return true when the given mouse event happened in a widget
  6274. function eventInWidget(display, e) {
  6275. for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
  6276. if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
  6277. (n.parentNode == display.sizer && n != display.mover))
  6278. { return true }
  6279. }
  6280. }
  6281. // POSITION MEASUREMENT
  6282. function paddingTop(display) {return display.lineSpace.offsetTop}
  6283. function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  6284. function paddingH(display) {
  6285. if (display.cachedPaddingH) { return display.cachedPaddingH }
  6286. var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
  6287. var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
  6288. var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
  6289. if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
  6290. return data
  6291. }
  6292. function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  6293. function displayWidth(cm) {
  6294. return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  6295. }
  6296. function displayHeight(cm) {
  6297. return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  6298. }
  6299. // Ensure the lineView.wrapping.heights array is populated. This is
  6300. // an array of bottom offsets for the lines that make up a drawn
  6301. // line. When lineWrapping is on, there might be more than one
  6302. // height.
  6303. function ensureLineHeights(cm, lineView, rect) {
  6304. var wrapping = cm.options.lineWrapping;
  6305. var curWidth = wrapping && displayWidth(cm);
  6306. if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
  6307. var heights = lineView.measure.heights = [];
  6308. if (wrapping) {
  6309. lineView.measure.width = curWidth;
  6310. var rects = lineView.text.firstChild.getClientRects();
  6311. for (var i = 0; i < rects.length - 1; i++) {
  6312. var cur = rects[i], next = rects[i + 1];
  6313. if (Math.abs(cur.bottom - next.bottom) > 2)
  6314. { heights.push((cur.bottom + next.top) / 2 - rect.top); }
  6315. }
  6316. }
  6317. heights.push(rect.bottom - rect.top);
  6318. }
  6319. }
  6320. // Find a line map (mapping character offsets to text nodes) and a
  6321. // measurement cache for the given line number. (A line view might
  6322. // contain multiple lines when collapsed ranges are present.)
  6323. function mapFromLineView(lineView, line, lineN) {
  6324. if (lineView.line == line)
  6325. { return {map: lineView.measure.map, cache: lineView.measure.cache} }
  6326. for (var i = 0; i < lineView.rest.length; i++)
  6327. { if (lineView.rest[i] == line)
  6328. { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
  6329. for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
  6330. { if (lineNo(lineView.rest[i$1]) > lineN)
  6331. { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  6332. }
  6333. // Render a line into the hidden node display.externalMeasured. Used
  6334. // when measurement is needed for a line that's not in the viewport.
  6335. function updateExternalMeasurement(cm, line) {
  6336. line = visualLine(line);
  6337. var lineN = lineNo(line);
  6338. var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
  6339. view.lineN = lineN;
  6340. var built = view.built = buildLineContent(cm, view);
  6341. view.text = built.pre;
  6342. removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
  6343. return view
  6344. }
  6345. // Get a {top, bottom, left, right} box (in line-local coordinates)
  6346. // for a given character.
  6347. function measureChar(cm, line, ch, bias) {
  6348. return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  6349. }
  6350. // Find a line view that corresponds to the given line number.
  6351. function findViewForLine(cm, lineN) {
  6352. if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
  6353. { return cm.display.view[findViewIndex(cm, lineN)] }
  6354. var ext = cm.display.externalMeasured;
  6355. if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
  6356. { return ext }
  6357. }
  6358. // Measurement can be split in two steps, the set-up work that
  6359. // applies to the whole line, and the measurement of the actual
  6360. // character. Functions like coordsChar, that need to do a lot of
  6361. // measurements in a row, can thus ensure that the set-up work is
  6362. // only done once.
  6363. function prepareMeasureForLine(cm, line) {
  6364. var lineN = lineNo(line);
  6365. var view = findViewForLine(cm, lineN);
  6366. if (view && !view.text) {
  6367. view = null;
  6368. } else if (view && view.changes) {
  6369. updateLineForChanges(cm, view, lineN, getDimensions(cm));
  6370. cm.curOp.forceUpdate = true;
  6371. }
  6372. if (!view)
  6373. { view = updateExternalMeasurement(cm, line); }
  6374. var info = mapFromLineView(view, line, lineN);
  6375. return {
  6376. line: line, view: view, rect: null,
  6377. map: info.map, cache: info.cache, before: info.before,
  6378. hasHeights: false
  6379. }
  6380. }
  6381. // Given a prepared measurement object, measures the position of an
  6382. // actual character (or fetches it from the cache).
  6383. function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
  6384. if (prepared.before) { ch = -1; }
  6385. var key = ch + (bias || ""), found;
  6386. if (prepared.cache.hasOwnProperty(key)) {
  6387. found = prepared.cache[key];
  6388. } else {
  6389. if (!prepared.rect)
  6390. { prepared.rect = prepared.view.text.getBoundingClientRect(); }
  6391. if (!prepared.hasHeights) {
  6392. ensureLineHeights(cm, prepared.view, prepared.rect);
  6393. prepared.hasHeights = true;
  6394. }
  6395. found = measureCharInner(cm, prepared, ch, bias);
  6396. if (!found.bogus) { prepared.cache[key] = found; }
  6397. }
  6398. return {left: found.left, right: found.right,
  6399. top: varHeight ? found.rtop : found.top,
  6400. bottom: varHeight ? found.rbottom : found.bottom}
  6401. }
  6402. var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
  6403. function nodeAndOffsetInLineMap(map$$1, ch, bias) {
  6404. var node, start, end, collapse, mStart, mEnd;
  6405. // First, search the line map for the text node corresponding to,
  6406. // or closest to, the target character.
  6407. for (var i = 0; i < map$$1.length; i += 3) {
  6408. mStart = map$$1[i];
  6409. mEnd = map$$1[i + 1];
  6410. if (ch < mStart) {
  6411. start = 0; end = 1;
  6412. collapse = "left";
  6413. } else if (ch < mEnd) {
  6414. start = ch - mStart;
  6415. end = start + 1;
  6416. } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
  6417. end = mEnd - mStart;
  6418. start = end - 1;
  6419. if (ch >= mEnd) { collapse = "right"; }
  6420. }
  6421. if (start != null) {
  6422. node = map$$1[i + 2];
  6423. if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
  6424. { collapse = bias; }
  6425. if (bias == "left" && start == 0)
  6426. { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
  6427. node = map$$1[(i -= 3) + 2];
  6428. collapse = "left";
  6429. } }
  6430. if (bias == "right" && start == mEnd - mStart)
  6431. { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
  6432. node = map$$1[(i += 3) + 2];
  6433. collapse = "right";
  6434. } }
  6435. break
  6436. }
  6437. }
  6438. return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  6439. }
  6440. function getUsefulRect(rects, bias) {
  6441. var rect = nullRect;
  6442. if (bias == "left") { for (var i = 0; i < rects.length; i++) {
  6443. if ((rect = rects[i]).left != rect.right) { break }
  6444. } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
  6445. if ((rect = rects[i$1]).left != rect.right) { break }
  6446. } }
  6447. return rect
  6448. }
  6449. function measureCharInner(cm, prepared, ch, bias) {
  6450. var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
  6451. var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
  6452. var rect;
  6453. if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
  6454. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
  6455. while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
  6456. while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
  6457. if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
  6458. { rect = node.parentNode.getBoundingClientRect(); }
  6459. else
  6460. { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
  6461. if (rect.left || rect.right || start == 0) { break }
  6462. end = start;
  6463. start = start - 1;
  6464. collapse = "right";
  6465. }
  6466. if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
  6467. } else { // If it is a widget, simply get the box for the whole widget.
  6468. if (start > 0) { collapse = bias = "right"; }
  6469. var rects;
  6470. if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
  6471. { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
  6472. else
  6473. { rect = node.getBoundingClientRect(); }
  6474. }
  6475. if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
  6476. var rSpan = node.parentNode.getClientRects()[0];
  6477. if (rSpan)
  6478. { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
  6479. else
  6480. { rect = nullRect; }
  6481. }
  6482. var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
  6483. var mid = (rtop + rbot) / 2;
  6484. var heights = prepared.view.measure.heights;
  6485. var i = 0;
  6486. for (; i < heights.length - 1; i++)
  6487. { if (mid < heights[i]) { break } }
  6488. var top = i ? heights[i - 1] : 0, bot = heights[i];
  6489. var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
  6490. right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
  6491. top: top, bottom: bot};
  6492. if (!rect.left && !rect.right) { result.bogus = true; }
  6493. if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
  6494. return result
  6495. }
  6496. // Work around problem with bounding client rects on ranges being
  6497. // returned incorrectly when zoomed on IE10 and below.
  6498. function maybeUpdateRectForZooming(measure, rect) {
  6499. if (!window.screen || screen.logicalXDPI == null ||
  6500. screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
  6501. { return rect }
  6502. var scaleX = screen.logicalXDPI / screen.deviceXDPI;
  6503. var scaleY = screen.logicalYDPI / screen.deviceYDPI;
  6504. return {left: rect.left * scaleX, right: rect.right * scaleX,
  6505. top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  6506. }
  6507. function clearLineMeasurementCacheFor(lineView) {
  6508. if (lineView.measure) {
  6509. lineView.measure.cache = {};
  6510. lineView.measure.heights = null;
  6511. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  6512. { lineView.measure.caches[i] = {}; } }
  6513. }
  6514. }
  6515. function clearLineMeasurementCache(cm) {
  6516. cm.display.externalMeasure = null;
  6517. removeChildren(cm.display.lineMeasure);
  6518. for (var i = 0; i < cm.display.view.length; i++)
  6519. { clearLineMeasurementCacheFor(cm.display.view[i]); }
  6520. }
  6521. function clearCaches(cm) {
  6522. clearLineMeasurementCache(cm);
  6523. cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
  6524. if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
  6525. cm.display.lineNumChars = null;
  6526. }
  6527. function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft }
  6528. function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop }
  6529. // Converts a {top, bottom, left, right} box from line-local
  6530. // coordinates into another coordinate system. Context may be one of
  6531. // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  6532. // or "page".
  6533. function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
  6534. if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
  6535. var size = widgetHeight(lineObj.widgets[i]);
  6536. rect.top += size; rect.bottom += size;
  6537. } } }
  6538. if (context == "line") { return rect }
  6539. if (!context) { context = "local"; }
  6540. var yOff = heightAtLine(lineObj);
  6541. if (context == "local") { yOff += paddingTop(cm.display); }
  6542. else { yOff -= cm.display.viewOffset; }
  6543. if (context == "page" || context == "window") {
  6544. var lOff = cm.display.lineSpace.getBoundingClientRect();
  6545. yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
  6546. var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
  6547. rect.left += xOff; rect.right += xOff;
  6548. }
  6549. rect.top += yOff; rect.bottom += yOff;
  6550. return rect
  6551. }
  6552. // Coverts a box from "div" coords to another coordinate system.
  6553. // Context may be "window", "page", "div", or "local"./null.
  6554. function fromCoordSystem(cm, coords, context) {
  6555. if (context == "div") { return coords }
  6556. var left = coords.left, top = coords.top;
  6557. // First move into "page" coordinate system
  6558. if (context == "page") {
  6559. left -= pageScrollX();
  6560. top -= pageScrollY();
  6561. } else if (context == "local" || !context) {
  6562. var localBox = cm.display.sizer.getBoundingClientRect();
  6563. left += localBox.left;
  6564. top += localBox.top;
  6565. }
  6566. var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
  6567. return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  6568. }
  6569. function charCoords(cm, pos, context, lineObj, bias) {
  6570. if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
  6571. return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  6572. }
  6573. // Returns a box for a given cursor position, which may have an
  6574. // 'other' property containing the position of the secondary cursor
  6575. // on a bidi boundary.
  6576. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
  6577. // and after `char - 1` in writing order of `char - 1`
  6578. // A cursor Pos(line, char, "after") is on the same visual line as `char`
  6579. // and before `char` in writing order of `char`
  6580. // Examples (upper-case letters are RTL, lower-case are LTR):
  6581. // Pos(0, 1, ...)
  6582. // before after
  6583. // ab a|b a|b
  6584. // aB a|B aB|
  6585. // Ab |Ab A|b
  6586. // AB B|A B|A
  6587. // Every position after the last character on a line is considered to stick
  6588. // to the last character on the line.
  6589. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
  6590. lineObj = lineObj || getLine(cm.doc, pos.line);
  6591. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  6592. function get(ch, right) {
  6593. var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
  6594. if (right) { m.left = m.right; } else { m.right = m.left; }
  6595. return intoCoordSystem(cm, lineObj, m, context)
  6596. }
  6597. var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
  6598. if (ch >= lineObj.text.length) {
  6599. ch = lineObj.text.length;
  6600. sticky = "before";
  6601. } else if (ch <= 0) {
  6602. ch = 0;
  6603. sticky = "after";
  6604. }
  6605. if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
  6606. function getBidi(ch, partPos, invert) {
  6607. var part = order[partPos], right = (part.level % 2) != 0;
  6608. return get(invert ? ch - 1 : ch, right != invert)
  6609. }
  6610. var partPos = getBidiPartAt(order, ch, sticky);
  6611. var other = bidiOther;
  6612. var val = getBidi(ch, partPos, sticky == "before");
  6613. if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
  6614. return val
  6615. }
  6616. // Used to cheaply estimate the coordinates for a position. Used for
  6617. // intermediate scroll updates.
  6618. function estimateCoords(cm, pos) {
  6619. var left = 0;
  6620. pos = clipPos(cm.doc, pos);
  6621. if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
  6622. var lineObj = getLine(cm.doc, pos.line);
  6623. var top = heightAtLine(lineObj) + paddingTop(cm.display);
  6624. return {left: left, right: left, top: top, bottom: top + lineObj.height}
  6625. }
  6626. // Positions returned by coordsChar contain some extra information.
  6627. // xRel is the relative x position of the input coordinates compared
  6628. // to the found position (so xRel > 0 means the coordinates are to
  6629. // the right of the character position, for example). When outside
  6630. // is true, that means the coordinates lie outside the line's
  6631. // vertical range.
  6632. function PosWithInfo(line, ch, sticky, outside, xRel) {
  6633. var pos = Pos(line, ch, sticky);
  6634. pos.xRel = xRel;
  6635. if (outside) { pos.outside = true; }
  6636. return pos
  6637. }
  6638. // Compute the character position closest to the given coordinates.
  6639. // Input must be lineSpace-local ("div" coordinate system).
  6640. function coordsChar(cm, x, y) {
  6641. var doc = cm.doc;
  6642. y += cm.display.viewOffset;
  6643. if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
  6644. var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
  6645. if (lineN > last)
  6646. { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
  6647. if (x < 0) { x = 0; }
  6648. var lineObj = getLine(doc, lineN);
  6649. for (;;) {
  6650. var found = coordsCharInner(cm, lineObj, lineN, x, y);
  6651. var merged = collapsedSpanAtEnd(lineObj);
  6652. var mergedPos = merged && merged.find(0, true);
  6653. if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
  6654. { lineN = lineNo(lineObj = mergedPos.to.line); }
  6655. else
  6656. { return found }
  6657. }
  6658. }
  6659. function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
  6660. var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); };
  6661. var end = lineObj.text.length;
  6662. var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0);
  6663. end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end);
  6664. return {begin: begin, end: end}
  6665. }
  6666. function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
  6667. var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
  6668. return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  6669. }
  6670. function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
  6671. y -= heightAtLine(lineObj);
  6672. var begin = 0, end = lineObj.text.length;
  6673. var preparedMeasure = prepareMeasureForLine(cm, lineObj);
  6674. var pos;
  6675. var order = getOrder(lineObj, cm.doc.direction);
  6676. if (order) {
  6677. if (cm.options.lineWrapping) {
  6678. var assign;
  6679. ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign));
  6680. }
  6681. pos = new Pos(lineNo$$1, begin);
  6682. var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left;
  6683. var dir = beginLeft < x ? 1 : -1;
  6684. var prevDiff, diff = beginLeft - x, prevPos;
  6685. do {
  6686. prevDiff = diff;
  6687. prevPos = pos;
  6688. pos = moveVisually(cm, lineObj, pos, dir);
  6689. if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
  6690. pos = prevPos;
  6691. break
  6692. }
  6693. diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x;
  6694. } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
  6695. if (Math.abs(diff) > Math.abs(prevDiff)) {
  6696. if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
  6697. pos = prevPos;
  6698. }
  6699. } else {
  6700. var ch = findFirst(function (ch) {
  6701. var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line");
  6702. if (box.top > y) {
  6703. // For the cursor stickiness
  6704. end = Math.min(ch, end);
  6705. return true
  6706. }
  6707. else if (box.bottom <= y) { return false }
  6708. else if (box.left > x) { return true }
  6709. else if (box.right < x) { return false }
  6710. else { return (x - box.left < box.right - x) }
  6711. }, begin, end);
  6712. ch = skipExtendingChars(lineObj.text, ch, 1);
  6713. pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after");
  6714. }
  6715. var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure);
  6716. if (y < coords.top || coords.bottom < y) { pos.outside = true; }
  6717. pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0);
  6718. return pos
  6719. }
  6720. var measureText;
  6721. // Compute the default text height.
  6722. function textHeight(display) {
  6723. if (display.cachedTextHeight != null) { return display.cachedTextHeight }
  6724. if (measureText == null) {
  6725. measureText = elt("pre");
  6726. // Measure a bunch of lines, for browsers that compute
  6727. // fractional heights.
  6728. for (var i = 0; i < 49; ++i) {
  6729. measureText.appendChild(document.createTextNode("x"));
  6730. measureText.appendChild(elt("br"));
  6731. }
  6732. measureText.appendChild(document.createTextNode("x"));
  6733. }
  6734. removeChildrenAndAdd(display.measure, measureText);
  6735. var height = measureText.offsetHeight / 50;
  6736. if (height > 3) { display.cachedTextHeight = height; }
  6737. removeChildren(display.measure);
  6738. return height || 1
  6739. }
  6740. // Compute the default character width.
  6741. function charWidth(display) {
  6742. if (display.cachedCharWidth != null) { return display.cachedCharWidth }
  6743. var anchor = elt("span", "xxxxxxxxxx");
  6744. var pre = elt("pre", [anchor]);
  6745. removeChildrenAndAdd(display.measure, pre);
  6746. var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
  6747. if (width > 2) { display.cachedCharWidth = width; }
  6748. return width || 10
  6749. }
  6750. // Do a bulk-read of the DOM positions and sizes needed to draw the
  6751. // view, so that we don't interleave reading and writing to the DOM.
  6752. function getDimensions(cm) {
  6753. var d = cm.display, left = {}, width = {};
  6754. var gutterLeft = d.gutters.clientLeft;
  6755. for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  6756. left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
  6757. width[cm.options.gutters[i]] = n.clientWidth;
  6758. }
  6759. return {fixedPos: compensateForHScroll(d),
  6760. gutterTotalWidth: d.gutters.offsetWidth,
  6761. gutterLeft: left,
  6762. gutterWidth: width,
  6763. wrapperWidth: d.wrapper.clientWidth}
  6764. }
  6765. // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  6766. // but using getBoundingClientRect to get a sub-pixel-accurate
  6767. // result.
  6768. function compensateForHScroll(display) {
  6769. return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  6770. }
  6771. // Returns a function that estimates the height of a line, to use as
  6772. // first approximation until the line becomes visible (and is thus
  6773. // properly measurable).
  6774. function estimateHeight(cm) {
  6775. var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
  6776. var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
  6777. return function (line) {
  6778. if (lineIsHidden(cm.doc, line)) { return 0 }
  6779. var widgetsHeight = 0;
  6780. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
  6781. if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
  6782. } }
  6783. if (wrapping)
  6784. { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
  6785. else
  6786. { return widgetsHeight + th }
  6787. }
  6788. }
  6789. function estimateLineHeights(cm) {
  6790. var doc = cm.doc, est = estimateHeight(cm);
  6791. doc.iter(function (line) {
  6792. var estHeight = est(line);
  6793. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  6794. });
  6795. }
  6796. // Given a mouse event, find the corresponding position. If liberal
  6797. // is false, it checks whether a gutter or scrollbar was clicked,
  6798. // and returns null if it was. forRect is used by rectangular
  6799. // selections, and tries to estimate a character position even for
  6800. // coordinates beyond the right of the text.
  6801. function posFromMouse(cm, e, liberal, forRect) {
  6802. var display = cm.display;
  6803. if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
  6804. var x, y, space = display.lineSpace.getBoundingClientRect();
  6805. // Fails unpredictably on IE[67] when mouse is dragged around quickly.
  6806. try { x = e.clientX - space.left; y = e.clientY - space.top; }
  6807. catch (e) { return null }
  6808. var coords = coordsChar(cm, x, y), line;
  6809. if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
  6810. var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
  6811. coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
  6812. }
  6813. return coords
  6814. }
  6815. // Find the view element corresponding to a given line. Return null
  6816. // when the line isn't visible.
  6817. function findViewIndex(cm, n) {
  6818. if (n >= cm.display.viewTo) { return null }
  6819. n -= cm.display.viewFrom;
  6820. if (n < 0) { return null }
  6821. var view = cm.display.view;
  6822. for (var i = 0; i < view.length; i++) {
  6823. n -= view[i].size;
  6824. if (n < 0) { return i }
  6825. }
  6826. }
  6827. function updateSelection(cm) {
  6828. cm.display.input.showSelection(cm.display.input.prepareSelection());
  6829. }
  6830. function prepareSelection(cm, primary) {
  6831. var doc = cm.doc, result = {};
  6832. var curFragment = result.cursors = document.createDocumentFragment();
  6833. var selFragment = result.selection = document.createDocumentFragment();
  6834. for (var i = 0; i < doc.sel.ranges.length; i++) {
  6835. if (primary === false && i == doc.sel.primIndex) { continue }
  6836. var range$$1 = doc.sel.ranges[i];
  6837. if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
  6838. var collapsed = range$$1.empty();
  6839. if (collapsed || cm.options.showCursorWhenSelecting)
  6840. { drawSelectionCursor(cm, range$$1.head, curFragment); }
  6841. if (!collapsed)
  6842. { drawSelectionRange(cm, range$$1, selFragment); }
  6843. }
  6844. return result
  6845. }
  6846. // Draws a cursor for the given range
  6847. function drawSelectionCursor(cm, head, output) {
  6848. var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
  6849. var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
  6850. cursor.style.left = pos.left + "px";
  6851. cursor.style.top = pos.top + "px";
  6852. cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  6853. if (pos.other) {
  6854. // Secondary cursor, shown when on a 'jump' in bi-directional text
  6855. var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
  6856. otherCursor.style.display = "";
  6857. otherCursor.style.left = pos.other.left + "px";
  6858. otherCursor.style.top = pos.other.top + "px";
  6859. otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  6860. }
  6861. }
  6862. // Draws the given range as a highlighted selection
  6863. function drawSelectionRange(cm, range$$1, output) {
  6864. var display = cm.display, doc = cm.doc;
  6865. var fragment = document.createDocumentFragment();
  6866. var padding = paddingH(cm.display), leftSide = padding.left;
  6867. var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
  6868. function add(left, top, width, bottom) {
  6869. if (top < 0) { top = 0; }
  6870. top = Math.round(top);
  6871. bottom = Math.round(bottom);
  6872. 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")));
  6873. }
  6874. function drawForLine(line, fromArg, toArg) {
  6875. var lineObj = getLine(doc, line);
  6876. var lineLen = lineObj.text.length;
  6877. var start, end;
  6878. function coords(ch, bias) {
  6879. return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
  6880. }
  6881. iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
  6882. var leftPos = coords(from, "left"), rightPos, left, right;
  6883. if (from == to) {
  6884. rightPos = leftPos;
  6885. left = right = leftPos.left;
  6886. } else {
  6887. rightPos = coords(to - 1, "right");
  6888. if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
  6889. left = leftPos.left;
  6890. right = rightPos.right;
  6891. }
  6892. if (fromArg == null && from == 0) { left = leftSide; }
  6893. if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
  6894. add(left, leftPos.top, null, leftPos.bottom);
  6895. left = leftSide;
  6896. if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }
  6897. }
  6898. if (toArg == null && to == lineLen) { right = rightSide; }
  6899. if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
  6900. { start = leftPos; }
  6901. if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
  6902. { end = rightPos; }
  6903. if (left < leftSide + 1) { left = leftSide; }
  6904. add(left, rightPos.top, right - left, rightPos.bottom);
  6905. });
  6906. return {start: start, end: end}
  6907. }
  6908. var sFrom = range$$1.from(), sTo = range$$1.to();
  6909. if (sFrom.line == sTo.line) {
  6910. drawForLine(sFrom.line, sFrom.ch, sTo.ch);
  6911. } else {
  6912. var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
  6913. var singleVLine = visualLine(fromLine) == visualLine(toLine);
  6914. var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
  6915. var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
  6916. if (singleVLine) {
  6917. if (leftEnd.top < rightStart.top - 2) {
  6918. add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
  6919. add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
  6920. } else {
  6921. add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
  6922. }
  6923. }
  6924. if (leftEnd.bottom < rightStart.top)
  6925. { add(leftSide, leftEnd.bottom, null, rightStart.top); }
  6926. }
  6927. output.appendChild(fragment);
  6928. }
  6929. // Cursor-blinking
  6930. function restartBlink(cm) {
  6931. if (!cm.state.focused) { return }
  6932. var display = cm.display;
  6933. clearInterval(display.blinker);
  6934. var on = true;
  6935. display.cursorDiv.style.visibility = "";
  6936. if (cm.options.cursorBlinkRate > 0)
  6937. { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
  6938. cm.options.cursorBlinkRate); }
  6939. else if (cm.options.cursorBlinkRate < 0)
  6940. { display.cursorDiv.style.visibility = "hidden"; }
  6941. }
  6942. function ensureFocus(cm) {
  6943. if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
  6944. }
  6945. function delayBlurEvent(cm) {
  6946. cm.state.delayingBlurEvent = true;
  6947. setTimeout(function () { if (cm.state.delayingBlurEvent) {
  6948. cm.state.delayingBlurEvent = false;
  6949. onBlur(cm);
  6950. } }, 100);
  6951. }
  6952. function onFocus(cm, e) {
  6953. if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
  6954. if (cm.options.readOnly == "nocursor") { return }
  6955. if (!cm.state.focused) {
  6956. signal(cm, "focus", cm, e);
  6957. cm.state.focused = true;
  6958. addClass(cm.display.wrapper, "CodeMirror-focused");
  6959. // This test prevents this from firing when a context
  6960. // menu is closed (since the input reset would kill the
  6961. // select-all detection hack)
  6962. if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
  6963. cm.display.input.reset();
  6964. if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
  6965. }
  6966. cm.display.input.receivedFocus();
  6967. }
  6968. restartBlink(cm);
  6969. }
  6970. function onBlur(cm, e) {
  6971. if (cm.state.delayingBlurEvent) { return }
  6972. if (cm.state.focused) {
  6973. signal(cm, "blur", cm, e);
  6974. cm.state.focused = false;
  6975. rmClass(cm.display.wrapper, "CodeMirror-focused");
  6976. }
  6977. clearInterval(cm.display.blinker);
  6978. setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  6979. }
  6980. // Re-align line numbers and gutter marks to compensate for
  6981. // horizontal scrolling.
  6982. function alignHorizontally(cm) {
  6983. var display = cm.display, view = display.view;
  6984. if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
  6985. var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
  6986. var gutterW = display.gutters.offsetWidth, left = comp + "px";
  6987. for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
  6988. if (cm.options.fixedGutter) {
  6989. if (view[i].gutter)
  6990. { view[i].gutter.style.left = left; }
  6991. if (view[i].gutterBackground)
  6992. { view[i].gutterBackground.style.left = left; }
  6993. }
  6994. var align = view[i].alignable;
  6995. if (align) { for (var j = 0; j < align.length; j++)
  6996. { align[j].style.left = left; } }
  6997. } }
  6998. if (cm.options.fixedGutter)
  6999. { display.gutters.style.left = (comp + gutterW) + "px"; }
  7000. }
  7001. // Used to ensure that the line number gutter is still the right
  7002. // size for the current document size. Returns true when an update
  7003. // is needed.
  7004. function maybeUpdateLineNumberWidth(cm) {
  7005. if (!cm.options.lineNumbers) { return false }
  7006. var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
  7007. if (last.length != display.lineNumChars) {
  7008. var test = display.measure.appendChild(elt("div", [elt("div", last)],
  7009. "CodeMirror-linenumber CodeMirror-gutter-elt"));
  7010. var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  7011. display.lineGutter.style.width = "";
  7012. display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
  7013. display.lineNumWidth = display.lineNumInnerWidth + padding;
  7014. display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  7015. display.lineGutter.style.width = display.lineNumWidth + "px";
  7016. updateGutterSpace(cm);
  7017. return true
  7018. }
  7019. return false
  7020. }
  7021. // Read the actual heights of the rendered lines, and update their
  7022. // stored heights to match.
  7023. function updateHeightsInViewport(cm) {
  7024. var display = cm.display;
  7025. var prevBottom = display.lineDiv.offsetTop;
  7026. for (var i = 0; i < display.view.length; i++) {
  7027. var cur = display.view[i], height = (void 0);
  7028. if (cur.hidden) { continue }
  7029. if (ie && ie_version < 8) {
  7030. var bot = cur.node.offsetTop + cur.node.offsetHeight;
  7031. height = bot - prevBottom;
  7032. prevBottom = bot;
  7033. } else {
  7034. var box = cur.node.getBoundingClientRect();
  7035. height = box.bottom - box.top;
  7036. }
  7037. var diff = cur.line.height - height;
  7038. if (height < 2) { height = textHeight(display); }
  7039. if (diff > .001 || diff < -.001) {
  7040. updateLineHeight(cur.line, height);
  7041. updateWidgetHeight(cur.line);
  7042. if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
  7043. { updateWidgetHeight(cur.rest[j]); } }
  7044. }
  7045. }
  7046. }
  7047. // Read and store the height of line widgets associated with the
  7048. // given line.
  7049. function updateWidgetHeight(line) {
  7050. if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
  7051. { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }
  7052. }
  7053. // Compute the lines that are visible in a given viewport (defaults
  7054. // the the current scroll position). viewport may contain top,
  7055. // height, and ensure (see op.scrollToPos) properties.
  7056. function visibleLines(display, doc, viewport) {
  7057. var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
  7058. top = Math.floor(top - paddingTop(display));
  7059. var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
  7060. var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
  7061. // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
  7062. // forces those lines into the viewport (if possible).
  7063. if (viewport && viewport.ensure) {
  7064. var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
  7065. if (ensureFrom < from) {
  7066. from = ensureFrom;
  7067. to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
  7068. } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
  7069. from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
  7070. to = ensureTo;
  7071. }
  7072. }
  7073. return {from: from, to: Math.max(to, from + 1)}
  7074. }
  7075. // Sync the scrollable area and scrollbars, ensure the viewport
  7076. // covers the visible area.
  7077. function setScrollTop(cm, val) {
  7078. if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
  7079. cm.doc.scrollTop = val;
  7080. if (!gecko) { updateDisplaySimple(cm, {top: val}); }
  7081. if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  7082. cm.display.scrollbars.setScrollTop(val);
  7083. if (gecko) { updateDisplaySimple(cm); }
  7084. startWorker(cm, 100);
  7085. }
  7086. // Sync scroller and scrollbar, ensure the gutter elements are
  7087. // aligned.
  7088. function setScrollLeft(cm, val, isScroller) {
  7089. if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
  7090. val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
  7091. cm.doc.scrollLeft = val;
  7092. alignHorizontally(cm);
  7093. if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
  7094. cm.display.scrollbars.setScrollLeft(val);
  7095. }
  7096. // Since the delta values reported on mouse wheel events are
  7097. // unstandardized between browsers and even browser versions, and
  7098. // generally horribly unpredictable, this code starts by measuring
  7099. // the scroll effect that the first few mouse wheel events have,
  7100. // and, from that, detects the way it can convert deltas to pixel
  7101. // offsets afterwards.
  7102. //
  7103. // The reason we want to know the amount a wheel event will scroll
  7104. // is that it gives us a chance to update the display before the
  7105. // actual scrolling happens, reducing flickering.
  7106. var wheelSamples = 0;
  7107. var wheelPixelsPerUnit = null;
  7108. // Fill in a browser-detected starting value on browsers where we
  7109. // know one. These don't have to be accurate -- the result of them
  7110. // being wrong would just be a slight flicker on the first wheel
  7111. // scroll (if it is large enough).
  7112. if (ie) { wheelPixelsPerUnit = -.53; }
  7113. else if (gecko) { wheelPixelsPerUnit = 15; }
  7114. else if (chrome) { wheelPixelsPerUnit = -.7; }
  7115. else if (safari) { wheelPixelsPerUnit = -1/3; }
  7116. function wheelEventDelta(e) {
  7117. var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
  7118. if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
  7119. if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
  7120. else if (dy == null) { dy = e.wheelDelta; }
  7121. return {x: dx, y: dy}
  7122. }
  7123. function wheelEventPixels(e) {
  7124. var delta = wheelEventDelta(e);
  7125. delta.x *= wheelPixelsPerUnit;
  7126. delta.y *= wheelPixelsPerUnit;
  7127. return delta
  7128. }
  7129. function onScrollWheel(cm, e) {
  7130. var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
  7131. var display = cm.display, scroll = display.scroller;
  7132. // Quit if there's nothing to scroll here
  7133. var canScrollX = scroll.scrollWidth > scroll.clientWidth;
  7134. var canScrollY = scroll.scrollHeight > scroll.clientHeight;
  7135. if (!(dx && canScrollX || dy && canScrollY)) { return }
  7136. // Webkit browsers on OS X abort momentum scrolls when the target
  7137. // of the scroll event is removed from the scrollable element.
  7138. // This hack (see related code in patchDisplay) makes sure the
  7139. // element is kept around.
  7140. if (dy && mac && webkit) {
  7141. outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
  7142. for (var i = 0; i < view.length; i++) {
  7143. if (view[i].node == cur) {
  7144. cm.display.currentWheelTarget = cur;
  7145. break outer
  7146. }
  7147. }
  7148. }
  7149. }
  7150. // On some browsers, horizontal scrolling will cause redraws to
  7151. // happen before the gutter has been realigned, causing it to
  7152. // wriggle around in a most unseemly way. When we have an
  7153. // estimated pixels/delta value, we just handle horizontal
  7154. // scrolling entirely here. It'll be slightly off from native, but
  7155. // better than glitching out.
  7156. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
  7157. if (dy && canScrollY)
  7158. { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); }
  7159. setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
  7160. // Only prevent default scrolling if vertical scrolling is
  7161. // actually possible. Otherwise, it causes vertical scroll
  7162. // jitter on OSX trackpads when deltaX is small and deltaY
  7163. // is large (issue #3579)
  7164. if (!dy || (dy && canScrollY))
  7165. { e_preventDefault(e); }
  7166. display.wheelStartX = null; // Abort measurement, if in progress
  7167. return
  7168. }
  7169. // 'Project' the visible viewport to cover the area that is being
  7170. // scrolled into view (if we know enough to estimate it).
  7171. if (dy && wheelPixelsPerUnit != null) {
  7172. var pixels = dy * wheelPixelsPerUnit;
  7173. var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
  7174. if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
  7175. else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
  7176. updateDisplaySimple(cm, {top: top, bottom: bot});
  7177. }
  7178. if (wheelSamples < 20) {
  7179. if (display.wheelStartX == null) {
  7180. display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
  7181. display.wheelDX = dx; display.wheelDY = dy;
  7182. setTimeout(function () {
  7183. if (display.wheelStartX == null) { return }
  7184. var movedX = scroll.scrollLeft - display.wheelStartX;
  7185. var movedY = scroll.scrollTop - display.wheelStartY;
  7186. var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
  7187. (movedX && display.wheelDX && movedX / display.wheelDX);
  7188. display.wheelStartX = display.wheelStartY = null;
  7189. if (!sample) { return }
  7190. wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
  7191. ++wheelSamples;
  7192. }, 200);
  7193. } else {
  7194. display.wheelDX += dx; display.wheelDY += dy;
  7195. }
  7196. }
  7197. }
  7198. // SCROLLBARS
  7199. // Prepare DOM reads needed to update the scrollbars. Done in one
  7200. // shot to minimize update/measure roundtrips.
  7201. function measureForScrollbars(cm) {
  7202. var d = cm.display, gutterW = d.gutters.offsetWidth;
  7203. var docH = Math.round(cm.doc.height + paddingVert(cm.display));
  7204. return {
  7205. clientHeight: d.scroller.clientHeight,
  7206. viewHeight: d.wrapper.clientHeight,
  7207. scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
  7208. viewWidth: d.wrapper.clientWidth,
  7209. barLeft: cm.options.fixedGutter ? gutterW : 0,
  7210. docHeight: docH,
  7211. scrollHeight: docH + scrollGap(cm) + d.barHeight,
  7212. nativeBarWidth: d.nativeBarWidth,
  7213. gutterWidth: gutterW
  7214. }
  7215. }
  7216. var NativeScrollbars = function(place, scroll, cm) {
  7217. this.cm = cm;
  7218. var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
  7219. var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
  7220. place(vert); place(horiz);
  7221. on(vert, "scroll", function () {
  7222. if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
  7223. });
  7224. on(horiz, "scroll", function () {
  7225. if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
  7226. });
  7227. this.checkedZeroWidth = false;
  7228. // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  7229. if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  7230. };
  7231. NativeScrollbars.prototype.update = function (measure) {
  7232. var needsH = measure.scrollWidth > measure.clientWidth + 1;
  7233. var needsV = measure.scrollHeight > measure.clientHeight + 1;
  7234. var sWidth = measure.nativeBarWidth;
  7235. if (needsV) {
  7236. this.vert.style.display = "block";
  7237. this.vert.style.bottom = needsH ? sWidth + "px" : "0";
  7238. var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
  7239. // A bug in IE8 can cause this value to be negative, so guard it.
  7240. this.vert.firstChild.style.height =
  7241. Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
  7242. } else {
  7243. this.vert.style.display = "";
  7244. this.vert.firstChild.style.height = "0";
  7245. }
  7246. if (needsH) {
  7247. this.horiz.style.display = "block";
  7248. this.horiz.style.right = needsV ? sWidth + "px" : "0";
  7249. this.horiz.style.left = measure.barLeft + "px";
  7250. var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
  7251. this.horiz.firstChild.style.width =
  7252. Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
  7253. } else {
  7254. this.horiz.style.display = "";
  7255. this.horiz.firstChild.style.width = "0";
  7256. }
  7257. if (!this.checkedZeroWidth && measure.clientHeight > 0) {
  7258. if (sWidth == 0) { this.zeroWidthHack(); }
  7259. this.checkedZeroWidth = true;
  7260. }
  7261. return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  7262. };
  7263. NativeScrollbars.prototype.setScrollLeft = function (pos) {
  7264. if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
  7265. if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); }
  7266. };
  7267. NativeScrollbars.prototype.setScrollTop = function (pos) {
  7268. if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
  7269. if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); }
  7270. };
  7271. NativeScrollbars.prototype.zeroWidthHack = function () {
  7272. var w = mac && !mac_geMountainLion ? "12px" : "18px";
  7273. this.horiz.style.height = this.vert.style.width = w;
  7274. this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
  7275. this.disableHoriz = new Delayed;
  7276. this.disableVert = new Delayed;
  7277. };
  7278. NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) {
  7279. bar.style.pointerEvents = "auto";
  7280. function maybeDisable() {
  7281. // To find out whether the scrollbar is still visible, we
  7282. // check whether the element under the pixel in the bottom
  7283. // left corner of the scrollbar box is the scrollbar box
  7284. // itself (when the bar is still visible) or its filler child
  7285. // (when the bar is hidden). If it is still visible, we keep
  7286. // it enabled, if it's hidden, we disable pointer events.
  7287. var box = bar.getBoundingClientRect();
  7288. var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1);
  7289. if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
  7290. else { delay.set(1000, maybeDisable); }
  7291. }
  7292. delay.set(1000, maybeDisable);
  7293. };
  7294. NativeScrollbars.prototype.clear = function () {
  7295. var parent = this.horiz.parentNode;
  7296. parent.removeChild(this.horiz);
  7297. parent.removeChild(this.vert);
  7298. };
  7299. var NullScrollbars = function () {};
  7300. NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  7301. NullScrollbars.prototype.setScrollLeft = function () {};
  7302. NullScrollbars.prototype.setScrollTop = function () {};
  7303. NullScrollbars.prototype.clear = function () {};
  7304. function updateScrollbars(cm, measure) {
  7305. if (!measure) { measure = measureForScrollbars(cm); }
  7306. var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
  7307. updateScrollbarsInner(cm, measure);
  7308. for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
  7309. if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
  7310. { updateHeightsInViewport(cm); }
  7311. updateScrollbarsInner(cm, measureForScrollbars(cm));
  7312. startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
  7313. }
  7314. }
  7315. // Re-synchronize the fake scrollbars with the actual size of the
  7316. // content.
  7317. function updateScrollbarsInner(cm, measure) {
  7318. var d = cm.display;
  7319. var sizes = d.scrollbars.update(measure);
  7320. d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
  7321. d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
  7322. d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
  7323. if (sizes.right && sizes.bottom) {
  7324. d.scrollbarFiller.style.display = "block";
  7325. d.scrollbarFiller.style.height = sizes.bottom + "px";
  7326. d.scrollbarFiller.style.width = sizes.right + "px";
  7327. } else { d.scrollbarFiller.style.display = ""; }
  7328. if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
  7329. d.gutterFiller.style.display = "block";
  7330. d.gutterFiller.style.height = sizes.bottom + "px";
  7331. d.gutterFiller.style.width = measure.gutterWidth + "px";
  7332. } else { d.gutterFiller.style.display = ""; }
  7333. }
  7334. var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
  7335. function initScrollbars(cm) {
  7336. if (cm.display.scrollbars) {
  7337. cm.display.scrollbars.clear();
  7338. if (cm.display.scrollbars.addClass)
  7339. { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  7340. }
  7341. cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
  7342. cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
  7343. // Prevent clicks in the scrollbars from killing focus
  7344. on(node, "mousedown", function () {
  7345. if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
  7346. });
  7347. node.setAttribute("cm-not-content", "true");
  7348. }, function (pos, axis) {
  7349. if (axis == "horizontal") { setScrollLeft(cm, pos); }
  7350. else { setScrollTop(cm, pos); }
  7351. }, cm);
  7352. if (cm.display.scrollbars.addClass)
  7353. { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  7354. }
  7355. // SCROLLING THINGS INTO VIEW
  7356. // If an editor sits on the top or bottom of the window, partially
  7357. // scrolled out of view, this ensures that the cursor is visible.
  7358. function maybeScrollWindow(cm, rect) {
  7359. if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
  7360. var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
  7361. if (rect.top + box.top < 0) { doScroll = true; }
  7362. else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
  7363. if (doScroll != null && !phantom) {
  7364. 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;"));
  7365. cm.display.lineSpace.appendChild(scrollNode);
  7366. scrollNode.scrollIntoView(doScroll);
  7367. cm.display.lineSpace.removeChild(scrollNode);
  7368. }
  7369. }
  7370. // Scroll a given position into view (immediately), verifying that
  7371. // it actually became visible (as line heights are accurately
  7372. // measured, the position of something may 'drift' during drawing).
  7373. function scrollPosIntoView(cm, pos, end, margin) {
  7374. if (margin == null) { margin = 0; }
  7375. var rect;
  7376. for (var limit = 0; limit < 5; limit++) {
  7377. var changed = false;
  7378. var coords = cursorCoords(cm, pos);
  7379. var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
  7380. rect = {left: Math.min(coords.left, endCoords.left),
  7381. top: Math.min(coords.top, endCoords.top) - margin,
  7382. right: Math.max(coords.left, endCoords.left),
  7383. bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
  7384. var scrollPos = calculateScrollPos(cm, rect);
  7385. var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
  7386. if (scrollPos.scrollTop != null) {
  7387. setScrollTop(cm, scrollPos.scrollTop);
  7388. if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
  7389. }
  7390. if (scrollPos.scrollLeft != null) {
  7391. setScrollLeft(cm, scrollPos.scrollLeft);
  7392. if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
  7393. }
  7394. if (!changed) { break }
  7395. }
  7396. return rect
  7397. }
  7398. // Scroll a given set of coordinates into view (immediately).
  7399. function scrollIntoView(cm, rect) {
  7400. var scrollPos = calculateScrollPos(cm, rect);
  7401. if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); }
  7402. if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  7403. }
  7404. // Calculate a new scroll position needed to scroll the given
  7405. // rectangle into view. Returns an object with scrollTop and
  7406. // scrollLeft properties. When these are undefined, the
  7407. // vertical/horizontal position does not need to be adjusted.
  7408. function calculateScrollPos(cm, rect) {
  7409. var display = cm.display, snapMargin = textHeight(cm.display);
  7410. if (rect.top < 0) { rect.top = 0; }
  7411. var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
  7412. var screen = displayHeight(cm), result = {};
  7413. if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
  7414. var docBottom = cm.doc.height + paddingVert(display);
  7415. var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
  7416. if (rect.top < screentop) {
  7417. result.scrollTop = atTop ? 0 : rect.top;
  7418. } else if (rect.bottom > screentop + screen) {
  7419. var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
  7420. if (newTop != screentop) { result.scrollTop = newTop; }
  7421. }
  7422. var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
  7423. var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
  7424. var tooWide = rect.right - rect.left > screenw;
  7425. if (tooWide) { rect.right = rect.left + screenw; }
  7426. if (rect.left < 10)
  7427. { result.scrollLeft = 0; }
  7428. else if (rect.left < screenleft)
  7429. { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
  7430. else if (rect.right > screenw + screenleft - 3)
  7431. { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
  7432. return result
  7433. }
  7434. // Store a relative adjustment to the scroll position in the current
  7435. // operation (to be applied when the operation finishes).
  7436. function addToScrollPos(cm, left, top) {
  7437. if (left != null || top != null) { resolveScrollToPos(cm); }
  7438. if (left != null)
  7439. { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; }
  7440. if (top != null)
  7441. { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
  7442. }
  7443. // Make sure that at the end of the operation the current cursor is
  7444. // shown.
  7445. function ensureCursorVisible(cm) {
  7446. resolveScrollToPos(cm);
  7447. var cur = cm.getCursor(), from = cur, to = cur;
  7448. if (!cm.options.lineWrapping) {
  7449. from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
  7450. to = Pos(cur.line, cur.ch + 1);
  7451. }
  7452. cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin};
  7453. }
  7454. // When an operation has its scrollToPos property set, and another
  7455. // scroll action is applied before the end of the operation, this
  7456. // 'simulates' scrolling that position into view in a cheap way, so
  7457. // that the effect of intermediate scroll commands is not ignored.
  7458. function resolveScrollToPos(cm) {
  7459. var range$$1 = cm.curOp.scrollToPos;
  7460. if (range$$1) {
  7461. cm.curOp.scrollToPos = null;
  7462. var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
  7463. var sPos = calculateScrollPos(cm, {
  7464. left: Math.min(from.left, to.left),
  7465. top: Math.min(from.top, to.top) - range$$1.margin,
  7466. right: Math.max(from.right, to.right),
  7467. bottom: Math.max(from.bottom, to.bottom) + range$$1.margin
  7468. });
  7469. cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  7470. }
  7471. }
  7472. // Operations are used to wrap a series of changes to the editor
  7473. // state in such a way that each change won't have to update the
  7474. // cursor and display (which would be awkward, slow, and
  7475. // error-prone). Instead, display updates are batched and then all
  7476. // combined and executed at once.
  7477. var nextOpId = 0;
  7478. // Start a new operation.
  7479. function startOperation(cm) {
  7480. cm.curOp = {
  7481. cm: cm,
  7482. viewChanged: false, // Flag that indicates that lines might need to be redrawn
  7483. startHeight: cm.doc.height, // Used to detect need to update scrollbar
  7484. forceUpdate: false, // Used to force a redraw
  7485. updateInput: null, // Whether to reset the input textarea
  7486. typing: false, // Whether this reset should be careful to leave existing text (for compositing)
  7487. changeObjs: null, // Accumulated changes, for firing change events
  7488. cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
  7489. cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
  7490. selectionChanged: false, // Whether the selection needs to be redrawn
  7491. updateMaxLine: false, // Set when the widest line needs to be determined anew
  7492. scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
  7493. scrollToPos: null, // Used to scroll to a specific position
  7494. focus: false,
  7495. id: ++nextOpId // Unique ID
  7496. };
  7497. pushOperation(cm.curOp);
  7498. }
  7499. // Finish an operation, updating the display and signalling delayed events
  7500. function endOperation(cm) {
  7501. var op = cm.curOp;
  7502. finishOperation(op, function (group) {
  7503. for (var i = 0; i < group.ops.length; i++)
  7504. { group.ops[i].cm.curOp = null; }
  7505. endOperations(group);
  7506. });
  7507. }
  7508. // The DOM updates done when an operation finishes are batched so
  7509. // that the minimum number of relayouts are required.
  7510. function endOperations(group) {
  7511. var ops = group.ops;
  7512. for (var i = 0; i < ops.length; i++) // Read DOM
  7513. { endOperation_R1(ops[i]); }
  7514. for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
  7515. { endOperation_W1(ops[i$1]); }
  7516. for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
  7517. { endOperation_R2(ops[i$2]); }
  7518. for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
  7519. { endOperation_W2(ops[i$3]); }
  7520. for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
  7521. { endOperation_finish(ops[i$4]); }
  7522. }
  7523. function endOperation_R1(op) {
  7524. var cm = op.cm, display = cm.display;
  7525. maybeClipScrollbars(cm);
  7526. if (op.updateMaxLine) { findMaxLine(cm); }
  7527. op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
  7528. op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
  7529. op.scrollToPos.to.line >= display.viewTo) ||
  7530. display.maxLineChanged && cm.options.lineWrapping;
  7531. op.update = op.mustUpdate &&
  7532. new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  7533. }
  7534. function endOperation_W1(op) {
  7535. op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  7536. }
  7537. function endOperation_R2(op) {
  7538. var cm = op.cm, display = cm.display;
  7539. if (op.updatedDisplay) { updateHeightsInViewport(cm); }
  7540. op.barMeasure = measureForScrollbars(cm);
  7541. // If the max line changed since it was last measured, measure it,
  7542. // and ensure the document's width matches it.
  7543. // updateDisplay_W2 will use these properties to do the actual resizing
  7544. if (display.maxLineChanged && !cm.options.lineWrapping) {
  7545. op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
  7546. cm.display.sizerWidth = op.adjustWidthTo;
  7547. op.barMeasure.scrollWidth =
  7548. Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
  7549. op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
  7550. }
  7551. if (op.updatedDisplay || op.selectionChanged)
  7552. { op.preparedSelection = display.input.prepareSelection(op.focus); }
  7553. }
  7554. function endOperation_W2(op) {
  7555. var cm = op.cm;
  7556. if (op.adjustWidthTo != null) {
  7557. cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
  7558. if (op.maxScrollLeft < cm.doc.scrollLeft)
  7559. { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
  7560. cm.display.maxLineChanged = false;
  7561. }
  7562. var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus());
  7563. if (op.preparedSelection)
  7564. { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
  7565. if (op.updatedDisplay || op.startHeight != cm.doc.height)
  7566. { updateScrollbars(cm, op.barMeasure); }
  7567. if (op.updatedDisplay)
  7568. { setDocumentHeight(cm, op.barMeasure); }
  7569. if (op.selectionChanged) { restartBlink(cm); }
  7570. if (cm.state.focused && op.updateInput)
  7571. { cm.display.input.reset(op.typing); }
  7572. if (takeFocus) { ensureFocus(op.cm); }
  7573. }
  7574. function endOperation_finish(op) {
  7575. var cm = op.cm, display = cm.display, doc = cm.doc;
  7576. if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
  7577. // Abort mouse wheel delta measurement, when scrolling explicitly
  7578. if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
  7579. { display.wheelStartX = display.wheelStartY = null; }
  7580. // Propagate the scroll position to the actual DOM scroller
  7581. if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
  7582. doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
  7583. display.scrollbars.setScrollTop(doc.scrollTop);
  7584. display.scroller.scrollTop = doc.scrollTop;
  7585. }
  7586. if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
  7587. doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
  7588. display.scrollbars.setScrollLeft(doc.scrollLeft);
  7589. display.scroller.scrollLeft = doc.scrollLeft;
  7590. alignHorizontally(cm);
  7591. }
  7592. // If we need to scroll a specific position into view, do so.
  7593. if (op.scrollToPos) {
  7594. var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
  7595. clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
  7596. maybeScrollWindow(cm, rect);
  7597. }
  7598. // Fire events for markers that are hidden/unidden by editing or
  7599. // undoing
  7600. var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
  7601. if (hidden) { for (var i = 0; i < hidden.length; ++i)
  7602. { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
  7603. if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
  7604. { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
  7605. if (display.wrapper.offsetHeight)
  7606. { doc.scrollTop = cm.display.scroller.scrollTop; }
  7607. // Fire change events, and delayed event handlers
  7608. if (op.changeObjs)
  7609. { signal(cm, "changes", cm, op.changeObjs); }
  7610. if (op.update)
  7611. { op.update.finish(); }
  7612. }
  7613. // Run the given function in an operation
  7614. function runInOp(cm, f) {
  7615. if (cm.curOp) { return f() }
  7616. startOperation(cm);
  7617. try { return f() }
  7618. finally { endOperation(cm); }
  7619. }
  7620. // Wraps a function in an operation. Returns the wrapped function.
  7621. function operation(cm, f) {
  7622. return function() {
  7623. if (cm.curOp) { return f.apply(cm, arguments) }
  7624. startOperation(cm);
  7625. try { return f.apply(cm, arguments) }
  7626. finally { endOperation(cm); }
  7627. }
  7628. }
  7629. // Used to add methods to editor and doc instances, wrapping them in
  7630. // operations.
  7631. function methodOp(f) {
  7632. return function() {
  7633. if (this.curOp) { return f.apply(this, arguments) }
  7634. startOperation(this);
  7635. try { return f.apply(this, arguments) }
  7636. finally { endOperation(this); }
  7637. }
  7638. }
  7639. function docMethodOp(f) {
  7640. return function() {
  7641. var cm = this.cm;
  7642. if (!cm || cm.curOp) { return f.apply(this, arguments) }
  7643. startOperation(cm);
  7644. try { return f.apply(this, arguments) }
  7645. finally { endOperation(cm); }
  7646. }
  7647. }
  7648. // Updates the display.view data structure for a given change to the
  7649. // document. From and to are in pre-change coordinates. Lendiff is
  7650. // the amount of lines added or subtracted by the change. This is
  7651. // used for changes that span multiple lines, or change the way
  7652. // lines are divided into visual lines. regLineChange (below)
  7653. // registers single-line changes.
  7654. function regChange(cm, from, to, lendiff) {
  7655. if (from == null) { from = cm.doc.first; }
  7656. if (to == null) { to = cm.doc.first + cm.doc.size; }
  7657. if (!lendiff) { lendiff = 0; }
  7658. var display = cm.display;
  7659. if (lendiff && to < display.viewTo &&
  7660. (display.updateLineNumbers == null || display.updateLineNumbers > from))
  7661. { display.updateLineNumbers = from; }
  7662. cm.curOp.viewChanged = true;
  7663. if (from >= display.viewTo) { // Change after
  7664. if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
  7665. { resetView(cm); }
  7666. } else if (to <= display.viewFrom) { // Change before
  7667. if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
  7668. resetView(cm);
  7669. } else {
  7670. display.viewFrom += lendiff;
  7671. display.viewTo += lendiff;
  7672. }
  7673. } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
  7674. resetView(cm);
  7675. } else if (from <= display.viewFrom) { // Top overlap
  7676. var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
  7677. if (cut) {
  7678. display.view = display.view.slice(cut.index);
  7679. display.viewFrom = cut.lineN;
  7680. display.viewTo += lendiff;
  7681. } else {
  7682. resetView(cm);
  7683. }
  7684. } else if (to >= display.viewTo) { // Bottom overlap
  7685. var cut$1 = viewCuttingPoint(cm, from, from, -1);
  7686. if (cut$1) {
  7687. display.view = display.view.slice(0, cut$1.index);
  7688. display.viewTo = cut$1.lineN;
  7689. } else {
  7690. resetView(cm);
  7691. }
  7692. } else { // Gap in the middle
  7693. var cutTop = viewCuttingPoint(cm, from, from, -1);
  7694. var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
  7695. if (cutTop && cutBot) {
  7696. display.view = display.view.slice(0, cutTop.index)
  7697. .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
  7698. .concat(display.view.slice(cutBot.index));
  7699. display.viewTo += lendiff;
  7700. } else {
  7701. resetView(cm);
  7702. }
  7703. }
  7704. var ext = display.externalMeasured;
  7705. if (ext) {
  7706. if (to < ext.lineN)
  7707. { ext.lineN += lendiff; }
  7708. else if (from < ext.lineN + ext.size)
  7709. { display.externalMeasured = null; }
  7710. }
  7711. }
  7712. // Register a change to a single line. Type must be one of "text",
  7713. // "gutter", "class", "widget"
  7714. function regLineChange(cm, line, type) {
  7715. cm.curOp.viewChanged = true;
  7716. var display = cm.display, ext = cm.display.externalMeasured;
  7717. if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
  7718. { display.externalMeasured = null; }
  7719. if (line < display.viewFrom || line >= display.viewTo) { return }
  7720. var lineView = display.view[findViewIndex(cm, line)];
  7721. if (lineView.node == null) { return }
  7722. var arr = lineView.changes || (lineView.changes = []);
  7723. if (indexOf(arr, type) == -1) { arr.push(type); }
  7724. }
  7725. // Clear the view.
  7726. function resetView(cm) {
  7727. cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
  7728. cm.display.view = [];
  7729. cm.display.viewOffset = 0;
  7730. }
  7731. function viewCuttingPoint(cm, oldN, newN, dir) {
  7732. var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
  7733. if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
  7734. { return {index: index, lineN: newN} }
  7735. var n = cm.display.viewFrom;
  7736. for (var i = 0; i < index; i++)
  7737. { n += view[i].size; }
  7738. if (n != oldN) {
  7739. if (dir > 0) {
  7740. if (index == view.length - 1) { return null }
  7741. diff = (n + view[index].size) - oldN;
  7742. index++;
  7743. } else {
  7744. diff = n - oldN;
  7745. }
  7746. oldN += diff; newN += diff;
  7747. }
  7748. while (visualLineNo(cm.doc, newN) != newN) {
  7749. if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
  7750. newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
  7751. index += dir;
  7752. }
  7753. return {index: index, lineN: newN}
  7754. }
  7755. // Force the view to cover a given range, adding empty view element
  7756. // or clipping off existing ones as needed.
  7757. function adjustView(cm, from, to) {
  7758. var display = cm.display, view = display.view;
  7759. if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
  7760. display.view = buildViewArray(cm, from, to);
  7761. display.viewFrom = from;
  7762. } else {
  7763. if (display.viewFrom > from)
  7764. { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
  7765. else if (display.viewFrom < from)
  7766. { display.view = display.view.slice(findViewIndex(cm, from)); }
  7767. display.viewFrom = from;
  7768. if (display.viewTo < to)
  7769. { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
  7770. else if (display.viewTo > to)
  7771. { display.view = display.view.slice(0, findViewIndex(cm, to)); }
  7772. }
  7773. display.viewTo = to;
  7774. }
  7775. // Count the number of lines in the view whose DOM representation is
  7776. // out of date (or nonexistent).
  7777. function countDirtyView(cm) {
  7778. var view = cm.display.view, dirty = 0;
  7779. for (var i = 0; i < view.length; i++) {
  7780. var lineView = view[i];
  7781. if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
  7782. }
  7783. return dirty
  7784. }
  7785. // HIGHLIGHT WORKER
  7786. function startWorker(cm, time) {
  7787. if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
  7788. { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  7789. }
  7790. function highlightWorker(cm) {
  7791. var doc = cm.doc;
  7792. if (doc.frontier < doc.first) { doc.frontier = doc.first; }
  7793. if (doc.frontier >= cm.display.viewTo) { return }
  7794. var end = +new Date + cm.options.workTime;
  7795. var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
  7796. var changedLines = [];
  7797. doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
  7798. if (doc.frontier >= cm.display.viewFrom) { // Visible
  7799. var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
  7800. var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
  7801. line.styles = highlighted.styles;
  7802. var oldCls = line.styleClasses, newCls = highlighted.classes;
  7803. if (newCls) { line.styleClasses = newCls; }
  7804. else if (oldCls) { line.styleClasses = null; }
  7805. var ischange = !oldStyles || oldStyles.length != line.styles.length ||
  7806. oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
  7807. for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
  7808. if (ischange) { changedLines.push(doc.frontier); }
  7809. line.stateAfter = tooLong ? state : copyState(doc.mode, state);
  7810. } else {
  7811. if (line.text.length <= cm.options.maxHighlightLength)
  7812. { processLine(cm, line.text, state); }
  7813. line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
  7814. }
  7815. ++doc.frontier;
  7816. if (+new Date > end) {
  7817. startWorker(cm, cm.options.workDelay);
  7818. return true
  7819. }
  7820. });
  7821. if (changedLines.length) { runInOp(cm, function () {
  7822. for (var i = 0; i < changedLines.length; i++)
  7823. { regLineChange(cm, changedLines[i], "text"); }
  7824. }); }
  7825. }
  7826. // DISPLAY DRAWING
  7827. var DisplayUpdate = function(cm, viewport, force) {
  7828. var display = cm.display;
  7829. this.viewport = viewport;
  7830. // Store some values that we'll need later (but don't want to force a relayout for)
  7831. this.visible = visibleLines(display, cm.doc, viewport);
  7832. this.editorIsHidden = !display.wrapper.offsetWidth;
  7833. this.wrapperHeight = display.wrapper.clientHeight;
  7834. this.wrapperWidth = display.wrapper.clientWidth;
  7835. this.oldDisplayWidth = displayWidth(cm);
  7836. this.force = force;
  7837. this.dims = getDimensions(cm);
  7838. this.events = [];
  7839. };
  7840. DisplayUpdate.prototype.signal = function (emitter, type) {
  7841. if (hasHandler(emitter, type))
  7842. { this.events.push(arguments); }
  7843. };
  7844. DisplayUpdate.prototype.finish = function () {
  7845. var this$1 = this;
  7846. for (var i = 0; i < this.events.length; i++)
  7847. { signal.apply(null, this$1.events[i]); }
  7848. };
  7849. function maybeClipScrollbars(cm) {
  7850. var display = cm.display;
  7851. if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
  7852. display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
  7853. display.heightForcer.style.height = scrollGap(cm) + "px";
  7854. display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
  7855. display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
  7856. display.scrollbarsClipped = true;
  7857. }
  7858. }
  7859. // Does the actual updating of the line display. Bails out
  7860. // (returning false) when there is nothing to be done and forced is
  7861. // false.
  7862. function updateDisplayIfNeeded(cm, update) {
  7863. var display = cm.display, doc = cm.doc;
  7864. if (update.editorIsHidden) {
  7865. resetView(cm);
  7866. return false
  7867. }
  7868. // Bail out if the visible area is already rendered and nothing changed.
  7869. if (!update.force &&
  7870. update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
  7871. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
  7872. display.renderedView == display.view && countDirtyView(cm) == 0)
  7873. { return false }
  7874. if (maybeUpdateLineNumberWidth(cm)) {
  7875. resetView(cm);
  7876. update.dims = getDimensions(cm);
  7877. }
  7878. // Compute a suitable new viewport (from & to)
  7879. var end = doc.first + doc.size;
  7880. var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
  7881. var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
  7882. if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
  7883. if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
  7884. if (sawCollapsedSpans) {
  7885. from = visualLineNo(cm.doc, from);
  7886. to = visualLineEndNo(cm.doc, to);
  7887. }
  7888. var different = from != display.viewFrom || to != display.viewTo ||
  7889. display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
  7890. adjustView(cm, from, to);
  7891. display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
  7892. // Position the mover div to align with the current scroll position
  7893. cm.display.mover.style.top = display.viewOffset + "px";
  7894. var toUpdate = countDirtyView(cm);
  7895. if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
  7896. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
  7897. { return false }
  7898. // For big changes, we hide the enclosing element during the
  7899. // update, since that speeds up the operations on most browsers.
  7900. var focused = activeElt();
  7901. if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
  7902. patchDisplay(cm, display.updateLineNumbers, update.dims);
  7903. if (toUpdate > 4) { display.lineDiv.style.display = ""; }
  7904. display.renderedView = display.view;
  7905. // There might have been a widget with a focused element that got
  7906. // hidden or updated, if so re-focus it.
  7907. if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); }
  7908. // Prevent selection and cursors from interfering with the scroll
  7909. // width and height.
  7910. removeChildren(display.cursorDiv);
  7911. removeChildren(display.selectionDiv);
  7912. display.gutters.style.height = display.sizer.style.minHeight = 0;
  7913. if (different) {
  7914. display.lastWrapHeight = update.wrapperHeight;
  7915. display.lastWrapWidth = update.wrapperWidth;
  7916. startWorker(cm, 400);
  7917. }
  7918. display.updateLineNumbers = null;
  7919. return true
  7920. }
  7921. function postUpdateDisplay(cm, update) {
  7922. var viewport = update.viewport;
  7923. for (var first = true;; first = false) {
  7924. if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
  7925. // Clip forced viewport to actual scrollable area.
  7926. if (viewport && viewport.top != null)
  7927. { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
  7928. // Updated line heights might result in the drawn area not
  7929. // actually covering the viewport. Keep looping until it does.
  7930. update.visible = visibleLines(cm.display, cm.doc, viewport);
  7931. if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
  7932. { break }
  7933. }
  7934. if (!updateDisplayIfNeeded(cm, update)) { break }
  7935. updateHeightsInViewport(cm);
  7936. var barMeasure = measureForScrollbars(cm);
  7937. updateSelection(cm);
  7938. updateScrollbars(cm, barMeasure);
  7939. setDocumentHeight(cm, barMeasure);
  7940. }
  7941. update.signal(cm, "update", cm);
  7942. if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
  7943. update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
  7944. cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
  7945. }
  7946. }
  7947. function updateDisplaySimple(cm, viewport) {
  7948. var update = new DisplayUpdate(cm, viewport);
  7949. if (updateDisplayIfNeeded(cm, update)) {
  7950. updateHeightsInViewport(cm);
  7951. postUpdateDisplay(cm, update);
  7952. var barMeasure = measureForScrollbars(cm);
  7953. updateSelection(cm);
  7954. updateScrollbars(cm, barMeasure);
  7955. setDocumentHeight(cm, barMeasure);
  7956. update.finish();
  7957. }
  7958. }
  7959. // Sync the actual display DOM structure with display.view, removing
  7960. // nodes for lines that are no longer in view, and creating the ones
  7961. // that are not there yet, and updating the ones that are out of
  7962. // date.
  7963. function patchDisplay(cm, updateNumbersFrom, dims) {
  7964. var display = cm.display, lineNumbers = cm.options.lineNumbers;
  7965. var container = display.lineDiv, cur = container.firstChild;
  7966. function rm(node) {
  7967. var next = node.nextSibling;
  7968. // Works around a throw-scroll bug in OS X Webkit
  7969. if (webkit && mac && cm.display.currentWheelTarget == node)
  7970. { node.style.display = "none"; }
  7971. else
  7972. { node.parentNode.removeChild(node); }
  7973. return next
  7974. }
  7975. var view = display.view, lineN = display.viewFrom;
  7976. // Loop over the elements in the view, syncing cur (the DOM nodes
  7977. // in display.lineDiv) with the view as we go.
  7978. for (var i = 0; i < view.length; i++) {
  7979. var lineView = view[i];
  7980. if (lineView.hidden) {
  7981. } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
  7982. var node = buildLineElement(cm, lineView, lineN, dims);
  7983. container.insertBefore(node, cur);
  7984. } else { // Already drawn
  7985. while (cur != lineView.node) { cur = rm(cur); }
  7986. var updateNumber = lineNumbers && updateNumbersFrom != null &&
  7987. updateNumbersFrom <= lineN && lineView.lineNumber;
  7988. if (lineView.changes) {
  7989. if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
  7990. updateLineForChanges(cm, lineView, lineN, dims);
  7991. }
  7992. if (updateNumber) {
  7993. removeChildren(lineView.lineNumber);
  7994. lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
  7995. }
  7996. cur = lineView.node.nextSibling;
  7997. }
  7998. lineN += lineView.size;
  7999. }
  8000. while (cur) { cur = rm(cur); }
  8001. }
  8002. function updateGutterSpace(cm) {
  8003. var width = cm.display.gutters.offsetWidth;
  8004. cm.display.sizer.style.marginLeft = width + "px";
  8005. }
  8006. function setDocumentHeight(cm, measure) {
  8007. cm.display.sizer.style.minHeight = measure.docHeight + "px";
  8008. cm.display.heightForcer.style.top = measure.docHeight + "px";
  8009. cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  8010. }
  8011. // Rebuild the gutter elements, ensure the margin to the left of the
  8012. // code matches their width.
  8013. function updateGutters(cm) {
  8014. var gutters = cm.display.gutters, specs = cm.options.gutters;
  8015. removeChildren(gutters);
  8016. var i = 0;
  8017. for (; i < specs.length; ++i) {
  8018. var gutterClass = specs[i];
  8019. var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
  8020. if (gutterClass == "CodeMirror-linenumbers") {
  8021. cm.display.lineGutter = gElt;
  8022. gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
  8023. }
  8024. }
  8025. gutters.style.display = i ? "" : "none";
  8026. updateGutterSpace(cm);
  8027. }
  8028. // Make sure the gutters options contains the element
  8029. // "CodeMirror-linenumbers" when the lineNumbers option is true.
  8030. function setGuttersForLineNumbers(options) {
  8031. var found = indexOf(options.gutters, "CodeMirror-linenumbers");
  8032. if (found == -1 && options.lineNumbers) {
  8033. options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
  8034. } else if (found > -1 && !options.lineNumbers) {
  8035. options.gutters = options.gutters.slice(0);
  8036. options.gutters.splice(found, 1);
  8037. }
  8038. }
  8039. // Selection objects are immutable. A new one is created every time
  8040. // the selection changes. A selection is one or more non-overlapping
  8041. // (and non-touching) ranges, sorted, and an integer that indicates
  8042. // which one is the primary selection (the one that's scrolled into
  8043. // view, that getCursor returns, etc).
  8044. var Selection = function(ranges, primIndex) {
  8045. this.ranges = ranges;
  8046. this.primIndex = primIndex;
  8047. };
  8048. Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
  8049. Selection.prototype.equals = function (other) {
  8050. var this$1 = this;
  8051. if (other == this) { return true }
  8052. if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
  8053. for (var i = 0; i < this.ranges.length; i++) {
  8054. var here = this$1.ranges[i], there = other.ranges[i];
  8055. if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
  8056. }
  8057. return true
  8058. };
  8059. Selection.prototype.deepCopy = function () {
  8060. var this$1 = this;
  8061. var out = [];
  8062. for (var i = 0; i < this.ranges.length; i++)
  8063. { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
  8064. return new Selection(out, this.primIndex)
  8065. };
  8066. Selection.prototype.somethingSelected = function () {
  8067. var this$1 = this;
  8068. for (var i = 0; i < this.ranges.length; i++)
  8069. { if (!this$1.ranges[i].empty()) { return true } }
  8070. return false
  8071. };
  8072. Selection.prototype.contains = function (pos, end) {
  8073. var this$1 = this;
  8074. if (!end) { end = pos; }
  8075. for (var i = 0; i < this.ranges.length; i++) {
  8076. var range = this$1.ranges[i];
  8077. if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
  8078. { return i }
  8079. }
  8080. return -1
  8081. };
  8082. var Range = function(anchor, head) {
  8083. this.anchor = anchor; this.head = head;
  8084. };
  8085. Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  8086. Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  8087. Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
  8088. // Take an unsorted, potentially overlapping set of ranges, and
  8089. // build a selection out of it. 'Consumes' ranges array (modifying
  8090. // it).
  8091. function normalizeSelection(ranges, primIndex) {
  8092. var prim = ranges[primIndex];
  8093. ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
  8094. primIndex = indexOf(ranges, prim);
  8095. for (var i = 1; i < ranges.length; i++) {
  8096. var cur = ranges[i], prev = ranges[i - 1];
  8097. if (cmp(prev.to(), cur.from()) >= 0) {
  8098. var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
  8099. var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
  8100. if (i <= primIndex) { --primIndex; }
  8101. ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
  8102. }
  8103. }
  8104. return new Selection(ranges, primIndex)
  8105. }
  8106. function simpleSelection(anchor, head) {
  8107. return new Selection([new Range(anchor, head || anchor)], 0)
  8108. }
  8109. // Compute the position of the end of a change (its 'to' property
  8110. // refers to the pre-change end).
  8111. function changeEnd(change) {
  8112. if (!change.text) { return change.to }
  8113. return Pos(change.from.line + change.text.length - 1,
  8114. lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  8115. }
  8116. // Adjust a position to refer to the post-change position of the
  8117. // same text, or the end of the change if the change covers it.
  8118. function adjustForChange(pos, change) {
  8119. if (cmp(pos, change.from) < 0) { return pos }
  8120. if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
  8121. var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
  8122. if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
  8123. return Pos(line, ch)
  8124. }
  8125. function computeSelAfterChange(doc, change) {
  8126. var out = [];
  8127. for (var i = 0; i < doc.sel.ranges.length; i++) {
  8128. var range = doc.sel.ranges[i];
  8129. out.push(new Range(adjustForChange(range.anchor, change),
  8130. adjustForChange(range.head, change)));
  8131. }
  8132. return normalizeSelection(out, doc.sel.primIndex)
  8133. }
  8134. function offsetPos(pos, old, nw) {
  8135. if (pos.line == old.line)
  8136. { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
  8137. else
  8138. { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  8139. }
  8140. // Used by replaceSelections to allow moving the selection to the
  8141. // start or around the replaced test. Hint may be "start" or "around".
  8142. function computeReplacedSel(doc, changes, hint) {
  8143. var out = [];
  8144. var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
  8145. for (var i = 0; i < changes.length; i++) {
  8146. var change = changes[i];
  8147. var from = offsetPos(change.from, oldPrev, newPrev);
  8148. var to = offsetPos(changeEnd(change), oldPrev, newPrev);
  8149. oldPrev = change.to;
  8150. newPrev = to;
  8151. if (hint == "around") {
  8152. var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
  8153. out[i] = new Range(inv ? to : from, inv ? from : to);
  8154. } else {
  8155. out[i] = new Range(from, from);
  8156. }
  8157. }
  8158. return new Selection(out, doc.sel.primIndex)
  8159. }
  8160. // Used to get the editor into a consistent state again when options change.
  8161. function loadMode(cm) {
  8162. cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
  8163. resetModeState(cm);
  8164. }
  8165. function resetModeState(cm) {
  8166. cm.doc.iter(function (line) {
  8167. if (line.stateAfter) { line.stateAfter = null; }
  8168. if (line.styles) { line.styles = null; }
  8169. });
  8170. cm.doc.frontier = cm.doc.first;
  8171. startWorker(cm, 100);
  8172. cm.state.modeGen++;
  8173. if (cm.curOp) { regChange(cm); }
  8174. }
  8175. // DOCUMENT DATA STRUCTURE
  8176. // By default, updates that start and end at the beginning of a line
  8177. // are treated specially, in order to make the association of line
  8178. // widgets and marker elements with the text behave more intuitive.
  8179. function isWholeLineUpdate(doc, change) {
  8180. return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
  8181. (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  8182. }
  8183. // Perform a change on the document data structure.
  8184. function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
  8185. function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  8186. function update(line, text, spans) {
  8187. updateLine(line, text, spans, estimateHeight$$1);
  8188. signalLater(line, "change", line, change);
  8189. }
  8190. function linesFor(start, end) {
  8191. var result = [];
  8192. for (var i = start; i < end; ++i)
  8193. { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
  8194. return result
  8195. }
  8196. var from = change.from, to = change.to, text = change.text;
  8197. var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
  8198. var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
  8199. // Adjust the line structure
  8200. if (change.full) {
  8201. doc.insert(0, linesFor(0, text.length));
  8202. doc.remove(text.length, doc.size - text.length);
  8203. } else if (isWholeLineUpdate(doc, change)) {
  8204. // This is a whole-line replace. Treated specially to make
  8205. // sure line objects move the way they are supposed to.
  8206. var added = linesFor(0, text.length - 1);
  8207. update(lastLine, lastLine.text, lastSpans);
  8208. if (nlines) { doc.remove(from.line, nlines); }
  8209. if (added.length) { doc.insert(from.line, added); }
  8210. } else if (firstLine == lastLine) {
  8211. if (text.length == 1) {
  8212. update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
  8213. } else {
  8214. var added$1 = linesFor(1, text.length - 1);
  8215. added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
  8216. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  8217. doc.insert(from.line + 1, added$1);
  8218. }
  8219. } else if (text.length == 1) {
  8220. update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
  8221. doc.remove(from.line + 1, nlines);
  8222. } else {
  8223. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  8224. update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
  8225. var added$2 = linesFor(1, text.length - 1);
  8226. if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
  8227. doc.insert(from.line + 1, added$2);
  8228. }
  8229. signalLater(doc, "change", doc, change);
  8230. }
  8231. // Call f for all linked documents.
  8232. function linkedDocs(doc, f, sharedHistOnly) {
  8233. function propagate(doc, skip, sharedHist) {
  8234. if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
  8235. var rel = doc.linked[i];
  8236. if (rel.doc == skip) { continue }
  8237. var shared = sharedHist && rel.sharedHist;
  8238. if (sharedHistOnly && !shared) { continue }
  8239. f(rel.doc, shared);
  8240. propagate(rel.doc, doc, shared);
  8241. } }
  8242. }
  8243. propagate(doc, null, true);
  8244. }
  8245. // Attach a document to an editor.
  8246. function attachDoc(cm, doc) {
  8247. if (doc.cm) { throw new Error("This document is already in use.") }
  8248. cm.doc = doc;
  8249. doc.cm = cm;
  8250. estimateLineHeights(cm);
  8251. loadMode(cm);
  8252. setDirectionClass(cm);
  8253. if (!cm.options.lineWrapping) { findMaxLine(cm); }
  8254. cm.options.mode = doc.modeOption;
  8255. regChange(cm);
  8256. }
  8257. function setDirectionClass(cm) {
  8258. (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  8259. }
  8260. function directionChanged(cm) {
  8261. runInOp(cm, function () {
  8262. setDirectionClass(cm);
  8263. regChange(cm);
  8264. });
  8265. }
  8266. function History(startGen) {
  8267. // Arrays of change events and selections. Doing something adds an
  8268. // event to done and clears undo. Undoing moves events from done
  8269. // to undone, redoing moves them in the other direction.
  8270. this.done = []; this.undone = [];
  8271. this.undoDepth = Infinity;
  8272. // Used to track when changes can be merged into a single undo
  8273. // event
  8274. this.lastModTime = this.lastSelTime = 0;
  8275. this.lastOp = this.lastSelOp = null;
  8276. this.lastOrigin = this.lastSelOrigin = null;
  8277. // Used by the isClean() method
  8278. this.generation = this.maxGeneration = startGen || 1;
  8279. }
  8280. // Create a history change event from an updateDoc-style change
  8281. // object.
  8282. function historyChangeFromChange(doc, change) {
  8283. var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
  8284. attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
  8285. linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
  8286. return histChange
  8287. }
  8288. // Pop all selection events off the end of a history array. Stop at
  8289. // a change event.
  8290. function clearSelectionEvents(array) {
  8291. while (array.length) {
  8292. var last = lst(array);
  8293. if (last.ranges) { array.pop(); }
  8294. else { break }
  8295. }
  8296. }
  8297. // Find the top change event in the history. Pop off selection
  8298. // events that are in the way.
  8299. function lastChangeEvent(hist, force) {
  8300. if (force) {
  8301. clearSelectionEvents(hist.done);
  8302. return lst(hist.done)
  8303. } else if (hist.done.length && !lst(hist.done).ranges) {
  8304. return lst(hist.done)
  8305. } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
  8306. hist.done.pop();
  8307. return lst(hist.done)
  8308. }
  8309. }
  8310. // Register a change in the history. Merges changes that are within
  8311. // a single operation, or are close together with an origin that
  8312. // allows merging (starting with "+") into a single event.
  8313. function addChangeToHistory(doc, change, selAfter, opId) {
  8314. var hist = doc.history;
  8315. hist.undone.length = 0;
  8316. var time = +new Date, cur;
  8317. var last;
  8318. if ((hist.lastOp == opId ||
  8319. hist.lastOrigin == change.origin && change.origin &&
  8320. ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
  8321. change.origin.charAt(0) == "*")) &&
  8322. (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
  8323. // Merge this change into the last event
  8324. last = lst(cur.changes);
  8325. if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
  8326. // Optimized case for simple insertion -- don't want to add
  8327. // new changesets for every character typed
  8328. last.to = changeEnd(change);
  8329. } else {
  8330. // Add new sub-event
  8331. cur.changes.push(historyChangeFromChange(doc, change));
  8332. }
  8333. } else {
  8334. // Can not be merged, start a new event.
  8335. var before = lst(hist.done);
  8336. if (!before || !before.ranges)
  8337. { pushSelectionToHistory(doc.sel, hist.done); }
  8338. cur = {changes: [historyChangeFromChange(doc, change)],
  8339. generation: hist.generation};
  8340. hist.done.push(cur);
  8341. while (hist.done.length > hist.undoDepth) {
  8342. hist.done.shift();
  8343. if (!hist.done[0].ranges) { hist.done.shift(); }
  8344. }
  8345. }
  8346. hist.done.push(selAfter);
  8347. hist.generation = ++hist.maxGeneration;
  8348. hist.lastModTime = hist.lastSelTime = time;
  8349. hist.lastOp = hist.lastSelOp = opId;
  8350. hist.lastOrigin = hist.lastSelOrigin = change.origin;
  8351. if (!last) { signal(doc, "historyAdded"); }
  8352. }
  8353. function selectionEventCanBeMerged(doc, origin, prev, sel) {
  8354. var ch = origin.charAt(0);
  8355. return ch == "*" ||
  8356. ch == "+" &&
  8357. prev.ranges.length == sel.ranges.length &&
  8358. prev.somethingSelected() == sel.somethingSelected() &&
  8359. new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  8360. }
  8361. // Called whenever the selection changes, sets the new selection as
  8362. // the pending selection in the history, and pushes the old pending
  8363. // selection into the 'done' array when it was significantly
  8364. // different (in number of selected ranges, emptiness, or time).
  8365. function addSelectionToHistory(doc, sel, opId, options) {
  8366. var hist = doc.history, origin = options && options.origin;
  8367. // A new event is started when the previous origin does not match
  8368. // the current, or the origins don't allow matching. Origins
  8369. // starting with * are always merged, those starting with + are
  8370. // merged when similar and close together in time.
  8371. if (opId == hist.lastSelOp ||
  8372. (origin && hist.lastSelOrigin == origin &&
  8373. (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
  8374. selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
  8375. { hist.done[hist.done.length - 1] = sel; }
  8376. else
  8377. { pushSelectionToHistory(sel, hist.done); }
  8378. hist.lastSelTime = +new Date;
  8379. hist.lastSelOrigin = origin;
  8380. hist.lastSelOp = opId;
  8381. if (options && options.clearRedo !== false)
  8382. { clearSelectionEvents(hist.undone); }
  8383. }
  8384. function pushSelectionToHistory(sel, dest) {
  8385. var top = lst(dest);
  8386. if (!(top && top.ranges && top.equals(sel)))
  8387. { dest.push(sel); }
  8388. }
  8389. // Used to store marked span information in the history.
  8390. function attachLocalSpans(doc, change, from, to) {
  8391. var existing = change["spans_" + doc.id], n = 0;
  8392. doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
  8393. if (line.markedSpans)
  8394. { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
  8395. ++n;
  8396. });
  8397. }
  8398. // When un/re-doing restores text containing marked spans, those
  8399. // that have been explicitly cleared should not be restored.
  8400. function removeClearedSpans(spans) {
  8401. if (!spans) { return null }
  8402. var out;
  8403. for (var i = 0; i < spans.length; ++i) {
  8404. if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
  8405. else if (out) { out.push(spans[i]); }
  8406. }
  8407. return !out ? spans : out.length ? out : null
  8408. }
  8409. // Retrieve and filter the old marked spans stored in a change event.
  8410. function getOldSpans(doc, change) {
  8411. var found = change["spans_" + doc.id];
  8412. if (!found) { return null }
  8413. var nw = [];
  8414. for (var i = 0; i < change.text.length; ++i)
  8415. { nw.push(removeClearedSpans(found[i])); }
  8416. return nw
  8417. }
  8418. // Used for un/re-doing changes from the history. Combines the
  8419. // result of computing the existing spans with the set of spans that
  8420. // existed in the history (so that deleting around a span and then
  8421. // undoing brings back the span).
  8422. function mergeOldSpans(doc, change) {
  8423. var old = getOldSpans(doc, change);
  8424. var stretched = stretchSpansOverChange(doc, change);
  8425. if (!old) { return stretched }
  8426. if (!stretched) { return old }
  8427. for (var i = 0; i < old.length; ++i) {
  8428. var oldCur = old[i], stretchCur = stretched[i];
  8429. if (oldCur && stretchCur) {
  8430. spans: for (var j = 0; j < stretchCur.length; ++j) {
  8431. var span = stretchCur[j];
  8432. for (var k = 0; k < oldCur.length; ++k)
  8433. { if (oldCur[k].marker == span.marker) { continue spans } }
  8434. oldCur.push(span);
  8435. }
  8436. } else if (stretchCur) {
  8437. old[i] = stretchCur;
  8438. }
  8439. }
  8440. return old
  8441. }
  8442. // Used both to provide a JSON-safe object in .getHistory, and, when
  8443. // detaching a document, to split the history in two
  8444. function copyHistoryArray(events, newGroup, instantiateSel) {
  8445. var copy = [];
  8446. for (var i = 0; i < events.length; ++i) {
  8447. var event = events[i];
  8448. if (event.ranges) {
  8449. copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
  8450. continue
  8451. }
  8452. var changes = event.changes, newChanges = [];
  8453. copy.push({changes: newChanges});
  8454. for (var j = 0; j < changes.length; ++j) {
  8455. var change = changes[j], m = (void 0);
  8456. newChanges.push({from: change.from, to: change.to, text: change.text});
  8457. if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
  8458. if (indexOf(newGroup, Number(m[1])) > -1) {
  8459. lst(newChanges)[prop] = change[prop];
  8460. delete change[prop];
  8461. }
  8462. } } }
  8463. }
  8464. }
  8465. return copy
  8466. }
  8467. // The 'scroll' parameter given to many of these indicated whether
  8468. // the new cursor position should be scrolled into view after
  8469. // modifying the selection.
  8470. // If shift is held or the extend flag is set, extends a range to
  8471. // include a given position (and optionally a second position).
  8472. // Otherwise, simply returns the range between the given positions.
  8473. // Used for cursor motion and such.
  8474. function extendRange(doc, range, head, other) {
  8475. if (doc.cm && doc.cm.display.shift || doc.extend) {
  8476. var anchor = range.anchor;
  8477. if (other) {
  8478. var posBefore = cmp(head, anchor) < 0;
  8479. if (posBefore != (cmp(other, anchor) < 0)) {
  8480. anchor = head;
  8481. head = other;
  8482. } else if (posBefore != (cmp(head, other) < 0)) {
  8483. head = other;
  8484. }
  8485. }
  8486. return new Range(anchor, head)
  8487. } else {
  8488. return new Range(other || head, head)
  8489. }
  8490. }
  8491. // Extend the primary selection range, discard the rest.
  8492. function extendSelection(doc, head, other, options) {
  8493. setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
  8494. }
  8495. // Extend all selections (pos is an array of selections with length
  8496. // equal the number of selections)
  8497. function extendSelections(doc, heads, options) {
  8498. var out = [];
  8499. for (var i = 0; i < doc.sel.ranges.length; i++)
  8500. { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); }
  8501. var newSel = normalizeSelection(out, doc.sel.primIndex);
  8502. setSelection(doc, newSel, options);
  8503. }
  8504. // Updates a single range in the selection.
  8505. function replaceOneSelection(doc, i, range, options) {
  8506. var ranges = doc.sel.ranges.slice(0);
  8507. ranges[i] = range;
  8508. setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
  8509. }
  8510. // Reset the selection to a single range.
  8511. function setSimpleSelection(doc, anchor, head, options) {
  8512. setSelection(doc, simpleSelection(anchor, head), options);
  8513. }
  8514. // Give beforeSelectionChange handlers a change to influence a
  8515. // selection update.
  8516. function filterSelectionChange(doc, sel, options) {
  8517. var obj = {
  8518. ranges: sel.ranges,
  8519. update: function(ranges) {
  8520. var this$1 = this;
  8521. this.ranges = [];
  8522. for (var i = 0; i < ranges.length; i++)
  8523. { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
  8524. clipPos(doc, ranges[i].head)); }
  8525. },
  8526. origin: options && options.origin
  8527. };
  8528. signal(doc, "beforeSelectionChange", doc, obj);
  8529. if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
  8530. if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
  8531. else { return sel }
  8532. }
  8533. function setSelectionReplaceHistory(doc, sel, options) {
  8534. var done = doc.history.done, last = lst(done);
  8535. if (last && last.ranges) {
  8536. done[done.length - 1] = sel;
  8537. setSelectionNoUndo(doc, sel, options);
  8538. } else {
  8539. setSelection(doc, sel, options);
  8540. }
  8541. }
  8542. // Set a new selection.
  8543. function setSelection(doc, sel, options) {
  8544. setSelectionNoUndo(doc, sel, options);
  8545. addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  8546. }
  8547. function setSelectionNoUndo(doc, sel, options) {
  8548. if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
  8549. { sel = filterSelectionChange(doc, sel, options); }
  8550. var bias = options && options.bias ||
  8551. (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
  8552. setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
  8553. if (!(options && options.scroll === false) && doc.cm)
  8554. { ensureCursorVisible(doc.cm); }
  8555. }
  8556. function setSelectionInner(doc, sel) {
  8557. if (sel.equals(doc.sel)) { return }
  8558. doc.sel = sel;
  8559. if (doc.cm) {
  8560. doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
  8561. signalCursorActivity(doc.cm);
  8562. }
  8563. signalLater(doc, "cursorActivity", doc);
  8564. }
  8565. // Verify that the selection does not partially select any atomic
  8566. // marked ranges.
  8567. function reCheckSelection(doc) {
  8568. setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
  8569. }
  8570. // Return a selection that does not partially select any atomic
  8571. // ranges.
  8572. function skipAtomicInSelection(doc, sel, bias, mayClear) {
  8573. var out;
  8574. for (var i = 0; i < sel.ranges.length; i++) {
  8575. var range = sel.ranges[i];
  8576. var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
  8577. var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
  8578. var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
  8579. if (out || newAnchor != range.anchor || newHead != range.head) {
  8580. if (!out) { out = sel.ranges.slice(0, i); }
  8581. out[i] = new Range(newAnchor, newHead);
  8582. }
  8583. }
  8584. return out ? normalizeSelection(out, sel.primIndex) : sel
  8585. }
  8586. function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  8587. var line = getLine(doc, pos.line);
  8588. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  8589. var sp = line.markedSpans[i], m = sp.marker;
  8590. if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
  8591. (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
  8592. if (mayClear) {
  8593. signal(m, "beforeCursorEnter");
  8594. if (m.explicitlyCleared) {
  8595. if (!line.markedSpans) { break }
  8596. else {--i; continue}
  8597. }
  8598. }
  8599. if (!m.atomic) { continue }
  8600. if (oldPos) {
  8601. var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
  8602. if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
  8603. { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
  8604. if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
  8605. { return skipAtomicInner(doc, near, pos, dir, mayClear) }
  8606. }
  8607. var far = m.find(dir < 0 ? -1 : 1);
  8608. if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
  8609. { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
  8610. return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
  8611. }
  8612. } }
  8613. return pos
  8614. }
  8615. // Ensure a given position is not inside an atomic range.
  8616. function skipAtomic(doc, pos, oldPos, bias, mayClear) {
  8617. var dir = bias || 1;
  8618. var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
  8619. (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
  8620. skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
  8621. (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
  8622. if (!found) {
  8623. doc.cantEdit = true;
  8624. return Pos(doc.first, 0)
  8625. }
  8626. return found
  8627. }
  8628. function movePos(doc, pos, dir, line) {
  8629. if (dir < 0 && pos.ch == 0) {
  8630. if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
  8631. else { return null }
  8632. } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
  8633. if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
  8634. else { return null }
  8635. } else {
  8636. return new Pos(pos.line, pos.ch + dir)
  8637. }
  8638. }
  8639. function selectAll(cm) {
  8640. cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  8641. }
  8642. // UPDATING
  8643. // Allow "beforeChange" event handlers to influence a change
  8644. function filterChange(doc, change, update) {
  8645. var obj = {
  8646. canceled: false,
  8647. from: change.from,
  8648. to: change.to,
  8649. text: change.text,
  8650. origin: change.origin,
  8651. cancel: function () { return obj.canceled = true; }
  8652. };
  8653. if (update) { obj.update = function (from, to, text, origin) {
  8654. if (from) { obj.from = clipPos(doc, from); }
  8655. if (to) { obj.to = clipPos(doc, to); }
  8656. if (text) { obj.text = text; }
  8657. if (origin !== undefined) { obj.origin = origin; }
  8658. }; }
  8659. signal(doc, "beforeChange", doc, obj);
  8660. if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
  8661. if (obj.canceled) { return null }
  8662. return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  8663. }
  8664. // Apply a change to a document, and add it to the document's
  8665. // history, and propagating it to all linked documents.
  8666. function makeChange(doc, change, ignoreReadOnly) {
  8667. if (doc.cm) {
  8668. if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
  8669. if (doc.cm.state.suppressEdits) { return }
  8670. }
  8671. if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
  8672. change = filterChange(doc, change, true);
  8673. if (!change) { return }
  8674. }
  8675. // Possibly split or suppress the update based on the presence
  8676. // of read-only spans in its range.
  8677. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
  8678. if (split) {
  8679. for (var i = split.length - 1; i >= 0; --i)
  8680. { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); }
  8681. } else {
  8682. makeChangeInner(doc, change);
  8683. }
  8684. }
  8685. function makeChangeInner(doc, change) {
  8686. if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
  8687. var selAfter = computeSelAfterChange(doc, change);
  8688. addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
  8689. makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
  8690. var rebased = [];
  8691. linkedDocs(doc, function (doc, sharedHist) {
  8692. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  8693. rebaseHist(doc.history, change);
  8694. rebased.push(doc.history);
  8695. }
  8696. makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
  8697. });
  8698. }
  8699. // Revert a change stored in a document's history.
  8700. function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  8701. if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
  8702. var hist = doc.history, event, selAfter = doc.sel;
  8703. var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
  8704. // Verify that there is a useable event (so that ctrl-z won't
  8705. // needlessly clear selection events)
  8706. var i = 0;
  8707. for (; i < source.length; i++) {
  8708. event = source[i];
  8709. if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
  8710. { break }
  8711. }
  8712. if (i == source.length) { return }
  8713. hist.lastOrigin = hist.lastSelOrigin = null;
  8714. for (;;) {
  8715. event = source.pop();
  8716. if (event.ranges) {
  8717. pushSelectionToHistory(event, dest);
  8718. if (allowSelectionOnly && !event.equals(doc.sel)) {
  8719. setSelection(doc, event, {clearRedo: false});
  8720. return
  8721. }
  8722. selAfter = event;
  8723. }
  8724. else { break }
  8725. }
  8726. // Build up a reverse change object to add to the opposite history
  8727. // stack (redo when undoing, and vice versa).
  8728. var antiChanges = [];
  8729. pushSelectionToHistory(selAfter, dest);
  8730. dest.push({changes: antiChanges, generation: hist.generation});
  8731. hist.generation = event.generation || ++hist.maxGeneration;
  8732. var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
  8733. var loop = function ( i ) {
  8734. var change = event.changes[i];
  8735. change.origin = type;
  8736. if (filter && !filterChange(doc, change, false)) {
  8737. source.length = 0;
  8738. return {}
  8739. }
  8740. antiChanges.push(historyChangeFromChange(doc, change));
  8741. var after = i ? computeSelAfterChange(doc, change) : lst(source);
  8742. makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
  8743. if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
  8744. var rebased = [];
  8745. // Propagate to the linked documents
  8746. linkedDocs(doc, function (doc, sharedHist) {
  8747. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  8748. rebaseHist(doc.history, change);
  8749. rebased.push(doc.history);
  8750. }
  8751. makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
  8752. });
  8753. };
  8754. for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
  8755. var returned = loop( i$1 );
  8756. if ( returned ) return returned.v;
  8757. }
  8758. }
  8759. // Sub-views need their line numbers shifted when text is added
  8760. // above or below them in the parent document.
  8761. function shiftDoc(doc, distance) {
  8762. if (distance == 0) { return }
  8763. doc.first += distance;
  8764. doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
  8765. Pos(range.anchor.line + distance, range.anchor.ch),
  8766. Pos(range.head.line + distance, range.head.ch)
  8767. ); }), doc.sel.primIndex);
  8768. if (doc.cm) {
  8769. regChange(doc.cm, doc.first, doc.first - distance, distance);
  8770. for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
  8771. { regLineChange(doc.cm, l, "gutter"); }
  8772. }
  8773. }
  8774. // More lower-level change function, handling only a single document
  8775. // (not linked ones).
  8776. function makeChangeSingleDoc(doc, change, selAfter, spans) {
  8777. if (doc.cm && !doc.cm.curOp)
  8778. { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
  8779. if (change.to.line < doc.first) {
  8780. shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
  8781. return
  8782. }
  8783. if (change.from.line > doc.lastLine()) { return }
  8784. // Clip the change to the size of this doc
  8785. if (change.from.line < doc.first) {
  8786. var shift = change.text.length - 1 - (doc.first - change.from.line);
  8787. shiftDoc(doc, shift);
  8788. change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
  8789. text: [lst(change.text)], origin: change.origin};
  8790. }
  8791. var last = doc.lastLine();
  8792. if (change.to.line > last) {
  8793. change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
  8794. text: [change.text[0]], origin: change.origin};
  8795. }
  8796. change.removed = getBetween(doc, change.from, change.to);
  8797. if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
  8798. if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
  8799. else { updateDoc(doc, change, spans); }
  8800. setSelectionNoUndo(doc, selAfter, sel_dontScroll);
  8801. }
  8802. // Handle the interaction of a change to a document with the editor
  8803. // that this document is part of.
  8804. function makeChangeSingleDocInEditor(cm, change, spans) {
  8805. var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
  8806. var recomputeMaxLength = false, checkWidthStart = from.line;
  8807. if (!cm.options.lineWrapping) {
  8808. checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
  8809. doc.iter(checkWidthStart, to.line + 1, function (line) {
  8810. if (line == display.maxLine) {
  8811. recomputeMaxLength = true;
  8812. return true
  8813. }
  8814. });
  8815. }
  8816. if (doc.sel.contains(change.from, change.to) > -1)
  8817. { signalCursorActivity(cm); }
  8818. updateDoc(doc, change, spans, estimateHeight(cm));
  8819. if (!cm.options.lineWrapping) {
  8820. doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
  8821. var len = lineLength(line);
  8822. if (len > display.maxLineLength) {
  8823. display.maxLine = line;
  8824. display.maxLineLength = len;
  8825. display.maxLineChanged = true;
  8826. recomputeMaxLength = false;
  8827. }
  8828. });
  8829. if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
  8830. }
  8831. // Adjust frontier, schedule worker
  8832. doc.frontier = Math.min(doc.frontier, from.line);
  8833. startWorker(cm, 400);
  8834. var lendiff = change.text.length - (to.line - from.line) - 1;
  8835. // Remember that these lines changed, for updating the display
  8836. if (change.full)
  8837. { regChange(cm); }
  8838. else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
  8839. { regLineChange(cm, from.line, "text"); }
  8840. else
  8841. { regChange(cm, from.line, to.line + 1, lendiff); }
  8842. var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
  8843. if (changeHandler || changesHandler) {
  8844. var obj = {
  8845. from: from, to: to,
  8846. text: change.text,
  8847. removed: change.removed,
  8848. origin: change.origin
  8849. };
  8850. if (changeHandler) { signalLater(cm, "change", cm, obj); }
  8851. if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
  8852. }
  8853. cm.display.selForContextMenu = null;
  8854. }
  8855. function replaceRange(doc, code, from, to, origin) {
  8856. if (!to) { to = from; }
  8857. if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
  8858. if (typeof code == "string") { code = doc.splitLines(code); }
  8859. makeChange(doc, {from: from, to: to, text: code, origin: origin});
  8860. }
  8861. // Rebasing/resetting history to deal with externally-sourced changes
  8862. function rebaseHistSelSingle(pos, from, to, diff) {
  8863. if (to < pos.line) {
  8864. pos.line += diff;
  8865. } else if (from < pos.line) {
  8866. pos.line = from;
  8867. pos.ch = 0;
  8868. }
  8869. }
  8870. // Tries to rebase an array of history events given a change in the
  8871. // document. If the change touches the same lines as the event, the
  8872. // event, and everything 'behind' it, is discarded. If the change is
  8873. // before the event, the event's positions are updated. Uses a
  8874. // copy-on-write scheme for the positions, to avoid having to
  8875. // reallocate them all on every rebase, but also avoid problems with
  8876. // shared position objects being unsafely updated.
  8877. function rebaseHistArray(array, from, to, diff) {
  8878. for (var i = 0; i < array.length; ++i) {
  8879. var sub = array[i], ok = true;
  8880. if (sub.ranges) {
  8881. if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
  8882. for (var j = 0; j < sub.ranges.length; j++) {
  8883. rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
  8884. rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
  8885. }
  8886. continue
  8887. }
  8888. for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
  8889. var cur = sub.changes[j$1];
  8890. if (to < cur.from.line) {
  8891. cur.from = Pos(cur.from.line + diff, cur.from.ch);
  8892. cur.to = Pos(cur.to.line + diff, cur.to.ch);
  8893. } else if (from <= cur.to.line) {
  8894. ok = false;
  8895. break
  8896. }
  8897. }
  8898. if (!ok) {
  8899. array.splice(0, i + 1);
  8900. i = 0;
  8901. }
  8902. }
  8903. }
  8904. function rebaseHist(hist, change) {
  8905. var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
  8906. rebaseHistArray(hist.done, from, to, diff);
  8907. rebaseHistArray(hist.undone, from, to, diff);
  8908. }
  8909. // Utility for applying a change to a line by handle or number,
  8910. // returning the number and optionally registering the line as
  8911. // changed.
  8912. function changeLine(doc, handle, changeType, op) {
  8913. var no = handle, line = handle;
  8914. if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
  8915. else { no = lineNo(handle); }
  8916. if (no == null) { return null }
  8917. if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
  8918. return line
  8919. }
  8920. // The document is represented as a BTree consisting of leaves, with
  8921. // chunk of lines in them, and branches, with up to ten leaves or
  8922. // other branch nodes below them. The top node is always a branch
  8923. // node, and is the document object itself (meaning it has
  8924. // additional methods and properties).
  8925. //
  8926. // All nodes have parent links. The tree is used both to go from
  8927. // line numbers to line objects, and to go from objects to numbers.
  8928. // It also indexes by height, and is used to convert between height
  8929. // and line object, and to find the total height of the document.
  8930. //
  8931. // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
  8932. var LeafChunk = function(lines) {
  8933. var this$1 = this;
  8934. this.lines = lines;
  8935. this.parent = null;
  8936. var height = 0;
  8937. for (var i = 0; i < lines.length; ++i) {
  8938. lines[i].parent = this$1;
  8939. height += lines[i].height;
  8940. }
  8941. this.height = height;
  8942. };
  8943. LeafChunk.prototype.chunkSize = function () { return this.lines.length };
  8944. // Remove the n lines at offset 'at'.
  8945. LeafChunk.prototype.removeInner = function (at, n) {
  8946. var this$1 = this;
  8947. for (var i = at, e = at + n; i < e; ++i) {
  8948. var line = this$1.lines[i];
  8949. this$1.height -= line.height;
  8950. cleanUpLine(line);
  8951. signalLater(line, "delete");
  8952. }
  8953. this.lines.splice(at, n);
  8954. };
  8955. // Helper used to collapse a small branch into a single leaf.
  8956. LeafChunk.prototype.collapse = function (lines) {
  8957. lines.push.apply(lines, this.lines);
  8958. };
  8959. // Insert the given array of lines at offset 'at', count them as
  8960. // having the given height.
  8961. LeafChunk.prototype.insertInner = function (at, lines, height) {
  8962. var this$1 = this;
  8963. this.height += height;
  8964. this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
  8965. for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
  8966. };
  8967. // Used to iterate over a part of the tree.
  8968. LeafChunk.prototype.iterN = function (at, n, op) {
  8969. var this$1 = this;
  8970. for (var e = at + n; at < e; ++at)
  8971. { if (op(this$1.lines[at])) { return true } }
  8972. };
  8973. var BranchChunk = function(children) {
  8974. var this$1 = this;
  8975. this.children = children;
  8976. var size = 0, height = 0;
  8977. for (var i = 0; i < children.length; ++i) {
  8978. var ch = children[i];
  8979. size += ch.chunkSize(); height += ch.height;
  8980. ch.parent = this$1;
  8981. }
  8982. this.size = size;
  8983. this.height = height;
  8984. this.parent = null;
  8985. };
  8986. BranchChunk.prototype.chunkSize = function () { return this.size };
  8987. BranchChunk.prototype.removeInner = function (at, n) {
  8988. var this$1 = this;
  8989. this.size -= n;
  8990. for (var i = 0; i < this.children.length; ++i) {
  8991. var child = this$1.children[i], sz = child.chunkSize();
  8992. if (at < sz) {
  8993. var rm = Math.min(n, sz - at), oldHeight = child.height;
  8994. child.removeInner(at, rm);
  8995. this$1.height -= oldHeight - child.height;
  8996. if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
  8997. if ((n -= rm) == 0) { break }
  8998. at = 0;
  8999. } else { at -= sz; }
  9000. }
  9001. // If the result is smaller than 25 lines, ensure that it is a
  9002. // single leaf node.
  9003. if (this.size - n < 25 &&
  9004. (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
  9005. var lines = [];
  9006. this.collapse(lines);
  9007. this.children = [new LeafChunk(lines)];
  9008. this.children[0].parent = this;
  9009. }
  9010. };
  9011. BranchChunk.prototype.collapse = function (lines) {
  9012. var this$1 = this;
  9013. for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
  9014. };
  9015. BranchChunk.prototype.insertInner = function (at, lines, height) {
  9016. var this$1 = this;
  9017. this.size += lines.length;
  9018. this.height += height;
  9019. for (var i = 0; i < this.children.length; ++i) {
  9020. var child = this$1.children[i], sz = child.chunkSize();
  9021. if (at <= sz) {
  9022. child.insertInner(at, lines, height);
  9023. if (child.lines && child.lines.length > 50) {
  9024. // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
  9025. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
  9026. var remaining = child.lines.length % 25 + 25;
  9027. for (var pos = remaining; pos < child.lines.length;) {
  9028. var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
  9029. child.height -= leaf.height;
  9030. this$1.children.splice(++i, 0, leaf);
  9031. leaf.parent = this$1;
  9032. }
  9033. child.lines = child.lines.slice(0, remaining);
  9034. this$1.maybeSpill();
  9035. }
  9036. break
  9037. }
  9038. at -= sz;
  9039. }
  9040. };
  9041. // When a node has grown, check whether it should be split.
  9042. BranchChunk.prototype.maybeSpill = function () {
  9043. if (this.children.length <= 10) { return }
  9044. var me = this;
  9045. do {
  9046. var spilled = me.children.splice(me.children.length - 5, 5);
  9047. var sibling = new BranchChunk(spilled);
  9048. if (!me.parent) { // Become the parent node
  9049. var copy = new BranchChunk(me.children);
  9050. copy.parent = me;
  9051. me.children = [copy, sibling];
  9052. me = copy;
  9053. } else {
  9054. me.size -= sibling.size;
  9055. me.height -= sibling.height;
  9056. var myIndex = indexOf(me.parent.children, me);
  9057. me.parent.children.splice(myIndex + 1, 0, sibling);
  9058. }
  9059. sibling.parent = me.parent;
  9060. } while (me.children.length > 10)
  9061. me.parent.maybeSpill();
  9062. };
  9063. BranchChunk.prototype.iterN = function (at, n, op) {
  9064. var this$1 = this;
  9065. for (var i = 0; i < this.children.length; ++i) {
  9066. var child = this$1.children[i], sz = child.chunkSize();
  9067. if (at < sz) {
  9068. var used = Math.min(n, sz - at);
  9069. if (child.iterN(at, used, op)) { return true }
  9070. if ((n -= used) == 0) { break }
  9071. at = 0;
  9072. } else { at -= sz; }
  9073. }
  9074. };
  9075. // Line widgets are block elements displayed above or below a line.
  9076. var LineWidget = function(doc, node, options) {
  9077. var this$1 = this;
  9078. if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
  9079. { this$1[opt] = options[opt]; } } }
  9080. this.doc = doc;
  9081. this.node = node;
  9082. };
  9083. LineWidget.prototype.clear = function () {
  9084. var this$1 = this;
  9085. var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
  9086. if (no == null || !ws) { return }
  9087. for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
  9088. if (!ws.length) { line.widgets = null; }
  9089. var height = widgetHeight(this);
  9090. updateLineHeight(line, Math.max(0, line.height - height));
  9091. if (cm) {
  9092. runInOp(cm, function () {
  9093. adjustScrollWhenAboveVisible(cm, line, -height);
  9094. regLineChange(cm, no, "widget");
  9095. });
  9096. signalLater(cm, "lineWidgetCleared", cm, this, no);
  9097. }
  9098. };
  9099. LineWidget.prototype.changed = function () {
  9100. var this$1 = this;
  9101. var oldH = this.height, cm = this.doc.cm, line = this.line;
  9102. this.height = null;
  9103. var diff = widgetHeight(this) - oldH;
  9104. if (!diff) { return }
  9105. updateLineHeight(line, line.height + diff);
  9106. if (cm) {
  9107. runInOp(cm, function () {
  9108. cm.curOp.forceUpdate = true;
  9109. adjustScrollWhenAboveVisible(cm, line, diff);
  9110. signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
  9111. });
  9112. }
  9113. };
  9114. eventMixin(LineWidget);
  9115. function adjustScrollWhenAboveVisible(cm, line, diff) {
  9116. if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
  9117. { addToScrollPos(cm, null, diff); }
  9118. }
  9119. function addLineWidget(doc, handle, node, options) {
  9120. var widget = new LineWidget(doc, node, options);
  9121. var cm = doc.cm;
  9122. if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
  9123. changeLine(doc, handle, "widget", function (line) {
  9124. var widgets = line.widgets || (line.widgets = []);
  9125. if (widget.insertAt == null) { widgets.push(widget); }
  9126. else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
  9127. widget.line = line;
  9128. if (cm && !lineIsHidden(doc, line)) {
  9129. var aboveVisible = heightAtLine(line) < doc.scrollTop;
  9130. updateLineHeight(line, line.height + widgetHeight(widget));
  9131. if (aboveVisible) { addToScrollPos(cm, null, widget.height); }
  9132. cm.curOp.forceUpdate = true;
  9133. }
  9134. return true
  9135. });
  9136. signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle));
  9137. return widget
  9138. }
  9139. // TEXTMARKERS
  9140. // Created with markText and setBookmark methods. A TextMarker is a
  9141. // handle that can be used to clear or find a marked position in the
  9142. // document. Line objects hold arrays (markedSpans) containing
  9143. // {from, to, marker} object pointing to such marker objects, and
  9144. // indicating that such a marker is present on that line. Multiple
  9145. // lines may point to the same marker when it spans across lines.
  9146. // The spans will have null for their from/to properties when the
  9147. // marker continues beyond the start/end of the line. Markers have
  9148. // links back to the lines they currently touch.
  9149. // Collapsed markers have unique ids, in order to be able to order
  9150. // them, which is needed for uniquely determining an outer marker
  9151. // when they overlap (they may nest, but not partially overlap).
  9152. var nextMarkerId = 0;
  9153. var TextMarker = function(doc, type) {
  9154. this.lines = [];
  9155. this.type = type;
  9156. this.doc = doc;
  9157. this.id = ++nextMarkerId;
  9158. };
  9159. // Clear the marker.
  9160. TextMarker.prototype.clear = function () {
  9161. var this$1 = this;
  9162. if (this.explicitlyCleared) { return }
  9163. var cm = this.doc.cm, withOp = cm && !cm.curOp;
  9164. if (withOp) { startOperation(cm); }
  9165. if (hasHandler(this, "clear")) {
  9166. var found = this.find();
  9167. if (found) { signalLater(this, "clear", found.from, found.to); }
  9168. }
  9169. var min = null, max = null;
  9170. for (var i = 0; i < this.lines.length; ++i) {
  9171. var line = this$1.lines[i];
  9172. var span = getMarkedSpanFor(line.markedSpans, this$1);
  9173. if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
  9174. else if (cm) {
  9175. if (span.to != null) { max = lineNo(line); }
  9176. if (span.from != null) { min = lineNo(line); }
  9177. }
  9178. line.markedSpans = removeMarkedSpan(line.markedSpans, span);
  9179. if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
  9180. { updateLineHeight(line, textHeight(cm.display)); }
  9181. }
  9182. if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
  9183. var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
  9184. if (len > cm.display.maxLineLength) {
  9185. cm.display.maxLine = visual;
  9186. cm.display.maxLineLength = len;
  9187. cm.display.maxLineChanged = true;
  9188. }
  9189. } }
  9190. if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
  9191. this.lines.length = 0;
  9192. this.explicitlyCleared = true;
  9193. if (this.atomic && this.doc.cantEdit) {
  9194. this.doc.cantEdit = false;
  9195. if (cm) { reCheckSelection(cm.doc); }
  9196. }
  9197. if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
  9198. if (withOp) { endOperation(cm); }
  9199. if (this.parent) { this.parent.clear(); }
  9200. };
  9201. // Find the position of the marker in the document. Returns a {from,
  9202. // to} object by default. Side can be passed to get a specific side
  9203. // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  9204. // Pos objects returned contain a line object, rather than a line
  9205. // number (used to prevent looking up the same line twice).
  9206. TextMarker.prototype.find = function (side, lineObj) {
  9207. var this$1 = this;
  9208. if (side == null && this.type == "bookmark") { side = 1; }
  9209. var from, to;
  9210. for (var i = 0; i < this.lines.length; ++i) {
  9211. var line = this$1.lines[i];
  9212. var span = getMarkedSpanFor(line.markedSpans, this$1);
  9213. if (span.from != null) {
  9214. from = Pos(lineObj ? line : lineNo(line), span.from);
  9215. if (side == -1) { return from }
  9216. }
  9217. if (span.to != null) {
  9218. to = Pos(lineObj ? line : lineNo(line), span.to);
  9219. if (side == 1) { return to }
  9220. }
  9221. }
  9222. return from && {from: from, to: to}
  9223. };
  9224. // Signals that the marker's widget changed, and surrounding layout
  9225. // should be recomputed.
  9226. TextMarker.prototype.changed = function () {
  9227. var this$1 = this;
  9228. var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
  9229. if (!pos || !cm) { return }
  9230. runInOp(cm, function () {
  9231. var line = pos.line, lineN = lineNo(pos.line);
  9232. var view = findViewForLine(cm, lineN);
  9233. if (view) {
  9234. clearLineMeasurementCacheFor(view);
  9235. cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
  9236. }
  9237. cm.curOp.updateMaxLine = true;
  9238. if (!lineIsHidden(widget.doc, line) && widget.height != null) {
  9239. var oldHeight = widget.height;
  9240. widget.height = null;
  9241. var dHeight = widgetHeight(widget) - oldHeight;
  9242. if (dHeight)
  9243. { updateLineHeight(line, line.height + dHeight); }
  9244. }
  9245. signalLater(cm, "markerChanged", cm, this$1);
  9246. });
  9247. };
  9248. TextMarker.prototype.attachLine = function (line) {
  9249. if (!this.lines.length && this.doc.cm) {
  9250. var op = this.doc.cm.curOp;
  9251. if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
  9252. { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
  9253. }
  9254. this.lines.push(line);
  9255. };
  9256. TextMarker.prototype.detachLine = function (line) {
  9257. this.lines.splice(indexOf(this.lines, line), 1);
  9258. if (!this.lines.length && this.doc.cm) {
  9259. var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
  9260. }
  9261. };
  9262. eventMixin(TextMarker);
  9263. // Create a marker, wire it up to the right lines, and
  9264. function markText(doc, from, to, options, type) {
  9265. // Shared markers (across linked documents) are handled separately
  9266. // (markTextShared will call out to this again, once per
  9267. // document).
  9268. if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
  9269. // Ensure we are in an operation.
  9270. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
  9271. var marker = new TextMarker(doc, type), diff = cmp(from, to);
  9272. if (options) { copyObj(options, marker, false); }
  9273. // Don't connect empty markers unless clearWhenEmpty is false
  9274. if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
  9275. { return marker }
  9276. if (marker.replacedWith) {
  9277. // Showing up as a widget implies collapsed (widget replaces text)
  9278. marker.collapsed = true;
  9279. marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
  9280. if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
  9281. if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
  9282. }
  9283. if (marker.collapsed) {
  9284. if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
  9285. from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
  9286. { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
  9287. seeCollapsedSpans();
  9288. }
  9289. if (marker.addToHistory)
  9290. { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
  9291. var curLine = from.line, cm = doc.cm, updateMaxLine;
  9292. doc.iter(curLine, to.line + 1, function (line) {
  9293. if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
  9294. { updateMaxLine = true; }
  9295. if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
  9296. addMarkedSpan(line, new MarkedSpan(marker,
  9297. curLine == from.line ? from.ch : null,
  9298. curLine == to.line ? to.ch : null));
  9299. ++curLine;
  9300. });
  9301. // lineIsHidden depends on the presence of the spans, so needs a second pass
  9302. if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
  9303. if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
  9304. }); }
  9305. if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
  9306. if (marker.readOnly) {
  9307. seeReadOnlySpans();
  9308. if (doc.history.done.length || doc.history.undone.length)
  9309. { doc.clearHistory(); }
  9310. }
  9311. if (marker.collapsed) {
  9312. marker.id = ++nextMarkerId;
  9313. marker.atomic = true;
  9314. }
  9315. if (cm) {
  9316. // Sync editor state
  9317. if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
  9318. if (marker.collapsed)
  9319. { regChange(cm, from.line, to.line + 1); }
  9320. else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
  9321. { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
  9322. if (marker.atomic) { reCheckSelection(cm.doc); }
  9323. signalLater(cm, "markerAdded", cm, marker);
  9324. }
  9325. return marker
  9326. }
  9327. // SHARED TEXTMARKERS
  9328. // A shared marker spans multiple linked documents. It is
  9329. // implemented as a meta-marker-object controlling multiple normal
  9330. // markers.
  9331. var SharedTextMarker = function(markers, primary) {
  9332. var this$1 = this;
  9333. this.markers = markers;
  9334. this.primary = primary;
  9335. for (var i = 0; i < markers.length; ++i)
  9336. { markers[i].parent = this$1; }
  9337. };
  9338. SharedTextMarker.prototype.clear = function () {
  9339. var this$1 = this;
  9340. if (this.explicitlyCleared) { return }
  9341. this.explicitlyCleared = true;
  9342. for (var i = 0; i < this.markers.length; ++i)
  9343. { this$1.markers[i].clear(); }
  9344. signalLater(this, "clear");
  9345. };
  9346. SharedTextMarker.prototype.find = function (side, lineObj) {
  9347. return this.primary.find(side, lineObj)
  9348. };
  9349. eventMixin(SharedTextMarker);
  9350. function markTextShared(doc, from, to, options, type) {
  9351. options = copyObj(options);
  9352. options.shared = false;
  9353. var markers = [markText(doc, from, to, options, type)], primary = markers[0];
  9354. var widget = options.widgetNode;
  9355. linkedDocs(doc, function (doc) {
  9356. if (widget) { options.widgetNode = widget.cloneNode(true); }
  9357. markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
  9358. for (var i = 0; i < doc.linked.length; ++i)
  9359. { if (doc.linked[i].isParent) { return } }
  9360. primary = lst(markers);
  9361. });
  9362. return new SharedTextMarker(markers, primary)
  9363. }
  9364. function findSharedMarkers(doc) {
  9365. return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  9366. }
  9367. function copySharedMarkers(doc, markers) {
  9368. for (var i = 0; i < markers.length; i++) {
  9369. var marker = markers[i], pos = marker.find();
  9370. var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
  9371. if (cmp(mFrom, mTo)) {
  9372. var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
  9373. marker.markers.push(subMark);
  9374. subMark.parent = marker;
  9375. }
  9376. }
  9377. }
  9378. function detachSharedMarkers(markers) {
  9379. var loop = function ( i ) {
  9380. var marker = markers[i], linked = [marker.primary.doc];
  9381. linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
  9382. for (var j = 0; j < marker.markers.length; j++) {
  9383. var subMarker = marker.markers[j];
  9384. if (indexOf(linked, subMarker.doc) == -1) {
  9385. subMarker.parent = null;
  9386. marker.markers.splice(j--, 1);
  9387. }
  9388. }
  9389. };
  9390. for (var i = 0; i < markers.length; i++) loop( i );
  9391. }
  9392. var nextDocId = 0;
  9393. var Doc = function(text, mode, firstLine, lineSep, direction) {
  9394. if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
  9395. if (firstLine == null) { firstLine = 0; }
  9396. BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
  9397. this.first = firstLine;
  9398. this.scrollTop = this.scrollLeft = 0;
  9399. this.cantEdit = false;
  9400. this.cleanGeneration = 1;
  9401. this.frontier = firstLine;
  9402. var start = Pos(firstLine, 0);
  9403. this.sel = simpleSelection(start);
  9404. this.history = new History(null);
  9405. this.id = ++nextDocId;
  9406. this.modeOption = mode;
  9407. this.lineSep = lineSep;
  9408. this.direction = (direction == "rtl") ? "rtl" : "ltr";
  9409. this.extend = false;
  9410. if (typeof text == "string") { text = this.splitLines(text); }
  9411. updateDoc(this, {from: start, to: start, text: text});
  9412. setSelection(this, simpleSelection(start), sel_dontScroll);
  9413. };
  9414. Doc.prototype = createObj(BranchChunk.prototype, {
  9415. constructor: Doc,
  9416. // Iterate over the document. Supports two forms -- with only one
  9417. // argument, it calls that for each line in the document. With
  9418. // three, it iterates over the range given by the first two (with
  9419. // the second being non-inclusive).
  9420. iter: function(from, to, op) {
  9421. if (op) { this.iterN(from - this.first, to - from, op); }
  9422. else { this.iterN(this.first, this.first + this.size, from); }
  9423. },
  9424. // Non-public interface for adding and removing lines.
  9425. insert: function(at, lines) {
  9426. var height = 0;
  9427. for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
  9428. this.insertInner(at - this.first, lines, height);
  9429. },
  9430. remove: function(at, n) { this.removeInner(at - this.first, n); },
  9431. // From here, the methods are part of the public interface. Most
  9432. // are also available from CodeMirror (editor) instances.
  9433. getValue: function(lineSep) {
  9434. var lines = getLines(this, this.first, this.first + this.size);
  9435. if (lineSep === false) { return lines }
  9436. return lines.join(lineSep || this.lineSeparator())
  9437. },
  9438. setValue: docMethodOp(function(code) {
  9439. var top = Pos(this.first, 0), last = this.first + this.size - 1;
  9440. makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
  9441. text: this.splitLines(code), origin: "setValue", full: true}, true);
  9442. setSelection(this, simpleSelection(top));
  9443. }),
  9444. replaceRange: function(code, from, to, origin) {
  9445. from = clipPos(this, from);
  9446. to = to ? clipPos(this, to) : from;
  9447. replaceRange(this, code, from, to, origin);
  9448. },
  9449. getRange: function(from, to, lineSep) {
  9450. var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
  9451. if (lineSep === false) { return lines }
  9452. return lines.join(lineSep || this.lineSeparator())
  9453. },
  9454. getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
  9455. getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
  9456. getLineNumber: function(line) {return lineNo(line)},
  9457. getLineHandleVisualStart: function(line) {
  9458. if (typeof line == "number") { line = getLine(this, line); }
  9459. return visualLine(line)
  9460. },
  9461. lineCount: function() {return this.size},
  9462. firstLine: function() {return this.first},
  9463. lastLine: function() {return this.first + this.size - 1},
  9464. clipPos: function(pos) {return clipPos(this, pos)},
  9465. getCursor: function(start) {
  9466. var range$$1 = this.sel.primary(), pos;
  9467. if (start == null || start == "head") { pos = range$$1.head; }
  9468. else if (start == "anchor") { pos = range$$1.anchor; }
  9469. else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
  9470. else { pos = range$$1.from(); }
  9471. return pos
  9472. },
  9473. listSelections: function() { return this.sel.ranges },
  9474. somethingSelected: function() {return this.sel.somethingSelected()},
  9475. setCursor: docMethodOp(function(line, ch, options) {
  9476. setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
  9477. }),
  9478. setSelection: docMethodOp(function(anchor, head, options) {
  9479. setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
  9480. }),
  9481. extendSelection: docMethodOp(function(head, other, options) {
  9482. extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
  9483. }),
  9484. extendSelections: docMethodOp(function(heads, options) {
  9485. extendSelections(this, clipPosArray(this, heads), options);
  9486. }),
  9487. extendSelectionsBy: docMethodOp(function(f, options) {
  9488. var heads = map(this.sel.ranges, f);
  9489. extendSelections(this, clipPosArray(this, heads), options);
  9490. }),
  9491. setSelections: docMethodOp(function(ranges, primary, options) {
  9492. var this$1 = this;
  9493. if (!ranges.length) { return }
  9494. var out = [];
  9495. for (var i = 0; i < ranges.length; i++)
  9496. { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
  9497. clipPos(this$1, ranges[i].head)); }
  9498. if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
  9499. setSelection(this, normalizeSelection(out, primary), options);
  9500. }),
  9501. addSelection: docMethodOp(function(anchor, head, options) {
  9502. var ranges = this.sel.ranges.slice(0);
  9503. ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
  9504. setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
  9505. }),
  9506. getSelection: function(lineSep) {
  9507. var this$1 = this;
  9508. var ranges = this.sel.ranges, lines;
  9509. for (var i = 0; i < ranges.length; i++) {
  9510. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  9511. lines = lines ? lines.concat(sel) : sel;
  9512. }
  9513. if (lineSep === false) { return lines }
  9514. else { return lines.join(lineSep || this.lineSeparator()) }
  9515. },
  9516. getSelections: function(lineSep) {
  9517. var this$1 = this;
  9518. var parts = [], ranges = this.sel.ranges;
  9519. for (var i = 0; i < ranges.length; i++) {
  9520. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  9521. if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
  9522. parts[i] = sel;
  9523. }
  9524. return parts
  9525. },
  9526. replaceSelection: function(code, collapse, origin) {
  9527. var dup = [];
  9528. for (var i = 0; i < this.sel.ranges.length; i++)
  9529. { dup[i] = code; }
  9530. this.replaceSelections(dup, collapse, origin || "+input");
  9531. },
  9532. replaceSelections: docMethodOp(function(code, collapse, origin) {
  9533. var this$1 = this;
  9534. var changes = [], sel = this.sel;
  9535. for (var i = 0; i < sel.ranges.length; i++) {
  9536. var range$$1 = sel.ranges[i];
  9537. changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
  9538. }
  9539. var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
  9540. for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
  9541. { makeChange(this$1, changes[i$1]); }
  9542. if (newSel) { setSelectionReplaceHistory(this, newSel); }
  9543. else if (this.cm) { ensureCursorVisible(this.cm); }
  9544. }),
  9545. undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
  9546. redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
  9547. undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
  9548. redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
  9549. setExtending: function(val) {this.extend = val;},
  9550. getExtending: function() {return this.extend},
  9551. historySize: function() {
  9552. var hist = this.history, done = 0, undone = 0;
  9553. for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
  9554. for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
  9555. return {undo: done, redo: undone}
  9556. },
  9557. clearHistory: function() {this.history = new History(this.history.maxGeneration);},
  9558. markClean: function() {
  9559. this.cleanGeneration = this.changeGeneration(true);
  9560. },
  9561. changeGeneration: function(forceSplit) {
  9562. if (forceSplit)
  9563. { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
  9564. return this.history.generation
  9565. },
  9566. isClean: function (gen) {
  9567. return this.history.generation == (gen || this.cleanGeneration)
  9568. },
  9569. getHistory: function() {
  9570. return {done: copyHistoryArray(this.history.done),
  9571. undone: copyHistoryArray(this.history.undone)}
  9572. },
  9573. setHistory: function(histData) {
  9574. var hist = this.history = new History(this.history.maxGeneration);
  9575. hist.done = copyHistoryArray(histData.done.slice(0), null, true);
  9576. hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
  9577. },
  9578. setGutterMarker: docMethodOp(function(line, gutterID, value) {
  9579. return changeLine(this, line, "gutter", function (line) {
  9580. var markers = line.gutterMarkers || (line.gutterMarkers = {});
  9581. markers[gutterID] = value;
  9582. if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
  9583. return true
  9584. })
  9585. }),
  9586. clearGutter: docMethodOp(function(gutterID) {
  9587. var this$1 = this;
  9588. this.iter(function (line) {
  9589. if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
  9590. changeLine(this$1, line, "gutter", function () {
  9591. line.gutterMarkers[gutterID] = null;
  9592. if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
  9593. return true
  9594. });
  9595. }
  9596. });
  9597. }),
  9598. lineInfo: function(line) {
  9599. var n;
  9600. if (typeof line == "number") {
  9601. if (!isLine(this, line)) { return null }
  9602. n = line;
  9603. line = getLine(this, line);
  9604. if (!line) { return null }
  9605. } else {
  9606. n = lineNo(line);
  9607. if (n == null) { return null }
  9608. }
  9609. return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
  9610. textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
  9611. widgets: line.widgets}
  9612. },
  9613. addLineClass: docMethodOp(function(handle, where, cls) {
  9614. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  9615. var prop = where == "text" ? "textClass"
  9616. : where == "background" ? "bgClass"
  9617. : where == "gutter" ? "gutterClass" : "wrapClass";
  9618. if (!line[prop]) { line[prop] = cls; }
  9619. else if (classTest(cls).test(line[prop])) { return false }
  9620. else { line[prop] += " " + cls; }
  9621. return true
  9622. })
  9623. }),
  9624. removeLineClass: docMethodOp(function(handle, where, cls) {
  9625. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  9626. var prop = where == "text" ? "textClass"
  9627. : where == "background" ? "bgClass"
  9628. : where == "gutter" ? "gutterClass" : "wrapClass";
  9629. var cur = line[prop];
  9630. if (!cur) { return false }
  9631. else if (cls == null) { line[prop] = null; }
  9632. else {
  9633. var found = cur.match(classTest(cls));
  9634. if (!found) { return false }
  9635. var end = found.index + found[0].length;
  9636. line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
  9637. }
  9638. return true
  9639. })
  9640. }),
  9641. addLineWidget: docMethodOp(function(handle, node, options) {
  9642. return addLineWidget(this, handle, node, options)
  9643. }),
  9644. removeLineWidget: function(widget) { widget.clear(); },
  9645. markText: function(from, to, options) {
  9646. return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
  9647. },
  9648. setBookmark: function(pos, options) {
  9649. var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
  9650. insertLeft: options && options.insertLeft,
  9651. clearWhenEmpty: false, shared: options && options.shared,
  9652. handleMouseEvents: options && options.handleMouseEvents};
  9653. pos = clipPos(this, pos);
  9654. return markText(this, pos, pos, realOpts, "bookmark")
  9655. },
  9656. findMarksAt: function(pos) {
  9657. pos = clipPos(this, pos);
  9658. var markers = [], spans = getLine(this, pos.line).markedSpans;
  9659. if (spans) { for (var i = 0; i < spans.length; ++i) {
  9660. var span = spans[i];
  9661. if ((span.from == null || span.from <= pos.ch) &&
  9662. (span.to == null || span.to >= pos.ch))
  9663. { markers.push(span.marker.parent || span.marker); }
  9664. } }
  9665. return markers
  9666. },
  9667. findMarks: function(from, to, filter) {
  9668. from = clipPos(this, from); to = clipPos(this, to);
  9669. var found = [], lineNo$$1 = from.line;
  9670. this.iter(from.line, to.line + 1, function (line) {
  9671. var spans = line.markedSpans;
  9672. if (spans) { for (var i = 0; i < spans.length; i++) {
  9673. var span = spans[i];
  9674. if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
  9675. span.from == null && lineNo$$1 != from.line ||
  9676. span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
  9677. (!filter || filter(span.marker)))
  9678. { found.push(span.marker.parent || span.marker); }
  9679. } }
  9680. ++lineNo$$1;
  9681. });
  9682. return found
  9683. },
  9684. getAllMarks: function() {
  9685. var markers = [];
  9686. this.iter(function (line) {
  9687. var sps = line.markedSpans;
  9688. if (sps) { for (var i = 0; i < sps.length; ++i)
  9689. { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
  9690. });
  9691. return markers
  9692. },
  9693. posFromIndex: function(off) {
  9694. var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
  9695. this.iter(function (line) {
  9696. var sz = line.text.length + sepSize;
  9697. if (sz > off) { ch = off; return true }
  9698. off -= sz;
  9699. ++lineNo$$1;
  9700. });
  9701. return clipPos(this, Pos(lineNo$$1, ch))
  9702. },
  9703. indexFromPos: function (coords) {
  9704. coords = clipPos(this, coords);
  9705. var index = coords.ch;
  9706. if (coords.line < this.first || coords.ch < 0) { return 0 }
  9707. var sepSize = this.lineSeparator().length;
  9708. this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
  9709. index += line.text.length + sepSize;
  9710. });
  9711. return index
  9712. },
  9713. copy: function(copyHistory) {
  9714. var doc = new Doc(getLines(this, this.first, this.first + this.size),
  9715. this.modeOption, this.first, this.lineSep, this.direction);
  9716. doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
  9717. doc.sel = this.sel;
  9718. doc.extend = false;
  9719. if (copyHistory) {
  9720. doc.history.undoDepth = this.history.undoDepth;
  9721. doc.setHistory(this.getHistory());
  9722. }
  9723. return doc
  9724. },
  9725. linkedDoc: function(options) {
  9726. if (!options) { options = {}; }
  9727. var from = this.first, to = this.first + this.size;
  9728. if (options.from != null && options.from > from) { from = options.from; }
  9729. if (options.to != null && options.to < to) { to = options.to; }
  9730. var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
  9731. if (options.sharedHist) { copy.history = this.history
  9732. ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
  9733. copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
  9734. copySharedMarkers(copy, findSharedMarkers(this));
  9735. return copy
  9736. },
  9737. unlinkDoc: function(other) {
  9738. var this$1 = this;
  9739. if (other instanceof CodeMirror$1) { other = other.doc; }
  9740. if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
  9741. var link = this$1.linked[i];
  9742. if (link.doc != other) { continue }
  9743. this$1.linked.splice(i, 1);
  9744. other.unlinkDoc(this$1);
  9745. detachSharedMarkers(findSharedMarkers(this$1));
  9746. break
  9747. } }
  9748. // If the histories were shared, split them again
  9749. if (other.history == this.history) {
  9750. var splitIds = [other.id];
  9751. linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
  9752. other.history = new History(null);
  9753. other.history.done = copyHistoryArray(this.history.done, splitIds);
  9754. other.history.undone = copyHistoryArray(this.history.undone, splitIds);
  9755. }
  9756. },
  9757. iterLinkedDocs: function(f) {linkedDocs(this, f);},
  9758. getMode: function() {return this.mode},
  9759. getEditor: function() {return this.cm},
  9760. splitLines: function(str) {
  9761. if (this.lineSep) { return str.split(this.lineSep) }
  9762. return splitLinesAuto(str)
  9763. },
  9764. lineSeparator: function() { return this.lineSep || "\n" },
  9765. setDirection: docMethodOp(function (dir) {
  9766. if (dir != "rtl") { dir = "ltr"; }
  9767. if (dir == this.direction) { return }
  9768. this.direction = dir;
  9769. this.iter(function (line) { return line.order = null; });
  9770. if (this.cm) { directionChanged(this.cm); }
  9771. })
  9772. });
  9773. // Public alias.
  9774. Doc.prototype.eachLine = Doc.prototype.iter;
  9775. // Kludge to work around strange IE behavior where it'll sometimes
  9776. // re-fire a series of drag-related events right after the drop (#1551)
  9777. var lastDrop = 0;
  9778. function onDrop(e) {
  9779. var cm = this;
  9780. clearDragCursor(cm);
  9781. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
  9782. { return }
  9783. e_preventDefault(e);
  9784. if (ie) { lastDrop = +new Date; }
  9785. var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
  9786. if (!pos || cm.isReadOnly()) { return }
  9787. // Might be a file drop, in which case we simply extract the text
  9788. // and insert it.
  9789. if (files && files.length && window.FileReader && window.File) {
  9790. var n = files.length, text = Array(n), read = 0;
  9791. var loadFile = function (file, i) {
  9792. if (cm.options.allowDropFileTypes &&
  9793. indexOf(cm.options.allowDropFileTypes, file.type) == -1)
  9794. { return }
  9795. var reader = new FileReader;
  9796. reader.onload = operation(cm, function () {
  9797. var content = reader.result;
  9798. if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
  9799. text[i] = content;
  9800. if (++read == n) {
  9801. pos = clipPos(cm.doc, pos);
  9802. var change = {from: pos, to: pos,
  9803. text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
  9804. origin: "paste"};
  9805. makeChange(cm.doc, change);
  9806. setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
  9807. }
  9808. });
  9809. reader.readAsText(file);
  9810. };
  9811. for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
  9812. } else { // Normal drop
  9813. // Don't do a replace if the drop happened inside of the selected text.
  9814. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
  9815. cm.state.draggingText(e);
  9816. // Ensure the editor is re-focused
  9817. setTimeout(function () { return cm.display.input.focus(); }, 20);
  9818. return
  9819. }
  9820. try {
  9821. var text$1 = e.dataTransfer.getData("Text");
  9822. if (text$1) {
  9823. var selected;
  9824. if (cm.state.draggingText && !cm.state.draggingText.copy)
  9825. { selected = cm.listSelections(); }
  9826. setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
  9827. if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
  9828. { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
  9829. cm.replaceSelection(text$1, "around", "paste");
  9830. cm.display.input.focus();
  9831. }
  9832. }
  9833. catch(e){}
  9834. }
  9835. }
  9836. function onDragStart(cm, e) {
  9837. if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
  9838. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
  9839. e.dataTransfer.setData("Text", cm.getSelection());
  9840. e.dataTransfer.effectAllowed = "copyMove";
  9841. // Use dummy image instead of default browsers image.
  9842. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
  9843. if (e.dataTransfer.setDragImage && !safari) {
  9844. var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
  9845. img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
  9846. if (presto) {
  9847. img.width = img.height = 1;
  9848. cm.display.wrapper.appendChild(img);
  9849. // Force a relayout, or Opera won't use our image for some obscure reason
  9850. img._top = img.offsetTop;
  9851. }
  9852. e.dataTransfer.setDragImage(img, 0, 0);
  9853. if (presto) { img.parentNode.removeChild(img); }
  9854. }
  9855. }
  9856. function onDragOver(cm, e) {
  9857. var pos = posFromMouse(cm, e);
  9858. if (!pos) { return }
  9859. var frag = document.createDocumentFragment();
  9860. drawSelectionCursor(cm, pos, frag);
  9861. if (!cm.display.dragCursor) {
  9862. cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
  9863. cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
  9864. }
  9865. removeChildrenAndAdd(cm.display.dragCursor, frag);
  9866. }
  9867. function clearDragCursor(cm) {
  9868. if (cm.display.dragCursor) {
  9869. cm.display.lineSpace.removeChild(cm.display.dragCursor);
  9870. cm.display.dragCursor = null;
  9871. }
  9872. }
  9873. // These must be handled carefully, because naively registering a
  9874. // handler for each editor will cause the editors to never be
  9875. // garbage collected.
  9876. function forEachCodeMirror(f) {
  9877. if (!document.body.getElementsByClassName) { return }
  9878. var byClass = document.body.getElementsByClassName("CodeMirror");
  9879. for (var i = 0; i < byClass.length; i++) {
  9880. var cm = byClass[i].CodeMirror;
  9881. if (cm) { f(cm); }
  9882. }
  9883. }
  9884. var globalsRegistered = false;
  9885. function ensureGlobalHandlers() {
  9886. if (globalsRegistered) { return }
  9887. registerGlobalHandlers();
  9888. globalsRegistered = true;
  9889. }
  9890. function registerGlobalHandlers() {
  9891. // When the window resizes, we need to refresh active editors.
  9892. var resizeTimer;
  9893. on(window, "resize", function () {
  9894. if (resizeTimer == null) { resizeTimer = setTimeout(function () {
  9895. resizeTimer = null;
  9896. forEachCodeMirror(onResize);
  9897. }, 100); }
  9898. });
  9899. // When the window loses focus, we want to show the editor as blurred
  9900. on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  9901. }
  9902. // Called when the window resizes
  9903. function onResize(cm) {
  9904. var d = cm.display;
  9905. if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
  9906. { return }
  9907. // Might be a text scaling operation, clear size caches.
  9908. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  9909. d.scrollbarsClipped = false;
  9910. cm.setSize();
  9911. }
  9912. var keyNames = {
  9913. 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
  9914. 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
  9915. 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
  9916. 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
  9917. 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
  9918. 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
  9919. 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
  9920. 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  9921. };
  9922. // Number keys
  9923. for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  9924. // Alphabetic keys
  9925. for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  9926. // Function keys
  9927. for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
  9928. var keyMap = {};
  9929. keyMap.basic = {
  9930. "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
  9931. "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
  9932. "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
  9933. "Tab": "defaultTab", "Shift-Tab": "indentAuto",
  9934. "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
  9935. "Esc": "singleSelection"
  9936. };
  9937. // Note that the save and find-related commands aren't defined by
  9938. // default. User code or addons can define them. Unknown commands
  9939. // are simply ignored.
  9940. keyMap.pcDefault = {
  9941. "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
  9942. "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
  9943. "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
  9944. "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
  9945. "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
  9946. "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
  9947. "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
  9948. fallthrough: "basic"
  9949. };
  9950. // Very basic readline/emacs-style bindings, which are standard on Mac.
  9951. keyMap.emacsy = {
  9952. "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
  9953. "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
  9954. "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
  9955. "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
  9956. "Ctrl-O": "openLine"
  9957. };
  9958. keyMap.macDefault = {
  9959. "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
  9960. "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
  9961. "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
  9962. "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
  9963. "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
  9964. "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
  9965. "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
  9966. fallthrough: ["basic", "emacsy"]
  9967. };
  9968. keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
  9969. // KEYMAP DISPATCH
  9970. function normalizeKeyName(name) {
  9971. var parts = name.split(/-(?!$)/);
  9972. name = parts[parts.length - 1];
  9973. var alt, ctrl, shift, cmd;
  9974. for (var i = 0; i < parts.length - 1; i++) {
  9975. var mod = parts[i];
  9976. if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
  9977. else if (/^a(lt)?$/i.test(mod)) { alt = true; }
  9978. else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
  9979. else if (/^s(hift)?$/i.test(mod)) { shift = true; }
  9980. else { throw new Error("Unrecognized modifier name: " + mod) }
  9981. }
  9982. if (alt) { name = "Alt-" + name; }
  9983. if (ctrl) { name = "Ctrl-" + name; }
  9984. if (cmd) { name = "Cmd-" + name; }
  9985. if (shift) { name = "Shift-" + name; }
  9986. return name
  9987. }
  9988. // This is a kludge to keep keymaps mostly working as raw objects
  9989. // (backwards compatibility) while at the same time support features
  9990. // like normalization and multi-stroke key bindings. It compiles a
  9991. // new normalized keymap, and then updates the old object to reflect
  9992. // this.
  9993. function normalizeKeyMap(keymap) {
  9994. var copy = {};
  9995. for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
  9996. var value = keymap[keyname];
  9997. if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
  9998. if (value == "...") { delete keymap[keyname]; continue }
  9999. var keys = map(keyname.split(" "), normalizeKeyName);
  10000. for (var i = 0; i < keys.length; i++) {
  10001. var val = (void 0), name = (void 0);
  10002. if (i == keys.length - 1) {
  10003. name = keys.join(" ");
  10004. val = value;
  10005. } else {
  10006. name = keys.slice(0, i + 1).join(" ");
  10007. val = "...";
  10008. }
  10009. var prev = copy[name];
  10010. if (!prev) { copy[name] = val; }
  10011. else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
  10012. }
  10013. delete keymap[keyname];
  10014. } }
  10015. for (var prop in copy) { keymap[prop] = copy[prop]; }
  10016. return keymap
  10017. }
  10018. function lookupKey(key, map$$1, handle, context) {
  10019. map$$1 = getKeyMap(map$$1);
  10020. var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
  10021. if (found === false) { return "nothing" }
  10022. if (found === "...") { return "multi" }
  10023. if (found != null && handle(found)) { return "handled" }
  10024. if (map$$1.fallthrough) {
  10025. if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
  10026. { return lookupKey(key, map$$1.fallthrough, handle, context) }
  10027. for (var i = 0; i < map$$1.fallthrough.length; i++) {
  10028. var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
  10029. if (result) { return result }
  10030. }
  10031. }
  10032. }
  10033. // Modifier key presses don't count as 'real' key presses for the
  10034. // purpose of keymap fallthrough.
  10035. function isModifierKey(value) {
  10036. var name = typeof value == "string" ? value : keyNames[value.keyCode];
  10037. return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  10038. }
  10039. // Look up the name of a key as indicated by an event object.
  10040. function keyName(event, noShift) {
  10041. if (presto && event.keyCode == 34 && event["char"]) { return false }
  10042. var base = keyNames[event.keyCode], name = base;
  10043. if (name == null || event.altGraphKey) { return false }
  10044. if (event.altKey && base != "Alt") { name = "Alt-" + name; }
  10045. if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
  10046. if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
  10047. if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
  10048. return name
  10049. }
  10050. function getKeyMap(val) {
  10051. return typeof val == "string" ? keyMap[val] : val
  10052. }
  10053. // Helper for deleting text near the selection(s), used to implement
  10054. // backspace, delete, and similar functionality.
  10055. function deleteNearSelection(cm, compute) {
  10056. var ranges = cm.doc.sel.ranges, kill = [];
  10057. // Build up a set of ranges to kill first, merging overlapping
  10058. // ranges.
  10059. for (var i = 0; i < ranges.length; i++) {
  10060. var toKill = compute(ranges[i]);
  10061. while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
  10062. var replaced = kill.pop();
  10063. if (cmp(replaced.from, toKill.from) < 0) {
  10064. toKill.from = replaced.from;
  10065. break
  10066. }
  10067. }
  10068. kill.push(toKill);
  10069. }
  10070. // Next, remove those actual ranges.
  10071. runInOp(cm, function () {
  10072. for (var i = kill.length - 1; i >= 0; i--)
  10073. { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
  10074. ensureCursorVisible(cm);
  10075. });
  10076. }
  10077. // Commands are parameter-less actions that can be performed on an
  10078. // editor, mostly used for keybindings.
  10079. var commands = {
  10080. selectAll: selectAll,
  10081. singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
  10082. killLine: function (cm) { return deleteNearSelection(cm, function (range) {
  10083. if (range.empty()) {
  10084. var len = getLine(cm.doc, range.head.line).text.length;
  10085. if (range.head.ch == len && range.head.line < cm.lastLine())
  10086. { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
  10087. else
  10088. { return {from: range.head, to: Pos(range.head.line, len)} }
  10089. } else {
  10090. return {from: range.from(), to: range.to()}
  10091. }
  10092. }); },
  10093. deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  10094. from: Pos(range.from().line, 0),
  10095. to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
  10096. }); }); },
  10097. delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  10098. from: Pos(range.from().line, 0), to: range.from()
  10099. }); }); },
  10100. delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
  10101. var top = cm.charCoords(range.head, "div").top + 5;
  10102. var leftPos = cm.coordsChar({left: 0, top: top}, "div");
  10103. return {from: leftPos, to: range.from()}
  10104. }); },
  10105. delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
  10106. var top = cm.charCoords(range.head, "div").top + 5;
  10107. var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
  10108. return {from: range.from(), to: rightPos }
  10109. }); },
  10110. undo: function (cm) { return cm.undo(); },
  10111. redo: function (cm) { return cm.redo(); },
  10112. undoSelection: function (cm) { return cm.undoSelection(); },
  10113. redoSelection: function (cm) { return cm.redoSelection(); },
  10114. goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
  10115. goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
  10116. goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
  10117. {origin: "+move", bias: 1}
  10118. ); },
  10119. goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
  10120. {origin: "+move", bias: 1}
  10121. ); },
  10122. goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
  10123. {origin: "+move", bias: -1}
  10124. ); },
  10125. goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
  10126. var top = cm.charCoords(range.head, "div").top + 5;
  10127. return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
  10128. }, sel_move); },
  10129. goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
  10130. var top = cm.charCoords(range.head, "div").top + 5;
  10131. return cm.coordsChar({left: 0, top: top}, "div")
  10132. }, sel_move); },
  10133. goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
  10134. var top = cm.charCoords(range.head, "div").top + 5;
  10135. var pos = cm.coordsChar({left: 0, top: top}, "div");
  10136. if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
  10137. return pos
  10138. }, sel_move); },
  10139. goLineUp: function (cm) { return cm.moveV(-1, "line"); },
  10140. goLineDown: function (cm) { return cm.moveV(1, "line"); },
  10141. goPageUp: function (cm) { return cm.moveV(-1, "page"); },
  10142. goPageDown: function (cm) { return cm.moveV(1, "page"); },
  10143. goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
  10144. goCharRight: function (cm) { return cm.moveH(1, "char"); },
  10145. goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
  10146. goColumnRight: function (cm) { return cm.moveH(1, "column"); },
  10147. goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
  10148. goGroupRight: function (cm) { return cm.moveH(1, "group"); },
  10149. goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
  10150. goWordRight: function (cm) { return cm.moveH(1, "word"); },
  10151. delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
  10152. delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
  10153. delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
  10154. delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
  10155. delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
  10156. delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
  10157. indentAuto: function (cm) { return cm.indentSelection("smart"); },
  10158. indentMore: function (cm) { return cm.indentSelection("add"); },
  10159. indentLess: function (cm) { return cm.indentSelection("subtract"); },
  10160. insertTab: function (cm) { return cm.replaceSelection("\t"); },
  10161. insertSoftTab: function (cm) {
  10162. var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
  10163. for (var i = 0; i < ranges.length; i++) {
  10164. var pos = ranges[i].from();
  10165. var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
  10166. spaces.push(spaceStr(tabSize - col % tabSize));
  10167. }
  10168. cm.replaceSelections(spaces);
  10169. },
  10170. defaultTab: function (cm) {
  10171. if (cm.somethingSelected()) { cm.indentSelection("add"); }
  10172. else { cm.execCommand("insertTab"); }
  10173. },
  10174. // Swap the two chars left and right of each selection's head.
  10175. // Move cursor behind the two swapped characters afterwards.
  10176. //
  10177. // Doesn't consider line feeds a character.
  10178. // Doesn't scan more than one line above to find a character.
  10179. // Doesn't do anything on an empty line.
  10180. // Doesn't do anything with non-empty selections.
  10181. transposeChars: function (cm) { return runInOp(cm, function () {
  10182. var ranges = cm.listSelections(), newSel = [];
  10183. for (var i = 0; i < ranges.length; i++) {
  10184. if (!ranges[i].empty()) { continue }
  10185. var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
  10186. if (line) {
  10187. if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
  10188. if (cur.ch > 0) {
  10189. cur = new Pos(cur.line, cur.ch + 1);
  10190. cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
  10191. Pos(cur.line, cur.ch - 2), cur, "+transpose");
  10192. } else if (cur.line > cm.doc.first) {
  10193. var prev = getLine(cm.doc, cur.line - 1).text;
  10194. if (prev) {
  10195. cur = new Pos(cur.line, 1);
  10196. cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
  10197. prev.charAt(prev.length - 1),
  10198. Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
  10199. }
  10200. }
  10201. }
  10202. newSel.push(new Range(cur, cur));
  10203. }
  10204. cm.setSelections(newSel);
  10205. }); },
  10206. newlineAndIndent: function (cm) { return runInOp(cm, function () {
  10207. var sels = cm.listSelections();
  10208. for (var i = sels.length - 1; i >= 0; i--)
  10209. { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
  10210. sels = cm.listSelections();
  10211. for (var i$1 = 0; i$1 < sels.length; i$1++)
  10212. { cm.indentLine(sels[i$1].from().line, null, true); }
  10213. ensureCursorVisible(cm);
  10214. }); },
  10215. openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
  10216. toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  10217. };
  10218. function lineStart(cm, lineN) {
  10219. var line = getLine(cm.doc, lineN);
  10220. var visual = visualLine(line);
  10221. if (visual != line) { lineN = lineNo(visual); }
  10222. return endOfLine(true, cm, visual, lineN, 1)
  10223. }
  10224. function lineEnd(cm, lineN) {
  10225. var line = getLine(cm.doc, lineN);
  10226. var visual = visualLineEnd(line);
  10227. if (visual != line) { lineN = lineNo(visual); }
  10228. return endOfLine(true, cm, line, lineN, -1)
  10229. }
  10230. function lineStartSmart(cm, pos) {
  10231. var start = lineStart(cm, pos.line);
  10232. var line = getLine(cm.doc, start.line);
  10233. var order = getOrder(line, cm.doc.direction);
  10234. if (!order || order[0].level == 0) {
  10235. var firstNonWS = Math.max(0, line.text.search(/\S/));
  10236. var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
  10237. return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
  10238. }
  10239. return start
  10240. }
  10241. // Run a handler that was bound to a key.
  10242. function doHandleBinding(cm, bound, dropShift) {
  10243. if (typeof bound == "string") {
  10244. bound = commands[bound];
  10245. if (!bound) { return false }
  10246. }
  10247. // Ensure previous input has been read, so that the handler sees a
  10248. // consistent view of the document
  10249. cm.display.input.ensurePolled();
  10250. var prevShift = cm.display.shift, done = false;
  10251. try {
  10252. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  10253. if (dropShift) { cm.display.shift = false; }
  10254. done = bound(cm) != Pass;
  10255. } finally {
  10256. cm.display.shift = prevShift;
  10257. cm.state.suppressEdits = false;
  10258. }
  10259. return done
  10260. }
  10261. function lookupKeyForEditor(cm, name, handle) {
  10262. for (var i = 0; i < cm.state.keyMaps.length; i++) {
  10263. var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
  10264. if (result) { return result }
  10265. }
  10266. return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
  10267. || lookupKey(name, cm.options.keyMap, handle, cm)
  10268. }
  10269. var stopSeq = new Delayed;
  10270. function dispatchKey(cm, name, e, handle) {
  10271. var seq = cm.state.keySeq;
  10272. if (seq) {
  10273. if (isModifierKey(name)) { return "handled" }
  10274. stopSeq.set(50, function () {
  10275. if (cm.state.keySeq == seq) {
  10276. cm.state.keySeq = null;
  10277. cm.display.input.reset();
  10278. }
  10279. });
  10280. name = seq + " " + name;
  10281. }
  10282. var result = lookupKeyForEditor(cm, name, handle);
  10283. if (result == "multi")
  10284. { cm.state.keySeq = name; }
  10285. if (result == "handled")
  10286. { signalLater(cm, "keyHandled", cm, name, e); }
  10287. if (result == "handled" || result == "multi") {
  10288. e_preventDefault(e);
  10289. restartBlink(cm);
  10290. }
  10291. if (seq && !result && /\'$/.test(name)) {
  10292. e_preventDefault(e);
  10293. return true
  10294. }
  10295. return !!result
  10296. }
  10297. // Handle a key from the keydown event.
  10298. function handleKeyBinding(cm, e) {
  10299. var name = keyName(e, true);
  10300. if (!name) { return false }
  10301. if (e.shiftKey && !cm.state.keySeq) {
  10302. // First try to resolve full name (including 'Shift-'). Failing
  10303. // that, see if there is a cursor-motion command (starting with
  10304. // 'go') bound to the keyname without 'Shift-'.
  10305. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
  10306. || dispatchKey(cm, name, e, function (b) {
  10307. if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
  10308. { return doHandleBinding(cm, b) }
  10309. })
  10310. } else {
  10311. return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
  10312. }
  10313. }
  10314. // Handle a key from the keypress event
  10315. function handleCharBinding(cm, e, ch) {
  10316. return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  10317. }
  10318. var lastStoppedKey = null;
  10319. function onKeyDown(e) {
  10320. var cm = this;
  10321. cm.curOp.focus = activeElt();
  10322. if (signalDOMEvent(cm, e)) { return }
  10323. // IE does strange things with escape.
  10324. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
  10325. var code = e.keyCode;
  10326. cm.display.shift = code == 16 || e.shiftKey;
  10327. var handled = handleKeyBinding(cm, e);
  10328. if (presto) {
  10329. lastStoppedKey = handled ? code : null;
  10330. // Opera has no cut event... we try to at least catch the key combo
  10331. if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
  10332. { cm.replaceSelection("", null, "cut"); }
  10333. }
  10334. // Turn mouse into crosshair when Alt is held on Mac.
  10335. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
  10336. { showCrossHair(cm); }
  10337. }
  10338. function showCrossHair(cm) {
  10339. var lineDiv = cm.display.lineDiv;
  10340. addClass(lineDiv, "CodeMirror-crosshair");
  10341. function up(e) {
  10342. if (e.keyCode == 18 || !e.altKey) {
  10343. rmClass(lineDiv, "CodeMirror-crosshair");
  10344. off(document, "keyup", up);
  10345. off(document, "mouseover", up);
  10346. }
  10347. }
  10348. on(document, "keyup", up);
  10349. on(document, "mouseover", up);
  10350. }
  10351. function onKeyUp(e) {
  10352. if (e.keyCode == 16) { this.doc.sel.shift = false; }
  10353. signalDOMEvent(this, e);
  10354. }
  10355. function onKeyPress(e) {
  10356. var cm = this;
  10357. if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
  10358. var keyCode = e.keyCode, charCode = e.charCode;
  10359. if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
  10360. if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
  10361. var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
  10362. // Some browsers fire keypress events for backspace
  10363. if (ch == "\x08") { return }
  10364. if (handleCharBinding(cm, e, ch)) { return }
  10365. cm.display.input.onKeyPress(e);
  10366. }
  10367. // A mouse down can be a single click, double click, triple click,
  10368. // start of selection drag, start of text drag, new cursor
  10369. // (ctrl-click), rectangle drag (alt-drag), or xwin
  10370. // middle-click-paste. Or it might be a click on something we should
  10371. // not interfere with, such as a scrollbar or widget.
  10372. function onMouseDown(e) {
  10373. var cm = this, display = cm.display;
  10374. if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  10375. display.input.ensurePolled();
  10376. display.shift = e.shiftKey;
  10377. if (eventInWidget(display, e)) {
  10378. if (!webkit) {
  10379. // Briefly turn off draggability, to allow widgets to do
  10380. // normal dragging things.
  10381. display.scroller.draggable = false;
  10382. setTimeout(function () { return display.scroller.draggable = true; }, 100);
  10383. }
  10384. return
  10385. }
  10386. if (clickInGutter(cm, e)) { return }
  10387. var start = posFromMouse(cm, e);
  10388. window.focus();
  10389. switch (e_button(e)) {
  10390. case 1:
  10391. // #3261: make sure, that we're not starting a second selection
  10392. if (cm.state.selectingText)
  10393. { cm.state.selectingText(e); }
  10394. else if (start)
  10395. { leftButtonDown(cm, e, start); }
  10396. else if (e_target(e) == display.scroller)
  10397. { e_preventDefault(e); }
  10398. break
  10399. case 2:
  10400. if (webkit) { cm.state.lastMiddleDown = +new Date; }
  10401. if (start) { extendSelection(cm.doc, start); }
  10402. setTimeout(function () { return display.input.focus(); }, 20);
  10403. e_preventDefault(e);
  10404. break
  10405. case 3:
  10406. if (captureRightClick) { onContextMenu(cm, e); }
  10407. else { delayBlurEvent(cm); }
  10408. break
  10409. }
  10410. }
  10411. var lastClick;
  10412. var lastDoubleClick;
  10413. function leftButtonDown(cm, e, start) {
  10414. if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
  10415. else { cm.curOp.focus = activeElt(); }
  10416. var now = +new Date, type;
  10417. if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
  10418. type = "triple";
  10419. } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
  10420. type = "double";
  10421. lastDoubleClick = {time: now, pos: start};
  10422. } else {
  10423. type = "single";
  10424. lastClick = {time: now, pos: start};
  10425. }
  10426. var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
  10427. if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
  10428. type == "single" && (contained = sel.contains(start)) > -1 &&
  10429. (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
  10430. (cmp(contained.to(), start) > 0 || start.xRel < 0))
  10431. { leftButtonStartDrag(cm, e, start, modifier); }
  10432. else
  10433. { leftButtonSelect(cm, e, start, type, modifier); }
  10434. }
  10435. // Start a text drag. When it ends, see if any dragging actually
  10436. // happen, and treat as a click if it didn't.
  10437. function leftButtonStartDrag(cm, e, start, modifier) {
  10438. var display = cm.display, startTime = +new Date;
  10439. var dragEnd = operation(cm, function (e2) {
  10440. if (webkit) { display.scroller.draggable = false; }
  10441. cm.state.draggingText = false;
  10442. off(document, "mouseup", dragEnd);
  10443. off(display.scroller, "drop", dragEnd);
  10444. if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
  10445. e_preventDefault(e2);
  10446. if (!modifier && +new Date - 200 < startTime)
  10447. { extendSelection(cm.doc, start); }
  10448. // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
  10449. if (webkit || ie && ie_version == 9)
  10450. { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
  10451. else
  10452. { display.input.focus(); }
  10453. }
  10454. });
  10455. // Let the drag handler handle this.
  10456. if (webkit) { display.scroller.draggable = true; }
  10457. cm.state.draggingText = dragEnd;
  10458. dragEnd.copy = mac ? e.altKey : e.ctrlKey;
  10459. // IE's approach to draggable
  10460. if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  10461. on(document, "mouseup", dragEnd);
  10462. on(display.scroller, "drop", dragEnd);
  10463. }
  10464. // Normal selection, as opposed to text dragging.
  10465. function leftButtonSelect(cm, e, start, type, addNew) {
  10466. var display = cm.display, doc = cm.doc;
  10467. e_preventDefault(e);
  10468. var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
  10469. if (addNew && !e.shiftKey) {
  10470. ourIndex = doc.sel.contains(start);
  10471. if (ourIndex > -1)
  10472. { ourRange = ranges[ourIndex]; }
  10473. else
  10474. { ourRange = new Range(start, start); }
  10475. } else {
  10476. ourRange = doc.sel.primary();
  10477. ourIndex = doc.sel.primIndex;
  10478. }
  10479. if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
  10480. type = "rect";
  10481. if (!addNew) { ourRange = new Range(start, start); }
  10482. start = posFromMouse(cm, e, true, true);
  10483. ourIndex = -1;
  10484. } else if (type == "double") {
  10485. var word = cm.findWordAt(start);
  10486. if (cm.display.shift || doc.extend)
  10487. { ourRange = extendRange(doc, ourRange, word.anchor, word.head); }
  10488. else
  10489. { ourRange = word; }
  10490. } else if (type == "triple") {
  10491. var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
  10492. if (cm.display.shift || doc.extend)
  10493. { ourRange = extendRange(doc, ourRange, line.anchor, line.head); }
  10494. else
  10495. { ourRange = line; }
  10496. } else {
  10497. ourRange = extendRange(doc, ourRange, start);
  10498. }
  10499. if (!addNew) {
  10500. ourIndex = 0;
  10501. setSelection(doc, new Selection([ourRange], 0), sel_mouse);
  10502. startSel = doc.sel;
  10503. } else if (ourIndex == -1) {
  10504. ourIndex = ranges.length;
  10505. setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
  10506. {scroll: false, origin: "*mouse"});
  10507. } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
  10508. setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
  10509. {scroll: false, origin: "*mouse"});
  10510. startSel = doc.sel;
  10511. } else {
  10512. replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
  10513. }
  10514. var lastPos = start;
  10515. function extendTo(pos) {
  10516. if (cmp(lastPos, pos) == 0) { return }
  10517. lastPos = pos;
  10518. if (type == "rect") {
  10519. var ranges = [], tabSize = cm.options.tabSize;
  10520. var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
  10521. var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
  10522. var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
  10523. for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
  10524. line <= end; line++) {
  10525. var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
  10526. if (left == right)
  10527. { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
  10528. else if (text.length > leftPos)
  10529. { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
  10530. }
  10531. if (!ranges.length) { ranges.push(new Range(start, start)); }
  10532. setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
  10533. {origin: "*mouse", scroll: false});
  10534. cm.scrollIntoView(pos);
  10535. } else {
  10536. var oldRange = ourRange;
  10537. var anchor = oldRange.anchor, head = pos;
  10538. if (type != "single") {
  10539. var range$$1;
  10540. if (type == "double")
  10541. { range$$1 = cm.findWordAt(pos); }
  10542. else
  10543. { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }
  10544. if (cmp(range$$1.anchor, anchor) > 0) {
  10545. head = range$$1.head;
  10546. anchor = minPos(oldRange.from(), range$$1.anchor);
  10547. } else {
  10548. head = range$$1.anchor;
  10549. anchor = maxPos(oldRange.to(), range$$1.head);
  10550. }
  10551. }
  10552. var ranges$1 = startSel.ranges.slice(0);
  10553. ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);
  10554. setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);
  10555. }
  10556. }
  10557. var editorSize = display.wrapper.getBoundingClientRect();
  10558. // Used to ensure timeout re-tries don't fire when another extend
  10559. // happened in the meantime (clearTimeout isn't reliable -- at
  10560. // least on Chrome, the timeouts still happen even when cleared,
  10561. // if the clear happens after their scheduled firing time).
  10562. var counter = 0;
  10563. function extend(e) {
  10564. var curCount = ++counter;
  10565. var cur = posFromMouse(cm, e, true, type == "rect");
  10566. if (!cur) { return }
  10567. if (cmp(cur, lastPos) != 0) {
  10568. cm.curOp.focus = activeElt();
  10569. extendTo(cur);
  10570. var visible = visibleLines(display, doc);
  10571. if (cur.line >= visible.to || cur.line < visible.from)
  10572. { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
  10573. } else {
  10574. var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
  10575. if (outside) { setTimeout(operation(cm, function () {
  10576. if (counter != curCount) { return }
  10577. display.scroller.scrollTop += outside;
  10578. extend(e);
  10579. }), 50); }
  10580. }
  10581. }
  10582. function done(e) {
  10583. cm.state.selectingText = false;
  10584. counter = Infinity;
  10585. e_preventDefault(e);
  10586. display.input.focus();
  10587. off(document, "mousemove", move);
  10588. off(document, "mouseup", up);
  10589. doc.history.lastSelOrigin = null;
  10590. }
  10591. var move = operation(cm, function (e) {
  10592. if (!e_button(e)) { done(e); }
  10593. else { extend(e); }
  10594. });
  10595. var up = operation(cm, done);
  10596. cm.state.selectingText = up;
  10597. on(document, "mousemove", move);
  10598. on(document, "mouseup", up);
  10599. }
  10600. // Determines whether an event happened in the gutter, and fires the
  10601. // handlers for the corresponding event.
  10602. function gutterEvent(cm, e, type, prevent) {
  10603. var mX, mY;
  10604. try { mX = e.clientX; mY = e.clientY; }
  10605. catch(e) { return false }
  10606. if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  10607. if (prevent) { e_preventDefault(e); }
  10608. var display = cm.display;
  10609. var lineBox = display.lineDiv.getBoundingClientRect();
  10610. if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
  10611. mY -= lineBox.top - display.viewOffset;
  10612. for (var i = 0; i < cm.options.gutters.length; ++i) {
  10613. var g = display.gutters.childNodes[i];
  10614. if (g && g.getBoundingClientRect().right >= mX) {
  10615. var line = lineAtHeight(cm.doc, mY);
  10616. var gutter = cm.options.gutters[i];
  10617. signal(cm, type, cm, line, gutter, e);
  10618. return e_defaultPrevented(e)
  10619. }
  10620. }
  10621. }
  10622. function clickInGutter(cm, e) {
  10623. return gutterEvent(cm, e, "gutterClick", true)
  10624. }
  10625. // CONTEXT MENU HANDLING
  10626. // To make the context menu work, we need to briefly unhide the
  10627. // textarea (making it as unobtrusive as possible) to let the
  10628. // right-click take effect on it.
  10629. function onContextMenu(cm, e) {
  10630. if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
  10631. if (signalDOMEvent(cm, e, "contextmenu")) { return }
  10632. cm.display.input.onContextMenu(e);
  10633. }
  10634. function contextMenuInGutter(cm, e) {
  10635. if (!hasHandler(cm, "gutterContextMenu")) { return false }
  10636. return gutterEvent(cm, e, "gutterContextMenu", false)
  10637. }
  10638. function themeChanged(cm) {
  10639. cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  10640. cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  10641. clearCaches(cm);
  10642. }
  10643. var Init = {toString: function(){return "CodeMirror.Init"}};
  10644. var defaults = {};
  10645. var optionHandlers = {};
  10646. function defineOptions(CodeMirror) {
  10647. var optionHandlers = CodeMirror.optionHandlers;
  10648. function option(name, deflt, handle, notOnInit) {
  10649. CodeMirror.defaults[name] = deflt;
  10650. if (handle) { optionHandlers[name] =
  10651. notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
  10652. }
  10653. CodeMirror.defineOption = option;
  10654. // Passed to option handlers when there is no old value.
  10655. CodeMirror.Init = Init;
  10656. // These two are, on init, called from the constructor because they
  10657. // have to be initialized before the editor can start at all.
  10658. option("value", "", function (cm, val) { return cm.setValue(val); }, true);
  10659. option("mode", null, function (cm, val) {
  10660. cm.doc.modeOption = val;
  10661. loadMode(cm);
  10662. }, true);
  10663. option("indentUnit", 2, loadMode, true);
  10664. option("indentWithTabs", false);
  10665. option("smartIndent", true);
  10666. option("tabSize", 4, function (cm) {
  10667. resetModeState(cm);
  10668. clearCaches(cm);
  10669. regChange(cm);
  10670. }, true);
  10671. option("lineSeparator", null, function (cm, val) {
  10672. cm.doc.lineSep = val;
  10673. if (!val) { return }
  10674. var newBreaks = [], lineNo = cm.doc.first;
  10675. cm.doc.iter(function (line) {
  10676. for (var pos = 0;;) {
  10677. var found = line.text.indexOf(val, pos);
  10678. if (found == -1) { break }
  10679. pos = found + val.length;
  10680. newBreaks.push(Pos(lineNo, found));
  10681. }
  10682. lineNo++;
  10683. });
  10684. for (var i = newBreaks.length - 1; i >= 0; i--)
  10685. { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
  10686. });
  10687. option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
  10688. cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
  10689. if (old != Init) { cm.refresh(); }
  10690. });
  10691. option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
  10692. option("electricChars", true);
  10693. option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
  10694. throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
  10695. }, true);
  10696. option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
  10697. option("rtlMoveVisually", !windows);
  10698. option("wholeLineUpdateBefore", true);
  10699. option("theme", "default", function (cm) {
  10700. themeChanged(cm);
  10701. guttersChanged(cm);
  10702. }, true);
  10703. option("keyMap", "default", function (cm, val, old) {
  10704. var next = getKeyMap(val);
  10705. var prev = old != Init && getKeyMap(old);
  10706. if (prev && prev.detach) { prev.detach(cm, next); }
  10707. if (next.attach) { next.attach(cm, prev || null); }
  10708. });
  10709. option("extraKeys", null);
  10710. option("lineWrapping", false, wrappingChanged, true);
  10711. option("gutters", [], function (cm) {
  10712. setGuttersForLineNumbers(cm.options);
  10713. guttersChanged(cm);
  10714. }, true);
  10715. option("fixedGutter", true, function (cm, val) {
  10716. cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
  10717. cm.refresh();
  10718. }, true);
  10719. option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
  10720. option("scrollbarStyle", "native", function (cm) {
  10721. initScrollbars(cm);
  10722. updateScrollbars(cm);
  10723. cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
  10724. cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
  10725. }, true);
  10726. option("lineNumbers", false, function (cm) {
  10727. setGuttersForLineNumbers(cm.options);
  10728. guttersChanged(cm);
  10729. }, true);
  10730. option("firstLineNumber", 1, guttersChanged, true);
  10731. option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
  10732. option("showCursorWhenSelecting", false, updateSelection, true);
  10733. option("resetSelectionOnContextMenu", true);
  10734. option("lineWiseCopyCut", true);
  10735. option("readOnly", false, function (cm, val) {
  10736. if (val == "nocursor") {
  10737. onBlur(cm);
  10738. cm.display.input.blur();
  10739. cm.display.disabled = true;
  10740. } else {
  10741. cm.display.disabled = false;
  10742. }
  10743. cm.display.input.readOnlyChanged(val);
  10744. });
  10745. option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
  10746. option("dragDrop", true, dragDropChanged);
  10747. option("allowDropFileTypes", null);
  10748. option("cursorBlinkRate", 530);
  10749. option("cursorScrollMargin", 0);
  10750. option("cursorHeight", 1, updateSelection, true);
  10751. option("singleCursorHeightPerLine", true, updateSelection, true);
  10752. option("workTime", 100);
  10753. option("workDelay", 100);
  10754. option("flattenSpans", true, resetModeState, true);
  10755. option("addModeClass", false, resetModeState, true);
  10756. option("pollInterval", 100);
  10757. option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
  10758. option("historyEventDelay", 1250);
  10759. option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
  10760. option("maxHighlightLength", 10000, resetModeState, true);
  10761. option("moveInputWithCursor", true, function (cm, val) {
  10762. if (!val) { cm.display.input.resetPosition(); }
  10763. });
  10764. option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
  10765. option("autofocus", null);
  10766. option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
  10767. }
  10768. function guttersChanged(cm) {
  10769. updateGutters(cm);
  10770. regChange(cm);
  10771. alignHorizontally(cm);
  10772. }
  10773. function dragDropChanged(cm, value, old) {
  10774. var wasOn = old && old != Init;
  10775. if (!value != !wasOn) {
  10776. var funcs = cm.display.dragFunctions;
  10777. var toggle = value ? on : off;
  10778. toggle(cm.display.scroller, "dragstart", funcs.start);
  10779. toggle(cm.display.scroller, "dragenter", funcs.enter);
  10780. toggle(cm.display.scroller, "dragover", funcs.over);
  10781. toggle(cm.display.scroller, "dragleave", funcs.leave);
  10782. toggle(cm.display.scroller, "drop", funcs.drop);
  10783. }
  10784. }
  10785. function wrappingChanged(cm) {
  10786. if (cm.options.lineWrapping) {
  10787. addClass(cm.display.wrapper, "CodeMirror-wrap");
  10788. cm.display.sizer.style.minWidth = "";
  10789. cm.display.sizerWidth = null;
  10790. } else {
  10791. rmClass(cm.display.wrapper, "CodeMirror-wrap");
  10792. findMaxLine(cm);
  10793. }
  10794. estimateLineHeights(cm);
  10795. regChange(cm);
  10796. clearCaches(cm);
  10797. setTimeout(function () { return updateScrollbars(cm); }, 100);
  10798. }
  10799. // A CodeMirror instance represents an editor. This is the object
  10800. // that user code is usually dealing with.
  10801. function CodeMirror$1(place, options) {
  10802. var this$1 = this;
  10803. if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
  10804. this.options = options = options ? copyObj(options) : {};
  10805. // Determine effective options based on given values and defaults.
  10806. copyObj(defaults, options, false);
  10807. setGuttersForLineNumbers(options);
  10808. var doc = options.value;
  10809. if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
  10810. this.doc = doc;
  10811. var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
  10812. var display = this.display = new Display(place, doc, input);
  10813. display.wrapper.CodeMirror = this;
  10814. updateGutters(this);
  10815. themeChanged(this);
  10816. if (options.lineWrapping)
  10817. { this.display.wrapper.className += " CodeMirror-wrap"; }
  10818. initScrollbars(this);
  10819. this.state = {
  10820. keyMaps: [], // stores maps added by addKeyMap
  10821. overlays: [], // highlighting overlays, as added by addOverlay
  10822. modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
  10823. overwrite: false,
  10824. delayingBlurEvent: false,
  10825. focused: false,
  10826. suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
  10827. pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
  10828. selectingText: false,
  10829. draggingText: false,
  10830. highlight: new Delayed(), // stores highlight worker timeout
  10831. keySeq: null, // Unfinished key sequence
  10832. specialChars: null
  10833. };
  10834. if (options.autofocus && !mobile) { display.input.focus(); }
  10835. // Override magic textarea content restore that IE sometimes does
  10836. // on our hidden textarea on reload
  10837. if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
  10838. registerEventHandlers(this);
  10839. ensureGlobalHandlers();
  10840. startOperation(this);
  10841. this.curOp.forceUpdate = true;
  10842. attachDoc(this, doc);
  10843. if ((options.autofocus && !mobile) || this.hasFocus())
  10844. { setTimeout(bind(onFocus, this), 20); }
  10845. else
  10846. { onBlur(this); }
  10847. for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
  10848. { optionHandlers[opt](this$1, options[opt], Init); } }
  10849. maybeUpdateLineNumberWidth(this);
  10850. if (options.finishInit) { options.finishInit(this); }
  10851. for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
  10852. endOperation(this);
  10853. // Suppress optimizelegibility in Webkit, since it breaks text
  10854. // measuring on line wrapping boundaries.
  10855. if (webkit && options.lineWrapping &&
  10856. getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
  10857. { display.lineDiv.style.textRendering = "auto"; }
  10858. }
  10859. // The default configuration options.
  10860. CodeMirror$1.defaults = defaults;
  10861. // Functions to run when options are changed.
  10862. CodeMirror$1.optionHandlers = optionHandlers;
  10863. // Attach the necessary event handlers when initializing the editor
  10864. function registerEventHandlers(cm) {
  10865. var d = cm.display;
  10866. on(d.scroller, "mousedown", operation(cm, onMouseDown));
  10867. // Older IE's will not fire a second mousedown for a double click
  10868. if (ie && ie_version < 11)
  10869. { on(d.scroller, "dblclick", operation(cm, function (e) {
  10870. if (signalDOMEvent(cm, e)) { return }
  10871. var pos = posFromMouse(cm, e);
  10872. if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
  10873. e_preventDefault(e);
  10874. var word = cm.findWordAt(pos);
  10875. extendSelection(cm.doc, word.anchor, word.head);
  10876. })); }
  10877. else
  10878. { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
  10879. // Some browsers fire contextmenu *after* opening the menu, at
  10880. // which point we can't mess with it anymore. Context menu is
  10881. // handled in onMouseDown for these browsers.
  10882. if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); }
  10883. // Used to suppress mouse event handling when a touch happens
  10884. var touchFinished, prevTouch = {end: 0};
  10885. function finishTouch() {
  10886. if (d.activeTouch) {
  10887. touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
  10888. prevTouch = d.activeTouch;
  10889. prevTouch.end = +new Date;
  10890. }
  10891. }
  10892. function isMouseLikeTouchEvent(e) {
  10893. if (e.touches.length != 1) { return false }
  10894. var touch = e.touches[0];
  10895. return touch.radiusX <= 1 && touch.radiusY <= 1
  10896. }
  10897. function farAway(touch, other) {
  10898. if (other.left == null) { return true }
  10899. var dx = other.left - touch.left, dy = other.top - touch.top;
  10900. return dx * dx + dy * dy > 20 * 20
  10901. }
  10902. on(d.scroller, "touchstart", function (e) {
  10903. if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
  10904. d.input.ensurePolled();
  10905. clearTimeout(touchFinished);
  10906. var now = +new Date;
  10907. d.activeTouch = {start: now, moved: false,
  10908. prev: now - prevTouch.end <= 300 ? prevTouch : null};
  10909. if (e.touches.length == 1) {
  10910. d.activeTouch.left = e.touches[0].pageX;
  10911. d.activeTouch.top = e.touches[0].pageY;
  10912. }
  10913. }
  10914. });
  10915. on(d.scroller, "touchmove", function () {
  10916. if (d.activeTouch) { d.activeTouch.moved = true; }
  10917. });
  10918. on(d.scroller, "touchend", function (e) {
  10919. var touch = d.activeTouch;
  10920. if (touch && !eventInWidget(d, e) && touch.left != null &&
  10921. !touch.moved && new Date - touch.start < 300) {
  10922. var pos = cm.coordsChar(d.activeTouch, "page"), range;
  10923. if (!touch.prev || farAway(touch, touch.prev)) // Single tap
  10924. { range = new Range(pos, pos); }
  10925. else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
  10926. { range = cm.findWordAt(pos); }
  10927. else // Triple tap
  10928. { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
  10929. cm.setSelection(range.anchor, range.head);
  10930. cm.focus();
  10931. e_preventDefault(e);
  10932. }
  10933. finishTouch();
  10934. });
  10935. on(d.scroller, "touchcancel", finishTouch);
  10936. // Sync scrolling between fake scrollbars and real scrollable
  10937. // area, ensure viewport is updated when scrolling.
  10938. on(d.scroller, "scroll", function () {
  10939. if (d.scroller.clientHeight) {
  10940. setScrollTop(cm, d.scroller.scrollTop);
  10941. setScrollLeft(cm, d.scroller.scrollLeft, true);
  10942. signal(cm, "scroll", cm);
  10943. }
  10944. });
  10945. // Listen to wheel events in order to try and update the viewport on time.
  10946. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
  10947. on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
  10948. // Prevent wrapper from ever scrolling
  10949. on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
  10950. d.dragFunctions = {
  10951. enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
  10952. over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
  10953. start: function (e) { return onDragStart(cm, e); },
  10954. drop: operation(cm, onDrop),
  10955. leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
  10956. };
  10957. var inp = d.input.getField();
  10958. on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
  10959. on(inp, "keydown", operation(cm, onKeyDown));
  10960. on(inp, "keypress", operation(cm, onKeyPress));
  10961. on(inp, "focus", function (e) { return onFocus(cm, e); });
  10962. on(inp, "blur", function (e) { return onBlur(cm, e); });
  10963. }
  10964. var initHooks = [];
  10965. CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
  10966. // Indent the given line. The how parameter can be "smart",
  10967. // "add"/null, "subtract", or "prev". When aggressive is false
  10968. // (typically set to true for forced single-line indents), empty
  10969. // lines are not indented, and places where the mode returns Pass
  10970. // are left alone.
  10971. function indentLine(cm, n, how, aggressive) {
  10972. var doc = cm.doc, state;
  10973. if (how == null) { how = "add"; }
  10974. if (how == "smart") {
  10975. // Fall back to "prev" when the mode doesn't have an indentation
  10976. // method.
  10977. if (!doc.mode.indent) { how = "prev"; }
  10978. else { state = getStateBefore(cm, n); }
  10979. }
  10980. var tabSize = cm.options.tabSize;
  10981. var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
  10982. if (line.stateAfter) { line.stateAfter = null; }
  10983. var curSpaceString = line.text.match(/^\s*/)[0], indentation;
  10984. if (!aggressive && !/\S/.test(line.text)) {
  10985. indentation = 0;
  10986. how = "not";
  10987. } else if (how == "smart") {
  10988. indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
  10989. if (indentation == Pass || indentation > 150) {
  10990. if (!aggressive) { return }
  10991. how = "prev";
  10992. }
  10993. }
  10994. if (how == "prev") {
  10995. if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
  10996. else { indentation = 0; }
  10997. } else if (how == "add") {
  10998. indentation = curSpace + cm.options.indentUnit;
  10999. } else if (how == "subtract") {
  11000. indentation = curSpace - cm.options.indentUnit;
  11001. } else if (typeof how == "number") {
  11002. indentation = curSpace + how;
  11003. }
  11004. indentation = Math.max(0, indentation);
  11005. var indentString = "", pos = 0;
  11006. if (cm.options.indentWithTabs)
  11007. { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
  11008. if (pos < indentation) { indentString += spaceStr(indentation - pos); }
  11009. if (indentString != curSpaceString) {
  11010. replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
  11011. line.stateAfter = null;
  11012. return true
  11013. } else {
  11014. // Ensure that, if the cursor was in the whitespace at the start
  11015. // of the line, it is moved to the end of that space.
  11016. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
  11017. var range = doc.sel.ranges[i$1];
  11018. if (range.head.line == n && range.head.ch < curSpaceString.length) {
  11019. var pos$1 = Pos(n, curSpaceString.length);
  11020. replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
  11021. break
  11022. }
  11023. }
  11024. }
  11025. }
  11026. // This will be set to a {lineWise: bool, text: [string]} object, so
  11027. // that, when pasting, we know what kind of selections the copied
  11028. // text was made out of.
  11029. var lastCopied = null;
  11030. function setLastCopied(newLastCopied) {
  11031. lastCopied = newLastCopied;
  11032. }
  11033. function applyTextInput(cm, inserted, deleted, sel, origin) {
  11034. var doc = cm.doc;
  11035. cm.display.shift = false;
  11036. if (!sel) { sel = doc.sel; }
  11037. var paste = cm.state.pasteIncoming || origin == "paste";
  11038. var textLines = splitLinesAuto(inserted), multiPaste = null;
  11039. // When pasing N lines into N selections, insert one line per selection
  11040. if (paste && sel.ranges.length > 1) {
  11041. if (lastCopied && lastCopied.text.join("\n") == inserted) {
  11042. if (sel.ranges.length % lastCopied.text.length == 0) {
  11043. multiPaste = [];
  11044. for (var i = 0; i < lastCopied.text.length; i++)
  11045. { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
  11046. }
  11047. } else if (textLines.length == sel.ranges.length) {
  11048. multiPaste = map(textLines, function (l) { return [l]; });
  11049. }
  11050. }
  11051. var updateInput;
  11052. // Normal behavior is to insert the new text into every selection
  11053. for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
  11054. var range$$1 = sel.ranges[i$1];
  11055. var from = range$$1.from(), to = range$$1.to();
  11056. if (range$$1.empty()) {
  11057. if (deleted && deleted > 0) // Handle deletion
  11058. { from = Pos(from.line, from.ch - deleted); }
  11059. else if (cm.state.overwrite && !paste) // Handle overwrite
  11060. { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
  11061. else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
  11062. { from = to = Pos(from.line, 0); }
  11063. }
  11064. updateInput = cm.curOp.updateInput;
  11065. var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
  11066. origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
  11067. makeChange(cm.doc, changeEvent);
  11068. signalLater(cm, "inputRead", cm, changeEvent);
  11069. }
  11070. if (inserted && !paste)
  11071. { triggerElectric(cm, inserted); }
  11072. ensureCursorVisible(cm);
  11073. cm.curOp.updateInput = updateInput;
  11074. cm.curOp.typing = true;
  11075. cm.state.pasteIncoming = cm.state.cutIncoming = false;
  11076. }
  11077. function handlePaste(e, cm) {
  11078. var pasted = e.clipboardData && e.clipboardData.getData("Text");
  11079. if (pasted) {
  11080. e.preventDefault();
  11081. if (!cm.isReadOnly() && !cm.options.disableInput)
  11082. { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
  11083. return true
  11084. }
  11085. }
  11086. function triggerElectric(cm, inserted) {
  11087. // When an 'electric' character is inserted, immediately trigger a reindent
  11088. if (!cm.options.electricChars || !cm.options.smartIndent) { return }
  11089. var sel = cm.doc.sel;
  11090. for (var i = sel.ranges.length - 1; i >= 0; i--) {
  11091. var range$$1 = sel.ranges[i];
  11092. if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
  11093. var mode = cm.getModeAt(range$$1.head);
  11094. var indented = false;
  11095. if (mode.electricChars) {
  11096. for (var j = 0; j < mode.electricChars.length; j++)
  11097. { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
  11098. indented = indentLine(cm, range$$1.head.line, "smart");
  11099. break
  11100. } }
  11101. } else if (mode.electricInput) {
  11102. if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
  11103. { indented = indentLine(cm, range$$1.head.line, "smart"); }
  11104. }
  11105. if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
  11106. }
  11107. }
  11108. function copyableRanges(cm) {
  11109. var text = [], ranges = [];
  11110. for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
  11111. var line = cm.doc.sel.ranges[i].head.line;
  11112. var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
  11113. ranges.push(lineRange);
  11114. text.push(cm.getRange(lineRange.anchor, lineRange.head));
  11115. }
  11116. return {text: text, ranges: ranges}
  11117. }
  11118. function disableBrowserMagic(field, spellcheck) {
  11119. field.setAttribute("autocorrect", "off");
  11120. field.setAttribute("autocapitalize", "off");
  11121. field.setAttribute("spellcheck", !!spellcheck);
  11122. }
  11123. function hiddenTextarea() {
  11124. var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
  11125. var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
  11126. // The textarea is kept positioned near the cursor to prevent the
  11127. // fact that it'll be scrolled into view on input from scrolling
  11128. // our fake cursor out of view. On webkit, when wrap=off, paste is
  11129. // very slow. So make the area wide instead.
  11130. if (webkit) { te.style.width = "1000px"; }
  11131. else { te.setAttribute("wrap", "off"); }
  11132. // If border: 0; -- iOS fails to open keyboard (issue #1287)
  11133. if (ios) { te.style.border = "1px solid black"; }
  11134. disableBrowserMagic(te);
  11135. return div
  11136. }
  11137. // The publicly visible API. Note that methodOp(f) means
  11138. // 'wrap f in an operation, performed on its `this` parameter'.
  11139. // This is not the complete set of editor methods. Most of the
  11140. // methods defined on the Doc type are also injected into
  11141. // CodeMirror.prototype, for backwards compatibility and
  11142. // convenience.
  11143. var addEditorMethods = function(CodeMirror) {
  11144. var optionHandlers = CodeMirror.optionHandlers;
  11145. var helpers = CodeMirror.helpers = {};
  11146. CodeMirror.prototype = {
  11147. constructor: CodeMirror,
  11148. focus: function(){window.focus(); this.display.input.focus();},
  11149. setOption: function(option, value) {
  11150. var options = this.options, old = options[option];
  11151. if (options[option] == value && option != "mode") { return }
  11152. options[option] = value;
  11153. if (optionHandlers.hasOwnProperty(option))
  11154. { operation(this, optionHandlers[option])(this, value, old); }
  11155. signal(this, "optionChange", this, option);
  11156. },
  11157. getOption: function(option) {return this.options[option]},
  11158. getDoc: function() {return this.doc},
  11159. addKeyMap: function(map$$1, bottom) {
  11160. this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
  11161. },
  11162. removeKeyMap: function(map$$1) {
  11163. var maps = this.state.keyMaps;
  11164. for (var i = 0; i < maps.length; ++i)
  11165. { if (maps[i] == map$$1 || maps[i].name == map$$1) {
  11166. maps.splice(i, 1);
  11167. return true
  11168. } }
  11169. },
  11170. addOverlay: methodOp(function(spec, options) {
  11171. var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
  11172. if (mode.startState) { throw new Error("Overlays may not be stateful.") }
  11173. insertSorted(this.state.overlays,
  11174. {mode: mode, modeSpec: spec, opaque: options && options.opaque,
  11175. priority: (options && options.priority) || 0},
  11176. function (overlay) { return overlay.priority; });
  11177. this.state.modeGen++;
  11178. regChange(this);
  11179. }),
  11180. removeOverlay: methodOp(function(spec) {
  11181. var this$1 = this;
  11182. var overlays = this.state.overlays;
  11183. for (var i = 0; i < overlays.length; ++i) {
  11184. var cur = overlays[i].modeSpec;
  11185. if (cur == spec || typeof spec == "string" && cur.name == spec) {
  11186. overlays.splice(i, 1);
  11187. this$1.state.modeGen++;
  11188. regChange(this$1);
  11189. return
  11190. }
  11191. }
  11192. }),
  11193. indentLine: methodOp(function(n, dir, aggressive) {
  11194. if (typeof dir != "string" && typeof dir != "number") {
  11195. if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
  11196. else { dir = dir ? "add" : "subtract"; }
  11197. }
  11198. if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
  11199. }),
  11200. indentSelection: methodOp(function(how) {
  11201. var this$1 = this;
  11202. var ranges = this.doc.sel.ranges, end = -1;
  11203. for (var i = 0; i < ranges.length; i++) {
  11204. var range$$1 = ranges[i];
  11205. if (!range$$1.empty()) {
  11206. var from = range$$1.from(), to = range$$1.to();
  11207. var start = Math.max(end, from.line);
  11208. end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
  11209. for (var j = start; j < end; ++j)
  11210. { indentLine(this$1, j, how); }
  11211. var newRanges = this$1.doc.sel.ranges;
  11212. if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
  11213. { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
  11214. } else if (range$$1.head.line > end) {
  11215. indentLine(this$1, range$$1.head.line, how, true);
  11216. end = range$$1.head.line;
  11217. if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
  11218. }
  11219. }
  11220. }),
  11221. // Fetch the parser token for a given character. Useful for hacks
  11222. // that want to inspect the mode state (say, for completion).
  11223. getTokenAt: function(pos, precise) {
  11224. return takeToken(this, pos, precise)
  11225. },
  11226. getLineTokens: function(line, precise) {
  11227. return takeToken(this, Pos(line), precise, true)
  11228. },
  11229. getTokenTypeAt: function(pos) {
  11230. pos = clipPos(this.doc, pos);
  11231. var styles = getLineStyles(this, getLine(this.doc, pos.line));
  11232. var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
  11233. var type;
  11234. if (ch == 0) { type = styles[2]; }
  11235. else { for (;;) {
  11236. var mid = (before + after) >> 1;
  11237. if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
  11238. else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
  11239. else { type = styles[mid * 2 + 2]; break }
  11240. } }
  11241. var cut = type ? type.indexOf("overlay ") : -1;
  11242. return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
  11243. },
  11244. getModeAt: function(pos) {
  11245. var mode = this.doc.mode;
  11246. if (!mode.innerMode) { return mode }
  11247. return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
  11248. },
  11249. getHelper: function(pos, type) {
  11250. return this.getHelpers(pos, type)[0]
  11251. },
  11252. getHelpers: function(pos, type) {
  11253. var this$1 = this;
  11254. var found = [];
  11255. if (!helpers.hasOwnProperty(type)) { return found }
  11256. var help = helpers[type], mode = this.getModeAt(pos);
  11257. if (typeof mode[type] == "string") {
  11258. if (help[mode[type]]) { found.push(help[mode[type]]); }
  11259. } else if (mode[type]) {
  11260. for (var i = 0; i < mode[type].length; i++) {
  11261. var val = help[mode[type][i]];
  11262. if (val) { found.push(val); }
  11263. }
  11264. } else if (mode.helperType && help[mode.helperType]) {
  11265. found.push(help[mode.helperType]);
  11266. } else if (help[mode.name]) {
  11267. found.push(help[mode.name]);
  11268. }
  11269. for (var i$1 = 0; i$1 < help._global.length; i$1++) {
  11270. var cur = help._global[i$1];
  11271. if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
  11272. { found.push(cur.val); }
  11273. }
  11274. return found
  11275. },
  11276. getStateAfter: function(line, precise) {
  11277. var doc = this.doc;
  11278. line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
  11279. return getStateBefore(this, line + 1, precise)
  11280. },
  11281. cursorCoords: function(start, mode) {
  11282. var pos, range$$1 = this.doc.sel.primary();
  11283. if (start == null) { pos = range$$1.head; }
  11284. else if (typeof start == "object") { pos = clipPos(this.doc, start); }
  11285. else { pos = start ? range$$1.from() : range$$1.to(); }
  11286. return cursorCoords(this, pos, mode || "page")
  11287. },
  11288. charCoords: function(pos, mode) {
  11289. return charCoords(this, clipPos(this.doc, pos), mode || "page")
  11290. },
  11291. coordsChar: function(coords, mode) {
  11292. coords = fromCoordSystem(this, coords, mode || "page");
  11293. return coordsChar(this, coords.left, coords.top)
  11294. },
  11295. lineAtHeight: function(height, mode) {
  11296. height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
  11297. return lineAtHeight(this.doc, height + this.display.viewOffset)
  11298. },
  11299. heightAtLine: function(line, mode, includeWidgets) {
  11300. var end = false, lineObj;
  11301. if (typeof line == "number") {
  11302. var last = this.doc.first + this.doc.size - 1;
  11303. if (line < this.doc.first) { line = this.doc.first; }
  11304. else if (line > last) { line = last; end = true; }
  11305. lineObj = getLine(this.doc, line);
  11306. } else {
  11307. lineObj = line;
  11308. }
  11309. return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
  11310. (end ? this.doc.height - heightAtLine(lineObj) : 0)
  11311. },
  11312. defaultTextHeight: function() { return textHeight(this.display) },
  11313. defaultCharWidth: function() { return charWidth(this.display) },
  11314. getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
  11315. addWidget: function(pos, node, scroll, vert, horiz) {
  11316. var display = this.display;
  11317. pos = cursorCoords(this, clipPos(this.doc, pos));
  11318. var top = pos.bottom, left = pos.left;
  11319. node.style.position = "absolute";
  11320. node.setAttribute("cm-ignore-events", "true");
  11321. this.display.input.setUneditable(node);
  11322. display.sizer.appendChild(node);
  11323. if (vert == "over") {
  11324. top = pos.top;
  11325. } else if (vert == "above" || vert == "near") {
  11326. var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
  11327. hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
  11328. // Default to positioning above (if specified and possible); otherwise default to positioning below
  11329. if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
  11330. { top = pos.top - node.offsetHeight; }
  11331. else if (pos.bottom + node.offsetHeight <= vspace)
  11332. { top = pos.bottom; }
  11333. if (left + node.offsetWidth > hspace)
  11334. { left = hspace - node.offsetWidth; }
  11335. }
  11336. node.style.top = top + "px";
  11337. node.style.left = node.style.right = "";
  11338. if (horiz == "right") {
  11339. left = display.sizer.clientWidth - node.offsetWidth;
  11340. node.style.right = "0px";
  11341. } else {
  11342. if (horiz == "left") { left = 0; }
  11343. else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
  11344. node.style.left = left + "px";
  11345. }
  11346. if (scroll)
  11347. { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
  11348. },
  11349. triggerOnKeyDown: methodOp(onKeyDown),
  11350. triggerOnKeyPress: methodOp(onKeyPress),
  11351. triggerOnKeyUp: onKeyUp,
  11352. execCommand: function(cmd) {
  11353. if (commands.hasOwnProperty(cmd))
  11354. { return commands[cmd].call(null, this) }
  11355. },
  11356. triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
  11357. findPosH: function(from, amount, unit, visually) {
  11358. var this$1 = this;
  11359. var dir = 1;
  11360. if (amount < 0) { dir = -1; amount = -amount; }
  11361. var cur = clipPos(this.doc, from);
  11362. for (var i = 0; i < amount; ++i) {
  11363. cur = findPosH(this$1.doc, cur, dir, unit, visually);
  11364. if (cur.hitSide) { break }
  11365. }
  11366. return cur
  11367. },
  11368. moveH: methodOp(function(dir, unit) {
  11369. var this$1 = this;
  11370. this.extendSelectionsBy(function (range$$1) {
  11371. if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
  11372. { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
  11373. else
  11374. { return dir < 0 ? range$$1.from() : range$$1.to() }
  11375. }, sel_move);
  11376. }),
  11377. deleteH: methodOp(function(dir, unit) {
  11378. var sel = this.doc.sel, doc = this.doc;
  11379. if (sel.somethingSelected())
  11380. { doc.replaceSelection("", null, "+delete"); }
  11381. else
  11382. { deleteNearSelection(this, function (range$$1) {
  11383. var other = findPosH(doc, range$$1.head, dir, unit, false);
  11384. return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
  11385. }); }
  11386. }),
  11387. findPosV: function(from, amount, unit, goalColumn) {
  11388. var this$1 = this;
  11389. var dir = 1, x = goalColumn;
  11390. if (amount < 0) { dir = -1; amount = -amount; }
  11391. var cur = clipPos(this.doc, from);
  11392. for (var i = 0; i < amount; ++i) {
  11393. var coords = cursorCoords(this$1, cur, "div");
  11394. if (x == null) { x = coords.left; }
  11395. else { coords.left = x; }
  11396. cur = findPosV(this$1, coords, dir, unit);
  11397. if (cur.hitSide) { break }
  11398. }
  11399. return cur
  11400. },
  11401. moveV: methodOp(function(dir, unit) {
  11402. var this$1 = this;
  11403. var doc = this.doc, goals = [];
  11404. var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
  11405. doc.extendSelectionsBy(function (range$$1) {
  11406. if (collapse)
  11407. { return dir < 0 ? range$$1.from() : range$$1.to() }
  11408. var headPos = cursorCoords(this$1, range$$1.head, "div");
  11409. if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
  11410. goals.push(headPos.left);
  11411. var pos = findPosV(this$1, headPos, dir, unit);
  11412. if (unit == "page" && range$$1 == doc.sel.primary())
  11413. { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); }
  11414. return pos
  11415. }, sel_move);
  11416. if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
  11417. { doc.sel.ranges[i].goalColumn = goals[i]; } }
  11418. }),
  11419. // Find the word at the given position (as returned by coordsChar).
  11420. findWordAt: function(pos) {
  11421. var doc = this.doc, line = getLine(doc, pos.line).text;
  11422. var start = pos.ch, end = pos.ch;
  11423. if (line) {
  11424. var helper = this.getHelper(pos, "wordChars");
  11425. if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
  11426. var startChar = line.charAt(start);
  11427. var check = isWordChar(startChar, helper)
  11428. ? function (ch) { return isWordChar(ch, helper); }
  11429. : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
  11430. : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
  11431. while (start > 0 && check(line.charAt(start - 1))) { --start; }
  11432. while (end < line.length && check(line.charAt(end))) { ++end; }
  11433. }
  11434. return new Range(Pos(pos.line, start), Pos(pos.line, end))
  11435. },
  11436. toggleOverwrite: function(value) {
  11437. if (value != null && value == this.state.overwrite) { return }
  11438. if (this.state.overwrite = !this.state.overwrite)
  11439. { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  11440. else
  11441. { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  11442. signal(this, "overwriteToggle", this, this.state.overwrite);
  11443. },
  11444. hasFocus: function() { return this.display.input.getField() == activeElt() },
  11445. isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
  11446. scrollTo: methodOp(function(x, y) {
  11447. if (x != null || y != null) { resolveScrollToPos(this); }
  11448. if (x != null) { this.curOp.scrollLeft = x; }
  11449. if (y != null) { this.curOp.scrollTop = y; }
  11450. }),
  11451. getScrollInfo: function() {
  11452. var scroller = this.display.scroller;
  11453. return {left: scroller.scrollLeft, top: scroller.scrollTop,
  11454. height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
  11455. width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
  11456. clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
  11457. },
  11458. scrollIntoView: methodOp(function(range$$1, margin) {
  11459. if (range$$1 == null) {
  11460. range$$1 = {from: this.doc.sel.primary().head, to: null};
  11461. if (margin == null) { margin = this.options.cursorScrollMargin; }
  11462. } else if (typeof range$$1 == "number") {
  11463. range$$1 = {from: Pos(range$$1, 0), to: null};
  11464. } else if (range$$1.from == null) {
  11465. range$$1 = {from: range$$1, to: null};
  11466. }
  11467. if (!range$$1.to) { range$$1.to = range$$1.from; }
  11468. range$$1.margin = margin || 0;
  11469. if (range$$1.from.line != null) {
  11470. resolveScrollToPos(this);
  11471. this.curOp.scrollToPos = range$$1;
  11472. } else {
  11473. var sPos = calculateScrollPos(this, {
  11474. left: Math.min(range$$1.from.left, range$$1.to.left),
  11475. top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin,
  11476. right: Math.max(range$$1.from.right, range$$1.to.right),
  11477. bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin
  11478. });
  11479. this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  11480. }
  11481. }),
  11482. setSize: methodOp(function(width, height) {
  11483. var this$1 = this;
  11484. var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
  11485. if (width != null) { this.display.wrapper.style.width = interpret(width); }
  11486. if (height != null) { this.display.wrapper.style.height = interpret(height); }
  11487. if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
  11488. var lineNo$$1 = this.display.viewFrom;
  11489. this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
  11490. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
  11491. { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
  11492. ++lineNo$$1;
  11493. });
  11494. this.curOp.forceUpdate = true;
  11495. signal(this, "refresh", this);
  11496. }),
  11497. operation: function(f){return runInOp(this, f)},
  11498. refresh: methodOp(function() {
  11499. var oldHeight = this.display.cachedTextHeight;
  11500. regChange(this);
  11501. this.curOp.forceUpdate = true;
  11502. clearCaches(this);
  11503. this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
  11504. updateGutterSpace(this);
  11505. if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
  11506. { estimateLineHeights(this); }
  11507. signal(this, "refresh", this);
  11508. }),
  11509. swapDoc: methodOp(function(doc) {
  11510. var old = this.doc;
  11511. old.cm = null;
  11512. attachDoc(this, doc);
  11513. clearCaches(this);
  11514. this.display.input.reset();
  11515. this.scrollTo(doc.scrollLeft, doc.scrollTop);
  11516. this.curOp.forceScroll = true;
  11517. signalLater(this, "swapDoc", this, old);
  11518. return old
  11519. }),
  11520. getInputField: function(){return this.display.input.getField()},
  11521. getWrapperElement: function(){return this.display.wrapper},
  11522. getScrollerElement: function(){return this.display.scroller},
  11523. getGutterElement: function(){return this.display.gutters}
  11524. };
  11525. eventMixin(CodeMirror);
  11526. CodeMirror.registerHelper = function(type, name, value) {
  11527. if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
  11528. helpers[type][name] = value;
  11529. };
  11530. CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
  11531. CodeMirror.registerHelper(type, name, value);
  11532. helpers[type]._global.push({pred: predicate, val: value});
  11533. };
  11534. };
  11535. // Used for horizontal relative motion. Dir is -1 or 1 (left or
  11536. // right), unit can be "char", "column" (like char, but doesn't
  11537. // cross line boundaries), "word" (across next word), or "group" (to
  11538. // the start of next group of word or non-word-non-whitespace
  11539. // chars). The visually param controls whether, in right-to-left
  11540. // text, direction 1 means to move towards the next index in the
  11541. // string, or towards the character to the right of the current
  11542. // position. The resulting position will have a hitSide=true
  11543. // property if it reached the end of the document.
  11544. function findPosH(doc, pos, dir, unit, visually) {
  11545. var oldPos = pos;
  11546. var origDir = dir;
  11547. var lineObj = getLine(doc, pos.line);
  11548. function findNextLine() {
  11549. var l = pos.line + dir;
  11550. if (l < doc.first || l >= doc.first + doc.size) { return false }
  11551. pos = new Pos(l, pos.ch, pos.sticky);
  11552. return lineObj = getLine(doc, l)
  11553. }
  11554. function moveOnce(boundToLine) {
  11555. var next;
  11556. if (visually) {
  11557. next = moveVisually(doc.cm, lineObj, pos, dir);
  11558. } else {
  11559. next = moveLogically(lineObj, pos, dir);
  11560. }
  11561. if (next == null) {
  11562. if (!boundToLine && findNextLine())
  11563. { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
  11564. else
  11565. { return false }
  11566. } else {
  11567. pos = next;
  11568. }
  11569. return true
  11570. }
  11571. if (unit == "char") {
  11572. moveOnce();
  11573. } else if (unit == "column") {
  11574. moveOnce(true);
  11575. } else if (unit == "word" || unit == "group") {
  11576. var sawType = null, group = unit == "group";
  11577. var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
  11578. for (var first = true;; first = false) {
  11579. if (dir < 0 && !moveOnce(!first)) { break }
  11580. var cur = lineObj.text.charAt(pos.ch) || "\n";
  11581. var type = isWordChar(cur, helper) ? "w"
  11582. : group && cur == "\n" ? "n"
  11583. : !group || /\s/.test(cur) ? null
  11584. : "p";
  11585. if (group && !first && !type) { type = "s"; }
  11586. if (sawType && sawType != type) {
  11587. if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
  11588. break
  11589. }
  11590. if (type) { sawType = type; }
  11591. if (dir > 0 && !moveOnce(!first)) { break }
  11592. }
  11593. }
  11594. var result = skipAtomic(doc, pos, oldPos, origDir, true);
  11595. if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
  11596. return result
  11597. }
  11598. // For relative vertical movement. Dir may be -1 or 1. Unit can be
  11599. // "page" or "line". The resulting position will have a hitSide=true
  11600. // property if it reached the end of the document.
  11601. function findPosV(cm, pos, dir, unit) {
  11602. var doc = cm.doc, x = pos.left, y;
  11603. if (unit == "page") {
  11604. var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
  11605. var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
  11606. y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
  11607. } else if (unit == "line") {
  11608. y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
  11609. }
  11610. var target;
  11611. for (;;) {
  11612. target = coordsChar(cm, x, y);
  11613. if (!target.outside) { break }
  11614. if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
  11615. y += dir * 5;
  11616. }
  11617. return target
  11618. }
  11619. // CONTENTEDITABLE INPUT STYLE
  11620. var ContentEditableInput = function(cm) {
  11621. this.cm = cm;
  11622. this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
  11623. this.polling = new Delayed();
  11624. this.composing = null;
  11625. this.gracePeriod = false;
  11626. this.readDOMTimeout = null;
  11627. };
  11628. ContentEditableInput.prototype.init = function (display) {
  11629. var this$1 = this;
  11630. var input = this, cm = input.cm;
  11631. var div = input.div = display.lineDiv;
  11632. disableBrowserMagic(div, cm.options.spellcheck);
  11633. on(div, "paste", function (e) {
  11634. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  11635. // IE doesn't fire input events, so we schedule a read for the pasted content in this way
  11636. if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
  11637. });
  11638. on(div, "compositionstart", function (e) {
  11639. this$1.composing = {data: e.data, done: false};
  11640. });
  11641. on(div, "compositionupdate", function (e) {
  11642. if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
  11643. });
  11644. on(div, "compositionend", function (e) {
  11645. if (this$1.composing) {
  11646. if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
  11647. this$1.composing.done = true;
  11648. }
  11649. });
  11650. on(div, "touchstart", function () { return input.forceCompositionEnd(); });
  11651. on(div, "input", function () {
  11652. if (!this$1.composing) { this$1.readFromDOMSoon(); }
  11653. });
  11654. function onCopyCut(e) {
  11655. if (signalDOMEvent(cm, e)) { return }
  11656. if (cm.somethingSelected()) {
  11657. setLastCopied({lineWise: false, text: cm.getSelections()});
  11658. if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
  11659. } else if (!cm.options.lineWiseCopyCut) {
  11660. return
  11661. } else {
  11662. var ranges = copyableRanges(cm);
  11663. setLastCopied({lineWise: true, text: ranges.text});
  11664. if (e.type == "cut") {
  11665. cm.operation(function () {
  11666. cm.setSelections(ranges.ranges, 0, sel_dontScroll);
  11667. cm.replaceSelection("", null, "cut");
  11668. });
  11669. }
  11670. }
  11671. if (e.clipboardData) {
  11672. e.clipboardData.clearData();
  11673. var content = lastCopied.text.join("\n");
  11674. // iOS exposes the clipboard API, but seems to discard content inserted into it
  11675. e.clipboardData.setData("Text", content);
  11676. if (e.clipboardData.getData("Text") == content) {
  11677. e.preventDefault();
  11678. return
  11679. }
  11680. }
  11681. // Old-fashioned briefly-focus-a-textarea hack
  11682. var kludge = hiddenTextarea(), te = kludge.firstChild;
  11683. cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
  11684. te.value = lastCopied.text.join("\n");
  11685. var hadFocus = document.activeElement;
  11686. selectInput(te);
  11687. setTimeout(function () {
  11688. cm.display.lineSpace.removeChild(kludge);
  11689. hadFocus.focus();
  11690. if (hadFocus == div) { input.showPrimarySelection(); }
  11691. }, 50);
  11692. }
  11693. on(div, "copy", onCopyCut);
  11694. on(div, "cut", onCopyCut);
  11695. };
  11696. ContentEditableInput.prototype.prepareSelection = function () {
  11697. var result = prepareSelection(this.cm, false);
  11698. result.focus = this.cm.state.focused;
  11699. return result
  11700. };
  11701. ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
  11702. if (!info || !this.cm.display.view.length) { return }
  11703. if (info.focus || takeFocus) { this.showPrimarySelection(); }
  11704. this.showMultipleSelections(info);
  11705. };
  11706. ContentEditableInput.prototype.showPrimarySelection = function () {
  11707. var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
  11708. var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
  11709. var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
  11710. if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
  11711. cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
  11712. cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
  11713. { return }
  11714. var start = posToDOM(this.cm, prim.from());
  11715. var end = posToDOM(this.cm, prim.to());
  11716. if (!start && !end) {
  11717. sel.removeAllRanges();
  11718. return
  11719. }
  11720. var view = this.cm.display.view;
  11721. var old = sel.rangeCount && sel.getRangeAt(0);
  11722. if (!start) {
  11723. start = {node: view[0].measure.map[2], offset: 0};
  11724. } else if (!end) { // FIXME dangerously hacky
  11725. var measure = view[view.length - 1].measure;
  11726. var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
  11727. end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
  11728. }
  11729. var rng;
  11730. try { rng = range(start.node, start.offset, end.offset, end.node); }
  11731. catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
  11732. if (rng) {
  11733. if (!gecko && this.cm.state.focused) {
  11734. sel.collapse(start.node, start.offset);
  11735. if (!rng.collapsed) {
  11736. sel.removeAllRanges();
  11737. sel.addRange(rng);
  11738. }
  11739. } else {
  11740. sel.removeAllRanges();
  11741. sel.addRange(rng);
  11742. }
  11743. if (old && sel.anchorNode == null) { sel.addRange(old); }
  11744. else if (gecko) { this.startGracePeriod(); }
  11745. }
  11746. this.rememberSelection();
  11747. };
  11748. ContentEditableInput.prototype.startGracePeriod = function () {
  11749. var this$1 = this;
  11750. clearTimeout(this.gracePeriod);
  11751. this.gracePeriod = setTimeout(function () {
  11752. this$1.gracePeriod = false;
  11753. if (this$1.selectionChanged())
  11754. { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
  11755. }, 20);
  11756. };
  11757. ContentEditableInput.prototype.showMultipleSelections = function (info) {
  11758. removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
  11759. removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  11760. };
  11761. ContentEditableInput.prototype.rememberSelection = function () {
  11762. var sel = window.getSelection();
  11763. this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
  11764. this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  11765. };
  11766. ContentEditableInput.prototype.selectionInEditor = function () {
  11767. var sel = window.getSelection();
  11768. if (!sel.rangeCount) { return false }
  11769. var node = sel.getRangeAt(0).commonAncestorContainer;
  11770. return contains(this.div, node)
  11771. };
  11772. ContentEditableInput.prototype.focus = function () {
  11773. if (this.cm.options.readOnly != "nocursor") {
  11774. if (!this.selectionInEditor())
  11775. { this.showSelection(this.prepareSelection(), true); }
  11776. this.div.focus();
  11777. }
  11778. };
  11779. ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  11780. ContentEditableInput.prototype.getField = function () { return this.div };
  11781. ContentEditableInput.prototype.supportsTouch = function () { return true };
  11782. ContentEditableInput.prototype.receivedFocus = function () {
  11783. var input = this;
  11784. if (this.selectionInEditor())
  11785. { this.pollSelection(); }
  11786. else
  11787. { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
  11788. function poll() {
  11789. if (input.cm.state.focused) {
  11790. input.pollSelection();
  11791. input.polling.set(input.cm.options.pollInterval, poll);
  11792. }
  11793. }
  11794. this.polling.set(this.cm.options.pollInterval, poll);
  11795. };
  11796. ContentEditableInput.prototype.selectionChanged = function () {
  11797. var sel = window.getSelection();
  11798. return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
  11799. sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  11800. };
  11801. ContentEditableInput.prototype.pollSelection = function () {
  11802. if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
  11803. var sel = window.getSelection(), cm = this.cm;
  11804. // On Android Chrome (version 56, at least), backspacing into an
  11805. // uneditable block element will put the cursor in that element,
  11806. // and then, because it's not editable, hide the virtual keyboard.
  11807. // Because Android doesn't allow us to actually detect backspace
  11808. // presses in a sane way, this code checks for when that happens
  11809. // and simulates a backspace press in this case.
  11810. if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
  11811. this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
  11812. this.blur();
  11813. this.focus();
  11814. return
  11815. }
  11816. if (this.composing) { return }
  11817. this.rememberSelection();
  11818. var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  11819. var head = domToPos(cm, sel.focusNode, sel.focusOffset);
  11820. if (anchor && head) { runInOp(cm, function () {
  11821. setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
  11822. if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
  11823. }); }
  11824. };
  11825. ContentEditableInput.prototype.pollContent = function () {
  11826. if (this.readDOMTimeout != null) {
  11827. clearTimeout(this.readDOMTimeout);
  11828. this.readDOMTimeout = null;
  11829. }
  11830. var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
  11831. var from = sel.from(), to = sel.to();
  11832. if (from.ch == 0 && from.line > cm.firstLine())
  11833. { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
  11834. if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
  11835. { to = Pos(to.line + 1, 0); }
  11836. if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
  11837. var fromIndex, fromLine, fromNode;
  11838. if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
  11839. fromLine = lineNo(display.view[0].line);
  11840. fromNode = display.view[0].node;
  11841. } else {
  11842. fromLine = lineNo(display.view[fromIndex].line);
  11843. fromNode = display.view[fromIndex - 1].node.nextSibling;
  11844. }
  11845. var toIndex = findViewIndex(cm, to.line);
  11846. var toLine, toNode;
  11847. if (toIndex == display.view.length - 1) {
  11848. toLine = display.viewTo - 1;
  11849. toNode = display.lineDiv.lastChild;
  11850. } else {
  11851. toLine = lineNo(display.view[toIndex + 1].line) - 1;
  11852. toNode = display.view[toIndex + 1].node.previousSibling;
  11853. }
  11854. if (!fromNode) { return false }
  11855. var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
  11856. var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
  11857. while (newText.length > 1 && oldText.length > 1) {
  11858. if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
  11859. else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
  11860. else { break }
  11861. }
  11862. var cutFront = 0, cutEnd = 0;
  11863. var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
  11864. while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
  11865. { ++cutFront; }
  11866. var newBot = lst(newText), oldBot = lst(oldText);
  11867. var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
  11868. oldBot.length - (oldText.length == 1 ? cutFront : 0));
  11869. while (cutEnd < maxCutEnd &&
  11870. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
  11871. { ++cutEnd; }
  11872. // Try to move start of change to start of selection if ambiguous
  11873. if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
  11874. while (cutFront && cutFront > from.ch &&
  11875. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
  11876. cutFront--;
  11877. cutEnd++;
  11878. }
  11879. }
  11880. newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
  11881. newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
  11882. var chFrom = Pos(fromLine, cutFront);
  11883. var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
  11884. if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
  11885. replaceRange(cm.doc, newText, chFrom, chTo, "+input");
  11886. return true
  11887. }
  11888. };
  11889. ContentEditableInput.prototype.ensurePolled = function () {
  11890. this.forceCompositionEnd();
  11891. };
  11892. ContentEditableInput.prototype.reset = function () {
  11893. this.forceCompositionEnd();
  11894. };
  11895. ContentEditableInput.prototype.forceCompositionEnd = function () {
  11896. if (!this.composing) { return }
  11897. clearTimeout(this.readDOMTimeout);
  11898. this.composing = null;
  11899. this.updateFromDOM();
  11900. this.div.blur();
  11901. this.div.focus();
  11902. };
  11903. ContentEditableInput.prototype.readFromDOMSoon = function () {
  11904. var this$1 = this;
  11905. if (this.readDOMTimeout != null) { return }
  11906. this.readDOMTimeout = setTimeout(function () {
  11907. this$1.readDOMTimeout = null;
  11908. if (this$1.composing) {
  11909. if (this$1.composing.done) { this$1.composing = null; }
  11910. else { return }
  11911. }
  11912. this$1.updateFromDOM();
  11913. }, 80);
  11914. };
  11915. ContentEditableInput.prototype.updateFromDOM = function () {
  11916. var this$1 = this;
  11917. if (this.cm.isReadOnly() || !this.pollContent())
  11918. { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  11919. };
  11920. ContentEditableInput.prototype.setUneditable = function (node) {
  11921. node.contentEditable = "false";
  11922. };
  11923. ContentEditableInput.prototype.onKeyPress = function (e) {
  11924. if (e.charCode == 0) { return }
  11925. e.preventDefault();
  11926. if (!this.cm.isReadOnly())
  11927. { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  11928. };
  11929. ContentEditableInput.prototype.readOnlyChanged = function (val) {
  11930. this.div.contentEditable = String(val != "nocursor");
  11931. };
  11932. ContentEditableInput.prototype.onContextMenu = function () {};
  11933. ContentEditableInput.prototype.resetPosition = function () {};
  11934. ContentEditableInput.prototype.needsContentAttribute = true;
  11935. function posToDOM(cm, pos) {
  11936. var view = findViewForLine(cm, pos.line);
  11937. if (!view || view.hidden) { return null }
  11938. var line = getLine(cm.doc, pos.line);
  11939. var info = mapFromLineView(view, line, pos.line);
  11940. var order = getOrder(line, cm.doc.direction), side = "left";
  11941. if (order) {
  11942. var partPos = getBidiPartAt(order, pos.ch);
  11943. side = partPos % 2 ? "right" : "left";
  11944. }
  11945. var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
  11946. result.offset = result.collapse == "right" ? result.end : result.start;
  11947. return result
  11948. }
  11949. function isInGutter(node) {
  11950. for (var scan = node; scan; scan = scan.parentNode)
  11951. { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
  11952. return false
  11953. }
  11954. function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
  11955. function domTextBetween(cm, from, to, fromLine, toLine) {
  11956. var text = "", closing = false, lineSep = cm.doc.lineSeparator();
  11957. function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  11958. function close() {
  11959. if (closing) {
  11960. text += lineSep;
  11961. closing = false;
  11962. }
  11963. }
  11964. function addText(str) {
  11965. if (str) {
  11966. close();
  11967. text += str;
  11968. }
  11969. }
  11970. function walk(node) {
  11971. if (node.nodeType == 1) {
  11972. var cmText = node.getAttribute("cm-text");
  11973. if (cmText != null) {
  11974. addText(cmText || node.textContent.replace(/\u200b/g, ""));
  11975. return
  11976. }
  11977. var markerID = node.getAttribute("cm-marker"), range$$1;
  11978. if (markerID) {
  11979. var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
  11980. if (found.length && (range$$1 = found[0].find()))
  11981. { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
  11982. return
  11983. }
  11984. if (node.getAttribute("contenteditable") == "false") { return }
  11985. var isBlock = /^(pre|div|p)$/i.test(node.nodeName);
  11986. if (isBlock) { close(); }
  11987. for (var i = 0; i < node.childNodes.length; i++)
  11988. { walk(node.childNodes[i]); }
  11989. if (isBlock) { closing = true; }
  11990. } else if (node.nodeType == 3) {
  11991. addText(node.nodeValue);
  11992. }
  11993. }
  11994. for (;;) {
  11995. walk(from);
  11996. if (from == to) { break }
  11997. from = from.nextSibling;
  11998. }
  11999. return text
  12000. }
  12001. function domToPos(cm, node, offset) {
  12002. var lineNode;
  12003. if (node == cm.display.lineDiv) {
  12004. lineNode = cm.display.lineDiv.childNodes[offset];
  12005. if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
  12006. node = null; offset = 0;
  12007. } else {
  12008. for (lineNode = node;; lineNode = lineNode.parentNode) {
  12009. if (!lineNode || lineNode == cm.display.lineDiv) { return null }
  12010. if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
  12011. }
  12012. }
  12013. for (var i = 0; i < cm.display.view.length; i++) {
  12014. var lineView = cm.display.view[i];
  12015. if (lineView.node == lineNode)
  12016. { return locateNodeInLineView(lineView, node, offset) }
  12017. }
  12018. }
  12019. function locateNodeInLineView(lineView, node, offset) {
  12020. var wrapper = lineView.text.firstChild, bad = false;
  12021. if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  12022. if (node == wrapper) {
  12023. bad = true;
  12024. node = wrapper.childNodes[offset];
  12025. offset = 0;
  12026. if (!node) {
  12027. var line = lineView.rest ? lst(lineView.rest) : lineView.line;
  12028. return badPos(Pos(lineNo(line), line.text.length), bad)
  12029. }
  12030. }
  12031. var textNode = node.nodeType == 3 ? node : null, topNode = node;
  12032. if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
  12033. textNode = node.firstChild;
  12034. if (offset) { offset = textNode.nodeValue.length; }
  12035. }
  12036. while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
  12037. var measure = lineView.measure, maps = measure.maps;
  12038. function find(textNode, topNode, offset) {
  12039. for (var i = -1; i < (maps ? maps.length : 0); i++) {
  12040. var map$$1 = i < 0 ? measure.map : maps[i];
  12041. for (var j = 0; j < map$$1.length; j += 3) {
  12042. var curNode = map$$1[j + 2];
  12043. if (curNode == textNode || curNode == topNode) {
  12044. var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
  12045. var ch = map$$1[j] + offset;
  12046. if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
  12047. return Pos(line, ch)
  12048. }
  12049. }
  12050. }
  12051. }
  12052. var found = find(textNode, topNode, offset);
  12053. if (found) { return badPos(found, bad) }
  12054. // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
  12055. for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
  12056. found = find(after, after.firstChild, 0);
  12057. if (found)
  12058. { return badPos(Pos(found.line, found.ch - dist), bad) }
  12059. else
  12060. { dist += after.textContent.length; }
  12061. }
  12062. for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
  12063. found = find(before, before.firstChild, -1);
  12064. if (found)
  12065. { return badPos(Pos(found.line, found.ch + dist$1), bad) }
  12066. else
  12067. { dist$1 += before.textContent.length; }
  12068. }
  12069. }
  12070. // TEXTAREA INPUT STYLE
  12071. var TextareaInput = function(cm) {
  12072. this.cm = cm;
  12073. // See input.poll and input.reset
  12074. this.prevInput = "";
  12075. // Flag that indicates whether we expect input to appear real soon
  12076. // now (after some event like 'keypress' or 'input') and are
  12077. // polling intensively.
  12078. this.pollingFast = false;
  12079. // Self-resetting timeout for the poller
  12080. this.polling = new Delayed();
  12081. // Tracks when input.reset has punted to just putting a short
  12082. // string into the textarea instead of the full selection.
  12083. this.inaccurateSelection = false;
  12084. // Used to work around IE issue with selection being forgotten when focus moves away from textarea
  12085. this.hasSelection = false;
  12086. this.composing = null;
  12087. };
  12088. TextareaInput.prototype.init = function (display) {
  12089. var this$1 = this;
  12090. var input = this, cm = this.cm;
  12091. // Wraps and hides input textarea
  12092. var div = this.wrapper = hiddenTextarea();
  12093. // The semihidden textarea that is focused when the editor is
  12094. // focused, and receives input.
  12095. var te = this.textarea = div.firstChild;
  12096. display.wrapper.insertBefore(div, display.wrapper.firstChild);
  12097. // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
  12098. if (ios) { te.style.width = "0px"; }
  12099. on(te, "input", function () {
  12100. if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
  12101. input.poll();
  12102. });
  12103. on(te, "paste", function (e) {
  12104. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  12105. cm.state.pasteIncoming = true;
  12106. input.fastPoll();
  12107. });
  12108. function prepareCopyCut(e) {
  12109. if (signalDOMEvent(cm, e)) { return }
  12110. if (cm.somethingSelected()) {
  12111. setLastCopied({lineWise: false, text: cm.getSelections()});
  12112. if (input.inaccurateSelection) {
  12113. input.prevInput = "";
  12114. input.inaccurateSelection = false;
  12115. te.value = lastCopied.text.join("\n");
  12116. selectInput(te);
  12117. }
  12118. } else if (!cm.options.lineWiseCopyCut) {
  12119. return
  12120. } else {
  12121. var ranges = copyableRanges(cm);
  12122. setLastCopied({lineWise: true, text: ranges.text});
  12123. if (e.type == "cut") {
  12124. cm.setSelections(ranges.ranges, null, sel_dontScroll);
  12125. } else {
  12126. input.prevInput = "";
  12127. te.value = ranges.text.join("\n");
  12128. selectInput(te);
  12129. }
  12130. }
  12131. if (e.type == "cut") { cm.state.cutIncoming = true; }
  12132. }
  12133. on(te, "cut", prepareCopyCut);
  12134. on(te, "copy", prepareCopyCut);
  12135. on(display.scroller, "paste", function (e) {
  12136. if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
  12137. cm.state.pasteIncoming = true;
  12138. input.focus();
  12139. });
  12140. // Prevent normal selection in the editor (we handle our own)
  12141. on(display.lineSpace, "selectstart", function (e) {
  12142. if (!eventInWidget(display, e)) { e_preventDefault(e); }
  12143. });
  12144. on(te, "compositionstart", function () {
  12145. var start = cm.getCursor("from");
  12146. if (input.composing) { input.composing.range.clear(); }
  12147. input.composing = {
  12148. start: start,
  12149. range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
  12150. };
  12151. });
  12152. on(te, "compositionend", function () {
  12153. if (input.composing) {
  12154. input.poll();
  12155. input.composing.range.clear();
  12156. input.composing = null;
  12157. }
  12158. });
  12159. };
  12160. TextareaInput.prototype.prepareSelection = function () {
  12161. // Redraw the selection and/or cursor
  12162. var cm = this.cm, display = cm.display, doc = cm.doc;
  12163. var result = prepareSelection(cm);
  12164. // Move the hidden textarea near the cursor to prevent scrolling artifacts
  12165. if (cm.options.moveInputWithCursor) {
  12166. var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
  12167. var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  12168. result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  12169. headPos.top + lineOff.top - wrapOff.top));
  12170. result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  12171. headPos.left + lineOff.left - wrapOff.left));
  12172. }
  12173. return result
  12174. };
  12175. TextareaInput.prototype.showSelection = function (drawn) {
  12176. var cm = this.cm, display = cm.display;
  12177. removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
  12178. removeChildrenAndAdd(display.selectionDiv, drawn.selection);
  12179. if (drawn.teTop != null) {
  12180. this.wrapper.style.top = drawn.teTop + "px";
  12181. this.wrapper.style.left = drawn.teLeft + "px";
  12182. }
  12183. };
  12184. // Reset the input to correspond to the selection (or to be empty,
  12185. // when not typing and nothing is selected)
  12186. TextareaInput.prototype.reset = function (typing) {
  12187. if (this.contextMenuPending) { return }
  12188. var minimal, selected, cm = this.cm, doc = cm.doc;
  12189. if (cm.somethingSelected()) {
  12190. this.prevInput = "";
  12191. var range$$1 = doc.sel.primary();
  12192. minimal = hasCopyEvent &&
  12193. (range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000);
  12194. var content = minimal ? "-" : selected || cm.getSelection();
  12195. this.textarea.value = content;
  12196. if (cm.state.focused) { selectInput(this.textarea); }
  12197. if (ie && ie_version >= 9) { this.hasSelection = content; }
  12198. } else if (!typing) {
  12199. this.prevInput = this.textarea.value = "";
  12200. if (ie && ie_version >= 9) { this.hasSelection = null; }
  12201. }
  12202. this.inaccurateSelection = minimal;
  12203. };
  12204. TextareaInput.prototype.getField = function () { return this.textarea };
  12205. TextareaInput.prototype.supportsTouch = function () { return false };
  12206. TextareaInput.prototype.focus = function () {
  12207. if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
  12208. try { this.textarea.focus(); }
  12209. catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
  12210. }
  12211. };
  12212. TextareaInput.prototype.blur = function () { this.textarea.blur(); };
  12213. TextareaInput.prototype.resetPosition = function () {
  12214. this.wrapper.style.top = this.wrapper.style.left = 0;
  12215. };
  12216. TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
  12217. // Poll for input changes, using the normal rate of polling. This
  12218. // runs as long as the editor is focused.
  12219. TextareaInput.prototype.slowPoll = function () {
  12220. var this$1 = this;
  12221. if (this.pollingFast) { return }
  12222. this.polling.set(this.cm.options.pollInterval, function () {
  12223. this$1.poll();
  12224. if (this$1.cm.state.focused) { this$1.slowPoll(); }
  12225. });
  12226. };
  12227. // When an event has just come in that is likely to add or change
  12228. // something in the input textarea, we poll faster, to ensure that
  12229. // the change appears on the screen quickly.
  12230. TextareaInput.prototype.fastPoll = function () {
  12231. var missed = false, input = this;
  12232. input.pollingFast = true;
  12233. function p() {
  12234. var changed = input.poll();
  12235. if (!changed && !missed) {missed = true; input.polling.set(60, p);}
  12236. else {input.pollingFast = false; input.slowPoll();}
  12237. }
  12238. input.polling.set(20, p);
  12239. };
  12240. // Read input from the textarea, and update the document to match.
  12241. // When something is selected, it is present in the textarea, and
  12242. // selected (unless it is huge, in which case a placeholder is
  12243. // used). When nothing is selected, the cursor sits after previously
  12244. // seen text (can be empty), which is stored in prevInput (we must
  12245. // not reset the textarea when typing, because that breaks IME).
  12246. TextareaInput.prototype.poll = function () {
  12247. var this$1 = this;
  12248. var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
  12249. // Since this is called a *lot*, try to bail out as cheaply as
  12250. // possible when it is clear that nothing happened. hasSelection
  12251. // will be the case when there is a lot of text in the textarea,
  12252. // in which case reading its value would be expensive.
  12253. if (this.contextMenuPending || !cm.state.focused ||
  12254. (hasSelection(input) && !prevInput && !this.composing) ||
  12255. cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
  12256. { return false }
  12257. var text = input.value;
  12258. // If nothing changed, bail.
  12259. if (text == prevInput && !cm.somethingSelected()) { return false }
  12260. // Work around nonsensical selection resetting in IE9/10, and
  12261. // inexplicable appearance of private area unicode characters on
  12262. // some key combos in Mac (#2689).
  12263. if (ie && ie_version >= 9 && this.hasSelection === text ||
  12264. mac && /[\uf700-\uf7ff]/.test(text)) {
  12265. cm.display.input.reset();
  12266. return false
  12267. }
  12268. if (cm.doc.sel == cm.display.selForContextMenu) {
  12269. var first = text.charCodeAt(0);
  12270. if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
  12271. if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
  12272. }
  12273. // Find the part of the input that is actually new
  12274. var same = 0, l = Math.min(prevInput.length, text.length);
  12275. while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
  12276. runInOp(cm, function () {
  12277. applyTextInput(cm, text.slice(same), prevInput.length - same,
  12278. null, this$1.composing ? "*compose" : null);
  12279. // Don't leave long text in the textarea, since it makes further polling slow
  12280. if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
  12281. else { this$1.prevInput = text; }
  12282. if (this$1.composing) {
  12283. this$1.composing.range.clear();
  12284. this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
  12285. {className: "CodeMirror-composing"});
  12286. }
  12287. });
  12288. return true
  12289. };
  12290. TextareaInput.prototype.ensurePolled = function () {
  12291. if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  12292. };
  12293. TextareaInput.prototype.onKeyPress = function () {
  12294. if (ie && ie_version >= 9) { this.hasSelection = null; }
  12295. this.fastPoll();
  12296. };
  12297. TextareaInput.prototype.onContextMenu = function (e) {
  12298. var input = this, cm = input.cm, display = cm.display, te = input.textarea;
  12299. var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
  12300. if (!pos || presto) { return } // Opera is difficult.
  12301. // Reset the current text selection only if the click is done outside of the selection
  12302. // and 'resetSelectionOnContextMenu' option is true.
  12303. var reset = cm.options.resetSelectionOnContextMenu;
  12304. if (reset && cm.doc.sel.contains(pos) == -1)
  12305. { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
  12306. var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
  12307. input.wrapper.style.cssText = "position: absolute";
  12308. var wrapperBox = input.wrapper.getBoundingClientRect();
  12309. 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);";
  12310. var oldScrollY;
  12311. if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
  12312. display.input.focus();
  12313. if (webkit) { window.scrollTo(null, oldScrollY); }
  12314. display.input.reset();
  12315. // Adds "Select all" to context menu in FF
  12316. if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
  12317. input.contextMenuPending = true;
  12318. display.selForContextMenu = cm.doc.sel;
  12319. clearTimeout(display.detectingSelectAll);
  12320. // Select-all will be greyed out if there's nothing to select, so
  12321. // this adds a zero-width space so that we can later check whether
  12322. // it got selected.
  12323. function prepareSelectAllHack() {
  12324. if (te.selectionStart != null) {
  12325. var selected = cm.somethingSelected();
  12326. var extval = "\u200b" + (selected ? te.value : "");
  12327. te.value = "\u21da"; // Used to catch context-menu undo
  12328. te.value = extval;
  12329. input.prevInput = selected ? "" : "\u200b";
  12330. te.selectionStart = 1; te.selectionEnd = extval.length;
  12331. // Re-set this, in case some other handler touched the
  12332. // selection in the meantime.
  12333. display.selForContextMenu = cm.doc.sel;
  12334. }
  12335. }
  12336. function rehide() {
  12337. input.contextMenuPending = false;
  12338. input.wrapper.style.cssText = oldWrapperCSS;
  12339. te.style.cssText = oldCSS;
  12340. if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
  12341. // Try to detect the user choosing select-all
  12342. if (te.selectionStart != null) {
  12343. if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
  12344. var i = 0, poll = function () {
  12345. if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
  12346. te.selectionEnd > 0 && input.prevInput == "\u200b") {
  12347. operation(cm, selectAll)(cm);
  12348. } else if (i++ < 10) {
  12349. display.detectingSelectAll = setTimeout(poll, 500);
  12350. } else {
  12351. display.selForContextMenu = null;
  12352. display.input.reset();
  12353. }
  12354. };
  12355. display.detectingSelectAll = setTimeout(poll, 200);
  12356. }
  12357. }
  12358. if (ie && ie_version >= 9) { prepareSelectAllHack(); }
  12359. if (captureRightClick) {
  12360. e_stop(e);
  12361. var mouseup = function () {
  12362. off(window, "mouseup", mouseup);
  12363. setTimeout(rehide, 20);
  12364. };
  12365. on(window, "mouseup", mouseup);
  12366. } else {
  12367. setTimeout(rehide, 50);
  12368. }
  12369. };
  12370. TextareaInput.prototype.readOnlyChanged = function (val) {
  12371. if (!val) { this.reset(); }
  12372. };
  12373. TextareaInput.prototype.setUneditable = function () {};
  12374. TextareaInput.prototype.needsContentAttribute = false;
  12375. function fromTextArea(textarea, options) {
  12376. options = options ? copyObj(options) : {};
  12377. options.value = textarea.value;
  12378. if (!options.tabindex && textarea.tabIndex)
  12379. { options.tabindex = textarea.tabIndex; }
  12380. if (!options.placeholder && textarea.placeholder)
  12381. { options.placeholder = textarea.placeholder; }
  12382. // Set autofocus to true if this textarea is focused, or if it has
  12383. // autofocus and no other element is focused.
  12384. if (options.autofocus == null) {
  12385. var hasFocus = activeElt();
  12386. options.autofocus = hasFocus == textarea ||
  12387. textarea.getAttribute("autofocus") != null && hasFocus == document.body;
  12388. }
  12389. function save() {textarea.value = cm.getValue();}
  12390. var realSubmit;
  12391. if (textarea.form) {
  12392. on(textarea.form, "submit", save);
  12393. // Deplorable hack to make the submit method do the right thing.
  12394. if (!options.leaveSubmitMethodAlone) {
  12395. var form = textarea.form;
  12396. realSubmit = form.submit;
  12397. try {
  12398. var wrappedSubmit = form.submit = function () {
  12399. save();
  12400. form.submit = realSubmit;
  12401. form.submit();
  12402. form.submit = wrappedSubmit;
  12403. };
  12404. } catch(e) {}
  12405. }
  12406. }
  12407. options.finishInit = function (cm) {
  12408. cm.save = save;
  12409. cm.getTextArea = function () { return textarea; };
  12410. cm.toTextArea = function () {
  12411. cm.toTextArea = isNaN; // Prevent this from being ran twice
  12412. save();
  12413. textarea.parentNode.removeChild(cm.getWrapperElement());
  12414. textarea.style.display = "";
  12415. if (textarea.form) {
  12416. off(textarea.form, "submit", save);
  12417. if (typeof textarea.form.submit == "function")
  12418. { textarea.form.submit = realSubmit; }
  12419. }
  12420. };
  12421. };
  12422. textarea.style.display = "none";
  12423. var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
  12424. options);
  12425. return cm
  12426. }
  12427. function addLegacyProps(CodeMirror) {
  12428. CodeMirror.off = off;
  12429. CodeMirror.on = on;
  12430. CodeMirror.wheelEventPixels = wheelEventPixels;
  12431. CodeMirror.Doc = Doc;
  12432. CodeMirror.splitLines = splitLinesAuto;
  12433. CodeMirror.countColumn = countColumn;
  12434. CodeMirror.findColumn = findColumn;
  12435. CodeMirror.isWordChar = isWordCharBasic;
  12436. CodeMirror.Pass = Pass;
  12437. CodeMirror.signal = signal;
  12438. CodeMirror.Line = Line;
  12439. CodeMirror.changeEnd = changeEnd;
  12440. CodeMirror.scrollbarModel = scrollbarModel;
  12441. CodeMirror.Pos = Pos;
  12442. CodeMirror.cmpPos = cmp;
  12443. CodeMirror.modes = modes;
  12444. CodeMirror.mimeModes = mimeModes;
  12445. CodeMirror.resolveMode = resolveMode;
  12446. CodeMirror.getMode = getMode;
  12447. CodeMirror.modeExtensions = modeExtensions;
  12448. CodeMirror.extendMode = extendMode;
  12449. CodeMirror.copyState = copyState;
  12450. CodeMirror.startState = startState;
  12451. CodeMirror.innerMode = innerMode;
  12452. CodeMirror.commands = commands;
  12453. CodeMirror.keyMap = keyMap;
  12454. CodeMirror.keyName = keyName;
  12455. CodeMirror.isModifierKey = isModifierKey;
  12456. CodeMirror.lookupKey = lookupKey;
  12457. CodeMirror.normalizeKeyMap = normalizeKeyMap;
  12458. CodeMirror.StringStream = StringStream;
  12459. CodeMirror.SharedTextMarker = SharedTextMarker;
  12460. CodeMirror.TextMarker = TextMarker;
  12461. CodeMirror.LineWidget = LineWidget;
  12462. CodeMirror.e_preventDefault = e_preventDefault;
  12463. CodeMirror.e_stopPropagation = e_stopPropagation;
  12464. CodeMirror.e_stop = e_stop;
  12465. CodeMirror.addClass = addClass;
  12466. CodeMirror.contains = contains;
  12467. CodeMirror.rmClass = rmClass;
  12468. CodeMirror.keyNames = keyNames;
  12469. }
  12470. // EDITOR CONSTRUCTOR
  12471. defineOptions(CodeMirror$1);
  12472. addEditorMethods(CodeMirror$1);
  12473. // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  12474. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  12475. for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
  12476. { CodeMirror$1.prototype[prop] = (function(method) {
  12477. return function() {return method.apply(this.doc, arguments)}
  12478. })(Doc.prototype[prop]); } }
  12479. eventMixin(Doc);
  12480. // INPUT HANDLING
  12481. CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
  12482. // MODE DEFINITION AND QUERYING
  12483. // Extra arguments are stored as the mode's dependencies, which is
  12484. // used by (legacy) mechanisms like loadmode.js to automatically
  12485. // load a mode. (Preferred mechanism is the require/define calls.)
  12486. CodeMirror$1.defineMode = function(name/*, mode, …*/) {
  12487. if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
  12488. defineMode.apply(this, arguments);
  12489. };
  12490. CodeMirror$1.defineMIME = defineMIME;
  12491. // Minimal default mode.
  12492. CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  12493. CodeMirror$1.defineMIME("text/plain", "null");
  12494. // EXTENSIONS
  12495. CodeMirror$1.defineExtension = function (name, func) {
  12496. CodeMirror$1.prototype[name] = func;
  12497. };
  12498. CodeMirror$1.defineDocExtension = function (name, func) {
  12499. Doc.prototype[name] = func;
  12500. };
  12501. CodeMirror$1.fromTextArea = fromTextArea;
  12502. addLegacyProps(CodeMirror$1);
  12503. CodeMirror$1.version = "5.25.0";
  12504. return CodeMirror$1;
  12505. })));
  12506. /***/ }),
  12507. /* 50 */
  12508. /***/ (function(module, exports, __webpack_require__) {
  12509. "use strict";
  12510. /**
  12511. * Copyright (c) 2013-present, Facebook, Inc.
  12512. * All rights reserved.
  12513. *
  12514. * This source code is licensed under the BSD-style license found in the
  12515. * LICENSE file in the root directory of this source tree. An additional grant
  12516. * of patent rights can be found in the PATENTS file in the same directory.
  12517. *
  12518. * @typechecks
  12519. *
  12520. */
  12521. /*eslint-disable no-self-compare */
  12522. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12523. /**
  12524. * inlined Object.is polyfill to avoid requiring consumers ship their own
  12525. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  12526. */
  12527. function is(x, y) {
  12528. // SameValue algorithm
  12529. if (x === y) {
  12530. // Steps 1-5, 7-10
  12531. // Steps 6.b-6.e: +0 != -0
  12532. // Added the nonzero y check to make Flow happy, but it is redundant
  12533. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  12534. } else {
  12535. // Step 6.a: NaN == NaN
  12536. return x !== x && y !== y;
  12537. }
  12538. }
  12539. /**
  12540. * Performs equality by iterating through keys on an object and returning false
  12541. * when any key has values which are not strictly equal between the arguments.
  12542. * Returns true when the values of all keys are strictly equal.
  12543. */
  12544. function shallowEqual(objA, objB) {
  12545. if (is(objA, objB)) {
  12546. return true;
  12547. }
  12548. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  12549. return false;
  12550. }
  12551. var keysA = Object.keys(objA);
  12552. var keysB = Object.keys(objB);
  12553. if (keysA.length !== keysB.length) {
  12554. return false;
  12555. }
  12556. // Test for A's keys different from B.
  12557. for (var i = 0; i < keysA.length; i++) {
  12558. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  12559. return false;
  12560. }
  12561. }
  12562. return true;
  12563. }
  12564. module.exports = shallowEqual;
  12565. /***/ }),
  12566. /* 51 */
  12567. /***/ (function(module, exports, __webpack_require__) {
  12568. "use strict";
  12569. /**
  12570. * Copyright 2013-present, Facebook, Inc.
  12571. * All rights reserved.
  12572. *
  12573. * This source code is licensed under the BSD-style license found in the
  12574. * LICENSE file in the root directory of this source tree. An additional grant
  12575. * of patent rights can be found in the PATENTS file in the same directory.
  12576. *
  12577. */
  12578. var DOMLazyTree = __webpack_require__(18);
  12579. var Danger = __webpack_require__(154);
  12580. var ReactDOMComponentTree = __webpack_require__(5);
  12581. var ReactInstrumentation = __webpack_require__(11);
  12582. var createMicrosoftUnsafeLocalFunction = __webpack_require__(60);
  12583. var setInnerHTML = __webpack_require__(35);
  12584. var setTextContent = __webpack_require__(93);
  12585. function getNodeAfter(parentNode, node) {
  12586. // Special case for text components, which return [open, close] comments
  12587. // from getHostNode.
  12588. if (Array.isArray(node)) {
  12589. node = node[1];
  12590. }
  12591. return node ? node.nextSibling : parentNode.firstChild;
  12592. }
  12593. /**
  12594. * Inserts `childNode` as a child of `parentNode` at the `index`.
  12595. *
  12596. * @param {DOMElement} parentNode Parent node in which to insert.
  12597. * @param {DOMElement} childNode Child node to insert.
  12598. * @param {number} index Index at which to insert the child.
  12599. * @internal
  12600. */
  12601. var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
  12602. // We rely exclusively on `insertBefore(node, null)` instead of also using
  12603. // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
  12604. // we are careful to use `null`.)
  12605. parentNode.insertBefore(childNode, referenceNode);
  12606. });
  12607. function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
  12608. DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
  12609. }
  12610. function moveChild(parentNode, childNode, referenceNode) {
  12611. if (Array.isArray(childNode)) {
  12612. moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
  12613. } else {
  12614. insertChildAt(parentNode, childNode, referenceNode);
  12615. }
  12616. }
  12617. function removeChild(parentNode, childNode) {
  12618. if (Array.isArray(childNode)) {
  12619. var closingComment = childNode[1];
  12620. childNode = childNode[0];
  12621. removeDelimitedText(parentNode, childNode, closingComment);
  12622. parentNode.removeChild(closingComment);
  12623. }
  12624. parentNode.removeChild(childNode);
  12625. }
  12626. function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
  12627. var node = openingComment;
  12628. while (true) {
  12629. var nextNode = node.nextSibling;
  12630. insertChildAt(parentNode, node, referenceNode);
  12631. if (node === closingComment) {
  12632. break;
  12633. }
  12634. node = nextNode;
  12635. }
  12636. }
  12637. function removeDelimitedText(parentNode, startNode, closingComment) {
  12638. while (true) {
  12639. var node = startNode.nextSibling;
  12640. if (node === closingComment) {
  12641. // The closing comment is removed by ReactMultiChild.
  12642. break;
  12643. } else {
  12644. parentNode.removeChild(node);
  12645. }
  12646. }
  12647. }
  12648. function replaceDelimitedText(openingComment, closingComment, stringText) {
  12649. var parentNode = openingComment.parentNode;
  12650. var nodeAfterComment = openingComment.nextSibling;
  12651. if (nodeAfterComment === closingComment) {
  12652. // There are no text nodes between the opening and closing comments; insert
  12653. // a new one if stringText isn't empty.
  12654. if (stringText) {
  12655. insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
  12656. }
  12657. } else {
  12658. if (stringText) {
  12659. // Set the text content of the first node after the opening comment, and
  12660. // remove all following nodes up until the closing comment.
  12661. setTextContent(nodeAfterComment, stringText);
  12662. removeDelimitedText(parentNode, nodeAfterComment, closingComment);
  12663. } else {
  12664. removeDelimitedText(parentNode, openingComment, closingComment);
  12665. }
  12666. }
  12667. if (false) {
  12668. ReactInstrumentation.debugTool.onHostOperation({
  12669. instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
  12670. type: 'replace text',
  12671. payload: stringText
  12672. });
  12673. }
  12674. }
  12675. var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
  12676. if (false) {
  12677. dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
  12678. Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
  12679. if (prevInstance._debugID !== 0) {
  12680. ReactInstrumentation.debugTool.onHostOperation({
  12681. instanceID: prevInstance._debugID,
  12682. type: 'replace with',
  12683. payload: markup.toString()
  12684. });
  12685. } else {
  12686. var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
  12687. if (nextInstance._debugID !== 0) {
  12688. ReactInstrumentation.debugTool.onHostOperation({
  12689. instanceID: nextInstance._debugID,
  12690. type: 'mount',
  12691. payload: markup.toString()
  12692. });
  12693. }
  12694. }
  12695. };
  12696. }
  12697. /**
  12698. * Operations for updating with DOM children.
  12699. */
  12700. var DOMChildrenOperations = {
  12701. dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
  12702. replaceDelimitedText: replaceDelimitedText,
  12703. /**
  12704. * Updates a component's children by processing a series of updates. The
  12705. * update configurations are each expected to have a `parentNode` property.
  12706. *
  12707. * @param {array<object>} updates List of update configurations.
  12708. * @internal
  12709. */
  12710. processUpdates: function (parentNode, updates) {
  12711. if (false) {
  12712. var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
  12713. }
  12714. for (var k = 0; k < updates.length; k++) {
  12715. var update = updates[k];
  12716. switch (update.type) {
  12717. case 'INSERT_MARKUP':
  12718. insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
  12719. if (false) {
  12720. ReactInstrumentation.debugTool.onHostOperation({
  12721. instanceID: parentNodeDebugID,
  12722. type: 'insert child',
  12723. payload: { toIndex: update.toIndex, content: update.content.toString() }
  12724. });
  12725. }
  12726. break;
  12727. case 'MOVE_EXISTING':
  12728. moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
  12729. if (false) {
  12730. ReactInstrumentation.debugTool.onHostOperation({
  12731. instanceID: parentNodeDebugID,
  12732. type: 'move child',
  12733. payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
  12734. });
  12735. }
  12736. break;
  12737. case 'SET_MARKUP':
  12738. setInnerHTML(parentNode, update.content);
  12739. if (false) {
  12740. ReactInstrumentation.debugTool.onHostOperation({
  12741. instanceID: parentNodeDebugID,
  12742. type: 'replace children',
  12743. payload: update.content.toString()
  12744. });
  12745. }
  12746. break;
  12747. case 'TEXT_CONTENT':
  12748. setTextContent(parentNode, update.content);
  12749. if (false) {
  12750. ReactInstrumentation.debugTool.onHostOperation({
  12751. instanceID: parentNodeDebugID,
  12752. type: 'replace text',
  12753. payload: update.content.toString()
  12754. });
  12755. }
  12756. break;
  12757. case 'REMOVE_NODE':
  12758. removeChild(parentNode, update.fromNode);
  12759. if (false) {
  12760. ReactInstrumentation.debugTool.onHostOperation({
  12761. instanceID: parentNodeDebugID,
  12762. type: 'remove child',
  12763. payload: { fromIndex: update.fromIndex }
  12764. });
  12765. }
  12766. break;
  12767. }
  12768. }
  12769. }
  12770. };
  12771. module.exports = DOMChildrenOperations;
  12772. /***/ }),
  12773. /* 52 */
  12774. /***/ (function(module, exports, __webpack_require__) {
  12775. "use strict";
  12776. /**
  12777. * Copyright 2013-present, Facebook, Inc.
  12778. * All rights reserved.
  12779. *
  12780. * This source code is licensed under the BSD-style license found in the
  12781. * LICENSE file in the root directory of this source tree. An additional grant
  12782. * of patent rights can be found in the PATENTS file in the same directory.
  12783. *
  12784. */
  12785. var DOMNamespaces = {
  12786. html: 'http://www.w3.org/1999/xhtml',
  12787. mathml: 'http://www.w3.org/1998/Math/MathML',
  12788. svg: 'http://www.w3.org/2000/svg'
  12789. };
  12790. module.exports = DOMNamespaces;
  12791. /***/ }),
  12792. /* 53 */
  12793. /***/ (function(module, exports, __webpack_require__) {
  12794. "use strict";
  12795. /**
  12796. * Copyright 2013-present, Facebook, Inc.
  12797. * All rights reserved.
  12798. *
  12799. * This source code is licensed under the BSD-style license found in the
  12800. * LICENSE file in the root directory of this source tree. An additional grant
  12801. * of patent rights can be found in the PATENTS file in the same directory.
  12802. *
  12803. *
  12804. */
  12805. var _prodInvariant = __webpack_require__(2);
  12806. var invariant = __webpack_require__(0);
  12807. /**
  12808. * Injectable ordering of event plugins.
  12809. */
  12810. var eventPluginOrder = null;
  12811. /**
  12812. * Injectable mapping from names to event plugin modules.
  12813. */
  12814. var namesToPlugins = {};
  12815. /**
  12816. * Recomputes the plugin list using the injected plugins and plugin ordering.
  12817. *
  12818. * @private
  12819. */
  12820. function recomputePluginOrdering() {
  12821. if (!eventPluginOrder) {
  12822. // Wait until an `eventPluginOrder` is injected.
  12823. return;
  12824. }
  12825. for (var pluginName in namesToPlugins) {
  12826. var pluginModule = namesToPlugins[pluginName];
  12827. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  12828. !(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;
  12829. if (EventPluginRegistry.plugins[pluginIndex]) {
  12830. continue;
  12831. }
  12832. !pluginModule.extractEvents ? false ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
  12833. EventPluginRegistry.plugins[pluginIndex] = pluginModule;
  12834. var publishedEvents = pluginModule.eventTypes;
  12835. for (var eventName in publishedEvents) {
  12836. !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;
  12837. }
  12838. }
  12839. }
  12840. /**
  12841. * Publishes an event so that it can be dispatched by the supplied plugin.
  12842. *
  12843. * @param {object} dispatchConfig Dispatch configuration for the event.
  12844. * @param {object} PluginModule Plugin publishing the event.
  12845. * @return {boolean} True if the event was successfully published.
  12846. * @private
  12847. */
  12848. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  12849. !!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;
  12850. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  12851. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12852. if (phasedRegistrationNames) {
  12853. for (var phaseName in phasedRegistrationNames) {
  12854. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  12855. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  12856. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  12857. }
  12858. }
  12859. return true;
  12860. } else if (dispatchConfig.registrationName) {
  12861. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  12862. return true;
  12863. }
  12864. return false;
  12865. }
  12866. /**
  12867. * Publishes a registration name that is used to identify dispatched events and
  12868. * can be used with `EventPluginHub.putListener` to register listeners.
  12869. *
  12870. * @param {string} registrationName Registration name to add.
  12871. * @param {object} PluginModule Plugin publishing the event.
  12872. * @private
  12873. */
  12874. function publishRegistrationName(registrationName, pluginModule, eventName) {
  12875. !!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;
  12876. EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
  12877. EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  12878. if (false) {
  12879. var lowerCasedName = registrationName.toLowerCase();
  12880. EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
  12881. if (registrationName === 'onDoubleClick') {
  12882. EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
  12883. }
  12884. }
  12885. }
  12886. /**
  12887. * Registers plugins so that they can extract and dispatch events.
  12888. *
  12889. * @see {EventPluginHub}
  12890. */
  12891. var EventPluginRegistry = {
  12892. /**
  12893. * Ordered list of injected plugins.
  12894. */
  12895. plugins: [],
  12896. /**
  12897. * Mapping from event name to dispatch config
  12898. */
  12899. eventNameDispatchConfigs: {},
  12900. /**
  12901. * Mapping from registration name to plugin module
  12902. */
  12903. registrationNameModules: {},
  12904. /**
  12905. * Mapping from registration name to event name
  12906. */
  12907. registrationNameDependencies: {},
  12908. /**
  12909. * Mapping from lowercase registration names to the properly cased version,
  12910. * used to warn in the case of missing event handlers. Available
  12911. * only in __DEV__.
  12912. * @type {Object}
  12913. */
  12914. possibleRegistrationNames: false ? {} : null,
  12915. // Trust the developer to only use possibleRegistrationNames in __DEV__
  12916. /**
  12917. * Injects an ordering of plugins (by plugin name). This allows the ordering
  12918. * to be decoupled from injection of the actual plugins so that ordering is
  12919. * always deterministic regardless of packaging, on-the-fly injection, etc.
  12920. *
  12921. * @param {array} InjectedEventPluginOrder
  12922. * @internal
  12923. * @see {EventPluginHub.injection.injectEventPluginOrder}
  12924. */
  12925. injectEventPluginOrder: function (injectedEventPluginOrder) {
  12926. !!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;
  12927. // Clone the ordering so it cannot be dynamically mutated.
  12928. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  12929. recomputePluginOrdering();
  12930. },
  12931. /**
  12932. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  12933. * in the ordering injected by `injectEventPluginOrder`.
  12934. *
  12935. * Plugins can be injected as part of page initialization or on-the-fly.
  12936. *
  12937. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  12938. * @internal
  12939. * @see {EventPluginHub.injection.injectEventPluginsByName}
  12940. */
  12941. injectEventPluginsByName: function (injectedNamesToPlugins) {
  12942. var isOrderingDirty = false;
  12943. for (var pluginName in injectedNamesToPlugins) {
  12944. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  12945. continue;
  12946. }
  12947. var pluginModule = injectedNamesToPlugins[pluginName];
  12948. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  12949. !!namesToPlugins[pluginName] ? false ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
  12950. namesToPlugins[pluginName] = pluginModule;
  12951. isOrderingDirty = true;
  12952. }
  12953. }
  12954. if (isOrderingDirty) {
  12955. recomputePluginOrdering();
  12956. }
  12957. },
  12958. /**
  12959. * Looks up the plugin for the supplied event.
  12960. *
  12961. * @param {object} event A synthetic event.
  12962. * @return {?object} The plugin that created the supplied event.
  12963. * @internal
  12964. */
  12965. getPluginModuleForEvent: function (event) {
  12966. var dispatchConfig = event.dispatchConfig;
  12967. if (dispatchConfig.registrationName) {
  12968. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  12969. }
  12970. if (dispatchConfig.phasedRegistrationNames !== undefined) {
  12971. // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
  12972. // that it is not undefined.
  12973. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12974. for (var phase in phasedRegistrationNames) {
  12975. if (!phasedRegistrationNames.hasOwnProperty(phase)) {
  12976. continue;
  12977. }
  12978. var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
  12979. if (pluginModule) {
  12980. return pluginModule;
  12981. }
  12982. }
  12983. }
  12984. return null;
  12985. },
  12986. /**
  12987. * Exposed for unit testing.
  12988. * @private
  12989. */
  12990. _resetEventPlugins: function () {
  12991. eventPluginOrder = null;
  12992. for (var pluginName in namesToPlugins) {
  12993. if (namesToPlugins.hasOwnProperty(pluginName)) {
  12994. delete namesToPlugins[pluginName];
  12995. }
  12996. }
  12997. EventPluginRegistry.plugins.length = 0;
  12998. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  12999. for (var eventName in eventNameDispatchConfigs) {
  13000. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  13001. delete eventNameDispatchConfigs[eventName];
  13002. }
  13003. }
  13004. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  13005. for (var registrationName in registrationNameModules) {
  13006. if (registrationNameModules.hasOwnProperty(registrationName)) {
  13007. delete registrationNameModules[registrationName];
  13008. }
  13009. }
  13010. if (false) {
  13011. var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
  13012. for (var lowerCasedName in possibleRegistrationNames) {
  13013. if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
  13014. delete possibleRegistrationNames[lowerCasedName];
  13015. }
  13016. }
  13017. }
  13018. }
  13019. };
  13020. module.exports = EventPluginRegistry;
  13021. /***/ }),
  13022. /* 54 */
  13023. /***/ (function(module, exports, __webpack_require__) {
  13024. "use strict";
  13025. /**
  13026. * Copyright 2013-present, Facebook, Inc.
  13027. * All rights reserved.
  13028. *
  13029. * This source code is licensed under the BSD-style license found in the
  13030. * LICENSE file in the root directory of this source tree. An additional grant
  13031. * of patent rights can be found in the PATENTS file in the same directory.
  13032. *
  13033. */
  13034. var _prodInvariant = __webpack_require__(2);
  13035. var ReactErrorUtils = __webpack_require__(58);
  13036. var invariant = __webpack_require__(0);
  13037. var warning = __webpack_require__(1);
  13038. /**
  13039. * Injected dependencies:
  13040. */
  13041. /**
  13042. * - `ComponentTree`: [required] Module that can convert between React instances
  13043. * and actual node references.
  13044. */
  13045. var ComponentTree;
  13046. var TreeTraversal;
  13047. var injection = {
  13048. injectComponentTree: function (Injected) {
  13049. ComponentTree = Injected;
  13050. if (false) {
  13051. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
  13052. }
  13053. },
  13054. injectTreeTraversal: function (Injected) {
  13055. TreeTraversal = Injected;
  13056. if (false) {
  13057. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
  13058. }
  13059. }
  13060. };
  13061. function isEndish(topLevelType) {
  13062. return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
  13063. }
  13064. function isMoveish(topLevelType) {
  13065. return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
  13066. }
  13067. function isStartish(topLevelType) {
  13068. return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
  13069. }
  13070. var validateEventDispatches;
  13071. if (false) {
  13072. validateEventDispatches = function (event) {
  13073. var dispatchListeners = event._dispatchListeners;
  13074. var dispatchInstances = event._dispatchInstances;
  13075. var listenersIsArr = Array.isArray(dispatchListeners);
  13076. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  13077. var instancesIsArr = Array.isArray(dispatchInstances);
  13078. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  13079. process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
  13080. };
  13081. }
  13082. /**
  13083. * Dispatch the event to the listener.
  13084. * @param {SyntheticEvent} event SyntheticEvent to handle
  13085. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  13086. * @param {function} listener Application-level callback
  13087. * @param {*} inst Internal component instance
  13088. */
  13089. function executeDispatch(event, simulated, listener, inst) {
  13090. var type = event.type || 'unknown-event';
  13091. event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
  13092. if (simulated) {
  13093. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
  13094. } else {
  13095. ReactErrorUtils.invokeGuardedCallback(type, listener, event);
  13096. }
  13097. event.currentTarget = null;
  13098. }
  13099. /**
  13100. * Standard/simple iteration through an event's collected dispatches.
  13101. */
  13102. function executeDispatchesInOrder(event, simulated) {
  13103. var dispatchListeners = event._dispatchListeners;
  13104. var dispatchInstances = event._dispatchInstances;
  13105. if (false) {
  13106. validateEventDispatches(event);
  13107. }
  13108. if (Array.isArray(dispatchListeners)) {
  13109. for (var i = 0; i < dispatchListeners.length; i++) {
  13110. if (event.isPropagationStopped()) {
  13111. break;
  13112. }
  13113. // Listeners and Instances are two parallel arrays that are always in sync.
  13114. executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
  13115. }
  13116. } else if (dispatchListeners) {
  13117. executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
  13118. }
  13119. event._dispatchListeners = null;
  13120. event._dispatchInstances = null;
  13121. }
  13122. /**
  13123. * Standard/simple iteration through an event's collected dispatches, but stops
  13124. * at the first dispatch execution returning true, and returns that id.
  13125. *
  13126. * @return {?string} id of the first dispatch execution who's listener returns
  13127. * true, or null if no listener returned true.
  13128. */
  13129. function executeDispatchesInOrderStopAtTrueImpl(event) {
  13130. var dispatchListeners = event._dispatchListeners;
  13131. var dispatchInstances = event._dispatchInstances;
  13132. if (false) {
  13133. validateEventDispatches(event);
  13134. }
  13135. if (Array.isArray(dispatchListeners)) {
  13136. for (var i = 0; i < dispatchListeners.length; i++) {
  13137. if (event.isPropagationStopped()) {
  13138. break;
  13139. }
  13140. // Listeners and Instances are two parallel arrays that are always in sync.
  13141. if (dispatchListeners[i](event, dispatchInstances[i])) {
  13142. return dispatchInstances[i];
  13143. }
  13144. }
  13145. } else if (dispatchListeners) {
  13146. if (dispatchListeners(event, dispatchInstances)) {
  13147. return dispatchInstances;
  13148. }
  13149. }
  13150. return null;
  13151. }
  13152. /**
  13153. * @see executeDispatchesInOrderStopAtTrueImpl
  13154. */
  13155. function executeDispatchesInOrderStopAtTrue(event) {
  13156. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  13157. event._dispatchInstances = null;
  13158. event._dispatchListeners = null;
  13159. return ret;
  13160. }
  13161. /**
  13162. * Execution of a "direct" dispatch - there must be at most one dispatch
  13163. * accumulated on the event or it is considered an error. It doesn't really make
  13164. * sense for an event with multiple dispatches (bubbled) to keep track of the
  13165. * return values at each dispatch execution, but it does tend to make sense when
  13166. * dealing with "direct" dispatches.
  13167. *
  13168. * @return {*} The return value of executing the single dispatch.
  13169. */
  13170. function executeDirectDispatch(event) {
  13171. if (false) {
  13172. validateEventDispatches(event);
  13173. }
  13174. var dispatchListener = event._dispatchListeners;
  13175. var dispatchInstance = event._dispatchInstances;
  13176. !!Array.isArray(dispatchListener) ? false ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
  13177. event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
  13178. var res = dispatchListener ? dispatchListener(event) : null;
  13179. event.currentTarget = null;
  13180. event._dispatchListeners = null;
  13181. event._dispatchInstances = null;
  13182. return res;
  13183. }
  13184. /**
  13185. * @param {SyntheticEvent} event
  13186. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  13187. */
  13188. function hasDispatches(event) {
  13189. return !!event._dispatchListeners;
  13190. }
  13191. /**
  13192. * General utilities that are useful in creating custom Event Plugins.
  13193. */
  13194. var EventPluginUtils = {
  13195. isEndish: isEndish,
  13196. isMoveish: isMoveish,
  13197. isStartish: isStartish,
  13198. executeDirectDispatch: executeDirectDispatch,
  13199. executeDispatchesInOrder: executeDispatchesInOrder,
  13200. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  13201. hasDispatches: hasDispatches,
  13202. getInstanceFromNode: function (node) {
  13203. return ComponentTree.getInstanceFromNode(node);
  13204. },
  13205. getNodeFromInstance: function (node) {
  13206. return ComponentTree.getNodeFromInstance(node);
  13207. },
  13208. isAncestor: function (a, b) {
  13209. return TreeTraversal.isAncestor(a, b);
  13210. },
  13211. getLowestCommonAncestor: function (a, b) {
  13212. return TreeTraversal.getLowestCommonAncestor(a, b);
  13213. },
  13214. getParentInstance: function (inst) {
  13215. return TreeTraversal.getParentInstance(inst);
  13216. },
  13217. traverseTwoPhase: function (target, fn, arg) {
  13218. return TreeTraversal.traverseTwoPhase(target, fn, arg);
  13219. },
  13220. traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
  13221. return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
  13222. },
  13223. injection: injection
  13224. };
  13225. module.exports = EventPluginUtils;
  13226. /***/ }),
  13227. /* 55 */
  13228. /***/ (function(module, exports, __webpack_require__) {
  13229. "use strict";
  13230. /**
  13231. * Copyright 2013-present, Facebook, Inc.
  13232. * All rights reserved.
  13233. *
  13234. * This source code is licensed under the BSD-style license found in the
  13235. * LICENSE file in the root directory of this source tree. An additional grant
  13236. * of patent rights can be found in the PATENTS file in the same directory.
  13237. *
  13238. *
  13239. */
  13240. /**
  13241. * Escape and wrap key so it is safe to use as a reactid
  13242. *
  13243. * @param {string} key to be escaped.
  13244. * @return {string} the escaped key.
  13245. */
  13246. function escape(key) {
  13247. var escapeRegex = /[=:]/g;
  13248. var escaperLookup = {
  13249. '=': '=0',
  13250. ':': '=2'
  13251. };
  13252. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  13253. return escaperLookup[match];
  13254. });
  13255. return '$' + escapedString;
  13256. }
  13257. /**
  13258. * Unescape and unwrap key for human-readable display
  13259. *
  13260. * @param {string} key to unescape.
  13261. * @return {string} the unescaped key.
  13262. */
  13263. function unescape(key) {
  13264. var unescapeRegex = /(=0|=2)/g;
  13265. var unescaperLookup = {
  13266. '=0': '=',
  13267. '=2': ':'
  13268. };
  13269. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  13270. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  13271. return unescaperLookup[match];
  13272. });
  13273. }
  13274. var KeyEscapeUtils = {
  13275. escape: escape,
  13276. unescape: unescape
  13277. };
  13278. module.exports = KeyEscapeUtils;
  13279. /***/ }),
  13280. /* 56 */
  13281. /***/ (function(module, exports, __webpack_require__) {
  13282. "use strict";
  13283. /**
  13284. * Copyright 2013-present, Facebook, Inc.
  13285. * All rights reserved.
  13286. *
  13287. * This source code is licensed under the BSD-style license found in the
  13288. * LICENSE file in the root directory of this source tree. An additional grant
  13289. * of patent rights can be found in the PATENTS file in the same directory.
  13290. *
  13291. */
  13292. var _prodInvariant = __webpack_require__(2);
  13293. var React = __webpack_require__(21);
  13294. var ReactPropTypesSecret = __webpack_require__(183);
  13295. var invariant = __webpack_require__(0);
  13296. var warning = __webpack_require__(1);
  13297. var hasReadOnlyValue = {
  13298. 'button': true,
  13299. 'checkbox': true,
  13300. 'image': true,
  13301. 'hidden': true,
  13302. 'radio': true,
  13303. 'reset': true,
  13304. 'submit': true
  13305. };
  13306. function _assertSingleLink(inputProps) {
  13307. !(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;
  13308. }
  13309. function _assertValueLink(inputProps) {
  13310. _assertSingleLink(inputProps);
  13311. !(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;
  13312. }
  13313. function _assertCheckedLink(inputProps) {
  13314. _assertSingleLink(inputProps);
  13315. !(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;
  13316. }
  13317. var propTypes = {
  13318. value: function (props, propName, componentName) {
  13319. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  13320. return null;
  13321. }
  13322. 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`.');
  13323. },
  13324. checked: function (props, propName, componentName) {
  13325. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  13326. return null;
  13327. }
  13328. 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`.');
  13329. },
  13330. onChange: React.PropTypes.func
  13331. };
  13332. var loggedTypeFailures = {};
  13333. function getDeclarationErrorAddendum(owner) {
  13334. if (owner) {
  13335. var name = owner.getName();
  13336. if (name) {
  13337. return ' Check the render method of `' + name + '`.';
  13338. }
  13339. }
  13340. return '';
  13341. }
  13342. /**
  13343. * Provide a linked `value` attribute for controlled forms. You should not use
  13344. * this outside of the ReactDOM controlled form components.
  13345. */
  13346. var LinkedValueUtils = {
  13347. checkPropTypes: function (tagName, props, owner) {
  13348. for (var propName in propTypes) {
  13349. if (propTypes.hasOwnProperty(propName)) {
  13350. var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
  13351. }
  13352. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  13353. // Only monitor this failure once because there tends to be a lot of the
  13354. // same error.
  13355. loggedTypeFailures[error.message] = true;
  13356. var addendum = getDeclarationErrorAddendum(owner);
  13357. false ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
  13358. }
  13359. }
  13360. },
  13361. /**
  13362. * @param {object} inputProps Props for form component
  13363. * @return {*} current value of the input either from value prop or link.
  13364. */
  13365. getValue: function (inputProps) {
  13366. if (inputProps.valueLink) {
  13367. _assertValueLink(inputProps);
  13368. return inputProps.valueLink.value;
  13369. }
  13370. return inputProps.value;
  13371. },
  13372. /**
  13373. * @param {object} inputProps Props for form component
  13374. * @return {*} current checked status of the input either from checked prop
  13375. * or link.
  13376. */
  13377. getChecked: function (inputProps) {
  13378. if (inputProps.checkedLink) {
  13379. _assertCheckedLink(inputProps);
  13380. return inputProps.checkedLink.value;
  13381. }
  13382. return inputProps.checked;
  13383. },
  13384. /**
  13385. * @param {object} inputProps Props for form component
  13386. * @param {SyntheticEvent} event change event to handle
  13387. */
  13388. executeOnChange: function (inputProps, event) {
  13389. if (inputProps.valueLink) {
  13390. _assertValueLink(inputProps);
  13391. return inputProps.valueLink.requestChange(event.target.value);
  13392. } else if (inputProps.checkedLink) {
  13393. _assertCheckedLink(inputProps);
  13394. return inputProps.checkedLink.requestChange(event.target.checked);
  13395. } else if (inputProps.onChange) {
  13396. return inputProps.onChange.call(undefined, event);
  13397. }
  13398. }
  13399. };
  13400. module.exports = LinkedValueUtils;
  13401. /***/ }),
  13402. /* 57 */
  13403. /***/ (function(module, exports, __webpack_require__) {
  13404. "use strict";
  13405. /**
  13406. * Copyright 2014-present, Facebook, Inc.
  13407. * All rights reserved.
  13408. *
  13409. * This source code is licensed under the BSD-style license found in the
  13410. * LICENSE file in the root directory of this source tree. An additional grant
  13411. * of patent rights can be found in the PATENTS file in the same directory.
  13412. *
  13413. *
  13414. */
  13415. var _prodInvariant = __webpack_require__(2);
  13416. var invariant = __webpack_require__(0);
  13417. var injected = false;
  13418. var ReactComponentEnvironment = {
  13419. /**
  13420. * Optionally injectable hook for swapping out mount images in the middle of
  13421. * the tree.
  13422. */
  13423. replaceNodeWithMarkup: null,
  13424. /**
  13425. * Optionally injectable hook for processing a queue of child updates. Will
  13426. * later move into MultiChildComponents.
  13427. */
  13428. processChildrenUpdates: null,
  13429. injection: {
  13430. injectEnvironment: function (environment) {
  13431. !!injected ? false ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
  13432. ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
  13433. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  13434. injected = true;
  13435. }
  13436. }
  13437. };
  13438. module.exports = ReactComponentEnvironment;
  13439. /***/ }),
  13440. /* 58 */
  13441. /***/ (function(module, exports, __webpack_require__) {
  13442. "use strict";
  13443. /**
  13444. * Copyright 2013-present, Facebook, Inc.
  13445. * All rights reserved.
  13446. *
  13447. * This source code is licensed under the BSD-style license found in the
  13448. * LICENSE file in the root directory of this source tree. An additional grant
  13449. * of patent rights can be found in the PATENTS file in the same directory.
  13450. *
  13451. *
  13452. */
  13453. var caughtError = null;
  13454. /**
  13455. * Call a function while guarding against errors that happens within it.
  13456. *
  13457. * @param {String} name of the guard to use for logging or debugging
  13458. * @param {Function} func The function to invoke
  13459. * @param {*} a First argument
  13460. * @param {*} b Second argument
  13461. */
  13462. function invokeGuardedCallback(name, func, a) {
  13463. try {
  13464. func(a);
  13465. } catch (x) {
  13466. if (caughtError === null) {
  13467. caughtError = x;
  13468. }
  13469. }
  13470. }
  13471. var ReactErrorUtils = {
  13472. invokeGuardedCallback: invokeGuardedCallback,
  13473. /**
  13474. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  13475. * handler are sure to be rethrown by rethrowCaughtError.
  13476. */
  13477. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  13478. /**
  13479. * During execution of guarded functions we will capture the first error which
  13480. * we will rethrow to be handled by the top level error handler.
  13481. */
  13482. rethrowCaughtError: function () {
  13483. if (caughtError) {
  13484. var error = caughtError;
  13485. caughtError = null;
  13486. throw error;
  13487. }
  13488. }
  13489. };
  13490. if (false) {
  13491. /**
  13492. * To help development we can get better devtools integration by simulating a
  13493. * real browser event.
  13494. */
  13495. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  13496. var fakeNode = document.createElement('react');
  13497. ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
  13498. var boundFunc = func.bind(null, a);
  13499. var evtType = 'react-' + name;
  13500. fakeNode.addEventListener(evtType, boundFunc, false);
  13501. var evt = document.createEvent('Event');
  13502. // $FlowFixMe https://github.com/facebook/flow/issues/2336
  13503. evt.initEvent(evtType, false, false);
  13504. fakeNode.dispatchEvent(evt);
  13505. fakeNode.removeEventListener(evtType, boundFunc, false);
  13506. };
  13507. }
  13508. }
  13509. module.exports = ReactErrorUtils;
  13510. /***/ }),
  13511. /* 59 */
  13512. /***/ (function(module, exports, __webpack_require__) {
  13513. "use strict";
  13514. /**
  13515. * Copyright 2015-present, Facebook, Inc.
  13516. * All rights reserved.
  13517. *
  13518. * This source code is licensed under the BSD-style license found in the
  13519. * LICENSE file in the root directory of this source tree. An additional grant
  13520. * of patent rights can be found in the PATENTS file in the same directory.
  13521. *
  13522. */
  13523. var _prodInvariant = __webpack_require__(2);
  13524. var ReactCurrentOwner = __webpack_require__(14);
  13525. var ReactInstanceMap = __webpack_require__(28);
  13526. var ReactInstrumentation = __webpack_require__(11);
  13527. var ReactUpdates = __webpack_require__(12);
  13528. var invariant = __webpack_require__(0);
  13529. var warning = __webpack_require__(1);
  13530. function enqueueUpdate(internalInstance) {
  13531. ReactUpdates.enqueueUpdate(internalInstance);
  13532. }
  13533. function formatUnexpectedArgument(arg) {
  13534. var type = typeof arg;
  13535. if (type !== 'object') {
  13536. return type;
  13537. }
  13538. var displayName = arg.constructor && arg.constructor.name || type;
  13539. var keys = Object.keys(arg);
  13540. if (keys.length > 0 && keys.length < 20) {
  13541. return displayName + ' (keys: ' + keys.join(', ') + ')';
  13542. }
  13543. return displayName;
  13544. }
  13545. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  13546. var internalInstance = ReactInstanceMap.get(publicInstance);
  13547. if (!internalInstance) {
  13548. if (false) {
  13549. var ctor = publicInstance.constructor;
  13550. // Only warn when we have a callerName. Otherwise we should be silent.
  13551. // We're probably calling from enqueueCallback. We don't want to warn
  13552. // there because we already warned for the corresponding lifecycle method.
  13553. 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;
  13554. }
  13555. return null;
  13556. }
  13557. if (false) {
  13558. 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;
  13559. }
  13560. return internalInstance;
  13561. }
  13562. /**
  13563. * ReactUpdateQueue allows for state updates to be scheduled into a later
  13564. * reconciliation step.
  13565. */
  13566. var ReactUpdateQueue = {
  13567. /**
  13568. * Checks whether or not this composite component is mounted.
  13569. * @param {ReactClass} publicInstance The instance we want to test.
  13570. * @return {boolean} True if mounted, false otherwise.
  13571. * @protected
  13572. * @final
  13573. */
  13574. isMounted: function (publicInstance) {
  13575. if (false) {
  13576. var owner = ReactCurrentOwner.current;
  13577. if (owner !== null) {
  13578. 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;
  13579. owner._warnedAboutRefsInRender = true;
  13580. }
  13581. }
  13582. var internalInstance = ReactInstanceMap.get(publicInstance);
  13583. if (internalInstance) {
  13584. // During componentWillMount and render this will still be null but after
  13585. // that will always render to something. At least for now. So we can use
  13586. // this hack.
  13587. return !!internalInstance._renderedComponent;
  13588. } else {
  13589. return false;
  13590. }
  13591. },
  13592. /**
  13593. * Enqueue a callback that will be executed after all the pending updates
  13594. * have processed.
  13595. *
  13596. * @param {ReactClass} publicInstance The instance to use as `this` context.
  13597. * @param {?function} callback Called after state is updated.
  13598. * @param {string} callerName Name of the calling function in the public API.
  13599. * @internal
  13600. */
  13601. enqueueCallback: function (publicInstance, callback, callerName) {
  13602. ReactUpdateQueue.validateCallback(callback, callerName);
  13603. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  13604. // Previously we would throw an error if we didn't have an internal
  13605. // instance. Since we want to make it a no-op instead, we mirror the same
  13606. // behavior we have in other enqueue* methods.
  13607. // We also need to ignore callbacks in componentWillMount. See
  13608. // enqueueUpdates.
  13609. if (!internalInstance) {
  13610. return null;
  13611. }
  13612. if (internalInstance._pendingCallbacks) {
  13613. internalInstance._pendingCallbacks.push(callback);
  13614. } else {
  13615. internalInstance._pendingCallbacks = [callback];
  13616. }
  13617. // TODO: The callback here is ignored when setState is called from
  13618. // componentWillMount. Either fix it or disallow doing so completely in
  13619. // favor of getInitialState. Alternatively, we can disallow
  13620. // componentWillMount during server-side rendering.
  13621. enqueueUpdate(internalInstance);
  13622. },
  13623. enqueueCallbackInternal: function (internalInstance, callback) {
  13624. if (internalInstance._pendingCallbacks) {
  13625. internalInstance._pendingCallbacks.push(callback);
  13626. } else {
  13627. internalInstance._pendingCallbacks = [callback];
  13628. }
  13629. enqueueUpdate(internalInstance);
  13630. },
  13631. /**
  13632. * Forces an update. This should only be invoked when it is known with
  13633. * certainty that we are **not** in a DOM transaction.
  13634. *
  13635. * You may want to call this when you know that some deeper aspect of the
  13636. * component's state has changed but `setState` was not called.
  13637. *
  13638. * This will not invoke `shouldComponentUpdate`, but it will invoke
  13639. * `componentWillUpdate` and `componentDidUpdate`.
  13640. *
  13641. * @param {ReactClass} publicInstance The instance that should rerender.
  13642. * @internal
  13643. */
  13644. enqueueForceUpdate: function (publicInstance) {
  13645. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  13646. if (!internalInstance) {
  13647. return;
  13648. }
  13649. internalInstance._pendingForceUpdate = true;
  13650. enqueueUpdate(internalInstance);
  13651. },
  13652. /**
  13653. * Replaces all of the state. Always use this or `setState` to mutate state.
  13654. * You should treat `this.state` as immutable.
  13655. *
  13656. * There is no guarantee that `this.state` will be immediately updated, so
  13657. * accessing `this.state` after calling this method may return the old value.
  13658. *
  13659. * @param {ReactClass} publicInstance The instance that should rerender.
  13660. * @param {object} completeState Next state.
  13661. * @internal
  13662. */
  13663. enqueueReplaceState: function (publicInstance, completeState) {
  13664. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  13665. if (!internalInstance) {
  13666. return;
  13667. }
  13668. internalInstance._pendingStateQueue = [completeState];
  13669. internalInstance._pendingReplaceState = true;
  13670. enqueueUpdate(internalInstance);
  13671. },
  13672. /**
  13673. * Sets a subset of the state. This only exists because _pendingState is
  13674. * internal. This provides a merging strategy that is not available to deep
  13675. * properties which is confusing. TODO: Expose pendingState or don't use it
  13676. * during the merge.
  13677. *
  13678. * @param {ReactClass} publicInstance The instance that should rerender.
  13679. * @param {object} partialState Next partial state to be merged with state.
  13680. * @internal
  13681. */
  13682. enqueueSetState: function (publicInstance, partialState) {
  13683. if (false) {
  13684. ReactInstrumentation.debugTool.onSetState();
  13685. process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
  13686. }
  13687. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  13688. if (!internalInstance) {
  13689. return;
  13690. }
  13691. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  13692. queue.push(partialState);
  13693. enqueueUpdate(internalInstance);
  13694. },
  13695. enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
  13696. internalInstance._pendingElement = nextElement;
  13697. // TODO: introduce _pendingContext instead of setting it directly.
  13698. internalInstance._context = nextContext;
  13699. enqueueUpdate(internalInstance);
  13700. },
  13701. validateCallback: function (callback, callerName) {
  13702. !(!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;
  13703. }
  13704. };
  13705. module.exports = ReactUpdateQueue;
  13706. /***/ }),
  13707. /* 60 */
  13708. /***/ (function(module, exports, __webpack_require__) {
  13709. "use strict";
  13710. /**
  13711. * Copyright 2013-present, Facebook, Inc.
  13712. * All rights reserved.
  13713. *
  13714. * This source code is licensed under the BSD-style license found in the
  13715. * LICENSE file in the root directory of this source tree. An additional grant
  13716. * of patent rights can be found in the PATENTS file in the same directory.
  13717. *
  13718. */
  13719. /* globals MSApp */
  13720. /**
  13721. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  13722. */
  13723. var createMicrosoftUnsafeLocalFunction = function (func) {
  13724. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  13725. return function (arg0, arg1, arg2, arg3) {
  13726. MSApp.execUnsafeLocalFunction(function () {
  13727. return func(arg0, arg1, arg2, arg3);
  13728. });
  13729. };
  13730. } else {
  13731. return func;
  13732. }
  13733. };
  13734. module.exports = createMicrosoftUnsafeLocalFunction;
  13735. /***/ }),
  13736. /* 61 */
  13737. /***/ (function(module, exports, __webpack_require__) {
  13738. "use strict";
  13739. /**
  13740. * Copyright 2013-present, Facebook, Inc.
  13741. * All rights reserved.
  13742. *
  13743. * This source code is licensed under the BSD-style license found in the
  13744. * LICENSE file in the root directory of this source tree. An additional grant
  13745. * of patent rights can be found in the PATENTS file in the same directory.
  13746. *
  13747. */
  13748. /**
  13749. * `charCode` represents the actual "character code" and is safe to use with
  13750. * `String.fromCharCode`. As such, only keys that correspond to printable
  13751. * characters produce a valid `charCode`, the only exception to this is Enter.
  13752. * The Tab-key is considered non-printable and does not have a `charCode`,
  13753. * presumably because it does not produce a tab-character in browsers.
  13754. *
  13755. * @param {object} nativeEvent Native browser event.
  13756. * @return {number} Normalized `charCode` property.
  13757. */
  13758. function getEventCharCode(nativeEvent) {
  13759. var charCode;
  13760. var keyCode = nativeEvent.keyCode;
  13761. if ('charCode' in nativeEvent) {
  13762. charCode = nativeEvent.charCode;
  13763. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  13764. if (charCode === 0 && keyCode === 13) {
  13765. charCode = 13;
  13766. }
  13767. } else {
  13768. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  13769. charCode = keyCode;
  13770. }
  13771. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  13772. // Must not discard the (non-)printable Enter-key.
  13773. if (charCode >= 32 || charCode === 13) {
  13774. return charCode;
  13775. }
  13776. return 0;
  13777. }
  13778. module.exports = getEventCharCode;
  13779. /***/ }),
  13780. /* 62 */
  13781. /***/ (function(module, exports, __webpack_require__) {
  13782. "use strict";
  13783. /**
  13784. * Copyright 2013-present, Facebook, Inc.
  13785. * All rights reserved.
  13786. *
  13787. * This source code is licensed under the BSD-style license found in the
  13788. * LICENSE file in the root directory of this source tree. An additional grant
  13789. * of patent rights can be found in the PATENTS file in the same directory.
  13790. *
  13791. */
  13792. /**
  13793. * Translation from modifier key to the associated property in the event.
  13794. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  13795. */
  13796. var modifierKeyToProp = {
  13797. 'Alt': 'altKey',
  13798. 'Control': 'ctrlKey',
  13799. 'Meta': 'metaKey',
  13800. 'Shift': 'shiftKey'
  13801. };
  13802. // IE8 does not implement getModifierState so we simply map it to the only
  13803. // modifier keys exposed by the event itself, does not support Lock-keys.
  13804. // Currently, all major browsers except Chrome seems to support Lock-keys.
  13805. function modifierStateGetter(keyArg) {
  13806. var syntheticEvent = this;
  13807. var nativeEvent = syntheticEvent.nativeEvent;
  13808. if (nativeEvent.getModifierState) {
  13809. return nativeEvent.getModifierState(keyArg);
  13810. }
  13811. var keyProp = modifierKeyToProp[keyArg];
  13812. return keyProp ? !!nativeEvent[keyProp] : false;
  13813. }
  13814. function getEventModifierState(nativeEvent) {
  13815. return modifierStateGetter;
  13816. }
  13817. module.exports = getEventModifierState;
  13818. /***/ }),
  13819. /* 63 */
  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. /**
  13832. * Gets the target node from a native browser event by accounting for
  13833. * inconsistencies in browser DOM APIs.
  13834. *
  13835. * @param {object} nativeEvent Native browser event.
  13836. * @return {DOMEventTarget} Target node.
  13837. */
  13838. function getEventTarget(nativeEvent) {
  13839. var target = nativeEvent.target || nativeEvent.srcElement || window;
  13840. // Normalize SVG <use> element events #4963
  13841. if (target.correspondingUseElement) {
  13842. target = target.correspondingUseElement;
  13843. }
  13844. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  13845. // @see http://www.quirksmode.org/js/events_properties.html
  13846. return target.nodeType === 3 ? target.parentNode : target;
  13847. }
  13848. module.exports = getEventTarget;
  13849. /***/ }),
  13850. /* 64 */
  13851. /***/ (function(module, exports, __webpack_require__) {
  13852. "use strict";
  13853. /**
  13854. * Copyright 2013-present, Facebook, Inc.
  13855. * All rights reserved.
  13856. *
  13857. * This source code is licensed under the BSD-style license found in the
  13858. * LICENSE file in the root directory of this source tree. An additional grant
  13859. * of patent rights can be found in the PATENTS file in the same directory.
  13860. *
  13861. */
  13862. var ExecutionEnvironment = __webpack_require__(8);
  13863. var useHasFeature;
  13864. if (ExecutionEnvironment.canUseDOM) {
  13865. useHasFeature = document.implementation && document.implementation.hasFeature &&
  13866. // always returns true in newer browsers as per the standard.
  13867. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  13868. document.implementation.hasFeature('', '') !== true;
  13869. }
  13870. /**
  13871. * Checks if an event is supported in the current execution environment.
  13872. *
  13873. * NOTE: This will not work correctly for non-generic events such as `change`,
  13874. * `reset`, `load`, `error`, and `select`.
  13875. *
  13876. * Borrows from Modernizr.
  13877. *
  13878. * @param {string} eventNameSuffix Event name, e.g. "click".
  13879. * @param {?boolean} capture Check if the capture phase is supported.
  13880. * @return {boolean} True if the event is supported.
  13881. * @internal
  13882. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  13883. */
  13884. function isEventSupported(eventNameSuffix, capture) {
  13885. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  13886. return false;
  13887. }
  13888. var eventName = 'on' + eventNameSuffix;
  13889. var isSupported = eventName in document;
  13890. if (!isSupported) {
  13891. var element = document.createElement('div');
  13892. element.setAttribute(eventName, 'return;');
  13893. isSupported = typeof element[eventName] === 'function';
  13894. }
  13895. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  13896. // This is the only way to test support for the `wheel` event in IE9+.
  13897. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  13898. }
  13899. return isSupported;
  13900. }
  13901. module.exports = isEventSupported;
  13902. /***/ }),
  13903. /* 65 */
  13904. /***/ (function(module, exports, __webpack_require__) {
  13905. "use strict";
  13906. /**
  13907. * Copyright 2013-present, Facebook, Inc.
  13908. * All rights reserved.
  13909. *
  13910. * This source code is licensed under the BSD-style license found in the
  13911. * LICENSE file in the root directory of this source tree. An additional grant
  13912. * of patent rights can be found in the PATENTS file in the same directory.
  13913. *
  13914. */
  13915. /**
  13916. * Given a `prevElement` and `nextElement`, determines if the existing
  13917. * instance should be updated as opposed to being destroyed or replaced by a new
  13918. * instance. Both arguments are elements. This ensures that this logic can
  13919. * operate on stateless trees without any backing instance.
  13920. *
  13921. * @param {?object} prevElement
  13922. * @param {?object} nextElement
  13923. * @return {boolean} True if the existing instance should be updated.
  13924. * @protected
  13925. */
  13926. function shouldUpdateReactComponent(prevElement, nextElement) {
  13927. var prevEmpty = prevElement === null || prevElement === false;
  13928. var nextEmpty = nextElement === null || nextElement === false;
  13929. if (prevEmpty || nextEmpty) {
  13930. return prevEmpty === nextEmpty;
  13931. }
  13932. var prevType = typeof prevElement;
  13933. var nextType = typeof nextElement;
  13934. if (prevType === 'string' || prevType === 'number') {
  13935. return nextType === 'string' || nextType === 'number';
  13936. } else {
  13937. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  13938. }
  13939. }
  13940. module.exports = shouldUpdateReactComponent;
  13941. /***/ }),
  13942. /* 66 */
  13943. /***/ (function(module, exports, __webpack_require__) {
  13944. "use strict";
  13945. /**
  13946. * Copyright 2015-present, Facebook, Inc.
  13947. * All rights reserved.
  13948. *
  13949. * This source code is licensed under the BSD-style license found in the
  13950. * LICENSE file in the root directory of this source tree. An additional grant
  13951. * of patent rights can be found in the PATENTS file in the same directory.
  13952. *
  13953. */
  13954. var _assign = __webpack_require__(3);
  13955. var emptyFunction = __webpack_require__(10);
  13956. var warning = __webpack_require__(1);
  13957. var validateDOMNesting = emptyFunction;
  13958. if (false) {
  13959. // This validation code was written based on the HTML5 parsing spec:
  13960. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  13961. //
  13962. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  13963. // not clear what practical benefit doing so provides); instead, we warn only
  13964. // for cases where the parser will give a parse tree differing from what React
  13965. // intended. For example, <b><div></div></b> is invalid but we don't warn
  13966. // because it still parses correctly; we do warn for other cases like nested
  13967. // <p> tags where the beginning of the second element implicitly closes the
  13968. // first, causing a confusing mess.
  13969. // https://html.spec.whatwg.org/multipage/syntax.html#special
  13970. 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'];
  13971. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  13972. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  13973. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  13974. // TODO: Distinguish by namespace here -- for <title>, including it here
  13975. // errs on the side of fewer warnings
  13976. 'foreignObject', 'desc', 'title'];
  13977. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  13978. var buttonScopeTags = inScopeTags.concat(['button']);
  13979. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  13980. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  13981. var emptyAncestorInfo = {
  13982. current: null,
  13983. formTag: null,
  13984. aTagInScope: null,
  13985. buttonTagInScope: null,
  13986. nobrTagInScope: null,
  13987. pTagInButtonScope: null,
  13988. listItemTagAutoclosing: null,
  13989. dlItemTagAutoclosing: null
  13990. };
  13991. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  13992. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  13993. var info = { tag: tag, instance: instance };
  13994. if (inScopeTags.indexOf(tag) !== -1) {
  13995. ancestorInfo.aTagInScope = null;
  13996. ancestorInfo.buttonTagInScope = null;
  13997. ancestorInfo.nobrTagInScope = null;
  13998. }
  13999. if (buttonScopeTags.indexOf(tag) !== -1) {
  14000. ancestorInfo.pTagInButtonScope = null;
  14001. }
  14002. // See rules for 'li', 'dd', 'dt' start tags in
  14003. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  14004. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  14005. ancestorInfo.listItemTagAutoclosing = null;
  14006. ancestorInfo.dlItemTagAutoclosing = null;
  14007. }
  14008. ancestorInfo.current = info;
  14009. if (tag === 'form') {
  14010. ancestorInfo.formTag = info;
  14011. }
  14012. if (tag === 'a') {
  14013. ancestorInfo.aTagInScope = info;
  14014. }
  14015. if (tag === 'button') {
  14016. ancestorInfo.buttonTagInScope = info;
  14017. }
  14018. if (tag === 'nobr') {
  14019. ancestorInfo.nobrTagInScope = info;
  14020. }
  14021. if (tag === 'p') {
  14022. ancestorInfo.pTagInButtonScope = info;
  14023. }
  14024. if (tag === 'li') {
  14025. ancestorInfo.listItemTagAutoclosing = info;
  14026. }
  14027. if (tag === 'dd' || tag === 'dt') {
  14028. ancestorInfo.dlItemTagAutoclosing = info;
  14029. }
  14030. return ancestorInfo;
  14031. };
  14032. /**
  14033. * Returns whether
  14034. */
  14035. var isTagValidWithParent = function (tag, parentTag) {
  14036. // First, let's check if we're in an unusual parsing mode...
  14037. switch (parentTag) {
  14038. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  14039. case 'select':
  14040. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  14041. case 'optgroup':
  14042. return tag === 'option' || tag === '#text';
  14043. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  14044. // but
  14045. case 'option':
  14046. return tag === '#text';
  14047. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  14048. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  14049. // No special behavior since these rules fall back to "in body" mode for
  14050. // all except special table nodes which cause bad parsing behavior anyway.
  14051. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  14052. case 'tr':
  14053. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  14054. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  14055. case 'tbody':
  14056. case 'thead':
  14057. case 'tfoot':
  14058. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  14059. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  14060. case 'colgroup':
  14061. return tag === 'col' || tag === 'template';
  14062. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  14063. case 'table':
  14064. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  14065. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  14066. case 'head':
  14067. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  14068. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  14069. case 'html':
  14070. return tag === 'head' || tag === 'body';
  14071. case '#document':
  14072. return tag === 'html';
  14073. }
  14074. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  14075. // where the parsing rules cause implicit opens or closes to be added.
  14076. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  14077. switch (tag) {
  14078. case 'h1':
  14079. case 'h2':
  14080. case 'h3':
  14081. case 'h4':
  14082. case 'h5':
  14083. case 'h6':
  14084. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  14085. case 'rp':
  14086. case 'rt':
  14087. return impliedEndTags.indexOf(parentTag) === -1;
  14088. case 'body':
  14089. case 'caption':
  14090. case 'col':
  14091. case 'colgroup':
  14092. case 'frame':
  14093. case 'head':
  14094. case 'html':
  14095. case 'tbody':
  14096. case 'td':
  14097. case 'tfoot':
  14098. case 'th':
  14099. case 'thead':
  14100. case 'tr':
  14101. // These tags are only valid with a few parents that have special child
  14102. // parsing rules -- if we're down here, then none of those matched and
  14103. // so we allow it only if we don't know what the parent is, as all other
  14104. // cases are invalid.
  14105. return parentTag == null;
  14106. }
  14107. return true;
  14108. };
  14109. /**
  14110. * Returns whether
  14111. */
  14112. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  14113. switch (tag) {
  14114. case 'address':
  14115. case 'article':
  14116. case 'aside':
  14117. case 'blockquote':
  14118. case 'center':
  14119. case 'details':
  14120. case 'dialog':
  14121. case 'dir':
  14122. case 'div':
  14123. case 'dl':
  14124. case 'fieldset':
  14125. case 'figcaption':
  14126. case 'figure':
  14127. case 'footer':
  14128. case 'header':
  14129. case 'hgroup':
  14130. case 'main':
  14131. case 'menu':
  14132. case 'nav':
  14133. case 'ol':
  14134. case 'p':
  14135. case 'section':
  14136. case 'summary':
  14137. case 'ul':
  14138. case 'pre':
  14139. case 'listing':
  14140. case 'table':
  14141. case 'hr':
  14142. case 'xmp':
  14143. case 'h1':
  14144. case 'h2':
  14145. case 'h3':
  14146. case 'h4':
  14147. case 'h5':
  14148. case 'h6':
  14149. return ancestorInfo.pTagInButtonScope;
  14150. case 'form':
  14151. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  14152. case 'li':
  14153. return ancestorInfo.listItemTagAutoclosing;
  14154. case 'dd':
  14155. case 'dt':
  14156. return ancestorInfo.dlItemTagAutoclosing;
  14157. case 'button':
  14158. return ancestorInfo.buttonTagInScope;
  14159. case 'a':
  14160. // Spec says something about storing a list of markers, but it sounds
  14161. // equivalent to this check.
  14162. return ancestorInfo.aTagInScope;
  14163. case 'nobr':
  14164. return ancestorInfo.nobrTagInScope;
  14165. }
  14166. return null;
  14167. };
  14168. /**
  14169. * Given a ReactCompositeComponent instance, return a list of its recursive
  14170. * owners, starting at the root and ending with the instance itself.
  14171. */
  14172. var findOwnerStack = function (instance) {
  14173. if (!instance) {
  14174. return [];
  14175. }
  14176. var stack = [];
  14177. do {
  14178. stack.push(instance);
  14179. } while (instance = instance._currentElement._owner);
  14180. stack.reverse();
  14181. return stack;
  14182. };
  14183. var didWarn = {};
  14184. validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
  14185. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  14186. var parentInfo = ancestorInfo.current;
  14187. var parentTag = parentInfo && parentInfo.tag;
  14188. if (childText != null) {
  14189. process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
  14190. childTag = '#text';
  14191. }
  14192. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  14193. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  14194. var problematic = invalidParent || invalidAncestor;
  14195. if (problematic) {
  14196. var ancestorTag = problematic.tag;
  14197. var ancestorInstance = problematic.instance;
  14198. var childOwner = childInstance && childInstance._currentElement._owner;
  14199. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  14200. var childOwners = findOwnerStack(childOwner);
  14201. var ancestorOwners = findOwnerStack(ancestorOwner);
  14202. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  14203. var i;
  14204. var deepestCommon = -1;
  14205. for (i = 0; i < minStackLen; i++) {
  14206. if (childOwners[i] === ancestorOwners[i]) {
  14207. deepestCommon = i;
  14208. } else {
  14209. break;
  14210. }
  14211. }
  14212. var UNKNOWN = '(unknown)';
  14213. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  14214. return inst.getName() || UNKNOWN;
  14215. });
  14216. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  14217. return inst.getName() || UNKNOWN;
  14218. });
  14219. var ownerInfo = [].concat(
  14220. // If the parent and child instances have a common owner ancestor, start
  14221. // with that -- otherwise we just start with the parent's owners.
  14222. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  14223. // If we're warning about an invalid (non-parent) ancestry, add '...'
  14224. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  14225. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  14226. if (didWarn[warnKey]) {
  14227. return;
  14228. }
  14229. didWarn[warnKey] = true;
  14230. var tagDisplayName = childTag;
  14231. var whitespaceInfo = '';
  14232. if (childTag === '#text') {
  14233. if (/\S/.test(childText)) {
  14234. tagDisplayName = 'Text nodes';
  14235. } else {
  14236. tagDisplayName = 'Whitespace text nodes';
  14237. whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
  14238. }
  14239. } else {
  14240. tagDisplayName = '<' + childTag + '>';
  14241. }
  14242. if (invalidParent) {
  14243. var info = '';
  14244. if (ancestorTag === 'table' && childTag === 'tr') {
  14245. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  14246. }
  14247. 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;
  14248. } else {
  14249. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
  14250. }
  14251. }
  14252. };
  14253. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  14254. // For testing
  14255. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  14256. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  14257. var parentInfo = ancestorInfo.current;
  14258. var parentTag = parentInfo && parentInfo.tag;
  14259. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  14260. };
  14261. }
  14262. module.exports = validateDOMNesting;
  14263. /***/ }),
  14264. /* 67 */
  14265. /***/ (function(module, exports, __webpack_require__) {
  14266. "use strict";
  14267. /**
  14268. * Copyright 2013-present, Facebook, Inc.
  14269. * All rights reserved.
  14270. *
  14271. * This source code is licensed under the BSD-style license found in the
  14272. * LICENSE file in the root directory of this source tree. An additional grant
  14273. * of patent rights can be found in the PATENTS file in the same directory.
  14274. *
  14275. */
  14276. var _prodInvariant = __webpack_require__(23);
  14277. var ReactNoopUpdateQueue = __webpack_require__(68);
  14278. var canDefineProperty = __webpack_require__(98);
  14279. var emptyObject = __webpack_require__(25);
  14280. var invariant = __webpack_require__(0);
  14281. var warning = __webpack_require__(1);
  14282. /**
  14283. * Base class helpers for the updating state of a component.
  14284. */
  14285. function ReactComponent(props, context, updater) {
  14286. this.props = props;
  14287. this.context = context;
  14288. this.refs = emptyObject;
  14289. // We initialize the default updater but the real one gets injected by the
  14290. // renderer.
  14291. this.updater = updater || ReactNoopUpdateQueue;
  14292. }
  14293. ReactComponent.prototype.isReactComponent = {};
  14294. /**
  14295. * Sets a subset of the state. Always use this to mutate
  14296. * state. You should treat `this.state` as immutable.
  14297. *
  14298. * There is no guarantee that `this.state` will be immediately updated, so
  14299. * accessing `this.state` after calling this method may return the old value.
  14300. *
  14301. * There is no guarantee that calls to `setState` will run synchronously,
  14302. * as they may eventually be batched together. You can provide an optional
  14303. * callback that will be executed when the call to setState is actually
  14304. * completed.
  14305. *
  14306. * When a function is provided to setState, it will be called at some point in
  14307. * the future (not synchronously). It will be called with the up to date
  14308. * component arguments (state, props, context). These values can be different
  14309. * from this.* because your function may be called after receiveProps but before
  14310. * shouldComponentUpdate, and this new state, props, and context will not yet be
  14311. * assigned to this.
  14312. *
  14313. * @param {object|function} partialState Next partial state or function to
  14314. * produce next partial state to be merged with current state.
  14315. * @param {?function} callback Called after state is updated.
  14316. * @final
  14317. * @protected
  14318. */
  14319. ReactComponent.prototype.setState = function (partialState, callback) {
  14320. !(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;
  14321. this.updater.enqueueSetState(this, partialState);
  14322. if (callback) {
  14323. this.updater.enqueueCallback(this, callback, 'setState');
  14324. }
  14325. };
  14326. /**
  14327. * Forces an update. This should only be invoked when it is known with
  14328. * certainty that we are **not** in a DOM transaction.
  14329. *
  14330. * You may want to call this when you know that some deeper aspect of the
  14331. * component's state has changed but `setState` was not called.
  14332. *
  14333. * This will not invoke `shouldComponentUpdate`, but it will invoke
  14334. * `componentWillUpdate` and `componentDidUpdate`.
  14335. *
  14336. * @param {?function} callback Called after update is complete.
  14337. * @final
  14338. * @protected
  14339. */
  14340. ReactComponent.prototype.forceUpdate = function (callback) {
  14341. this.updater.enqueueForceUpdate(this);
  14342. if (callback) {
  14343. this.updater.enqueueCallback(this, callback, 'forceUpdate');
  14344. }
  14345. };
  14346. /**
  14347. * Deprecated APIs. These APIs used to exist on classic React classes but since
  14348. * we would like to deprecate them, we're not going to move them over to this
  14349. * modern base class. Instead, we define a getter that warns if it's accessed.
  14350. */
  14351. if (false) {
  14352. var deprecatedAPIs = {
  14353. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  14354. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  14355. };
  14356. var defineDeprecationWarning = function (methodName, info) {
  14357. if (canDefineProperty) {
  14358. Object.defineProperty(ReactComponent.prototype, methodName, {
  14359. get: function () {
  14360. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
  14361. return undefined;
  14362. }
  14363. });
  14364. }
  14365. };
  14366. for (var fnName in deprecatedAPIs) {
  14367. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  14368. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  14369. }
  14370. }
  14371. }
  14372. module.exports = ReactComponent;
  14373. /***/ }),
  14374. /* 68 */
  14375. /***/ (function(module, exports, __webpack_require__) {
  14376. "use strict";
  14377. /**
  14378. * Copyright 2015-present, Facebook, Inc.
  14379. * All rights reserved.
  14380. *
  14381. * This source code is licensed under the BSD-style license found in the
  14382. * LICENSE file in the root directory of this source tree. An additional grant
  14383. * of patent rights can be found in the PATENTS file in the same directory.
  14384. *
  14385. */
  14386. var warning = __webpack_require__(1);
  14387. function warnNoop(publicInstance, callerName) {
  14388. if (false) {
  14389. var constructor = publicInstance.constructor;
  14390. 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;
  14391. }
  14392. }
  14393. /**
  14394. * This is the abstract API for an update queue.
  14395. */
  14396. var ReactNoopUpdateQueue = {
  14397. /**
  14398. * Checks whether or not this composite component is mounted.
  14399. * @param {ReactClass} publicInstance The instance we want to test.
  14400. * @return {boolean} True if mounted, false otherwise.
  14401. * @protected
  14402. * @final
  14403. */
  14404. isMounted: function (publicInstance) {
  14405. return false;
  14406. },
  14407. /**
  14408. * Enqueue a callback that will be executed after all the pending updates
  14409. * have processed.
  14410. *
  14411. * @param {ReactClass} publicInstance The instance to use as `this` context.
  14412. * @param {?function} callback Called after state is updated.
  14413. * @internal
  14414. */
  14415. enqueueCallback: function (publicInstance, callback) {},
  14416. /**
  14417. * Forces an update. This should only be invoked when it is known with
  14418. * certainty that we are **not** in a DOM transaction.
  14419. *
  14420. * You may want to call this when you know that some deeper aspect of the
  14421. * component's state has changed but `setState` was not called.
  14422. *
  14423. * This will not invoke `shouldComponentUpdate`, but it will invoke
  14424. * `componentWillUpdate` and `componentDidUpdate`.
  14425. *
  14426. * @param {ReactClass} publicInstance The instance that should rerender.
  14427. * @internal
  14428. */
  14429. enqueueForceUpdate: function (publicInstance) {
  14430. warnNoop(publicInstance, 'forceUpdate');
  14431. },
  14432. /**
  14433. * Replaces all of the state. Always use this or `setState` to mutate state.
  14434. * You should treat `this.state` as immutable.
  14435. *
  14436. * There is no guarantee that `this.state` will be immediately updated, so
  14437. * accessing `this.state` after calling this method may return the old value.
  14438. *
  14439. * @param {ReactClass} publicInstance The instance that should rerender.
  14440. * @param {object} completeState Next state.
  14441. * @internal
  14442. */
  14443. enqueueReplaceState: function (publicInstance, completeState) {
  14444. warnNoop(publicInstance, 'replaceState');
  14445. },
  14446. /**
  14447. * Sets a subset of the state. This only exists because _pendingState is
  14448. * internal. This provides a merging strategy that is not available to deep
  14449. * properties which is confusing. TODO: Expose pendingState or don't use it
  14450. * during the merge.
  14451. *
  14452. * @param {ReactClass} publicInstance The instance that should rerender.
  14453. * @param {object} partialState Next partial state to be merged with state.
  14454. * @internal
  14455. */
  14456. enqueueSetState: function (publicInstance, partialState) {
  14457. warnNoop(publicInstance, 'setState');
  14458. }
  14459. };
  14460. module.exports = ReactNoopUpdateQueue;
  14461. /***/ }),
  14462. /* 69 */
  14463. /***/ (function(module, exports, __webpack_require__) {
  14464. "use strict";
  14465. exports.version = [3, 3, 1, 5123];
  14466. /***/ }),
  14467. /* 70 */
  14468. /***/ (function(module, exports, __webpack_require__) {
  14469. "use strict";
  14470. /**
  14471. * kw
  14472. * @author oldj
  14473. * @blog http://oldj.net
  14474. */
  14475. function kw2re(kw) {
  14476. // 模糊搜索
  14477. var r = void 0;
  14478. var m = void 0;
  14479. var flag = [];
  14480. if (kw === '/') {
  14481. return;
  14482. } else if (m = kw.match(/^\/([^\/]+)\/?(\w*)$/)) {
  14483. if (m[2].indexOf('i') > -1) {
  14484. flag.push('i');
  14485. }
  14486. // if (m[2].indexOf('g') > -1) {
  14487. flag.push('g');
  14488. // }
  14489. try {
  14490. r = new RegExp(m[1], flag.join(''));
  14491. } catch (e) {}
  14492. } else if (kw.indexOf('*') > -1) {
  14493. try {
  14494. r = new RegExp(kw.replace(/\*/g, '.*'), 'ig');
  14495. } catch (e) {}
  14496. }
  14497. return r;
  14498. }
  14499. exports.findPositions = function (kw, code) {
  14500. if (!kw || kw === '/') return [];
  14501. var r = kw2re(kw);
  14502. if (!r) {
  14503. try {
  14504. r = new RegExp(kw.replace(/([\.\?\*\+\^\$\(\)\-\[\]\{\}])/g, '\\$1'), 'ig');
  14505. } catch (e) {
  14506. console.log(e);
  14507. return [];
  14508. }
  14509. }
  14510. var indexes = [];
  14511. var lines = code.split('\n');
  14512. lines.map(function (ln, idx) {
  14513. var match = void 0;
  14514. var max_loop = 30;
  14515. while (match = r.exec(ln)) {
  14516. indexes.push([{ line: idx, ch: match.index }, { line: idx, ch: match.index + match[0].length }]);
  14517. max_loop--;
  14518. if (max_loop < 0) break;
  14519. }
  14520. });
  14521. return indexes;
  14522. };
  14523. exports.kw2re = kw2re;
  14524. /***/ }),
  14525. /* 71 */
  14526. /***/ (function(module, exports, __webpack_require__) {
  14527. "use strict";
  14528. /**
  14529. * Copyright (c) 2013-present, Facebook, Inc.
  14530. *
  14531. * Licensed under the Apache License, Version 2.0 (the "License");
  14532. * you may not use this file except in compliance with the License.
  14533. * You may obtain a copy of the License at
  14534. *
  14535. * http://www.apache.org/licenses/LICENSE-2.0
  14536. *
  14537. * Unless required by applicable law or agreed to in writing, software
  14538. * distributed under the License is distributed on an "AS IS" BASIS,
  14539. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14540. * See the License for the specific language governing permissions and
  14541. * limitations under the License.
  14542. *
  14543. * @typechecks
  14544. */
  14545. var emptyFunction = __webpack_require__(10);
  14546. /**
  14547. * Upstream version of event listener. Does not take into account specific
  14548. * nature of platform.
  14549. */
  14550. var EventListener = {
  14551. /**
  14552. * Listen to DOM events during the bubble phase.
  14553. *
  14554. * @param {DOMEventTarget} target DOM element to register listener on.
  14555. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14556. * @param {function} callback Callback function.
  14557. * @return {object} Object with a `remove` method.
  14558. */
  14559. listen: function listen(target, eventType, callback) {
  14560. if (target.addEventListener) {
  14561. target.addEventListener(eventType, callback, false);
  14562. return {
  14563. remove: function remove() {
  14564. target.removeEventListener(eventType, callback, false);
  14565. }
  14566. };
  14567. } else if (target.attachEvent) {
  14568. target.attachEvent('on' + eventType, callback);
  14569. return {
  14570. remove: function remove() {
  14571. target.detachEvent('on' + eventType, callback);
  14572. }
  14573. };
  14574. }
  14575. },
  14576. /**
  14577. * Listen to DOM events during the capture phase.
  14578. *
  14579. * @param {DOMEventTarget} target DOM element to register listener on.
  14580. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14581. * @param {function} callback Callback function.
  14582. * @return {object} Object with a `remove` method.
  14583. */
  14584. capture: function capture(target, eventType, callback) {
  14585. if (target.addEventListener) {
  14586. target.addEventListener(eventType, callback, true);
  14587. return {
  14588. remove: function remove() {
  14589. target.removeEventListener(eventType, callback, true);
  14590. }
  14591. };
  14592. } else {
  14593. if (false) {
  14594. 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.');
  14595. }
  14596. return {
  14597. remove: emptyFunction
  14598. };
  14599. }
  14600. },
  14601. registerDefault: function registerDefault() {}
  14602. };
  14603. module.exports = EventListener;
  14604. /***/ }),
  14605. /* 72 */
  14606. /***/ (function(module, exports, __webpack_require__) {
  14607. "use strict";
  14608. /**
  14609. * Copyright (c) 2013-present, Facebook, Inc.
  14610. * All rights reserved.
  14611. *
  14612. * This source code is licensed under the BSD-style license found in the
  14613. * LICENSE file in the root directory of this source tree. An additional grant
  14614. * of patent rights can be found in the PATENTS file in the same directory.
  14615. *
  14616. */
  14617. /**
  14618. * @param {DOMElement} node input/textarea to focus
  14619. */
  14620. function focusNode(node) {
  14621. // IE8 can throw "Can't move focus to the control because it is invisible,
  14622. // not enabled, or of a type that does not accept the focus." for all kinds of
  14623. // reasons that are too expensive and fragile to test.
  14624. try {
  14625. node.focus();
  14626. } catch (e) {}
  14627. }
  14628. module.exports = focusNode;
  14629. /***/ }),
  14630. /* 73 */
  14631. /***/ (function(module, exports, __webpack_require__) {
  14632. "use strict";
  14633. /**
  14634. * Copyright (c) 2013-present, Facebook, Inc.
  14635. * All rights reserved.
  14636. *
  14637. * This source code is licensed under the BSD-style license found in the
  14638. * LICENSE file in the root directory of this source tree. An additional grant
  14639. * of patent rights can be found in the PATENTS file in the same directory.
  14640. *
  14641. * @typechecks
  14642. */
  14643. /* eslint-disable fb-www/typeof-undefined */
  14644. /**
  14645. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  14646. * not safe to call document.activeElement if there is nothing focused.
  14647. *
  14648. * The activeElement will be null only if the document or document body is not
  14649. * yet defined.
  14650. *
  14651. * @param {?DOMDocument} doc Defaults to current document.
  14652. * @return {?DOMElement}
  14653. */
  14654. function getActiveElement(doc) /*?DOMElement*/{
  14655. doc = doc || (typeof document !== 'undefined' ? document : undefined);
  14656. if (typeof doc === 'undefined') {
  14657. return null;
  14658. }
  14659. try {
  14660. return doc.activeElement || doc.body;
  14661. } catch (e) {
  14662. return doc.body;
  14663. }
  14664. }
  14665. module.exports = getActiveElement;
  14666. /***/ }),
  14667. /* 74 */
  14668. /***/ (function(module, exports) {
  14669. // shim for using process in browser
  14670. var process = module.exports = {};
  14671. // cached from whatever global is present so that test runners that stub it
  14672. // don't break things. But we need to wrap it in a try catch in case it is
  14673. // wrapped in strict mode code which doesn't define any globals. It's inside a
  14674. // function because try/catches deoptimize in certain engines.
  14675. var cachedSetTimeout;
  14676. var cachedClearTimeout;
  14677. function defaultSetTimout() {
  14678. throw new Error('setTimeout has not been defined');
  14679. }
  14680. function defaultClearTimeout () {
  14681. throw new Error('clearTimeout has not been defined');
  14682. }
  14683. (function () {
  14684. try {
  14685. if (typeof setTimeout === 'function') {
  14686. cachedSetTimeout = setTimeout;
  14687. } else {
  14688. cachedSetTimeout = defaultSetTimout;
  14689. }
  14690. } catch (e) {
  14691. cachedSetTimeout = defaultSetTimout;
  14692. }
  14693. try {
  14694. if (typeof clearTimeout === 'function') {
  14695. cachedClearTimeout = clearTimeout;
  14696. } else {
  14697. cachedClearTimeout = defaultClearTimeout;
  14698. }
  14699. } catch (e) {
  14700. cachedClearTimeout = defaultClearTimeout;
  14701. }
  14702. } ())
  14703. function runTimeout(fun) {
  14704. if (cachedSetTimeout === setTimeout) {
  14705. //normal enviroments in sane situations
  14706. return setTimeout(fun, 0);
  14707. }
  14708. // if setTimeout wasn't available but was latter defined
  14709. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  14710. cachedSetTimeout = setTimeout;
  14711. return setTimeout(fun, 0);
  14712. }
  14713. try {
  14714. // when when somebody has screwed with setTimeout but no I.E. maddness
  14715. return cachedSetTimeout(fun, 0);
  14716. } catch(e){
  14717. try {
  14718. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14719. return cachedSetTimeout.call(null, fun, 0);
  14720. } catch(e){
  14721. // 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
  14722. return cachedSetTimeout.call(this, fun, 0);
  14723. }
  14724. }
  14725. }
  14726. function runClearTimeout(marker) {
  14727. if (cachedClearTimeout === clearTimeout) {
  14728. //normal enviroments in sane situations
  14729. return clearTimeout(marker);
  14730. }
  14731. // if clearTimeout wasn't available but was latter defined
  14732. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  14733. cachedClearTimeout = clearTimeout;
  14734. return clearTimeout(marker);
  14735. }
  14736. try {
  14737. // when when somebody has screwed with setTimeout but no I.E. maddness
  14738. return cachedClearTimeout(marker);
  14739. } catch (e){
  14740. try {
  14741. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14742. return cachedClearTimeout.call(null, marker);
  14743. } catch (e){
  14744. // 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.
  14745. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  14746. return cachedClearTimeout.call(this, marker);
  14747. }
  14748. }
  14749. }
  14750. var queue = [];
  14751. var draining = false;
  14752. var currentQueue;
  14753. var queueIndex = -1;
  14754. function cleanUpNextTick() {
  14755. if (!draining || !currentQueue) {
  14756. return;
  14757. }
  14758. draining = false;
  14759. if (currentQueue.length) {
  14760. queue = currentQueue.concat(queue);
  14761. } else {
  14762. queueIndex = -1;
  14763. }
  14764. if (queue.length) {
  14765. drainQueue();
  14766. }
  14767. }
  14768. function drainQueue() {
  14769. if (draining) {
  14770. return;
  14771. }
  14772. var timeout = runTimeout(cleanUpNextTick);
  14773. draining = true;
  14774. var len = queue.length;
  14775. while(len) {
  14776. currentQueue = queue;
  14777. queue = [];
  14778. while (++queueIndex < len) {
  14779. if (currentQueue) {
  14780. currentQueue[queueIndex].run();
  14781. }
  14782. }
  14783. queueIndex = -1;
  14784. len = queue.length;
  14785. }
  14786. currentQueue = null;
  14787. draining = false;
  14788. runClearTimeout(timeout);
  14789. }
  14790. process.nextTick = function (fun) {
  14791. var args = new Array(arguments.length - 1);
  14792. if (arguments.length > 1) {
  14793. for (var i = 1; i < arguments.length; i++) {
  14794. args[i - 1] = arguments[i];
  14795. }
  14796. }
  14797. queue.push(new Item(fun, args));
  14798. if (queue.length === 1 && !draining) {
  14799. runTimeout(drainQueue);
  14800. }
  14801. };
  14802. // v8 likes predictible objects
  14803. function Item(fun, array) {
  14804. this.fun = fun;
  14805. this.array = array;
  14806. }
  14807. Item.prototype.run = function () {
  14808. this.fun.apply(null, this.array);
  14809. };
  14810. process.title = 'browser';
  14811. process.browser = true;
  14812. process.env = {};
  14813. process.argv = [];
  14814. process.version = ''; // empty string to avoid regexp issues
  14815. process.versions = {};
  14816. function noop() {}
  14817. process.on = noop;
  14818. process.addListener = noop;
  14819. process.once = noop;
  14820. process.off = noop;
  14821. process.removeListener = noop;
  14822. process.removeAllListeners = noop;
  14823. process.emit = noop;
  14824. process.binding = function (name) {
  14825. throw new Error('process.binding is not supported');
  14826. };
  14827. process.cwd = function () { return '/' };
  14828. process.chdir = function (dir) {
  14829. throw new Error('process.chdir is not supported');
  14830. };
  14831. process.umask = function() { return 0; };
  14832. /***/ }),
  14833. /* 75 */
  14834. /***/ (function(module, exports, __webpack_require__) {
  14835. "use strict";
  14836. /**
  14837. * Copyright 2013-present, Facebook, Inc.
  14838. * All rights reserved.
  14839. *
  14840. * This source code is licensed under the BSD-style license found in the
  14841. * LICENSE file in the root directory of this source tree. An additional grant
  14842. * of patent rights can be found in the PATENTS file in the same directory.
  14843. *
  14844. */
  14845. /**
  14846. * CSS properties which accept numbers but are not in units of "px".
  14847. */
  14848. var isUnitlessNumber = {
  14849. animationIterationCount: true,
  14850. borderImageOutset: true,
  14851. borderImageSlice: true,
  14852. borderImageWidth: true,
  14853. boxFlex: true,
  14854. boxFlexGroup: true,
  14855. boxOrdinalGroup: true,
  14856. columnCount: true,
  14857. flex: true,
  14858. flexGrow: true,
  14859. flexPositive: true,
  14860. flexShrink: true,
  14861. flexNegative: true,
  14862. flexOrder: true,
  14863. gridRow: true,
  14864. gridColumn: true,
  14865. fontWeight: true,
  14866. lineClamp: true,
  14867. lineHeight: true,
  14868. opacity: true,
  14869. order: true,
  14870. orphans: true,
  14871. tabSize: true,
  14872. widows: true,
  14873. zIndex: true,
  14874. zoom: true,
  14875. // SVG-related properties
  14876. fillOpacity: true,
  14877. floodOpacity: true,
  14878. stopOpacity: true,
  14879. strokeDasharray: true,
  14880. strokeDashoffset: true,
  14881. strokeMiterlimit: true,
  14882. strokeOpacity: true,
  14883. strokeWidth: true
  14884. };
  14885. /**
  14886. * @param {string} prefix vendor-specific prefix, eg: Webkit
  14887. * @param {string} key style name, eg: transitionDuration
  14888. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  14889. * WebkitTransitionDuration
  14890. */
  14891. function prefixKey(prefix, key) {
  14892. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  14893. }
  14894. /**
  14895. * Support style names that may come passed in prefixed by adding permutations
  14896. * of vendor prefixes.
  14897. */
  14898. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  14899. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  14900. // infinite loop, because it iterates over the newly added props too.
  14901. Object.keys(isUnitlessNumber).forEach(function (prop) {
  14902. prefixes.forEach(function (prefix) {
  14903. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  14904. });
  14905. });
  14906. /**
  14907. * Most style properties can be unset by doing .style[prop] = '' but IE8
  14908. * doesn't like doing that with shorthand properties so for the properties that
  14909. * IE8 breaks on, which are listed here, we instead unset each of the
  14910. * individual properties. See http://bugs.jquery.com/ticket/12385.
  14911. * The 4-value 'clock' properties like margin, padding, border-width seem to
  14912. * behave without any problems. Curiously, list-style works too without any
  14913. * special prodding.
  14914. */
  14915. var shorthandPropertyExpansions = {
  14916. background: {
  14917. backgroundAttachment: true,
  14918. backgroundColor: true,
  14919. backgroundImage: true,
  14920. backgroundPositionX: true,
  14921. backgroundPositionY: true,
  14922. backgroundRepeat: true
  14923. },
  14924. backgroundPosition: {
  14925. backgroundPositionX: true,
  14926. backgroundPositionY: true
  14927. },
  14928. border: {
  14929. borderWidth: true,
  14930. borderStyle: true,
  14931. borderColor: true
  14932. },
  14933. borderBottom: {
  14934. borderBottomWidth: true,
  14935. borderBottomStyle: true,
  14936. borderBottomColor: true
  14937. },
  14938. borderLeft: {
  14939. borderLeftWidth: true,
  14940. borderLeftStyle: true,
  14941. borderLeftColor: true
  14942. },
  14943. borderRight: {
  14944. borderRightWidth: true,
  14945. borderRightStyle: true,
  14946. borderRightColor: true
  14947. },
  14948. borderTop: {
  14949. borderTopWidth: true,
  14950. borderTopStyle: true,
  14951. borderTopColor: true
  14952. },
  14953. font: {
  14954. fontStyle: true,
  14955. fontVariant: true,
  14956. fontWeight: true,
  14957. fontSize: true,
  14958. lineHeight: true,
  14959. fontFamily: true
  14960. },
  14961. outline: {
  14962. outlineWidth: true,
  14963. outlineStyle: true,
  14964. outlineColor: true
  14965. }
  14966. };
  14967. var CSSProperty = {
  14968. isUnitlessNumber: isUnitlessNumber,
  14969. shorthandPropertyExpansions: shorthandPropertyExpansions
  14970. };
  14971. module.exports = CSSProperty;
  14972. /***/ }),
  14973. /* 76 */
  14974. /***/ (function(module, exports, __webpack_require__) {
  14975. "use strict";
  14976. /**
  14977. * Copyright 2013-present, Facebook, Inc.
  14978. * All rights reserved.
  14979. *
  14980. * This source code is licensed under the BSD-style license found in the
  14981. * LICENSE file in the root directory of this source tree. An additional grant
  14982. * of patent rights can be found in the PATENTS file in the same directory.
  14983. *
  14984. *
  14985. */
  14986. var _prodInvariant = __webpack_require__(2);
  14987. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14988. var PooledClass = __webpack_require__(16);
  14989. var invariant = __webpack_require__(0);
  14990. /**
  14991. * A specialized pseudo-event module to help keep track of components waiting to
  14992. * be notified when their DOM representations are available for use.
  14993. *
  14994. * This implements `PooledClass`, so you should never need to instantiate this.
  14995. * Instead, use `CallbackQueue.getPooled()`.
  14996. *
  14997. * @class ReactMountReady
  14998. * @implements PooledClass
  14999. * @internal
  15000. */
  15001. var CallbackQueue = function () {
  15002. function CallbackQueue(arg) {
  15003. _classCallCheck(this, CallbackQueue);
  15004. this._callbacks = null;
  15005. this._contexts = null;
  15006. this._arg = arg;
  15007. }
  15008. /**
  15009. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  15010. *
  15011. * @param {function} callback Invoked when `notifyAll` is invoked.
  15012. * @param {?object} context Context to call `callback` with.
  15013. * @internal
  15014. */
  15015. CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
  15016. this._callbacks = this._callbacks || [];
  15017. this._callbacks.push(callback);
  15018. this._contexts = this._contexts || [];
  15019. this._contexts.push(context);
  15020. };
  15021. /**
  15022. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  15023. * the DOM representation of a component has been created or updated.
  15024. *
  15025. * @internal
  15026. */
  15027. CallbackQueue.prototype.notifyAll = function notifyAll() {
  15028. var callbacks = this._callbacks;
  15029. var contexts = this._contexts;
  15030. var arg = this._arg;
  15031. if (callbacks && contexts) {
  15032. !(callbacks.length === contexts.length) ? false ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
  15033. this._callbacks = null;
  15034. this._contexts = null;
  15035. for (var i = 0; i < callbacks.length; i++) {
  15036. callbacks[i].call(contexts[i], arg);
  15037. }
  15038. callbacks.length = 0;
  15039. contexts.length = 0;
  15040. }
  15041. };
  15042. CallbackQueue.prototype.checkpoint = function checkpoint() {
  15043. return this._callbacks ? this._callbacks.length : 0;
  15044. };
  15045. CallbackQueue.prototype.rollback = function rollback(len) {
  15046. if (this._callbacks && this._contexts) {
  15047. this._callbacks.length = len;
  15048. this._contexts.length = len;
  15049. }
  15050. };
  15051. /**
  15052. * Resets the internal queue.
  15053. *
  15054. * @internal
  15055. */
  15056. CallbackQueue.prototype.reset = function reset() {
  15057. this._callbacks = null;
  15058. this._contexts = null;
  15059. };
  15060. /**
  15061. * `PooledClass` looks for this.
  15062. */
  15063. CallbackQueue.prototype.destructor = function destructor() {
  15064. this.reset();
  15065. };
  15066. return CallbackQueue;
  15067. }();
  15068. module.exports = PooledClass.addPoolingTo(CallbackQueue);
  15069. /***/ }),
  15070. /* 77 */
  15071. /***/ (function(module, exports, __webpack_require__) {
  15072. "use strict";
  15073. /**
  15074. * Copyright 2013-present, Facebook, Inc.
  15075. * All rights reserved.
  15076. *
  15077. * This source code is licensed under the BSD-style license found in the
  15078. * LICENSE file in the root directory of this source tree. An additional grant
  15079. * of patent rights can be found in the PATENTS file in the same directory.
  15080. *
  15081. */
  15082. var DOMProperty = __webpack_require__(19);
  15083. var ReactDOMComponentTree = __webpack_require__(5);
  15084. var ReactInstrumentation = __webpack_require__(11);
  15085. var quoteAttributeValueForBrowser = __webpack_require__(211);
  15086. var warning = __webpack_require__(1);
  15087. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  15088. var illegalAttributeNameCache = {};
  15089. var validatedAttributeNameCache = {};
  15090. function isAttributeNameSafe(attributeName) {
  15091. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  15092. return true;
  15093. }
  15094. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  15095. return false;
  15096. }
  15097. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  15098. validatedAttributeNameCache[attributeName] = true;
  15099. return true;
  15100. }
  15101. illegalAttributeNameCache[attributeName] = true;
  15102. false ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
  15103. return false;
  15104. }
  15105. function shouldIgnoreValue(propertyInfo, value) {
  15106. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  15107. }
  15108. /**
  15109. * Operations for dealing with DOM properties.
  15110. */
  15111. var DOMPropertyOperations = {
  15112. /**
  15113. * Creates markup for the ID property.
  15114. *
  15115. * @param {string} id Unescaped ID.
  15116. * @return {string} Markup string.
  15117. */
  15118. createMarkupForID: function (id) {
  15119. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  15120. },
  15121. setAttributeForID: function (node, id) {
  15122. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  15123. },
  15124. createMarkupForRoot: function () {
  15125. return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
  15126. },
  15127. setAttributeForRoot: function (node) {
  15128. node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
  15129. },
  15130. /**
  15131. * Creates markup for a property.
  15132. *
  15133. * @param {string} name
  15134. * @param {*} value
  15135. * @return {?string} Markup string, or null if the property was invalid.
  15136. */
  15137. createMarkupForProperty: function (name, value) {
  15138. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  15139. if (propertyInfo) {
  15140. if (shouldIgnoreValue(propertyInfo, value)) {
  15141. return '';
  15142. }
  15143. var attributeName = propertyInfo.attributeName;
  15144. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  15145. return attributeName + '=""';
  15146. }
  15147. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  15148. } else if (DOMProperty.isCustomAttribute(name)) {
  15149. if (value == null) {
  15150. return '';
  15151. }
  15152. return name + '=' + quoteAttributeValueForBrowser(value);
  15153. }
  15154. return null;
  15155. },
  15156. /**
  15157. * Creates markup for a custom property.
  15158. *
  15159. * @param {string} name
  15160. * @param {*} value
  15161. * @return {string} Markup string, or empty string if the property was invalid.
  15162. */
  15163. createMarkupForCustomAttribute: function (name, value) {
  15164. if (!isAttributeNameSafe(name) || value == null) {
  15165. return '';
  15166. }
  15167. return name + '=' + quoteAttributeValueForBrowser(value);
  15168. },
  15169. /**
  15170. * Sets the value for a property on a node.
  15171. *
  15172. * @param {DOMElement} node
  15173. * @param {string} name
  15174. * @param {*} value
  15175. */
  15176. setValueForProperty: function (node, name, value) {
  15177. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  15178. if (propertyInfo) {
  15179. var mutationMethod = propertyInfo.mutationMethod;
  15180. if (mutationMethod) {
  15181. mutationMethod(node, value);
  15182. } else if (shouldIgnoreValue(propertyInfo, value)) {
  15183. this.deleteValueForProperty(node, name);
  15184. return;
  15185. } else if (propertyInfo.mustUseProperty) {
  15186. // Contrary to `setAttribute`, object properties are properly
  15187. // `toString`ed by IE8/9.
  15188. node[propertyInfo.propertyName] = value;
  15189. } else {
  15190. var attributeName = propertyInfo.attributeName;
  15191. var namespace = propertyInfo.attributeNamespace;
  15192. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  15193. // ('' + value) makes it output the correct toString()-value.
  15194. if (namespace) {
  15195. node.setAttributeNS(namespace, attributeName, '' + value);
  15196. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  15197. node.setAttribute(attributeName, '');
  15198. } else {
  15199. node.setAttribute(attributeName, '' + value);
  15200. }
  15201. }
  15202. } else if (DOMProperty.isCustomAttribute(name)) {
  15203. DOMPropertyOperations.setValueForAttribute(node, name, value);
  15204. return;
  15205. }
  15206. if (false) {
  15207. var payload = {};
  15208. payload[name] = value;
  15209. ReactInstrumentation.debugTool.onHostOperation({
  15210. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15211. type: 'update attribute',
  15212. payload: payload
  15213. });
  15214. }
  15215. },
  15216. setValueForAttribute: function (node, name, value) {
  15217. if (!isAttributeNameSafe(name)) {
  15218. return;
  15219. }
  15220. if (value == null) {
  15221. node.removeAttribute(name);
  15222. } else {
  15223. node.setAttribute(name, '' + value);
  15224. }
  15225. if (false) {
  15226. var payload = {};
  15227. payload[name] = value;
  15228. ReactInstrumentation.debugTool.onHostOperation({
  15229. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15230. type: 'update attribute',
  15231. payload: payload
  15232. });
  15233. }
  15234. },
  15235. /**
  15236. * Deletes an attributes from a node.
  15237. *
  15238. * @param {DOMElement} node
  15239. * @param {string} name
  15240. */
  15241. deleteValueForAttribute: function (node, name) {
  15242. node.removeAttribute(name);
  15243. if (false) {
  15244. ReactInstrumentation.debugTool.onHostOperation({
  15245. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15246. type: 'remove attribute',
  15247. payload: name
  15248. });
  15249. }
  15250. },
  15251. /**
  15252. * Deletes the value for a property on a node.
  15253. *
  15254. * @param {DOMElement} node
  15255. * @param {string} name
  15256. */
  15257. deleteValueForProperty: function (node, name) {
  15258. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  15259. if (propertyInfo) {
  15260. var mutationMethod = propertyInfo.mutationMethod;
  15261. if (mutationMethod) {
  15262. mutationMethod(node, undefined);
  15263. } else if (propertyInfo.mustUseProperty) {
  15264. var propName = propertyInfo.propertyName;
  15265. if (propertyInfo.hasBooleanValue) {
  15266. node[propName] = false;
  15267. } else {
  15268. node[propName] = '';
  15269. }
  15270. } else {
  15271. node.removeAttribute(propertyInfo.attributeName);
  15272. }
  15273. } else if (DOMProperty.isCustomAttribute(name)) {
  15274. node.removeAttribute(name);
  15275. }
  15276. if (false) {
  15277. ReactInstrumentation.debugTool.onHostOperation({
  15278. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15279. type: 'remove attribute',
  15280. payload: name
  15281. });
  15282. }
  15283. }
  15284. };
  15285. module.exports = DOMPropertyOperations;
  15286. /***/ }),
  15287. /* 78 */
  15288. /***/ (function(module, exports, __webpack_require__) {
  15289. "use strict";
  15290. /**
  15291. * Copyright 2015-present, Facebook, Inc.
  15292. * All rights reserved.
  15293. *
  15294. * This source code is licensed under the BSD-style license found in the
  15295. * LICENSE file in the root directory of this source tree. An additional grant
  15296. * of patent rights can be found in the PATENTS file in the same directory.
  15297. *
  15298. */
  15299. var ReactDOMComponentFlags = {
  15300. hasCachedChildNodes: 1 << 0
  15301. };
  15302. module.exports = ReactDOMComponentFlags;
  15303. /***/ }),
  15304. /* 79 */
  15305. /***/ (function(module, exports, __webpack_require__) {
  15306. "use strict";
  15307. /**
  15308. * Copyright 2013-present, Facebook, Inc.
  15309. * All rights reserved.
  15310. *
  15311. * This source code is licensed under the BSD-style license found in the
  15312. * LICENSE file in the root directory of this source tree. An additional grant
  15313. * of patent rights can be found in the PATENTS file in the same directory.
  15314. *
  15315. */
  15316. var _assign = __webpack_require__(3);
  15317. var LinkedValueUtils = __webpack_require__(56);
  15318. var ReactDOMComponentTree = __webpack_require__(5);
  15319. var ReactUpdates = __webpack_require__(12);
  15320. var warning = __webpack_require__(1);
  15321. var didWarnValueLink = false;
  15322. var didWarnValueDefaultValue = false;
  15323. function updateOptionsIfPendingUpdateAndMounted() {
  15324. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  15325. this._wrapperState.pendingUpdate = false;
  15326. var props = this._currentElement.props;
  15327. var value = LinkedValueUtils.getValue(props);
  15328. if (value != null) {
  15329. updateOptions(this, Boolean(props.multiple), value);
  15330. }
  15331. }
  15332. }
  15333. function getDeclarationErrorAddendum(owner) {
  15334. if (owner) {
  15335. var name = owner.getName();
  15336. if (name) {
  15337. return ' Check the render method of `' + name + '`.';
  15338. }
  15339. }
  15340. return '';
  15341. }
  15342. var valuePropNames = ['value', 'defaultValue'];
  15343. /**
  15344. * Validation function for `value` and `defaultValue`.
  15345. * @private
  15346. */
  15347. function checkSelectPropTypes(inst, props) {
  15348. var owner = inst._currentElement._owner;
  15349. LinkedValueUtils.checkPropTypes('select', props, owner);
  15350. if (props.valueLink !== undefined && !didWarnValueLink) {
  15351. false ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
  15352. didWarnValueLink = true;
  15353. }
  15354. for (var i = 0; i < valuePropNames.length; i++) {
  15355. var propName = valuePropNames[i];
  15356. if (props[propName] == null) {
  15357. continue;
  15358. }
  15359. var isArray = Array.isArray(props[propName]);
  15360. if (props.multiple && !isArray) {
  15361. false ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  15362. } else if (!props.multiple && isArray) {
  15363. false ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  15364. }
  15365. }
  15366. }
  15367. /**
  15368. * @param {ReactDOMComponent} inst
  15369. * @param {boolean} multiple
  15370. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  15371. * @private
  15372. */
  15373. function updateOptions(inst, multiple, propValue) {
  15374. var selectedValue, i;
  15375. var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
  15376. if (multiple) {
  15377. selectedValue = {};
  15378. for (i = 0; i < propValue.length; i++) {
  15379. selectedValue['' + propValue[i]] = true;
  15380. }
  15381. for (i = 0; i < options.length; i++) {
  15382. var selected = selectedValue.hasOwnProperty(options[i].value);
  15383. if (options[i].selected !== selected) {
  15384. options[i].selected = selected;
  15385. }
  15386. }
  15387. } else {
  15388. // Do not set `select.value` as exact behavior isn't consistent across all
  15389. // browsers for all cases.
  15390. selectedValue = '' + propValue;
  15391. for (i = 0; i < options.length; i++) {
  15392. if (options[i].value === selectedValue) {
  15393. options[i].selected = true;
  15394. return;
  15395. }
  15396. }
  15397. if (options.length) {
  15398. options[0].selected = true;
  15399. }
  15400. }
  15401. }
  15402. /**
  15403. * Implements a <select> host component that allows optionally setting the
  15404. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  15405. * stringable. If `multiple` is true, the prop must be an array of stringables.
  15406. *
  15407. * If `value` is not supplied (or null/undefined), user actions that change the
  15408. * selected option will trigger updates to the rendered options.
  15409. *
  15410. * If it is supplied (and not null/undefined), the rendered options will not
  15411. * update in response to user actions. Instead, the `value` prop must change in
  15412. * order for the rendered options to update.
  15413. *
  15414. * If `defaultValue` is provided, any options with the supplied values will be
  15415. * selected.
  15416. */
  15417. var ReactDOMSelect = {
  15418. getHostProps: function (inst, props) {
  15419. return _assign({}, props, {
  15420. onChange: inst._wrapperState.onChange,
  15421. value: undefined
  15422. });
  15423. },
  15424. mountWrapper: function (inst, props) {
  15425. if (false) {
  15426. checkSelectPropTypes(inst, props);
  15427. }
  15428. var value = LinkedValueUtils.getValue(props);
  15429. inst._wrapperState = {
  15430. pendingUpdate: false,
  15431. initialValue: value != null ? value : props.defaultValue,
  15432. listeners: null,
  15433. onChange: _handleChange.bind(inst),
  15434. wasMultiple: Boolean(props.multiple)
  15435. };
  15436. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  15437. 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;
  15438. didWarnValueDefaultValue = true;
  15439. }
  15440. },
  15441. getSelectValueContext: function (inst) {
  15442. // ReactDOMOption looks at this initial value so the initial generated
  15443. // markup has correct `selected` attributes
  15444. return inst._wrapperState.initialValue;
  15445. },
  15446. postUpdateWrapper: function (inst) {
  15447. var props = inst._currentElement.props;
  15448. // After the initial mount, we control selected-ness manually so don't pass
  15449. // this value down
  15450. inst._wrapperState.initialValue = undefined;
  15451. var wasMultiple = inst._wrapperState.wasMultiple;
  15452. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  15453. var value = LinkedValueUtils.getValue(props);
  15454. if (value != null) {
  15455. inst._wrapperState.pendingUpdate = false;
  15456. updateOptions(inst, Boolean(props.multiple), value);
  15457. } else if (wasMultiple !== Boolean(props.multiple)) {
  15458. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  15459. if (props.defaultValue != null) {
  15460. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  15461. } else {
  15462. // Revert the select back to its default unselected state.
  15463. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  15464. }
  15465. }
  15466. }
  15467. };
  15468. function _handleChange(event) {
  15469. var props = this._currentElement.props;
  15470. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  15471. if (this._rootNodeID) {
  15472. this._wrapperState.pendingUpdate = true;
  15473. }
  15474. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  15475. return returnValue;
  15476. }
  15477. module.exports = ReactDOMSelect;
  15478. /***/ }),
  15479. /* 80 */
  15480. /***/ (function(module, exports, __webpack_require__) {
  15481. "use strict";
  15482. /**
  15483. * Copyright 2014-present, Facebook, Inc.
  15484. * All rights reserved.
  15485. *
  15486. * This source code is licensed under the BSD-style license found in the
  15487. * LICENSE file in the root directory of this source tree. An additional grant
  15488. * of patent rights can be found in the PATENTS file in the same directory.
  15489. *
  15490. */
  15491. var emptyComponentFactory;
  15492. var ReactEmptyComponentInjection = {
  15493. injectEmptyComponentFactory: function (factory) {
  15494. emptyComponentFactory = factory;
  15495. }
  15496. };
  15497. var ReactEmptyComponent = {
  15498. create: function (instantiate) {
  15499. return emptyComponentFactory(instantiate);
  15500. }
  15501. };
  15502. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  15503. module.exports = ReactEmptyComponent;
  15504. /***/ }),
  15505. /* 81 */
  15506. /***/ (function(module, exports, __webpack_require__) {
  15507. "use strict";
  15508. /**
  15509. * Copyright 2013-present, Facebook, Inc.
  15510. * All rights reserved.
  15511. *
  15512. * This source code is licensed under the BSD-style license found in the
  15513. * LICENSE file in the root directory of this source tree. An additional grant
  15514. * of patent rights can be found in the PATENTS file in the same directory.
  15515. *
  15516. *
  15517. */
  15518. var ReactFeatureFlags = {
  15519. // When true, call console.time() before and .timeEnd() after each top-level
  15520. // render (both initial renders and updates). Useful when looking at prod-mode
  15521. // timeline profiles in Chrome, for example.
  15522. logTopLevelRenders: false
  15523. };
  15524. module.exports = ReactFeatureFlags;
  15525. /***/ }),
  15526. /* 82 */
  15527. /***/ (function(module, exports, __webpack_require__) {
  15528. "use strict";
  15529. /**
  15530. * Copyright 2014-present, Facebook, Inc.
  15531. * All rights reserved.
  15532. *
  15533. * This source code is licensed under the BSD-style license found in the
  15534. * LICENSE file in the root directory of this source tree. An additional grant
  15535. * of patent rights can be found in the PATENTS file in the same directory.
  15536. *
  15537. */
  15538. var _prodInvariant = __webpack_require__(2);
  15539. var invariant = __webpack_require__(0);
  15540. var genericComponentClass = null;
  15541. var textComponentClass = null;
  15542. var ReactHostComponentInjection = {
  15543. // This accepts a class that receives the tag string. This is a catch all
  15544. // that can render any kind of tag.
  15545. injectGenericComponentClass: function (componentClass) {
  15546. genericComponentClass = componentClass;
  15547. },
  15548. // This accepts a text component class that takes the text string to be
  15549. // rendered as props.
  15550. injectTextComponentClass: function (componentClass) {
  15551. textComponentClass = componentClass;
  15552. }
  15553. };
  15554. /**
  15555. * Get a host internal component class for a specific tag.
  15556. *
  15557. * @param {ReactElement} element The element to create.
  15558. * @return {function} The internal class constructor function.
  15559. */
  15560. function createInternalComponent(element) {
  15561. !genericComponentClass ? false ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
  15562. return new genericComponentClass(element);
  15563. }
  15564. /**
  15565. * @param {ReactText} text
  15566. * @return {ReactComponent}
  15567. */
  15568. function createInstanceForText(text) {
  15569. return new textComponentClass(text);
  15570. }
  15571. /**
  15572. * @param {ReactComponent} component
  15573. * @return {boolean}
  15574. */
  15575. function isTextComponent(component) {
  15576. return component instanceof textComponentClass;
  15577. }
  15578. var ReactHostComponent = {
  15579. createInternalComponent: createInternalComponent,
  15580. createInstanceForText: createInstanceForText,
  15581. isTextComponent: isTextComponent,
  15582. injection: ReactHostComponentInjection
  15583. };
  15584. module.exports = ReactHostComponent;
  15585. /***/ }),
  15586. /* 83 */
  15587. /***/ (function(module, exports, __webpack_require__) {
  15588. "use strict";
  15589. /**
  15590. * Copyright 2013-present, Facebook, Inc.
  15591. * All rights reserved.
  15592. *
  15593. * This source code is licensed under the BSD-style license found in the
  15594. * LICENSE file in the root directory of this source tree. An additional grant
  15595. * of patent rights can be found in the PATENTS file in the same directory.
  15596. *
  15597. */
  15598. var ReactDOMSelection = __webpack_require__(170);
  15599. var containsNode = __webpack_require__(139);
  15600. var focusNode = __webpack_require__(72);
  15601. var getActiveElement = __webpack_require__(73);
  15602. function isInDocument(node) {
  15603. return containsNode(document.documentElement, node);
  15604. }
  15605. /**
  15606. * @ReactInputSelection: React input selection module. Based on Selection.js,
  15607. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  15608. * assume buttons have range selections allowed).
  15609. * Input selection module for React.
  15610. */
  15611. var ReactInputSelection = {
  15612. hasSelectionCapabilities: function (elem) {
  15613. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  15614. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  15615. },
  15616. getSelectionInformation: function () {
  15617. var focusedElem = getActiveElement();
  15618. return {
  15619. focusedElem: focusedElem,
  15620. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  15621. };
  15622. },
  15623. /**
  15624. * @restoreSelection: If any selection information was potentially lost,
  15625. * restore it. This is useful when performing operations that could remove dom
  15626. * nodes and place them back in, resulting in focus being lost.
  15627. */
  15628. restoreSelection: function (priorSelectionInformation) {
  15629. var curFocusedElem = getActiveElement();
  15630. var priorFocusedElem = priorSelectionInformation.focusedElem;
  15631. var priorSelectionRange = priorSelectionInformation.selectionRange;
  15632. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  15633. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  15634. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  15635. }
  15636. focusNode(priorFocusedElem);
  15637. }
  15638. },
  15639. /**
  15640. * @getSelection: Gets the selection bounds of a focused textarea, input or
  15641. * contentEditable node.
  15642. * -@input: Look up selection bounds of this input
  15643. * -@return {start: selectionStart, end: selectionEnd}
  15644. */
  15645. getSelection: function (input) {
  15646. var selection;
  15647. if ('selectionStart' in input) {
  15648. // Modern browser with input or textarea.
  15649. selection = {
  15650. start: input.selectionStart,
  15651. end: input.selectionEnd
  15652. };
  15653. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  15654. // IE8 input.
  15655. var range = document.selection.createRange();
  15656. // There can only be one selection per document in IE, so it must
  15657. // be in our element.
  15658. if (range.parentElement() === input) {
  15659. selection = {
  15660. start: -range.moveStart('character', -input.value.length),
  15661. end: -range.moveEnd('character', -input.value.length)
  15662. };
  15663. }
  15664. } else {
  15665. // Content editable or old IE textarea.
  15666. selection = ReactDOMSelection.getOffsets(input);
  15667. }
  15668. return selection || { start: 0, end: 0 };
  15669. },
  15670. /**
  15671. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  15672. * the input.
  15673. * -@input Set selection bounds of this input or textarea
  15674. * -@offsets Object of same form that is returned from get*
  15675. */
  15676. setSelection: function (input, offsets) {
  15677. var start = offsets.start;
  15678. var end = offsets.end;
  15679. if (end === undefined) {
  15680. end = start;
  15681. }
  15682. if ('selectionStart' in input) {
  15683. input.selectionStart = start;
  15684. input.selectionEnd = Math.min(end, input.value.length);
  15685. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  15686. var range = input.createTextRange();
  15687. range.collapse(true);
  15688. range.moveStart('character', start);
  15689. range.moveEnd('character', end - start);
  15690. range.select();
  15691. } else {
  15692. ReactDOMSelection.setOffsets(input, offsets);
  15693. }
  15694. }
  15695. };
  15696. module.exports = ReactInputSelection;
  15697. /***/ }),
  15698. /* 84 */
  15699. /***/ (function(module, exports, __webpack_require__) {
  15700. "use strict";
  15701. /**
  15702. * Copyright 2013-present, Facebook, Inc.
  15703. * All rights reserved.
  15704. *
  15705. * This source code is licensed under the BSD-style license found in the
  15706. * LICENSE file in the root directory of this source tree. An additional grant
  15707. * of patent rights can be found in the PATENTS file in the same directory.
  15708. *
  15709. */
  15710. var _prodInvariant = __webpack_require__(2);
  15711. var DOMLazyTree = __webpack_require__(18);
  15712. var DOMProperty = __webpack_require__(19);
  15713. var React = __webpack_require__(21);
  15714. var ReactBrowserEventEmitter = __webpack_require__(31);
  15715. var ReactCurrentOwner = __webpack_require__(14);
  15716. var ReactDOMComponentTree = __webpack_require__(5);
  15717. var ReactDOMContainerInfo = __webpack_require__(164);
  15718. var ReactDOMFeatureFlags = __webpack_require__(166);
  15719. var ReactFeatureFlags = __webpack_require__(81);
  15720. var ReactInstanceMap = __webpack_require__(28);
  15721. var ReactInstrumentation = __webpack_require__(11);
  15722. var ReactMarkupChecksum = __webpack_require__(180);
  15723. var ReactReconciler = __webpack_require__(20);
  15724. var ReactUpdateQueue = __webpack_require__(59);
  15725. var ReactUpdates = __webpack_require__(12);
  15726. var emptyObject = __webpack_require__(25);
  15727. var instantiateReactComponent = __webpack_require__(91);
  15728. var invariant = __webpack_require__(0);
  15729. var setInnerHTML = __webpack_require__(35);
  15730. var shouldUpdateReactComponent = __webpack_require__(65);
  15731. var warning = __webpack_require__(1);
  15732. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  15733. var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
  15734. var ELEMENT_NODE_TYPE = 1;
  15735. var DOC_NODE_TYPE = 9;
  15736. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  15737. var instancesByReactRootID = {};
  15738. /**
  15739. * Finds the index of the first character
  15740. * that's not common between the two given strings.
  15741. *
  15742. * @return {number} the index of the character where the strings diverge
  15743. */
  15744. function firstDifferenceIndex(string1, string2) {
  15745. var minLen = Math.min(string1.length, string2.length);
  15746. for (var i = 0; i < minLen; i++) {
  15747. if (string1.charAt(i) !== string2.charAt(i)) {
  15748. return i;
  15749. }
  15750. }
  15751. return string1.length === string2.length ? -1 : minLen;
  15752. }
  15753. /**
  15754. * @param {DOMElement|DOMDocument} container DOM element that may contain
  15755. * a React component
  15756. * @return {?*} DOM element that may have the reactRoot ID, or null.
  15757. */
  15758. function getReactRootElementInContainer(container) {
  15759. if (!container) {
  15760. return null;
  15761. }
  15762. if (container.nodeType === DOC_NODE_TYPE) {
  15763. return container.documentElement;
  15764. } else {
  15765. return container.firstChild;
  15766. }
  15767. }
  15768. function internalGetID(node) {
  15769. // If node is something like a window, document, or text node, none of
  15770. // which support attributes or a .getAttribute method, gracefully return
  15771. // the empty string, as if the attribute were missing.
  15772. return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  15773. }
  15774. /**
  15775. * Mounts this component and inserts it into the DOM.
  15776. *
  15777. * @param {ReactComponent} componentInstance The instance to mount.
  15778. * @param {DOMElement} container DOM element to mount into.
  15779. * @param {ReactReconcileTransaction} transaction
  15780. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  15781. */
  15782. function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
  15783. var markerName;
  15784. if (ReactFeatureFlags.logTopLevelRenders) {
  15785. var wrappedElement = wrapperInstance._currentElement.props.child;
  15786. var type = wrappedElement.type;
  15787. markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
  15788. console.time(markerName);
  15789. }
  15790. var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
  15791. );
  15792. if (markerName) {
  15793. console.timeEnd(markerName);
  15794. }
  15795. wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
  15796. ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
  15797. }
  15798. /**
  15799. * Batched mount.
  15800. *
  15801. * @param {ReactComponent} componentInstance The instance to mount.
  15802. * @param {DOMElement} container DOM element to mount into.
  15803. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  15804. */
  15805. function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
  15806. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  15807. /* useCreateElement */
  15808. !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
  15809. transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
  15810. ReactUpdates.ReactReconcileTransaction.release(transaction);
  15811. }
  15812. /**
  15813. * Unmounts a component and removes it from the DOM.
  15814. *
  15815. * @param {ReactComponent} instance React component instance.
  15816. * @param {DOMElement} container DOM element to unmount from.
  15817. * @final
  15818. * @internal
  15819. * @see {ReactMount.unmountComponentAtNode}
  15820. */
  15821. function unmountComponentFromNode(instance, container, safely) {
  15822. if (false) {
  15823. ReactInstrumentation.debugTool.onBeginFlush();
  15824. }
  15825. ReactReconciler.unmountComponent(instance, safely);
  15826. if (false) {
  15827. ReactInstrumentation.debugTool.onEndFlush();
  15828. }
  15829. if (container.nodeType === DOC_NODE_TYPE) {
  15830. container = container.documentElement;
  15831. }
  15832. // http://jsperf.com/emptying-a-node
  15833. while (container.lastChild) {
  15834. container.removeChild(container.lastChild);
  15835. }
  15836. }
  15837. /**
  15838. * True if the supplied DOM node has a direct React-rendered child that is
  15839. * not a React root element. Useful for warning in `render`,
  15840. * `unmountComponentAtNode`, etc.
  15841. *
  15842. * @param {?DOMElement} node The candidate DOM node.
  15843. * @return {boolean} True if the DOM element contains a direct child that was
  15844. * rendered by React but is not a root element.
  15845. * @internal
  15846. */
  15847. function hasNonRootReactChild(container) {
  15848. var rootEl = getReactRootElementInContainer(container);
  15849. if (rootEl) {
  15850. var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
  15851. return !!(inst && inst._hostParent);
  15852. }
  15853. }
  15854. /**
  15855. * True if the supplied DOM node is a React DOM element and
  15856. * it has been rendered by another copy of React.
  15857. *
  15858. * @param {?DOMElement} node The candidate DOM node.
  15859. * @return {boolean} True if the DOM has been rendered by another copy of React
  15860. * @internal
  15861. */
  15862. function nodeIsRenderedByOtherInstance(container) {
  15863. var rootEl = getReactRootElementInContainer(container);
  15864. return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
  15865. }
  15866. /**
  15867. * True if the supplied DOM node is a valid node element.
  15868. *
  15869. * @param {?DOMElement} node The candidate DOM node.
  15870. * @return {boolean} True if the DOM is a valid DOM node.
  15871. * @internal
  15872. */
  15873. function isValidContainer(node) {
  15874. return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
  15875. }
  15876. /**
  15877. * True if the supplied DOM node is a valid React node element.
  15878. *
  15879. * @param {?DOMElement} node The candidate DOM node.
  15880. * @return {boolean} True if the DOM is a valid React DOM node.
  15881. * @internal
  15882. */
  15883. function isReactNode(node) {
  15884. return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
  15885. }
  15886. function getHostRootInstanceInContainer(container) {
  15887. var rootEl = getReactRootElementInContainer(container);
  15888. var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
  15889. return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
  15890. }
  15891. function getTopLevelWrapperInContainer(container) {
  15892. var root = getHostRootInstanceInContainer(container);
  15893. return root ? root._hostContainerInfo._topLevelWrapper : null;
  15894. }
  15895. /**
  15896. * Temporary (?) hack so that we can store all top-level pending updates on
  15897. * composites instead of having to worry about different types of components
  15898. * here.
  15899. */
  15900. var topLevelRootCounter = 1;
  15901. var TopLevelWrapper = function () {
  15902. this.rootID = topLevelRootCounter++;
  15903. };
  15904. TopLevelWrapper.prototype.isReactComponent = {};
  15905. if (false) {
  15906. TopLevelWrapper.displayName = 'TopLevelWrapper';
  15907. }
  15908. TopLevelWrapper.prototype.render = function () {
  15909. return this.props.child;
  15910. };
  15911. TopLevelWrapper.isReactTopLevelWrapper = true;
  15912. /**
  15913. * Mounting is the process of initializing a React component by creating its
  15914. * representative DOM elements and inserting them into a supplied `container`.
  15915. * Any prior content inside `container` is destroyed in the process.
  15916. *
  15917. * ReactMount.render(
  15918. * component,
  15919. * document.getElementById('container')
  15920. * );
  15921. *
  15922. * <div id="container"> <-- Supplied `container`.
  15923. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  15924. * // ... component.
  15925. * </div>
  15926. * </div>
  15927. *
  15928. * Inside of `container`, the first element rendered is the "reactRoot".
  15929. */
  15930. var ReactMount = {
  15931. TopLevelWrapper: TopLevelWrapper,
  15932. /**
  15933. * Used by devtools. The keys are not important.
  15934. */
  15935. _instancesByReactRootID: instancesByReactRootID,
  15936. /**
  15937. * This is a hook provided to support rendering React components while
  15938. * ensuring that the apparent scroll position of its `container` does not
  15939. * change.
  15940. *
  15941. * @param {DOMElement} container The `container` being rendered into.
  15942. * @param {function} renderCallback This must be called once to do the render.
  15943. */
  15944. scrollMonitor: function (container, renderCallback) {
  15945. renderCallback();
  15946. },
  15947. /**
  15948. * Take a component that's already mounted into the DOM and replace its props
  15949. * @param {ReactComponent} prevComponent component instance already in the DOM
  15950. * @param {ReactElement} nextElement component instance to render
  15951. * @param {DOMElement} container container to render into
  15952. * @param {?function} callback function triggered on completion
  15953. */
  15954. _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
  15955. ReactMount.scrollMonitor(container, function () {
  15956. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
  15957. if (callback) {
  15958. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  15959. }
  15960. });
  15961. return prevComponent;
  15962. },
  15963. /**
  15964. * Render a new component into the DOM. Hooked by hooks!
  15965. *
  15966. * @param {ReactElement} nextElement element to render
  15967. * @param {DOMElement} container container to render into
  15968. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  15969. * @return {ReactComponent} nextComponent
  15970. */
  15971. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  15972. // Various parts of our code (such as ReactCompositeComponent's
  15973. // _renderValidatedComponent) assume that calls to render aren't nested;
  15974. // verify that that's the case.
  15975. 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;
  15976. !isValidContainer(container) ? false ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
  15977. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  15978. var componentInstance = instantiateReactComponent(nextElement, false);
  15979. // The initial render is synchronous but any updates that happen during
  15980. // rendering, in componentWillMount or componentDidMount, will be batched
  15981. // according to the current batching strategy.
  15982. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
  15983. var wrapperID = componentInstance._instance.rootID;
  15984. instancesByReactRootID[wrapperID] = componentInstance;
  15985. return componentInstance;
  15986. },
  15987. /**
  15988. * Renders a React component into the DOM in the supplied `container`.
  15989. *
  15990. * If the React component was previously rendered into `container`, this will
  15991. * perform an update on it and only mutate the DOM as necessary to reflect the
  15992. * latest React component.
  15993. *
  15994. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  15995. * @param {ReactElement} nextElement Component element to render.
  15996. * @param {DOMElement} container DOM element to render into.
  15997. * @param {?function} callback function triggered on completion
  15998. * @return {ReactComponent} Component instance rendered in `container`.
  15999. */
  16000. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  16001. !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? false ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
  16002. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  16003. },
  16004. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  16005. ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
  16006. !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 />.' :
  16007. // Check if it quacks like an element
  16008. 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;
  16009. 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;
  16010. var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement });
  16011. var nextContext;
  16012. if (parentComponent) {
  16013. var parentInst = ReactInstanceMap.get(parentComponent);
  16014. nextContext = parentInst._processChildContext(parentInst._context);
  16015. } else {
  16016. nextContext = emptyObject;
  16017. }
  16018. var prevComponent = getTopLevelWrapperInContainer(container);
  16019. if (prevComponent) {
  16020. var prevWrappedElement = prevComponent._currentElement;
  16021. var prevElement = prevWrappedElement.props.child;
  16022. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  16023. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  16024. var updatedCallback = callback && function () {
  16025. callback.call(publicInst);
  16026. };
  16027. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
  16028. return publicInst;
  16029. } else {
  16030. ReactMount.unmountComponentAtNode(container);
  16031. }
  16032. }
  16033. var reactRootElement = getReactRootElementInContainer(container);
  16034. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  16035. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  16036. if (false) {
  16037. 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;
  16038. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  16039. var rootElementSibling = reactRootElement;
  16040. while (rootElementSibling) {
  16041. if (internalGetID(rootElementSibling)) {
  16042. 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;
  16043. break;
  16044. }
  16045. rootElementSibling = rootElementSibling.nextSibling;
  16046. }
  16047. }
  16048. }
  16049. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  16050. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
  16051. if (callback) {
  16052. callback.call(component);
  16053. }
  16054. return component;
  16055. },
  16056. /**
  16057. * Renders a React component into the DOM in the supplied `container`.
  16058. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
  16059. *
  16060. * If the React component was previously rendered into `container`, this will
  16061. * perform an update on it and only mutate the DOM as necessary to reflect the
  16062. * latest React component.
  16063. *
  16064. * @param {ReactElement} nextElement Component element to render.
  16065. * @param {DOMElement} container DOM element to render into.
  16066. * @param {?function} callback function triggered on completion
  16067. * @return {ReactComponent} Component instance rendered in `container`.
  16068. */
  16069. render: function (nextElement, container, callback) {
  16070. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  16071. },
  16072. /**
  16073. * Unmounts and destroys the React component rendered in the `container`.
  16074. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
  16075. *
  16076. * @param {DOMElement} container DOM element containing a React component.
  16077. * @return {boolean} True if a component was found in and unmounted from
  16078. * `container`
  16079. */
  16080. unmountComponentAtNode: function (container) {
  16081. // Various parts of our code (such as ReactCompositeComponent's
  16082. // _renderValidatedComponent) assume that calls to render aren't nested;
  16083. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  16084. // render but we still don't expect to be in a render call here.)
  16085. 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;
  16086. !isValidContainer(container) ? false ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
  16087. if (false) {
  16088. 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;
  16089. }
  16090. var prevComponent = getTopLevelWrapperInContainer(container);
  16091. if (!prevComponent) {
  16092. // Check if the node being unmounted was rendered by React, but isn't a
  16093. // root node.
  16094. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  16095. // Check if the container itself is a React root node.
  16096. var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
  16097. if (false) {
  16098. 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;
  16099. }
  16100. return false;
  16101. }
  16102. delete instancesByReactRootID[prevComponent._instance.rootID];
  16103. ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
  16104. return true;
  16105. },
  16106. _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
  16107. !isValidContainer(container) ? false ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
  16108. if (shouldReuseMarkup) {
  16109. var rootElement = getReactRootElementInContainer(container);
  16110. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  16111. ReactDOMComponentTree.precacheNode(instance, rootElement);
  16112. return;
  16113. } else {
  16114. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  16115. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  16116. var rootMarkup = rootElement.outerHTML;
  16117. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  16118. var normalizedMarkup = markup;
  16119. if (false) {
  16120. // because rootMarkup is retrieved from the DOM, various normalizations
  16121. // will have occurred which will not be present in `markup`. Here,
  16122. // insert markup into a <div> or <iframe> depending on the container
  16123. // type to perform the same normalizations before comparing.
  16124. var normalizer;
  16125. if (container.nodeType === ELEMENT_NODE_TYPE) {
  16126. normalizer = document.createElement('div');
  16127. normalizer.innerHTML = markup;
  16128. normalizedMarkup = normalizer.innerHTML;
  16129. } else {
  16130. normalizer = document.createElement('iframe');
  16131. document.body.appendChild(normalizer);
  16132. normalizer.contentDocument.write(markup);
  16133. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  16134. document.body.removeChild(normalizer);
  16135. }
  16136. }
  16137. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  16138. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  16139. !(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;
  16140. if (false) {
  16141. 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;
  16142. }
  16143. }
  16144. }
  16145. !(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;
  16146. if (transaction.useCreateElement) {
  16147. while (container.lastChild) {
  16148. container.removeChild(container.lastChild);
  16149. }
  16150. DOMLazyTree.insertTreeBefore(container, markup, null);
  16151. } else {
  16152. setInnerHTML(container, markup);
  16153. ReactDOMComponentTree.precacheNode(instance, container.firstChild);
  16154. }
  16155. if (false) {
  16156. var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
  16157. if (hostNode._debugID !== 0) {
  16158. ReactInstrumentation.debugTool.onHostOperation({
  16159. instanceID: hostNode._debugID,
  16160. type: 'mount',
  16161. payload: markup.toString()
  16162. });
  16163. }
  16164. }
  16165. }
  16166. };
  16167. module.exports = ReactMount;
  16168. /***/ }),
  16169. /* 85 */
  16170. /***/ (function(module, exports, __webpack_require__) {
  16171. "use strict";
  16172. /**
  16173. * Copyright 2013-present, Facebook, Inc.
  16174. * All rights reserved.
  16175. *
  16176. * This source code is licensed under the BSD-style license found in the
  16177. * LICENSE file in the root directory of this source tree. An additional grant
  16178. * of patent rights can be found in the PATENTS file in the same directory.
  16179. *
  16180. *
  16181. */
  16182. var _prodInvariant = __webpack_require__(2);
  16183. var React = __webpack_require__(21);
  16184. var invariant = __webpack_require__(0);
  16185. var ReactNodeTypes = {
  16186. HOST: 0,
  16187. COMPOSITE: 1,
  16188. EMPTY: 2,
  16189. getType: function (node) {
  16190. if (node === null || node === false) {
  16191. return ReactNodeTypes.EMPTY;
  16192. } else if (React.isValidElement(node)) {
  16193. if (typeof node.type === 'function') {
  16194. return ReactNodeTypes.COMPOSITE;
  16195. } else {
  16196. return ReactNodeTypes.HOST;
  16197. }
  16198. }
  16199. true ? false ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
  16200. }
  16201. };
  16202. module.exports = ReactNodeTypes;
  16203. /***/ }),
  16204. /* 86 */
  16205. /***/ (function(module, exports, __webpack_require__) {
  16206. "use strict";
  16207. /**
  16208. * Copyright 2013-present, Facebook, Inc.
  16209. * All rights reserved.
  16210. *
  16211. * This source code is licensed under the BSD-style license found in the
  16212. * LICENSE file in the root directory of this source tree. An additional grant
  16213. * of patent rights can be found in the PATENTS file in the same directory.
  16214. *
  16215. */
  16216. var ViewportMetrics = {
  16217. currentScrollLeft: 0,
  16218. currentScrollTop: 0,
  16219. refreshScrollValues: function (scrollPosition) {
  16220. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  16221. ViewportMetrics.currentScrollTop = scrollPosition.y;
  16222. }
  16223. };
  16224. module.exports = ViewportMetrics;
  16225. /***/ }),
  16226. /* 87 */
  16227. /***/ (function(module, exports, __webpack_require__) {
  16228. "use strict";
  16229. /**
  16230. * Copyright 2014-present, Facebook, Inc.
  16231. * All rights reserved.
  16232. *
  16233. * This source code is licensed under the BSD-style license found in the
  16234. * LICENSE file in the root directory of this source tree. An additional grant
  16235. * of patent rights can be found in the PATENTS file in the same directory.
  16236. *
  16237. *
  16238. */
  16239. var _prodInvariant = __webpack_require__(2);
  16240. var invariant = __webpack_require__(0);
  16241. /**
  16242. * Accumulates items that must not be null or undefined into the first one. This
  16243. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  16244. * API cleanness. Since `current` can be null before being passed in and not
  16245. * null after this function, make sure to assign it back to `current`:
  16246. *
  16247. * `a = accumulateInto(a, b);`
  16248. *
  16249. * This API should be sparingly used. Try `accumulate` for something cleaner.
  16250. *
  16251. * @return {*|array<*>} An accumulation of items.
  16252. */
  16253. function accumulateInto(current, next) {
  16254. !(next != null) ? false ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
  16255. if (current == null) {
  16256. return next;
  16257. }
  16258. // Both are not empty. Warning: Never call x.concat(y) when you are not
  16259. // certain that x is an Array (x could be a string with concat method).
  16260. if (Array.isArray(current)) {
  16261. if (Array.isArray(next)) {
  16262. current.push.apply(current, next);
  16263. return current;
  16264. }
  16265. current.push(next);
  16266. return current;
  16267. }
  16268. if (Array.isArray(next)) {
  16269. // A bit too dangerous to mutate `next`.
  16270. return [current].concat(next);
  16271. }
  16272. return [current, next];
  16273. }
  16274. module.exports = accumulateInto;
  16275. /***/ }),
  16276. /* 88 */
  16277. /***/ (function(module, exports, __webpack_require__) {
  16278. "use strict";
  16279. /**
  16280. * Copyright 2013-present, Facebook, Inc.
  16281. * All rights reserved.
  16282. *
  16283. * This source code is licensed under the BSD-style license found in the
  16284. * LICENSE file in the root directory of this source tree. An additional grant
  16285. * of patent rights can be found in the PATENTS file in the same directory.
  16286. *
  16287. *
  16288. */
  16289. /**
  16290. * @param {array} arr an "accumulation" of items which is either an Array or
  16291. * a single item. Useful when paired with the `accumulate` module. This is a
  16292. * simple utility that allows us to reason about a collection of items, but
  16293. * handling the case when there is exactly one item (and we do not need to
  16294. * allocate an array).
  16295. */
  16296. function forEachAccumulated(arr, cb, scope) {
  16297. if (Array.isArray(arr)) {
  16298. arr.forEach(cb, scope);
  16299. } else if (arr) {
  16300. cb.call(scope, arr);
  16301. }
  16302. }
  16303. module.exports = forEachAccumulated;
  16304. /***/ }),
  16305. /* 89 */
  16306. /***/ (function(module, exports, __webpack_require__) {
  16307. "use strict";
  16308. /**
  16309. * Copyright 2013-present, Facebook, Inc.
  16310. * All rights reserved.
  16311. *
  16312. * This source code is licensed under the BSD-style license found in the
  16313. * LICENSE file in the root directory of this source tree. An additional grant
  16314. * of patent rights can be found in the PATENTS file in the same directory.
  16315. *
  16316. */
  16317. var ReactNodeTypes = __webpack_require__(85);
  16318. function getHostComponentFromComposite(inst) {
  16319. var type;
  16320. while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
  16321. inst = inst._renderedComponent;
  16322. }
  16323. if (type === ReactNodeTypes.HOST) {
  16324. return inst._renderedComponent;
  16325. } else if (type === ReactNodeTypes.EMPTY) {
  16326. return null;
  16327. }
  16328. }
  16329. module.exports = getHostComponentFromComposite;
  16330. /***/ }),
  16331. /* 90 */
  16332. /***/ (function(module, exports, __webpack_require__) {
  16333. "use strict";
  16334. /**
  16335. * Copyright 2013-present, Facebook, Inc.
  16336. * All rights reserved.
  16337. *
  16338. * This source code is licensed under the BSD-style license found in the
  16339. * LICENSE file in the root directory of this source tree. An additional grant
  16340. * of patent rights can be found in the PATENTS file in the same directory.
  16341. *
  16342. */
  16343. var ExecutionEnvironment = __webpack_require__(8);
  16344. var contentKey = null;
  16345. /**
  16346. * Gets the key used to access text content on a DOM node.
  16347. *
  16348. * @return {?string} Key used to access text content.
  16349. * @internal
  16350. */
  16351. function getTextContentAccessor() {
  16352. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  16353. // Prefer textContent to innerText because many browsers support both but
  16354. // SVG <text> elements don't support innerText even when <div> does.
  16355. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  16356. }
  16357. return contentKey;
  16358. }
  16359. module.exports = getTextContentAccessor;
  16360. /***/ }),
  16361. /* 91 */
  16362. /***/ (function(module, exports, __webpack_require__) {
  16363. "use strict";
  16364. /**
  16365. * Copyright 2013-present, Facebook, Inc.
  16366. * All rights reserved.
  16367. *
  16368. * This source code is licensed under the BSD-style license found in the
  16369. * LICENSE file in the root directory of this source tree. An additional grant
  16370. * of patent rights can be found in the PATENTS file in the same directory.
  16371. *
  16372. */
  16373. var _prodInvariant = __webpack_require__(2),
  16374. _assign = __webpack_require__(3);
  16375. var ReactCompositeComponent = __webpack_require__(161);
  16376. var ReactEmptyComponent = __webpack_require__(80);
  16377. var ReactHostComponent = __webpack_require__(82);
  16378. var getNextDebugID = __webpack_require__(208);
  16379. var invariant = __webpack_require__(0);
  16380. var warning = __webpack_require__(1);
  16381. // To avoid a cyclic dependency, we create the final class in this module
  16382. var ReactCompositeComponentWrapper = function (element) {
  16383. this.construct(element);
  16384. };
  16385. _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
  16386. _instantiateReactComponent: instantiateReactComponent
  16387. });
  16388. function getDeclarationErrorAddendum(owner) {
  16389. if (owner) {
  16390. var name = owner.getName();
  16391. if (name) {
  16392. return ' Check the render method of `' + name + '`.';
  16393. }
  16394. }
  16395. return '';
  16396. }
  16397. /**
  16398. * Check if the type reference is a known internal type. I.e. not a user
  16399. * provided composite type.
  16400. *
  16401. * @param {function} type
  16402. * @return {boolean} Returns true if this is a valid internal type.
  16403. */
  16404. function isInternalComponentType(type) {
  16405. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  16406. }
  16407. /**
  16408. * Given a ReactNode, create an instance that will actually be mounted.
  16409. *
  16410. * @param {ReactNode} node
  16411. * @param {boolean} shouldHaveDebugID
  16412. * @return {object} A new instance of the element's constructor.
  16413. * @protected
  16414. */
  16415. function instantiateReactComponent(node, shouldHaveDebugID) {
  16416. var instance;
  16417. if (node === null || node === false) {
  16418. instance = ReactEmptyComponent.create(instantiateReactComponent);
  16419. } else if (typeof node === 'object') {
  16420. var element = node;
  16421. var type = element.type;
  16422. if (typeof type !== 'function' && typeof type !== 'string') {
  16423. var info = '';
  16424. if (false) {
  16425. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  16426. info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
  16427. }
  16428. }
  16429. info += getDeclarationErrorAddendum(element._owner);
  16430. 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;
  16431. }
  16432. // Special case string values
  16433. if (typeof element.type === 'string') {
  16434. instance = ReactHostComponent.createInternalComponent(element);
  16435. } else if (isInternalComponentType(element.type)) {
  16436. // This is temporarily available for custom components that are not string
  16437. // representations. I.e. ART. Once those are updated to use the string
  16438. // representation, we can drop this code path.
  16439. instance = new element.type(element);
  16440. // We renamed this. Allow the old name for compat. :(
  16441. if (!instance.getHostNode) {
  16442. instance.getHostNode = instance.getNativeNode;
  16443. }
  16444. } else {
  16445. instance = new ReactCompositeComponentWrapper(element);
  16446. }
  16447. } else if (typeof node === 'string' || typeof node === 'number') {
  16448. instance = ReactHostComponent.createInstanceForText(node);
  16449. } else {
  16450. true ? false ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
  16451. }
  16452. if (false) {
  16453. 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;
  16454. }
  16455. // These two fields are used by the DOM and ART diffing algorithms
  16456. // respectively. Instead of using expandos on components, we should be
  16457. // storing the state needed by the diffing algorithms elsewhere.
  16458. instance._mountIndex = 0;
  16459. instance._mountImage = null;
  16460. if (false) {
  16461. instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
  16462. }
  16463. // Internal instances should fully constructed at this point, so they should
  16464. // not get any new fields added to them at this point.
  16465. if (false) {
  16466. if (Object.preventExtensions) {
  16467. Object.preventExtensions(instance);
  16468. }
  16469. }
  16470. return instance;
  16471. }
  16472. module.exports = instantiateReactComponent;
  16473. /***/ }),
  16474. /* 92 */
  16475. /***/ (function(module, exports, __webpack_require__) {
  16476. "use strict";
  16477. /**
  16478. * Copyright 2013-present, Facebook, Inc.
  16479. * All rights reserved.
  16480. *
  16481. * This source code is licensed under the BSD-style license found in the
  16482. * LICENSE file in the root directory of this source tree. An additional grant
  16483. * of patent rights can be found in the PATENTS file in the same directory.
  16484. *
  16485. *
  16486. */
  16487. /**
  16488. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  16489. */
  16490. var supportedInputTypes = {
  16491. 'color': true,
  16492. 'date': true,
  16493. 'datetime': true,
  16494. 'datetime-local': true,
  16495. 'email': true,
  16496. 'month': true,
  16497. 'number': true,
  16498. 'password': true,
  16499. 'range': true,
  16500. 'search': true,
  16501. 'tel': true,
  16502. 'text': true,
  16503. 'time': true,
  16504. 'url': true,
  16505. 'week': true
  16506. };
  16507. function isTextInputElement(elem) {
  16508. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  16509. if (nodeName === 'input') {
  16510. return !!supportedInputTypes[elem.type];
  16511. }
  16512. if (nodeName === 'textarea') {
  16513. return true;
  16514. }
  16515. return false;
  16516. }
  16517. module.exports = isTextInputElement;
  16518. /***/ }),
  16519. /* 93 */
  16520. /***/ (function(module, exports, __webpack_require__) {
  16521. "use strict";
  16522. /**
  16523. * Copyright 2013-present, Facebook, Inc.
  16524. * All rights reserved.
  16525. *
  16526. * This source code is licensed under the BSD-style license found in the
  16527. * LICENSE file in the root directory of this source tree. An additional grant
  16528. * of patent rights can be found in the PATENTS file in the same directory.
  16529. *
  16530. */
  16531. var ExecutionEnvironment = __webpack_require__(8);
  16532. var escapeTextContentForBrowser = __webpack_require__(34);
  16533. var setInnerHTML = __webpack_require__(35);
  16534. /**
  16535. * Set the textContent property of a node, ensuring that whitespace is preserved
  16536. * even in IE8. innerText is a poor substitute for textContent and, among many
  16537. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  16538. * as it should.
  16539. *
  16540. * @param {DOMElement} node
  16541. * @param {string} text
  16542. * @internal
  16543. */
  16544. var setTextContent = function (node, text) {
  16545. if (text) {
  16546. var firstChild = node.firstChild;
  16547. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
  16548. firstChild.nodeValue = text;
  16549. return;
  16550. }
  16551. }
  16552. node.textContent = text;
  16553. };
  16554. if (ExecutionEnvironment.canUseDOM) {
  16555. if (!('textContent' in document.documentElement)) {
  16556. setTextContent = function (node, text) {
  16557. if (node.nodeType === 3) {
  16558. node.nodeValue = text;
  16559. return;
  16560. }
  16561. setInnerHTML(node, escapeTextContentForBrowser(text));
  16562. };
  16563. }
  16564. }
  16565. module.exports = setTextContent;
  16566. /***/ }),
  16567. /* 94 */
  16568. /***/ (function(module, exports, __webpack_require__) {
  16569. "use strict";
  16570. /**
  16571. * Copyright 2013-present, Facebook, Inc.
  16572. * All rights reserved.
  16573. *
  16574. * This source code is licensed under the BSD-style license found in the
  16575. * LICENSE file in the root directory of this source tree. An additional grant
  16576. * of patent rights can be found in the PATENTS file in the same directory.
  16577. *
  16578. */
  16579. var _prodInvariant = __webpack_require__(2);
  16580. var ReactCurrentOwner = __webpack_require__(14);
  16581. var REACT_ELEMENT_TYPE = __webpack_require__(176);
  16582. var getIteratorFn = __webpack_require__(207);
  16583. var invariant = __webpack_require__(0);
  16584. var KeyEscapeUtils = __webpack_require__(55);
  16585. var warning = __webpack_require__(1);
  16586. var SEPARATOR = '.';
  16587. var SUBSEPARATOR = ':';
  16588. /**
  16589. * This is inlined from ReactElement since this file is shared between
  16590. * isomorphic and renderers. We could extract this to a
  16591. *
  16592. */
  16593. /**
  16594. * TODO: Test that a single child and an array with one item have the same key
  16595. * pattern.
  16596. */
  16597. var didWarnAboutMaps = false;
  16598. /**
  16599. * Generate a key string that identifies a component within a set.
  16600. *
  16601. * @param {*} component A component that could contain a manual key.
  16602. * @param {number} index Index that is used if a manual key is not provided.
  16603. * @return {string}
  16604. */
  16605. function getComponentKey(component, index) {
  16606. // Do some typechecking here since we call this blindly. We want to ensure
  16607. // that we don't block potential future ES APIs.
  16608. if (component && typeof component === 'object' && component.key != null) {
  16609. // Explicit key
  16610. return KeyEscapeUtils.escape(component.key);
  16611. }
  16612. // Implicit key determined by the index in the set
  16613. return index.toString(36);
  16614. }
  16615. /**
  16616. * @param {?*} children Children tree container.
  16617. * @param {!string} nameSoFar Name of the key path so far.
  16618. * @param {!function} callback Callback to invoke with each child found.
  16619. * @param {?*} traverseContext Used to pass information throughout the traversal
  16620. * process.
  16621. * @return {!number} The number of children in this subtree.
  16622. */
  16623. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  16624. var type = typeof children;
  16625. if (type === 'undefined' || type === 'boolean') {
  16626. // All of the above are perceived as null.
  16627. children = null;
  16628. }
  16629. if (children === null || type === 'string' || type === 'number' ||
  16630. // The following is inlined from ReactElement. This means we can optimize
  16631. // some checks. React Fiber also inlines this logic for similar purposes.
  16632. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  16633. callback(traverseContext, children,
  16634. // If it's the only child, treat the name as if it was wrapped in an array
  16635. // so that it's consistent if the number of children grows.
  16636. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  16637. return 1;
  16638. }
  16639. var child;
  16640. var nextName;
  16641. var subtreeCount = 0; // Count of children found in the current subtree.
  16642. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  16643. if (Array.isArray(children)) {
  16644. for (var i = 0; i < children.length; i++) {
  16645. child = children[i];
  16646. nextName = nextNamePrefix + getComponentKey(child, i);
  16647. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16648. }
  16649. } else {
  16650. var iteratorFn = getIteratorFn(children);
  16651. if (iteratorFn) {
  16652. var iterator = iteratorFn.call(children);
  16653. var step;
  16654. if (iteratorFn !== children.entries) {
  16655. var ii = 0;
  16656. while (!(step = iterator.next()).done) {
  16657. child = step.value;
  16658. nextName = nextNamePrefix + getComponentKey(child, ii++);
  16659. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16660. }
  16661. } else {
  16662. if (false) {
  16663. var mapsAsChildrenAddendum = '';
  16664. if (ReactCurrentOwner.current) {
  16665. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  16666. if (mapsAsChildrenOwnerName) {
  16667. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  16668. }
  16669. }
  16670. 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;
  16671. didWarnAboutMaps = true;
  16672. }
  16673. // Iterator will provide entry [k,v] tuples rather than values.
  16674. while (!(step = iterator.next()).done) {
  16675. var entry = step.value;
  16676. if (entry) {
  16677. child = entry[1];
  16678. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  16679. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16680. }
  16681. }
  16682. }
  16683. } else if (type === 'object') {
  16684. var addendum = '';
  16685. if (false) {
  16686. 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.';
  16687. if (children._isReactElement) {
  16688. 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.';
  16689. }
  16690. if (ReactCurrentOwner.current) {
  16691. var name = ReactCurrentOwner.current.getName();
  16692. if (name) {
  16693. addendum += ' Check the render method of `' + name + '`.';
  16694. }
  16695. }
  16696. }
  16697. var childrenString = String(children);
  16698. 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;
  16699. }
  16700. }
  16701. return subtreeCount;
  16702. }
  16703. /**
  16704. * Traverses children that are typically specified as `props.children`, but
  16705. * might also be specified through attributes:
  16706. *
  16707. * - `traverseAllChildren(this.props.children, ...)`
  16708. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  16709. *
  16710. * The `traverseContext` is an optional argument that is passed through the
  16711. * entire traversal. It can be used to store accumulations or anything else that
  16712. * the callback might find relevant.
  16713. *
  16714. * @param {?*} children Children tree object.
  16715. * @param {!function} callback To invoke upon traversing each child.
  16716. * @param {?*} traverseContext Context for traversal.
  16717. * @return {!number} The number of children in this subtree.
  16718. */
  16719. function traverseAllChildren(children, callback, traverseContext) {
  16720. if (children == null) {
  16721. return 0;
  16722. }
  16723. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  16724. }
  16725. module.exports = traverseAllChildren;
  16726. /***/ }),
  16727. /* 95 */
  16728. /***/ (function(module, exports, __webpack_require__) {
  16729. "use strict";
  16730. /**
  16731. * Copyright 2016-present, Facebook, Inc.
  16732. * All rights reserved.
  16733. *
  16734. * This source code is licensed under the BSD-style license found in the
  16735. * LICENSE file in the root directory of this source tree. An additional grant
  16736. * of patent rights can be found in the PATENTS file in the same directory.
  16737. *
  16738. *
  16739. */
  16740. var _prodInvariant = __webpack_require__(23);
  16741. var ReactCurrentOwner = __webpack_require__(14);
  16742. var invariant = __webpack_require__(0);
  16743. var warning = __webpack_require__(1);
  16744. function isNative(fn) {
  16745. // Based on isNative() from Lodash
  16746. var funcToString = Function.prototype.toString;
  16747. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16748. var reIsNative = RegExp('^' + funcToString
  16749. // Take an example native function source for comparison
  16750. .call(hasOwnProperty)
  16751. // Strip regex characters so we can use it for regex
  16752. .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  16753. // Remove hasOwnProperty from the template to make it generic
  16754. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
  16755. try {
  16756. var source = funcToString.call(fn);
  16757. return reIsNative.test(source);
  16758. } catch (err) {
  16759. return false;
  16760. }
  16761. }
  16762. var canUseCollections =
  16763. // Array.from
  16764. typeof Array.from === 'function' &&
  16765. // Map
  16766. typeof Map === 'function' && isNative(Map) &&
  16767. // Map.prototype.keys
  16768. Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
  16769. // Set
  16770. typeof Set === 'function' && isNative(Set) &&
  16771. // Set.prototype.keys
  16772. Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
  16773. var setItem;
  16774. var getItem;
  16775. var removeItem;
  16776. var getItemIDs;
  16777. var addRoot;
  16778. var removeRoot;
  16779. var getRootIDs;
  16780. if (canUseCollections) {
  16781. var itemMap = new Map();
  16782. var rootIDSet = new Set();
  16783. setItem = function (id, item) {
  16784. itemMap.set(id, item);
  16785. };
  16786. getItem = function (id) {
  16787. return itemMap.get(id);
  16788. };
  16789. removeItem = function (id) {
  16790. itemMap['delete'](id);
  16791. };
  16792. getItemIDs = function () {
  16793. return Array.from(itemMap.keys());
  16794. };
  16795. addRoot = function (id) {
  16796. rootIDSet.add(id);
  16797. };
  16798. removeRoot = function (id) {
  16799. rootIDSet['delete'](id);
  16800. };
  16801. getRootIDs = function () {
  16802. return Array.from(rootIDSet.keys());
  16803. };
  16804. } else {
  16805. var itemByKey = {};
  16806. var rootByKey = {};
  16807. // Use non-numeric keys to prevent V8 performance issues:
  16808. // https://github.com/facebook/react/pull/7232
  16809. var getKeyFromID = function (id) {
  16810. return '.' + id;
  16811. };
  16812. var getIDFromKey = function (key) {
  16813. return parseInt(key.substr(1), 10);
  16814. };
  16815. setItem = function (id, item) {
  16816. var key = getKeyFromID(id);
  16817. itemByKey[key] = item;
  16818. };
  16819. getItem = function (id) {
  16820. var key = getKeyFromID(id);
  16821. return itemByKey[key];
  16822. };
  16823. removeItem = function (id) {
  16824. var key = getKeyFromID(id);
  16825. delete itemByKey[key];
  16826. };
  16827. getItemIDs = function () {
  16828. return Object.keys(itemByKey).map(getIDFromKey);
  16829. };
  16830. addRoot = function (id) {
  16831. var key = getKeyFromID(id);
  16832. rootByKey[key] = true;
  16833. };
  16834. removeRoot = function (id) {
  16835. var key = getKeyFromID(id);
  16836. delete rootByKey[key];
  16837. };
  16838. getRootIDs = function () {
  16839. return Object.keys(rootByKey).map(getIDFromKey);
  16840. };
  16841. }
  16842. var unmountedIDs = [];
  16843. function purgeDeep(id) {
  16844. var item = getItem(id);
  16845. if (item) {
  16846. var childIDs = item.childIDs;
  16847. removeItem(id);
  16848. childIDs.forEach(purgeDeep);
  16849. }
  16850. }
  16851. function describeComponentFrame(name, source, ownerName) {
  16852. return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
  16853. }
  16854. function getDisplayName(element) {
  16855. if (element == null) {
  16856. return '#empty';
  16857. } else if (typeof element === 'string' || typeof element === 'number') {
  16858. return '#text';
  16859. } else if (typeof element.type === 'string') {
  16860. return element.type;
  16861. } else {
  16862. return element.type.displayName || element.type.name || 'Unknown';
  16863. }
  16864. }
  16865. function describeID(id) {
  16866. var name = ReactComponentTreeHook.getDisplayName(id);
  16867. var element = ReactComponentTreeHook.getElement(id);
  16868. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  16869. var ownerName;
  16870. if (ownerID) {
  16871. ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
  16872. }
  16873. false ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
  16874. return describeComponentFrame(name, element && element._source, ownerName);
  16875. }
  16876. var ReactComponentTreeHook = {
  16877. onSetChildren: function (id, nextChildIDs) {
  16878. var item = getItem(id);
  16879. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  16880. item.childIDs = nextChildIDs;
  16881. for (var i = 0; i < nextChildIDs.length; i++) {
  16882. var nextChildID = nextChildIDs[i];
  16883. var nextChild = getItem(nextChildID);
  16884. !nextChild ? false ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
  16885. !(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;
  16886. !nextChild.isMounted ? false ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
  16887. if (nextChild.parentID == null) {
  16888. nextChild.parentID = id;
  16889. // TODO: This shouldn't be necessary but mounting a new root during in
  16890. // componentWillMount currently causes not-yet-mounted components to
  16891. // be purged from our tree data so their parent id is missing.
  16892. }
  16893. !(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;
  16894. }
  16895. },
  16896. onBeforeMountComponent: function (id, element, parentID) {
  16897. var item = {
  16898. element: element,
  16899. parentID: parentID,
  16900. text: null,
  16901. childIDs: [],
  16902. isMounted: false,
  16903. updateCount: 0
  16904. };
  16905. setItem(id, item);
  16906. },
  16907. onBeforeUpdateComponent: function (id, element) {
  16908. var item = getItem(id);
  16909. if (!item || !item.isMounted) {
  16910. // We may end up here as a result of setState() in componentWillUnmount().
  16911. // In this case, ignore the element.
  16912. return;
  16913. }
  16914. item.element = element;
  16915. },
  16916. onMountComponent: function (id) {
  16917. var item = getItem(id);
  16918. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  16919. item.isMounted = true;
  16920. var isRoot = item.parentID === 0;
  16921. if (isRoot) {
  16922. addRoot(id);
  16923. }
  16924. },
  16925. onUpdateComponent: function (id) {
  16926. var item = getItem(id);
  16927. if (!item || !item.isMounted) {
  16928. // We may end up here as a result of setState() in componentWillUnmount().
  16929. // In this case, ignore the element.
  16930. return;
  16931. }
  16932. item.updateCount++;
  16933. },
  16934. onUnmountComponent: function (id) {
  16935. var item = getItem(id);
  16936. if (item) {
  16937. // We need to check if it exists.
  16938. // `item` might not exist if it is inside an error boundary, and a sibling
  16939. // error boundary child threw while mounting. Then this instance never
  16940. // got a chance to mount, but it still gets an unmounting event during
  16941. // the error boundary cleanup.
  16942. item.isMounted = false;
  16943. var isRoot = item.parentID === 0;
  16944. if (isRoot) {
  16945. removeRoot(id);
  16946. }
  16947. }
  16948. unmountedIDs.push(id);
  16949. },
  16950. purgeUnmountedComponents: function () {
  16951. if (ReactComponentTreeHook._preventPurging) {
  16952. // Should only be used for testing.
  16953. return;
  16954. }
  16955. for (var i = 0; i < unmountedIDs.length; i++) {
  16956. var id = unmountedIDs[i];
  16957. purgeDeep(id);
  16958. }
  16959. unmountedIDs.length = 0;
  16960. },
  16961. isMounted: function (id) {
  16962. var item = getItem(id);
  16963. return item ? item.isMounted : false;
  16964. },
  16965. getCurrentStackAddendum: function (topElement) {
  16966. var info = '';
  16967. if (topElement) {
  16968. var name = getDisplayName(topElement);
  16969. var owner = topElement._owner;
  16970. info += describeComponentFrame(name, topElement._source, owner && owner.getName());
  16971. }
  16972. var currentOwner = ReactCurrentOwner.current;
  16973. var id = currentOwner && currentOwner._debugID;
  16974. info += ReactComponentTreeHook.getStackAddendumByID(id);
  16975. return info;
  16976. },
  16977. getStackAddendumByID: function (id) {
  16978. var info = '';
  16979. while (id) {
  16980. info += describeID(id);
  16981. id = ReactComponentTreeHook.getParentID(id);
  16982. }
  16983. return info;
  16984. },
  16985. getChildIDs: function (id) {
  16986. var item = getItem(id);
  16987. return item ? item.childIDs : [];
  16988. },
  16989. getDisplayName: function (id) {
  16990. var element = ReactComponentTreeHook.getElement(id);
  16991. if (!element) {
  16992. return null;
  16993. }
  16994. return getDisplayName(element);
  16995. },
  16996. getElement: function (id) {
  16997. var item = getItem(id);
  16998. return item ? item.element : null;
  16999. },
  17000. getOwnerID: function (id) {
  17001. var element = ReactComponentTreeHook.getElement(id);
  17002. if (!element || !element._owner) {
  17003. return null;
  17004. }
  17005. return element._owner._debugID;
  17006. },
  17007. getParentID: function (id) {
  17008. var item = getItem(id);
  17009. return item ? item.parentID : null;
  17010. },
  17011. getSource: function (id) {
  17012. var item = getItem(id);
  17013. var element = item ? item.element : null;
  17014. var source = element != null ? element._source : null;
  17015. return source;
  17016. },
  17017. getText: function (id) {
  17018. var element = ReactComponentTreeHook.getElement(id);
  17019. if (typeof element === 'string') {
  17020. return element;
  17021. } else if (typeof element === 'number') {
  17022. return '' + element;
  17023. } else {
  17024. return null;
  17025. }
  17026. },
  17027. getUpdateCount: function (id) {
  17028. var item = getItem(id);
  17029. return item ? item.updateCount : 0;
  17030. },
  17031. getRootIDs: getRootIDs,
  17032. getRegisteredIDs: getItemIDs
  17033. };
  17034. module.exports = ReactComponentTreeHook;
  17035. /***/ }),
  17036. /* 96 */
  17037. /***/ (function(module, exports, __webpack_require__) {
  17038. "use strict";
  17039. /**
  17040. * Copyright 2014-present, Facebook, Inc.
  17041. * All rights reserved.
  17042. *
  17043. * This source code is licensed under the BSD-style license found in the
  17044. * LICENSE file in the root directory of this source tree. An additional grant
  17045. * of patent rights can be found in the PATENTS file in the same directory.
  17046. *
  17047. *
  17048. */
  17049. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  17050. // nor polyfill, then a plain number is used for performance.
  17051. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  17052. module.exports = REACT_ELEMENT_TYPE;
  17053. /***/ }),
  17054. /* 97 */
  17055. /***/ (function(module, exports, __webpack_require__) {
  17056. "use strict";
  17057. /**
  17058. * Copyright 2013-present, Facebook, Inc.
  17059. * All rights reserved.
  17060. *
  17061. * This source code is licensed under the BSD-style license found in the
  17062. * LICENSE file in the root directory of this source tree. An additional grant
  17063. * of patent rights can be found in the PATENTS file in the same directory.
  17064. *
  17065. *
  17066. */
  17067. var ReactPropTypeLocationNames = {};
  17068. if (false) {
  17069. ReactPropTypeLocationNames = {
  17070. prop: 'prop',
  17071. context: 'context',
  17072. childContext: 'child context'
  17073. };
  17074. }
  17075. module.exports = ReactPropTypeLocationNames;
  17076. /***/ }),
  17077. /* 98 */
  17078. /***/ (function(module, exports, __webpack_require__) {
  17079. "use strict";
  17080. /**
  17081. * Copyright 2013-present, Facebook, Inc.
  17082. * All rights reserved.
  17083. *
  17084. * This source code is licensed under the BSD-style license found in the
  17085. * LICENSE file in the root directory of this source tree. An additional grant
  17086. * of patent rights can be found in the PATENTS file in the same directory.
  17087. *
  17088. *
  17089. */
  17090. var canDefineProperty = false;
  17091. if (false) {
  17092. try {
  17093. // $FlowFixMe https://github.com/facebook/flow/issues/285
  17094. Object.defineProperty({}, 'x', { get: function () {} });
  17095. canDefineProperty = true;
  17096. } catch (x) {
  17097. // IE will fail on defineProperty
  17098. }
  17099. }
  17100. module.exports = canDefineProperty;
  17101. /***/ }),
  17102. /* 99 */
  17103. /***/ (function(module, exports, __webpack_require__) {
  17104. "use strict";
  17105. /**
  17106. * Copyright 2013-present, Facebook, Inc.
  17107. * All rights reserved.
  17108. *
  17109. * This source code is licensed under the BSD-style license found in the
  17110. * LICENSE file in the root directory of this source tree. An additional grant
  17111. * of patent rights can be found in the PATENTS file in the same directory.
  17112. *
  17113. *
  17114. */
  17115. /* global Symbol */
  17116. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  17117. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  17118. /**
  17119. * Returns the iterator method function contained on the iterable object.
  17120. *
  17121. * Be sure to invoke the function with the iterable as context:
  17122. *
  17123. * var iteratorFn = getIteratorFn(myIterable);
  17124. * if (iteratorFn) {
  17125. * var iterator = iteratorFn.call(myIterable);
  17126. * ...
  17127. * }
  17128. *
  17129. * @param {?object} maybeIterable
  17130. * @return {?function}
  17131. */
  17132. function getIteratorFn(maybeIterable) {
  17133. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  17134. if (typeof iteratorFn === 'function') {
  17135. return iteratorFn;
  17136. }
  17137. }
  17138. module.exports = getIteratorFn;
  17139. /***/ }),
  17140. /* 100 */
  17141. /***/ (function(module, exports, __webpack_require__) {
  17142. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**!
  17143. * Sortable
  17144. * @author RubaXa <[email protected]>
  17145. * @license MIT
  17146. */
  17147. (function sortableModule(factory) {
  17148. "use strict";
  17149. if (true) {
  17150. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  17151. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  17152. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  17153. __WEBPACK_AMD_DEFINE_FACTORY__),
  17154. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17155. }
  17156. else if (typeof module != "undefined" && typeof module.exports != "undefined") {
  17157. module.exports = factory();
  17158. }
  17159. else {
  17160. /* jshint sub:true */
  17161. window["Sortable"] = factory();
  17162. }
  17163. })(function sortableFactory() {
  17164. "use strict";
  17165. if (typeof window == "undefined" || !window.document) {
  17166. return function sortableError() {
  17167. throw new Error("Sortable.js requires a window with a document");
  17168. };
  17169. }
  17170. var dragEl,
  17171. parentEl,
  17172. ghostEl,
  17173. cloneEl,
  17174. rootEl,
  17175. nextEl,
  17176. lastDownEl,
  17177. scrollEl,
  17178. scrollParentEl,
  17179. scrollCustomFn,
  17180. lastEl,
  17181. lastCSS,
  17182. lastParentCSS,
  17183. oldIndex,
  17184. newIndex,
  17185. activeGroup,
  17186. putSortable,
  17187. autoScroll = {},
  17188. tapEvt,
  17189. touchEvt,
  17190. moved,
  17191. /** @const */
  17192. R_SPACE = /\s+/g,
  17193. R_FLOAT = /left|right|inline/,
  17194. expando = 'Sortable' + (new Date).getTime(),
  17195. win = window,
  17196. document = win.document,
  17197. parseInt = win.parseInt,
  17198. $ = win.jQuery || win.Zepto,
  17199. Polymer = win.Polymer,
  17200. captureMode = false,
  17201. supportDraggable = !!('draggable' in document.createElement('div')),
  17202. supportCssPointerEvents = (function (el) {
  17203. // false when IE11
  17204. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  17205. return false;
  17206. }
  17207. el = document.createElement('x');
  17208. el.style.cssText = 'pointer-events:auto';
  17209. return el.style.pointerEvents === 'auto';
  17210. })(),
  17211. _silent = false,
  17212. abs = Math.abs,
  17213. min = Math.min,
  17214. savedInputChecked = [],
  17215. touchDragOverListeners = [],
  17216. _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  17217. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  17218. if (rootEl && options.scroll) {
  17219. var _this = rootEl[expando],
  17220. el,
  17221. rect,
  17222. sens = options.scrollSensitivity,
  17223. speed = options.scrollSpeed,
  17224. x = evt.clientX,
  17225. y = evt.clientY,
  17226. winWidth = window.innerWidth,
  17227. winHeight = window.innerHeight,
  17228. vx,
  17229. vy,
  17230. scrollOffsetX,
  17231. scrollOffsetY
  17232. ;
  17233. // Delect scrollEl
  17234. if (scrollParentEl !== rootEl) {
  17235. scrollEl = options.scroll;
  17236. scrollParentEl = rootEl;
  17237. scrollCustomFn = options.scrollFn;
  17238. if (scrollEl === true) {
  17239. scrollEl = rootEl;
  17240. do {
  17241. if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
  17242. (scrollEl.offsetHeight < scrollEl.scrollHeight)
  17243. ) {
  17244. break;
  17245. }
  17246. /* jshint boss:true */
  17247. } while (scrollEl = scrollEl.parentNode);
  17248. }
  17249. }
  17250. if (scrollEl) {
  17251. el = scrollEl;
  17252. rect = scrollEl.getBoundingClientRect();
  17253. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  17254. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  17255. }
  17256. if (!(vx || vy)) {
  17257. vx = (winWidth - x <= sens) - (x <= sens);
  17258. vy = (winHeight - y <= sens) - (y <= sens);
  17259. /* jshint expr:true */
  17260. (vx || vy) && (el = win);
  17261. }
  17262. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  17263. autoScroll.el = el;
  17264. autoScroll.vx = vx;
  17265. autoScroll.vy = vy;
  17266. clearInterval(autoScroll.pid);
  17267. if (el) {
  17268. autoScroll.pid = setInterval(function () {
  17269. scrollOffsetY = vy ? vy * speed : 0;
  17270. scrollOffsetX = vx ? vx * speed : 0;
  17271. if ('function' === typeof(scrollCustomFn)) {
  17272. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  17273. }
  17274. if (el === win) {
  17275. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  17276. } else {
  17277. el.scrollTop += scrollOffsetY;
  17278. el.scrollLeft += scrollOffsetX;
  17279. }
  17280. }, 24);
  17281. }
  17282. }
  17283. }
  17284. }, 30),
  17285. _prepareGroup = function (options) {
  17286. function toFn(value, pull) {
  17287. if (value === void 0 || value === true) {
  17288. value = group.name;
  17289. }
  17290. if (typeof value === 'function') {
  17291. return value;
  17292. } else {
  17293. return function (to, from) {
  17294. var fromGroup = from.options.group.name;
  17295. return pull
  17296. ? value
  17297. : value && (value.join
  17298. ? value.indexOf(fromGroup) > -1
  17299. : (fromGroup == value)
  17300. );
  17301. };
  17302. }
  17303. }
  17304. var group = {};
  17305. var originalGroup = options.group;
  17306. if (!originalGroup || typeof originalGroup != 'object') {
  17307. originalGroup = {name: originalGroup};
  17308. }
  17309. group.name = originalGroup.name;
  17310. group.checkPull = toFn(originalGroup.pull, true);
  17311. group.checkPut = toFn(originalGroup.put);
  17312. group.revertClone = originalGroup.revertClone;
  17313. options.group = group;
  17314. }
  17315. ;
  17316. /**
  17317. * @class Sortable
  17318. * @param {HTMLElement} el
  17319. * @param {Object} [options]
  17320. */
  17321. function Sortable(el, options) {
  17322. if (!(el && el.nodeType && el.nodeType === 1)) {
  17323. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  17324. }
  17325. this.el = el; // root element
  17326. this.options = options = _extend({}, options);
  17327. // Export instance
  17328. el[expando] = this;
  17329. // Default options
  17330. var defaults = {
  17331. group: Math.random(),
  17332. sort: true,
  17333. disabled: false,
  17334. store: null,
  17335. handle: null,
  17336. scroll: true,
  17337. scrollSensitivity: 30,
  17338. scrollSpeed: 10,
  17339. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  17340. ghostClass: 'sortable-ghost',
  17341. chosenClass: 'sortable-chosen',
  17342. dragClass: 'sortable-drag',
  17343. ignore: 'a, img',
  17344. filter: null,
  17345. preventOnFilter: true,
  17346. animation: 0,
  17347. setData: function (dataTransfer, dragEl) {
  17348. dataTransfer.setData('Text', dragEl.textContent);
  17349. },
  17350. dropBubble: false,
  17351. dragoverBubble: false,
  17352. dataIdAttr: 'data-id',
  17353. delay: 0,
  17354. forceFallback: false,
  17355. fallbackClass: 'sortable-fallback',
  17356. fallbackOnBody: false,
  17357. fallbackTolerance: 0,
  17358. fallbackOffset: {x: 0, y: 0}
  17359. };
  17360. // Set default options
  17361. for (var name in defaults) {
  17362. !(name in options) && (options[name] = defaults[name]);
  17363. }
  17364. _prepareGroup(options);
  17365. // Bind all private methods
  17366. for (var fn in this) {
  17367. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  17368. this[fn] = this[fn].bind(this);
  17369. }
  17370. }
  17371. // Setup drag mode
  17372. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  17373. // Bind events
  17374. _on(el, 'mousedown', this._onTapStart);
  17375. _on(el, 'touchstart', this._onTapStart);
  17376. _on(el, 'pointerdown', this._onTapStart);
  17377. if (this.nativeDraggable) {
  17378. _on(el, 'dragover', this);
  17379. _on(el, 'dragenter', this);
  17380. }
  17381. touchDragOverListeners.push(this._onDragOver);
  17382. // Restore sorting
  17383. options.store && this.sort(options.store.get(this));
  17384. }
  17385. Sortable.prototype = /** @lends Sortable.prototype */ {
  17386. constructor: Sortable,
  17387. _onTapStart: function (/** Event|TouchEvent */evt) {
  17388. var _this = this,
  17389. el = this.el,
  17390. options = this.options,
  17391. preventOnFilter = options.preventOnFilter,
  17392. type = evt.type,
  17393. touch = evt.touches && evt.touches[0],
  17394. target = (touch || evt).target,
  17395. originalTarget = evt.target.shadowRoot && evt.path[0] || target,
  17396. filter = options.filter,
  17397. startIndex;
  17398. _saveInputCheckedState(el);
  17399. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  17400. if (dragEl) {
  17401. return;
  17402. }
  17403. if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
  17404. return; // only left button or enabled
  17405. }
  17406. target = _closest(target, options.draggable, el);
  17407. if (!target) {
  17408. return;
  17409. }
  17410. if (lastDownEl === target) {
  17411. // Ignoring duplicate `down`
  17412. return;
  17413. }
  17414. // Get the index of the dragged element within its parent
  17415. startIndex = _index(target, options.draggable);
  17416. // Check filter
  17417. if (typeof filter === 'function') {
  17418. if (filter.call(this, evt, target, this)) {
  17419. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  17420. preventOnFilter && evt.preventDefault();
  17421. return; // cancel dnd
  17422. }
  17423. }
  17424. else if (filter) {
  17425. filter = filter.split(',').some(function (criteria) {
  17426. criteria = _closest(originalTarget, criteria.trim(), el);
  17427. if (criteria) {
  17428. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  17429. return true;
  17430. }
  17431. });
  17432. if (filter) {
  17433. preventOnFilter && evt.preventDefault();
  17434. return; // cancel dnd
  17435. }
  17436. }
  17437. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  17438. return;
  17439. }
  17440. // Prepare `dragstart`
  17441. this._prepareDragStart(evt, touch, target, startIndex);
  17442. },
  17443. _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  17444. var _this = this,
  17445. el = _this.el,
  17446. options = _this.options,
  17447. ownerDocument = el.ownerDocument,
  17448. dragStartFn;
  17449. if (target && !dragEl && (target.parentNode === el)) {
  17450. tapEvt = evt;
  17451. rootEl = el;
  17452. dragEl = target;
  17453. parentEl = dragEl.parentNode;
  17454. nextEl = dragEl.nextSibling;
  17455. lastDownEl = target;
  17456. activeGroup = options.group;
  17457. oldIndex = startIndex;
  17458. this._lastX = (touch || evt).clientX;
  17459. this._lastY = (touch || evt).clientY;
  17460. dragEl.style['will-change'] = 'transform';
  17461. dragStartFn = function () {
  17462. // Delayed drag has been triggered
  17463. // we can re-enable the events: touchmove/mousemove
  17464. _this._disableDelayedDrag();
  17465. // Make the element draggable
  17466. dragEl.draggable = _this.nativeDraggable;
  17467. // Chosen item
  17468. _toggleClass(dragEl, options.chosenClass, true);
  17469. // Bind the events: dragstart/dragend
  17470. _this._triggerDragStart(evt, touch);
  17471. // Drag start event
  17472. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  17473. };
  17474. // Disable "draggable"
  17475. options.ignore.split(',').forEach(function (criteria) {
  17476. _find(dragEl, criteria.trim(), _disableDraggable);
  17477. });
  17478. _on(ownerDocument, 'mouseup', _this._onDrop);
  17479. _on(ownerDocument, 'touchend', _this._onDrop);
  17480. _on(ownerDocument, 'touchcancel', _this._onDrop);
  17481. _on(ownerDocument, 'pointercancel', _this._onDrop);
  17482. _on(ownerDocument, 'selectstart', _this);
  17483. if (options.delay) {
  17484. // If the user moves the pointer or let go the click or touch
  17485. // before the delay has been reached:
  17486. // disable the delayed drag
  17487. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  17488. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  17489. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  17490. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  17491. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  17492. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  17493. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  17494. } else {
  17495. dragStartFn();
  17496. }
  17497. }
  17498. },
  17499. _disableDelayedDrag: function () {
  17500. var ownerDocument = this.el.ownerDocument;
  17501. clearTimeout(this._dragStartTimer);
  17502. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  17503. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  17504. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  17505. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  17506. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  17507. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  17508. },
  17509. _triggerDragStart: function (/** Event */evt, /** Touch */touch) {
  17510. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  17511. if (touch) {
  17512. // Touch device support
  17513. tapEvt = {
  17514. target: dragEl,
  17515. clientX: touch.clientX,
  17516. clientY: touch.clientY
  17517. };
  17518. this._onDragStart(tapEvt, 'touch');
  17519. }
  17520. else if (!this.nativeDraggable) {
  17521. this._onDragStart(tapEvt, true);
  17522. }
  17523. else {
  17524. _on(dragEl, 'dragend', this);
  17525. _on(rootEl, 'dragstart', this._onDragStart);
  17526. }
  17527. try {
  17528. if (document.selection) {
  17529. // Timeout neccessary for IE9
  17530. setTimeout(function () {
  17531. document.selection.empty();
  17532. });
  17533. } else {
  17534. window.getSelection().removeAllRanges();
  17535. }
  17536. } catch (err) {
  17537. }
  17538. },
  17539. _dragStarted: function () {
  17540. if (rootEl && dragEl) {
  17541. var options = this.options;
  17542. // Apply effect
  17543. _toggleClass(dragEl, options.ghostClass, true);
  17544. _toggleClass(dragEl, options.dragClass, false);
  17545. Sortable.active = this;
  17546. // Drag start event
  17547. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  17548. } else {
  17549. this._nulling();
  17550. }
  17551. },
  17552. _emulateDragOver: function () {
  17553. if (touchEvt) {
  17554. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  17555. return;
  17556. }
  17557. this._lastX = touchEvt.clientX;
  17558. this._lastY = touchEvt.clientY;
  17559. if (!supportCssPointerEvents) {
  17560. _css(ghostEl, 'display', 'none');
  17561. }
  17562. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  17563. parent = target,
  17564. i = touchDragOverListeners.length;
  17565. if (parent) {
  17566. do {
  17567. if (parent[expando]) {
  17568. while (i--) {
  17569. touchDragOverListeners[i]({
  17570. clientX: touchEvt.clientX,
  17571. clientY: touchEvt.clientY,
  17572. target: target,
  17573. rootEl: parent
  17574. });
  17575. }
  17576. break;
  17577. }
  17578. target = parent; // store last element
  17579. }
  17580. /* jshint boss:true */
  17581. while (parent = parent.parentNode);
  17582. }
  17583. if (!supportCssPointerEvents) {
  17584. _css(ghostEl, 'display', '');
  17585. }
  17586. }
  17587. },
  17588. _onTouchMove: function (/**TouchEvent*/evt) {
  17589. if (tapEvt) {
  17590. var options = this.options,
  17591. fallbackTolerance = options.fallbackTolerance,
  17592. fallbackOffset = options.fallbackOffset,
  17593. touch = evt.touches ? evt.touches[0] : evt,
  17594. dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
  17595. dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
  17596. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  17597. // only set the status to dragging, when we are actually dragging
  17598. if (!Sortable.active) {
  17599. if (fallbackTolerance &&
  17600. min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
  17601. ) {
  17602. return;
  17603. }
  17604. this._dragStarted();
  17605. }
  17606. // as well as creating the ghost element on the document body
  17607. this._appendGhost();
  17608. moved = true;
  17609. touchEvt = touch;
  17610. _css(ghostEl, 'webkitTransform', translate3d);
  17611. _css(ghostEl, 'mozTransform', translate3d);
  17612. _css(ghostEl, 'msTransform', translate3d);
  17613. _css(ghostEl, 'transform', translate3d);
  17614. evt.preventDefault();
  17615. }
  17616. },
  17617. _appendGhost: function () {
  17618. if (!ghostEl) {
  17619. var rect = dragEl.getBoundingClientRect(),
  17620. css = _css(dragEl),
  17621. options = this.options,
  17622. ghostRect;
  17623. ghostEl = dragEl.cloneNode(true);
  17624. _toggleClass(ghostEl, options.ghostClass, false);
  17625. _toggleClass(ghostEl, options.fallbackClass, true);
  17626. _toggleClass(ghostEl, options.dragClass, true);
  17627. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  17628. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  17629. _css(ghostEl, 'width', rect.width);
  17630. _css(ghostEl, 'height', rect.height);
  17631. _css(ghostEl, 'opacity', '0.8');
  17632. _css(ghostEl, 'position', 'fixed');
  17633. _css(ghostEl, 'zIndex', '100000');
  17634. _css(ghostEl, 'pointerEvents', 'none');
  17635. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  17636. // Fixing dimensions.
  17637. ghostRect = ghostEl.getBoundingClientRect();
  17638. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  17639. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  17640. }
  17641. },
  17642. _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
  17643. var dataTransfer = evt.dataTransfer,
  17644. options = this.options;
  17645. this._offUpEvents();
  17646. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  17647. cloneEl = _clone(dragEl);
  17648. cloneEl.draggable = false;
  17649. cloneEl.style['will-change'] = '';
  17650. _css(cloneEl, 'display', 'none');
  17651. _toggleClass(cloneEl, this.options.chosenClass, false);
  17652. rootEl.insertBefore(cloneEl, dragEl);
  17653. _dispatchEvent(this, rootEl, 'clone', dragEl);
  17654. }
  17655. _toggleClass(dragEl, options.dragClass, true);
  17656. if (useFallback) {
  17657. if (useFallback === 'touch') {
  17658. // Bind touch events
  17659. _on(document, 'touchmove', this._onTouchMove);
  17660. _on(document, 'touchend', this._onDrop);
  17661. _on(document, 'touchcancel', this._onDrop);
  17662. _on(document, 'pointermove', this._onTouchMove);
  17663. _on(document, 'pointerup', this._onDrop);
  17664. } else {
  17665. // Old brwoser
  17666. _on(document, 'mousemove', this._onTouchMove);
  17667. _on(document, 'mouseup', this._onDrop);
  17668. }
  17669. this._loopId = setInterval(this._emulateDragOver, 50);
  17670. }
  17671. else {
  17672. if (dataTransfer) {
  17673. dataTransfer.effectAllowed = 'move';
  17674. options.setData && options.setData.call(this, dataTransfer, dragEl);
  17675. }
  17676. _on(document, 'drop', this);
  17677. setTimeout(this._dragStarted, 0);
  17678. }
  17679. },
  17680. _onDragOver: function (/**Event*/evt) {
  17681. var el = this.el,
  17682. target,
  17683. dragRect,
  17684. targetRect,
  17685. revert,
  17686. options = this.options,
  17687. group = options.group,
  17688. activeSortable = Sortable.active,
  17689. isOwner = (activeGroup === group),
  17690. isMovingBetweenSortable = false,
  17691. canSort = options.sort;
  17692. if (evt.preventDefault !== void 0) {
  17693. evt.preventDefault();
  17694. !options.dragoverBubble && evt.stopPropagation();
  17695. }
  17696. if (dragEl.animated) {
  17697. return;
  17698. }
  17699. moved = true;
  17700. if (activeSortable && !options.disabled &&
  17701. (isOwner
  17702. ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  17703. : (
  17704. putSortable === this ||
  17705. (
  17706. (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
  17707. group.checkPut(this, activeSortable, dragEl, evt)
  17708. )
  17709. )
  17710. ) &&
  17711. (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  17712. ) {
  17713. // Smart auto-scrolling
  17714. _autoScroll(evt, options, this.el);
  17715. if (_silent) {
  17716. return;
  17717. }
  17718. target = _closest(evt.target, options.draggable, el);
  17719. dragRect = dragEl.getBoundingClientRect();
  17720. if (putSortable !== this) {
  17721. putSortable = this;
  17722. isMovingBetweenSortable = true;
  17723. }
  17724. if (revert) {
  17725. _cloneHide(activeSortable, true);
  17726. parentEl = rootEl; // actualization
  17727. if (cloneEl || nextEl) {
  17728. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  17729. }
  17730. else if (!canSort) {
  17731. rootEl.appendChild(dragEl);
  17732. }
  17733. return;
  17734. }
  17735. if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
  17736. (el === evt.target) && (target = _ghostIsLast(el, evt))
  17737. ) {
  17738. if (target) {
  17739. if (target.animated) {
  17740. return;
  17741. }
  17742. targetRect = target.getBoundingClientRect();
  17743. }
  17744. _cloneHide(activeSortable, isOwner);
  17745. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  17746. if (!dragEl.contains(el)) {
  17747. el.appendChild(dragEl);
  17748. parentEl = el; // actualization
  17749. }
  17750. this._animate(dragRect, dragEl);
  17751. target && this._animate(targetRect, target);
  17752. }
  17753. }
  17754. else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
  17755. if (lastEl !== target) {
  17756. lastEl = target;
  17757. lastCSS = _css(target);
  17758. lastParentCSS = _css(target.parentNode);
  17759. }
  17760. targetRect = target.getBoundingClientRect();
  17761. var width = targetRect.right - targetRect.left,
  17762. height = targetRect.bottom - targetRect.top,
  17763. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
  17764. || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
  17765. isWide = (target.offsetWidth > dragEl.offsetWidth),
  17766. isLong = (target.offsetHeight > dragEl.offsetHeight),
  17767. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  17768. nextSibling = target.nextElementSibling,
  17769. moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
  17770. after = false
  17771. ;
  17772. if (moveVector !== false) {
  17773. _silent = true;
  17774. setTimeout(_unsilent, 30);
  17775. _cloneHide(activeSortable, isOwner);
  17776. if (moveVector === 1 || moveVector === -1) {
  17777. after = (moveVector === 1);
  17778. }
  17779. else if (floating) {
  17780. var elTop = dragEl.offsetTop,
  17781. tgTop = target.offsetTop;
  17782. if (elTop === tgTop) {
  17783. after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
  17784. }
  17785. else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  17786. after = (evt.clientY - targetRect.top) / height > 0.5;
  17787. } else {
  17788. after = tgTop > elTop;
  17789. }
  17790. } else if (!isMovingBetweenSortable) {
  17791. after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
  17792. }
  17793. if (!dragEl.contains(el)) {
  17794. if (after && !nextSibling) {
  17795. el.appendChild(dragEl);
  17796. } else {
  17797. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  17798. }
  17799. }
  17800. parentEl = dragEl.parentNode; // actualization
  17801. this._animate(dragRect, dragEl);
  17802. this._animate(targetRect, target);
  17803. }
  17804. }
  17805. }
  17806. },
  17807. _animate: function (prevRect, target) {
  17808. var ms = this.options.animation;
  17809. if (ms) {
  17810. var currentRect = target.getBoundingClientRect();
  17811. if (prevRect.nodeType === 1) {
  17812. prevRect = prevRect.getBoundingClientRect();
  17813. }
  17814. _css(target, 'transition', 'none');
  17815. _css(target, 'transform', 'translate3d('
  17816. + (prevRect.left - currentRect.left) + 'px,'
  17817. + (prevRect.top - currentRect.top) + 'px,0)'
  17818. );
  17819. target.offsetWidth; // repaint
  17820. _css(target, 'transition', 'all ' + ms + 'ms');
  17821. _css(target, 'transform', 'translate3d(0,0,0)');
  17822. clearTimeout(target.animated);
  17823. target.animated = setTimeout(function () {
  17824. _css(target, 'transition', '');
  17825. _css(target, 'transform', '');
  17826. target.animated = false;
  17827. }, ms);
  17828. }
  17829. },
  17830. _offUpEvents: function () {
  17831. var ownerDocument = this.el.ownerDocument;
  17832. _off(document, 'touchmove', this._onTouchMove);
  17833. _off(document, 'pointermove', this._onTouchMove);
  17834. _off(ownerDocument, 'mouseup', this._onDrop);
  17835. _off(ownerDocument, 'touchend', this._onDrop);
  17836. _off(ownerDocument, 'pointerup', this._onDrop);
  17837. _off(ownerDocument, 'touchcancel', this._onDrop);
  17838. _off(ownerDocument, 'selectstart', this);
  17839. },
  17840. _onDrop: function (/**Event*/evt) {
  17841. var el = this.el,
  17842. options = this.options;
  17843. clearInterval(this._loopId);
  17844. clearInterval(autoScroll.pid);
  17845. clearTimeout(this._dragStartTimer);
  17846. // Unbind events
  17847. _off(document, 'mousemove', this._onTouchMove);
  17848. if (this.nativeDraggable) {
  17849. _off(document, 'drop', this);
  17850. _off(el, 'dragstart', this._onDragStart);
  17851. }
  17852. this._offUpEvents();
  17853. if (evt) {
  17854. if (moved) {
  17855. evt.preventDefault();
  17856. !options.dropBubble && evt.stopPropagation();
  17857. }
  17858. ghostEl && ghostEl.parentNode.removeChild(ghostEl);
  17859. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  17860. // Remove clone
  17861. cloneEl && cloneEl.parentNode.removeChild(cloneEl);
  17862. }
  17863. if (dragEl) {
  17864. if (this.nativeDraggable) {
  17865. _off(dragEl, 'dragend', this);
  17866. }
  17867. _disableDraggable(dragEl);
  17868. dragEl.style['will-change'] = '';
  17869. // Remove class's
  17870. _toggleClass(dragEl, this.options.ghostClass, false);
  17871. _toggleClass(dragEl, this.options.chosenClass, false);
  17872. if (rootEl !== parentEl) {
  17873. newIndex = _index(dragEl, options.draggable);
  17874. if (newIndex >= 0) {
  17875. // Add event
  17876. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  17877. // Remove event
  17878. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  17879. // drag from one list and drop into another
  17880. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  17881. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  17882. }
  17883. }
  17884. else {
  17885. if (dragEl.nextSibling !== nextEl) {
  17886. // Get the index of the dragged element within its parent
  17887. newIndex = _index(dragEl, options.draggable);
  17888. if (newIndex >= 0) {
  17889. // drag & drop within the same list
  17890. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  17891. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  17892. }
  17893. }
  17894. }
  17895. if (Sortable.active) {
  17896. /* jshint eqnull:true */
  17897. if (newIndex == null || newIndex === -1) {
  17898. newIndex = oldIndex;
  17899. }
  17900. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  17901. // Save sorting
  17902. this.save();
  17903. }
  17904. }
  17905. }
  17906. this._nulling();
  17907. },
  17908. _nulling: function() {
  17909. rootEl =
  17910. dragEl =
  17911. parentEl =
  17912. ghostEl =
  17913. nextEl =
  17914. cloneEl =
  17915. lastDownEl =
  17916. scrollEl =
  17917. scrollParentEl =
  17918. tapEvt =
  17919. touchEvt =
  17920. moved =
  17921. newIndex =
  17922. lastEl =
  17923. lastCSS =
  17924. putSortable =
  17925. activeGroup =
  17926. Sortable.active = null;
  17927. savedInputChecked.forEach(function (el) {
  17928. el.checked = true;
  17929. });
  17930. savedInputChecked.length = 0;
  17931. },
  17932. handleEvent: function (/**Event*/evt) {
  17933. switch (evt.type) {
  17934. case 'drop':
  17935. case 'dragend':
  17936. this._onDrop(evt);
  17937. break;
  17938. case 'dragover':
  17939. case 'dragenter':
  17940. if (dragEl) {
  17941. this._onDragOver(evt);
  17942. _globalDragOver(evt);
  17943. }
  17944. break;
  17945. case 'selectstart':
  17946. evt.preventDefault();
  17947. break;
  17948. }
  17949. },
  17950. /**
  17951. * Serializes the item into an array of string.
  17952. * @returns {String[]}
  17953. */
  17954. toArray: function () {
  17955. var order = [],
  17956. el,
  17957. children = this.el.children,
  17958. i = 0,
  17959. n = children.length,
  17960. options = this.options;
  17961. for (; i < n; i++) {
  17962. el = children[i];
  17963. if (_closest(el, options.draggable, this.el)) {
  17964. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  17965. }
  17966. }
  17967. return order;
  17968. },
  17969. /**
  17970. * Sorts the elements according to the array.
  17971. * @param {String[]} order order of the items
  17972. */
  17973. sort: function (order) {
  17974. var items = {}, rootEl = this.el;
  17975. this.toArray().forEach(function (id, i) {
  17976. var el = rootEl.children[i];
  17977. if (_closest(el, this.options.draggable, rootEl)) {
  17978. items[id] = el;
  17979. }
  17980. }, this);
  17981. order.forEach(function (id) {
  17982. if (items[id]) {
  17983. rootEl.removeChild(items[id]);
  17984. rootEl.appendChild(items[id]);
  17985. }
  17986. });
  17987. },
  17988. /**
  17989. * Save the current sorting
  17990. */
  17991. save: function () {
  17992. var store = this.options.store;
  17993. store && store.set(this);
  17994. },
  17995. /**
  17996. * 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.
  17997. * @param {HTMLElement} el
  17998. * @param {String} [selector] default: `options.draggable`
  17999. * @returns {HTMLElement|null}
  18000. */
  18001. closest: function (el, selector) {
  18002. return _closest(el, selector || this.options.draggable, this.el);
  18003. },
  18004. /**
  18005. * Set/get option
  18006. * @param {string} name
  18007. * @param {*} [value]
  18008. * @returns {*}
  18009. */
  18010. option: function (name, value) {
  18011. var options = this.options;
  18012. if (value === void 0) {
  18013. return options[name];
  18014. } else {
  18015. options[name] = value;
  18016. if (name === 'group') {
  18017. _prepareGroup(options);
  18018. }
  18019. }
  18020. },
  18021. /**
  18022. * Destroy
  18023. */
  18024. destroy: function () {
  18025. var el = this.el;
  18026. el[expando] = null;
  18027. _off(el, 'mousedown', this._onTapStart);
  18028. _off(el, 'touchstart', this._onTapStart);
  18029. _off(el, 'pointerdown', this._onTapStart);
  18030. if (this.nativeDraggable) {
  18031. _off(el, 'dragover', this);
  18032. _off(el, 'dragenter', this);
  18033. }
  18034. // Remove draggable attributes
  18035. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  18036. el.removeAttribute('draggable');
  18037. });
  18038. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  18039. this._onDrop();
  18040. this.el = el = null;
  18041. }
  18042. };
  18043. function _cloneHide(sortable, state) {
  18044. if (sortable.lastPullMode !== 'clone') {
  18045. state = true;
  18046. }
  18047. if (cloneEl && (cloneEl.state !== state)) {
  18048. _css(cloneEl, 'display', state ? 'none' : '');
  18049. if (!state) {
  18050. if (cloneEl.state) {
  18051. if (sortable.options.group.revertClone) {
  18052. rootEl.insertBefore(cloneEl, nextEl);
  18053. sortable._animate(dragEl, cloneEl);
  18054. } else {
  18055. rootEl.insertBefore(cloneEl, dragEl);
  18056. }
  18057. }
  18058. }
  18059. cloneEl.state = state;
  18060. }
  18061. }
  18062. function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  18063. if (el) {
  18064. ctx = ctx || document;
  18065. do {
  18066. if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
  18067. return el;
  18068. }
  18069. /* jshint boss:true */
  18070. } while (el = _getParentOrHost(el));
  18071. }
  18072. return null;
  18073. }
  18074. function _getParentOrHost(el) {
  18075. var parent = el.host;
  18076. return (parent && parent.nodeType) ? parent : el.parentNode;
  18077. }
  18078. function _globalDragOver(/**Event*/evt) {
  18079. if (evt.dataTransfer) {
  18080. evt.dataTransfer.dropEffect = 'move';
  18081. }
  18082. evt.preventDefault();
  18083. }
  18084. function _on(el, event, fn) {
  18085. el.addEventListener(event, fn, captureMode);
  18086. }
  18087. function _off(el, event, fn) {
  18088. el.removeEventListener(event, fn, captureMode);
  18089. }
  18090. function _toggleClass(el, name, state) {
  18091. if (el) {
  18092. if (el.classList) {
  18093. el.classList[state ? 'add' : 'remove'](name);
  18094. }
  18095. else {
  18096. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  18097. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  18098. }
  18099. }
  18100. }
  18101. function _css(el, prop, val) {
  18102. var style = el && el.style;
  18103. if (style) {
  18104. if (val === void 0) {
  18105. if (document.defaultView && document.defaultView.getComputedStyle) {
  18106. val = document.defaultView.getComputedStyle(el, '');
  18107. }
  18108. else if (el.currentStyle) {
  18109. val = el.currentStyle;
  18110. }
  18111. return prop === void 0 ? val : val[prop];
  18112. }
  18113. else {
  18114. if (!(prop in style)) {
  18115. prop = '-webkit-' + prop;
  18116. }
  18117. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  18118. }
  18119. }
  18120. }
  18121. function _find(ctx, tagName, iterator) {
  18122. if (ctx) {
  18123. var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
  18124. if (iterator) {
  18125. for (; i < n; i++) {
  18126. iterator(list[i], i);
  18127. }
  18128. }
  18129. return list;
  18130. }
  18131. return [];
  18132. }
  18133. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  18134. sortable = (sortable || rootEl[expando]);
  18135. var evt = document.createEvent('Event'),
  18136. options = sortable.options,
  18137. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  18138. evt.initEvent(name, true, true);
  18139. evt.to = rootEl;
  18140. evt.from = fromEl || rootEl;
  18141. evt.item = targetEl || rootEl;
  18142. evt.clone = cloneEl;
  18143. evt.oldIndex = startIndex;
  18144. evt.newIndex = newIndex;
  18145. rootEl.dispatchEvent(evt);
  18146. if (options[onName]) {
  18147. options[onName].call(sortable, evt);
  18148. }
  18149. }
  18150. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) {
  18151. var evt,
  18152. sortable = fromEl[expando],
  18153. onMoveFn = sortable.options.onMove,
  18154. retVal;
  18155. evt = document.createEvent('Event');
  18156. evt.initEvent('move', true, true);
  18157. evt.to = toEl;
  18158. evt.from = fromEl;
  18159. evt.dragged = dragEl;
  18160. evt.draggedRect = dragRect;
  18161. evt.related = targetEl || toEl;
  18162. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  18163. fromEl.dispatchEvent(evt);
  18164. if (onMoveFn) {
  18165. retVal = onMoveFn.call(sortable, evt, originalEvt);
  18166. }
  18167. return retVal;
  18168. }
  18169. function _disableDraggable(el) {
  18170. el.draggable = false;
  18171. }
  18172. function _unsilent() {
  18173. _silent = false;
  18174. }
  18175. /** @returns {HTMLElement|false} */
  18176. function _ghostIsLast(el, evt) {
  18177. var lastEl = el.lastElementChild,
  18178. rect = lastEl.getBoundingClientRect();
  18179. // 5 — min delta
  18180. // abs — нельзя добавлять, а то глюки при наведении сверху
  18181. return (
  18182. (evt.clientY - (rect.top + rect.height) > 5) ||
  18183. (evt.clientX - (rect.right + rect.width) > 5)
  18184. ) && lastEl;
  18185. }
  18186. /**
  18187. * Generate id
  18188. * @param {HTMLElement} el
  18189. * @returns {String}
  18190. * @private
  18191. */
  18192. function _generateId(el) {
  18193. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  18194. i = str.length,
  18195. sum = 0;
  18196. while (i--) {
  18197. sum += str.charCodeAt(i);
  18198. }
  18199. return sum.toString(36);
  18200. }
  18201. /**
  18202. * Returns the index of an element within its parent for a selected set of
  18203. * elements
  18204. * @param {HTMLElement} el
  18205. * @param {selector} selector
  18206. * @return {number}
  18207. */
  18208. function _index(el, selector) {
  18209. var index = 0;
  18210. if (!el || !el.parentNode) {
  18211. return -1;
  18212. }
  18213. while (el && (el = el.previousElementSibling)) {
  18214. if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
  18215. index++;
  18216. }
  18217. }
  18218. return index;
  18219. }
  18220. function _matches(/**HTMLElement*/el, /**String*/selector) {
  18221. if (el) {
  18222. selector = selector.split('.');
  18223. var tag = selector.shift().toUpperCase(),
  18224. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  18225. return (
  18226. (tag === '' || el.nodeName.toUpperCase() == tag) &&
  18227. (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
  18228. );
  18229. }
  18230. return false;
  18231. }
  18232. function _throttle(callback, ms) {
  18233. var args, _this;
  18234. return function () {
  18235. if (args === void 0) {
  18236. args = arguments;
  18237. _this = this;
  18238. setTimeout(function () {
  18239. if (args.length === 1) {
  18240. callback.call(_this, args[0]);
  18241. } else {
  18242. callback.apply(_this, args);
  18243. }
  18244. args = void 0;
  18245. }, ms);
  18246. }
  18247. };
  18248. }
  18249. function _extend(dst, src) {
  18250. if (dst && src) {
  18251. for (var key in src) {
  18252. if (src.hasOwnProperty(key)) {
  18253. dst[key] = src[key];
  18254. }
  18255. }
  18256. }
  18257. return dst;
  18258. }
  18259. function _clone(el) {
  18260. return $
  18261. ? $(el).clone(true)[0]
  18262. : (Polymer && Polymer.dom
  18263. ? Polymer.dom(el).cloneNode(true)
  18264. : el.cloneNode(true)
  18265. );
  18266. }
  18267. function _saveInputCheckedState(root) {
  18268. var inputs = root.getElementsByTagName('input');
  18269. var idx = inputs.length;
  18270. while (idx--) {
  18271. var el = inputs[idx];
  18272. el.checked && savedInputChecked.push(el);
  18273. }
  18274. }
  18275. // Fixed #973:
  18276. _on(document, 'touchmove', function (evt) {
  18277. if (Sortable.active) {
  18278. evt.preventDefault();
  18279. }
  18280. });
  18281. try {
  18282. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  18283. get: function () {
  18284. captureMode = {
  18285. capture: false,
  18286. passive: false
  18287. };
  18288. }
  18289. }));
  18290. } catch (err) {}
  18291. // Export utils
  18292. Sortable.utils = {
  18293. on: _on,
  18294. off: _off,
  18295. css: _css,
  18296. find: _find,
  18297. is: function (el, selector) {
  18298. return !!_closest(el, selector, el);
  18299. },
  18300. extend: _extend,
  18301. throttle: _throttle,
  18302. closest: _closest,
  18303. toggleClass: _toggleClass,
  18304. clone: _clone,
  18305. index: _index
  18306. };
  18307. /**
  18308. * Create sortable instance
  18309. * @param {HTMLElement} el
  18310. * @param {Object} [options]
  18311. */
  18312. Sortable.create = function (el, options) {
  18313. return new Sortable(el, options);
  18314. };
  18315. // Export
  18316. Sortable.version = '1.5.1';
  18317. return Sortable;
  18318. });
  18319. /***/ }),
  18320. /* 101 */
  18321. /***/ (function(module, exports) {
  18322. module.exports = "data:application/vnd.ms-fontobject;base64,pj8AAIw+AAABAAIAAAAAAAIABgMAAAAAAAABAPQBAAAAAExQAQAAAAAAABAAAAAAAAAAAAEAAAAAAAAAKj2ZxQAAAAAAAAAAAAAAAAAAAAAAABAAaQBjAG8AbgBmAG8AbgB0AAAADABNAGUAZABpAHUAbQAAAIoAVgBlAHIAcwBpAG8AbgAgADEALgAwADsAIAB0AHQAZgBhAHUAdABvAGgAaQBuAHQAIAAoAHYAMAAuADkANAApACAALQBsACAAOAAgAC0AcgAgADUAMAAgAC0ARwAgADIAMAAwACAALQB4ACAAMQA0ACAALQB3ACAAIgBHACIAIAAtAGYAIAAtAHMAAAAQAGkAYwBvAG4AZgBvAG4AdAAAAAAAAAEAAAAQAQAABAAARkZUTXZHMeAAAAEMAAAAHEdERUYAUgAGAAABKAAAACBPUy8yV6halgAAAUgAAABWY21hcL2Ds2kAAAGgAAABqGN2dCANZf5MAAA0OAAAACRmcGdtMPeelQAANFwAAAmWZ2FzcAAAABAAADQwAAAACGdseWZJFyqxAAADSAAALDRoZWFkDijSuQAAL3wAAAA2aGhlYQjeBE8AAC+0AAAAJGhtdHh/CAn8AAAv2AAAAIxsb2Nho5yvDgAAMGQAAABMbWF4cAIkCrwAADCwAAAAIG5hbWUckFeqAAAw0AAAAihwb3N0xwSeMQAAMvgAAAE2cHJlcKW5vmYAAD30AAAAlQAAAAEAAAAAzD2izwAAAADVBMeIAAAAANUEx4gAAQAAAA4AAAAYAAAAAAACAAEAAwAkAAEABAAAAAIAAAABBAYB9AAFAAgCmQLMAAAAjwKZAswAAAHrADMBCQAAAgAGAwAAAAAAAAAAAAEQAAAAAAAAAAAAAABQZkVkAEAAeOd9A4D/gABcA4AA1AAAAAEAAAAAAAAAAAADAAAAAwAAABwAAQAAAAAAogADAAEAAAAcAAQAhgAAAA4ACAACAAYAAAB45hXmH+Y6533//wAAAAAAeOYA5hfmOud9//8AAP+LAAAAABnkGKcAAQAAAAAACgA0AAAAAAAAAAUADwARABIACAAjAB8ABgAHAA4AEwAUABUABAAaABwAHQAgABAACwAMACIACQAWABcAGwAhAA0ACgAYABkAAAEGAAABAAAAAAAAAAECAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUALP/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/j8TDQEgDRMTDf7gDYMUKBwcKBwAAAIAZv+SA5oCxgALACoAOEA1DAECBQFAAAMABQADBWYABQIABQJkAAAAAgQAAlkABAEBBE0ABAQBUQABBAFFFxkUKRUQBhQrACIOARQeATI+ATQmARQeAjMyPwE2NzIfAR4BBwMxBw4BLwEuAT8BPgEXAm/evW1tvd69bW3+TAoIDAQQXYoHCA0ILQcBB/o1BxYHlwgBCCMHFggCxW293r1tbb3evf6lAQoIB2ieCAEHLAgVCP74OQcBB44HFgglCAEIAAACAH8AIQOBAyMACwAXAGZLsDJQWEAkBwEFAAYABQZmBAECAwEDAgFmAAMAAQMBVQAGBgBSAAAACgZCG0AqBwEFAAYABQZmBAECAwEDAgFmAAAABgMABlcAAwIBA0sAAwMBUQABAwFFWUAKEREREREVFRAIFisAIg4BFB4BMj4BNCYDIzUjFSMRMxUzNTMCaNCxZ2ex0LFnZ4UyxDIyxDIDImex0bFnZ7HRsf4br68Bi7OzAAADAFX/LAOrAywAEgAaADMAcUAOMxsCAwIREAkHBAEAAkBLsBpQWEAdBgQIAwMAAAEDAFkAAQAFAQVWAAICB1EABwcKAkIbQCMABwACAwcCWQYECAMDAAABAwBZAAEFBQFNAAEBBVIABQEFRllAExMTMTAtKyYjHhwTGhMaGDgSCRErJTQ2MhYVFAcWFxQGKwEiJjU3JgM1NDYyFh0BJRUjIgYVERQWMyEyNjURNCYrATU0JiIGFQGrMkYyJwkJEw1ADRMSJ1ZkjmT+QEAkMjIkAqokMjIkQKLmopcjMjIjLxkyPA0TEw1uGQEZlkZkZEaWlpYyI/5VIzIyIwGrIzKWc6KicwAAAAADAA8AWQPxAqcADwAfACcANkAzAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAlJCEgHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY1BCImNDYyFhQC2f5OdKOjdAGydKOjZX9a/k5af39aAbJaf/3UiGBgiGBao3Mgc6OjcyBzowE2Wn5+WiBaf39akWGIYGCIAAAAAAMADwBZA/ECpwAPACAAKAA9QDogEAIEBQFAAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAmJSIhHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY9AQYiJjQ2MhYUAtn+TnSjo3QBsnSjo2Z/Wv5MWX9/WQG0Wn+xiGBgiGFao3Mgc6OjcyBzowE1Wn9/Wh9af39aH7BhiGBgiAAAAAACAAD/XwQAAwQAIQA1AFW1AwEDBAFAS7AaUFhAGgACAwEDAgFmAAMAAQMBVQAEBABRAAAACgRCG0AgAAIDAQMCAWYAAAAEAwAEWQADAgEDTQADAwFRAAEDAUVZtigsETgpBRMrLQEmJzY1NCYnJiMiBgcGFRQWFxY7ATI3MhYxBRY2PwE2JiUOASMmJy4BNTQ3PgEzMhceARUUA+P+8AIEJUVBaYpSmDdYRUJpiAF5ZAECARAbSBcGGAT+TChtO2JMLzJAJ207Y0svMgPjAgJPUVKYN1lGQWmKUpk3WEgD4xcJHQccSe4vMgE/J247Y0swMT8obTtjAAMAdP+gA4wCuAAPABkAHAAmQCMZAQACGxgCAQACQBwaAgE9AAIAAmgAAAEAaAABAV8SFxYDESslJyY0NwE2Mh8BFhQHAQYiATYyHwEWFA8BJwE3FwGAqQYGAXwGEAapBgb+hAYRATASMRJwEhI4xf33OMYDqQURBgF8BgapBhAG/oQGAqkSEnASMRI4xf0y/sYAAAADAGv/6wOVAxUACwAbACsATEuwLlBYQB0AAwAEBQMEWQACAgFRAAEBCkEABQUAUQAAAAsAQhtAGgADAAQFAwRZAAUAAAUAVQACAgFRAAEBCgJCWbc1NTU3FRAGFCsEIi4BND4BMh4BFAYDNCYrASIGHQEUFjsBMjY1FTQmKwEiBh0BFBY7ATI2NQJu3LpsbLrcumxs8QsHSgcLCwdKBwsLB0oHCwsHSgcLFGy63LpsbLrcugIFBwsLB0oICgoIgQgLCwjvBwsLBwAAAAABATIArgLWAlIAHAAnQCQABAMBBE0FAQMGAgIAAQMAWQAEBAFRAAEEAUUTIxMjIxMQBxUrASMVFAYiJj0BIyImNDY7ATU0NjIWHQEzMhYUBiMCu50PFhCdCw8PC50QFg+dCw8PCwFmngoQEAqeDxYPnQsPDwudDxYPAAAAAwBJASsDtQH2AAcADwAXACFAHgQCAgABAQBNBAICAAABUQUDAgEAAUUTExMTExAGFCsSIgYUFjI2NCQiBhQWMjY0JCIGFBYyNjTYUzs7UzwBFVQ7O1Q7ARZUOztUOwH1O1Q7O1Q7O1Q7O1Q7O1Q7O1QAAAAJAED/vgO/Az4ADwAfAC8APwBPAF8AbwB/AI8Ah0CEFAQTAhIFAAUDAgEGAAFZFwoWCBUFBgsJAgcMBgdZGhAZDhgFDA0NDE0aEBkOGAUMDA1REQ8CDQwNRYKAcnBiYFJQQkAyMCIgEhACAIqHgI+Cj3p3cH9yf2pnYG9ib1pXUF9SX0pHQE9CTzo3MD8yPyonIC8iLxoXEB8SHwoHAA8CDxsOKwEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgJZswwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgM+EgyzDBISDLMMEhIMswwSEgyzDBISDLMMEhIMswwS/rgSDLMNERENswwSEgyzDRERDbMMEhIMsw0REQ2zDBL+uBIMsw0REQ2zDBISDLMNERENswwSEgyzDRERDbMMEgALAED/awOgAmwABgAKAA4AEgAWABoAHgAiACYAKgAuAU20BQEPAT9LsApQWEBRAAAEAwQAA2YLCQIHBgEGB14SEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0uwGFBYQFIAAAQDBAADZgsJAgcGAQYHAWYSEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0BXAAAEAwQAA2YLCQIHBgEGBwFmEhACDg8OaQAFGAEEAAUEVwADAAYHAwZXCggXAgQBABMMARNXAAwAFRQMFVcAFAANFhQNVwAWDw8WSwAWFg9PEQEPFg9DWVlANgcHAAAuLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsHCgcKCQgABgAGEREZECslESMRIxc3ARUjNSUhESEFMxUjNzMVIzczFSMFMxUjNzMVIzczFSMnMxUjJTMVIwMAQKDAwP2gwAEA/sABQP7AYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQGwBgP6AwMABwMDAQP7AgEBAQEBggGBAQEBA4GBAYAAAAAsAQP9sA6ECbAAGAAoADgASABYAGgAeACIAJgAqAC4BA7QFAREBP0uwClBYQFwHBQIDBANoFwICAQsKCwEKZg4MAgoVFQpcAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRBtAXQcFAgMEA2gXAgIBCwoLAQpmDgwCChULChVkAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRFlANicnAAAuLSwrJyonKikoJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcABgAGEREZECsBETMRMycHATMVIzczFSM3MxUjBTMVIzczFSM3MxUjJzMVIyUzFSMRFSM1JSERIQLAQKDAwP4gYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQMABAP7AAUABLP6AAYDAwAFAQEBAQGCAYEBAQEDgYEBg/uDAwED+wAACAFf/1wOpAykACwAXAJRLsB1QWEAmBAECAwUDAgVmBwEFBgMFBmQAAwMBUQABAQpBAAYGAFIAAAALAEIbS7AyUFhAJAQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgYAUgAAAAsAQhtAKQQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgAABksABgYAUgAABgBGWVlAChERERERFRUQCBYrBCIuATQ+ATIeARQGAyM1IxUjFTMVMzUzAnPmxHJyxObEcnJjqlSqqlSqKXLE5sRycsTmxAFhqqpUqqoAAAMAQAAAA8EC4AAjAEAATABLQEgJAQcALCscGwQFBgJABwEAPgkCAQMACggCBwMAB1kAAwAGBQMGWQAFBAQFTQAFBQRRAAQFBEVDQUlGQUxDTCZlNTVnFREiCxYrATQmKwEwIjEGBwYwIwYHBgcGBwYjKgEjISIGFRMUFjMhMjY1JxQGIyEiJjUDNDYzIToBMzI2NzY3NjczMhYdAiUhMjY0JiMhIgYUFgPBOSe6AgYEAQEFAxIRAwEEFwENAf5gKDggOCgCgCg4QBMN/YANEyATDQGgAQ0BIy8HAgIIBagNE/z/AaANExMN/mANExMCgCg4AQEBAwMRRwwCETkp/mIoODgmAg0TFA4Bng0TIh8ECyIOEw0CASMTGhMTGhMAAAQAX//BA7MDSQAFAAkADQATAA1AChMRDAoJBwUDBCYrLQEHCQEnNwkCEQ0BJQElBwkBJwIJ/ogyAaoBqjMz/lb+VgGqAS7+0v7SAS7+iDIBqgGqM8L3NP7dASM1bAEj/t3+3QHxzs/P/fv4NP7dASM1AAAABAC//8ADQANAABkAIwAzAEMAV0BUISAbGgkIAgEIAQQ7NAIJCAJAAAAABAEABFkFCgMDAQAHCAEHWQAIAAkGCAlZAAYCAgZNAAYGAlIAAgYCRgAAQD84NzEuKSYjIh4dABkAGTUkJAsRKwE1MS4BIyIGBzEVIyIGFREUFjMhMjY1ETQmJTE+ATIWFzEVIQEUBiMhIiY1ETQ2MyEyFhUHNTQmIgYdAQYVFBYyNjU0AwEDlWholQMBGyUlGwIAGyUl/iYCcJxwAv6AAb8TDf5ADRMTDQHADRPgExoTHCMyIwHAh2iRkWeIJRv+gBslJRsBgBomhU5tbU6F/mANExMNAUANExMNkjQNExMNNBIhGSMjGSEABgCJ/6oDswNIAAsAFwAuAEAAUgBZAIFAflcBBQ0uAQ4PAkAABAANBQQNWQAFAAkPBQlZEgEPAA4ADw5ZEAEAAAECAAFZEQECAAMMAgNZAAwKAQcIDAdZCwEIBgYITQsBCAgGUQAGCAZFVFMODAIAU1lUWVJQTUtGQ0A/PTs4NjEvKigmIx4cGhgUEQwXDhcIBQALAgsTDisBISIGFBYzITI2NCYHISIGFBYzITI2NCYDISIGFSMiBhURFBYzITI2NTMyNjURNQEhIiY1ETQ2MzcRFBYzIRQGIzcUBiMhIiY1ETQ2MyEVFBY7ASciJj0BMRcC6P78DBERDAEEDBERDP78DBERDAEEDBERDP6lLUYiLUJGLgGxLkYdLkb++/5PFyMhFiBGLQFbIxfLIxf+ThYjIxYBIUYuV1cVJZEBshEYEREYEZARGBERGBECJUctRi39vi1HRy1HLAGVOf2FJBYCQhYjAf33LEcWJK0WIyMWAkIXI3QtRjo9GVasAAAAAgAA/3UDbgLjACsANwAvQCwkGQ4DBAIAAUAABQEBAAIFAFkDAQIEBAJNAwECAgRRAAQCBEUVFyQuJCoGFCslNC8BNzY1NC8BJiMiDwEnJiMiDwEGFRQfAQcGFRQfARYzMj8BFxYzMj8BNhIUDgEiLgE0PgEyFgKRC2hoCws0Cw8PC2doCg8QCzMLC2dnCwszCxAPCmhnCw8PCzQL3XbK78l2dsnvyqsPC2dnCw8QCjQLC2hoCws0ChAPC2dnCw8QCjQLC2hoCws0CgEI7sp2dsruynZ2AAAABf///ywEAAMsAA8AHABcAGwAwwGuQBuEAQYLGwEHBrpVEAMDB7F+cnBsZ2FdCAIOBEBLsAtQWEBBAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZEgEJAAEJAVUACgoAUQAAAApBAAICEVEAERELEUIbS7AMUFhAOwANAAYHDQZZDAELCAEHAwsHWQUEAgMQDwIOAgMOWRIBCQABCQFVAAoKAFEAAAAKQQACAhFRABERCxFCG0uwGlBYQEEADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQAKCgBRAAAACkEAAgIRUQAREQsRQhtLsCZQWEA/AAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQACAhFRABERCxFCG0BGAAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkAAgARCQIRWRIBCQEBCU0SAQkJAVEAAQkBRVlZWVlAJsPCqKacmpiXlpWPjYuJiIWDgW5tSkdGREJAODc2NTMxKCcXEhMQKwAuASIOAhQeAjI+AjQnLgEnLgInLgInFgMeAQYHBgcOAyMmJyYnJicmJyYjIgcGIzEiLgEnJj4BNzYzMhcWMzI3MjMyFx4BFx4DFxYXBgcGBw4BFyUWFxYXBgcGFxYHJjU8ATUBIiYnNic0Nz4DJicmJyYnPgIzMhcmIyIjBiMiJyYjIgcGBwYXFjMxMjc2MzIXFhcWFxYXFhcWMzI3Njc2Nz4BJicmNjc2NzY3Nic0MRYVFA4CIwOzkrrOupJNTZK6zrqSTVIHHh8QGQwJCAsXDoJYAgESFAwOCAsWIhgHBQQGCA0ZOxodDhkRBwgKEAgLAiciNyIbKicqCA4KBhINDRELCAsWIBUWCQkbFQkVCQX9FQgKIg4DCRwGBQsaAc2B2jsoDQ4GBggDAQQMRA0SDoDIdHdoExgICw0GHRw1KDFEQBgXHB47ChQWCxQSIhEMCAYHBgsQGUQoFRQLBRsZAwEDAwgNESAJFgQbSXyrXQJNkk1NkrrOupJNTZK6zj8MDwsFHhscGBokC1L+wRMhLBcNJRYXHQ0IHRhCbzFcFAkDAgMSER5DRxYlFxQBCQkiHxgbJxkHCAMJGRIJEzYUDgECCAcGDCkYFiJKTwECAf4vhW5MOAUTCAkRDBEHGg8DA3G6azoIAQ8cLSpLST9FAgMGC0Isa1AeGg8YLBg1HAYePywWFRUICw8dChgUAUtRXqp8SQAAAAEAAv8sA/4DLABLAKRADBoJAgIDQC8CCgkCQEuwGlBYQDcEAQIDAAMCAGYGAQABAwABZA0BBwgJCAcJZgsBCQoICQpkBQEBDAEIBwEIWAAKCgNRAAMDCgpCG0A8BAECAwADAgBmBgEAAQMAAWQNAQcICQgHCWYLAQkKCAkKZAADAgoDTQUBAQwBCAcBCFgAAwMKUQAKAwpFWUAVR0ZCQT49ODcyMRQXFBMVFRMUEg4XKwEnJiIGFB8BIREXFjI2NC8BJiIPAQYUFjI/AREhNzY0JiIPAQYUHwEWMjY0LwEhEScmIgYUHwEWMj8BNjQmIg8BESEHBhQWMj8BNjQD8JwOJxsOTP7RTA4nGw6bDicNnA4bJw5M/tBMDhsnDpwNDZwOJxsOTAEwTA4nGw6bDicOmw4bJw5MAS9MDhsnDpwNAUqbDhsnDkwBNUsOGycOmw4Omw4nGw1M/stMDicbDpsOJw2cDhwmDkz+0UwOGycOmw4Omw4nGw5LAS5MDiYcDpwNJwAEAED/bAPAAuwAIQAtADkAQwBVQFIbGgIHAwFAAAEACgABClkFAQMHAANNCwIMAwAJAQcGAAdZCAEGBAQGTQgBBgYEUQAEBgRFAQBDQj88NTQvLikoIyIeHBcUEQ8MCgcEACEBIQ0OKwEjNTQmIyEiBh0BIyIGFBY7AREUFjMhMjY1ETE1MzI2NCYAIiY1AzQ2MhYVERQWIiY1ETQ2MhYVExQBNDYzITIWHQEhA5yaKR3+iB0pmw4UFA5PKR0CEB0pTg8UFP4AHRQBFR0Usx0UFB0UAf68GhIBIhIa/oYCPWkdKSkdaRQdFP27HSkpHQIuFxQdFP25FA8BdA8UFA/+jA8UFA8BdA8UFA/+jA8CcREaGhE+AAAAAgBB/6wDvwKsAGAAvgNNQBylASUjqgEIEzMBCidDAQwABEC+vWEDJhYBBgI/S7ALUFhArhkYAhcaFRoXFWYWARUUGhUUZAAUHxoUH2QAIh8jHyIjZiQBIyUfIyVkACUTHyUTZAATCB8TCGQACAcfCAdkCQEHJh8HJmQoASYnHyYnZAAnCh8nCmQACgYfCgZkAAYLHwYLZAALBR8LBWQABQQfBQRkAAQDHwQDZAADAB8DAGQADQwODA0OZg8BDhAMDhBkHh0cGwQaISACHyIaH1kCAQIAEhECEAAQVgAMDAsMQhtLsAxQWECuGRgCFxoVGhcVZhYBFRQaFRRkABQfGhQfZAAiHyMfIiNmJAEjJR8jJWQAJRMfJRNkABMIHxMIZAAIBx8IB2QJAQcmHwcmZCgBJicfJidkACcKHycKZAAKBh8KBmQABgsfBgtkAAsFHwsFZAAFBB8FBGQABAMfBANkAAMAHwMAZAANDA4MDQ5mEA8CDhEMDhFkHh0cGwQaISACHyIaH1kCAQIAEgERABFWAAwMCwxCG0uwFlBYQK4ZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAA0MDgwNDmYPAQ4QDA4QZB4dHBsEGiEgAh8iGh9ZAgECABIRAhAAEFYADAwLDEIbQLoZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAAwADQAMDWYADQ4ADQ5kDwEOEAAOEGQeHRwbBBohIAIfIhofWQIBAgAMEABNAgECAAAQUhIRAhAAEEZZWVlAS7y6trWxr6ino6KhoJ2cmpmYl5WUjYyLiomIhoWEg4KAfnx6eXV0c3Jwb2ZlW1lYV1ZVVFJQT0xLSEc9PDY1MS8ULBQUExIRESEpFyslBiciJyImIyYnIicmJyImJyYnIicmJzAjMSYnMCcmJy4BMSY1MzI2LwEmIg8BBhY7ARQXFBYzFhcWFxYXMhYxFhcWFRYXHgEzFhcWMxYXFjMUFjMyFzIWMxYzMjc+AS4BNzQnMCYjJicwJjEmJzAmIyYnIiYjJicuASMuASMiLgEjIiYjJiMwJiMwIjEiBw4BHgE3NjMWFzIWMxYXMhcWFzIWMxYXMBYzFhcUMDEWFSMiBh8BFjI/ATYmKwE5AQKkS1wMDAIGAQ0FAQoLBgIGAQwHAQMNCQEkHQEICQECP0IDAwJvAgUBcAECA0NCAQEDCwQBCA0BASYvAgwQAQUBCg4KAggOCwQEAgQRAQUBFRF1Yg8HFiXFQgEBBQsCOlMDAQsPAQcCCBABCQMBBAICBgcCAggDDREEAQF2YQ8HFiUPS1sNDAIFAQsJAgcLCAEEAQwKAQE/LUFCAwMCbwIFAXABAgNDPTYCAQECAQIDAgIBBAMCBgUUHgEJCgEDUGYFA6oCAqoDBXdiAQIFDQYBCg4CJxoBAQYHAQIEBQQDAwMBAQMBAkYLJSAG5HdiAwcPAkgkAgUFAwMDAQIBAQEBAgEBRgslHwcLNQEBAQECAgMCAgQEARw2AVFoBQKrAgKrAgUABgDo/84FAQJeAAAAUgBgAHAAgACQAMlAKEoREAMJBHBpaGEABQgJgHl4cQQKC5CJiIEiBQYDXFhMNDMOBgUGBUBLsBxQWEA1AAEABAkBBFkACQAICwkIWQALAAoNCwpZAA0DBg1NAAMMAQYFAwZZBw4CBQUAUQIBAAALAEIbQDwAAQAECQEEWQAJAAgLCQhZAAsACg0LClkADQMGDU0AAwwBBgUDBlkHDgIFAAAFTQcOAgUFAFECAQAFAEVZQCABAY6LhoN+e3ZzbmtmY15dVFMBUgFSRUM7OjApLicPECsJAR4DBgcjIi4DJzQRMTQ+AzchMh4DFxwCNQ4EBzAqBCsBLgE3MTQ+AzczETQuAycwISIOAwcGFR4EFyUjDgIHMBwBMRcyNzYDFAYrASImNTE0NjsBMhYVFxQGKwEiJjUxNDY7ATIWFQcUBisBIiY1MTQ2OwEyFhUFAPzsAgMIAwYJlwQNJBwZAwINFSscAVUEDSMcGQIBAxQdOSUEBggJBgICDwEBAgoPIBRRAgkOHBL+tAMJGBIRAgEBAQkOHRQBhkYECxYBCAUdJTgPCt0KDw8K3QoPAQ8L3AsPDwvcCw+ADwtbCxAQC1sLDwGm/lMBAgkKDQcDEBkzIU0BQAQQKSEfBAMSGjYjEqiYAQQPLCo2FgQpQgMKGxYVBAFGAwsdFhUCAgoRJhnLtwMMHhcWAnEBBRoRIB8BHSUBcwoPDwoLDw8LlAsPDwsLDw8LlQsQEAsLEBALAAMAPwAFA8ECUwAPAB8ALwBCQD8PCAcABAABHxgXEAQCAy8oJyAEBAUDQAABAAADAQBZAAMAAgUDAlkABQQEBU0ABQUEUQAEBQRFNTU1NTUyBhQrARQGIyEiJjUxNDYzITIWHQEUBiMhIiY1MTQ2MyEyFh0BFAYjISImNTE0NjMhMhYVA8AYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgCKBEZGRESGBgS/BEZGRERGRkR/BIYGBIRGRkRAAAABwCF//0DewMDAAcACwAPABMAFwAnACsAyLYGAQIJCAFAS7AbUFhARg4BAQABaAAJCAoKCV4AAAACAwACVwADAAQFAwRXAAUABgcFBlcABwAICQcIVw8BCgANDAoNWAAMCwsMSwAMDAtRAAsMC0UbQEcOAQEAAWgACQgKCAkKZgAAAAIDAAJXAAMABAUDBFcABQAGBwUGVwAHAAgJBwhXDwEKAA0MCg1YAAwLCwxLAAwMC1EACwwLRVlAJRoYAAArKikoIh8YJxonFxYVFBMSERAPDg0MCwoJCAAHAAcTEA8rARMHAyEDJxMXIRUhFSEVIRUhFSEVIRUhBSEiBh8BHgEzITI2PwE2JgUjNTMDJDI5Lf4gLTkyYwGC/n4Bgv5+AYL+fgGC/n4CK/0sCgoDUgMSCgIUChIDUgMK/u3CwgMC/lEHAYL+fgcBr2AwMTAwMTAwMQ0J9AoNDQr0CQ1gMAAAAAAHAAD/gAQAA4AADwAXAB8ALwA3AD8ATwBaQFcOAQALBwIFBAAFWQANAwQNTQ8MCgMECQEDAgQDWQgGAgIBAQJNCAYCAgIBUQABAgFFQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAUjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYmGoAbJSUDgHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExoTJhrAGiYlG8AbJQADAEQAFwO8AukABwAoACwAPUA6AwECAAcGAgdXCAEABAEATQAGBQEEAQYEWQgBAAABTwABAAFDAQAsKyopJyMeGRMQDwwFBAAHAQcJDislIg4BByEuASUCEzQmIwYhMSAnIgYVFgMUFjc2Fjc2Nz4BFxY3NhcWNichESECAyRGOgcBUgVoAX4DAxkiLf6t/q0zHBkBARccI5AjGRc4dzk/V14mIRo//QgC+JEYOig1RQwBCQEHIhoBARYc5/7HHBkBAQEBARAoCiElAgICAhpaAcgAAAUApv/WA1oDKgANABMAJQAxAD0A1EAKDgECBA0BBQICQEuwHVBYQDAAAgAFBgIFWQsBBgAHCAYHWQwBCAAJAwgJWQAEBABRAAAACkEKAQMDAVEAAQELAUIbS7AyUFhALgAAAAQCAARZAAIABQYCBVkLAQYABwgGB1kMAQgACQMICVkKAQMDAVEAAQELAUIbQDQAAAAEAgAEWQACAAUGAgVZCwEGAAcIBgdZDAEIAAkDCAlZCgEDAQEDTQoBAwMBUQABAwFFWVlAHzQyKCYWFDo3Mj00PS4rJjEoMSIgHRsUJRYlJTUgDRErASEiBhURFBYzITI2NREnFyMiJjUTISImNRE0NjMhFRQWOwERFAYDISIGFBYzITI2NCYHISIGFBYzITI2NCYChf6MLD4+LAHeLD7Wf2gJDmz+IhMbGxMBNjEigxtY/qwMEhIMAVQMEhIM/qwMEhIMAVQMEhIDKT4s/YIsPj4sAhSBfw0K/aUbEwJ+Ext/IjH+JhMbAXESGRERGRKcEhkRERkSAAEAAAABAADFmT0qXw889QALBAAAAAAA1QTHiAAAAADVBMeI////LAUBA4AAAAAIAAIAAAAAAAAAAQAAA4D/LABcBQH//wAABQEAAQAAAAAAAAAAAAAAAAAAACEEAAAAAAAAAAFVAAAD6QAsBAAAAAQAADoEAABLBAAASwQAAGYEAAB/BAAAVQQAAA8EAAAPBAAAAAQAAHQEAABrBAABMgQAAEkEAABABAAAQAQAAEAEAABXBAAAQAQAAF8EAAC/BAAAiQQAAAAEAAAABAAAAgQAAEAEAABBBQEA6AQAAD8AhQAAAEQApgAAAAAAAAAAATwCGgI4AoQC9ANWA7AENASMBOgFZAWuBhQGUgaMB4gIfAlKCboKSgqECw4Lzgw6DigO6g92EhYTMhOWFEgU6hVUFhoAAQAAACUAxAALAAAAAAACAFIAYABsAAABNQmWAAAAAAAAAAwAlgABAAAAAAABAAgAAAABAAAAAAACAAYACAABAAAAAAADACMADgABAAAAAAAEAAgAMQABAAAAAAAFAEUAOQABAAAAAAAGAAgAfgADAAEECQABABAAhgADAAEECQACAAwAlgADAAEECQADAEYAogADAAEECQAEABAA6AADAAEECQAFAIoA+AADAAEECQAGABABgmljb25mb250TWVkaXVtRm9udEZvcmdlIDIuMCA6IGljb25mb250IDogMS00LTIwMTdpY29uZm9udFZlcnNpb24gMS4wOyB0dGZhdXRvaGludCAodjAuOTQpIC1sIDggLXIgNTAgLUcgMjAwIC14IDE0IC13ICJHIiAtZiAtc2ljb25mb250AGkAYwBvAG4AZgBvAG4AdABNAGUAZABpAHUAbQBGAG8AbgB0AEYAbwByAGcAZQAgADIALgAwACAAOgAgAGkAYwBvAG4AZgBvAG4AdAAgADoAIAAxAC0ANAAtADIAMAAxADcAaQBjAG8AbgBmAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AMAA7ACAAdAB0AGYAYQB1AHQAbwBoAGkAbgB0ACAAKAB2ADAALgA5ADQAKQAgAC0AbAAgADgAIAAtAHIAIAA1ADAAIAAtAEcAIAAyADAAMAAgAC0AeAAgADEANAAgAC0AdwAgACIARwAiACAALQBmACAALQBzAGkAYwBvAG4AZgBvAG4AdAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUAAAABAAIAWwECAQMBBAEFAQYASwEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETARQBFQEWARcBGAEZARoBGwEcAR0BHgEfASABIQlzd2l0Y2hvZmYEaWNvbgh3YXJuZmlsbAR3YXJuAm9rBGxvY2sDb2ZmAm9uBnNlYXJjaARlZGl0BGluZm8FYWRkLXMEbW9yZQRncmlkCG1vdmVkb3duBm1vdmV1cANhZGQGZm9sZGVyBWdyb3VwBWxvY2syBWZpbGVzC3RpbWVzY2lyY2xlBWVhcnRoBG1vdmUGZGVsZXRlB3JlZnJlc2gDZG9jBGxpbmUIZmlsZS1ib3gIc3dpdGNob24Jc3lzc2VydmVyBGZpbGUAAAABAAH//wAPAAAAAAAAAAAAAAAAAAAAAAAyADIDGP/hA4D/LAMY/+EDgP8ssAAssCBgZi2wASwgZCCwwFCwBCZasARFW1ghIyEbilggsFBQWCGwQFkbILA4UFghsDhZWSCwCkVhZLAoUFghsApFILAwUFghsDBZGyCwwFBYIGYgiophILAKUFhgGyCwIFBYIbAKYBsgsDZQWCGwNmAbYFlZWRuwACtZWSOwAFBYZVlZLbACLCBFILAEJWFkILAFQ1BYsAUjQrAGI0IbISFZsAFgLbADLCMhIyEgZLEFYkIgsAYjQrIKAAIqISCwBkMgiiCKsAArsTAFJYpRWGBQG2FSWVgjWSEgsEBTWLAAKxshsEBZI7AAUFhlWS2wBCywCCNCsAcjQrAAI0KwAEOwB0NRWLAIQyuyAAEAQ2BCsBZlHFktsAUssABDIEUgsAJFY7ABRWJgRC2wBiywAEMgRSCwACsjsQQEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERC2wByyxBQVFsAFhRC2wCCywAWAgILAKQ0qwAFBYILAKI0JZsAtDSrAAUlggsAsjQlktsAksILgEAGIguAQAY4ojYbAMQ2AgimAgsAwjQiMtsAosS1RYsQcBRFkksA1lI3gtsAssS1FYS1NYsQcBRFkbIVkksBNlI3gtsAwssQANQ1VYsQ0NQ7ABYUKwCStZsABDsAIlQrIAAQBDYEKxCgIlQrELAiVCsAEWIyCwAyVQWLAAQ7AEJUKKiiCKI2GwCCohI7ABYSCKI2GwCCohG7AAQ7ACJUKwAiVhsAgqIVmwCkNHsAtDR2CwgGIgsAJFY7ABRWJgsQAAEyNEsAFDsAA+sgEBAUNgQi2wDSyxAAVFVFgAsA0jQiBgsAFhtQ4OAQAMAEJCimCxDAQrsGsrGyJZLbAOLLEADSstsA8ssQENKy2wECyxAg0rLbARLLEDDSstsBIssQQNKy2wEyyxBQ0rLbAULLEGDSstsBUssQcNKy2wFiyxCA0rLbAXLLEJDSstsBgssAcrsQAFRVRYALANI0IgYLABYbUODgEADABCQopgsQwEK7BrKxsiWS2wGSyxABgrLbAaLLEBGCstsBsssQIYKy2wHCyxAxgrLbAdLLEEGCstsB4ssQUYKy2wHyyxBhgrLbAgLLEHGCstsCEssQgYKy2wIiyxCRgrLbAjLCBgsA5gIEMjsAFgQ7ACJbACJVFYIyA8sAFgI7ASZRwbISFZLbAkLLAjK7AjKi2wJSwgIEcgILACRWOwAUViYCNhOCMgilVYIEcgILACRWOwAUViYCNhOBshWS2wJiyxAAVFVFgAsAEWsCUqsAEVMBsiWS2wJyywByuxAAVFVFgAsAEWsCUqsAEVMBsiWS2wKCwgNbABYC2wKSwAsANFY7ABRWKwACuwAkVjsAFFYrAAK7AAFrQAAAAAAEQ+IzixKAEVKi2wKiwgPCBHILACRWOwAUViYLAAQ2E4LbArLC4XPC2wLCwgPCBHILACRWOwAUViYLAAQ2GwAUNjOC2wLSyxAgAWJSAuIEewACNCsAIlSYqKRyNHI2EgWGIbIVmwASNCsiwBARUUKi2wLiywABawBCWwBCVHI0cjYbAGRStlii4jICA8ijgtsC8ssAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgsAlDIIojRyNHI2EjRmCwBEOwgGJgILAAKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwgGJhIyAgsAQmI0ZhOBsjsAlDRrACJbAJQ0cjRyNhYCCwBEOwgGJgIyCwACsjsARDYLAAK7AFJWGwBSWwgGKwBCZhILAEJWBkI7ADJWBkUFghGyMhWSMgILAEJiNGYThZLbAwLLAAFiAgILAFJiAuRyNHI2EjPDgtsDEssAAWILAJI0IgICBGI0ewACsjYTgtsDIssAAWsAMlsAIlRyNHI2GwAFRYLiA8IyEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbABRWMjIFhiGyFZY7ABRWJgIy4jICA8ijgjIVktsDMssAAWILAJQyAuRyNHI2EgYLAgYGawgGIjICA8ijgtsDQsIyAuRrACJUZSWCA8WS6xJAEUKy2wNSwjIC5GsAIlRlBYIDxZLrEkARQrLbA2LCMgLkawAiVGUlggPFkjIC5GsAIlRlBYIDxZLrEkARQrLbA3LLAuKyMgLkawAiVGUlggPFkusSQBFCstsDgssC8riiAgPLAEI0KKOCMgLkawAiVGUlggPFkusSQBFCuwBEMusCQrLbA5LLAAFrAEJbAEJiAuRyNHI2GwBkUrIyA8IC4jOLEkARQrLbA6LLEJBCVCsAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgR7AEQ7CAYmAgsAArIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbCAYmGwAiVGYTgjIDwjOBshICBGI0ewACsjYTghWbEkARQrLbA7LLAuKy6xJAEUKy2wPCywLyshIyAgPLAEI0IjOLEkARQrsARDLrAkKy2wPSywABUgR7AAI0KyAAEBFRQTLrAqKi2wPiywABUgR7AAI0KyAAEBFRQTLrAqKi2wPyyxAAEUE7ArKi2wQCywLSotsEEssAAWRSMgLiBGiiNhOLEkARQrLbBCLLAJI0KwQSstsEMssgAAOistsEQssgABOistsEUssgEAOistsEYssgEBOistsEcssgAAOystsEgssgABOystsEkssgEAOystsEossgEBOystsEsssgAANystsEwssgABNystsE0ssgEANystsE4ssgEBNystsE8ssgAAOSstsFAssgABOSstsFEssgEAOSstsFIssgEBOSstsFMssgAAPCstsFQssgABPCstsFUssgEAPCstsFYssgEBPCstsFcssgAAOCstsFgssgABOCstsFkssgEAOCstsFossgEBOCstsFsssDArLrEkARQrLbBcLLAwK7A0Ky2wXSywMCuwNSstsF4ssAAWsDArsDYrLbBfLLAxKy6xJAEUKy2wYCywMSuwNCstsGEssDErsDUrLbBiLLAxK7A2Ky2wYyywMisusSQBFCstsGQssDIrsDQrLbBlLLAyK7A1Ky2wZiywMiuwNistsGcssDMrLrEkARQrLbBoLLAzK7A0Ky2waSywMyuwNSstsGossDMrsDYrLbBrLCuwCGWwAyRQeLABFTAtAABLuADIUlixAQGOWbkIAAgAYyCwASNEILADI3CwDkUgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbABRWMjYrACI0SzCgkFBCuzCgsFBCuzDg8FBCtZsgQoCUVSRLMKDQYEK7EGAUSxJAGIUViwQIhYsQYDRLEmAYhRWLgEAIhYsQYBRFlZWVm4Af+FsASNsQUARAAAAA=="
  18323. /***/ }),
  18324. /* 102 */
  18325. /***/ (function(module, exports, __webpack_require__) {
  18326. "use strict";
  18327. /**
  18328. * @author oldj
  18329. * @blog https://oldj.net
  18330. */
  18331. /**
  18332. * 将一个 node list 转为数组
  18333. * @param list {NodeList}
  18334. * 参见:http://www.planabc.net/2010/01/06/arguments_to_array/
  18335. */
  18336. module.exports = (list) => {
  18337. let arr
  18338. let length
  18339. try {
  18340. // works in every browser except IE
  18341. arr = [].slice.call(list);
  18342. return arr;
  18343. } catch(err) {
  18344. // slower, but works in IE
  18345. arr = [];
  18346. length = list.length;
  18347. for (let i = 0; i < length; i++) {
  18348. arr.push(list[i]);
  18349. }
  18350. return arr;
  18351. }
  18352. }
  18353. /***/ }),
  18354. /* 103 */
  18355. /***/ (function(module, exports, __webpack_require__) {
  18356. "use strict";
  18357. /**
  18358. * @author oldj
  18359. * @blog http://oldj.net
  18360. */
  18361. Object.defineProperty(exports, "__esModule", {
  18362. value: true
  18363. });
  18364. 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; }; }();
  18365. var _react = __webpack_require__(7);
  18366. var _react2 = _interopRequireDefault(_react);
  18367. var _panel = __webpack_require__(119);
  18368. var _panel2 = _interopRequireDefault(_panel);
  18369. var _content = __webpack_require__(109);
  18370. var _content2 = _interopRequireDefault(_content);
  18371. var _sudo = __webpack_require__(114);
  18372. var _sudo2 = _interopRequireDefault(_sudo);
  18373. var _edit = __webpack_require__(111);
  18374. var _edit2 = _interopRequireDefault(_edit);
  18375. var _preferences = __webpack_require__(113);
  18376. var _preferences2 = _interopRequireDefault(_preferences);
  18377. var _Agent = __webpack_require__(4);
  18378. var _Agent2 = _interopRequireDefault(_Agent);
  18379. var _index = __webpack_require__(30);
  18380. __webpack_require__(226);
  18381. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18382. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18383. 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; }
  18384. 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; }
  18385. var App = function (_React$Component) {
  18386. _inherits(App, _React$Component);
  18387. function App(props) {
  18388. _classCallCheck(this, App);
  18389. var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props));
  18390. _this.state = {
  18391. list: [], // 用户的 hosts 列表
  18392. sys_hosts: {}, // 系统 hosts
  18393. current: {}, // 当前 hosts
  18394. lang: {}, // 语言
  18395. just_added_id: null
  18396. };
  18397. _this.is_dragging = false;
  18398. _this.loadHosts();
  18399. _Agent2.default.pact('getPref').then(function (pref) {
  18400. return pref.user_language || 'en';
  18401. }).then(function (l) {
  18402. _Agent2.default.pact('getLang', l).then(function (lang) {
  18403. _this.setState({ lang: lang });
  18404. });
  18405. });
  18406. (0, _index.reg)(_this);
  18407. _Agent2.default.on('drag_start', function () {
  18408. _this.is_dragging = true;
  18409. console.log('drag_start');
  18410. });
  18411. _Agent2.default.on('drag_end', function () {
  18412. _this.is_dragging = false;
  18413. console.log('drag_end');
  18414. });
  18415. setInterval(function () {
  18416. var list = _this.state.list;
  18417. if (_this.is_dragging || !list || list.length === 0) return;
  18418. console.log('checkNeedRemoteRefresh');
  18419. _Agent2.default.pact('checkNeedRemoteRefresh', list).then(function (list) {
  18420. if (!list) return;
  18421. _Agent2.default.emit('list_updated', list);
  18422. }).catch(function (e) {
  18423. console.log(e);
  18424. });
  18425. }, 60 * 1000);
  18426. return _this;
  18427. }
  18428. _createClass(App, [{
  18429. key: 'loadHosts',
  18430. value: function loadHosts() {
  18431. var _this2 = this;
  18432. _Agent2.default.pact('getHosts').then(function (data) {
  18433. var state = {
  18434. list: data.list,
  18435. sys_hosts: data.sys_hosts
  18436. };
  18437. var current = _this2.state.current;
  18438. state.current = data.list.find(function (item) {
  18439. return item.id === current.id;
  18440. }) || data.sys_hosts;
  18441. _this2.setState(state);
  18442. });
  18443. }
  18444. }, {
  18445. key: 'setCurrent',
  18446. value: function setCurrent(hosts) {
  18447. var _this3 = this;
  18448. if (hosts.is_sys) {
  18449. _Agent2.default.pact('getSysHosts').then(function (_hosts) {
  18450. _this3.setState({
  18451. sys_hosts: _hosts,
  18452. current: _hosts
  18453. });
  18454. });
  18455. } else {
  18456. this.setState({
  18457. current: hosts
  18458. });
  18459. }
  18460. }
  18461. }, {
  18462. key: 'toSave',
  18463. value: function toSave() {
  18464. var _this4 = this;
  18465. clearTimeout(this._t);
  18466. this._t = setTimeout(function () {
  18467. _Agent2.default.emit('save', _this4.state.list);
  18468. }, 1000);
  18469. }
  18470. }, {
  18471. key: 'setHostsContent',
  18472. value: function setHostsContent(v) {
  18473. if (this.state.current.content === v) return; // not changed
  18474. this.state.current.content = v || '';
  18475. this.toSave();
  18476. }
  18477. }, {
  18478. key: 'justAdd',
  18479. value: function justAdd(id) {
  18480. this.setState({
  18481. just_added_id: id
  18482. });
  18483. }
  18484. }, {
  18485. key: 'componentDidMount',
  18486. value: function componentDidMount() {
  18487. window.addEventListener('keydown', function (e) {
  18488. if (e.keyCode === 27) {
  18489. _Agent2.default.emit('esc');
  18490. }
  18491. }, false);
  18492. window.addEventListener('mouseup', function () {
  18493. _Agent2.default.emit('drag_end');
  18494. });
  18495. }
  18496. }, {
  18497. key: 'render',
  18498. value: function render() {
  18499. var current = this.state.current;
  18500. return _react2.default.createElement(
  18501. 'div',
  18502. { id: 'app', className: 'platform-' + _Agent2.default.platform },
  18503. _react2.default.createElement(_panel2.default, {
  18504. list: this.state.list,
  18505. sys_hosts: this.state.sys_hosts,
  18506. current: current,
  18507. setCurrent: this.setCurrent.bind(this),
  18508. lang: this.state.lang,
  18509. just_added_id: this.state.just_added_id,
  18510. justAdd: this.justAdd.bind(this)
  18511. }),
  18512. _react2.default.createElement(_content2.default, {
  18513. current: current,
  18514. readonly: App.isReadOnly(current),
  18515. setHostsContent: this.setHostsContent.bind(this),
  18516. lang: this.state.lang
  18517. }),
  18518. _react2.default.createElement(
  18519. 'div',
  18520. { className: 'frames' },
  18521. _react2.default.createElement(_sudo2.default, { lang: this.state.lang }),
  18522. _react2.default.createElement(_edit2.default, {
  18523. lang: this.state.lang,
  18524. list: this.state.list,
  18525. justAdd: this.justAdd.bind(this)
  18526. }),
  18527. _react2.default.createElement(_preferences2.default, {
  18528. lang: this.state.lang
  18529. })
  18530. )
  18531. );
  18532. }
  18533. }], [{
  18534. key: 'isReadOnly',
  18535. value: function isReadOnly(hosts) {
  18536. return !hosts || hosts.is_sys || hosts.where === 'remote' || hosts.where === 'group';
  18537. }
  18538. }]);
  18539. return App;
  18540. }(_react2.default.Component);
  18541. exports.default = App;
  18542. /***/ }),
  18543. /* 104 */
  18544. /***/ (function(module, exports, __webpack_require__) {
  18545. "use strict";
  18546. module.exports = __webpack_require__(162);
  18547. /***/ }),
  18548. /* 105 */
  18549. /***/ (function(module, exports, __webpack_require__) {
  18550. "use strict";
  18551. /**
  18552. * @author oldj
  18553. * @blog https://oldj.net
  18554. */
  18555. var m_ver = __webpack_require__(69).version;
  18556. module.exports = {
  18557. PORT: 50761,
  18558. version: m_ver.slice(0, 3).join('.'),
  18559. version_full: m_ver.join('.'),
  18560. url_download: 'https://github.com/oldj/SwitchHosts/releases'
  18561. };
  18562. /***/ }),
  18563. /* 106 */
  18564. /***/ (function(module, exports, __webpack_require__) {
  18565. "use strict";
  18566. /**
  18567. * @author oldj
  18568. * @blog https://oldj.net
  18569. */
  18570. module.exports = function (v) {
  18571. return 'v' + v.slice(0, 3).join('.') + (' (' + v[3] + ')');
  18572. };
  18573. /***/ }),
  18574. /* 107 */
  18575. /***/ (function(module, exports, __webpack_require__) {
  18576. "use strict";
  18577. /**
  18578. * @author oldj
  18579. * @blog https://oldj.net
  18580. */
  18581. module.exports = function () {
  18582. return new Date().getTime() + '-' + Math.floor(Math.random() * 1e6);
  18583. };
  18584. /***/ }),
  18585. /* 108 */
  18586. /***/ (function(module, exports, __webpack_require__) {
  18587. "use strict";
  18588. // custom mode
  18589. Object.defineProperty(exports, "__esModule", {
  18590. value: true
  18591. });
  18592. exports.default = function () {
  18593. _codemirror2.default.defineMode('hosts', function () {
  18594. function tokenBase(stream) {
  18595. if (stream.eatSpace()) return null;
  18596. var sol = stream.sol();
  18597. var ch = stream.next();
  18598. var s = stream.string;
  18599. if (ch === '#') {
  18600. stream.skipToEnd();
  18601. return 'comment';
  18602. }
  18603. if (!s.match(/^\s*([\d\.]+|[\da-f:\.%lo]+)\s+\w/i)) {
  18604. return 'error';
  18605. }
  18606. if (sol && ch.match(/[\w\.:%]/)) {
  18607. stream.eatWhile(/[\w\.:%]/);
  18608. return 'ip';
  18609. }
  18610. return null;
  18611. }
  18612. function tokenize(stream, state) {
  18613. return (state.tokens[0] || tokenBase)(stream, state);
  18614. }
  18615. return {
  18616. startState: function startState() {
  18617. return { tokens: [] };
  18618. },
  18619. token: function token(stream, state) {
  18620. return tokenize(stream, state);
  18621. },
  18622. lineComment: '#'
  18623. };
  18624. });
  18625. //CodeMirror.defineMIME('text/x-hosts', 'hosts');
  18626. };
  18627. var _codemirror = __webpack_require__(49);
  18628. var _codemirror2 = _interopRequireDefault(_codemirror);
  18629. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18630. /***/ }),
  18631. /* 109 */
  18632. /***/ (function(module, exports, __webpack_require__) {
  18633. "use strict";
  18634. /**
  18635. * @author oldj
  18636. * @blog https://oldj.net
  18637. */
  18638. Object.defineProperty(exports, "__esModule", {
  18639. value: true
  18640. });
  18641. 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; }; }();
  18642. var _react = __webpack_require__(7);
  18643. var _react2 = _interopRequireDefault(_react);
  18644. var _classnames = __webpack_require__(15);
  18645. var _classnames2 = _interopRequireDefault(_classnames);
  18646. var _editor = __webpack_require__(110);
  18647. var _editor2 = _interopRequireDefault(_editor);
  18648. __webpack_require__(227);
  18649. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18650. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18651. 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; }
  18652. 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; }
  18653. var Content = function (_React$Component) {
  18654. _inherits(Content, _React$Component);
  18655. function Content(props) {
  18656. _classCallCheck(this, Content);
  18657. var _this = _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).call(this, props));
  18658. _this.state = {
  18659. is_loading: _this.props.current.is_loading
  18660. };
  18661. return _this;
  18662. }
  18663. _createClass(Content, [{
  18664. key: 'setValue',
  18665. value: function setValue(v) {
  18666. this.props.setHostsContent(v);
  18667. }
  18668. }, {
  18669. key: 'render',
  18670. value: function render() {
  18671. var _props = this.props,
  18672. current = _props.current,
  18673. lang = _props.lang;
  18674. return _react2.default.createElement(
  18675. 'div',
  18676. { id: 'sh-content' },
  18677. _react2.default.createElement(
  18678. 'div',
  18679. { className: 'inform' },
  18680. _react2.default.createElement(
  18681. 'span',
  18682. {
  18683. className: (0, _classnames2.default)({
  18684. loading: 1,
  18685. show: this.state.is_loading
  18686. })
  18687. },
  18688. 'loading...'
  18689. ),
  18690. _react2.default.createElement('i', {
  18691. className: (0, _classnames2.default)({
  18692. show: current.where === 'remote',
  18693. iconfont: 1,
  18694. 'icon-earth': 1
  18695. }),
  18696. title: lang.remote_hosts
  18697. }),
  18698. _react2.default.createElement('i', {
  18699. className: (0, _classnames2.default)({
  18700. show: this.props.readonly,
  18701. iconfont: 1,
  18702. 'icon-lock2': 1
  18703. }),
  18704. title: lang.readonly
  18705. })
  18706. ),
  18707. _react2.default.createElement(
  18708. 'div',
  18709. { className: (0, _classnames2.default)({
  18710. errorMessage: 1,
  18711. show: !!this.props.current.error
  18712. }) },
  18713. this.props.current.error
  18714. ),
  18715. _react2.default.createElement(_editor2.default, {
  18716. readonly: this.props.readonly,
  18717. code: this.props.current.content || '',
  18718. setValue: this.setValue.bind(this)
  18719. })
  18720. );
  18721. }
  18722. }]);
  18723. return Content;
  18724. }(_react2.default.Component);
  18725. exports.default = Content;
  18726. /***/ }),
  18727. /* 110 */
  18728. /***/ (function(module, exports, __webpack_require__) {
  18729. "use strict";
  18730. /**
  18731. * @author oldj
  18732. * @blog http://oldj.net
  18733. */
  18734. Object.defineProperty(exports, "__esModule", {
  18735. value: true
  18736. });
  18737. 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; }; }();
  18738. var _react = __webpack_require__(7);
  18739. var _react2 = _interopRequireDefault(_react);
  18740. var _codemirror = __webpack_require__(49);
  18741. var _codemirror2 = _interopRequireDefault(_codemirror);
  18742. __webpack_require__(121);
  18743. var _classnames = __webpack_require__(15);
  18744. var _classnames2 = _interopRequireDefault(_classnames);
  18745. var _kw = __webpack_require__(70);
  18746. var _kw2 = _interopRequireDefault(_kw);
  18747. var _Agent = __webpack_require__(4);
  18748. var _Agent2 = _interopRequireDefault(_Agent);
  18749. __webpack_require__(225);
  18750. __webpack_require__(228);
  18751. var _cm_hl = __webpack_require__(108);
  18752. var _cm_hl2 = _interopRequireDefault(_cm_hl);
  18753. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18754. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18755. 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; }
  18756. 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; }
  18757. // import '../../../node_modules/codemirror/addon/comment/comment'
  18758. (0, _cm_hl2.default)();
  18759. var Editor = function (_React$Component) {
  18760. _inherits(Editor, _React$Component);
  18761. function Editor(props) {
  18762. _classCallCheck(this, Editor);
  18763. var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));
  18764. _this.codemirror = null;
  18765. _this.marks = [];
  18766. _this.kw = '';
  18767. _this.state = {};
  18768. _Agent2.default.on('search', function (kw) {
  18769. _this.kw = kw;
  18770. _this.highlightKeyword();
  18771. });
  18772. return _this;
  18773. }
  18774. _createClass(Editor, [{
  18775. key: 'highlightKeyword',
  18776. value: function highlightKeyword() {
  18777. var _this2 = this;
  18778. while (this.marks.length > 0) {
  18779. this.marks.shift().clear();
  18780. }
  18781. var code = this.props.code;
  18782. var pos = _kw2.default.findPositions(this.kw, code) || [];
  18783. // this.codemirror.markText({line: 6, ch: 16}, {line: 6, ch: 22}, {className: 'cm-hl'});
  18784. pos.map(function (p) {
  18785. _this2.marks.push(_this2.codemirror.markText(p[0], p[1], { className: 'cm-hl' }));
  18786. });
  18787. }
  18788. }, {
  18789. key: 'setValue',
  18790. value: function setValue(v) {
  18791. this.props.setValue(v);
  18792. }
  18793. }, {
  18794. key: 'toComment',
  18795. value: function toComment() {
  18796. var doc = this.codemirror.getDoc();
  18797. var cur = doc.getCursor();
  18798. var line = cur.line;
  18799. var info = doc.lineInfo(line);
  18800. this.codemirror.toggleComment({
  18801. line: line,
  18802. cur: 0
  18803. }, {
  18804. line: line,
  18805. cur: info.text.length
  18806. });
  18807. }
  18808. }, {
  18809. key: 'componentDidMount',
  18810. value: function componentDidMount() {
  18811. var _this3 = this;
  18812. // console.log(this.cnt_node, this.cnt_node.value);
  18813. this.codemirror = _codemirror2.default.fromTextArea(this.cnt_node, {
  18814. lineNumbers: true,
  18815. readOnly: true,
  18816. mode: 'hosts'
  18817. });
  18818. this.codemirror.setSize('100%', '100%');
  18819. this.codemirror.on('change', function (a) {
  18820. var v = a.getDoc().getValue();
  18821. _this3.setValue(v);
  18822. });
  18823. this.codemirror.on('gutterClick', function (cm, n) {
  18824. if (_this3.props.readonly === true) return;
  18825. var info = cm.lineInfo(n);
  18826. //cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
  18827. var ln = info.text;
  18828. if (/^\s*$/.test(ln)) return;
  18829. var new_ln = void 0;
  18830. if (/^#/.test(ln)) {
  18831. new_ln = ln.replace(/^#\s*/, '');
  18832. } else {
  18833. new_ln = '# ' + ln;
  18834. }
  18835. _this3.codemirror.getDoc().replaceRange(new_ln, { line: info.line, ch: 0 }, {
  18836. line: info.line,
  18837. ch: ln.length
  18838. });
  18839. //app.caculateHosts();
  18840. });
  18841. _Agent2.default.on('to_comment', function () {
  18842. _this3.toComment();
  18843. });
  18844. }
  18845. }, {
  18846. key: 'componentWillReceiveProps',
  18847. value: function componentWillReceiveProps(next_props) {
  18848. var _this4 = this;
  18849. // console.log(next_props);
  18850. var cm = this.codemirror;
  18851. var v = cm.getDoc().getValue();
  18852. if (v !== next_props.code) {
  18853. cm.getDoc().setValue(next_props.code);
  18854. }
  18855. cm.setOption('readOnly', next_props.readonly);
  18856. setTimeout(function () {
  18857. _this4.highlightKeyword();
  18858. }, 100);
  18859. }
  18860. }, {
  18861. key: 'render',
  18862. value: function render() {
  18863. var _this5 = this;
  18864. return _react2.default.createElement(
  18865. 'div',
  18866. {
  18867. id: 'sh-editor',
  18868. className: (0, _classnames2.default)({
  18869. readonly: this.props.readonly
  18870. }) },
  18871. _react2.default.createElement('textarea', {
  18872. ref: function ref(c) {
  18873. return _this5.cnt_node = c;
  18874. },
  18875. defaultValue: this.props.code || ''
  18876. })
  18877. );
  18878. }
  18879. }]);
  18880. return Editor;
  18881. }(_react2.default.Component);
  18882. exports.default = Editor;
  18883. /***/ }),
  18884. /* 111 */
  18885. /***/ (function(module, exports, __webpack_require__) {
  18886. "use strict";
  18887. /**
  18888. * @author oldj
  18889. * @blog https://oldj.net
  18890. */
  18891. Object.defineProperty(exports, "__esModule", {
  18892. value: true
  18893. });
  18894. 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"); } }; }();
  18895. 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; }; }();
  18896. var _react = __webpack_require__(7);
  18897. var _react2 = _interopRequireDefault(_react);
  18898. var _frame = __webpack_require__(48);
  18899. var _frame2 = _interopRequireDefault(_frame);
  18900. var _classnames = __webpack_require__(15);
  18901. var _classnames2 = _interopRequireDefault(_classnames);
  18902. var _group = __webpack_require__(112);
  18903. var _group2 = _interopRequireDefault(_group);
  18904. var _Agent = __webpack_require__(4);
  18905. var _Agent2 = _interopRequireDefault(_Agent);
  18906. var _makeId = __webpack_require__(107);
  18907. var _makeId2 = _interopRequireDefault(_makeId);
  18908. __webpack_require__(229);
  18909. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18910. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18911. 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; }
  18912. 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; }
  18913. var EditPrompt = function (_React$Component) {
  18914. _inherits(EditPrompt, _React$Component);
  18915. function EditPrompt(props) {
  18916. _classCallCheck(this, EditPrompt);
  18917. var _this = _possibleConstructorReturn(this, (EditPrompt.__proto__ || Object.getPrototypeOf(EditPrompt)).call(this, props));
  18918. _this.state = {
  18919. show: false,
  18920. is_add: true,
  18921. where: 'local',
  18922. title: '',
  18923. url: '',
  18924. last_refresh: null,
  18925. refresh_interval: 0,
  18926. is_loading: false,
  18927. include: []
  18928. };
  18929. _this.current_hosts = null;
  18930. return _this;
  18931. }
  18932. _createClass(EditPrompt, [{
  18933. key: 'tryToFocus',
  18934. value: function tryToFocus() {
  18935. var el = this.refs.body && this.refs.body.querySelector('input[type=text]');
  18936. el && el.focus();
  18937. }
  18938. }, {
  18939. key: 'clear',
  18940. value: function clear() {
  18941. this.setState({
  18942. where: 'local',
  18943. title: '',
  18944. url: '',
  18945. last_refresh: null,
  18946. refresh_interval: 0
  18947. });
  18948. }
  18949. }, {
  18950. key: 'componentDidMount',
  18951. value: function componentDidMount() {
  18952. var _this2 = this;
  18953. _Agent2.default.on('add_hosts', function () {
  18954. _this2.setState({
  18955. show: true,
  18956. is_add: true
  18957. });
  18958. setTimeout(function () {
  18959. _this2.tryToFocus();
  18960. }, 100);
  18961. });
  18962. _Agent2.default.on('edit_hosts', function (hosts) {
  18963. _this2.current_hosts = hosts;
  18964. var include = hosts.include || [];
  18965. include = Array.from(new Set(include));
  18966. _this2.setState({
  18967. id: hosts.id,
  18968. show: true,
  18969. is_add: false,
  18970. where: hosts.where || 'local',
  18971. title: hosts.title || '',
  18972. url: hosts.url || '',
  18973. last_refresh: hosts.last_refresh || null,
  18974. refresh_interval: hosts.refresh_interval || 0,
  18975. include: include
  18976. });
  18977. setTimeout(function () {
  18978. _this2.tryToFocus();
  18979. }, 100);
  18980. });
  18981. _Agent2.default.on('list_updated', function (list) {
  18982. var hosts = list.find(function (i) {
  18983. return i.id === _this2.state.id;
  18984. });
  18985. if (hosts) {
  18986. _this2.current_hosts = hosts;
  18987. _this2.setState({ last_refresh: hosts.last_refresh });
  18988. setTimeout(function () {
  18989. return _this2.setState({ is_loading: false });
  18990. }, 500);
  18991. }
  18992. });
  18993. }
  18994. }, {
  18995. key: 'onOK',
  18996. value: function onOK() {
  18997. this.setState({
  18998. title: (this.state.title || '').replace(/^\s+|\s+$/g, ''),
  18999. url: (this.state.url || '').replace(/^\s+|\s+$/g, '')
  19000. });
  19001. if (this.state.title === '') {
  19002. this.refs.title.focus();
  19003. return false;
  19004. }
  19005. if (this.state.where === 'remote' && this.state.url === '') {
  19006. this.refs.url.focus();
  19007. return false;
  19008. }
  19009. var new_id = (0, _makeId2.default)();
  19010. var data = Object.assign({}, this.current_hosts, this.state, this.state.is_add ? {
  19011. id: new_id,
  19012. content: '# ' + this.state.title,
  19013. on: false
  19014. } : {});
  19015. if (!data.id) data.id = new_id;
  19016. if (this.state.is_add) {
  19017. this.props.justAdd(new_id);
  19018. }
  19019. delete data['is_add'];
  19020. _Agent2.default.emit('update_hosts', data);
  19021. this.setState({
  19022. show: false
  19023. });
  19024. this.clear();
  19025. }
  19026. }, {
  19027. key: 'onCancel',
  19028. value: function onCancel() {
  19029. this.setState({
  19030. show: false
  19031. });
  19032. this.clear();
  19033. }
  19034. }, {
  19035. key: 'confirmDel',
  19036. value: function confirmDel() {
  19037. var lang = this.props.lang;
  19038. if (!confirm(lang.confirm_del)) return;
  19039. _Agent2.default.emit('del_hosts', this.current_hosts);
  19040. this.setState({
  19041. show: false
  19042. });
  19043. this.clear();
  19044. }
  19045. }, {
  19046. key: 'updateInclude',
  19047. value: function updateInclude(include) {
  19048. this.setState({ include: include });
  19049. }
  19050. }, {
  19051. key: 'getRefreshOptions',
  19052. value: function getRefreshOptions() {
  19053. var lang = this.props.lang;
  19054. var k = [[0, '' + lang.never], [1, '1 ' + lang.hour], [24, '24 ' + lang.hours], [168, '7 ' + lang.days]];
  19055. if (_Agent2.default.IS_DEV) {
  19056. k.splice(1, 0, [0.002778, '10s (for DEV)']); // dev test only
  19057. }
  19058. return k.map(function (_ref, idx) {
  19059. var _ref2 = _slicedToArray(_ref, 2),
  19060. v = _ref2[0],
  19061. n = _ref2[1];
  19062. return _react2.default.createElement(
  19063. 'option',
  19064. { value: v, key: idx },
  19065. n
  19066. );
  19067. });
  19068. }
  19069. }, {
  19070. key: 'getEditOperations',
  19071. value: function getEditOperations() {
  19072. if (this.state.is_add) return null;
  19073. var lang = this.props.lang;
  19074. return _react2.default.createElement(
  19075. 'div',
  19076. null,
  19077. _react2.default.createElement(
  19078. 'div',
  19079. { className: 'ln' },
  19080. _react2.default.createElement(
  19081. 'a',
  19082. { href: '#', className: 'del',
  19083. onClick: this.confirmDel.bind(this)
  19084. },
  19085. _react2.default.createElement('i', { className: 'iconfont icon-delete' }),
  19086. _react2.default.createElement(
  19087. 'span',
  19088. null,
  19089. lang.del_hosts
  19090. )
  19091. )
  19092. )
  19093. );
  19094. }
  19095. }, {
  19096. key: 'refresh',
  19097. value: function refresh() {
  19098. if (this.state.is_loading) return;
  19099. _Agent2.default.emit('check_hosts_refresh', this.current_hosts);
  19100. this.setState({
  19101. is_loading: true
  19102. });
  19103. }
  19104. }, {
  19105. key: 'renderGroup',
  19106. value: function renderGroup() {
  19107. if (this.state.where !== 'group') return null;
  19108. return _react2.default.createElement(_group2.default, {
  19109. list: this.props.list,
  19110. include: this.state.include,
  19111. updateInclude: this.updateInclude.bind(this)
  19112. });
  19113. }
  19114. }, {
  19115. key: 'renderRemoteInputs',
  19116. value: function renderRemoteInputs() {
  19117. var _this3 = this;
  19118. if (this.state.where !== 'remote') return null;
  19119. var lang = this.props.lang;
  19120. return _react2.default.createElement(
  19121. 'div',
  19122. { className: 'remote-ipts' },
  19123. _react2.default.createElement(
  19124. 'div',
  19125. { className: 'ln' },
  19126. _react2.default.createElement(
  19127. 'div',
  19128. { className: 'title' },
  19129. lang.url
  19130. ),
  19131. _react2.default.createElement(
  19132. 'div',
  19133. { className: 'cnt' },
  19134. _react2.default.createElement('input', {
  19135. type: 'text',
  19136. ref: 'url',
  19137. value: this.state.url,
  19138. placeholder: 'http://',
  19139. onChange: function onChange(e) {
  19140. return _this3.setState({ url: e.target.value });
  19141. },
  19142. onKeyDown: function onKeyDown(e) {
  19143. return e.keyCode === 13 && _this3.onOK() || e.keyCode === 27 && _this3.onCancel();
  19144. }
  19145. })
  19146. )
  19147. ),
  19148. _react2.default.createElement(
  19149. 'div',
  19150. { className: 'ln' },
  19151. _react2.default.createElement(
  19152. 'div',
  19153. { className: 'title' },
  19154. lang.auto_refresh
  19155. ),
  19156. _react2.default.createElement(
  19157. 'div',
  19158. { className: 'cnt' },
  19159. _react2.default.createElement(
  19160. 'select',
  19161. {
  19162. value: this.state.refresh_interval,
  19163. onChange: function onChange(e) {
  19164. return _this3.setState({ refresh_interval: parseFloat(e.target.value) || 0 });
  19165. }
  19166. },
  19167. this.getRefreshOptions()
  19168. ),
  19169. _react2.default.createElement('i', {
  19170. className: (0, _classnames2.default)({
  19171. iconfont: 1,
  19172. 'icon-refresh': 1,
  19173. 'invisible': !this.current_hosts || this.state.url !== this.current_hosts.url,
  19174. 'loading': this.state.is_loading
  19175. }),
  19176. title: lang.refresh,
  19177. onClick: function onClick() {
  19178. return _this3.refresh();
  19179. }
  19180. }),
  19181. _react2.default.createElement(
  19182. 'span',
  19183. { className: 'last-refresh' },
  19184. lang.last_refresh,
  19185. this.state.last_refresh || 'N/A'
  19186. )
  19187. )
  19188. )
  19189. );
  19190. }
  19191. }, {
  19192. key: 'body',
  19193. value: function body() {
  19194. var _this4 = this;
  19195. var lang = this.props.lang;
  19196. return _react2.default.createElement(
  19197. 'div',
  19198. { ref: 'body' },
  19199. _react2.default.createElement(
  19200. 'div',
  19201. { className: 'ln' },
  19202. _react2.default.createElement('input', { id: 'ipt-local', type: 'radio', name: 'where', value: 'local',
  19203. checked: this.state.where === 'local',
  19204. onChange: function onChange(e) {
  19205. return _this4.setState({ where: e.target.value });
  19206. }
  19207. }),
  19208. _react2.default.createElement(
  19209. 'label',
  19210. { htmlFor: 'ipt-local' },
  19211. lang.where_local
  19212. ),
  19213. _react2.default.createElement('input', { id: 'ipt-remote', type: 'radio', name: 'where', value: 'remote',
  19214. checked: this.state.where === 'remote',
  19215. onChange: function onChange(e) {
  19216. return _this4.setState({ where: e.target.value });
  19217. }
  19218. }),
  19219. _react2.default.createElement(
  19220. 'label',
  19221. { htmlFor: 'ipt-remote' },
  19222. lang.where_remote
  19223. ),
  19224. _react2.default.createElement('input', { id: 'ipt-group', type: 'radio', name: 'where', value: 'group',
  19225. checked: this.state.where === 'group',
  19226. onChange: function onChange(e) {
  19227. return _this4.setState({ where: e.target.value });
  19228. }
  19229. }),
  19230. _react2.default.createElement(
  19231. 'label',
  19232. { htmlFor: 'ipt-group' },
  19233. lang.where_group
  19234. )
  19235. ),
  19236. _react2.default.createElement(
  19237. 'div',
  19238. { className: 'ln' },
  19239. _react2.default.createElement(
  19240. 'div',
  19241. { className: 'title' },
  19242. lang.hosts_title
  19243. ),
  19244. _react2.default.createElement(
  19245. 'div',
  19246. { className: 'cnt' },
  19247. _react2.default.createElement('input', {
  19248. type: 'text',
  19249. ref: 'title',
  19250. name: 'text',
  19251. value: this.state.title,
  19252. onChange: function onChange(e) {
  19253. return _this4.setState({ title: e.target.value });
  19254. },
  19255. onKeyDown: function onKeyDown(e) {
  19256. return e.keyCode === 13 && _this4.onOK() || e.keyCode === 27 && _this4.onCancel();
  19257. }
  19258. })
  19259. )
  19260. ),
  19261. this.renderRemoteInputs(),
  19262. this.renderGroup(),
  19263. this.getEditOperations()
  19264. );
  19265. }
  19266. }, {
  19267. key: 'render',
  19268. value: function render() {
  19269. var _this5 = this;
  19270. var lang = this.props.lang;
  19271. return _react2.default.createElement(_frame2.default, {
  19272. show: this.state.show,
  19273. head: lang[this.state.is_add ? 'add_hosts' : 'edit_hosts'],
  19274. body: this.body(),
  19275. onOK: function onOK() {
  19276. return _this5.onOK();
  19277. },
  19278. onCancel: function onCancel() {
  19279. return _this5.onCancel();
  19280. },
  19281. lang: this.props.lang
  19282. });
  19283. }
  19284. }]);
  19285. return EditPrompt;
  19286. }(_react2.default.Component);
  19287. exports.default = EditPrompt;
  19288. /***/ }),
  19289. /* 112 */
  19290. /***/ (function(module, exports, __webpack_require__) {
  19291. "use strict";
  19292. /**
  19293. * @author oldj
  19294. * @blog https://oldj.net
  19295. */
  19296. Object.defineProperty(exports, "__esModule", {
  19297. value: true
  19298. });
  19299. 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; };
  19300. 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; }; }();
  19301. var _react = __webpack_require__(7);
  19302. var _react2 = _interopRequireDefault(_react);
  19303. var _classnames = __webpack_require__(15);
  19304. var _classnames2 = _interopRequireDefault(_classnames);
  19305. var _sortablejs = __webpack_require__(100);
  19306. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  19307. var _listToArray = __webpack_require__(102);
  19308. var _listToArray2 = _interopRequireDefault(_listToArray);
  19309. __webpack_require__(231);
  19310. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19311. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19312. 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; }
  19313. 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; }
  19314. var Group = function (_React$Component) {
  19315. _inherits(Group, _React$Component);
  19316. function Group(props) {
  19317. _classCallCheck(this, Group);
  19318. var _this = _possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props));
  19319. _this.state = {
  19320. list: [],
  19321. include: []
  19322. };
  19323. _this.current_hosts = null;
  19324. _this.ids = [];
  19325. return _this;
  19326. }
  19327. _createClass(Group, [{
  19328. key: 'makeItem',
  19329. value: function makeItem(item) {
  19330. if (!item) {
  19331. return null;
  19332. }
  19333. var attrs = {
  19334. 'data-id': item.id || ''
  19335. };
  19336. return _react2.default.createElement(
  19337. 'div',
  19338. _extends({ className: 'hosts-item' }, attrs),
  19339. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  19340. 'iconfont': 1,
  19341. 'item-icon': 1,
  19342. 'icon-file': item.where !== 'group',
  19343. 'icon-files': item.where === 'group'
  19344. })
  19345. }),
  19346. _react2.default.createElement(
  19347. 'span',
  19348. null,
  19349. item.title || 'untitled'
  19350. )
  19351. );
  19352. }
  19353. }, {
  19354. key: 'makeList',
  19355. value: function makeList() {
  19356. var _this2 = this;
  19357. var include = this.state.include;
  19358. var items = this.state.list.filter(function (item) {
  19359. return item.where !== 'group' && !include.includes(item.id);
  19360. }).map(function (item) {
  19361. return _this2.makeItem(item);
  19362. });
  19363. return _react2.default.createElement(
  19364. 'div',
  19365. { id: 'hosts-group-valid' },
  19366. _react2.default.createElement(
  19367. 'div',
  19368. { ref: 'group_valid', className: 'hosts-group-list' },
  19369. items
  19370. )
  19371. );
  19372. }
  19373. }, {
  19374. key: 'currentList',
  19375. value: function currentList() {
  19376. var _this3 = this;
  19377. var list = this.state.list;
  19378. var items = this.state.include.map(function (id) {
  19379. return list.find(function (item) {
  19380. return item.id === id;
  19381. });
  19382. }).map(function (item) {
  19383. return _this3.makeItem(item);
  19384. });
  19385. return _react2.default.createElement(
  19386. 'div',
  19387. { id: 'hosts-group-current' },
  19388. _react2.default.createElement(
  19389. 'div',
  19390. { ref: 'group_current', className: 'hosts-group-list' },
  19391. items
  19392. )
  19393. );
  19394. }
  19395. }, {
  19396. key: 'getCurrentListFromDOM',
  19397. value: function getCurrentListFromDOM() {
  19398. var updateInclude = this.props.updateInclude;
  19399. var nodes = this.refs.group_current.getElementsByClassName('hosts-item');
  19400. nodes = (0, _listToArray2.default)(nodes);
  19401. var ids = nodes.map(function (item) {
  19402. return item.getAttribute('data-id');
  19403. });
  19404. this.ids = ids;
  19405. updateInclude(ids);
  19406. }
  19407. }, {
  19408. key: 'componentWillMount',
  19409. value: function componentWillMount() {
  19410. this.setState({
  19411. list: this.props.list,
  19412. include: this.props.include
  19413. });
  19414. }
  19415. }, {
  19416. key: 'componentDidMount',
  19417. value: function componentDidMount() {
  19418. var _this4 = this;
  19419. _sortablejs2.default.create(this.refs.group_valid, {
  19420. group: 'sorting',
  19421. animation: 150,
  19422. sort: false
  19423. });
  19424. _sortablejs2.default.create(this.refs.group_current, {
  19425. group: 'sorting',
  19426. animation: 150,
  19427. sort: true,
  19428. onSort: function onSort() {
  19429. _this4.getCurrentListFromDOM();
  19430. }
  19431. });
  19432. }
  19433. }, {
  19434. key: 'render',
  19435. value: function render() {
  19436. return _react2.default.createElement(
  19437. 'div',
  19438. { id: 'hosts-group' },
  19439. this.makeList(),
  19440. _react2.default.createElement('div', { className: 'arrow' }),
  19441. this.currentList()
  19442. );
  19443. }
  19444. }]);
  19445. return Group;
  19446. }(_react2.default.Component);
  19447. exports.default = Group;
  19448. /***/ }),
  19449. /* 113 */
  19450. /***/ (function(module, exports, __webpack_require__) {
  19451. "use strict";
  19452. /**
  19453. * @author oldj
  19454. * @blog http://oldj.net
  19455. */
  19456. Object.defineProperty(exports, "__esModule", {
  19457. value: true
  19458. });
  19459. 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; }; }();
  19460. var _react = __webpack_require__(7);
  19461. var _react2 = _interopRequireDefault(_react);
  19462. var _frame = __webpack_require__(48);
  19463. var _frame2 = _interopRequireDefault(_frame);
  19464. var _classnames = __webpack_require__(15);
  19465. var _classnames2 = _interopRequireDefault(_classnames);
  19466. var _Agent = __webpack_require__(4);
  19467. var _Agent2 = _interopRequireDefault(_Agent);
  19468. var _version = __webpack_require__(69);
  19469. var _formatVersion = __webpack_require__(106);
  19470. var _formatVersion2 = _interopRequireDefault(_formatVersion);
  19471. __webpack_require__(232);
  19472. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19473. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19474. 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; }
  19475. 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; }
  19476. var pref_keys = ['after_cmd', 'auto_launch', 'choice_mode', 'hide_at_launch', 'is_dock_icon_hidden', 'user_language'];
  19477. var PreferencesPrompt = function (_React$Component) {
  19478. _inherits(PreferencesPrompt, _React$Component);
  19479. function PreferencesPrompt(props) {
  19480. _classCallCheck(this, PreferencesPrompt);
  19481. var _this = _possibleConstructorReturn(this, (PreferencesPrompt.__proto__ || Object.getPrototypeOf(PreferencesPrompt)).call(this, props));
  19482. _this.state = {
  19483. show: false,
  19484. user_language: '',
  19485. after_cmd: '',
  19486. choice_mode: '',
  19487. auto_launch: false,
  19488. hide_at_launch: false,
  19489. lang_list: [],
  19490. update_found: false // 发现新版本
  19491. };
  19492. _Agent2.default.pact('getLangList').then(function (lang_list) {
  19493. return _this.setState({ lang_list: lang_list });
  19494. });
  19495. return _this;
  19496. }
  19497. _createClass(PreferencesPrompt, [{
  19498. key: 'componentDidMount',
  19499. value: function componentDidMount() {
  19500. var _this2 = this;
  19501. _Agent2.default.on('show_preferences', function () {
  19502. _Agent2.default.pact('getPref').then(function (pref) {
  19503. _this2.setState(Object.assign({}, pref, { show: true }));
  19504. });
  19505. });
  19506. _Agent2.default.on('update_found', function (v) {
  19507. console.log(v);
  19508. _this2.setState({
  19509. update_found: true
  19510. });
  19511. });
  19512. }
  19513. }, {
  19514. key: 'onOK',
  19515. value: function onOK() {
  19516. var _this3 = this;
  19517. this.setState({
  19518. show: false
  19519. }, function () {
  19520. var prefs = {};
  19521. var d = _this3.state;
  19522. pref_keys.map(function (k) {
  19523. if (d.hasOwnProperty(k)) {
  19524. prefs[k] = d[k];
  19525. }
  19526. });
  19527. _Agent2.default.pact('setPref', prefs).then(function () {
  19528. setTimeout(function () {
  19529. _Agent2.default.pact('relaunch');
  19530. }, 200);
  19531. });
  19532. });
  19533. }
  19534. }, {
  19535. key: 'onCancel',
  19536. value: function onCancel() {
  19537. this.setState({
  19538. show: false
  19539. });
  19540. }
  19541. }, {
  19542. key: 'getLanguageOptions',
  19543. value: function getLanguageOptions() {
  19544. return this.state.lang_list.map(function (_ref, idx) {
  19545. var key = _ref.key,
  19546. name = _ref.name;
  19547. return _react2.default.createElement(
  19548. 'option',
  19549. { value: key, key: idx },
  19550. name
  19551. );
  19552. });
  19553. }
  19554. }, {
  19555. key: 'updateLangKey',
  19556. value: function updateLangKey(v) {
  19557. this.setState({ user_language: v });
  19558. }
  19559. }, {
  19560. key: 'updateChoiceMode',
  19561. value: function updateChoiceMode(v) {
  19562. this.setState({
  19563. choice_mode: v
  19564. });
  19565. }
  19566. }, {
  19567. key: 'updateAfterCmd',
  19568. value: function updateAfterCmd(v) {
  19569. this.setState({
  19570. after_cmd: v
  19571. });
  19572. }
  19573. }, {
  19574. key: 'updateAutoLaunch',
  19575. value: function updateAutoLaunch(v) {
  19576. this.setState({
  19577. auto_launch: v
  19578. });
  19579. // todo set auto launch
  19580. }
  19581. }, {
  19582. key: 'updateMinimizeAtLaunch',
  19583. value: function updateMinimizeAtLaunch(v) {
  19584. this.setState({
  19585. hide_at_launch: v
  19586. });
  19587. }
  19588. }, {
  19589. key: 'prefLanguage',
  19590. value: function prefLanguage() {
  19591. var _this4 = this;
  19592. var lang = this.props.lang;
  19593. return _react2.default.createElement(
  19594. 'div',
  19595. { className: 'ln' },
  19596. _react2.default.createElement(
  19597. 'div',
  19598. { className: 'title' },
  19599. lang.language
  19600. ),
  19601. _react2.default.createElement(
  19602. 'div',
  19603. { className: 'cnt' },
  19604. _react2.default.createElement(
  19605. 'select',
  19606. {
  19607. value: this.state.user_language || '',
  19608. onChange: function onChange(e) {
  19609. return _this4.updateLangKey(e.target.value);
  19610. }
  19611. },
  19612. this.getLanguageOptions()
  19613. ),
  19614. _react2.default.createElement(
  19615. 'div',
  19616. {
  19617. className: 'inform' },
  19618. lang.should_restart_after_change_language
  19619. )
  19620. )
  19621. );
  19622. }
  19623. }, {
  19624. key: 'prefChoiceMode',
  19625. value: function prefChoiceMode() {
  19626. var _this5 = this;
  19627. var lang = this.props.lang;
  19628. return _react2.default.createElement(
  19629. 'div',
  19630. { className: 'ln' },
  19631. _react2.default.createElement(
  19632. 'div',
  19633. { className: 'title' },
  19634. lang.pref_choice_mode
  19635. ),
  19636. _react2.default.createElement(
  19637. 'div',
  19638. { className: 'cnt' },
  19639. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-single', name: 'choice_mode',
  19640. value: 'single',
  19641. defaultChecked: this.state.choice_mode === 'single',
  19642. onChange: function onChange(e) {
  19643. return _this5.updateChoiceMode(e.target.value);
  19644. }
  19645. }),
  19646. _react2.default.createElement(
  19647. 'label',
  19648. {
  19649. htmlFor: 'pref-choice-mode-single' },
  19650. lang.pref_choice_mode_single
  19651. ),
  19652. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-multiple', name: 'choice_mode',
  19653. value: 'multiple',
  19654. defaultChecked: this.state.choice_mode === 'multiple',
  19655. onChange: function onChange(e) {
  19656. return _this5.updateChoiceMode(e.target.value);
  19657. }
  19658. }),
  19659. _react2.default.createElement(
  19660. 'label',
  19661. {
  19662. htmlFor: 'pref-choice-mode-multiple' },
  19663. lang.pref_choice_mode_multiple
  19664. )
  19665. )
  19666. );
  19667. }
  19668. }, {
  19669. key: 'prefAfterCmd',
  19670. value: function prefAfterCmd() {
  19671. var _this6 = this;
  19672. var lang = this.props.lang;
  19673. return _react2.default.createElement(
  19674. 'div',
  19675. { className: 'ln' },
  19676. _react2.default.createElement(
  19677. 'div',
  19678. { className: 'title' },
  19679. lang.pref_after_cmd
  19680. ),
  19681. _react2.default.createElement(
  19682. 'div',
  19683. { className: 'cnt' },
  19684. _react2.default.createElement(
  19685. 'div',
  19686. { className: 'inform' },
  19687. lang.pref_after_cmd_info
  19688. ),
  19689. _react2.default.createElement('textarea', {
  19690. name: '',
  19691. defaultValue: this.state.after_cmd,
  19692. placeholder: lang.pref_after_cmd_placeholder,
  19693. onChange: function onChange(e) {
  19694. return _this6.updateAfterCmd(e.target.value);
  19695. }
  19696. })
  19697. )
  19698. );
  19699. }
  19700. }, {
  19701. key: 'prefAutoLaunch',
  19702. value: function prefAutoLaunch() {
  19703. var _this7 = this;
  19704. var lang = this.props.lang;
  19705. return _react2.default.createElement(
  19706. 'div',
  19707. { className: 'ln' },
  19708. _react2.default.createElement(
  19709. 'div',
  19710. { className: 'title' },
  19711. lang.auto_launch
  19712. ),
  19713. _react2.default.createElement(
  19714. 'div',
  19715. { className: 'cnt' },
  19716. _react2.default.createElement('input', { type: 'checkbox', name: '',
  19717. defaultChecked: this.state.auto_launch,
  19718. onChange: function onChange(e) {
  19719. return _this7.updateAutoLaunch(e.target.checked);
  19720. }
  19721. })
  19722. )
  19723. );
  19724. }
  19725. }, {
  19726. key: 'prefMinimizeAtLaunch',
  19727. value: function prefMinimizeAtLaunch() {
  19728. var _this8 = this;
  19729. var lang = this.props.lang;
  19730. return _react2.default.createElement(
  19731. 'div',
  19732. { className: 'ln' },
  19733. _react2.default.createElement(
  19734. 'div',
  19735. { className: 'title' },
  19736. lang.hide_at_launch
  19737. ),
  19738. _react2.default.createElement(
  19739. 'div',
  19740. { className: 'cnt' },
  19741. _react2.default.createElement('input', { type: 'checkbox', name: '',
  19742. defaultChecked: this.state.hide_at_launch,
  19743. onChange: function onChange(e) {
  19744. return _this8.updateMinimizeAtLaunch(e.target.checked);
  19745. }
  19746. })
  19747. )
  19748. );
  19749. }
  19750. }, {
  19751. key: 'body',
  19752. value: function body() {
  19753. return _react2.default.createElement(
  19754. 'div',
  19755. { ref: 'body' },
  19756. _react2.default.createElement(
  19757. 'div',
  19758. {
  19759. className: (0, _classnames2.default)('current-version', { 'update-found': this.state.update_found }) },
  19760. _react2.default.createElement(
  19761. 'a',
  19762. { href: '#',
  19763. onClick: PreferencesPrompt.openDownloadPage },
  19764. (0, _formatVersion2.default)(_version.version)
  19765. )
  19766. ),
  19767. this.prefLanguage(),
  19768. this.prefChoiceMode(),
  19769. this.prefAfterCmd(),
  19770. this.prefMinimizeAtLaunch()
  19771. );
  19772. }
  19773. }, {
  19774. key: 'render',
  19775. value: function render() {
  19776. var _this9 = this;
  19777. var lang = this.props.lang;
  19778. return _react2.default.createElement(_frame2.default, {
  19779. show: this.state.show,
  19780. head: lang.preferences,
  19781. body: this.body(),
  19782. onOK: function onOK() {
  19783. return _this9.onOK();
  19784. },
  19785. onCancel: function onCancel() {
  19786. return _this9.onCancel();
  19787. },
  19788. cancel_title: lang.cancel,
  19789. ok_title: lang.set_and_relaunch_app
  19790. });
  19791. }
  19792. }], [{
  19793. key: 'openDownloadPage',
  19794. value: function openDownloadPage() {
  19795. _Agent2.default.pact('openUrl', __webpack_require__(105).url_download);
  19796. }
  19797. }]);
  19798. return PreferencesPrompt;
  19799. }(_react2.default.Component);
  19800. exports.default = PreferencesPrompt;
  19801. /***/ }),
  19802. /* 114 */
  19803. /***/ (function(module, exports, __webpack_require__) {
  19804. "use strict";
  19805. /**
  19806. * @author oldj
  19807. * @blog http://oldj.net
  19808. */
  19809. Object.defineProperty(exports, "__esModule", {
  19810. value: true
  19811. });
  19812. 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; }; }();
  19813. var _react = __webpack_require__(7);
  19814. var _react2 = _interopRequireDefault(_react);
  19815. var _Agent = __webpack_require__(4);
  19816. var _Agent2 = _interopRequireDefault(_Agent);
  19817. var _frame = __webpack_require__(48);
  19818. var _frame2 = _interopRequireDefault(_frame);
  19819. __webpack_require__(233);
  19820. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19821. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19822. 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; }
  19823. 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; }
  19824. var SudoPrompt = function (_React$Component) {
  19825. _inherits(SudoPrompt, _React$Component);
  19826. function SudoPrompt(props) {
  19827. _classCallCheck(this, SudoPrompt);
  19828. var _this = _possibleConstructorReturn(this, (SudoPrompt.__proto__ || Object.getPrototypeOf(SudoPrompt)).call(this, props));
  19829. _this.onSuccess = null;
  19830. _this.state = {
  19831. show: false,
  19832. pswd: ''
  19833. };
  19834. return _this;
  19835. }
  19836. _createClass(SudoPrompt, [{
  19837. key: 'componentDidMount',
  19838. value: function componentDidMount() {
  19839. var _this2 = this;
  19840. _Agent2.default.on('sudo_prompt', function (success) {
  19841. _this2.setState({ show: true });
  19842. _this2.onSuccess = success;
  19843. setTimeout(function () {
  19844. var el = _this2.refs.body;
  19845. el && el.querySelector('input').focus();
  19846. }, 100);
  19847. });
  19848. }
  19849. }, {
  19850. key: 'onOK',
  19851. value: function onOK() {
  19852. var pswd = this.refs.pswd.value;
  19853. if (!pswd) {
  19854. var el = this.refs.body;
  19855. el && el.querySelector('input').focus();
  19856. return;
  19857. }
  19858. this.setState({
  19859. show: false,
  19860. pswd: pswd
  19861. });
  19862. _Agent2.default.emit('sudo_pswd', pswd);
  19863. if (typeof this.onSuccess === 'function') {
  19864. this.onSuccess(pswd);
  19865. }
  19866. this.onSuccess = null;
  19867. }
  19868. }, {
  19869. key: 'onCancel',
  19870. value: function onCancel() {
  19871. _Agent2.default.emit('sudo_cancel');
  19872. this.setState({
  19873. show: false
  19874. });
  19875. this.onSuccess = null;
  19876. }
  19877. }, {
  19878. key: 'body',
  19879. value: function body() {
  19880. var _this3 = this;
  19881. var lang = this.props.lang;
  19882. return _react2.default.createElement(
  19883. 'div',
  19884. { ref: 'body' },
  19885. _react2.default.createElement(
  19886. 'div',
  19887. { className: 'ln' },
  19888. _react2.default.createElement(
  19889. 'div',
  19890. { className: 'title' },
  19891. lang.sudo_pswd
  19892. ),
  19893. _react2.default.createElement(
  19894. 'div',
  19895. { className: 'cnt' },
  19896. _react2.default.createElement('input', {
  19897. type: 'password',
  19898. ref: 'pswd',
  19899. onKeyDown: function onKeyDown(e) {
  19900. return e.keyCode === 13 && _this3.onOK() || e.keyCode === 27 && _this3.onCancel();
  19901. }
  19902. })
  19903. )
  19904. )
  19905. );
  19906. }
  19907. }, {
  19908. key: 'render',
  19909. value: function render() {
  19910. var _this4 = this;
  19911. var lang = this.props.lang;
  19912. return _react2.default.createElement(_frame2.default, {
  19913. show: this.state.show,
  19914. head: lang.input_sudo_pswd,
  19915. body: this.body(),
  19916. onOK: function onOK() {
  19917. return _this4.onOK();
  19918. },
  19919. onCancel: function onCancel() {
  19920. return _this4.onCancel();
  19921. },
  19922. lang: lang
  19923. });
  19924. }
  19925. }]);
  19926. return SudoPrompt;
  19927. }(_react2.default.Component);
  19928. exports.default = SudoPrompt;
  19929. /***/ }),
  19930. /* 115 */
  19931. /***/ (function(module, exports, __webpack_require__) {
  19932. "use strict";
  19933. /**
  19934. * @author oldj
  19935. * @blog http://oldj.net
  19936. */
  19937. var _react = __webpack_require__(7);
  19938. var _react2 = _interopRequireDefault(_react);
  19939. var _reactDom = __webpack_require__(104);
  19940. var _reactDom2 = _interopRequireDefault(_reactDom);
  19941. var _app = __webpack_require__(103);
  19942. var _app2 = _interopRequireDefault(_app);
  19943. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19944. _reactDom2.default.render(_react2.default.createElement(_app2.default, null), document.getElementById('app'));
  19945. /***/ }),
  19946. /* 116 */
  19947. /***/ (function(module, exports, __webpack_require__) {
  19948. "use strict";
  19949. /**
  19950. * @author oldj
  19951. * @blog https://oldj.net
  19952. */
  19953. Object.defineProperty(exports, "__esModule", {
  19954. value: true
  19955. });
  19956. 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; }; }();
  19957. var _react = __webpack_require__(7);
  19958. var _react2 = _interopRequireDefault(_react);
  19959. var _classnames = __webpack_require__(15);
  19960. var _classnames2 = _interopRequireDefault(_classnames);
  19961. var _Agent = __webpack_require__(4);
  19962. var _Agent2 = _interopRequireDefault(_Agent);
  19963. __webpack_require__(234);
  19964. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19965. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19966. 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; }
  19967. 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; }
  19968. var Buttons = function (_React$Component) {
  19969. _inherits(Buttons, _React$Component);
  19970. function Buttons(props) {
  19971. _classCallCheck(this, Buttons);
  19972. var _this = _possibleConstructorReturn(this, (Buttons.__proto__ || Object.getPrototypeOf(Buttons)).call(this, props));
  19973. _this.state = {
  19974. top_toggle_on: true,
  19975. search_on: false
  19976. };
  19977. _this.on_ids = [];
  19978. return _this;
  19979. }
  19980. _createClass(Buttons, [{
  19981. key: 'btnToggle',
  19982. value: function btnToggle() {
  19983. var _this2 = this;
  19984. var doToggle = function doToggle() {
  19985. var on = !_this2.state.top_toggle_on;
  19986. _Agent2.default.emit('top_toggle', on, _this2.on_ids, function (e) {
  19987. if (e) {
  19988. console.log(e);
  19989. return;
  19990. }
  19991. _this2.setState({
  19992. top_toggle_on: on
  19993. }, function () {
  19994. if (_this2.state.top_toggle_on) {
  19995. _this2.on_ids = [];
  19996. }
  19997. });
  19998. });
  19999. };
  20000. if (this.state.top_toggle_on) {
  20001. _Agent2.default.emit('get_on_hosts', function (ids) {
  20002. _this2.on_ids = ids;
  20003. doToggle();
  20004. });
  20005. } else {
  20006. doToggle();
  20007. }
  20008. }
  20009. }, {
  20010. key: 'btnSearch',
  20011. value: function btnSearch() {
  20012. var _this3 = this;
  20013. this.setState({
  20014. search_on: !this.state.search_on
  20015. }, function () {
  20016. _Agent2.default.emit(_this3.state.search_on ? 'search_on' : 'search_off');
  20017. });
  20018. }
  20019. }, {
  20020. key: 'cancelSearch',
  20021. value: function cancelSearch() {
  20022. this.setState({
  20023. search_on: false
  20024. }, function () {
  20025. _Agent2.default.emit('search_off');
  20026. });
  20027. }
  20028. }, {
  20029. key: 'componentDidMount',
  20030. value: function componentDidMount() {
  20031. var _this4 = this;
  20032. _Agent2.default.on('to_search', function () {
  20033. _this4.btnSearch();
  20034. });
  20035. _Agent2.default.on('esc', function () {
  20036. if (_this4.state.search_on) {
  20037. _this4.btnSearch();
  20038. }
  20039. });
  20040. }
  20041. }, {
  20042. key: 'render',
  20043. value: function render() {
  20044. var _this5 = this;
  20045. return _react2.default.createElement(
  20046. 'div',
  20047. { id: 'sh-buttons' },
  20048. _react2.default.createElement(
  20049. 'div',
  20050. { className: 'left' },
  20051. _react2.default.createElement(
  20052. 'a',
  20053. {
  20054. className: 'btn-add',
  20055. href: '#',
  20056. onClick: function onClick() {
  20057. return Buttons.btnAdd();
  20058. }
  20059. },
  20060. '+'
  20061. )
  20062. ),
  20063. _react2.default.createElement(
  20064. 'div',
  20065. { className: 'right' },
  20066. _react2.default.createElement('i', {
  20067. className: (0, _classnames2.default)({
  20068. iconfont: 1,
  20069. 'icon-search': 1,
  20070. 'on': this.state.search_on
  20071. }),
  20072. onClick: function onClick() {
  20073. return _this5.btnSearch();
  20074. }
  20075. }),
  20076. _react2.default.createElement('i', {
  20077. className: (0, _classnames2.default)({
  20078. iconfont: 1,
  20079. 'icon-switchon': this.state.top_toggle_on,
  20080. 'icon-switchoff': !this.state.top_toggle_on
  20081. }),
  20082. onClick: function onClick() {
  20083. return _this5.btnToggle();
  20084. }
  20085. })
  20086. )
  20087. );
  20088. }
  20089. }], [{
  20090. key: 'btnAdd',
  20091. value: function btnAdd() {
  20092. _Agent2.default.emit('add_hosts');
  20093. }
  20094. }]);
  20095. return Buttons;
  20096. }(_react2.default.Component);
  20097. exports.default = Buttons;
  20098. /***/ }),
  20099. /* 117 */
  20100. /***/ (function(module, exports, __webpack_require__) {
  20101. "use strict";
  20102. /**
  20103. * @author oldj
  20104. * @blog https://oldj.net
  20105. */
  20106. Object.defineProperty(exports, "__esModule", {
  20107. value: true
  20108. });
  20109. 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; };
  20110. 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; }; }();
  20111. var _react = __webpack_require__(7);
  20112. var _react2 = _interopRequireDefault(_react);
  20113. var _classnames = __webpack_require__(15);
  20114. var _classnames2 = _interopRequireDefault(_classnames);
  20115. var _Agent = __webpack_require__(4);
  20116. var _Agent2 = _interopRequireDefault(_Agent);
  20117. var _isInViewport = __webpack_require__(242);
  20118. var _isInViewport2 = _interopRequireDefault(_isInViewport);
  20119. __webpack_require__(235);
  20120. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20121. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20122. 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; }
  20123. 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; }
  20124. var ListItem = function (_React$Component) {
  20125. _inherits(ListItem, _React$Component);
  20126. function ListItem(props) {
  20127. _classCallCheck(this, ListItem);
  20128. var _this = _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).call(this, props));
  20129. _this.is_sys = !!_this.props.sys;
  20130. _this.state = {};
  20131. return _this;
  20132. }
  20133. _createClass(ListItem, [{
  20134. key: 'getTitle',
  20135. value: function getTitle() {
  20136. var lang = this.props.lang;
  20137. return this.is_sys ? lang.sys_hosts_title : this.props.data.title || lang.untitled;
  20138. }
  20139. }, {
  20140. key: 'beSelected',
  20141. value: function beSelected() {
  20142. this.props.setCurrent(this.props.data);
  20143. }
  20144. }, {
  20145. key: 'toggle',
  20146. value: function toggle() {
  20147. _Agent2.default.emit('toggle_hosts', Object.assign({}, this.props.data));
  20148. }
  20149. }, {
  20150. key: 'toEdit',
  20151. value: function toEdit() {
  20152. _Agent2.default.emit('edit_hosts', Object.assign({}, this.props.data));
  20153. }
  20154. }, {
  20155. key: 'componentDidMount',
  20156. value: function componentDidMount() {
  20157. var _props = this.props,
  20158. just_added_id = _props.just_added_id,
  20159. data = _props.data;
  20160. //Agent.on('select_hosts', id => {
  20161. // if (id && id === this.props.data.id) {
  20162. // this.beSelected()
  20163. // this.el && this.el.scrollIntoView()
  20164. // }
  20165. //})
  20166. if (!this.el) {
  20167. return;
  20168. }
  20169. var el = this.el;
  20170. if (just_added_id === data.id && !(0, _isInViewport2.default)(el)) {
  20171. el.scrollIntoView();
  20172. this.props.justAdd(null);
  20173. }
  20174. }
  20175. }, {
  20176. key: 'render',
  20177. value: function render() {
  20178. var _this2 = this;
  20179. var _props2 = this.props,
  20180. data = _props2.data,
  20181. sys = _props2.sys,
  20182. current = _props2.current,
  20183. show = _props2.show;
  20184. if (!data) return null;
  20185. var is_selected = data.id === current.id || data.is_sys && current.is_sys;
  20186. var attrs = {
  20187. 'data-id': data.id || ''
  20188. };
  20189. return _react2.default.createElement(
  20190. 'div',
  20191. _extends({ className: (0, _classnames2.default)({
  20192. 'list-item': 1
  20193. //, 'hidden': !this.isMatched()
  20194. , 'sys-hosts': sys,
  20195. 'selected': is_selected,
  20196. 'hidden': show === false
  20197. }),
  20198. onClick: this.beSelected.bind(this),
  20199. ref: function ref(el) {
  20200. return _this2.el = el;
  20201. }
  20202. }, attrs),
  20203. sys ? null : _react2.default.createElement(
  20204. 'div',
  20205. { className: 'item-buttons' },
  20206. _react2.default.createElement('i', {
  20207. className: 'iconfont icon-edit',
  20208. onClick: this.toEdit.bind(this)
  20209. }),
  20210. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20211. 'switch': 1,
  20212. 'iconfont': 1,
  20213. 'icon-on': data.on,
  20214. 'icon-off': !data.on
  20215. }),
  20216. onClick: this.toggle.bind(this)
  20217. })
  20218. ),
  20219. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20220. 'iconfont': 1,
  20221. 'item-icon': 1,
  20222. 'icon-warn': !!data.error,
  20223. 'icon-file': !sys && !data.error && data.where !== 'group',
  20224. 'icon-files': data.where === 'group',
  20225. 'icon-sysserver': sys && !data.error
  20226. }),
  20227. title: data.error || ''
  20228. }),
  20229. _react2.default.createElement(
  20230. 'span',
  20231. null,
  20232. this.getTitle()
  20233. )
  20234. );
  20235. }
  20236. }]);
  20237. return ListItem;
  20238. }(_react2.default.Component);
  20239. exports.default = ListItem;
  20240. /***/ }),
  20241. /* 118 */
  20242. /***/ (function(module, exports, __webpack_require__) {
  20243. "use strict";
  20244. /**
  20245. * @author oldj
  20246. * @blog https://oldj.net
  20247. */
  20248. Object.defineProperty(exports, "__esModule", {
  20249. value: true
  20250. });
  20251. 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; };
  20252. 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; }; }();
  20253. var _react = __webpack_require__(7);
  20254. var _react2 = _interopRequireDefault(_react);
  20255. var _listItem = __webpack_require__(117);
  20256. var _listItem2 = _interopRequireDefault(_listItem);
  20257. var _sortablejs = __webpack_require__(100);
  20258. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  20259. var _listToArray = __webpack_require__(102);
  20260. var _listToArray2 = _interopRequireDefault(_listToArray);
  20261. var _Agent = __webpack_require__(4);
  20262. var _Agent2 = _interopRequireDefault(_Agent);
  20263. var _kw = __webpack_require__(70);
  20264. __webpack_require__(236);
  20265. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20266. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20267. 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; }
  20268. 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; }
  20269. var List = function (_React$Component) {
  20270. _inherits(List, _React$Component);
  20271. function List(props) {
  20272. _classCallCheck(this, List);
  20273. var _this = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, props));
  20274. _this.state = {
  20275. kw: ''
  20276. };
  20277. _Agent2.default.on('search', function (kw) {
  20278. _this.setState({ kw: kw });
  20279. });
  20280. return _this;
  20281. }
  20282. _createClass(List, [{
  20283. key: 'customItems',
  20284. value: function customItems() {
  20285. var _this2 = this;
  20286. var kw = this.state.kw;
  20287. function match(kw, item) {
  20288. return (0, _kw.findPositions)(kw, item.content).length > 0 || (0, _kw.findPositions)(kw, item.title).length > 0;
  20289. }
  20290. return this.props.list.map(function (item, idx) {
  20291. var show = true;
  20292. if (kw && !match(kw, item)) {
  20293. show = false;
  20294. }
  20295. return _react2.default.createElement(_listItem2.default, _extends({
  20296. data: item,
  20297. idx: idx,
  20298. key: 'hosts-' + idx + Math.random(),
  20299. show: show
  20300. }, _this2.props));
  20301. });
  20302. }
  20303. }, {
  20304. key: 'getCurrentListFromDOM',
  20305. value: function getCurrentListFromDOM() {
  20306. var nodes = this.refs.items.getElementsByClassName('list-item');
  20307. nodes = (0, _listToArray2.default)(nodes);
  20308. var ids = nodes.map(function (el) {
  20309. return el.getAttribute('data-id');
  20310. });
  20311. _Agent2.default.emit('sort', ids);
  20312. }
  20313. }, {
  20314. key: 'componentDidMount',
  20315. value: function componentDidMount() {
  20316. var _this3 = this;
  20317. _sortablejs2.default.create(this.refs.items, {
  20318. group: 'list-sorting',
  20319. sort: true,
  20320. animation: 150,
  20321. onStart: function onStart() {
  20322. _Agent2.default.emit('drag_start');
  20323. },
  20324. onSort: function onSort() {
  20325. _this3.getCurrentListFromDOM();
  20326. _Agent2.default.emit('drag_end');
  20327. //console.log(evt)
  20328. //console.log(evt.item)
  20329. //console.log(evt.oldIndex, evt.newIndex)
  20330. }
  20331. });
  20332. }
  20333. }, {
  20334. key: 'render',
  20335. value: function render() {
  20336. return _react2.default.createElement(
  20337. 'div',
  20338. { id: 'sh-list' },
  20339. _react2.default.createElement(_listItem2.default, _extends({
  20340. data: this.props.sys_hosts
  20341. }, this.props, {
  20342. sys: '1' })),
  20343. _react2.default.createElement(
  20344. 'div',
  20345. { ref: 'items', className: 'custom-items' },
  20346. this.customItems()
  20347. )
  20348. );
  20349. }
  20350. }]);
  20351. return List;
  20352. }(_react2.default.Component);
  20353. exports.default = List;
  20354. /***/ }),
  20355. /* 119 */
  20356. /***/ (function(module, exports, __webpack_require__) {
  20357. "use strict";
  20358. /**
  20359. * @author oldj
  20360. * @blog http://oldj.net
  20361. */
  20362. Object.defineProperty(exports, "__esModule", {
  20363. value: true
  20364. });
  20365. 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; }; }();
  20366. var _react = __webpack_require__(7);
  20367. var _react2 = _interopRequireDefault(_react);
  20368. var _buttons = __webpack_require__(116);
  20369. var _buttons2 = _interopRequireDefault(_buttons);
  20370. var _searchbar = __webpack_require__(120);
  20371. var _searchbar2 = _interopRequireDefault(_searchbar);
  20372. var _list = __webpack_require__(118);
  20373. var _list2 = _interopRequireDefault(_list);
  20374. __webpack_require__(237);
  20375. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20376. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20377. 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; }
  20378. 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; }
  20379. var Panel = function (_React$Component) {
  20380. _inherits(Panel, _React$Component);
  20381. function Panel() {
  20382. _classCallCheck(this, Panel);
  20383. return _possibleConstructorReturn(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).apply(this, arguments));
  20384. }
  20385. _createClass(Panel, [{
  20386. key: 'render',
  20387. value: function render() {
  20388. return _react2.default.createElement(
  20389. 'div',
  20390. { id: 'panel' },
  20391. _react2.default.createElement(_list2.default, this.props),
  20392. _react2.default.createElement(_searchbar2.default, null),
  20393. _react2.default.createElement(_buttons2.default, null)
  20394. );
  20395. }
  20396. }]);
  20397. return Panel;
  20398. }(_react2.default.Component);
  20399. exports.default = Panel;
  20400. /***/ }),
  20401. /* 120 */
  20402. /***/ (function(module, exports, __webpack_require__) {
  20403. "use strict";
  20404. /**
  20405. * @author oldj
  20406. * @blog http://oldj.net
  20407. */
  20408. Object.defineProperty(exports, "__esModule", {
  20409. value: true
  20410. });
  20411. 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; }; }();
  20412. var _react = __webpack_require__(7);
  20413. var _react2 = _interopRequireDefault(_react);
  20414. var _Agent = __webpack_require__(4);
  20415. var _Agent2 = _interopRequireDefault(_Agent);
  20416. __webpack_require__(238);
  20417. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20418. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20419. 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; }
  20420. 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; }
  20421. var SearchBar = function (_React$Component) {
  20422. _inherits(SearchBar, _React$Component);
  20423. function SearchBar(props) {
  20424. _classCallCheck(this, SearchBar);
  20425. var _this = _possibleConstructorReturn(this, (SearchBar.__proto__ || Object.getPrototypeOf(SearchBar)).call(this, props));
  20426. _this.state = {
  20427. show: false,
  20428. keyword: ''
  20429. };
  20430. _this._t = null;
  20431. _Agent2.default.on('search_on', function () {
  20432. _this.setState({
  20433. show: true
  20434. }, function () {
  20435. setTimeout(function () {
  20436. _this.refs.keyword.focus();
  20437. }, 100);
  20438. });
  20439. });
  20440. _Agent2.default.on('search_off', function () {
  20441. _this.clearSearch();
  20442. });
  20443. return _this;
  20444. }
  20445. _createClass(SearchBar, [{
  20446. key: 'clearSearch',
  20447. value: function clearSearch() {
  20448. this.setState({
  20449. show: false,
  20450. keyword: ''
  20451. });
  20452. _Agent2.default.emit('search', '');
  20453. }
  20454. }, {
  20455. key: 'doSearch',
  20456. value: function doSearch(kw) {
  20457. this.setState({
  20458. keyword: kw
  20459. });
  20460. clearTimeout(this._t);
  20461. this._t = setTimeout(function () {
  20462. _Agent2.default.emit('search', kw);
  20463. }, 300);
  20464. }
  20465. }, {
  20466. key: 'render',
  20467. value: function render() {
  20468. var _this2 = this;
  20469. if (!this.state.show) {
  20470. return null;
  20471. }
  20472. return _react2.default.createElement(
  20473. 'div',
  20474. { id: 'sh-searchbar' },
  20475. _react2.default.createElement('input', {
  20476. ref: 'keyword',
  20477. type: 'text',
  20478. placeholder: 'keyword',
  20479. value: this.state.keyword,
  20480. onChange: function onChange(e) {
  20481. return _this2.doSearch(e.target.value);
  20482. },
  20483. onKeyDown: function onKeyDown(e) {
  20484. return e.keyCode === 27 && SearchBar.onCancel();
  20485. }
  20486. })
  20487. );
  20488. }
  20489. }], [{
  20490. key: 'onCancel',
  20491. value: function onCancel() {
  20492. _Agent2.default.emit('cancel_search');
  20493. }
  20494. }]);
  20495. return SearchBar;
  20496. }(_react2.default.Component);
  20497. exports.default = SearchBar;
  20498. /***/ }),
  20499. /* 121 */
  20500. /***/ (function(module, exports, __webpack_require__) {
  20501. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  20502. // Distributed under an MIT license: http://codemirror.net/LICENSE
  20503. (function(mod) {
  20504. if (true) // CommonJS
  20505. mod(__webpack_require__(49));
  20506. else if (typeof define == "function" && define.amd) // AMD
  20507. define(["../../lib/codemirror"], mod);
  20508. else // Plain browser env
  20509. mod(CodeMirror);
  20510. })(function(CodeMirror) {
  20511. "use strict";
  20512. var noOptions = {};
  20513. var nonWS = /[^\s\u00a0]/;
  20514. var Pos = CodeMirror.Pos;
  20515. function firstNonWS(str) {
  20516. var found = str.search(nonWS);
  20517. return found == -1 ? 0 : found;
  20518. }
  20519. CodeMirror.commands.toggleComment = function(cm) {
  20520. cm.toggleComment();
  20521. };
  20522. CodeMirror.defineExtension("toggleComment", function(options) {
  20523. if (!options) options = noOptions;
  20524. var cm = this;
  20525. var minLine = Infinity, ranges = this.listSelections(), mode = null;
  20526. for (var i = ranges.length - 1; i >= 0; i--) {
  20527. var from = ranges[i].from(), to = ranges[i].to();
  20528. if (from.line >= minLine) continue;
  20529. if (to.line >= minLine) to = Pos(minLine, 0);
  20530. minLine = from.line;
  20531. if (mode == null) {
  20532. if (cm.uncomment(from, to, options)) mode = "un";
  20533. else { cm.lineComment(from, to, options); mode = "line"; }
  20534. } else if (mode == "un") {
  20535. cm.uncomment(from, to, options);
  20536. } else {
  20537. cm.lineComment(from, to, options);
  20538. }
  20539. }
  20540. });
  20541. // Rough heuristic to try and detect lines that are part of multi-line string
  20542. function probablyInsideString(cm, pos, line) {
  20543. return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
  20544. }
  20545. function getMode(cm, pos) {
  20546. var mode = cm.getMode()
  20547. return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
  20548. }
  20549. CodeMirror.defineExtension("lineComment", function(from, to, options) {
  20550. if (!options) options = noOptions;
  20551. var self = this, mode = getMode(self, from);
  20552. var firstLine = self.getLine(from.line);
  20553. if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
  20554. var commentString = options.lineComment || mode.lineComment;
  20555. if (!commentString) {
  20556. if (options.blockCommentStart || mode.blockCommentStart) {
  20557. options.fullLines = true;
  20558. self.blockComment(from, to, options);
  20559. }
  20560. return;
  20561. }
  20562. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
  20563. var pad = options.padding == null ? " " : options.padding;
  20564. var blankLines = options.commentBlankLines || from.line == to.line;
  20565. self.operation(function() {
  20566. if (options.indent) {
  20567. var baseString = null;
  20568. for (var i = from.line; i < end; ++i) {
  20569. var line = self.getLine(i);
  20570. var whitespace = line.slice(0, firstNonWS(line));
  20571. if (baseString == null || baseString.length > whitespace.length) {
  20572. baseString = whitespace;
  20573. }
  20574. }
  20575. for (var i = from.line; i < end; ++i) {
  20576. var line = self.getLine(i), cut = baseString.length;
  20577. if (!blankLines && !nonWS.test(line)) continue;
  20578. if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
  20579. self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
  20580. }
  20581. } else {
  20582. for (var i = from.line; i < end; ++i) {
  20583. if (blankLines || nonWS.test(self.getLine(i)))
  20584. self.replaceRange(commentString + pad, Pos(i, 0));
  20585. }
  20586. }
  20587. });
  20588. });
  20589. CodeMirror.defineExtension("blockComment", function(from, to, options) {
  20590. if (!options) options = noOptions;
  20591. var self = this, mode = getMode(self, from);
  20592. var startString = options.blockCommentStart || mode.blockCommentStart;
  20593. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  20594. if (!startString || !endString) {
  20595. if ((options.lineComment || mode.lineComment) && options.fullLines != false)
  20596. self.lineComment(from, to, options);
  20597. return;
  20598. }
  20599. if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
  20600. var end = Math.min(to.line, self.lastLine());
  20601. if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
  20602. var pad = options.padding == null ? " " : options.padding;
  20603. if (from.line > end) return;
  20604. self.operation(function() {
  20605. if (options.fullLines != false) {
  20606. var lastLineHasText = nonWS.test(self.getLine(end));
  20607. self.replaceRange(pad + endString, Pos(end));
  20608. self.replaceRange(startString + pad, Pos(from.line, 0));
  20609. var lead = options.blockCommentLead || mode.blockCommentLead;
  20610. if (lead != null) for (var i = from.line + 1; i <= end; ++i)
  20611. if (i != end || lastLineHasText)
  20612. self.replaceRange(lead + pad, Pos(i, 0));
  20613. } else {
  20614. self.replaceRange(endString, to);
  20615. self.replaceRange(startString, from);
  20616. }
  20617. });
  20618. });
  20619. CodeMirror.defineExtension("uncomment", function(from, to, options) {
  20620. if (!options) options = noOptions;
  20621. var self = this, mode = getMode(self, from);
  20622. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
  20623. // Try finding line comments
  20624. var lineString = options.lineComment || mode.lineComment, lines = [];
  20625. var pad = options.padding == null ? " " : options.padding, didSomething;
  20626. lineComment: {
  20627. if (!lineString) break lineComment;
  20628. for (var i = start; i <= end; ++i) {
  20629. var line = self.getLine(i);
  20630. var found = line.indexOf(lineString);
  20631. if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
  20632. if (found == -1 && nonWS.test(line)) break lineComment;
  20633. if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
  20634. lines.push(line);
  20635. }
  20636. self.operation(function() {
  20637. for (var i = start; i <= end; ++i) {
  20638. var line = lines[i - start];
  20639. var pos = line.indexOf(lineString), endPos = pos + lineString.length;
  20640. if (pos < 0) continue;
  20641. if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
  20642. didSomething = true;
  20643. self.replaceRange("", Pos(i, pos), Pos(i, endPos));
  20644. }
  20645. });
  20646. if (didSomething) return true;
  20647. }
  20648. // Try block comments
  20649. var startString = options.blockCommentStart || mode.blockCommentStart;
  20650. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  20651. if (!startString || !endString) return false;
  20652. var lead = options.blockCommentLead || mode.blockCommentLead;
  20653. var startLine = self.getLine(start), open = startLine.indexOf(startString)
  20654. if (open == -1) return false
  20655. var endLine = end == start ? startLine : self.getLine(end)
  20656. var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
  20657. if (close == -1 && start != end) {
  20658. endLine = self.getLine(--end);
  20659. close = endLine.indexOf(endString);
  20660. }
  20661. var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
  20662. if (close == -1 ||
  20663. !/comment/.test(self.getTokenTypeAt(insideStart)) ||
  20664. !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
  20665. self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
  20666. return false;
  20667. // Avoid killing block comments completely outside the selection.
  20668. // Positions of the last startString before the start of the selection, and the first endString after it.
  20669. var lastStart = startLine.lastIndexOf(startString, from.ch);
  20670. var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
  20671. if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
  20672. // Positions of the first endString after the end of the selection, and the last startString before it.
  20673. firstEnd = endLine.indexOf(endString, to.ch);
  20674. var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
  20675. lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
  20676. if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
  20677. self.operation(function() {
  20678. self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
  20679. Pos(end, close + endString.length));
  20680. var openEnd = open + startString.length;
  20681. if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
  20682. self.replaceRange("", Pos(start, open), Pos(start, openEnd));
  20683. if (lead) for (var i = start + 1; i <= end; ++i) {
  20684. var line = self.getLine(i), found = line.indexOf(lead);
  20685. if (found == -1 || nonWS.test(line.slice(0, found))) continue;
  20686. var foundEnd = found + lead.length;
  20687. if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
  20688. self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
  20689. }
  20690. });
  20691. return true;
  20692. });
  20693. });
  20694. /***/ }),
  20695. /* 122 */
  20696. /***/ (function(module, exports, __webpack_require__) {
  20697. exports = module.exports = __webpack_require__(6)();
  20698. // imports
  20699. // module
  20700. 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", ""]);
  20701. // exports
  20702. /***/ }),
  20703. /* 123 */
  20704. /***/ (function(module, exports, __webpack_require__) {
  20705. exports = module.exports = __webpack_require__(6)();
  20706. // imports
  20707. // module
  20708. 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", ""]);
  20709. // exports
  20710. /***/ }),
  20711. /* 124 */
  20712. /***/ (function(module, exports, __webpack_require__) {
  20713. exports = module.exports = __webpack_require__(6)();
  20714. // imports
  20715. // module
  20716. 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", ""]);
  20717. // exports
  20718. /***/ }),
  20719. /* 125 */
  20720. /***/ (function(module, exports, __webpack_require__) {
  20721. exports = module.exports = __webpack_require__(6)();
  20722. // imports
  20723. // module
  20724. 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", ""]);
  20725. // exports
  20726. /***/ }),
  20727. /* 126 */
  20728. /***/ (function(module, exports, __webpack_require__) {
  20729. exports = module.exports = __webpack_require__(6)();
  20730. // imports
  20731. // module
  20732. 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 5px;\n cursor: pointer;\n width: 20px;\n height: 20px;\n overflow: hidden;\n text-align: center;\n line-height: 20px;\n vertical-align: middle;\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", ""]);
  20733. // exports
  20734. /***/ }),
  20735. /* 127 */
  20736. /***/ (function(module, exports, __webpack_require__) {
  20737. exports = module.exports = __webpack_require__(6)();
  20738. // imports
  20739. // module
  20740. 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", ""]);
  20741. // exports
  20742. /***/ }),
  20743. /* 128 */
  20744. /***/ (function(module, exports, __webpack_require__) {
  20745. exports = module.exports = __webpack_require__(6)();
  20746. // imports
  20747. // module
  20748. 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", ""]);
  20749. // exports
  20750. /***/ }),
  20751. /* 129 */
  20752. /***/ (function(module, exports, __webpack_require__) {
  20753. exports = module.exports = __webpack_require__(6)();
  20754. // imports
  20755. // module
  20756. exports.push([module.i, ".frame textarea {\n width: 300px;\n height: 80px;\n padding: 2px 4px;\n outline: none;\n border: solid 1px #ccc;\n}\n.frame .current-version {\n float: right;\n margin-top: -60px;\n color: #999;\n}\n.frame .current-version a {\n color: #999;\n}\n.frame .current-version a:hover {\n color: #000;\n}\n.frame .current-version.update-found:after {\n content: '';\n display: block;\n float: right;\n width: 6px;\n height: 6px;\n background: #f00;\n border-radius: 3px;\n}\n", ""]);
  20757. // exports
  20758. /***/ }),
  20759. /* 130 */
  20760. /***/ (function(module, exports, __webpack_require__) {
  20761. exports = module.exports = __webpack_require__(6)();
  20762. // imports
  20763. // module
  20764. 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.frame .prompt {\n width: 480px;\n}\n", ""]);
  20765. // exports
  20766. /***/ }),
  20767. /* 131 */
  20768. /***/ (function(module, exports, __webpack_require__) {
  20769. exports = module.exports = __webpack_require__(6)();
  20770. // imports
  20771. // module
  20772. 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", ""]);
  20773. // exports
  20774. /***/ }),
  20775. /* 132 */
  20776. /***/ (function(module, exports, __webpack_require__) {
  20777. exports = module.exports = __webpack_require__(6)();
  20778. // imports
  20779. // module
  20780. exports.push([module.i, "#sh-list .list-item {\n position: relative;\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 13px;\n}\n#sh-list .list-item.sys-hosts i {\n width: 22px;\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: inline-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 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 display: none;\n}\n#sh-list .list-item .item-buttons {\n position: absolute;\n right: 10px;\n}\n", ""]);
  20781. // exports
  20782. /***/ }),
  20783. /* 133 */
  20784. /***/ (function(module, exports, __webpack_require__) {
  20785. exports = module.exports = __webpack_require__(6)();
  20786. // imports
  20787. // module
  20788. 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#sh-list .hidden {\n display: none;\n}\n", ""]);
  20789. // exports
  20790. /***/ }),
  20791. /* 134 */
  20792. /***/ (function(module, exports, __webpack_require__) {
  20793. exports = module.exports = __webpack_require__(6)();
  20794. // imports
  20795. exports.i(__webpack_require__(136), "");
  20796. // module
  20797. exports.push([module.i, "#panel {\n width: 240px;\n height: 100%;\n background: #373d47;\n color: #979da7;\n}\n", ""]);
  20798. // exports
  20799. /***/ }),
  20800. /* 135 */
  20801. /***/ (function(module, exports, __webpack_require__) {
  20802. exports = module.exports = __webpack_require__(6)();
  20803. // imports
  20804. // module
  20805. 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", ""]);
  20806. // exports
  20807. /***/ }),
  20808. /* 136 */
  20809. /***/ (function(module, exports, __webpack_require__) {
  20810. exports = module.exports = __webpack_require__(6)();
  20811. // imports
  20812. // module
  20813. exports.push([module.i, "\n@font-face {font-family: \"iconfont\";\n src: url(" + __webpack_require__(101) + "); /* IE9*/\n src: url(" + __webpack_require__(101) + "#iefix) format('embedded-opentype'), \n url(" + __webpack_require__(241) + ") format('woff'), \n url(" + __webpack_require__(240) + ") format('truetype'), \n url(" + __webpack_require__(239) + "#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-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-refresh:before { content: \"\\E63A\"; }\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", ""]);
  20814. // exports
  20815. /***/ }),
  20816. /* 137 */
  20817. /***/ (function(module, exports, __webpack_require__) {
  20818. "use strict";
  20819. /**
  20820. * Copyright (c) 2013-present, Facebook, Inc.
  20821. * All rights reserved.
  20822. *
  20823. * This source code is licensed under the BSD-style license found in the
  20824. * LICENSE file in the root directory of this source tree. An additional grant
  20825. * of patent rights can be found in the PATENTS file in the same directory.
  20826. *
  20827. * @typechecks
  20828. */
  20829. var _hyphenPattern = /-(.)/g;
  20830. /**
  20831. * Camelcases a hyphenated string, for example:
  20832. *
  20833. * > camelize('background-color')
  20834. * < "backgroundColor"
  20835. *
  20836. * @param {string} string
  20837. * @return {string}
  20838. */
  20839. function camelize(string) {
  20840. return string.replace(_hyphenPattern, function (_, character) {
  20841. return character.toUpperCase();
  20842. });
  20843. }
  20844. module.exports = camelize;
  20845. /***/ }),
  20846. /* 138 */
  20847. /***/ (function(module, exports, __webpack_require__) {
  20848. "use strict";
  20849. /**
  20850. * Copyright (c) 2013-present, Facebook, Inc.
  20851. * All rights reserved.
  20852. *
  20853. * This source code is licensed under the BSD-style license found in the
  20854. * LICENSE file in the root directory of this source tree. An additional grant
  20855. * of patent rights can be found in the PATENTS file in the same directory.
  20856. *
  20857. * @typechecks
  20858. */
  20859. var camelize = __webpack_require__(137);
  20860. var msPattern = /^-ms-/;
  20861. /**
  20862. * Camelcases a hyphenated CSS property name, for example:
  20863. *
  20864. * > camelizeStyleName('background-color')
  20865. * < "backgroundColor"
  20866. * > camelizeStyleName('-moz-transition')
  20867. * < "MozTransition"
  20868. * > camelizeStyleName('-ms-transition')
  20869. * < "msTransition"
  20870. *
  20871. * As Andi Smith suggests
  20872. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  20873. * is converted to lowercase `ms`.
  20874. *
  20875. * @param {string} string
  20876. * @return {string}
  20877. */
  20878. function camelizeStyleName(string) {
  20879. return camelize(string.replace(msPattern, 'ms-'));
  20880. }
  20881. module.exports = camelizeStyleName;
  20882. /***/ }),
  20883. /* 139 */
  20884. /***/ (function(module, exports, __webpack_require__) {
  20885. "use strict";
  20886. /**
  20887. * Copyright (c) 2013-present, Facebook, Inc.
  20888. * All rights reserved.
  20889. *
  20890. * This source code is licensed under the BSD-style license found in the
  20891. * LICENSE file in the root directory of this source tree. An additional grant
  20892. * of patent rights can be found in the PATENTS file in the same directory.
  20893. *
  20894. *
  20895. */
  20896. var isTextNode = __webpack_require__(147);
  20897. /*eslint-disable no-bitwise */
  20898. /**
  20899. * Checks if a given DOM node contains or is another DOM node.
  20900. */
  20901. function containsNode(outerNode, innerNode) {
  20902. if (!outerNode || !innerNode) {
  20903. return false;
  20904. } else if (outerNode === innerNode) {
  20905. return true;
  20906. } else if (isTextNode(outerNode)) {
  20907. return false;
  20908. } else if (isTextNode(innerNode)) {
  20909. return containsNode(outerNode, innerNode.parentNode);
  20910. } else if ('contains' in outerNode) {
  20911. return outerNode.contains(innerNode);
  20912. } else if (outerNode.compareDocumentPosition) {
  20913. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  20914. } else {
  20915. return false;
  20916. }
  20917. }
  20918. module.exports = containsNode;
  20919. /***/ }),
  20920. /* 140 */
  20921. /***/ (function(module, exports, __webpack_require__) {
  20922. "use strict";
  20923. /**
  20924. * Copyright (c) 2013-present, Facebook, Inc.
  20925. * All rights reserved.
  20926. *
  20927. * This source code is licensed under the BSD-style license found in the
  20928. * LICENSE file in the root directory of this source tree. An additional grant
  20929. * of patent rights can be found in the PATENTS file in the same directory.
  20930. *
  20931. * @typechecks
  20932. */
  20933. var invariant = __webpack_require__(0);
  20934. /**
  20935. * Convert array-like objects to arrays.
  20936. *
  20937. * This API assumes the caller knows the contents of the data type. For less
  20938. * well defined inputs use createArrayFromMixed.
  20939. *
  20940. * @param {object|function|filelist} obj
  20941. * @return {array}
  20942. */
  20943. function toArray(obj) {
  20944. var length = obj.length;
  20945. // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
  20946. // in old versions of Safari).
  20947. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? false ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
  20948. !(typeof length === 'number') ? false ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
  20949. !(length === 0 || length - 1 in obj) ? false ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
  20950. !(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;
  20951. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  20952. // without method will throw during the slice call and skip straight to the
  20953. // fallback.
  20954. if (obj.hasOwnProperty) {
  20955. try {
  20956. return Array.prototype.slice.call(obj);
  20957. } catch (e) {
  20958. // IE < 9 does not support Array#slice on collections objects
  20959. }
  20960. }
  20961. // Fall back to copying key by key. This assumes all keys have a value,
  20962. // so will not preserve sparsely populated inputs.
  20963. var ret = Array(length);
  20964. for (var ii = 0; ii < length; ii++) {
  20965. ret[ii] = obj[ii];
  20966. }
  20967. return ret;
  20968. }
  20969. /**
  20970. * Perform a heuristic test to determine if an object is "array-like".
  20971. *
  20972. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  20973. * Joshu replied: "Mu."
  20974. *
  20975. * This function determines if its argument has "array nature": it returns
  20976. * true if the argument is an actual array, an `arguments' object, or an
  20977. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  20978. *
  20979. * It will return false for other array-like objects like Filelist.
  20980. *
  20981. * @param {*} obj
  20982. * @return {boolean}
  20983. */
  20984. function hasArrayNature(obj) {
  20985. return (
  20986. // not null/false
  20987. !!obj && (
  20988. // arrays are objects, NodeLists are functions in Safari
  20989. typeof obj == 'object' || typeof obj == 'function') &&
  20990. // quacks like an array
  20991. 'length' in obj &&
  20992. // not window
  20993. !('setInterval' in obj) &&
  20994. // no DOM node should be considered an array-like
  20995. // a 'select' element has 'length' and 'item' properties on IE8
  20996. typeof obj.nodeType != 'number' && (
  20997. // a real array
  20998. Array.isArray(obj) ||
  20999. // arguments
  21000. 'callee' in obj ||
  21001. // HTMLCollection/NodeList
  21002. 'item' in obj)
  21003. );
  21004. }
  21005. /**
  21006. * Ensure that the argument is an array by wrapping it in an array if it is not.
  21007. * Creates a copy of the argument if it is already an array.
  21008. *
  21009. * This is mostly useful idiomatically:
  21010. *
  21011. * var createArrayFromMixed = require('createArrayFromMixed');
  21012. *
  21013. * function takesOneOrMoreThings(things) {
  21014. * things = createArrayFromMixed(things);
  21015. * ...
  21016. * }
  21017. *
  21018. * This allows you to treat `things' as an array, but accept scalars in the API.
  21019. *
  21020. * If you need to convert an array-like object, like `arguments`, into an array
  21021. * use toArray instead.
  21022. *
  21023. * @param {*} obj
  21024. * @return {array}
  21025. */
  21026. function createArrayFromMixed(obj) {
  21027. if (!hasArrayNature(obj)) {
  21028. return [obj];
  21029. } else if (Array.isArray(obj)) {
  21030. return obj.slice();
  21031. } else {
  21032. return toArray(obj);
  21033. }
  21034. }
  21035. module.exports = createArrayFromMixed;
  21036. /***/ }),
  21037. /* 141 */
  21038. /***/ (function(module, exports, __webpack_require__) {
  21039. "use strict";
  21040. /**
  21041. * Copyright (c) 2013-present, Facebook, Inc.
  21042. * All rights reserved.
  21043. *
  21044. * This source code is licensed under the BSD-style license found in the
  21045. * LICENSE file in the root directory of this source tree. An additional grant
  21046. * of patent rights can be found in the PATENTS file in the same directory.
  21047. *
  21048. * @typechecks
  21049. */
  21050. /*eslint-disable fb-www/unsafe-html*/
  21051. var ExecutionEnvironment = __webpack_require__(8);
  21052. var createArrayFromMixed = __webpack_require__(140);
  21053. var getMarkupWrap = __webpack_require__(142);
  21054. var invariant = __webpack_require__(0);
  21055. /**
  21056. * Dummy container used to render all markup.
  21057. */
  21058. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21059. /**
  21060. * Pattern used by `getNodeName`.
  21061. */
  21062. var nodeNamePattern = /^\s*<(\w+)/;
  21063. /**
  21064. * Extracts the `nodeName` of the first element in a string of markup.
  21065. *
  21066. * @param {string} markup String of markup.
  21067. * @return {?string} Node name of the supplied markup.
  21068. */
  21069. function getNodeName(markup) {
  21070. var nodeNameMatch = markup.match(nodeNamePattern);
  21071. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  21072. }
  21073. /**
  21074. * Creates an array containing the nodes rendered from the supplied markup. The
  21075. * optionally supplied `handleScript` function will be invoked once for each
  21076. * <script> element that is rendered. If no `handleScript` function is supplied,
  21077. * an exception is thrown if any <script> elements are rendered.
  21078. *
  21079. * @param {string} markup A string of valid HTML markup.
  21080. * @param {?function} handleScript Invoked once for each rendered <script>.
  21081. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  21082. */
  21083. function createNodesFromMarkup(markup, handleScript) {
  21084. var node = dummyNode;
  21085. !!!dummyNode ? false ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
  21086. var nodeName = getNodeName(markup);
  21087. var wrap = nodeName && getMarkupWrap(nodeName);
  21088. if (wrap) {
  21089. node.innerHTML = wrap[1] + markup + wrap[2];
  21090. var wrapDepth = wrap[0];
  21091. while (wrapDepth--) {
  21092. node = node.lastChild;
  21093. }
  21094. } else {
  21095. node.innerHTML = markup;
  21096. }
  21097. var scripts = node.getElementsByTagName('script');
  21098. if (scripts.length) {
  21099. !handleScript ? false ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
  21100. createArrayFromMixed(scripts).forEach(handleScript);
  21101. }
  21102. var nodes = Array.from(node.childNodes);
  21103. while (node.lastChild) {
  21104. node.removeChild(node.lastChild);
  21105. }
  21106. return nodes;
  21107. }
  21108. module.exports = createNodesFromMarkup;
  21109. /***/ }),
  21110. /* 142 */
  21111. /***/ (function(module, exports, __webpack_require__) {
  21112. "use strict";
  21113. /**
  21114. * Copyright (c) 2013-present, Facebook, Inc.
  21115. * All rights reserved.
  21116. *
  21117. * This source code is licensed under the BSD-style license found in the
  21118. * LICENSE file in the root directory of this source tree. An additional grant
  21119. * of patent rights can be found in the PATENTS file in the same directory.
  21120. *
  21121. */
  21122. /*eslint-disable fb-www/unsafe-html */
  21123. var ExecutionEnvironment = __webpack_require__(8);
  21124. var invariant = __webpack_require__(0);
  21125. /**
  21126. * Dummy container used to detect which wraps are necessary.
  21127. */
  21128. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21129. /**
  21130. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  21131. * so we wrap them, render the wrapped nodes, then extract the desired node.
  21132. *
  21133. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  21134. */
  21135. var shouldWrap = {};
  21136. var selectWrap = [1, '<select multiple="true">', '</select>'];
  21137. var tableWrap = [1, '<table>', '</table>'];
  21138. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  21139. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  21140. var markupWrap = {
  21141. '*': [1, '?<div>', '</div>'],
  21142. 'area': [1, '<map>', '</map>'],
  21143. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  21144. 'legend': [1, '<fieldset>', '</fieldset>'],
  21145. 'param': [1, '<object>', '</object>'],
  21146. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  21147. 'optgroup': selectWrap,
  21148. 'option': selectWrap,
  21149. 'caption': tableWrap,
  21150. 'colgroup': tableWrap,
  21151. 'tbody': tableWrap,
  21152. 'tfoot': tableWrap,
  21153. 'thead': tableWrap,
  21154. 'td': trWrap,
  21155. 'th': trWrap
  21156. };
  21157. // Initialize the SVG elements since we know they'll always need to be wrapped
  21158. // consistently. If they are created inside a <div> they will be initialized in
  21159. // the wrong namespace (and will not display).
  21160. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  21161. svgElements.forEach(function (nodeName) {
  21162. markupWrap[nodeName] = svgWrap;
  21163. shouldWrap[nodeName] = true;
  21164. });
  21165. /**
  21166. * Gets the markup wrap configuration for the supplied `nodeName`.
  21167. *
  21168. * NOTE: This lazily detects which wraps are necessary for the current browser.
  21169. *
  21170. * @param {string} nodeName Lowercase `nodeName`.
  21171. * @return {?array} Markup wrap configuration, if applicable.
  21172. */
  21173. function getMarkupWrap(nodeName) {
  21174. !!!dummyNode ? false ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
  21175. if (!markupWrap.hasOwnProperty(nodeName)) {
  21176. nodeName = '*';
  21177. }
  21178. if (!shouldWrap.hasOwnProperty(nodeName)) {
  21179. if (nodeName === '*') {
  21180. dummyNode.innerHTML = '<link />';
  21181. } else {
  21182. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  21183. }
  21184. shouldWrap[nodeName] = !dummyNode.firstChild;
  21185. }
  21186. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  21187. }
  21188. module.exports = getMarkupWrap;
  21189. /***/ }),
  21190. /* 143 */
  21191. /***/ (function(module, exports, __webpack_require__) {
  21192. "use strict";
  21193. /**
  21194. * Copyright (c) 2013-present, Facebook, Inc.
  21195. * All rights reserved.
  21196. *
  21197. * This source code is licensed under the BSD-style license found in the
  21198. * LICENSE file in the root directory of this source tree. An additional grant
  21199. * of patent rights can be found in the PATENTS file in the same directory.
  21200. *
  21201. * @typechecks
  21202. */
  21203. /**
  21204. * Gets the scroll position of the supplied element or window.
  21205. *
  21206. * The return values are unbounded, unlike `getScrollPosition`. This means they
  21207. * may be negative or exceed the element boundaries (which is possible using
  21208. * inertial scrolling).
  21209. *
  21210. * @param {DOMWindow|DOMElement} scrollable
  21211. * @return {object} Map with `x` and `y` keys.
  21212. */
  21213. function getUnboundedScrollPosition(scrollable) {
  21214. if (scrollable.Window && scrollable instanceof scrollable.Window) {
  21215. return {
  21216. x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
  21217. y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
  21218. };
  21219. }
  21220. return {
  21221. x: scrollable.scrollLeft,
  21222. y: scrollable.scrollTop
  21223. };
  21224. }
  21225. module.exports = getUnboundedScrollPosition;
  21226. /***/ }),
  21227. /* 144 */
  21228. /***/ (function(module, exports, __webpack_require__) {
  21229. "use strict";
  21230. /**
  21231. * Copyright (c) 2013-present, Facebook, Inc.
  21232. * All rights reserved.
  21233. *
  21234. * This source code is licensed under the BSD-style license found in the
  21235. * LICENSE file in the root directory of this source tree. An additional grant
  21236. * of patent rights can be found in the PATENTS file in the same directory.
  21237. *
  21238. * @typechecks
  21239. */
  21240. var _uppercasePattern = /([A-Z])/g;
  21241. /**
  21242. * Hyphenates a camelcased string, for example:
  21243. *
  21244. * > hyphenate('backgroundColor')
  21245. * < "background-color"
  21246. *
  21247. * For CSS style names, use `hyphenateStyleName` instead which works properly
  21248. * with all vendor prefixes, including `ms`.
  21249. *
  21250. * @param {string} string
  21251. * @return {string}
  21252. */
  21253. function hyphenate(string) {
  21254. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  21255. }
  21256. module.exports = hyphenate;
  21257. /***/ }),
  21258. /* 145 */
  21259. /***/ (function(module, exports, __webpack_require__) {
  21260. "use strict";
  21261. /**
  21262. * Copyright (c) 2013-present, Facebook, Inc.
  21263. * All rights reserved.
  21264. *
  21265. * This source code is licensed under the BSD-style license found in the
  21266. * LICENSE file in the root directory of this source tree. An additional grant
  21267. * of patent rights can be found in the PATENTS file in the same directory.
  21268. *
  21269. * @typechecks
  21270. */
  21271. var hyphenate = __webpack_require__(144);
  21272. var msPattern = /^ms-/;
  21273. /**
  21274. * Hyphenates a camelcased CSS property name, for example:
  21275. *
  21276. * > hyphenateStyleName('backgroundColor')
  21277. * < "background-color"
  21278. * > hyphenateStyleName('MozTransition')
  21279. * < "-moz-transition"
  21280. * > hyphenateStyleName('msTransition')
  21281. * < "-ms-transition"
  21282. *
  21283. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  21284. * is converted to `-ms-`.
  21285. *
  21286. * @param {string} string
  21287. * @return {string}
  21288. */
  21289. function hyphenateStyleName(string) {
  21290. return hyphenate(string).replace(msPattern, '-ms-');
  21291. }
  21292. module.exports = hyphenateStyleName;
  21293. /***/ }),
  21294. /* 146 */
  21295. /***/ (function(module, exports, __webpack_require__) {
  21296. "use strict";
  21297. /**
  21298. * Copyright (c) 2013-present, Facebook, Inc.
  21299. * All rights reserved.
  21300. *
  21301. * This source code is licensed under the BSD-style license found in the
  21302. * LICENSE file in the root directory of this source tree. An additional grant
  21303. * of patent rights can be found in the PATENTS file in the same directory.
  21304. *
  21305. * @typechecks
  21306. */
  21307. /**
  21308. * @param {*} object The object to check.
  21309. * @return {boolean} Whether or not the object is a DOM node.
  21310. */
  21311. function isNode(object) {
  21312. var doc = object ? object.ownerDocument || object : document;
  21313. var defaultView = doc.defaultView || window;
  21314. return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  21315. }
  21316. module.exports = isNode;
  21317. /***/ }),
  21318. /* 147 */
  21319. /***/ (function(module, exports, __webpack_require__) {
  21320. "use strict";
  21321. /**
  21322. * Copyright (c) 2013-present, Facebook, Inc.
  21323. * All rights reserved.
  21324. *
  21325. * This source code is licensed under the BSD-style license found in the
  21326. * LICENSE file in the root directory of this source tree. An additional grant
  21327. * of patent rights can be found in the PATENTS file in the same directory.
  21328. *
  21329. * @typechecks
  21330. */
  21331. var isNode = __webpack_require__(146);
  21332. /**
  21333. * @param {*} object The object to check.
  21334. * @return {boolean} Whether or not the object is a DOM text node.
  21335. */
  21336. function isTextNode(object) {
  21337. return isNode(object) && object.nodeType == 3;
  21338. }
  21339. module.exports = isTextNode;
  21340. /***/ }),
  21341. /* 148 */
  21342. /***/ (function(module, exports, __webpack_require__) {
  21343. "use strict";
  21344. /**
  21345. * Copyright (c) 2013-present, Facebook, Inc.
  21346. * All rights reserved.
  21347. *
  21348. * This source code is licensed under the BSD-style license found in the
  21349. * LICENSE file in the root directory of this source tree. An additional grant
  21350. * of patent rights can be found in the PATENTS file in the same directory.
  21351. *
  21352. *
  21353. * @typechecks static-only
  21354. */
  21355. /**
  21356. * Memoizes the return value of a function that accepts one string argument.
  21357. */
  21358. function memoizeStringOnly(callback) {
  21359. var cache = {};
  21360. return function (string) {
  21361. if (!cache.hasOwnProperty(string)) {
  21362. cache[string] = callback.call(this, string);
  21363. }
  21364. return cache[string];
  21365. };
  21366. }
  21367. module.exports = memoizeStringOnly;
  21368. /***/ }),
  21369. /* 149 */
  21370. /***/ (function(module, exports, __webpack_require__) {
  21371. "use strict";
  21372. /**
  21373. * Copyright 2013-present, Facebook, Inc.
  21374. * All rights reserved.
  21375. *
  21376. * This source code is licensed under the BSD-style license found in the
  21377. * LICENSE file in the root directory of this source tree. An additional grant
  21378. * of patent rights can be found in the PATENTS file in the same directory.
  21379. *
  21380. */
  21381. var ARIADOMPropertyConfig = {
  21382. Properties: {
  21383. // Global States and Properties
  21384. 'aria-current': 0, // state
  21385. 'aria-details': 0,
  21386. 'aria-disabled': 0, // state
  21387. 'aria-hidden': 0, // state
  21388. 'aria-invalid': 0, // state
  21389. 'aria-keyshortcuts': 0,
  21390. 'aria-label': 0,
  21391. 'aria-roledescription': 0,
  21392. // Widget Attributes
  21393. 'aria-autocomplete': 0,
  21394. 'aria-checked': 0,
  21395. 'aria-expanded': 0,
  21396. 'aria-haspopup': 0,
  21397. 'aria-level': 0,
  21398. 'aria-modal': 0,
  21399. 'aria-multiline': 0,
  21400. 'aria-multiselectable': 0,
  21401. 'aria-orientation': 0,
  21402. 'aria-placeholder': 0,
  21403. 'aria-pressed': 0,
  21404. 'aria-readonly': 0,
  21405. 'aria-required': 0,
  21406. 'aria-selected': 0,
  21407. 'aria-sort': 0,
  21408. 'aria-valuemax': 0,
  21409. 'aria-valuemin': 0,
  21410. 'aria-valuenow': 0,
  21411. 'aria-valuetext': 0,
  21412. // Live Region Attributes
  21413. 'aria-atomic': 0,
  21414. 'aria-busy': 0,
  21415. 'aria-live': 0,
  21416. 'aria-relevant': 0,
  21417. // Drag-and-Drop Attributes
  21418. 'aria-dropeffect': 0,
  21419. 'aria-grabbed': 0,
  21420. // Relationship Attributes
  21421. 'aria-activedescendant': 0,
  21422. 'aria-colcount': 0,
  21423. 'aria-colindex': 0,
  21424. 'aria-colspan': 0,
  21425. 'aria-controls': 0,
  21426. 'aria-describedby': 0,
  21427. 'aria-errormessage': 0,
  21428. 'aria-flowto': 0,
  21429. 'aria-labelledby': 0,
  21430. 'aria-owns': 0,
  21431. 'aria-posinset': 0,
  21432. 'aria-rowcount': 0,
  21433. 'aria-rowindex': 0,
  21434. 'aria-rowspan': 0,
  21435. 'aria-setsize': 0
  21436. },
  21437. DOMAttributeNames: {},
  21438. DOMPropertyNames: {}
  21439. };
  21440. module.exports = ARIADOMPropertyConfig;
  21441. /***/ }),
  21442. /* 150 */
  21443. /***/ (function(module, exports, __webpack_require__) {
  21444. "use strict";
  21445. /**
  21446. * Copyright 2013-present, Facebook, Inc.
  21447. * All rights reserved.
  21448. *
  21449. * This source code is licensed under the BSD-style license found in the
  21450. * LICENSE file in the root directory of this source tree. An additional grant
  21451. * of patent rights can be found in the PATENTS file in the same directory.
  21452. *
  21453. */
  21454. var ReactDOMComponentTree = __webpack_require__(5);
  21455. var focusNode = __webpack_require__(72);
  21456. var AutoFocusUtils = {
  21457. focusDOMComponent: function () {
  21458. focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
  21459. }
  21460. };
  21461. module.exports = AutoFocusUtils;
  21462. /***/ }),
  21463. /* 151 */
  21464. /***/ (function(module, exports, __webpack_require__) {
  21465. "use strict";
  21466. /**
  21467. * Copyright 2013-present Facebook, Inc.
  21468. * All rights reserved.
  21469. *
  21470. * This source code is licensed under the BSD-style license found in the
  21471. * LICENSE file in the root directory of this source tree. An additional grant
  21472. * of patent rights can be found in the PATENTS file in the same directory.
  21473. *
  21474. */
  21475. var EventPropagators = __webpack_require__(27);
  21476. var ExecutionEnvironment = __webpack_require__(8);
  21477. var FallbackCompositionState = __webpack_require__(157);
  21478. var SyntheticCompositionEvent = __webpack_require__(194);
  21479. var SyntheticInputEvent = __webpack_require__(197);
  21480. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  21481. var START_KEYCODE = 229;
  21482. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  21483. var documentMode = null;
  21484. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  21485. documentMode = document.documentMode;
  21486. }
  21487. // Webkit offers a very useful `textInput` event that can be used to
  21488. // directly represent `beforeInput`. The IE `textinput` event is not as
  21489. // useful, so we don't use it.
  21490. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  21491. // In IE9+, we have access to composition events, but the data supplied
  21492. // by the native compositionend event may be incorrect. Japanese ideographic
  21493. // spaces, for instance (\u3000) are not recorded correctly.
  21494. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  21495. /**
  21496. * Opera <= 12 includes TextEvent in window, but does not fire
  21497. * text input events. Rely on keypress instead.
  21498. */
  21499. function isPresto() {
  21500. var opera = window.opera;
  21501. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  21502. }
  21503. var SPACEBAR_CODE = 32;
  21504. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  21505. // Events and their corresponding property names.
  21506. var eventTypes = {
  21507. beforeInput: {
  21508. phasedRegistrationNames: {
  21509. bubbled: 'onBeforeInput',
  21510. captured: 'onBeforeInputCapture'
  21511. },
  21512. dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
  21513. },
  21514. compositionEnd: {
  21515. phasedRegistrationNames: {
  21516. bubbled: 'onCompositionEnd',
  21517. captured: 'onCompositionEndCapture'
  21518. },
  21519. dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21520. },
  21521. compositionStart: {
  21522. phasedRegistrationNames: {
  21523. bubbled: 'onCompositionStart',
  21524. captured: 'onCompositionStartCapture'
  21525. },
  21526. dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21527. },
  21528. compositionUpdate: {
  21529. phasedRegistrationNames: {
  21530. bubbled: 'onCompositionUpdate',
  21531. captured: 'onCompositionUpdateCapture'
  21532. },
  21533. dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21534. }
  21535. };
  21536. // Track whether we've ever handled a keypress on the space key.
  21537. var hasSpaceKeypress = false;
  21538. /**
  21539. * Return whether a native keypress event is assumed to be a command.
  21540. * This is required because Firefox fires `keypress` events for key commands
  21541. * (cut, copy, select-all, etc.) even though no character is inserted.
  21542. */
  21543. function isKeypressCommand(nativeEvent) {
  21544. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  21545. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  21546. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  21547. }
  21548. /**
  21549. * Translate native top level events into event types.
  21550. *
  21551. * @param {string} topLevelType
  21552. * @return {object}
  21553. */
  21554. function getCompositionEventType(topLevelType) {
  21555. switch (topLevelType) {
  21556. case 'topCompositionStart':
  21557. return eventTypes.compositionStart;
  21558. case 'topCompositionEnd':
  21559. return eventTypes.compositionEnd;
  21560. case 'topCompositionUpdate':
  21561. return eventTypes.compositionUpdate;
  21562. }
  21563. }
  21564. /**
  21565. * Does our fallback best-guess model think this event signifies that
  21566. * composition has begun?
  21567. *
  21568. * @param {string} topLevelType
  21569. * @param {object} nativeEvent
  21570. * @return {boolean}
  21571. */
  21572. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  21573. return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
  21574. }
  21575. /**
  21576. * Does our fallback mode think that this event is the end of composition?
  21577. *
  21578. * @param {string} topLevelType
  21579. * @param {object} nativeEvent
  21580. * @return {boolean}
  21581. */
  21582. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  21583. switch (topLevelType) {
  21584. case 'topKeyUp':
  21585. // Command keys insert or clear IME input.
  21586. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  21587. case 'topKeyDown':
  21588. // Expect IME keyCode on each keydown. If we get any other
  21589. // code we must have exited earlier.
  21590. return nativeEvent.keyCode !== START_KEYCODE;
  21591. case 'topKeyPress':
  21592. case 'topMouseDown':
  21593. case 'topBlur':
  21594. // Events are not possible without cancelling IME.
  21595. return true;
  21596. default:
  21597. return false;
  21598. }
  21599. }
  21600. /**
  21601. * Google Input Tools provides composition data via a CustomEvent,
  21602. * with the `data` property populated in the `detail` object. If this
  21603. * is available on the event object, use it. If not, this is a plain
  21604. * composition event and we have nothing special to extract.
  21605. *
  21606. * @param {object} nativeEvent
  21607. * @return {?string}
  21608. */
  21609. function getDataFromCustomEvent(nativeEvent) {
  21610. var detail = nativeEvent.detail;
  21611. if (typeof detail === 'object' && 'data' in detail) {
  21612. return detail.data;
  21613. }
  21614. return null;
  21615. }
  21616. // Track the current IME composition fallback object, if any.
  21617. var currentComposition = null;
  21618. /**
  21619. * @return {?object} A SyntheticCompositionEvent.
  21620. */
  21621. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  21622. var eventType;
  21623. var fallbackData;
  21624. if (canUseCompositionEvent) {
  21625. eventType = getCompositionEventType(topLevelType);
  21626. } else if (!currentComposition) {
  21627. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  21628. eventType = eventTypes.compositionStart;
  21629. }
  21630. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  21631. eventType = eventTypes.compositionEnd;
  21632. }
  21633. if (!eventType) {
  21634. return null;
  21635. }
  21636. if (useFallbackCompositionData) {
  21637. // The current composition is stored statically and must not be
  21638. // overwritten while composition continues.
  21639. if (!currentComposition && eventType === eventTypes.compositionStart) {
  21640. currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
  21641. } else if (eventType === eventTypes.compositionEnd) {
  21642. if (currentComposition) {
  21643. fallbackData = currentComposition.getData();
  21644. }
  21645. }
  21646. }
  21647. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  21648. if (fallbackData) {
  21649. // Inject data generated from fallback path into the synthetic event.
  21650. // This matches the property of native CompositionEventInterface.
  21651. event.data = fallbackData;
  21652. } else {
  21653. var customData = getDataFromCustomEvent(nativeEvent);
  21654. if (customData !== null) {
  21655. event.data = customData;
  21656. }
  21657. }
  21658. EventPropagators.accumulateTwoPhaseDispatches(event);
  21659. return event;
  21660. }
  21661. /**
  21662. * @param {string} topLevelType Record from `EventConstants`.
  21663. * @param {object} nativeEvent Native browser event.
  21664. * @return {?string} The string corresponding to this `beforeInput` event.
  21665. */
  21666. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  21667. switch (topLevelType) {
  21668. case 'topCompositionEnd':
  21669. return getDataFromCustomEvent(nativeEvent);
  21670. case 'topKeyPress':
  21671. /**
  21672. * If native `textInput` events are available, our goal is to make
  21673. * use of them. However, there is a special case: the spacebar key.
  21674. * In Webkit, preventing default on a spacebar `textInput` event
  21675. * cancels character insertion, but it *also* causes the browser
  21676. * to fall back to its default spacebar behavior of scrolling the
  21677. * page.
  21678. *
  21679. * Tracking at:
  21680. * https://code.google.com/p/chromium/issues/detail?id=355103
  21681. *
  21682. * To avoid this issue, use the keypress event as if no `textInput`
  21683. * event is available.
  21684. */
  21685. var which = nativeEvent.which;
  21686. if (which !== SPACEBAR_CODE) {
  21687. return null;
  21688. }
  21689. hasSpaceKeypress = true;
  21690. return SPACEBAR_CHAR;
  21691. case 'topTextInput':
  21692. // Record the characters to be added to the DOM.
  21693. var chars = nativeEvent.data;
  21694. // If it's a spacebar character, assume that we have already handled
  21695. // it at the keypress level and bail immediately. Android Chrome
  21696. // doesn't give us keycodes, so we need to blacklist it.
  21697. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  21698. return null;
  21699. }
  21700. return chars;
  21701. default:
  21702. // For other native event types, do nothing.
  21703. return null;
  21704. }
  21705. }
  21706. /**
  21707. * For browsers that do not provide the `textInput` event, extract the
  21708. * appropriate string to use for SyntheticInputEvent.
  21709. *
  21710. * @param {string} topLevelType Record from `EventConstants`.
  21711. * @param {object} nativeEvent Native browser event.
  21712. * @return {?string} The fallback string for this `beforeInput` event.
  21713. */
  21714. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  21715. // If we are currently composing (IME) and using a fallback to do so,
  21716. // try to extract the composed characters from the fallback object.
  21717. // If composition event is available, we extract a string only at
  21718. // compositionevent, otherwise extract it at fallback events.
  21719. if (currentComposition) {
  21720. if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  21721. var chars = currentComposition.getData();
  21722. FallbackCompositionState.release(currentComposition);
  21723. currentComposition = null;
  21724. return chars;
  21725. }
  21726. return null;
  21727. }
  21728. switch (topLevelType) {
  21729. case 'topPaste':
  21730. // If a paste event occurs after a keypress, throw out the input
  21731. // chars. Paste events should not lead to BeforeInput events.
  21732. return null;
  21733. case 'topKeyPress':
  21734. /**
  21735. * As of v27, Firefox may fire keypress events even when no character
  21736. * will be inserted. A few possibilities:
  21737. *
  21738. * - `which` is `0`. Arrow keys, Esc key, etc.
  21739. *
  21740. * - `which` is the pressed key code, but no char is available.
  21741. * Ex: 'AltGr + d` in Polish. There is no modified character for
  21742. * this key combination and no character is inserted into the
  21743. * document, but FF fires the keypress for char code `100` anyway.
  21744. * No `input` event will occur.
  21745. *
  21746. * - `which` is the pressed key code, but a command combination is
  21747. * being used. Ex: `Cmd+C`. No character is inserted, and no
  21748. * `input` event will occur.
  21749. */
  21750. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  21751. return String.fromCharCode(nativeEvent.which);
  21752. }
  21753. return null;
  21754. case 'topCompositionEnd':
  21755. return useFallbackCompositionData ? null : nativeEvent.data;
  21756. default:
  21757. return null;
  21758. }
  21759. }
  21760. /**
  21761. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  21762. * `textInput` or fallback behavior.
  21763. *
  21764. * @return {?object} A SyntheticInputEvent.
  21765. */
  21766. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  21767. var chars;
  21768. if (canUseTextInputEvent) {
  21769. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  21770. } else {
  21771. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  21772. }
  21773. // If no characters are being inserted, no BeforeInput event should
  21774. // be fired.
  21775. if (!chars) {
  21776. return null;
  21777. }
  21778. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  21779. event.data = chars;
  21780. EventPropagators.accumulateTwoPhaseDispatches(event);
  21781. return event;
  21782. }
  21783. /**
  21784. * Create an `onBeforeInput` event to match
  21785. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  21786. *
  21787. * This event plugin is based on the native `textInput` event
  21788. * available in Chrome, Safari, Opera, and IE. This event fires after
  21789. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  21790. *
  21791. * `beforeInput` is spec'd but not implemented in any browsers, and
  21792. * the `input` event does not provide any useful information about what has
  21793. * actually been added, contrary to the spec. Thus, `textInput` is the best
  21794. * available event to identify the characters that have actually been inserted
  21795. * into the target node.
  21796. *
  21797. * This plugin is also responsible for emitting `composition` events, thus
  21798. * allowing us to share composition fallback code for both `beforeInput` and
  21799. * `composition` event types.
  21800. */
  21801. var BeforeInputEventPlugin = {
  21802. eventTypes: eventTypes,
  21803. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  21804. return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
  21805. }
  21806. };
  21807. module.exports = BeforeInputEventPlugin;
  21808. /***/ }),
  21809. /* 152 */
  21810. /***/ (function(module, exports, __webpack_require__) {
  21811. "use strict";
  21812. /**
  21813. * Copyright 2013-present, Facebook, Inc.
  21814. * All rights reserved.
  21815. *
  21816. * This source code is licensed under the BSD-style license found in the
  21817. * LICENSE file in the root directory of this source tree. An additional grant
  21818. * of patent rights can be found in the PATENTS file in the same directory.
  21819. *
  21820. */
  21821. var CSSProperty = __webpack_require__(75);
  21822. var ExecutionEnvironment = __webpack_require__(8);
  21823. var ReactInstrumentation = __webpack_require__(11);
  21824. var camelizeStyleName = __webpack_require__(138);
  21825. var dangerousStyleValue = __webpack_require__(203);
  21826. var hyphenateStyleName = __webpack_require__(145);
  21827. var memoizeStringOnly = __webpack_require__(148);
  21828. var warning = __webpack_require__(1);
  21829. var processStyleName = memoizeStringOnly(function (styleName) {
  21830. return hyphenateStyleName(styleName);
  21831. });
  21832. var hasShorthandPropertyBug = false;
  21833. var styleFloatAccessor = 'cssFloat';
  21834. if (ExecutionEnvironment.canUseDOM) {
  21835. var tempStyle = document.createElement('div').style;
  21836. try {
  21837. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  21838. tempStyle.font = '';
  21839. } catch (e) {
  21840. hasShorthandPropertyBug = true;
  21841. }
  21842. // IE8 only supports accessing cssFloat (standard) as styleFloat
  21843. if (document.documentElement.style.cssFloat === undefined) {
  21844. styleFloatAccessor = 'styleFloat';
  21845. }
  21846. }
  21847. if (false) {
  21848. // 'msTransform' is correct, but the other prefixes should be capitalized
  21849. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  21850. // style values shouldn't contain a semicolon
  21851. var badStyleValueWithSemicolonPattern = /;\s*$/;
  21852. var warnedStyleNames = {};
  21853. var warnedStyleValues = {};
  21854. var warnedForNaNValue = false;
  21855. var warnHyphenatedStyleName = function (name, owner) {
  21856. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  21857. return;
  21858. }
  21859. warnedStyleNames[name] = true;
  21860. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
  21861. };
  21862. var warnBadVendoredStyleName = function (name, owner) {
  21863. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  21864. return;
  21865. }
  21866. warnedStyleNames[name] = true;
  21867. 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;
  21868. };
  21869. var warnStyleValueWithSemicolon = function (name, value, owner) {
  21870. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  21871. return;
  21872. }
  21873. warnedStyleValues[value] = true;
  21874. 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;
  21875. };
  21876. var warnStyleValueIsNaN = function (name, value, owner) {
  21877. if (warnedForNaNValue) {
  21878. return;
  21879. }
  21880. warnedForNaNValue = true;
  21881. process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
  21882. };
  21883. var checkRenderMessage = function (owner) {
  21884. if (owner) {
  21885. var name = owner.getName();
  21886. if (name) {
  21887. return ' Check the render method of `' + name + '`.';
  21888. }
  21889. }
  21890. return '';
  21891. };
  21892. /**
  21893. * @param {string} name
  21894. * @param {*} value
  21895. * @param {ReactDOMComponent} component
  21896. */
  21897. var warnValidStyle = function (name, value, component) {
  21898. var owner;
  21899. if (component) {
  21900. owner = component._currentElement._owner;
  21901. }
  21902. if (name.indexOf('-') > -1) {
  21903. warnHyphenatedStyleName(name, owner);
  21904. } else if (badVendoredStyleNamePattern.test(name)) {
  21905. warnBadVendoredStyleName(name, owner);
  21906. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  21907. warnStyleValueWithSemicolon(name, value, owner);
  21908. }
  21909. if (typeof value === 'number' && isNaN(value)) {
  21910. warnStyleValueIsNaN(name, value, owner);
  21911. }
  21912. };
  21913. }
  21914. /**
  21915. * Operations for dealing with CSS properties.
  21916. */
  21917. var CSSPropertyOperations = {
  21918. /**
  21919. * Serializes a mapping of style properties for use as inline styles:
  21920. *
  21921. * > createMarkupForStyles({width: '200px', height: 0})
  21922. * "width:200px;height:0;"
  21923. *
  21924. * Undefined values are ignored so that declarative programming is easier.
  21925. * The result should be HTML-escaped before insertion into the DOM.
  21926. *
  21927. * @param {object} styles
  21928. * @param {ReactDOMComponent} component
  21929. * @return {?string}
  21930. */
  21931. createMarkupForStyles: function (styles, component) {
  21932. var serialized = '';
  21933. for (var styleName in styles) {
  21934. if (!styles.hasOwnProperty(styleName)) {
  21935. continue;
  21936. }
  21937. var styleValue = styles[styleName];
  21938. if (false) {
  21939. warnValidStyle(styleName, styleValue, component);
  21940. }
  21941. if (styleValue != null) {
  21942. serialized += processStyleName(styleName) + ':';
  21943. serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
  21944. }
  21945. }
  21946. return serialized || null;
  21947. },
  21948. /**
  21949. * Sets the value for multiple styles on a node. If a value is specified as
  21950. * '' (empty string), the corresponding style property will be unset.
  21951. *
  21952. * @param {DOMElement} node
  21953. * @param {object} styles
  21954. * @param {ReactDOMComponent} component
  21955. */
  21956. setValueForStyles: function (node, styles, component) {
  21957. if (false) {
  21958. ReactInstrumentation.debugTool.onHostOperation({
  21959. instanceID: component._debugID,
  21960. type: 'update styles',
  21961. payload: styles
  21962. });
  21963. }
  21964. var style = node.style;
  21965. for (var styleName in styles) {
  21966. if (!styles.hasOwnProperty(styleName)) {
  21967. continue;
  21968. }
  21969. if (false) {
  21970. warnValidStyle(styleName, styles[styleName], component);
  21971. }
  21972. var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
  21973. if (styleName === 'float' || styleName === 'cssFloat') {
  21974. styleName = styleFloatAccessor;
  21975. }
  21976. if (styleValue) {
  21977. style[styleName] = styleValue;
  21978. } else {
  21979. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  21980. if (expansion) {
  21981. // Shorthand property that IE8 won't like unsetting, so unset each
  21982. // component to placate it
  21983. for (var individualStyleName in expansion) {
  21984. style[individualStyleName] = '';
  21985. }
  21986. } else {
  21987. style[styleName] = '';
  21988. }
  21989. }
  21990. }
  21991. }
  21992. };
  21993. module.exports = CSSPropertyOperations;
  21994. /***/ }),
  21995. /* 153 */
  21996. /***/ (function(module, exports, __webpack_require__) {
  21997. "use strict";
  21998. /**
  21999. * Copyright 2013-present, Facebook, Inc.
  22000. * All rights reserved.
  22001. *
  22002. * This source code is licensed under the BSD-style license found in the
  22003. * LICENSE file in the root directory of this source tree. An additional grant
  22004. * of patent rights can be found in the PATENTS file in the same directory.
  22005. *
  22006. */
  22007. var EventPluginHub = __webpack_require__(26);
  22008. var EventPropagators = __webpack_require__(27);
  22009. var ExecutionEnvironment = __webpack_require__(8);
  22010. var ReactDOMComponentTree = __webpack_require__(5);
  22011. var ReactUpdates = __webpack_require__(12);
  22012. var SyntheticEvent = __webpack_require__(13);
  22013. var getEventTarget = __webpack_require__(63);
  22014. var isEventSupported = __webpack_require__(64);
  22015. var isTextInputElement = __webpack_require__(92);
  22016. var eventTypes = {
  22017. change: {
  22018. phasedRegistrationNames: {
  22019. bubbled: 'onChange',
  22020. captured: 'onChangeCapture'
  22021. },
  22022. dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
  22023. }
  22024. };
  22025. /**
  22026. * For IE shims
  22027. */
  22028. var activeElement = null;
  22029. var activeElementInst = null;
  22030. var activeElementValue = null;
  22031. var activeElementValueProp = null;
  22032. /**
  22033. * SECTION: handle `change` event
  22034. */
  22035. function shouldUseChangeEvent(elem) {
  22036. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  22037. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  22038. }
  22039. var doesChangeEventBubble = false;
  22040. if (ExecutionEnvironment.canUseDOM) {
  22041. // See `handleChange` comment below
  22042. doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
  22043. }
  22044. function manualDispatchChangeEvent(nativeEvent) {
  22045. var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
  22046. EventPropagators.accumulateTwoPhaseDispatches(event);
  22047. // If change and propertychange bubbled, we'd just bind to it like all the
  22048. // other events and have it go through ReactBrowserEventEmitter. Since it
  22049. // doesn't, we manually listen for the events and so we have to enqueue and
  22050. // process the abstract event manually.
  22051. //
  22052. // Batching is necessary here in order to ensure that all event handlers run
  22053. // before the next rerender (including event handlers attached to ancestor
  22054. // elements instead of directly on the input). Without this, controlled
  22055. // components don't work properly in conjunction with event bubbling because
  22056. // the component is rerendered and the value reverted before all the event
  22057. // handlers can run. See https://github.com/facebook/react/issues/708.
  22058. ReactUpdates.batchedUpdates(runEventInBatch, event);
  22059. }
  22060. function runEventInBatch(event) {
  22061. EventPluginHub.enqueueEvents(event);
  22062. EventPluginHub.processEventQueue(false);
  22063. }
  22064. function startWatchingForChangeEventIE8(target, targetInst) {
  22065. activeElement = target;
  22066. activeElementInst = targetInst;
  22067. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  22068. }
  22069. function stopWatchingForChangeEventIE8() {
  22070. if (!activeElement) {
  22071. return;
  22072. }
  22073. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  22074. activeElement = null;
  22075. activeElementInst = null;
  22076. }
  22077. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  22078. if (topLevelType === 'topChange') {
  22079. return targetInst;
  22080. }
  22081. }
  22082. function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
  22083. if (topLevelType === 'topFocus') {
  22084. // stopWatching() should be a noop here but we call it just in case we
  22085. // missed a blur event somehow.
  22086. stopWatchingForChangeEventIE8();
  22087. startWatchingForChangeEventIE8(target, targetInst);
  22088. } else if (topLevelType === 'topBlur') {
  22089. stopWatchingForChangeEventIE8();
  22090. }
  22091. }
  22092. /**
  22093. * SECTION: handle `input` event
  22094. */
  22095. var isInputEventSupported = false;
  22096. if (ExecutionEnvironment.canUseDOM) {
  22097. // IE9 claims to support the input event but fails to trigger it when
  22098. // deleting text, so we ignore its input events.
  22099. // IE10+ fire input events to often, such when a placeholder
  22100. // changes or when an input with a placeholder is focused.
  22101. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
  22102. }
  22103. /**
  22104. * (For IE <=11) Replacement getter/setter for the `value` property that gets
  22105. * set on the active element.
  22106. */
  22107. var newValueProp = {
  22108. get: function () {
  22109. return activeElementValueProp.get.call(this);
  22110. },
  22111. set: function (val) {
  22112. // Cast to a string so we can do equality checks.
  22113. activeElementValue = '' + val;
  22114. activeElementValueProp.set.call(this, val);
  22115. }
  22116. };
  22117. /**
  22118. * (For IE <=11) Starts tracking propertychange events on the passed-in element
  22119. * and override the value property so that we can distinguish user events from
  22120. * value changes in JS.
  22121. */
  22122. function startWatchingForValueChange(target, targetInst) {
  22123. activeElement = target;
  22124. activeElementInst = targetInst;
  22125. activeElementValue = target.value;
  22126. activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
  22127. // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
  22128. // on DOM elements
  22129. Object.defineProperty(activeElement, 'value', newValueProp);
  22130. if (activeElement.attachEvent) {
  22131. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  22132. } else {
  22133. activeElement.addEventListener('propertychange', handlePropertyChange, false);
  22134. }
  22135. }
  22136. /**
  22137. * (For IE <=11) Removes the event listeners from the currently-tracked element,
  22138. * if any exists.
  22139. */
  22140. function stopWatchingForValueChange() {
  22141. if (!activeElement) {
  22142. return;
  22143. }
  22144. // delete restores the original property definition
  22145. delete activeElement.value;
  22146. if (activeElement.detachEvent) {
  22147. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  22148. } else {
  22149. activeElement.removeEventListener('propertychange', handlePropertyChange, false);
  22150. }
  22151. activeElement = null;
  22152. activeElementInst = null;
  22153. activeElementValue = null;
  22154. activeElementValueProp = null;
  22155. }
  22156. /**
  22157. * (For IE <=11) Handles a propertychange event, sending a `change` event if
  22158. * the value of the active element has changed.
  22159. */
  22160. function handlePropertyChange(nativeEvent) {
  22161. if (nativeEvent.propertyName !== 'value') {
  22162. return;
  22163. }
  22164. var value = nativeEvent.srcElement.value;
  22165. if (value === activeElementValue) {
  22166. return;
  22167. }
  22168. activeElementValue = value;
  22169. manualDispatchChangeEvent(nativeEvent);
  22170. }
  22171. /**
  22172. * If a `change` event should be fired, returns the target's ID.
  22173. */
  22174. function getTargetInstForInputEvent(topLevelType, targetInst) {
  22175. if (topLevelType === 'topInput') {
  22176. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  22177. // what we want so fall through here and trigger an abstract event
  22178. return targetInst;
  22179. }
  22180. }
  22181. function handleEventsForInputEventIE(topLevelType, target, targetInst) {
  22182. if (topLevelType === 'topFocus') {
  22183. // In IE8, we can capture almost all .value changes by adding a
  22184. // propertychange handler and looking for events with propertyName
  22185. // equal to 'value'
  22186. // In IE9-11, propertychange fires for most input events but is buggy and
  22187. // doesn't fire when text is deleted, but conveniently, selectionchange
  22188. // appears to fire in all of the remaining cases so we catch those and
  22189. // forward the event if the value has changed
  22190. // In either case, we don't want to call the event handler if the value
  22191. // is changed from JS so we redefine a setter for `.value` that updates
  22192. // our activeElementValue variable, allowing us to ignore those changes
  22193. //
  22194. // stopWatching() should be a noop here but we call it just in case we
  22195. // missed a blur event somehow.
  22196. stopWatchingForValueChange();
  22197. startWatchingForValueChange(target, targetInst);
  22198. } else if (topLevelType === 'topBlur') {
  22199. stopWatchingForValueChange();
  22200. }
  22201. }
  22202. // For IE8 and IE9.
  22203. function getTargetInstForInputEventIE(topLevelType, targetInst) {
  22204. if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
  22205. // On the selectionchange event, the target is just document which isn't
  22206. // helpful for us so just check activeElement instead.
  22207. //
  22208. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  22209. // propertychange on the first input event after setting `value` from a
  22210. // script and fires only keydown, keypress, keyup. Catching keyup usually
  22211. // gets it and catching keydown lets us fire an event for the first
  22212. // keystroke if user does a key repeat (it'll be a little delayed: right
  22213. // before the second keystroke). Other input methods (e.g., paste) seem to
  22214. // fire selectionchange normally.
  22215. if (activeElement && activeElement.value !== activeElementValue) {
  22216. activeElementValue = activeElement.value;
  22217. return activeElementInst;
  22218. }
  22219. }
  22220. }
  22221. /**
  22222. * SECTION: handle `click` event
  22223. */
  22224. function shouldUseClickEvent(elem) {
  22225. // Use the `click` event to detect changes to checkbox and radio inputs.
  22226. // This approach works across all browsers, whereas `change` does not fire
  22227. // until `blur` in IE8.
  22228. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  22229. }
  22230. function getTargetInstForClickEvent(topLevelType, targetInst) {
  22231. if (topLevelType === 'topClick') {
  22232. return targetInst;
  22233. }
  22234. }
  22235. /**
  22236. * This plugin creates an `onChange` event that normalizes change events
  22237. * across form elements. This event fires at a time when it's possible to
  22238. * change the element's value without seeing a flicker.
  22239. *
  22240. * Supported elements are:
  22241. * - input (see `isTextInputElement`)
  22242. * - textarea
  22243. * - select
  22244. */
  22245. var ChangeEventPlugin = {
  22246. eventTypes: eventTypes,
  22247. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22248. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  22249. var getTargetInstFunc, handleEventFunc;
  22250. if (shouldUseChangeEvent(targetNode)) {
  22251. if (doesChangeEventBubble) {
  22252. getTargetInstFunc = getTargetInstForChangeEvent;
  22253. } else {
  22254. handleEventFunc = handleEventsForChangeEventIE8;
  22255. }
  22256. } else if (isTextInputElement(targetNode)) {
  22257. if (isInputEventSupported) {
  22258. getTargetInstFunc = getTargetInstForInputEvent;
  22259. } else {
  22260. getTargetInstFunc = getTargetInstForInputEventIE;
  22261. handleEventFunc = handleEventsForInputEventIE;
  22262. }
  22263. } else if (shouldUseClickEvent(targetNode)) {
  22264. getTargetInstFunc = getTargetInstForClickEvent;
  22265. }
  22266. if (getTargetInstFunc) {
  22267. var inst = getTargetInstFunc(topLevelType, targetInst);
  22268. if (inst) {
  22269. var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
  22270. event.type = 'change';
  22271. EventPropagators.accumulateTwoPhaseDispatches(event);
  22272. return event;
  22273. }
  22274. }
  22275. if (handleEventFunc) {
  22276. handleEventFunc(topLevelType, targetNode, targetInst);
  22277. }
  22278. }
  22279. };
  22280. module.exports = ChangeEventPlugin;
  22281. /***/ }),
  22282. /* 154 */
  22283. /***/ (function(module, exports, __webpack_require__) {
  22284. "use strict";
  22285. /**
  22286. * Copyright 2013-present, Facebook, Inc.
  22287. * All rights reserved.
  22288. *
  22289. * This source code is licensed under the BSD-style license found in the
  22290. * LICENSE file in the root directory of this source tree. An additional grant
  22291. * of patent rights can be found in the PATENTS file in the same directory.
  22292. *
  22293. */
  22294. var _prodInvariant = __webpack_require__(2);
  22295. var DOMLazyTree = __webpack_require__(18);
  22296. var ExecutionEnvironment = __webpack_require__(8);
  22297. var createNodesFromMarkup = __webpack_require__(141);
  22298. var emptyFunction = __webpack_require__(10);
  22299. var invariant = __webpack_require__(0);
  22300. var Danger = {
  22301. /**
  22302. * Replaces a node with a string of markup at its current position within its
  22303. * parent. The markup must render into a single root node.
  22304. *
  22305. * @param {DOMElement} oldChild Child node to replace.
  22306. * @param {string} markup Markup to render in place of the child node.
  22307. * @internal
  22308. */
  22309. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  22310. !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;
  22311. !markup ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
  22312. !(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;
  22313. if (typeof markup === 'string') {
  22314. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  22315. oldChild.parentNode.replaceChild(newChild, oldChild);
  22316. } else {
  22317. DOMLazyTree.replaceChildWithTree(oldChild, markup);
  22318. }
  22319. }
  22320. };
  22321. module.exports = Danger;
  22322. /***/ }),
  22323. /* 155 */
  22324. /***/ (function(module, exports, __webpack_require__) {
  22325. "use strict";
  22326. /**
  22327. * Copyright 2013-present, Facebook, Inc.
  22328. * All rights reserved.
  22329. *
  22330. * This source code is licensed under the BSD-style license found in the
  22331. * LICENSE file in the root directory of this source tree. An additional grant
  22332. * of patent rights can be found in the PATENTS file in the same directory.
  22333. *
  22334. */
  22335. /**
  22336. * Module that is injectable into `EventPluginHub`, that specifies a
  22337. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  22338. * plugins, without having to package every one of them. This is better than
  22339. * having plugins be ordered in the same order that they are injected because
  22340. * that ordering would be influenced by the packaging order.
  22341. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  22342. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  22343. */
  22344. var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  22345. module.exports = DefaultEventPluginOrder;
  22346. /***/ }),
  22347. /* 156 */
  22348. /***/ (function(module, exports, __webpack_require__) {
  22349. "use strict";
  22350. /**
  22351. * Copyright 2013-present, Facebook, Inc.
  22352. * All rights reserved.
  22353. *
  22354. * This source code is licensed under the BSD-style license found in the
  22355. * LICENSE file in the root directory of this source tree. An additional grant
  22356. * of patent rights can be found in the PATENTS file in the same directory.
  22357. *
  22358. */
  22359. var EventPropagators = __webpack_require__(27);
  22360. var ReactDOMComponentTree = __webpack_require__(5);
  22361. var SyntheticMouseEvent = __webpack_require__(32);
  22362. var eventTypes = {
  22363. mouseEnter: {
  22364. registrationName: 'onMouseEnter',
  22365. dependencies: ['topMouseOut', 'topMouseOver']
  22366. },
  22367. mouseLeave: {
  22368. registrationName: 'onMouseLeave',
  22369. dependencies: ['topMouseOut', 'topMouseOver']
  22370. }
  22371. };
  22372. var EnterLeaveEventPlugin = {
  22373. eventTypes: eventTypes,
  22374. /**
  22375. * For almost every interaction we care about, there will be both a top-level
  22376. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  22377. * we do not extract duplicate events. However, moving the mouse into the
  22378. * browser from outside will not fire a `mouseout` event. In this case, we use
  22379. * the `mouseover` top-level event.
  22380. */
  22381. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22382. if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  22383. return null;
  22384. }
  22385. if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
  22386. // Must not be a mouse in or mouse out - ignoring.
  22387. return null;
  22388. }
  22389. var win;
  22390. if (nativeEventTarget.window === nativeEventTarget) {
  22391. // `nativeEventTarget` is probably a window object.
  22392. win = nativeEventTarget;
  22393. } else {
  22394. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  22395. var doc = nativeEventTarget.ownerDocument;
  22396. if (doc) {
  22397. win = doc.defaultView || doc.parentWindow;
  22398. } else {
  22399. win = window;
  22400. }
  22401. }
  22402. var from;
  22403. var to;
  22404. if (topLevelType === 'topMouseOut') {
  22405. from = targetInst;
  22406. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  22407. to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
  22408. } else {
  22409. // Moving to a node from outside the window.
  22410. from = null;
  22411. to = targetInst;
  22412. }
  22413. if (from === to) {
  22414. // Nothing pertains to our managed components.
  22415. return null;
  22416. }
  22417. var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
  22418. var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
  22419. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
  22420. leave.type = 'mouseleave';
  22421. leave.target = fromNode;
  22422. leave.relatedTarget = toNode;
  22423. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
  22424. enter.type = 'mouseenter';
  22425. enter.target = toNode;
  22426. enter.relatedTarget = fromNode;
  22427. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
  22428. return [leave, enter];
  22429. }
  22430. };
  22431. module.exports = EnterLeaveEventPlugin;
  22432. /***/ }),
  22433. /* 157 */
  22434. /***/ (function(module, exports, __webpack_require__) {
  22435. "use strict";
  22436. /**
  22437. * Copyright 2013-present, Facebook, Inc.
  22438. * All rights reserved.
  22439. *
  22440. * This source code is licensed under the BSD-style license found in the
  22441. * LICENSE file in the root directory of this source tree. An additional grant
  22442. * of patent rights can be found in the PATENTS file in the same directory.
  22443. *
  22444. */
  22445. var _assign = __webpack_require__(3);
  22446. var PooledClass = __webpack_require__(16);
  22447. var getTextContentAccessor = __webpack_require__(90);
  22448. /**
  22449. * This helper class stores information about text content of a target node,
  22450. * allowing comparison of content before and after a given event.
  22451. *
  22452. * Identify the node where selection currently begins, then observe
  22453. * both its text content and its current position in the DOM. Since the
  22454. * browser may natively replace the target node during composition, we can
  22455. * use its position to find its replacement.
  22456. *
  22457. * @param {DOMEventTarget} root
  22458. */
  22459. function FallbackCompositionState(root) {
  22460. this._root = root;
  22461. this._startText = this.getText();
  22462. this._fallbackText = null;
  22463. }
  22464. _assign(FallbackCompositionState.prototype, {
  22465. destructor: function () {
  22466. this._root = null;
  22467. this._startText = null;
  22468. this._fallbackText = null;
  22469. },
  22470. /**
  22471. * Get current text of input.
  22472. *
  22473. * @return {string}
  22474. */
  22475. getText: function () {
  22476. if ('value' in this._root) {
  22477. return this._root.value;
  22478. }
  22479. return this._root[getTextContentAccessor()];
  22480. },
  22481. /**
  22482. * Determine the differing substring between the initially stored
  22483. * text content and the current content.
  22484. *
  22485. * @return {string}
  22486. */
  22487. getData: function () {
  22488. if (this._fallbackText) {
  22489. return this._fallbackText;
  22490. }
  22491. var start;
  22492. var startValue = this._startText;
  22493. var startLength = startValue.length;
  22494. var end;
  22495. var endValue = this.getText();
  22496. var endLength = endValue.length;
  22497. for (start = 0; start < startLength; start++) {
  22498. if (startValue[start] !== endValue[start]) {
  22499. break;
  22500. }
  22501. }
  22502. var minEnd = startLength - start;
  22503. for (end = 1; end <= minEnd; end++) {
  22504. if (startValue[startLength - end] !== endValue[endLength - end]) {
  22505. break;
  22506. }
  22507. }
  22508. var sliceTail = end > 1 ? 1 - end : undefined;
  22509. this._fallbackText = endValue.slice(start, sliceTail);
  22510. return this._fallbackText;
  22511. }
  22512. });
  22513. PooledClass.addPoolingTo(FallbackCompositionState);
  22514. module.exports = FallbackCompositionState;
  22515. /***/ }),
  22516. /* 158 */
  22517. /***/ (function(module, exports, __webpack_require__) {
  22518. "use strict";
  22519. /**
  22520. * Copyright 2013-present, Facebook, Inc.
  22521. * All rights reserved.
  22522. *
  22523. * This source code is licensed under the BSD-style license found in the
  22524. * LICENSE file in the root directory of this source tree. An additional grant
  22525. * of patent rights can be found in the PATENTS file in the same directory.
  22526. *
  22527. */
  22528. var DOMProperty = __webpack_require__(19);
  22529. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  22530. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  22531. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  22532. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  22533. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  22534. var HTMLDOMPropertyConfig = {
  22535. isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  22536. Properties: {
  22537. /**
  22538. * Standard Properties
  22539. */
  22540. accept: 0,
  22541. acceptCharset: 0,
  22542. accessKey: 0,
  22543. action: 0,
  22544. allowFullScreen: HAS_BOOLEAN_VALUE,
  22545. allowTransparency: 0,
  22546. alt: 0,
  22547. // specifies target context for links with `preload` type
  22548. as: 0,
  22549. async: HAS_BOOLEAN_VALUE,
  22550. autoComplete: 0,
  22551. // autoFocus is polyfilled/normalized by AutoFocusUtils
  22552. // autoFocus: HAS_BOOLEAN_VALUE,
  22553. autoPlay: HAS_BOOLEAN_VALUE,
  22554. capture: HAS_BOOLEAN_VALUE,
  22555. cellPadding: 0,
  22556. cellSpacing: 0,
  22557. charSet: 0,
  22558. challenge: 0,
  22559. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22560. cite: 0,
  22561. classID: 0,
  22562. className: 0,
  22563. cols: HAS_POSITIVE_NUMERIC_VALUE,
  22564. colSpan: 0,
  22565. content: 0,
  22566. contentEditable: 0,
  22567. contextMenu: 0,
  22568. controls: HAS_BOOLEAN_VALUE,
  22569. coords: 0,
  22570. crossOrigin: 0,
  22571. data: 0, // For `<object />` acts as `src`.
  22572. dateTime: 0,
  22573. 'default': HAS_BOOLEAN_VALUE,
  22574. defer: HAS_BOOLEAN_VALUE,
  22575. dir: 0,
  22576. disabled: HAS_BOOLEAN_VALUE,
  22577. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  22578. draggable: 0,
  22579. encType: 0,
  22580. form: 0,
  22581. formAction: 0,
  22582. formEncType: 0,
  22583. formMethod: 0,
  22584. formNoValidate: HAS_BOOLEAN_VALUE,
  22585. formTarget: 0,
  22586. frameBorder: 0,
  22587. headers: 0,
  22588. height: 0,
  22589. hidden: HAS_BOOLEAN_VALUE,
  22590. high: 0,
  22591. href: 0,
  22592. hrefLang: 0,
  22593. htmlFor: 0,
  22594. httpEquiv: 0,
  22595. icon: 0,
  22596. id: 0,
  22597. inputMode: 0,
  22598. integrity: 0,
  22599. is: 0,
  22600. keyParams: 0,
  22601. keyType: 0,
  22602. kind: 0,
  22603. label: 0,
  22604. lang: 0,
  22605. list: 0,
  22606. loop: HAS_BOOLEAN_VALUE,
  22607. low: 0,
  22608. manifest: 0,
  22609. marginHeight: 0,
  22610. marginWidth: 0,
  22611. max: 0,
  22612. maxLength: 0,
  22613. media: 0,
  22614. mediaGroup: 0,
  22615. method: 0,
  22616. min: 0,
  22617. minLength: 0,
  22618. // Caution; `option.selected` is not updated if `select.multiple` is
  22619. // disabled with `removeAttribute`.
  22620. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22621. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22622. name: 0,
  22623. nonce: 0,
  22624. noValidate: HAS_BOOLEAN_VALUE,
  22625. open: HAS_BOOLEAN_VALUE,
  22626. optimum: 0,
  22627. pattern: 0,
  22628. placeholder: 0,
  22629. playsInline: HAS_BOOLEAN_VALUE,
  22630. poster: 0,
  22631. preload: 0,
  22632. profile: 0,
  22633. radioGroup: 0,
  22634. readOnly: HAS_BOOLEAN_VALUE,
  22635. referrerPolicy: 0,
  22636. rel: 0,
  22637. required: HAS_BOOLEAN_VALUE,
  22638. reversed: HAS_BOOLEAN_VALUE,
  22639. role: 0,
  22640. rows: HAS_POSITIVE_NUMERIC_VALUE,
  22641. rowSpan: HAS_NUMERIC_VALUE,
  22642. sandbox: 0,
  22643. scope: 0,
  22644. scoped: HAS_BOOLEAN_VALUE,
  22645. scrolling: 0,
  22646. seamless: HAS_BOOLEAN_VALUE,
  22647. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22648. shape: 0,
  22649. size: HAS_POSITIVE_NUMERIC_VALUE,
  22650. sizes: 0,
  22651. span: HAS_POSITIVE_NUMERIC_VALUE,
  22652. spellCheck: 0,
  22653. src: 0,
  22654. srcDoc: 0,
  22655. srcLang: 0,
  22656. srcSet: 0,
  22657. start: HAS_NUMERIC_VALUE,
  22658. step: 0,
  22659. style: 0,
  22660. summary: 0,
  22661. tabIndex: 0,
  22662. target: 0,
  22663. title: 0,
  22664. // Setting .type throws on non-<input> tags
  22665. type: 0,
  22666. useMap: 0,
  22667. value: 0,
  22668. width: 0,
  22669. wmode: 0,
  22670. wrap: 0,
  22671. /**
  22672. * RDFa Properties
  22673. */
  22674. about: 0,
  22675. datatype: 0,
  22676. inlist: 0,
  22677. prefix: 0,
  22678. // property is also supported for OpenGraph in meta tags.
  22679. property: 0,
  22680. resource: 0,
  22681. 'typeof': 0,
  22682. vocab: 0,
  22683. /**
  22684. * Non-standard Properties
  22685. */
  22686. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  22687. // keyboard hints.
  22688. autoCapitalize: 0,
  22689. autoCorrect: 0,
  22690. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  22691. autoSave: 0,
  22692. // color is for Safari mask-icon link
  22693. color: 0,
  22694. // itemProp, itemScope, itemType are for
  22695. // Microdata support. See http://schema.org/docs/gs.html
  22696. itemProp: 0,
  22697. itemScope: HAS_BOOLEAN_VALUE,
  22698. itemType: 0,
  22699. // itemID and itemRef are for Microdata support as well but
  22700. // only specified in the WHATWG spec document. See
  22701. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  22702. itemID: 0,
  22703. itemRef: 0,
  22704. // results show looking glass icon and recent searches on input
  22705. // search fields in WebKit/Blink
  22706. results: 0,
  22707. // IE-only attribute that specifies security restrictions on an iframe
  22708. // as an alternative to the sandbox attribute on IE<10
  22709. security: 0,
  22710. // IE-only attribute that controls focus behavior
  22711. unselectable: 0
  22712. },
  22713. DOMAttributeNames: {
  22714. acceptCharset: 'accept-charset',
  22715. className: 'class',
  22716. htmlFor: 'for',
  22717. httpEquiv: 'http-equiv'
  22718. },
  22719. DOMPropertyNames: {}
  22720. };
  22721. module.exports = HTMLDOMPropertyConfig;
  22722. /***/ }),
  22723. /* 159 */
  22724. /***/ (function(module, exports, __webpack_require__) {
  22725. "use strict";
  22726. /* WEBPACK VAR INJECTION */(function(process) {/**
  22727. * Copyright 2014-present, Facebook, Inc.
  22728. * All rights reserved.
  22729. *
  22730. * This source code is licensed under the BSD-style license found in the
  22731. * LICENSE file in the root directory of this source tree. An additional grant
  22732. * of patent rights can be found in the PATENTS file in the same directory.
  22733. *
  22734. */
  22735. var ReactReconciler = __webpack_require__(20);
  22736. var instantiateReactComponent = __webpack_require__(91);
  22737. var KeyEscapeUtils = __webpack_require__(55);
  22738. var shouldUpdateReactComponent = __webpack_require__(65);
  22739. var traverseAllChildren = __webpack_require__(94);
  22740. var warning = __webpack_require__(1);
  22741. var ReactComponentTreeHook;
  22742. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  22743. // Temporary hack.
  22744. // Inline requires don't work well with Jest:
  22745. // https://github.com/facebook/react/issues/7240
  22746. // Remove the inline requires when we don't need them anymore:
  22747. // https://github.com/facebook/react/pull/7178
  22748. ReactComponentTreeHook = __webpack_require__(95);
  22749. }
  22750. function instantiateChild(childInstances, child, name, selfDebugID) {
  22751. // We found a component instance.
  22752. var keyUnique = childInstances[name] === undefined;
  22753. if (false) {
  22754. if (!ReactComponentTreeHook) {
  22755. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  22756. }
  22757. if (!keyUnique) {
  22758. 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;
  22759. }
  22760. }
  22761. if (child != null && keyUnique) {
  22762. childInstances[name] = instantiateReactComponent(child, true);
  22763. }
  22764. }
  22765. /**
  22766. * ReactChildReconciler provides helpers for initializing or updating a set of
  22767. * children. Its output is suitable for passing it onto ReactMultiChild which
  22768. * does diffed reordering and insertion.
  22769. */
  22770. var ReactChildReconciler = {
  22771. /**
  22772. * Generates a "mount image" for each of the supplied children. In the case
  22773. * of `ReactDOMComponent`, a mount image is a string of markup.
  22774. *
  22775. * @param {?object} nestedChildNodes Nested child maps.
  22776. * @return {?object} A set of child instances.
  22777. * @internal
  22778. */
  22779. instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
  22780. ) {
  22781. if (nestedChildNodes == null) {
  22782. return null;
  22783. }
  22784. var childInstances = {};
  22785. if (false) {
  22786. traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
  22787. return instantiateChild(childInsts, child, name, selfDebugID);
  22788. }, childInstances);
  22789. } else {
  22790. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  22791. }
  22792. return childInstances;
  22793. },
  22794. /**
  22795. * Updates the rendered children and returns a new set of children.
  22796. *
  22797. * @param {?object} prevChildren Previously initialized set of children.
  22798. * @param {?object} nextChildren Flat child element maps.
  22799. * @param {ReactReconcileTransaction} transaction
  22800. * @param {object} context
  22801. * @return {?object} A new set of child instances.
  22802. * @internal
  22803. */
  22804. updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
  22805. ) {
  22806. // We currently don't have a way to track moves here but if we use iterators
  22807. // instead of for..in we can zip the iterators and check if an item has
  22808. // moved.
  22809. // TODO: If nothing has changed, return the prevChildren object so that we
  22810. // can quickly bailout if nothing has changed.
  22811. if (!nextChildren && !prevChildren) {
  22812. return;
  22813. }
  22814. var name;
  22815. var prevChild;
  22816. for (name in nextChildren) {
  22817. if (!nextChildren.hasOwnProperty(name)) {
  22818. continue;
  22819. }
  22820. prevChild = prevChildren && prevChildren[name];
  22821. var prevElement = prevChild && prevChild._currentElement;
  22822. var nextElement = nextChildren[name];
  22823. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  22824. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  22825. nextChildren[name] = prevChild;
  22826. } else {
  22827. if (prevChild) {
  22828. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  22829. ReactReconciler.unmountComponent(prevChild, false);
  22830. }
  22831. // The child must be instantiated before it's mounted.
  22832. var nextChildInstance = instantiateReactComponent(nextElement, true);
  22833. nextChildren[name] = nextChildInstance;
  22834. // Creating mount image now ensures refs are resolved in right order
  22835. // (see https://github.com/facebook/react/pull/7101 for explanation).
  22836. var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
  22837. mountImages.push(nextChildMountImage);
  22838. }
  22839. }
  22840. // Unmount children that are no longer present.
  22841. for (name in prevChildren) {
  22842. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  22843. prevChild = prevChildren[name];
  22844. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  22845. ReactReconciler.unmountComponent(prevChild, false);
  22846. }
  22847. }
  22848. },
  22849. /**
  22850. * Unmounts all rendered children. This should be used to clean up children
  22851. * when this component is unmounted.
  22852. *
  22853. * @param {?object} renderedChildren Previously initialized set of children.
  22854. * @internal
  22855. */
  22856. unmountChildren: function (renderedChildren, safely) {
  22857. for (var name in renderedChildren) {
  22858. if (renderedChildren.hasOwnProperty(name)) {
  22859. var renderedChild = renderedChildren[name];
  22860. ReactReconciler.unmountComponent(renderedChild, safely);
  22861. }
  22862. }
  22863. }
  22864. };
  22865. module.exports = ReactChildReconciler;
  22866. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  22867. /***/ }),
  22868. /* 160 */
  22869. /***/ (function(module, exports, __webpack_require__) {
  22870. "use strict";
  22871. /**
  22872. * Copyright 2013-present, Facebook, Inc.
  22873. * All rights reserved.
  22874. *
  22875. * This source code is licensed under the BSD-style license found in the
  22876. * LICENSE file in the root directory of this source tree. An additional grant
  22877. * of patent rights can be found in the PATENTS file in the same directory.
  22878. *
  22879. */
  22880. var DOMChildrenOperations = __webpack_require__(51);
  22881. var ReactDOMIDOperations = __webpack_require__(167);
  22882. /**
  22883. * Abstracts away all functionality of the reconciler that requires knowledge of
  22884. * the browser context. TODO: These callers should be refactored to avoid the
  22885. * need for this injection.
  22886. */
  22887. var ReactComponentBrowserEnvironment = {
  22888. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  22889. replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
  22890. };
  22891. module.exports = ReactComponentBrowserEnvironment;
  22892. /***/ }),
  22893. /* 161 */
  22894. /***/ (function(module, exports, __webpack_require__) {
  22895. "use strict";
  22896. /**
  22897. * Copyright 2013-present, Facebook, Inc.
  22898. * All rights reserved.
  22899. *
  22900. * This source code is licensed under the BSD-style license found in the
  22901. * LICENSE file in the root directory of this source tree. An additional grant
  22902. * of patent rights can be found in the PATENTS file in the same directory.
  22903. *
  22904. */
  22905. var _prodInvariant = __webpack_require__(2),
  22906. _assign = __webpack_require__(3);
  22907. var React = __webpack_require__(21);
  22908. var ReactComponentEnvironment = __webpack_require__(57);
  22909. var ReactCurrentOwner = __webpack_require__(14);
  22910. var ReactErrorUtils = __webpack_require__(58);
  22911. var ReactInstanceMap = __webpack_require__(28);
  22912. var ReactInstrumentation = __webpack_require__(11);
  22913. var ReactNodeTypes = __webpack_require__(85);
  22914. var ReactReconciler = __webpack_require__(20);
  22915. if (false) {
  22916. var checkReactTypeSpec = require('./checkReactTypeSpec');
  22917. }
  22918. var emptyObject = __webpack_require__(25);
  22919. var invariant = __webpack_require__(0);
  22920. var shallowEqual = __webpack_require__(50);
  22921. var shouldUpdateReactComponent = __webpack_require__(65);
  22922. var warning = __webpack_require__(1);
  22923. var CompositeTypes = {
  22924. ImpureClass: 0,
  22925. PureClass: 1,
  22926. StatelessFunctional: 2
  22927. };
  22928. function StatelessComponent(Component) {}
  22929. StatelessComponent.prototype.render = function () {
  22930. var Component = ReactInstanceMap.get(this)._currentElement.type;
  22931. var element = Component(this.props, this.context, this.updater);
  22932. warnIfInvalidElement(Component, element);
  22933. return element;
  22934. };
  22935. function warnIfInvalidElement(Component, element) {
  22936. if (false) {
  22937. 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;
  22938. process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
  22939. }
  22940. }
  22941. function shouldConstruct(Component) {
  22942. return !!(Component.prototype && Component.prototype.isReactComponent);
  22943. }
  22944. function isPureComponent(Component) {
  22945. return !!(Component.prototype && Component.prototype.isPureReactComponent);
  22946. }
  22947. // Separated into a function to contain deoptimizations caused by try/finally.
  22948. function measureLifeCyclePerf(fn, debugID, timerType) {
  22949. if (debugID === 0) {
  22950. // Top-level wrappers (see ReactMount) and empty components (see
  22951. // ReactDOMEmptyComponent) are invisible to hooks and devtools.
  22952. // Both are implementation details that should go away in the future.
  22953. return fn();
  22954. }
  22955. ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
  22956. try {
  22957. return fn();
  22958. } finally {
  22959. ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
  22960. }
  22961. }
  22962. /**
  22963. * ------------------ The Life-Cycle of a Composite Component ------------------
  22964. *
  22965. * - constructor: Initialization of state. The instance is now retained.
  22966. * - componentWillMount
  22967. * - render
  22968. * - [children's constructors]
  22969. * - [children's componentWillMount and render]
  22970. * - [children's componentDidMount]
  22971. * - componentDidMount
  22972. *
  22973. * Update Phases:
  22974. * - componentWillReceiveProps (only called if parent updated)
  22975. * - shouldComponentUpdate
  22976. * - componentWillUpdate
  22977. * - render
  22978. * - [children's constructors or receive props phases]
  22979. * - componentDidUpdate
  22980. *
  22981. * - componentWillUnmount
  22982. * - [children's componentWillUnmount]
  22983. * - [children destroyed]
  22984. * - (destroyed): The instance is now blank, released by React and ready for GC.
  22985. *
  22986. * -----------------------------------------------------------------------------
  22987. */
  22988. /**
  22989. * An incrementing ID assigned to each component when it is mounted. This is
  22990. * used to enforce the order in which `ReactUpdates` updates dirty components.
  22991. *
  22992. * @private
  22993. */
  22994. var nextMountID = 1;
  22995. /**
  22996. * @lends {ReactCompositeComponent.prototype}
  22997. */
  22998. var ReactCompositeComponent = {
  22999. /**
  23000. * Base constructor for all composite component.
  23001. *
  23002. * @param {ReactElement} element
  23003. * @final
  23004. * @internal
  23005. */
  23006. construct: function (element) {
  23007. this._currentElement = element;
  23008. this._rootNodeID = 0;
  23009. this._compositeType = null;
  23010. this._instance = null;
  23011. this._hostParent = null;
  23012. this._hostContainerInfo = null;
  23013. // See ReactUpdateQueue
  23014. this._updateBatchNumber = null;
  23015. this._pendingElement = null;
  23016. this._pendingStateQueue = null;
  23017. this._pendingReplaceState = false;
  23018. this._pendingForceUpdate = false;
  23019. this._renderedNodeType = null;
  23020. this._renderedComponent = null;
  23021. this._context = null;
  23022. this._mountOrder = 0;
  23023. this._topLevelWrapper = null;
  23024. // See ReactUpdates and ReactUpdateQueue.
  23025. this._pendingCallbacks = null;
  23026. // ComponentWillUnmount shall only be called once
  23027. this._calledComponentWillUnmount = false;
  23028. if (false) {
  23029. this._warnedAboutRefsInRender = false;
  23030. }
  23031. },
  23032. /**
  23033. * Initializes the component, renders markup, and registers event listeners.
  23034. *
  23035. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  23036. * @param {?object} hostParent
  23037. * @param {?object} hostContainerInfo
  23038. * @param {?object} context
  23039. * @return {?string} Rendered markup to be inserted into the DOM.
  23040. * @final
  23041. * @internal
  23042. */
  23043. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  23044. var _this = this;
  23045. this._context = context;
  23046. this._mountOrder = nextMountID++;
  23047. this._hostParent = hostParent;
  23048. this._hostContainerInfo = hostContainerInfo;
  23049. var publicProps = this._currentElement.props;
  23050. var publicContext = this._processContext(context);
  23051. var Component = this._currentElement.type;
  23052. var updateQueue = transaction.getUpdateQueue();
  23053. // Initialize the public class
  23054. var doConstruct = shouldConstruct(Component);
  23055. var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
  23056. var renderedElement;
  23057. // Support functional components
  23058. if (!doConstruct && (inst == null || inst.render == null)) {
  23059. renderedElement = inst;
  23060. warnIfInvalidElement(Component, renderedElement);
  23061. !(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;
  23062. inst = new StatelessComponent(Component);
  23063. this._compositeType = CompositeTypes.StatelessFunctional;
  23064. } else {
  23065. if (isPureComponent(Component)) {
  23066. this._compositeType = CompositeTypes.PureClass;
  23067. } else {
  23068. this._compositeType = CompositeTypes.ImpureClass;
  23069. }
  23070. }
  23071. if (false) {
  23072. // This will throw later in _renderValidatedComponent, but add an early
  23073. // warning now to help debugging
  23074. if (inst.render == null) {
  23075. 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;
  23076. }
  23077. var propsMutated = inst.props !== publicProps;
  23078. var componentName = Component.displayName || Component.name || 'Component';
  23079. 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;
  23080. }
  23081. // These should be set up in the constructor, but as a convenience for
  23082. // simpler class abstractions, we set them up after the fact.
  23083. inst.props = publicProps;
  23084. inst.context = publicContext;
  23085. inst.refs = emptyObject;
  23086. inst.updater = updateQueue;
  23087. this._instance = inst;
  23088. // Store a reference from the instance back to the internal representation
  23089. ReactInstanceMap.set(inst, this);
  23090. if (false) {
  23091. // Since plain JS classes are defined without any special initialization
  23092. // logic, we can not catch common errors early. Therefore, we have to
  23093. // catch them here, at initialization time, instead.
  23094. 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;
  23095. 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;
  23096. 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;
  23097. 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;
  23098. 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;
  23099. 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;
  23100. 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;
  23101. }
  23102. var initialState = inst.state;
  23103. if (initialState === undefined) {
  23104. inst.state = initialState = null;
  23105. }
  23106. !(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;
  23107. this._pendingStateQueue = null;
  23108. this._pendingReplaceState = false;
  23109. this._pendingForceUpdate = false;
  23110. var markup;
  23111. if (inst.unstable_handleError) {
  23112. markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23113. } else {
  23114. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23115. }
  23116. if (inst.componentDidMount) {
  23117. if (false) {
  23118. transaction.getReactMountReady().enqueue(function () {
  23119. measureLifeCyclePerf(function () {
  23120. return inst.componentDidMount();
  23121. }, _this._debugID, 'componentDidMount');
  23122. });
  23123. } else {
  23124. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  23125. }
  23126. }
  23127. return markup;
  23128. },
  23129. _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
  23130. if (false) {
  23131. ReactCurrentOwner.current = this;
  23132. try {
  23133. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23134. } finally {
  23135. ReactCurrentOwner.current = null;
  23136. }
  23137. } else {
  23138. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23139. }
  23140. },
  23141. _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
  23142. var Component = this._currentElement.type;
  23143. if (doConstruct) {
  23144. if (false) {
  23145. return measureLifeCyclePerf(function () {
  23146. return new Component(publicProps, publicContext, updateQueue);
  23147. }, this._debugID, 'ctor');
  23148. } else {
  23149. return new Component(publicProps, publicContext, updateQueue);
  23150. }
  23151. }
  23152. // This can still be an instance in case of factory components
  23153. // but we'll count this as time spent rendering as the more common case.
  23154. if (false) {
  23155. return measureLifeCyclePerf(function () {
  23156. return Component(publicProps, publicContext, updateQueue);
  23157. }, this._debugID, 'render');
  23158. } else {
  23159. return Component(publicProps, publicContext, updateQueue);
  23160. }
  23161. },
  23162. performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23163. var markup;
  23164. var checkpoint = transaction.checkpoint();
  23165. try {
  23166. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23167. } catch (e) {
  23168. // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
  23169. transaction.rollback(checkpoint);
  23170. this._instance.unstable_handleError(e);
  23171. if (this._pendingStateQueue) {
  23172. this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
  23173. }
  23174. checkpoint = transaction.checkpoint();
  23175. this._renderedComponent.unmountComponent(true);
  23176. transaction.rollback(checkpoint);
  23177. // Try again - we've informed the component about the error, so they can render an error message this time.
  23178. // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
  23179. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23180. }
  23181. return markup;
  23182. },
  23183. performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23184. var inst = this._instance;
  23185. var debugID = 0;
  23186. if (false) {
  23187. debugID = this._debugID;
  23188. }
  23189. if (inst.componentWillMount) {
  23190. if (false) {
  23191. measureLifeCyclePerf(function () {
  23192. return inst.componentWillMount();
  23193. }, debugID, 'componentWillMount');
  23194. } else {
  23195. inst.componentWillMount();
  23196. }
  23197. // When mounting, calls to `setState` by `componentWillMount` will set
  23198. // `this._pendingStateQueue` without triggering a re-render.
  23199. if (this._pendingStateQueue) {
  23200. inst.state = this._processPendingState(inst.props, inst.context);
  23201. }
  23202. }
  23203. // If not a stateless component, we now render
  23204. if (renderedElement === undefined) {
  23205. renderedElement = this._renderValidatedComponent();
  23206. }
  23207. var nodeType = ReactNodeTypes.getType(renderedElement);
  23208. this._renderedNodeType = nodeType;
  23209. var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23210. );
  23211. this._renderedComponent = child;
  23212. var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
  23213. if (false) {
  23214. if (debugID !== 0) {
  23215. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23216. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23217. }
  23218. }
  23219. return markup;
  23220. },
  23221. getHostNode: function () {
  23222. return ReactReconciler.getHostNode(this._renderedComponent);
  23223. },
  23224. /**
  23225. * Releases any resources allocated by `mountComponent`.
  23226. *
  23227. * @final
  23228. * @internal
  23229. */
  23230. unmountComponent: function (safely) {
  23231. if (!this._renderedComponent) {
  23232. return;
  23233. }
  23234. var inst = this._instance;
  23235. if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
  23236. inst._calledComponentWillUnmount = true;
  23237. if (safely) {
  23238. var name = this.getName() + '.componentWillUnmount()';
  23239. ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
  23240. } else {
  23241. if (false) {
  23242. measureLifeCyclePerf(function () {
  23243. return inst.componentWillUnmount();
  23244. }, this._debugID, 'componentWillUnmount');
  23245. } else {
  23246. inst.componentWillUnmount();
  23247. }
  23248. }
  23249. }
  23250. if (this._renderedComponent) {
  23251. ReactReconciler.unmountComponent(this._renderedComponent, safely);
  23252. this._renderedNodeType = null;
  23253. this._renderedComponent = null;
  23254. this._instance = null;
  23255. }
  23256. // Reset pending fields
  23257. // Even if this component is scheduled for another update in ReactUpdates,
  23258. // it would still be ignored because these fields are reset.
  23259. this._pendingStateQueue = null;
  23260. this._pendingReplaceState = false;
  23261. this._pendingForceUpdate = false;
  23262. this._pendingCallbacks = null;
  23263. this._pendingElement = null;
  23264. // These fields do not really need to be reset since this object is no
  23265. // longer accessible.
  23266. this._context = null;
  23267. this._rootNodeID = 0;
  23268. this._topLevelWrapper = null;
  23269. // Delete the reference from the instance to this internal representation
  23270. // which allow the internals to be properly cleaned up even if the user
  23271. // leaks a reference to the public instance.
  23272. ReactInstanceMap.remove(inst);
  23273. // Some existing components rely on inst.props even after they've been
  23274. // destroyed (in event handlers).
  23275. // TODO: inst.props = null;
  23276. // TODO: inst.state = null;
  23277. // TODO: inst.context = null;
  23278. },
  23279. /**
  23280. * Filters the context object to only contain keys specified in
  23281. * `contextTypes`
  23282. *
  23283. * @param {object} context
  23284. * @return {?object}
  23285. * @private
  23286. */
  23287. _maskContext: function (context) {
  23288. var Component = this._currentElement.type;
  23289. var contextTypes = Component.contextTypes;
  23290. if (!contextTypes) {
  23291. return emptyObject;
  23292. }
  23293. var maskedContext = {};
  23294. for (var contextName in contextTypes) {
  23295. maskedContext[contextName] = context[contextName];
  23296. }
  23297. return maskedContext;
  23298. },
  23299. /**
  23300. * Filters the context object to only contain keys specified in
  23301. * `contextTypes`, and asserts that they are valid.
  23302. *
  23303. * @param {object} context
  23304. * @return {?object}
  23305. * @private
  23306. */
  23307. _processContext: function (context) {
  23308. var maskedContext = this._maskContext(context);
  23309. if (false) {
  23310. var Component = this._currentElement.type;
  23311. if (Component.contextTypes) {
  23312. this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
  23313. }
  23314. }
  23315. return maskedContext;
  23316. },
  23317. /**
  23318. * @param {object} currentContext
  23319. * @return {object}
  23320. * @private
  23321. */
  23322. _processChildContext: function (currentContext) {
  23323. var Component = this._currentElement.type;
  23324. var inst = this._instance;
  23325. var childContext;
  23326. if (inst.getChildContext) {
  23327. if (false) {
  23328. ReactInstrumentation.debugTool.onBeginProcessingChildContext();
  23329. try {
  23330. childContext = inst.getChildContext();
  23331. } finally {
  23332. ReactInstrumentation.debugTool.onEndProcessingChildContext();
  23333. }
  23334. } else {
  23335. childContext = inst.getChildContext();
  23336. }
  23337. }
  23338. if (childContext) {
  23339. !(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;
  23340. if (false) {
  23341. this._checkContextTypes(Component.childContextTypes, childContext, 'childContext');
  23342. }
  23343. for (var name in childContext) {
  23344. !(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;
  23345. }
  23346. return _assign({}, currentContext, childContext);
  23347. }
  23348. return currentContext;
  23349. },
  23350. /**
  23351. * Assert that the context types are valid
  23352. *
  23353. * @param {object} typeSpecs Map of context field to a ReactPropType
  23354. * @param {object} values Runtime values that need to be type-checked
  23355. * @param {string} location e.g. "prop", "context", "child context"
  23356. * @private
  23357. */
  23358. _checkContextTypes: function (typeSpecs, values, location) {
  23359. if (false) {
  23360. checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
  23361. }
  23362. },
  23363. receiveComponent: function (nextElement, transaction, nextContext) {
  23364. var prevElement = this._currentElement;
  23365. var prevContext = this._context;
  23366. this._pendingElement = null;
  23367. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  23368. },
  23369. /**
  23370. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  23371. * is set, update the component.
  23372. *
  23373. * @param {ReactReconcileTransaction} transaction
  23374. * @internal
  23375. */
  23376. performUpdateIfNecessary: function (transaction) {
  23377. if (this._pendingElement != null) {
  23378. ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
  23379. } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  23380. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  23381. } else {
  23382. this._updateBatchNumber = null;
  23383. }
  23384. },
  23385. /**
  23386. * Perform an update to a mounted component. The componentWillReceiveProps and
  23387. * shouldComponentUpdate methods are called, then (assuming the update isn't
  23388. * skipped) the remaining update lifecycle methods are called and the DOM
  23389. * representation is updated.
  23390. *
  23391. * By default, this implements React's rendering and reconciliation algorithm.
  23392. * Sophisticated clients may wish to override this.
  23393. *
  23394. * @param {ReactReconcileTransaction} transaction
  23395. * @param {ReactElement} prevParentElement
  23396. * @param {ReactElement} nextParentElement
  23397. * @internal
  23398. * @overridable
  23399. */
  23400. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  23401. var inst = this._instance;
  23402. !(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;
  23403. var willReceive = false;
  23404. var nextContext;
  23405. // Determine if the context has changed or not
  23406. if (this._context === nextUnmaskedContext) {
  23407. nextContext = inst.context;
  23408. } else {
  23409. nextContext = this._processContext(nextUnmaskedContext);
  23410. willReceive = true;
  23411. }
  23412. var prevProps = prevParentElement.props;
  23413. var nextProps = nextParentElement.props;
  23414. // Not a simple state update but a props update
  23415. if (prevParentElement !== nextParentElement) {
  23416. willReceive = true;
  23417. }
  23418. // An update here will schedule an update but immediately set
  23419. // _pendingStateQueue which will ensure that any state updates gets
  23420. // immediately reconciled instead of waiting for the next batch.
  23421. if (willReceive && inst.componentWillReceiveProps) {
  23422. if (false) {
  23423. measureLifeCyclePerf(function () {
  23424. return inst.componentWillReceiveProps(nextProps, nextContext);
  23425. }, this._debugID, 'componentWillReceiveProps');
  23426. } else {
  23427. inst.componentWillReceiveProps(nextProps, nextContext);
  23428. }
  23429. }
  23430. var nextState = this._processPendingState(nextProps, nextContext);
  23431. var shouldUpdate = true;
  23432. if (!this._pendingForceUpdate) {
  23433. if (inst.shouldComponentUpdate) {
  23434. if (false) {
  23435. shouldUpdate = measureLifeCyclePerf(function () {
  23436. return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23437. }, this._debugID, 'shouldComponentUpdate');
  23438. } else {
  23439. shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23440. }
  23441. } else {
  23442. if (this._compositeType === CompositeTypes.PureClass) {
  23443. shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
  23444. }
  23445. }
  23446. }
  23447. if (false) {
  23448. 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;
  23449. }
  23450. this._updateBatchNumber = null;
  23451. if (shouldUpdate) {
  23452. this._pendingForceUpdate = false;
  23453. // Will set `this.props`, `this.state` and `this.context`.
  23454. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  23455. } else {
  23456. // If it's determined that a component should not update, we still want
  23457. // to set props and state but we shortcut the rest of the update.
  23458. this._currentElement = nextParentElement;
  23459. this._context = nextUnmaskedContext;
  23460. inst.props = nextProps;
  23461. inst.state = nextState;
  23462. inst.context = nextContext;
  23463. }
  23464. },
  23465. _processPendingState: function (props, context) {
  23466. var inst = this._instance;
  23467. var queue = this._pendingStateQueue;
  23468. var replace = this._pendingReplaceState;
  23469. this._pendingReplaceState = false;
  23470. this._pendingStateQueue = null;
  23471. if (!queue) {
  23472. return inst.state;
  23473. }
  23474. if (replace && queue.length === 1) {
  23475. return queue[0];
  23476. }
  23477. var nextState = _assign({}, replace ? queue[0] : inst.state);
  23478. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  23479. var partial = queue[i];
  23480. _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  23481. }
  23482. return nextState;
  23483. },
  23484. /**
  23485. * Merges new props and state, notifies delegate methods of update and
  23486. * performs update.
  23487. *
  23488. * @param {ReactElement} nextElement Next element
  23489. * @param {object} nextProps Next public object to set as properties.
  23490. * @param {?object} nextState Next object to set as state.
  23491. * @param {?object} nextContext Next public object to set as context.
  23492. * @param {ReactReconcileTransaction} transaction
  23493. * @param {?object} unmaskedContext
  23494. * @private
  23495. */
  23496. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  23497. var _this2 = this;
  23498. var inst = this._instance;
  23499. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  23500. var prevProps;
  23501. var prevState;
  23502. var prevContext;
  23503. if (hasComponentDidUpdate) {
  23504. prevProps = inst.props;
  23505. prevState = inst.state;
  23506. prevContext = inst.context;
  23507. }
  23508. if (inst.componentWillUpdate) {
  23509. if (false) {
  23510. measureLifeCyclePerf(function () {
  23511. return inst.componentWillUpdate(nextProps, nextState, nextContext);
  23512. }, this._debugID, 'componentWillUpdate');
  23513. } else {
  23514. inst.componentWillUpdate(nextProps, nextState, nextContext);
  23515. }
  23516. }
  23517. this._currentElement = nextElement;
  23518. this._context = unmaskedContext;
  23519. inst.props = nextProps;
  23520. inst.state = nextState;
  23521. inst.context = nextContext;
  23522. this._updateRenderedComponent(transaction, unmaskedContext);
  23523. if (hasComponentDidUpdate) {
  23524. if (false) {
  23525. transaction.getReactMountReady().enqueue(function () {
  23526. measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
  23527. });
  23528. } else {
  23529. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  23530. }
  23531. }
  23532. },
  23533. /**
  23534. * Call the component's `render` method and update the DOM accordingly.
  23535. *
  23536. * @param {ReactReconcileTransaction} transaction
  23537. * @internal
  23538. */
  23539. _updateRenderedComponent: function (transaction, context) {
  23540. var prevComponentInstance = this._renderedComponent;
  23541. var prevRenderedElement = prevComponentInstance._currentElement;
  23542. var nextRenderedElement = this._renderValidatedComponent();
  23543. var debugID = 0;
  23544. if (false) {
  23545. debugID = this._debugID;
  23546. }
  23547. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  23548. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  23549. } else {
  23550. var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
  23551. ReactReconciler.unmountComponent(prevComponentInstance, false);
  23552. var nodeType = ReactNodeTypes.getType(nextRenderedElement);
  23553. this._renderedNodeType = nodeType;
  23554. var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23555. );
  23556. this._renderedComponent = child;
  23557. var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
  23558. if (false) {
  23559. if (debugID !== 0) {
  23560. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23561. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23562. }
  23563. }
  23564. this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
  23565. }
  23566. },
  23567. /**
  23568. * Overridden in shallow rendering.
  23569. *
  23570. * @protected
  23571. */
  23572. _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
  23573. ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
  23574. },
  23575. /**
  23576. * @protected
  23577. */
  23578. _renderValidatedComponentWithoutOwnerOrContext: function () {
  23579. var inst = this._instance;
  23580. var renderedElement;
  23581. if (false) {
  23582. renderedElement = measureLifeCyclePerf(function () {
  23583. return inst.render();
  23584. }, this._debugID, 'render');
  23585. } else {
  23586. renderedElement = inst.render();
  23587. }
  23588. if (false) {
  23589. // We allow auto-mocks to proceed as if they're returning null.
  23590. if (renderedElement === undefined && inst.render._isMockFunction) {
  23591. // This is probably bad practice. Consider warning here and
  23592. // deprecating this convenience.
  23593. renderedElement = null;
  23594. }
  23595. }
  23596. return renderedElement;
  23597. },
  23598. /**
  23599. * @private
  23600. */
  23601. _renderValidatedComponent: function () {
  23602. var renderedElement;
  23603. if ("production" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
  23604. ReactCurrentOwner.current = this;
  23605. try {
  23606. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  23607. } finally {
  23608. ReactCurrentOwner.current = null;
  23609. }
  23610. } else {
  23611. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  23612. }
  23613. !(
  23614. // TODO: An `isValidNode` function would probably be more appropriate
  23615. 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;
  23616. return renderedElement;
  23617. },
  23618. /**
  23619. * Lazily allocates the refs object and stores `component` as `ref`.
  23620. *
  23621. * @param {string} ref Reference name.
  23622. * @param {component} component Component to store as `ref`.
  23623. * @final
  23624. * @private
  23625. */
  23626. attachRef: function (ref, component) {
  23627. var inst = this.getPublicInstance();
  23628. !(inst != null) ? false ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
  23629. var publicComponentInstance = component.getPublicInstance();
  23630. if (false) {
  23631. var componentName = component && component.getName ? component.getName() : 'a component';
  23632. 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;
  23633. }
  23634. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  23635. refs[ref] = publicComponentInstance;
  23636. },
  23637. /**
  23638. * Detaches a reference name.
  23639. *
  23640. * @param {string} ref Name to dereference.
  23641. * @final
  23642. * @private
  23643. */
  23644. detachRef: function (ref) {
  23645. var refs = this.getPublicInstance().refs;
  23646. delete refs[ref];
  23647. },
  23648. /**
  23649. * Get a text description of the component that can be used to identify it
  23650. * in error messages.
  23651. * @return {string} The name or null.
  23652. * @internal
  23653. */
  23654. getName: function () {
  23655. var type = this._currentElement.type;
  23656. var constructor = this._instance && this._instance.constructor;
  23657. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  23658. },
  23659. /**
  23660. * Get the publicly accessible representation of this component - i.e. what
  23661. * is exposed by refs and returned by render. Can be null for stateless
  23662. * components.
  23663. *
  23664. * @return {ReactComponent} the public component instance.
  23665. * @internal
  23666. */
  23667. getPublicInstance: function () {
  23668. var inst = this._instance;
  23669. if (this._compositeType === CompositeTypes.StatelessFunctional) {
  23670. return null;
  23671. }
  23672. return inst;
  23673. },
  23674. // Stub
  23675. _instantiateReactComponent: null
  23676. };
  23677. module.exports = ReactCompositeComponent;
  23678. /***/ }),
  23679. /* 162 */
  23680. /***/ (function(module, exports, __webpack_require__) {
  23681. "use strict";
  23682. /**
  23683. * Copyright 2013-present, Facebook, Inc.
  23684. * All rights reserved.
  23685. *
  23686. * This source code is licensed under the BSD-style license found in the
  23687. * LICENSE file in the root directory of this source tree. An additional grant
  23688. * of patent rights can be found in the PATENTS file in the same directory.
  23689. *
  23690. */
  23691. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  23692. var ReactDOMComponentTree = __webpack_require__(5);
  23693. var ReactDefaultInjection = __webpack_require__(175);
  23694. var ReactMount = __webpack_require__(84);
  23695. var ReactReconciler = __webpack_require__(20);
  23696. var ReactUpdates = __webpack_require__(12);
  23697. var ReactVersion = __webpack_require__(188);
  23698. var findDOMNode = __webpack_require__(204);
  23699. var getHostComponentFromComposite = __webpack_require__(89);
  23700. var renderSubtreeIntoContainer = __webpack_require__(212);
  23701. var warning = __webpack_require__(1);
  23702. ReactDefaultInjection.inject();
  23703. var ReactDOM = {
  23704. findDOMNode: findDOMNode,
  23705. render: ReactMount.render,
  23706. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  23707. version: ReactVersion,
  23708. /* eslint-disable camelcase */
  23709. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  23710. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  23711. };
  23712. // Inject the runtime into a devtools global hook regardless of browser.
  23713. // Allows for debugging when the hook is injected on the page.
  23714. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  23715. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  23716. ComponentTree: {
  23717. getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
  23718. getNodeFromInstance: function (inst) {
  23719. // inst is an internal instance (but could be a composite)
  23720. if (inst._renderedComponent) {
  23721. inst = getHostComponentFromComposite(inst);
  23722. }
  23723. if (inst) {
  23724. return ReactDOMComponentTree.getNodeFromInstance(inst);
  23725. } else {
  23726. return null;
  23727. }
  23728. }
  23729. },
  23730. Mount: ReactMount,
  23731. Reconciler: ReactReconciler
  23732. });
  23733. }
  23734. if (false) {
  23735. var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
  23736. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  23737. // First check if devtools is not installed
  23738. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  23739. // If we're in Chrome or Firefox, provide a download link if not installed.
  23740. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  23741. // Firefox does not have the issue with devtools loaded over file://
  23742. var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
  23743. 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');
  23744. }
  23745. }
  23746. var testFunc = function testFn() {};
  23747. 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;
  23748. // If we're in IE8, check to see if we are in compatibility mode and provide
  23749. // information on preventing compatibility mode
  23750. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  23751. 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;
  23752. var expectedFeatures = [
  23753. // shims
  23754. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
  23755. for (var i = 0; i < expectedFeatures.length; i++) {
  23756. if (!expectedFeatures[i]) {
  23757. 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;
  23758. break;
  23759. }
  23760. }
  23761. }
  23762. }
  23763. if (false) {
  23764. var ReactInstrumentation = require('./ReactInstrumentation');
  23765. var ReactDOMUnknownPropertyHook = require('./ReactDOMUnknownPropertyHook');
  23766. var ReactDOMNullInputValuePropHook = require('./ReactDOMNullInputValuePropHook');
  23767. var ReactDOMInvalidARIAHook = require('./ReactDOMInvalidARIAHook');
  23768. ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
  23769. ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
  23770. ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
  23771. }
  23772. module.exports = ReactDOM;
  23773. /***/ }),
  23774. /* 163 */
  23775. /***/ (function(module, exports, __webpack_require__) {
  23776. "use strict";
  23777. /**
  23778. * Copyright 2013-present, Facebook, Inc.
  23779. * All rights reserved.
  23780. *
  23781. * This source code is licensed under the BSD-style license found in the
  23782. * LICENSE file in the root directory of this source tree. An additional grant
  23783. * of patent rights can be found in the PATENTS file in the same directory.
  23784. *
  23785. */
  23786. /* global hasOwnProperty:true */
  23787. var _prodInvariant = __webpack_require__(2),
  23788. _assign = __webpack_require__(3);
  23789. var AutoFocusUtils = __webpack_require__(150);
  23790. var CSSPropertyOperations = __webpack_require__(152);
  23791. var DOMLazyTree = __webpack_require__(18);
  23792. var DOMNamespaces = __webpack_require__(52);
  23793. var DOMProperty = __webpack_require__(19);
  23794. var DOMPropertyOperations = __webpack_require__(77);
  23795. var EventPluginHub = __webpack_require__(26);
  23796. var EventPluginRegistry = __webpack_require__(53);
  23797. var ReactBrowserEventEmitter = __webpack_require__(31);
  23798. var ReactDOMComponentFlags = __webpack_require__(78);
  23799. var ReactDOMComponentTree = __webpack_require__(5);
  23800. var ReactDOMInput = __webpack_require__(168);
  23801. var ReactDOMOption = __webpack_require__(169);
  23802. var ReactDOMSelect = __webpack_require__(79);
  23803. var ReactDOMTextarea = __webpack_require__(172);
  23804. var ReactInstrumentation = __webpack_require__(11);
  23805. var ReactMultiChild = __webpack_require__(181);
  23806. var ReactServerRenderingTransaction = __webpack_require__(186);
  23807. var emptyFunction = __webpack_require__(10);
  23808. var escapeTextContentForBrowser = __webpack_require__(34);
  23809. var invariant = __webpack_require__(0);
  23810. var isEventSupported = __webpack_require__(64);
  23811. var shallowEqual = __webpack_require__(50);
  23812. var validateDOMNesting = __webpack_require__(66);
  23813. var warning = __webpack_require__(1);
  23814. var Flags = ReactDOMComponentFlags;
  23815. var deleteListener = EventPluginHub.deleteListener;
  23816. var getNode = ReactDOMComponentTree.getNodeFromInstance;
  23817. var listenTo = ReactBrowserEventEmitter.listenTo;
  23818. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  23819. // For quickly matching children type, to test if can be treated as content.
  23820. var CONTENT_TYPES = { 'string': true, 'number': true };
  23821. var STYLE = 'style';
  23822. var HTML = '__html';
  23823. var RESERVED_PROPS = {
  23824. children: null,
  23825. dangerouslySetInnerHTML: null,
  23826. suppressContentEditableWarning: null
  23827. };
  23828. // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
  23829. var DOC_FRAGMENT_TYPE = 11;
  23830. function getDeclarationErrorAddendum(internalInstance) {
  23831. if (internalInstance) {
  23832. var owner = internalInstance._currentElement._owner || null;
  23833. if (owner) {
  23834. var name = owner.getName();
  23835. if (name) {
  23836. return ' This DOM node was rendered by `' + name + '`.';
  23837. }
  23838. }
  23839. }
  23840. return '';
  23841. }
  23842. function friendlyStringify(obj) {
  23843. if (typeof obj === 'object') {
  23844. if (Array.isArray(obj)) {
  23845. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  23846. } else {
  23847. var pairs = [];
  23848. for (var key in obj) {
  23849. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  23850. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  23851. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  23852. }
  23853. }
  23854. return '{' + pairs.join(', ') + '}';
  23855. }
  23856. } else if (typeof obj === 'string') {
  23857. return JSON.stringify(obj);
  23858. } else if (typeof obj === 'function') {
  23859. return '[function object]';
  23860. }
  23861. // Differs from JSON.stringify in that undefined because undefined and that
  23862. // inf and nan don't become null
  23863. return String(obj);
  23864. }
  23865. var styleMutationWarning = {};
  23866. function checkAndWarnForMutatedStyle(style1, style2, component) {
  23867. if (style1 == null || style2 == null) {
  23868. return;
  23869. }
  23870. if (shallowEqual(style1, style2)) {
  23871. return;
  23872. }
  23873. var componentName = component._tag;
  23874. var owner = component._currentElement._owner;
  23875. var ownerName;
  23876. if (owner) {
  23877. ownerName = owner.getName();
  23878. }
  23879. var hash = ownerName + '|' + componentName;
  23880. if (styleMutationWarning.hasOwnProperty(hash)) {
  23881. return;
  23882. }
  23883. styleMutationWarning[hash] = true;
  23884. 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;
  23885. }
  23886. /**
  23887. * @param {object} component
  23888. * @param {?object} props
  23889. */
  23890. function assertValidProps(component, props) {
  23891. if (!props) {
  23892. return;
  23893. }
  23894. // Note the use of `==` which checks for null or undefined.
  23895. if (voidElementTags[component._tag]) {
  23896. !(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;
  23897. }
  23898. if (props.dangerouslySetInnerHTML != null) {
  23899. !(props.children == null) ? false ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
  23900. !(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;
  23901. }
  23902. if (false) {
  23903. 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;
  23904. 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;
  23905. 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;
  23906. }
  23907. !(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;
  23908. }
  23909. function enqueuePutListener(inst, registrationName, listener, transaction) {
  23910. if (transaction instanceof ReactServerRenderingTransaction) {
  23911. return;
  23912. }
  23913. if (false) {
  23914. // IE8 has no API for event capturing and the `onScroll` event doesn't
  23915. // bubble.
  23916. process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
  23917. }
  23918. var containerInfo = inst._hostContainerInfo;
  23919. var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
  23920. var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
  23921. listenTo(registrationName, doc);
  23922. transaction.getReactMountReady().enqueue(putListener, {
  23923. inst: inst,
  23924. registrationName: registrationName,
  23925. listener: listener
  23926. });
  23927. }
  23928. function putListener() {
  23929. var listenerToPut = this;
  23930. EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
  23931. }
  23932. function inputPostMount() {
  23933. var inst = this;
  23934. ReactDOMInput.postMountWrapper(inst);
  23935. }
  23936. function textareaPostMount() {
  23937. var inst = this;
  23938. ReactDOMTextarea.postMountWrapper(inst);
  23939. }
  23940. function optionPostMount() {
  23941. var inst = this;
  23942. ReactDOMOption.postMountWrapper(inst);
  23943. }
  23944. var setAndValidateContentChildDev = emptyFunction;
  23945. if (false) {
  23946. setAndValidateContentChildDev = function (content) {
  23947. var hasExistingContent = this._contentDebugID != null;
  23948. var debugID = this._debugID;
  23949. // This ID represents the inlined child that has no backing instance:
  23950. var contentDebugID = -debugID;
  23951. if (content == null) {
  23952. if (hasExistingContent) {
  23953. ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
  23954. }
  23955. this._contentDebugID = null;
  23956. return;
  23957. }
  23958. validateDOMNesting(null, String(content), this, this._ancestorInfo);
  23959. this._contentDebugID = contentDebugID;
  23960. if (hasExistingContent) {
  23961. ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
  23962. ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
  23963. } else {
  23964. ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
  23965. ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
  23966. ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
  23967. }
  23968. };
  23969. }
  23970. // There are so many media events, it makes sense to just
  23971. // maintain a list rather than create a `trapBubbledEvent` for each
  23972. var mediaEvents = {
  23973. topAbort: 'abort',
  23974. topCanPlay: 'canplay',
  23975. topCanPlayThrough: 'canplaythrough',
  23976. topDurationChange: 'durationchange',
  23977. topEmptied: 'emptied',
  23978. topEncrypted: 'encrypted',
  23979. topEnded: 'ended',
  23980. topError: 'error',
  23981. topLoadedData: 'loadeddata',
  23982. topLoadedMetadata: 'loadedmetadata',
  23983. topLoadStart: 'loadstart',
  23984. topPause: 'pause',
  23985. topPlay: 'play',
  23986. topPlaying: 'playing',
  23987. topProgress: 'progress',
  23988. topRateChange: 'ratechange',
  23989. topSeeked: 'seeked',
  23990. topSeeking: 'seeking',
  23991. topStalled: 'stalled',
  23992. topSuspend: 'suspend',
  23993. topTimeUpdate: 'timeupdate',
  23994. topVolumeChange: 'volumechange',
  23995. topWaiting: 'waiting'
  23996. };
  23997. function trapBubbledEventsLocal() {
  23998. var inst = this;
  23999. // If a component renders to null or if another component fatals and causes
  24000. // the state of the tree to be corrupted, `node` here can be null.
  24001. !inst._rootNodeID ? false ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
  24002. var node = getNode(inst);
  24003. !node ? false ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
  24004. switch (inst._tag) {
  24005. case 'iframe':
  24006. case 'object':
  24007. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24008. break;
  24009. case 'video':
  24010. case 'audio':
  24011. inst._wrapperState.listeners = [];
  24012. // Create listener for each media event
  24013. for (var event in mediaEvents) {
  24014. if (mediaEvents.hasOwnProperty(event)) {
  24015. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
  24016. }
  24017. }
  24018. break;
  24019. case 'source':
  24020. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
  24021. break;
  24022. case 'img':
  24023. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24024. break;
  24025. case 'form':
  24026. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
  24027. break;
  24028. case 'input':
  24029. case 'select':
  24030. case 'textarea':
  24031. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
  24032. break;
  24033. }
  24034. }
  24035. function postUpdateSelectWrapper() {
  24036. ReactDOMSelect.postUpdateWrapper(this);
  24037. }
  24038. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  24039. // those special-case tags.
  24040. var omittedCloseTags = {
  24041. 'area': true,
  24042. 'base': true,
  24043. 'br': true,
  24044. 'col': true,
  24045. 'embed': true,
  24046. 'hr': true,
  24047. 'img': true,
  24048. 'input': true,
  24049. 'keygen': true,
  24050. 'link': true,
  24051. 'meta': true,
  24052. 'param': true,
  24053. 'source': true,
  24054. 'track': true,
  24055. 'wbr': true
  24056. };
  24057. var newlineEatingTags = {
  24058. 'listing': true,
  24059. 'pre': true,
  24060. 'textarea': true
  24061. };
  24062. // For HTML, certain tags cannot have children. This has the same purpose as
  24063. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  24064. var voidElementTags = _assign({
  24065. 'menuitem': true
  24066. }, omittedCloseTags);
  24067. // We accept any tag to be rendered but since this gets injected into arbitrary
  24068. // HTML, we want to make sure that it's a safe tag.
  24069. // http://www.w3.org/TR/REC-xml/#NT-Name
  24070. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  24071. var validatedTagCache = {};
  24072. var hasOwnProperty = {}.hasOwnProperty;
  24073. function validateDangerousTag(tag) {
  24074. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  24075. !VALID_TAG_REGEX.test(tag) ? false ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
  24076. validatedTagCache[tag] = true;
  24077. }
  24078. }
  24079. function isCustomComponent(tagName, props) {
  24080. return tagName.indexOf('-') >= 0 || props.is != null;
  24081. }
  24082. var globalIdCounter = 1;
  24083. /**
  24084. * Creates a new React class that is idempotent and capable of containing other
  24085. * React components. It accepts event listeners and DOM properties that are
  24086. * valid according to `DOMProperty`.
  24087. *
  24088. * - Event listeners: `onClick`, `onMouseDown`, etc.
  24089. * - DOM properties: `className`, `name`, `title`, etc.
  24090. *
  24091. * The `style` property functions differently from the DOM API. It accepts an
  24092. * object mapping of style properties to values.
  24093. *
  24094. * @constructor ReactDOMComponent
  24095. * @extends ReactMultiChild
  24096. */
  24097. function ReactDOMComponent(element) {
  24098. var tag = element.type;
  24099. validateDangerousTag(tag);
  24100. this._currentElement = element;
  24101. this._tag = tag.toLowerCase();
  24102. this._namespaceURI = null;
  24103. this._renderedChildren = null;
  24104. this._previousStyle = null;
  24105. this._previousStyleCopy = null;
  24106. this._hostNode = null;
  24107. this._hostParent = null;
  24108. this._rootNodeID = 0;
  24109. this._domID = 0;
  24110. this._hostContainerInfo = null;
  24111. this._wrapperState = null;
  24112. this._topLevelWrapper = null;
  24113. this._flags = 0;
  24114. if (false) {
  24115. this._ancestorInfo = null;
  24116. setAndValidateContentChildDev.call(this, null);
  24117. }
  24118. }
  24119. ReactDOMComponent.displayName = 'ReactDOMComponent';
  24120. ReactDOMComponent.Mixin = {
  24121. /**
  24122. * Generates root tag markup then recurses. This method has side effects and
  24123. * is not idempotent.
  24124. *
  24125. * @internal
  24126. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24127. * @param {?ReactDOMComponent} the parent component instance
  24128. * @param {?object} info about the host container
  24129. * @param {object} context
  24130. * @return {string} The computed markup.
  24131. */
  24132. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  24133. this._rootNodeID = globalIdCounter++;
  24134. this._domID = hostContainerInfo._idCounter++;
  24135. this._hostParent = hostParent;
  24136. this._hostContainerInfo = hostContainerInfo;
  24137. var props = this._currentElement.props;
  24138. switch (this._tag) {
  24139. case 'audio':
  24140. case 'form':
  24141. case 'iframe':
  24142. case 'img':
  24143. case 'link':
  24144. case 'object':
  24145. case 'source':
  24146. case 'video':
  24147. this._wrapperState = {
  24148. listeners: null
  24149. };
  24150. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24151. break;
  24152. case 'input':
  24153. ReactDOMInput.mountWrapper(this, props, hostParent);
  24154. props = ReactDOMInput.getHostProps(this, props);
  24155. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24156. break;
  24157. case 'option':
  24158. ReactDOMOption.mountWrapper(this, props, hostParent);
  24159. props = ReactDOMOption.getHostProps(this, props);
  24160. break;
  24161. case 'select':
  24162. ReactDOMSelect.mountWrapper(this, props, hostParent);
  24163. props = ReactDOMSelect.getHostProps(this, props);
  24164. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24165. break;
  24166. case 'textarea':
  24167. ReactDOMTextarea.mountWrapper(this, props, hostParent);
  24168. props = ReactDOMTextarea.getHostProps(this, props);
  24169. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24170. break;
  24171. }
  24172. assertValidProps(this, props);
  24173. // We create tags in the namespace of their parent container, except HTML
  24174. // tags get no namespace.
  24175. var namespaceURI;
  24176. var parentTag;
  24177. if (hostParent != null) {
  24178. namespaceURI = hostParent._namespaceURI;
  24179. parentTag = hostParent._tag;
  24180. } else if (hostContainerInfo._tag) {
  24181. namespaceURI = hostContainerInfo._namespaceURI;
  24182. parentTag = hostContainerInfo._tag;
  24183. }
  24184. if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
  24185. namespaceURI = DOMNamespaces.html;
  24186. }
  24187. if (namespaceURI === DOMNamespaces.html) {
  24188. if (this._tag === 'svg') {
  24189. namespaceURI = DOMNamespaces.svg;
  24190. } else if (this._tag === 'math') {
  24191. namespaceURI = DOMNamespaces.mathml;
  24192. }
  24193. }
  24194. this._namespaceURI = namespaceURI;
  24195. if (false) {
  24196. var parentInfo;
  24197. if (hostParent != null) {
  24198. parentInfo = hostParent._ancestorInfo;
  24199. } else if (hostContainerInfo._tag) {
  24200. parentInfo = hostContainerInfo._ancestorInfo;
  24201. }
  24202. if (parentInfo) {
  24203. // parentInfo should always be present except for the top-level
  24204. // component when server rendering
  24205. validateDOMNesting(this._tag, null, this, parentInfo);
  24206. }
  24207. this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
  24208. }
  24209. var mountImage;
  24210. if (transaction.useCreateElement) {
  24211. var ownerDocument = hostContainerInfo._ownerDocument;
  24212. var el;
  24213. if (namespaceURI === DOMNamespaces.html) {
  24214. if (this._tag === 'script') {
  24215. // Create the script via .innerHTML so its "parser-inserted" flag is
  24216. // set to true and it does not execute
  24217. var div = ownerDocument.createElement('div');
  24218. var type = this._currentElement.type;
  24219. div.innerHTML = '<' + type + '></' + type + '>';
  24220. el = div.removeChild(div.firstChild);
  24221. } else if (props.is) {
  24222. el = ownerDocument.createElement(this._currentElement.type, props.is);
  24223. } else {
  24224. // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
  24225. // See discussion in https://github.com/facebook/react/pull/6896
  24226. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  24227. el = ownerDocument.createElement(this._currentElement.type);
  24228. }
  24229. } else {
  24230. el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
  24231. }
  24232. ReactDOMComponentTree.precacheNode(this, el);
  24233. this._flags |= Flags.hasCachedChildNodes;
  24234. if (!this._hostParent) {
  24235. DOMPropertyOperations.setAttributeForRoot(el);
  24236. }
  24237. this._updateDOMProperties(null, props, transaction);
  24238. var lazyTree = DOMLazyTree(el);
  24239. this._createInitialChildren(transaction, props, context, lazyTree);
  24240. mountImage = lazyTree;
  24241. } else {
  24242. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  24243. var tagContent = this._createContentMarkup(transaction, props, context);
  24244. if (!tagContent && omittedCloseTags[this._tag]) {
  24245. mountImage = tagOpen + '/>';
  24246. } else {
  24247. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  24248. }
  24249. }
  24250. switch (this._tag) {
  24251. case 'input':
  24252. transaction.getReactMountReady().enqueue(inputPostMount, this);
  24253. if (props.autoFocus) {
  24254. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24255. }
  24256. break;
  24257. case 'textarea':
  24258. transaction.getReactMountReady().enqueue(textareaPostMount, this);
  24259. if (props.autoFocus) {
  24260. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24261. }
  24262. break;
  24263. case 'select':
  24264. if (props.autoFocus) {
  24265. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24266. }
  24267. break;
  24268. case 'button':
  24269. if (props.autoFocus) {
  24270. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24271. }
  24272. break;
  24273. case 'option':
  24274. transaction.getReactMountReady().enqueue(optionPostMount, this);
  24275. break;
  24276. }
  24277. return mountImage;
  24278. },
  24279. /**
  24280. * Creates markup for the open tag and all attributes.
  24281. *
  24282. * This method has side effects because events get registered.
  24283. *
  24284. * Iterating over object properties is faster than iterating over arrays.
  24285. * @see http://jsperf.com/obj-vs-arr-iteration
  24286. *
  24287. * @private
  24288. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24289. * @param {object} props
  24290. * @return {string} Markup of opening tag.
  24291. */
  24292. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  24293. var ret = '<' + this._currentElement.type;
  24294. for (var propKey in props) {
  24295. if (!props.hasOwnProperty(propKey)) {
  24296. continue;
  24297. }
  24298. var propValue = props[propKey];
  24299. if (propValue == null) {
  24300. continue;
  24301. }
  24302. if (registrationNameModules.hasOwnProperty(propKey)) {
  24303. if (propValue) {
  24304. enqueuePutListener(this, propKey, propValue, transaction);
  24305. }
  24306. } else {
  24307. if (propKey === STYLE) {
  24308. if (propValue) {
  24309. if (false) {
  24310. // See `_updateDOMProperties`. style block
  24311. this._previousStyle = propValue;
  24312. }
  24313. propValue = this._previousStyleCopy = _assign({}, props.style);
  24314. }
  24315. propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
  24316. }
  24317. var markup = null;
  24318. if (this._tag != null && isCustomComponent(this._tag, props)) {
  24319. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24320. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  24321. }
  24322. } else {
  24323. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  24324. }
  24325. if (markup) {
  24326. ret += ' ' + markup;
  24327. }
  24328. }
  24329. }
  24330. // For static pages, no need to put React ID and checksum. Saves lots of
  24331. // bytes.
  24332. if (transaction.renderToStaticMarkup) {
  24333. return ret;
  24334. }
  24335. if (!this._hostParent) {
  24336. ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
  24337. }
  24338. ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
  24339. return ret;
  24340. },
  24341. /**
  24342. * Creates markup for the content between the tags.
  24343. *
  24344. * @private
  24345. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24346. * @param {object} props
  24347. * @param {object} context
  24348. * @return {string} Content markup.
  24349. */
  24350. _createContentMarkup: function (transaction, props, context) {
  24351. var ret = '';
  24352. // Intentional use of != to avoid catching zero/false.
  24353. var innerHTML = props.dangerouslySetInnerHTML;
  24354. if (innerHTML != null) {
  24355. if (innerHTML.__html != null) {
  24356. ret = innerHTML.__html;
  24357. }
  24358. } else {
  24359. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24360. var childrenToUse = contentToUse != null ? null : props.children;
  24361. if (contentToUse != null) {
  24362. // TODO: Validate that text is allowed as a child of this node
  24363. ret = escapeTextContentForBrowser(contentToUse);
  24364. if (false) {
  24365. setAndValidateContentChildDev.call(this, contentToUse);
  24366. }
  24367. } else if (childrenToUse != null) {
  24368. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24369. ret = mountImages.join('');
  24370. }
  24371. }
  24372. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  24373. // text/html ignores the first character in these tags if it's a newline
  24374. // Prefer to break application/xml over text/html (for now) by adding
  24375. // a newline specifically to get eaten by the parser. (Alternately for
  24376. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  24377. // \r is normalized out by HTMLTextAreaElement#value.)
  24378. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  24379. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  24380. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  24381. // See: Parsing of "textarea" "listing" and "pre" elements
  24382. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  24383. return '\n' + ret;
  24384. } else {
  24385. return ret;
  24386. }
  24387. },
  24388. _createInitialChildren: function (transaction, props, context, lazyTree) {
  24389. // Intentional use of != to avoid catching zero/false.
  24390. var innerHTML = props.dangerouslySetInnerHTML;
  24391. if (innerHTML != null) {
  24392. if (innerHTML.__html != null) {
  24393. DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
  24394. }
  24395. } else {
  24396. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24397. var childrenToUse = contentToUse != null ? null : props.children;
  24398. // TODO: Validate that text is allowed as a child of this node
  24399. if (contentToUse != null) {
  24400. // Avoid setting textContent when the text is empty. In IE11 setting
  24401. // textContent on a text area will cause the placeholder to not
  24402. // show within the textarea until it has been focused and blurred again.
  24403. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  24404. if (contentToUse !== '') {
  24405. if (false) {
  24406. setAndValidateContentChildDev.call(this, contentToUse);
  24407. }
  24408. DOMLazyTree.queueText(lazyTree, contentToUse);
  24409. }
  24410. } else if (childrenToUse != null) {
  24411. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24412. for (var i = 0; i < mountImages.length; i++) {
  24413. DOMLazyTree.queueChild(lazyTree, mountImages[i]);
  24414. }
  24415. }
  24416. }
  24417. },
  24418. /**
  24419. * Receives a next element and updates the component.
  24420. *
  24421. * @internal
  24422. * @param {ReactElement} nextElement
  24423. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24424. * @param {object} context
  24425. */
  24426. receiveComponent: function (nextElement, transaction, context) {
  24427. var prevElement = this._currentElement;
  24428. this._currentElement = nextElement;
  24429. this.updateComponent(transaction, prevElement, nextElement, context);
  24430. },
  24431. /**
  24432. * Updates a DOM component after it has already been allocated and
  24433. * attached to the DOM. Reconciles the root DOM node, then recurses.
  24434. *
  24435. * @param {ReactReconcileTransaction} transaction
  24436. * @param {ReactElement} prevElement
  24437. * @param {ReactElement} nextElement
  24438. * @internal
  24439. * @overridable
  24440. */
  24441. updateComponent: function (transaction, prevElement, nextElement, context) {
  24442. var lastProps = prevElement.props;
  24443. var nextProps = this._currentElement.props;
  24444. switch (this._tag) {
  24445. case 'input':
  24446. lastProps = ReactDOMInput.getHostProps(this, lastProps);
  24447. nextProps = ReactDOMInput.getHostProps(this, nextProps);
  24448. break;
  24449. case 'option':
  24450. lastProps = ReactDOMOption.getHostProps(this, lastProps);
  24451. nextProps = ReactDOMOption.getHostProps(this, nextProps);
  24452. break;
  24453. case 'select':
  24454. lastProps = ReactDOMSelect.getHostProps(this, lastProps);
  24455. nextProps = ReactDOMSelect.getHostProps(this, nextProps);
  24456. break;
  24457. case 'textarea':
  24458. lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
  24459. nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
  24460. break;
  24461. }
  24462. assertValidProps(this, nextProps);
  24463. this._updateDOMProperties(lastProps, nextProps, transaction);
  24464. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  24465. switch (this._tag) {
  24466. case 'input':
  24467. // Update the wrapper around inputs *after* updating props. This has to
  24468. // happen after `_updateDOMProperties`. Otherwise HTML5 input validations
  24469. // raise warnings and prevent the new value from being assigned.
  24470. ReactDOMInput.updateWrapper(this);
  24471. break;
  24472. case 'textarea':
  24473. ReactDOMTextarea.updateWrapper(this);
  24474. break;
  24475. case 'select':
  24476. // <select> value update needs to occur after <option> children
  24477. // reconciliation
  24478. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  24479. break;
  24480. }
  24481. },
  24482. /**
  24483. * Reconciles the properties by detecting differences in property values and
  24484. * updating the DOM as necessary. This function is probably the single most
  24485. * critical path for performance optimization.
  24486. *
  24487. * TODO: Benchmark whether checking for changed values in memory actually
  24488. * improves performance (especially statically positioned elements).
  24489. * TODO: Benchmark the effects of putting this at the top since 99% of props
  24490. * do not change for a given reconciliation.
  24491. * TODO: Benchmark areas that can be improved with caching.
  24492. *
  24493. * @private
  24494. * @param {object} lastProps
  24495. * @param {object} nextProps
  24496. * @param {?DOMElement} node
  24497. */
  24498. _updateDOMProperties: function (lastProps, nextProps, transaction) {
  24499. var propKey;
  24500. var styleName;
  24501. var styleUpdates;
  24502. for (propKey in lastProps) {
  24503. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  24504. continue;
  24505. }
  24506. if (propKey === STYLE) {
  24507. var lastStyle = this._previousStyleCopy;
  24508. for (styleName in lastStyle) {
  24509. if (lastStyle.hasOwnProperty(styleName)) {
  24510. styleUpdates = styleUpdates || {};
  24511. styleUpdates[styleName] = '';
  24512. }
  24513. }
  24514. this._previousStyleCopy = null;
  24515. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  24516. if (lastProps[propKey]) {
  24517. // Only call deleteListener if there was a listener previously or
  24518. // else willDeleteListener gets called when there wasn't actually a
  24519. // listener (e.g., onClick={null})
  24520. deleteListener(this, propKey);
  24521. }
  24522. } else if (isCustomComponent(this._tag, lastProps)) {
  24523. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24524. DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
  24525. }
  24526. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  24527. DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
  24528. }
  24529. }
  24530. for (propKey in nextProps) {
  24531. var nextProp = nextProps[propKey];
  24532. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
  24533. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  24534. continue;
  24535. }
  24536. if (propKey === STYLE) {
  24537. if (nextProp) {
  24538. if (false) {
  24539. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  24540. this._previousStyle = nextProp;
  24541. }
  24542. nextProp = this._previousStyleCopy = _assign({}, nextProp);
  24543. } else {
  24544. this._previousStyleCopy = null;
  24545. }
  24546. if (lastProp) {
  24547. // Unset styles on `lastProp` but not on `nextProp`.
  24548. for (styleName in lastProp) {
  24549. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  24550. styleUpdates = styleUpdates || {};
  24551. styleUpdates[styleName] = '';
  24552. }
  24553. }
  24554. // Update styles that changed since `lastProp`.
  24555. for (styleName in nextProp) {
  24556. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  24557. styleUpdates = styleUpdates || {};
  24558. styleUpdates[styleName] = nextProp[styleName];
  24559. }
  24560. }
  24561. } else {
  24562. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  24563. styleUpdates = nextProp;
  24564. }
  24565. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  24566. if (nextProp) {
  24567. enqueuePutListener(this, propKey, nextProp, transaction);
  24568. } else if (lastProp) {
  24569. deleteListener(this, propKey);
  24570. }
  24571. } else if (isCustomComponent(this._tag, nextProps)) {
  24572. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24573. DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
  24574. }
  24575. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  24576. var node = getNode(this);
  24577. // If we're updating to null or undefined, we should remove the property
  24578. // from the DOM node instead of inadvertently setting to a string. This
  24579. // brings us in line with the same behavior we have on initial render.
  24580. if (nextProp != null) {
  24581. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  24582. } else {
  24583. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  24584. }
  24585. }
  24586. }
  24587. if (styleUpdates) {
  24588. CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
  24589. }
  24590. },
  24591. /**
  24592. * Reconciles the children with the various properties that affect the
  24593. * children content.
  24594. *
  24595. * @param {object} lastProps
  24596. * @param {object} nextProps
  24597. * @param {ReactReconcileTransaction} transaction
  24598. * @param {object} context
  24599. */
  24600. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  24601. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  24602. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  24603. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  24604. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  24605. // Note the use of `!=` which checks for null or undefined.
  24606. var lastChildren = lastContent != null ? null : lastProps.children;
  24607. var nextChildren = nextContent != null ? null : nextProps.children;
  24608. // If we're switching from children to content/html or vice versa, remove
  24609. // the old content
  24610. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  24611. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  24612. if (lastChildren != null && nextChildren == null) {
  24613. this.updateChildren(null, transaction, context);
  24614. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  24615. this.updateTextContent('');
  24616. if (false) {
  24617. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  24618. }
  24619. }
  24620. if (nextContent != null) {
  24621. if (lastContent !== nextContent) {
  24622. this.updateTextContent('' + nextContent);
  24623. if (false) {
  24624. setAndValidateContentChildDev.call(this, nextContent);
  24625. }
  24626. }
  24627. } else if (nextHtml != null) {
  24628. if (lastHtml !== nextHtml) {
  24629. this.updateMarkup('' + nextHtml);
  24630. }
  24631. if (false) {
  24632. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  24633. }
  24634. } else if (nextChildren != null) {
  24635. if (false) {
  24636. setAndValidateContentChildDev.call(this, null);
  24637. }
  24638. this.updateChildren(nextChildren, transaction, context);
  24639. }
  24640. },
  24641. getHostNode: function () {
  24642. return getNode(this);
  24643. },
  24644. /**
  24645. * Destroys all event registrations for this instance. Does not remove from
  24646. * the DOM. That must be done by the parent.
  24647. *
  24648. * @internal
  24649. */
  24650. unmountComponent: function (safely) {
  24651. switch (this._tag) {
  24652. case 'audio':
  24653. case 'form':
  24654. case 'iframe':
  24655. case 'img':
  24656. case 'link':
  24657. case 'object':
  24658. case 'source':
  24659. case 'video':
  24660. var listeners = this._wrapperState.listeners;
  24661. if (listeners) {
  24662. for (var i = 0; i < listeners.length; i++) {
  24663. listeners[i].remove();
  24664. }
  24665. }
  24666. break;
  24667. case 'html':
  24668. case 'head':
  24669. case 'body':
  24670. /**
  24671. * Components like <html> <head> and <body> can't be removed or added
  24672. * easily in a cross-browser way, however it's valuable to be able to
  24673. * take advantage of React's reconciliation for styling and <title>
  24674. * management. So we just document it and throw in dangerous cases.
  24675. */
  24676. 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;
  24677. break;
  24678. }
  24679. this.unmountChildren(safely);
  24680. ReactDOMComponentTree.uncacheNode(this);
  24681. EventPluginHub.deleteAllListeners(this);
  24682. this._rootNodeID = 0;
  24683. this._domID = 0;
  24684. this._wrapperState = null;
  24685. if (false) {
  24686. setAndValidateContentChildDev.call(this, null);
  24687. }
  24688. },
  24689. getPublicInstance: function () {
  24690. return getNode(this);
  24691. }
  24692. };
  24693. _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  24694. module.exports = ReactDOMComponent;
  24695. /***/ }),
  24696. /* 164 */
  24697. /***/ (function(module, exports, __webpack_require__) {
  24698. "use strict";
  24699. /**
  24700. * Copyright 2013-present, Facebook, Inc.
  24701. * All rights reserved.
  24702. *
  24703. * This source code is licensed under the BSD-style license found in the
  24704. * LICENSE file in the root directory of this source tree. An additional grant
  24705. * of patent rights can be found in the PATENTS file in the same directory.
  24706. *
  24707. */
  24708. var validateDOMNesting = __webpack_require__(66);
  24709. var DOC_NODE_TYPE = 9;
  24710. function ReactDOMContainerInfo(topLevelWrapper, node) {
  24711. var info = {
  24712. _topLevelWrapper: topLevelWrapper,
  24713. _idCounter: 1,
  24714. _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
  24715. _node: node,
  24716. _tag: node ? node.nodeName.toLowerCase() : null,
  24717. _namespaceURI: node ? node.namespaceURI : null
  24718. };
  24719. if (false) {
  24720. info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
  24721. }
  24722. return info;
  24723. }
  24724. module.exports = ReactDOMContainerInfo;
  24725. /***/ }),
  24726. /* 165 */
  24727. /***/ (function(module, exports, __webpack_require__) {
  24728. "use strict";
  24729. /**
  24730. * Copyright 2014-present, Facebook, Inc.
  24731. * All rights reserved.
  24732. *
  24733. * This source code is licensed under the BSD-style license found in the
  24734. * LICENSE file in the root directory of this source tree. An additional grant
  24735. * of patent rights can be found in the PATENTS file in the same directory.
  24736. *
  24737. */
  24738. var _assign = __webpack_require__(3);
  24739. var DOMLazyTree = __webpack_require__(18);
  24740. var ReactDOMComponentTree = __webpack_require__(5);
  24741. var ReactDOMEmptyComponent = function (instantiate) {
  24742. // ReactCompositeComponent uses this:
  24743. this._currentElement = null;
  24744. // ReactDOMComponentTree uses these:
  24745. this._hostNode = null;
  24746. this._hostParent = null;
  24747. this._hostContainerInfo = null;
  24748. this._domID = 0;
  24749. };
  24750. _assign(ReactDOMEmptyComponent.prototype, {
  24751. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  24752. var domID = hostContainerInfo._idCounter++;
  24753. this._domID = domID;
  24754. this._hostParent = hostParent;
  24755. this._hostContainerInfo = hostContainerInfo;
  24756. var nodeValue = ' react-empty: ' + this._domID + ' ';
  24757. if (transaction.useCreateElement) {
  24758. var ownerDocument = hostContainerInfo._ownerDocument;
  24759. var node = ownerDocument.createComment(nodeValue);
  24760. ReactDOMComponentTree.precacheNode(this, node);
  24761. return DOMLazyTree(node);
  24762. } else {
  24763. if (transaction.renderToStaticMarkup) {
  24764. // Normally we'd insert a comment node, but since this is a situation
  24765. // where React won't take over (static pages), we can simply return
  24766. // nothing.
  24767. return '';
  24768. }
  24769. return '<!--' + nodeValue + '-->';
  24770. }
  24771. },
  24772. receiveComponent: function () {},
  24773. getHostNode: function () {
  24774. return ReactDOMComponentTree.getNodeFromInstance(this);
  24775. },
  24776. unmountComponent: function () {
  24777. ReactDOMComponentTree.uncacheNode(this);
  24778. }
  24779. });
  24780. module.exports = ReactDOMEmptyComponent;
  24781. /***/ }),
  24782. /* 166 */
  24783. /***/ (function(module, exports, __webpack_require__) {
  24784. "use strict";
  24785. /**
  24786. * Copyright 2013-present, Facebook, Inc.
  24787. * All rights reserved.
  24788. *
  24789. * This source code is licensed under the BSD-style license found in the
  24790. * LICENSE file in the root directory of this source tree. An additional grant
  24791. * of patent rights can be found in the PATENTS file in the same directory.
  24792. *
  24793. */
  24794. var ReactDOMFeatureFlags = {
  24795. useCreateElement: true,
  24796. useFiber: false
  24797. };
  24798. module.exports = ReactDOMFeatureFlags;
  24799. /***/ }),
  24800. /* 167 */
  24801. /***/ (function(module, exports, __webpack_require__) {
  24802. "use strict";
  24803. /**
  24804. * Copyright 2013-present, Facebook, Inc.
  24805. * All rights reserved.
  24806. *
  24807. * This source code is licensed under the BSD-style license found in the
  24808. * LICENSE file in the root directory of this source tree. An additional grant
  24809. * of patent rights can be found in the PATENTS file in the same directory.
  24810. *
  24811. */
  24812. var DOMChildrenOperations = __webpack_require__(51);
  24813. var ReactDOMComponentTree = __webpack_require__(5);
  24814. /**
  24815. * Operations used to process updates to DOM nodes.
  24816. */
  24817. var ReactDOMIDOperations = {
  24818. /**
  24819. * Updates a component's children by processing a series of updates.
  24820. *
  24821. * @param {array<object>} updates List of update configurations.
  24822. * @internal
  24823. */
  24824. dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
  24825. var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
  24826. DOMChildrenOperations.processUpdates(node, updates);
  24827. }
  24828. };
  24829. module.exports = ReactDOMIDOperations;
  24830. /***/ }),
  24831. /* 168 */
  24832. /***/ (function(module, exports, __webpack_require__) {
  24833. "use strict";
  24834. /**
  24835. * Copyright 2013-present, Facebook, Inc.
  24836. * All rights reserved.
  24837. *
  24838. * This source code is licensed under the BSD-style license found in the
  24839. * LICENSE file in the root directory of this source tree. An additional grant
  24840. * of patent rights can be found in the PATENTS file in the same directory.
  24841. *
  24842. */
  24843. var _prodInvariant = __webpack_require__(2),
  24844. _assign = __webpack_require__(3);
  24845. var DOMPropertyOperations = __webpack_require__(77);
  24846. var LinkedValueUtils = __webpack_require__(56);
  24847. var ReactDOMComponentTree = __webpack_require__(5);
  24848. var ReactUpdates = __webpack_require__(12);
  24849. var invariant = __webpack_require__(0);
  24850. var warning = __webpack_require__(1);
  24851. var didWarnValueLink = false;
  24852. var didWarnCheckedLink = false;
  24853. var didWarnValueDefaultValue = false;
  24854. var didWarnCheckedDefaultChecked = false;
  24855. var didWarnControlledToUncontrolled = false;
  24856. var didWarnUncontrolledToControlled = false;
  24857. function forceUpdateIfMounted() {
  24858. if (this._rootNodeID) {
  24859. // DOM component is still mounted; update
  24860. ReactDOMInput.updateWrapper(this);
  24861. }
  24862. }
  24863. function isControlled(props) {
  24864. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  24865. return usesChecked ? props.checked != null : props.value != null;
  24866. }
  24867. /**
  24868. * Implements an <input> host component that allows setting these optional
  24869. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  24870. *
  24871. * If `checked` or `value` are not supplied (or null/undefined), user actions
  24872. * that affect the checked state or value will trigger updates to the element.
  24873. *
  24874. * If they are supplied (and not null/undefined), the rendered element will not
  24875. * trigger updates to the element. Instead, the props must change in order for
  24876. * the rendered element to be updated.
  24877. *
  24878. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  24879. * with an empty value (or `defaultValue`).
  24880. *
  24881. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  24882. */
  24883. var ReactDOMInput = {
  24884. getHostProps: function (inst, props) {
  24885. var value = LinkedValueUtils.getValue(props);
  24886. var checked = LinkedValueUtils.getChecked(props);
  24887. var hostProps = _assign({
  24888. // Make sure we set .type before any other properties (setting .value
  24889. // before .type means .value is lost in IE11 and below)
  24890. type: undefined,
  24891. // Make sure we set .step before .value (setting .value before .step
  24892. // means .value is rounded on mount, based upon step precision)
  24893. step: undefined,
  24894. // Make sure we set .min & .max before .value (to ensure proper order
  24895. // in corner cases such as min or max deriving from value, e.g. Issue #7170)
  24896. min: undefined,
  24897. max: undefined
  24898. }, props, {
  24899. defaultChecked: undefined,
  24900. defaultValue: undefined,
  24901. value: value != null ? value : inst._wrapperState.initialValue,
  24902. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  24903. onChange: inst._wrapperState.onChange
  24904. });
  24905. return hostProps;
  24906. },
  24907. mountWrapper: function (inst, props) {
  24908. if (false) {
  24909. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  24910. var owner = inst._currentElement._owner;
  24911. if (props.valueLink !== undefined && !didWarnValueLink) {
  24912. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  24913. didWarnValueLink = true;
  24914. }
  24915. if (props.checkedLink !== undefined && !didWarnCheckedLink) {
  24916. process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  24917. didWarnCheckedLink = true;
  24918. }
  24919. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  24920. 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;
  24921. didWarnCheckedDefaultChecked = true;
  24922. }
  24923. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  24924. 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;
  24925. didWarnValueDefaultValue = true;
  24926. }
  24927. }
  24928. var defaultValue = props.defaultValue;
  24929. inst._wrapperState = {
  24930. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  24931. initialValue: props.value != null ? props.value : defaultValue,
  24932. listeners: null,
  24933. onChange: _handleChange.bind(inst)
  24934. };
  24935. if (false) {
  24936. inst._wrapperState.controlled = isControlled(props);
  24937. }
  24938. },
  24939. updateWrapper: function (inst) {
  24940. var props = inst._currentElement.props;
  24941. if (false) {
  24942. var controlled = isControlled(props);
  24943. var owner = inst._currentElement._owner;
  24944. if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  24945. 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;
  24946. didWarnUncontrolledToControlled = true;
  24947. }
  24948. if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  24949. 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;
  24950. didWarnControlledToUncontrolled = true;
  24951. }
  24952. }
  24953. // TODO: Shouldn't this be getChecked(props)?
  24954. var checked = props.checked;
  24955. if (checked != null) {
  24956. DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
  24957. }
  24958. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  24959. var value = LinkedValueUtils.getValue(props);
  24960. if (value != null) {
  24961. // Cast `value` to a string to ensure the value is set correctly. While
  24962. // browsers typically do this as necessary, jsdom doesn't.
  24963. var newValue = '' + value;
  24964. // To avoid side effects (such as losing text selection), only set value if changed
  24965. if (newValue !== node.value) {
  24966. node.value = newValue;
  24967. }
  24968. } else {
  24969. if (props.value == null && props.defaultValue != null) {
  24970. // In Chrome, assigning defaultValue to certain input types triggers input validation.
  24971. // For number inputs, the display value loses trailing decimal points. For email inputs,
  24972. // Chrome raises "The specified value <x> is not a valid email address".
  24973. //
  24974. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  24975. // when the user is inputting text
  24976. //
  24977. // https://github.com/facebook/react/issues/7253
  24978. if (node.defaultValue !== '' + props.defaultValue) {
  24979. node.defaultValue = '' + props.defaultValue;
  24980. }
  24981. }
  24982. if (props.checked == null && props.defaultChecked != null) {
  24983. node.defaultChecked = !!props.defaultChecked;
  24984. }
  24985. }
  24986. },
  24987. postMountWrapper: function (inst) {
  24988. var props = inst._currentElement.props;
  24989. // This is in postMount because we need access to the DOM node, which is not
  24990. // available until after the component has mounted.
  24991. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  24992. // Detach value from defaultValue. We won't do anything if we're working on
  24993. // submit or reset inputs as those values & defaultValues are linked. They
  24994. // are not resetable nodes so this operation doesn't matter and actually
  24995. // removes browser-default values (eg "Submit Query") when no value is
  24996. // provided.
  24997. switch (props.type) {
  24998. case 'submit':
  24999. case 'reset':
  25000. break;
  25001. case 'color':
  25002. case 'date':
  25003. case 'datetime':
  25004. case 'datetime-local':
  25005. case 'month':
  25006. case 'time':
  25007. case 'week':
  25008. // This fixes the no-show issue on iOS Safari and Android Chrome:
  25009. // https://github.com/facebook/react/issues/7233
  25010. node.value = '';
  25011. node.value = node.defaultValue;
  25012. break;
  25013. default:
  25014. node.value = node.value;
  25015. break;
  25016. }
  25017. // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  25018. // this is needed to work around a chrome bug where setting defaultChecked
  25019. // will sometimes influence the value of checked (even after detachment).
  25020. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  25021. // We need to temporarily unset name to avoid disrupting radio button groups.
  25022. var name = node.name;
  25023. if (name !== '') {
  25024. node.name = '';
  25025. }
  25026. node.defaultChecked = !node.defaultChecked;
  25027. node.defaultChecked = !node.defaultChecked;
  25028. if (name !== '') {
  25029. node.name = name;
  25030. }
  25031. }
  25032. };
  25033. function _handleChange(event) {
  25034. var props = this._currentElement.props;
  25035. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25036. // Here we use asap to wait until all updates have propagated, which
  25037. // is important when using controlled components within layers:
  25038. // https://github.com/facebook/react/issues/1698
  25039. ReactUpdates.asap(forceUpdateIfMounted, this);
  25040. var name = props.name;
  25041. if (props.type === 'radio' && name != null) {
  25042. var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
  25043. var queryRoot = rootNode;
  25044. while (queryRoot.parentNode) {
  25045. queryRoot = queryRoot.parentNode;
  25046. }
  25047. // If `rootNode.form` was non-null, then we could try `form.elements`,
  25048. // but that sometimes behaves strangely in IE8. We could also try using
  25049. // `form.getElementsByName`, but that will only return direct children
  25050. // and won't include inputs that use the HTML5 `form=` attribute. Since
  25051. // the input might not even be in a form, let's just use the global
  25052. // `querySelectorAll` to ensure we don't miss anything.
  25053. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  25054. for (var i = 0; i < group.length; i++) {
  25055. var otherNode = group[i];
  25056. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  25057. continue;
  25058. }
  25059. // This will throw if radio buttons rendered by different copies of React
  25060. // and the same name are rendered into the same form (same as #1939).
  25061. // That's probably okay; we don't support it just as we don't support
  25062. // mixing React radio buttons with non-React ones.
  25063. var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
  25064. !otherInstance ? false ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
  25065. // If this is a controlled radio button group, forcing the input that
  25066. // was previously checked to update will cause it to be come re-checked
  25067. // as appropriate.
  25068. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  25069. }
  25070. }
  25071. return returnValue;
  25072. }
  25073. module.exports = ReactDOMInput;
  25074. /***/ }),
  25075. /* 169 */
  25076. /***/ (function(module, exports, __webpack_require__) {
  25077. "use strict";
  25078. /**
  25079. * Copyright 2013-present, Facebook, Inc.
  25080. * All rights reserved.
  25081. *
  25082. * This source code is licensed under the BSD-style license found in the
  25083. * LICENSE file in the root directory of this source tree. An additional grant
  25084. * of patent rights can be found in the PATENTS file in the same directory.
  25085. *
  25086. */
  25087. var _assign = __webpack_require__(3);
  25088. var React = __webpack_require__(21);
  25089. var ReactDOMComponentTree = __webpack_require__(5);
  25090. var ReactDOMSelect = __webpack_require__(79);
  25091. var warning = __webpack_require__(1);
  25092. var didWarnInvalidOptionChildren = false;
  25093. function flattenChildren(children) {
  25094. var content = '';
  25095. // Flatten children and warn if they aren't strings or numbers;
  25096. // invalid types are ignored.
  25097. React.Children.forEach(children, function (child) {
  25098. if (child == null) {
  25099. return;
  25100. }
  25101. if (typeof child === 'string' || typeof child === 'number') {
  25102. content += child;
  25103. } else if (!didWarnInvalidOptionChildren) {
  25104. didWarnInvalidOptionChildren = true;
  25105. false ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
  25106. }
  25107. });
  25108. return content;
  25109. }
  25110. /**
  25111. * Implements an <option> host component that warns when `selected` is set.
  25112. */
  25113. var ReactDOMOption = {
  25114. mountWrapper: function (inst, props, hostParent) {
  25115. // TODO (yungsters): Remove support for `selected` in <option>.
  25116. if (false) {
  25117. 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;
  25118. }
  25119. // Look up whether this option is 'selected'
  25120. var selectValue = null;
  25121. if (hostParent != null) {
  25122. var selectParent = hostParent;
  25123. if (selectParent._tag === 'optgroup') {
  25124. selectParent = selectParent._hostParent;
  25125. }
  25126. if (selectParent != null && selectParent._tag === 'select') {
  25127. selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
  25128. }
  25129. }
  25130. // If the value is null (e.g., no specified value or after initial mount)
  25131. // or missing (e.g., for <datalist>), we don't change props.selected
  25132. var selected = null;
  25133. if (selectValue != null) {
  25134. var value;
  25135. if (props.value != null) {
  25136. value = props.value + '';
  25137. } else {
  25138. value = flattenChildren(props.children);
  25139. }
  25140. selected = false;
  25141. if (Array.isArray(selectValue)) {
  25142. // multiple
  25143. for (var i = 0; i < selectValue.length; i++) {
  25144. if ('' + selectValue[i] === value) {
  25145. selected = true;
  25146. break;
  25147. }
  25148. }
  25149. } else {
  25150. selected = '' + selectValue === value;
  25151. }
  25152. }
  25153. inst._wrapperState = { selected: selected };
  25154. },
  25155. postMountWrapper: function (inst) {
  25156. // value="" should make a value attribute (#6219)
  25157. var props = inst._currentElement.props;
  25158. if (props.value != null) {
  25159. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25160. node.setAttribute('value', props.value);
  25161. }
  25162. },
  25163. getHostProps: function (inst, props) {
  25164. var hostProps = _assign({ selected: undefined, children: undefined }, props);
  25165. // Read state only from initial mount because <select> updates value
  25166. // manually; we need the initial state only for server rendering
  25167. if (inst._wrapperState.selected != null) {
  25168. hostProps.selected = inst._wrapperState.selected;
  25169. }
  25170. var content = flattenChildren(props.children);
  25171. if (content) {
  25172. hostProps.children = content;
  25173. }
  25174. return hostProps;
  25175. }
  25176. };
  25177. module.exports = ReactDOMOption;
  25178. /***/ }),
  25179. /* 170 */
  25180. /***/ (function(module, exports, __webpack_require__) {
  25181. "use strict";
  25182. /**
  25183. * Copyright 2013-present, Facebook, Inc.
  25184. * All rights reserved.
  25185. *
  25186. * This source code is licensed under the BSD-style license found in the
  25187. * LICENSE file in the root directory of this source tree. An additional grant
  25188. * of patent rights can be found in the PATENTS file in the same directory.
  25189. *
  25190. */
  25191. var ExecutionEnvironment = __webpack_require__(8);
  25192. var getNodeForCharacterOffset = __webpack_require__(209);
  25193. var getTextContentAccessor = __webpack_require__(90);
  25194. /**
  25195. * While `isCollapsed` is available on the Selection object and `collapsed`
  25196. * is available on the Range object, IE11 sometimes gets them wrong.
  25197. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  25198. */
  25199. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  25200. return anchorNode === focusNode && anchorOffset === focusOffset;
  25201. }
  25202. /**
  25203. * Get the appropriate anchor and focus node/offset pairs for IE.
  25204. *
  25205. * The catch here is that IE's selection API doesn't provide information
  25206. * about whether the selection is forward or backward, so we have to
  25207. * behave as though it's always forward.
  25208. *
  25209. * IE text differs from modern selection in that it behaves as though
  25210. * block elements end with a new line. This means character offsets will
  25211. * differ between the two APIs.
  25212. *
  25213. * @param {DOMElement} node
  25214. * @return {object}
  25215. */
  25216. function getIEOffsets(node) {
  25217. var selection = document.selection;
  25218. var selectedRange = selection.createRange();
  25219. var selectedLength = selectedRange.text.length;
  25220. // Duplicate selection so we can move range without breaking user selection.
  25221. var fromStart = selectedRange.duplicate();
  25222. fromStart.moveToElementText(node);
  25223. fromStart.setEndPoint('EndToStart', selectedRange);
  25224. var startOffset = fromStart.text.length;
  25225. var endOffset = startOffset + selectedLength;
  25226. return {
  25227. start: startOffset,
  25228. end: endOffset
  25229. };
  25230. }
  25231. /**
  25232. * @param {DOMElement} node
  25233. * @return {?object}
  25234. */
  25235. function getModernOffsets(node) {
  25236. var selection = window.getSelection && window.getSelection();
  25237. if (!selection || selection.rangeCount === 0) {
  25238. return null;
  25239. }
  25240. var anchorNode = selection.anchorNode;
  25241. var anchorOffset = selection.anchorOffset;
  25242. var focusNode = selection.focusNode;
  25243. var focusOffset = selection.focusOffset;
  25244. var currentRange = selection.getRangeAt(0);
  25245. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  25246. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  25247. // divs do not seem to expose properties, triggering a "Permission denied
  25248. // error" if any of its properties are accessed. The only seemingly possible
  25249. // way to avoid erroring is to access a property that typically works for
  25250. // non-anonymous divs and catch any error that may otherwise arise. See
  25251. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  25252. try {
  25253. /* eslint-disable no-unused-expressions */
  25254. currentRange.startContainer.nodeType;
  25255. currentRange.endContainer.nodeType;
  25256. /* eslint-enable no-unused-expressions */
  25257. } catch (e) {
  25258. return null;
  25259. }
  25260. // If the node and offset values are the same, the selection is collapsed.
  25261. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  25262. // this value wrong.
  25263. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  25264. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  25265. var tempRange = currentRange.cloneRange();
  25266. tempRange.selectNodeContents(node);
  25267. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  25268. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  25269. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  25270. var end = start + rangeLength;
  25271. // Detect whether the selection is backward.
  25272. var detectionRange = document.createRange();
  25273. detectionRange.setStart(anchorNode, anchorOffset);
  25274. detectionRange.setEnd(focusNode, focusOffset);
  25275. var isBackward = detectionRange.collapsed;
  25276. return {
  25277. start: isBackward ? end : start,
  25278. end: isBackward ? start : end
  25279. };
  25280. }
  25281. /**
  25282. * @param {DOMElement|DOMTextNode} node
  25283. * @param {object} offsets
  25284. */
  25285. function setIEOffsets(node, offsets) {
  25286. var range = document.selection.createRange().duplicate();
  25287. var start, end;
  25288. if (offsets.end === undefined) {
  25289. start = offsets.start;
  25290. end = start;
  25291. } else if (offsets.start > offsets.end) {
  25292. start = offsets.end;
  25293. end = offsets.start;
  25294. } else {
  25295. start = offsets.start;
  25296. end = offsets.end;
  25297. }
  25298. range.moveToElementText(node);
  25299. range.moveStart('character', start);
  25300. range.setEndPoint('EndToStart', range);
  25301. range.moveEnd('character', end - start);
  25302. range.select();
  25303. }
  25304. /**
  25305. * In modern non-IE browsers, we can support both forward and backward
  25306. * selections.
  25307. *
  25308. * Note: IE10+ supports the Selection object, but it does not support
  25309. * the `extend` method, which means that even in modern IE, it's not possible
  25310. * to programmatically create a backward selection. Thus, for all IE
  25311. * versions, we use the old IE API to create our selections.
  25312. *
  25313. * @param {DOMElement|DOMTextNode} node
  25314. * @param {object} offsets
  25315. */
  25316. function setModernOffsets(node, offsets) {
  25317. if (!window.getSelection) {
  25318. return;
  25319. }
  25320. var selection = window.getSelection();
  25321. var length = node[getTextContentAccessor()].length;
  25322. var start = Math.min(offsets.start, length);
  25323. var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  25324. // IE 11 uses modern selection, but doesn't support the extend method.
  25325. // Flip backward selections, so we can set with a single range.
  25326. if (!selection.extend && start > end) {
  25327. var temp = end;
  25328. end = start;
  25329. start = temp;
  25330. }
  25331. var startMarker = getNodeForCharacterOffset(node, start);
  25332. var endMarker = getNodeForCharacterOffset(node, end);
  25333. if (startMarker && endMarker) {
  25334. var range = document.createRange();
  25335. range.setStart(startMarker.node, startMarker.offset);
  25336. selection.removeAllRanges();
  25337. if (start > end) {
  25338. selection.addRange(range);
  25339. selection.extend(endMarker.node, endMarker.offset);
  25340. } else {
  25341. range.setEnd(endMarker.node, endMarker.offset);
  25342. selection.addRange(range);
  25343. }
  25344. }
  25345. }
  25346. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  25347. var ReactDOMSelection = {
  25348. /**
  25349. * @param {DOMElement} node
  25350. */
  25351. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  25352. /**
  25353. * @param {DOMElement|DOMTextNode} node
  25354. * @param {object} offsets
  25355. */
  25356. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  25357. };
  25358. module.exports = ReactDOMSelection;
  25359. /***/ }),
  25360. /* 171 */
  25361. /***/ (function(module, exports, __webpack_require__) {
  25362. "use strict";
  25363. /**
  25364. * Copyright 2013-present, Facebook, Inc.
  25365. * All rights reserved.
  25366. *
  25367. * This source code is licensed under the BSD-style license found in the
  25368. * LICENSE file in the root directory of this source tree. An additional grant
  25369. * of patent rights can be found in the PATENTS file in the same directory.
  25370. *
  25371. */
  25372. var _prodInvariant = __webpack_require__(2),
  25373. _assign = __webpack_require__(3);
  25374. var DOMChildrenOperations = __webpack_require__(51);
  25375. var DOMLazyTree = __webpack_require__(18);
  25376. var ReactDOMComponentTree = __webpack_require__(5);
  25377. var escapeTextContentForBrowser = __webpack_require__(34);
  25378. var invariant = __webpack_require__(0);
  25379. var validateDOMNesting = __webpack_require__(66);
  25380. /**
  25381. * Text nodes violate a couple assumptions that React makes about components:
  25382. *
  25383. * - When mounting text into the DOM, adjacent text nodes are merged.
  25384. * - Text nodes cannot be assigned a React root ID.
  25385. *
  25386. * This component is used to wrap strings between comment nodes so that they
  25387. * can undergo the same reconciliation that is applied to elements.
  25388. *
  25389. * TODO: Investigate representing React components in the DOM with text nodes.
  25390. *
  25391. * @class ReactDOMTextComponent
  25392. * @extends ReactComponent
  25393. * @internal
  25394. */
  25395. var ReactDOMTextComponent = function (text) {
  25396. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  25397. this._currentElement = text;
  25398. this._stringText = '' + text;
  25399. // ReactDOMComponentTree uses these:
  25400. this._hostNode = null;
  25401. this._hostParent = null;
  25402. // Properties
  25403. this._domID = 0;
  25404. this._mountIndex = 0;
  25405. this._closingComment = null;
  25406. this._commentNodes = null;
  25407. };
  25408. _assign(ReactDOMTextComponent.prototype, {
  25409. /**
  25410. * Creates the markup for this text node. This node is not intended to have
  25411. * any features besides containing text content.
  25412. *
  25413. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  25414. * @return {string} Markup for this text node.
  25415. * @internal
  25416. */
  25417. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25418. if (false) {
  25419. var parentInfo;
  25420. if (hostParent != null) {
  25421. parentInfo = hostParent._ancestorInfo;
  25422. } else if (hostContainerInfo != null) {
  25423. parentInfo = hostContainerInfo._ancestorInfo;
  25424. }
  25425. if (parentInfo) {
  25426. // parentInfo should always be present except for the top-level
  25427. // component when server rendering
  25428. validateDOMNesting(null, this._stringText, this, parentInfo);
  25429. }
  25430. }
  25431. var domID = hostContainerInfo._idCounter++;
  25432. var openingValue = ' react-text: ' + domID + ' ';
  25433. var closingValue = ' /react-text ';
  25434. this._domID = domID;
  25435. this._hostParent = hostParent;
  25436. if (transaction.useCreateElement) {
  25437. var ownerDocument = hostContainerInfo._ownerDocument;
  25438. var openingComment = ownerDocument.createComment(openingValue);
  25439. var closingComment = ownerDocument.createComment(closingValue);
  25440. var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
  25441. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
  25442. if (this._stringText) {
  25443. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
  25444. }
  25445. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
  25446. ReactDOMComponentTree.precacheNode(this, openingComment);
  25447. this._closingComment = closingComment;
  25448. return lazyTree;
  25449. } else {
  25450. var escapedText = escapeTextContentForBrowser(this._stringText);
  25451. if (transaction.renderToStaticMarkup) {
  25452. // Normally we'd wrap this between comment nodes for the reasons stated
  25453. // above, but since this is a situation where React won't take over
  25454. // (static pages), we can simply return the text as it is.
  25455. return escapedText;
  25456. }
  25457. return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
  25458. }
  25459. },
  25460. /**
  25461. * Updates this component by updating the text content.
  25462. *
  25463. * @param {ReactText} nextText The next text content
  25464. * @param {ReactReconcileTransaction} transaction
  25465. * @internal
  25466. */
  25467. receiveComponent: function (nextText, transaction) {
  25468. if (nextText !== this._currentElement) {
  25469. this._currentElement = nextText;
  25470. var nextStringText = '' + nextText;
  25471. if (nextStringText !== this._stringText) {
  25472. // TODO: Save this as pending props and use performUpdateIfNecessary
  25473. // and/or updateComponent to do the actual update for consistency with
  25474. // other component types?
  25475. this._stringText = nextStringText;
  25476. var commentNodes = this.getHostNode();
  25477. DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
  25478. }
  25479. }
  25480. },
  25481. getHostNode: function () {
  25482. var hostNode = this._commentNodes;
  25483. if (hostNode) {
  25484. return hostNode;
  25485. }
  25486. if (!this._closingComment) {
  25487. var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
  25488. var node = openingComment.nextSibling;
  25489. while (true) {
  25490. !(node != null) ? false ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
  25491. if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
  25492. this._closingComment = node;
  25493. break;
  25494. }
  25495. node = node.nextSibling;
  25496. }
  25497. }
  25498. hostNode = [this._hostNode, this._closingComment];
  25499. this._commentNodes = hostNode;
  25500. return hostNode;
  25501. },
  25502. unmountComponent: function () {
  25503. this._closingComment = null;
  25504. this._commentNodes = null;
  25505. ReactDOMComponentTree.uncacheNode(this);
  25506. }
  25507. });
  25508. module.exports = ReactDOMTextComponent;
  25509. /***/ }),
  25510. /* 172 */
  25511. /***/ (function(module, exports, __webpack_require__) {
  25512. "use strict";
  25513. /**
  25514. * Copyright 2013-present, Facebook, Inc.
  25515. * All rights reserved.
  25516. *
  25517. * This source code is licensed under the BSD-style license found in the
  25518. * LICENSE file in the root directory of this source tree. An additional grant
  25519. * of patent rights can be found in the PATENTS file in the same directory.
  25520. *
  25521. */
  25522. var _prodInvariant = __webpack_require__(2),
  25523. _assign = __webpack_require__(3);
  25524. var LinkedValueUtils = __webpack_require__(56);
  25525. var ReactDOMComponentTree = __webpack_require__(5);
  25526. var ReactUpdates = __webpack_require__(12);
  25527. var invariant = __webpack_require__(0);
  25528. var warning = __webpack_require__(1);
  25529. var didWarnValueLink = false;
  25530. var didWarnValDefaultVal = false;
  25531. function forceUpdateIfMounted() {
  25532. if (this._rootNodeID) {
  25533. // DOM component is still mounted; update
  25534. ReactDOMTextarea.updateWrapper(this);
  25535. }
  25536. }
  25537. /**
  25538. * Implements a <textarea> host component that allows setting `value`, and
  25539. * `defaultValue`. This differs from the traditional DOM API because value is
  25540. * usually set as PCDATA children.
  25541. *
  25542. * If `value` is not supplied (or null/undefined), user actions that affect the
  25543. * value will trigger updates to the element.
  25544. *
  25545. * If `value` is supplied (and not null/undefined), the rendered element will
  25546. * not trigger updates to the element. Instead, the `value` prop must change in
  25547. * order for the rendered element to be updated.
  25548. *
  25549. * The rendered element will be initialized with an empty value, the prop
  25550. * `defaultValue` if specified, or the children content (deprecated).
  25551. */
  25552. var ReactDOMTextarea = {
  25553. getHostProps: function (inst, props) {
  25554. !(props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
  25555. // Always set children to the same thing. In IE9, the selection range will
  25556. // get reset if `textContent` is mutated. We could add a check in setTextContent
  25557. // to only set the value if/when the value differs from the node value (which would
  25558. // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
  25559. // The value can be a boolean or object so that's why it's forced to be a string.
  25560. var hostProps = _assign({}, props, {
  25561. value: undefined,
  25562. defaultValue: undefined,
  25563. children: '' + inst._wrapperState.initialValue,
  25564. onChange: inst._wrapperState.onChange
  25565. });
  25566. return hostProps;
  25567. },
  25568. mountWrapper: function (inst, props) {
  25569. if (false) {
  25570. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  25571. if (props.valueLink !== undefined && !didWarnValueLink) {
  25572. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
  25573. didWarnValueLink = true;
  25574. }
  25575. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  25576. 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;
  25577. didWarnValDefaultVal = true;
  25578. }
  25579. }
  25580. var value = LinkedValueUtils.getValue(props);
  25581. var initialValue = value;
  25582. // Only bother fetching default value if we're going to use it
  25583. if (value == null) {
  25584. var defaultValue = props.defaultValue;
  25585. // TODO (yungsters): Remove support for children content in <textarea>.
  25586. var children = props.children;
  25587. if (children != null) {
  25588. if (false) {
  25589. process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
  25590. }
  25591. !(defaultValue == null) ? false ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
  25592. if (Array.isArray(children)) {
  25593. !(children.length <= 1) ? false ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
  25594. children = children[0];
  25595. }
  25596. defaultValue = '' + children;
  25597. }
  25598. if (defaultValue == null) {
  25599. defaultValue = '';
  25600. }
  25601. initialValue = defaultValue;
  25602. }
  25603. inst._wrapperState = {
  25604. initialValue: '' + initialValue,
  25605. listeners: null,
  25606. onChange: _handleChange.bind(inst)
  25607. };
  25608. },
  25609. updateWrapper: function (inst) {
  25610. var props = inst._currentElement.props;
  25611. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25612. var value = LinkedValueUtils.getValue(props);
  25613. if (value != null) {
  25614. // Cast `value` to a string to ensure the value is set correctly. While
  25615. // browsers typically do this as necessary, jsdom doesn't.
  25616. var newValue = '' + value;
  25617. // To avoid side effects (such as losing text selection), only set value if changed
  25618. if (newValue !== node.value) {
  25619. node.value = newValue;
  25620. }
  25621. if (props.defaultValue == null) {
  25622. node.defaultValue = newValue;
  25623. }
  25624. }
  25625. if (props.defaultValue != null) {
  25626. node.defaultValue = props.defaultValue;
  25627. }
  25628. },
  25629. postMountWrapper: function (inst) {
  25630. // This is in postMount because we need access to the DOM node, which is not
  25631. // available until after the component has mounted.
  25632. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25633. var textContent = node.textContent;
  25634. // Only set node.value if textContent is equal to the expected
  25635. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  25636. // will populate textContent as well.
  25637. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  25638. if (textContent === inst._wrapperState.initialValue) {
  25639. node.value = textContent;
  25640. }
  25641. }
  25642. };
  25643. function _handleChange(event) {
  25644. var props = this._currentElement.props;
  25645. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25646. ReactUpdates.asap(forceUpdateIfMounted, this);
  25647. return returnValue;
  25648. }
  25649. module.exports = ReactDOMTextarea;
  25650. /***/ }),
  25651. /* 173 */
  25652. /***/ (function(module, exports, __webpack_require__) {
  25653. "use strict";
  25654. /**
  25655. * Copyright 2015-present, Facebook, Inc.
  25656. * All rights reserved.
  25657. *
  25658. * This source code is licensed under the BSD-style license found in the
  25659. * LICENSE file in the root directory of this source tree. An additional grant
  25660. * of patent rights can be found in the PATENTS file in the same directory.
  25661. *
  25662. */
  25663. var _prodInvariant = __webpack_require__(2);
  25664. var invariant = __webpack_require__(0);
  25665. /**
  25666. * Return the lowest common ancestor of A and B, or null if they are in
  25667. * different trees.
  25668. */
  25669. function getLowestCommonAncestor(instA, instB) {
  25670. !('_hostNode' in instA) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  25671. !('_hostNode' in instB) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  25672. var depthA = 0;
  25673. for (var tempA = instA; tempA; tempA = tempA._hostParent) {
  25674. depthA++;
  25675. }
  25676. var depthB = 0;
  25677. for (var tempB = instB; tempB; tempB = tempB._hostParent) {
  25678. depthB++;
  25679. }
  25680. // If A is deeper, crawl up.
  25681. while (depthA - depthB > 0) {
  25682. instA = instA._hostParent;
  25683. depthA--;
  25684. }
  25685. // If B is deeper, crawl up.
  25686. while (depthB - depthA > 0) {
  25687. instB = instB._hostParent;
  25688. depthB--;
  25689. }
  25690. // Walk in lockstep until we find a match.
  25691. var depth = depthA;
  25692. while (depth--) {
  25693. if (instA === instB) {
  25694. return instA;
  25695. }
  25696. instA = instA._hostParent;
  25697. instB = instB._hostParent;
  25698. }
  25699. return null;
  25700. }
  25701. /**
  25702. * Return if A is an ancestor of B.
  25703. */
  25704. function isAncestor(instA, instB) {
  25705. !('_hostNode' in instA) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  25706. !('_hostNode' in instB) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  25707. while (instB) {
  25708. if (instB === instA) {
  25709. return true;
  25710. }
  25711. instB = instB._hostParent;
  25712. }
  25713. return false;
  25714. }
  25715. /**
  25716. * Return the parent instance of the passed-in instance.
  25717. */
  25718. function getParentInstance(inst) {
  25719. !('_hostNode' in inst) ? false ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
  25720. return inst._hostParent;
  25721. }
  25722. /**
  25723. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  25724. */
  25725. function traverseTwoPhase(inst, fn, arg) {
  25726. var path = [];
  25727. while (inst) {
  25728. path.push(inst);
  25729. inst = inst._hostParent;
  25730. }
  25731. var i;
  25732. for (i = path.length; i-- > 0;) {
  25733. fn(path[i], 'captured', arg);
  25734. }
  25735. for (i = 0; i < path.length; i++) {
  25736. fn(path[i], 'bubbled', arg);
  25737. }
  25738. }
  25739. /**
  25740. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  25741. * should would receive a `mouseEnter` or `mouseLeave` event.
  25742. *
  25743. * Does not invoke the callback on the nearest common ancestor because nothing
  25744. * "entered" or "left" that element.
  25745. */
  25746. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  25747. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  25748. var pathFrom = [];
  25749. while (from && from !== common) {
  25750. pathFrom.push(from);
  25751. from = from._hostParent;
  25752. }
  25753. var pathTo = [];
  25754. while (to && to !== common) {
  25755. pathTo.push(to);
  25756. to = to._hostParent;
  25757. }
  25758. var i;
  25759. for (i = 0; i < pathFrom.length; i++) {
  25760. fn(pathFrom[i], 'bubbled', argFrom);
  25761. }
  25762. for (i = pathTo.length; i-- > 0;) {
  25763. fn(pathTo[i], 'captured', argTo);
  25764. }
  25765. }
  25766. module.exports = {
  25767. isAncestor: isAncestor,
  25768. getLowestCommonAncestor: getLowestCommonAncestor,
  25769. getParentInstance: getParentInstance,
  25770. traverseTwoPhase: traverseTwoPhase,
  25771. traverseEnterLeave: traverseEnterLeave
  25772. };
  25773. /***/ }),
  25774. /* 174 */
  25775. /***/ (function(module, exports, __webpack_require__) {
  25776. "use strict";
  25777. /**
  25778. * Copyright 2013-present, Facebook, Inc.
  25779. * All rights reserved.
  25780. *
  25781. * This source code is licensed under the BSD-style license found in the
  25782. * LICENSE file in the root directory of this source tree. An additional grant
  25783. * of patent rights can be found in the PATENTS file in the same directory.
  25784. *
  25785. */
  25786. var _assign = __webpack_require__(3);
  25787. var ReactUpdates = __webpack_require__(12);
  25788. var Transaction = __webpack_require__(33);
  25789. var emptyFunction = __webpack_require__(10);
  25790. var RESET_BATCHED_UPDATES = {
  25791. initialize: emptyFunction,
  25792. close: function () {
  25793. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  25794. }
  25795. };
  25796. var FLUSH_BATCHED_UPDATES = {
  25797. initialize: emptyFunction,
  25798. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  25799. };
  25800. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  25801. function ReactDefaultBatchingStrategyTransaction() {
  25802. this.reinitializeTransaction();
  25803. }
  25804. _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
  25805. getTransactionWrappers: function () {
  25806. return TRANSACTION_WRAPPERS;
  25807. }
  25808. });
  25809. var transaction = new ReactDefaultBatchingStrategyTransaction();
  25810. var ReactDefaultBatchingStrategy = {
  25811. isBatchingUpdates: false,
  25812. /**
  25813. * Call the provided function in a context within which calls to `setState`
  25814. * and friends are batched such that components aren't updated unnecessarily.
  25815. */
  25816. batchedUpdates: function (callback, a, b, c, d, e) {
  25817. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  25818. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  25819. // The code is written this way to avoid extra allocations
  25820. if (alreadyBatchingUpdates) {
  25821. return callback(a, b, c, d, e);
  25822. } else {
  25823. return transaction.perform(callback, null, a, b, c, d, e);
  25824. }
  25825. }
  25826. };
  25827. module.exports = ReactDefaultBatchingStrategy;
  25828. /***/ }),
  25829. /* 175 */
  25830. /***/ (function(module, exports, __webpack_require__) {
  25831. "use strict";
  25832. /**
  25833. * Copyright 2013-present, Facebook, Inc.
  25834. * All rights reserved.
  25835. *
  25836. * This source code is licensed under the BSD-style license found in the
  25837. * LICENSE file in the root directory of this source tree. An additional grant
  25838. * of patent rights can be found in the PATENTS file in the same directory.
  25839. *
  25840. */
  25841. var ARIADOMPropertyConfig = __webpack_require__(149);
  25842. var BeforeInputEventPlugin = __webpack_require__(151);
  25843. var ChangeEventPlugin = __webpack_require__(153);
  25844. var DefaultEventPluginOrder = __webpack_require__(155);
  25845. var EnterLeaveEventPlugin = __webpack_require__(156);
  25846. var HTMLDOMPropertyConfig = __webpack_require__(158);
  25847. var ReactComponentBrowserEnvironment = __webpack_require__(160);
  25848. var ReactDOMComponent = __webpack_require__(163);
  25849. var ReactDOMComponentTree = __webpack_require__(5);
  25850. var ReactDOMEmptyComponent = __webpack_require__(165);
  25851. var ReactDOMTreeTraversal = __webpack_require__(173);
  25852. var ReactDOMTextComponent = __webpack_require__(171);
  25853. var ReactDefaultBatchingStrategy = __webpack_require__(174);
  25854. var ReactEventListener = __webpack_require__(178);
  25855. var ReactInjection = __webpack_require__(179);
  25856. var ReactReconcileTransaction = __webpack_require__(184);
  25857. var SVGDOMPropertyConfig = __webpack_require__(189);
  25858. var SelectEventPlugin = __webpack_require__(190);
  25859. var SimpleEventPlugin = __webpack_require__(191);
  25860. var alreadyInjected = false;
  25861. function inject() {
  25862. if (alreadyInjected) {
  25863. // TODO: This is currently true because these injections are shared between
  25864. // the client and the server package. They should be built independently
  25865. // and not share any injection state. Then this problem will be solved.
  25866. return;
  25867. }
  25868. alreadyInjected = true;
  25869. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  25870. /**
  25871. * Inject modules for resolving DOM hierarchy and plugin ordering.
  25872. */
  25873. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  25874. ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
  25875. ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
  25876. /**
  25877. * Some important event plugins included by default (without having to require
  25878. * them).
  25879. */
  25880. ReactInjection.EventPluginHub.injectEventPluginsByName({
  25881. SimpleEventPlugin: SimpleEventPlugin,
  25882. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  25883. ChangeEventPlugin: ChangeEventPlugin,
  25884. SelectEventPlugin: SelectEventPlugin,
  25885. BeforeInputEventPlugin: BeforeInputEventPlugin
  25886. });
  25887. ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
  25888. ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
  25889. ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
  25890. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  25891. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  25892. ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
  25893. return new ReactDOMEmptyComponent(instantiate);
  25894. });
  25895. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  25896. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  25897. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  25898. }
  25899. module.exports = {
  25900. inject: inject
  25901. };
  25902. /***/ }),
  25903. /* 176 */
  25904. /***/ (function(module, exports, __webpack_require__) {
  25905. "use strict";
  25906. /**
  25907. * Copyright 2014-present, Facebook, Inc.
  25908. * All rights reserved.
  25909. *
  25910. * This source code is licensed under the BSD-style license found in the
  25911. * LICENSE file in the root directory of this source tree. An additional grant
  25912. * of patent rights can be found in the PATENTS file in the same directory.
  25913. *
  25914. *
  25915. */
  25916. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  25917. // nor polyfill, then a plain number is used for performance.
  25918. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  25919. module.exports = REACT_ELEMENT_TYPE;
  25920. /***/ }),
  25921. /* 177 */
  25922. /***/ (function(module, exports, __webpack_require__) {
  25923. "use strict";
  25924. /**
  25925. * Copyright 2013-present, Facebook, Inc.
  25926. * All rights reserved.
  25927. *
  25928. * This source code is licensed under the BSD-style license found in the
  25929. * LICENSE file in the root directory of this source tree. An additional grant
  25930. * of patent rights can be found in the PATENTS file in the same directory.
  25931. *
  25932. */
  25933. var EventPluginHub = __webpack_require__(26);
  25934. function runEventQueueInBatch(events) {
  25935. EventPluginHub.enqueueEvents(events);
  25936. EventPluginHub.processEventQueue(false);
  25937. }
  25938. var ReactEventEmitterMixin = {
  25939. /**
  25940. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  25941. * opportunity to create `ReactEvent`s to be dispatched.
  25942. */
  25943. handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  25944. var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  25945. runEventQueueInBatch(events);
  25946. }
  25947. };
  25948. module.exports = ReactEventEmitterMixin;
  25949. /***/ }),
  25950. /* 178 */
  25951. /***/ (function(module, exports, __webpack_require__) {
  25952. "use strict";
  25953. /**
  25954. * Copyright 2013-present, Facebook, Inc.
  25955. * All rights reserved.
  25956. *
  25957. * This source code is licensed under the BSD-style license found in the
  25958. * LICENSE file in the root directory of this source tree. An additional grant
  25959. * of patent rights can be found in the PATENTS file in the same directory.
  25960. *
  25961. */
  25962. var _assign = __webpack_require__(3);
  25963. var EventListener = __webpack_require__(71);
  25964. var ExecutionEnvironment = __webpack_require__(8);
  25965. var PooledClass = __webpack_require__(16);
  25966. var ReactDOMComponentTree = __webpack_require__(5);
  25967. var ReactUpdates = __webpack_require__(12);
  25968. var getEventTarget = __webpack_require__(63);
  25969. var getUnboundedScrollPosition = __webpack_require__(143);
  25970. /**
  25971. * Find the deepest React component completely containing the root of the
  25972. * passed-in instance (for use when entire React trees are nested within each
  25973. * other). If React trees are not nested, returns null.
  25974. */
  25975. function findParent(inst) {
  25976. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  25977. // traversal, but caching is difficult to do correctly without using a
  25978. // mutation observer to listen for all DOM changes.
  25979. while (inst._hostParent) {
  25980. inst = inst._hostParent;
  25981. }
  25982. var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  25983. var container = rootNode.parentNode;
  25984. return ReactDOMComponentTree.getClosestInstanceFromNode(container);
  25985. }
  25986. // Used to store ancestor hierarchy in top level callback
  25987. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  25988. this.topLevelType = topLevelType;
  25989. this.nativeEvent = nativeEvent;
  25990. this.ancestors = [];
  25991. }
  25992. _assign(TopLevelCallbackBookKeeping.prototype, {
  25993. destructor: function () {
  25994. this.topLevelType = null;
  25995. this.nativeEvent = null;
  25996. this.ancestors.length = 0;
  25997. }
  25998. });
  25999. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  26000. function handleTopLevelImpl(bookKeeping) {
  26001. var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
  26002. var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
  26003. // Loop through the hierarchy, in case there's any nested components.
  26004. // It's important that we build the array of ancestors before calling any
  26005. // event handlers, because event handlers can modify the DOM, leading to
  26006. // inconsistencies with ReactMount's node cache. See #1105.
  26007. var ancestor = targetInst;
  26008. do {
  26009. bookKeeping.ancestors.push(ancestor);
  26010. ancestor = ancestor && findParent(ancestor);
  26011. } while (ancestor);
  26012. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  26013. targetInst = bookKeeping.ancestors[i];
  26014. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  26015. }
  26016. }
  26017. function scrollValueMonitor(cb) {
  26018. var scrollPosition = getUnboundedScrollPosition(window);
  26019. cb(scrollPosition);
  26020. }
  26021. var ReactEventListener = {
  26022. _enabled: true,
  26023. _handleTopLevel: null,
  26024. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  26025. setHandleTopLevel: function (handleTopLevel) {
  26026. ReactEventListener._handleTopLevel = handleTopLevel;
  26027. },
  26028. setEnabled: function (enabled) {
  26029. ReactEventListener._enabled = !!enabled;
  26030. },
  26031. isEnabled: function () {
  26032. return ReactEventListener._enabled;
  26033. },
  26034. /**
  26035. * Traps top-level events by using event bubbling.
  26036. *
  26037. * @param {string} topLevelType Record from `EventConstants`.
  26038. * @param {string} handlerBaseName Event name (e.g. "click").
  26039. * @param {object} element Element on which to attach listener.
  26040. * @return {?object} An object with a remove function which will forcefully
  26041. * remove the listener.
  26042. * @internal
  26043. */
  26044. trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
  26045. if (!element) {
  26046. return null;
  26047. }
  26048. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26049. },
  26050. /**
  26051. * Traps a top-level event by using event capturing.
  26052. *
  26053. * @param {string} topLevelType Record from `EventConstants`.
  26054. * @param {string} handlerBaseName Event name (e.g. "click").
  26055. * @param {object} element Element on which to attach listener.
  26056. * @return {?object} An object with a remove function which will forcefully
  26057. * remove the listener.
  26058. * @internal
  26059. */
  26060. trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
  26061. if (!element) {
  26062. return null;
  26063. }
  26064. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26065. },
  26066. monitorScrollValue: function (refresh) {
  26067. var callback = scrollValueMonitor.bind(null, refresh);
  26068. EventListener.listen(window, 'scroll', callback);
  26069. },
  26070. dispatchEvent: function (topLevelType, nativeEvent) {
  26071. if (!ReactEventListener._enabled) {
  26072. return;
  26073. }
  26074. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  26075. try {
  26076. // Event queue being processed in the same cycle allows
  26077. // `preventDefault`.
  26078. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  26079. } finally {
  26080. TopLevelCallbackBookKeeping.release(bookKeeping);
  26081. }
  26082. }
  26083. };
  26084. module.exports = ReactEventListener;
  26085. /***/ }),
  26086. /* 179 */
  26087. /***/ (function(module, exports, __webpack_require__) {
  26088. "use strict";
  26089. /**
  26090. * Copyright 2013-present, Facebook, Inc.
  26091. * All rights reserved.
  26092. *
  26093. * This source code is licensed under the BSD-style license found in the
  26094. * LICENSE file in the root directory of this source tree. An additional grant
  26095. * of patent rights can be found in the PATENTS file in the same directory.
  26096. *
  26097. */
  26098. var DOMProperty = __webpack_require__(19);
  26099. var EventPluginHub = __webpack_require__(26);
  26100. var EventPluginUtils = __webpack_require__(54);
  26101. var ReactComponentEnvironment = __webpack_require__(57);
  26102. var ReactEmptyComponent = __webpack_require__(80);
  26103. var ReactBrowserEventEmitter = __webpack_require__(31);
  26104. var ReactHostComponent = __webpack_require__(82);
  26105. var ReactUpdates = __webpack_require__(12);
  26106. var ReactInjection = {
  26107. Component: ReactComponentEnvironment.injection,
  26108. DOMProperty: DOMProperty.injection,
  26109. EmptyComponent: ReactEmptyComponent.injection,
  26110. EventPluginHub: EventPluginHub.injection,
  26111. EventPluginUtils: EventPluginUtils.injection,
  26112. EventEmitter: ReactBrowserEventEmitter.injection,
  26113. HostComponent: ReactHostComponent.injection,
  26114. Updates: ReactUpdates.injection
  26115. };
  26116. module.exports = ReactInjection;
  26117. /***/ }),
  26118. /* 180 */
  26119. /***/ (function(module, exports, __webpack_require__) {
  26120. "use strict";
  26121. /**
  26122. * Copyright 2013-present, Facebook, Inc.
  26123. * All rights reserved.
  26124. *
  26125. * This source code is licensed under the BSD-style license found in the
  26126. * LICENSE file in the root directory of this source tree. An additional grant
  26127. * of patent rights can be found in the PATENTS file in the same directory.
  26128. *
  26129. */
  26130. var adler32 = __webpack_require__(202);
  26131. var TAG_END = /\/?>/;
  26132. var COMMENT_START = /^<\!\-\-/;
  26133. var ReactMarkupChecksum = {
  26134. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  26135. /**
  26136. * @param {string} markup Markup string
  26137. * @return {string} Markup string with checksum attribute attached
  26138. */
  26139. addChecksumToMarkup: function (markup) {
  26140. var checksum = adler32(markup);
  26141. // Add checksum (handle both parent tags, comments and self-closing tags)
  26142. if (COMMENT_START.test(markup)) {
  26143. return markup;
  26144. } else {
  26145. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  26146. }
  26147. },
  26148. /**
  26149. * @param {string} markup to use
  26150. * @param {DOMElement} element root React element
  26151. * @returns {boolean} whether or not the markup is the same
  26152. */
  26153. canReuseMarkup: function (markup, element) {
  26154. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  26155. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  26156. var markupChecksum = adler32(markup);
  26157. return markupChecksum === existingChecksum;
  26158. }
  26159. };
  26160. module.exports = ReactMarkupChecksum;
  26161. /***/ }),
  26162. /* 181 */
  26163. /***/ (function(module, exports, __webpack_require__) {
  26164. "use strict";
  26165. /**
  26166. * Copyright 2013-present, Facebook, Inc.
  26167. * All rights reserved.
  26168. *
  26169. * This source code is licensed under the BSD-style license found in the
  26170. * LICENSE file in the root directory of this source tree. An additional grant
  26171. * of patent rights can be found in the PATENTS file in the same directory.
  26172. *
  26173. */
  26174. var _prodInvariant = __webpack_require__(2);
  26175. var ReactComponentEnvironment = __webpack_require__(57);
  26176. var ReactInstanceMap = __webpack_require__(28);
  26177. var ReactInstrumentation = __webpack_require__(11);
  26178. var ReactCurrentOwner = __webpack_require__(14);
  26179. var ReactReconciler = __webpack_require__(20);
  26180. var ReactChildReconciler = __webpack_require__(159);
  26181. var emptyFunction = __webpack_require__(10);
  26182. var flattenChildren = __webpack_require__(205);
  26183. var invariant = __webpack_require__(0);
  26184. /**
  26185. * Make an update for markup to be rendered and inserted at a supplied index.
  26186. *
  26187. * @param {string} markup Markup that renders into an element.
  26188. * @param {number} toIndex Destination index.
  26189. * @private
  26190. */
  26191. function makeInsertMarkup(markup, afterNode, toIndex) {
  26192. // NOTE: Null values reduce hidden classes.
  26193. return {
  26194. type: 'INSERT_MARKUP',
  26195. content: markup,
  26196. fromIndex: null,
  26197. fromNode: null,
  26198. toIndex: toIndex,
  26199. afterNode: afterNode
  26200. };
  26201. }
  26202. /**
  26203. * Make an update for moving an existing element to another index.
  26204. *
  26205. * @param {number} fromIndex Source index of the existing element.
  26206. * @param {number} toIndex Destination index of the element.
  26207. * @private
  26208. */
  26209. function makeMove(child, afterNode, toIndex) {
  26210. // NOTE: Null values reduce hidden classes.
  26211. return {
  26212. type: 'MOVE_EXISTING',
  26213. content: null,
  26214. fromIndex: child._mountIndex,
  26215. fromNode: ReactReconciler.getHostNode(child),
  26216. toIndex: toIndex,
  26217. afterNode: afterNode
  26218. };
  26219. }
  26220. /**
  26221. * Make an update for removing an element at an index.
  26222. *
  26223. * @param {number} fromIndex Index of the element to remove.
  26224. * @private
  26225. */
  26226. function makeRemove(child, node) {
  26227. // NOTE: Null values reduce hidden classes.
  26228. return {
  26229. type: 'REMOVE_NODE',
  26230. content: null,
  26231. fromIndex: child._mountIndex,
  26232. fromNode: node,
  26233. toIndex: null,
  26234. afterNode: null
  26235. };
  26236. }
  26237. /**
  26238. * Make an update for setting the markup of a node.
  26239. *
  26240. * @param {string} markup Markup that renders into an element.
  26241. * @private
  26242. */
  26243. function makeSetMarkup(markup) {
  26244. // NOTE: Null values reduce hidden classes.
  26245. return {
  26246. type: 'SET_MARKUP',
  26247. content: markup,
  26248. fromIndex: null,
  26249. fromNode: null,
  26250. toIndex: null,
  26251. afterNode: null
  26252. };
  26253. }
  26254. /**
  26255. * Make an update for setting the text content.
  26256. *
  26257. * @param {string} textContent Text content to set.
  26258. * @private
  26259. */
  26260. function makeTextContent(textContent) {
  26261. // NOTE: Null values reduce hidden classes.
  26262. return {
  26263. type: 'TEXT_CONTENT',
  26264. content: textContent,
  26265. fromIndex: null,
  26266. fromNode: null,
  26267. toIndex: null,
  26268. afterNode: null
  26269. };
  26270. }
  26271. /**
  26272. * Push an update, if any, onto the queue. Creates a new queue if none is
  26273. * passed and always returns the queue. Mutative.
  26274. */
  26275. function enqueue(queue, update) {
  26276. if (update) {
  26277. queue = queue || [];
  26278. queue.push(update);
  26279. }
  26280. return queue;
  26281. }
  26282. /**
  26283. * Processes any enqueued updates.
  26284. *
  26285. * @private
  26286. */
  26287. function processQueue(inst, updateQueue) {
  26288. ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
  26289. }
  26290. var setChildrenForInstrumentation = emptyFunction;
  26291. if (false) {
  26292. var getDebugID = function (inst) {
  26293. if (!inst._debugID) {
  26294. // Check for ART-like instances. TODO: This is silly/gross.
  26295. var internal;
  26296. if (internal = ReactInstanceMap.get(inst)) {
  26297. inst = internal;
  26298. }
  26299. }
  26300. return inst._debugID;
  26301. };
  26302. setChildrenForInstrumentation = function (children) {
  26303. var debugID = getDebugID(this);
  26304. // TODO: React Native empty components are also multichild.
  26305. // This means they still get into this method but don't have _debugID.
  26306. if (debugID !== 0) {
  26307. ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
  26308. return children[key]._debugID;
  26309. }) : []);
  26310. }
  26311. };
  26312. }
  26313. /**
  26314. * ReactMultiChild are capable of reconciling multiple children.
  26315. *
  26316. * @class ReactMultiChild
  26317. * @internal
  26318. */
  26319. var ReactMultiChild = {
  26320. /**
  26321. * Provides common functionality for components that must reconcile multiple
  26322. * children. This is used by `ReactDOMComponent` to mount, update, and
  26323. * unmount child components.
  26324. *
  26325. * @lends {ReactMultiChild.prototype}
  26326. */
  26327. Mixin: {
  26328. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  26329. if (false) {
  26330. var selfDebugID = getDebugID(this);
  26331. if (this._currentElement) {
  26332. try {
  26333. ReactCurrentOwner.current = this._currentElement._owner;
  26334. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
  26335. } finally {
  26336. ReactCurrentOwner.current = null;
  26337. }
  26338. }
  26339. }
  26340. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  26341. },
  26342. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
  26343. var nextChildren;
  26344. var selfDebugID = 0;
  26345. if (false) {
  26346. selfDebugID = getDebugID(this);
  26347. if (this._currentElement) {
  26348. try {
  26349. ReactCurrentOwner.current = this._currentElement._owner;
  26350. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26351. } finally {
  26352. ReactCurrentOwner.current = null;
  26353. }
  26354. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26355. return nextChildren;
  26356. }
  26357. }
  26358. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26359. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26360. return nextChildren;
  26361. },
  26362. /**
  26363. * Generates a "mount image" for each of the supplied children. In the case
  26364. * of `ReactDOMComponent`, a mount image is a string of markup.
  26365. *
  26366. * @param {?object} nestedChildren Nested child maps.
  26367. * @return {array} An array of mounted representations.
  26368. * @internal
  26369. */
  26370. mountChildren: function (nestedChildren, transaction, context) {
  26371. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  26372. this._renderedChildren = children;
  26373. var mountImages = [];
  26374. var index = 0;
  26375. for (var name in children) {
  26376. if (children.hasOwnProperty(name)) {
  26377. var child = children[name];
  26378. var selfDebugID = 0;
  26379. if (false) {
  26380. selfDebugID = getDebugID(this);
  26381. }
  26382. var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26383. child._mountIndex = index++;
  26384. mountImages.push(mountImage);
  26385. }
  26386. }
  26387. if (false) {
  26388. setChildrenForInstrumentation.call(this, children);
  26389. }
  26390. return mountImages;
  26391. },
  26392. /**
  26393. * Replaces any rendered children with a text content string.
  26394. *
  26395. * @param {string} nextContent String of content.
  26396. * @internal
  26397. */
  26398. updateTextContent: function (nextContent) {
  26399. var prevChildren = this._renderedChildren;
  26400. // Remove any rendered children.
  26401. ReactChildReconciler.unmountChildren(prevChildren, false);
  26402. for (var name in prevChildren) {
  26403. if (prevChildren.hasOwnProperty(name)) {
  26404. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26405. }
  26406. }
  26407. // Set new text content.
  26408. var updates = [makeTextContent(nextContent)];
  26409. processQueue(this, updates);
  26410. },
  26411. /**
  26412. * Replaces any rendered children with a markup string.
  26413. *
  26414. * @param {string} nextMarkup String of markup.
  26415. * @internal
  26416. */
  26417. updateMarkup: function (nextMarkup) {
  26418. var prevChildren = this._renderedChildren;
  26419. // Remove any rendered children.
  26420. ReactChildReconciler.unmountChildren(prevChildren, false);
  26421. for (var name in prevChildren) {
  26422. if (prevChildren.hasOwnProperty(name)) {
  26423. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26424. }
  26425. }
  26426. var updates = [makeSetMarkup(nextMarkup)];
  26427. processQueue(this, updates);
  26428. },
  26429. /**
  26430. * Updates the rendered children with new children.
  26431. *
  26432. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26433. * @param {ReactReconcileTransaction} transaction
  26434. * @internal
  26435. */
  26436. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  26437. // Hook used by React ART
  26438. this._updateChildren(nextNestedChildrenElements, transaction, context);
  26439. },
  26440. /**
  26441. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26442. * @param {ReactReconcileTransaction} transaction
  26443. * @final
  26444. * @protected
  26445. */
  26446. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  26447. var prevChildren = this._renderedChildren;
  26448. var removedNodes = {};
  26449. var mountImages = [];
  26450. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
  26451. if (!nextChildren && !prevChildren) {
  26452. return;
  26453. }
  26454. var updates = null;
  26455. var name;
  26456. // `nextIndex` will increment for each child in `nextChildren`, but
  26457. // `lastIndex` will be the last index visited in `prevChildren`.
  26458. var nextIndex = 0;
  26459. var lastIndex = 0;
  26460. // `nextMountIndex` will increment for each newly mounted child.
  26461. var nextMountIndex = 0;
  26462. var lastPlacedNode = null;
  26463. for (name in nextChildren) {
  26464. if (!nextChildren.hasOwnProperty(name)) {
  26465. continue;
  26466. }
  26467. var prevChild = prevChildren && prevChildren[name];
  26468. var nextChild = nextChildren[name];
  26469. if (prevChild === nextChild) {
  26470. updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
  26471. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  26472. prevChild._mountIndex = nextIndex;
  26473. } else {
  26474. if (prevChild) {
  26475. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  26476. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  26477. // The `removedNodes` loop below will actually remove the child.
  26478. }
  26479. // The child must be instantiated before it's mounted.
  26480. updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
  26481. nextMountIndex++;
  26482. }
  26483. nextIndex++;
  26484. lastPlacedNode = ReactReconciler.getHostNode(nextChild);
  26485. }
  26486. // Remove children that are no longer present.
  26487. for (name in removedNodes) {
  26488. if (removedNodes.hasOwnProperty(name)) {
  26489. updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
  26490. }
  26491. }
  26492. if (updates) {
  26493. processQueue(this, updates);
  26494. }
  26495. this._renderedChildren = nextChildren;
  26496. if (false) {
  26497. setChildrenForInstrumentation.call(this, nextChildren);
  26498. }
  26499. },
  26500. /**
  26501. * Unmounts all rendered children. This should be used to clean up children
  26502. * when this component is unmounted. It does not actually perform any
  26503. * backend operations.
  26504. *
  26505. * @internal
  26506. */
  26507. unmountChildren: function (safely) {
  26508. var renderedChildren = this._renderedChildren;
  26509. ReactChildReconciler.unmountChildren(renderedChildren, safely);
  26510. this._renderedChildren = null;
  26511. },
  26512. /**
  26513. * Moves a child component to the supplied index.
  26514. *
  26515. * @param {ReactComponent} child Component to move.
  26516. * @param {number} toIndex Destination index of the element.
  26517. * @param {number} lastIndex Last index visited of the siblings of `child`.
  26518. * @protected
  26519. */
  26520. moveChild: function (child, afterNode, toIndex, lastIndex) {
  26521. // If the index of `child` is less than `lastIndex`, then it needs to
  26522. // be moved. Otherwise, we do not need to move it because a child will be
  26523. // inserted or moved before `child`.
  26524. if (child._mountIndex < lastIndex) {
  26525. return makeMove(child, afterNode, toIndex);
  26526. }
  26527. },
  26528. /**
  26529. * Creates a child component.
  26530. *
  26531. * @param {ReactComponent} child Component to create.
  26532. * @param {string} mountImage Markup to insert.
  26533. * @protected
  26534. */
  26535. createChild: function (child, afterNode, mountImage) {
  26536. return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
  26537. },
  26538. /**
  26539. * Removes a child component.
  26540. *
  26541. * @param {ReactComponent} child Child to remove.
  26542. * @protected
  26543. */
  26544. removeChild: function (child, node) {
  26545. return makeRemove(child, node);
  26546. },
  26547. /**
  26548. * Mounts a child with the supplied name.
  26549. *
  26550. * NOTE: This is part of `updateChildren` and is here for readability.
  26551. *
  26552. * @param {ReactComponent} child Component to mount.
  26553. * @param {string} name Name of the child.
  26554. * @param {number} index Index at which to insert the child.
  26555. * @param {ReactReconcileTransaction} transaction
  26556. * @private
  26557. */
  26558. _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
  26559. child._mountIndex = index;
  26560. return this.createChild(child, afterNode, mountImage);
  26561. },
  26562. /**
  26563. * Unmounts a rendered child.
  26564. *
  26565. * NOTE: This is part of `updateChildren` and is here for readability.
  26566. *
  26567. * @param {ReactComponent} child Component to unmount.
  26568. * @private
  26569. */
  26570. _unmountChild: function (child, node) {
  26571. var update = this.removeChild(child, node);
  26572. child._mountIndex = null;
  26573. return update;
  26574. }
  26575. }
  26576. };
  26577. module.exports = ReactMultiChild;
  26578. /***/ }),
  26579. /* 182 */
  26580. /***/ (function(module, exports, __webpack_require__) {
  26581. "use strict";
  26582. /**
  26583. * Copyright 2013-present, Facebook, Inc.
  26584. * All rights reserved.
  26585. *
  26586. * This source code is licensed under the BSD-style license found in the
  26587. * LICENSE file in the root directory of this source tree. An additional grant
  26588. * of patent rights can be found in the PATENTS file in the same directory.
  26589. *
  26590. *
  26591. */
  26592. var _prodInvariant = __webpack_require__(2);
  26593. var invariant = __webpack_require__(0);
  26594. /**
  26595. * @param {?object} object
  26596. * @return {boolean} True if `object` is a valid owner.
  26597. * @final
  26598. */
  26599. function isValidOwner(object) {
  26600. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  26601. }
  26602. /**
  26603. * ReactOwners are capable of storing references to owned components.
  26604. *
  26605. * All components are capable of //being// referenced by owner components, but
  26606. * only ReactOwner components are capable of //referencing// owned components.
  26607. * The named reference is known as a "ref".
  26608. *
  26609. * Refs are available when mounted and updated during reconciliation.
  26610. *
  26611. * var MyComponent = React.createClass({
  26612. * render: function() {
  26613. * return (
  26614. * <div onClick={this.handleClick}>
  26615. * <CustomComponent ref="custom" />
  26616. * </div>
  26617. * );
  26618. * },
  26619. * handleClick: function() {
  26620. * this.refs.custom.handleClick();
  26621. * },
  26622. * componentDidMount: function() {
  26623. * this.refs.custom.initialize();
  26624. * }
  26625. * });
  26626. *
  26627. * Refs should rarely be used. When refs are used, they should only be done to
  26628. * control data that is not handled by React's data flow.
  26629. *
  26630. * @class ReactOwner
  26631. */
  26632. var ReactOwner = {
  26633. /**
  26634. * Adds a component by ref to an owner component.
  26635. *
  26636. * @param {ReactComponent} component Component to reference.
  26637. * @param {string} ref Name by which to refer to the component.
  26638. * @param {ReactOwner} owner Component on which to record the ref.
  26639. * @final
  26640. * @internal
  26641. */
  26642. addComponentAsRefTo: function (component, ref, owner) {
  26643. !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;
  26644. owner.attachRef(ref, component);
  26645. },
  26646. /**
  26647. * Removes a component by ref from an owner component.
  26648. *
  26649. * @param {ReactComponent} component Component to dereference.
  26650. * @param {string} ref Name of the ref to remove.
  26651. * @param {ReactOwner} owner Component on which the ref is recorded.
  26652. * @final
  26653. * @internal
  26654. */
  26655. removeComponentAsRefFrom: function (component, ref, owner) {
  26656. !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;
  26657. var ownerPublicInstance = owner.getPublicInstance();
  26658. // Check that `component`'s owner is still alive and that `component` is still the current ref
  26659. // because we do not want to detach the ref if another component stole it.
  26660. if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
  26661. owner.detachRef(ref);
  26662. }
  26663. }
  26664. };
  26665. module.exports = ReactOwner;
  26666. /***/ }),
  26667. /* 183 */
  26668. /***/ (function(module, exports, __webpack_require__) {
  26669. "use strict";
  26670. /**
  26671. * Copyright 2013-present, Facebook, Inc.
  26672. * All rights reserved.
  26673. *
  26674. * This source code is licensed under the BSD-style license found in the
  26675. * LICENSE file in the root directory of this source tree. An additional grant
  26676. * of patent rights can be found in the PATENTS file in the same directory.
  26677. *
  26678. *
  26679. */
  26680. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  26681. module.exports = ReactPropTypesSecret;
  26682. /***/ }),
  26683. /* 184 */
  26684. /***/ (function(module, exports, __webpack_require__) {
  26685. "use strict";
  26686. /**
  26687. * Copyright 2013-present, Facebook, Inc.
  26688. * All rights reserved.
  26689. *
  26690. * This source code is licensed under the BSD-style license found in the
  26691. * LICENSE file in the root directory of this source tree. An additional grant
  26692. * of patent rights can be found in the PATENTS file in the same directory.
  26693. *
  26694. */
  26695. var _assign = __webpack_require__(3);
  26696. var CallbackQueue = __webpack_require__(76);
  26697. var PooledClass = __webpack_require__(16);
  26698. var ReactBrowserEventEmitter = __webpack_require__(31);
  26699. var ReactInputSelection = __webpack_require__(83);
  26700. var ReactInstrumentation = __webpack_require__(11);
  26701. var Transaction = __webpack_require__(33);
  26702. var ReactUpdateQueue = __webpack_require__(59);
  26703. /**
  26704. * Ensures that, when possible, the selection range (currently selected text
  26705. * input) is not disturbed by performing the transaction.
  26706. */
  26707. var SELECTION_RESTORATION = {
  26708. /**
  26709. * @return {Selection} Selection information.
  26710. */
  26711. initialize: ReactInputSelection.getSelectionInformation,
  26712. /**
  26713. * @param {Selection} sel Selection information returned from `initialize`.
  26714. */
  26715. close: ReactInputSelection.restoreSelection
  26716. };
  26717. /**
  26718. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  26719. * high level DOM manipulations (like temporarily removing a text input from the
  26720. * DOM).
  26721. */
  26722. var EVENT_SUPPRESSION = {
  26723. /**
  26724. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  26725. * the reconciliation.
  26726. */
  26727. initialize: function () {
  26728. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  26729. ReactBrowserEventEmitter.setEnabled(false);
  26730. return currentlyEnabled;
  26731. },
  26732. /**
  26733. * @param {boolean} previouslyEnabled Enabled status of
  26734. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  26735. * restores the previous value.
  26736. */
  26737. close: function (previouslyEnabled) {
  26738. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  26739. }
  26740. };
  26741. /**
  26742. * Provides a queue for collecting `componentDidMount` and
  26743. * `componentDidUpdate` callbacks during the transaction.
  26744. */
  26745. var ON_DOM_READY_QUEUEING = {
  26746. /**
  26747. * Initializes the internal `onDOMReady` queue.
  26748. */
  26749. initialize: function () {
  26750. this.reactMountReady.reset();
  26751. },
  26752. /**
  26753. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  26754. */
  26755. close: function () {
  26756. this.reactMountReady.notifyAll();
  26757. }
  26758. };
  26759. /**
  26760. * Executed within the scope of the `Transaction` instance. Consider these as
  26761. * being member methods, but with an implied ordering while being isolated from
  26762. * each other.
  26763. */
  26764. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  26765. if (false) {
  26766. TRANSACTION_WRAPPERS.push({
  26767. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  26768. close: ReactInstrumentation.debugTool.onEndFlush
  26769. });
  26770. }
  26771. /**
  26772. * Currently:
  26773. * - The order that these are listed in the transaction is critical:
  26774. * - Suppresses events.
  26775. * - Restores selection range.
  26776. *
  26777. * Future:
  26778. * - Restore document/overflow scroll positions that were unintentionally
  26779. * modified via DOM insertions above the top viewport boundary.
  26780. * - Implement/integrate with customized constraint based layout system and keep
  26781. * track of which dimensions must be remeasured.
  26782. *
  26783. * @class ReactReconcileTransaction
  26784. */
  26785. function ReactReconcileTransaction(useCreateElement) {
  26786. this.reinitializeTransaction();
  26787. // Only server-side rendering really needs this option (see
  26788. // `ReactServerRendering`), but server-side uses
  26789. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  26790. // accessible and defaults to false when `ReactDOMComponent` and
  26791. // `ReactDOMTextComponent` checks it in `mountComponent`.`
  26792. this.renderToStaticMarkup = false;
  26793. this.reactMountReady = CallbackQueue.getPooled(null);
  26794. this.useCreateElement = useCreateElement;
  26795. }
  26796. var Mixin = {
  26797. /**
  26798. * @see Transaction
  26799. * @abstract
  26800. * @final
  26801. * @return {array<object>} List of operation wrap procedures.
  26802. * TODO: convert to array<TransactionWrapper>
  26803. */
  26804. getTransactionWrappers: function () {
  26805. return TRANSACTION_WRAPPERS;
  26806. },
  26807. /**
  26808. * @return {object} The queue to collect `onDOMReady` callbacks with.
  26809. */
  26810. getReactMountReady: function () {
  26811. return this.reactMountReady;
  26812. },
  26813. /**
  26814. * @return {object} The queue to collect React async events.
  26815. */
  26816. getUpdateQueue: function () {
  26817. return ReactUpdateQueue;
  26818. },
  26819. /**
  26820. * Save current transaction state -- if the return value from this method is
  26821. * passed to `rollback`, the transaction will be reset to that state.
  26822. */
  26823. checkpoint: function () {
  26824. // reactMountReady is the our only stateful wrapper
  26825. return this.reactMountReady.checkpoint();
  26826. },
  26827. rollback: function (checkpoint) {
  26828. this.reactMountReady.rollback(checkpoint);
  26829. },
  26830. /**
  26831. * `PooledClass` looks for this, and will invoke this before allowing this
  26832. * instance to be reused.
  26833. */
  26834. destructor: function () {
  26835. CallbackQueue.release(this.reactMountReady);
  26836. this.reactMountReady = null;
  26837. }
  26838. };
  26839. _assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
  26840. PooledClass.addPoolingTo(ReactReconcileTransaction);
  26841. module.exports = ReactReconcileTransaction;
  26842. /***/ }),
  26843. /* 185 */
  26844. /***/ (function(module, exports, __webpack_require__) {
  26845. "use strict";
  26846. /**
  26847. * Copyright 2013-present, Facebook, Inc.
  26848. * All rights reserved.
  26849. *
  26850. * This source code is licensed under the BSD-style license found in the
  26851. * LICENSE file in the root directory of this source tree. An additional grant
  26852. * of patent rights can be found in the PATENTS file in the same directory.
  26853. *
  26854. *
  26855. */
  26856. var ReactOwner = __webpack_require__(182);
  26857. var ReactRef = {};
  26858. function attachRef(ref, component, owner) {
  26859. if (typeof ref === 'function') {
  26860. ref(component.getPublicInstance());
  26861. } else {
  26862. // Legacy ref
  26863. ReactOwner.addComponentAsRefTo(component, ref, owner);
  26864. }
  26865. }
  26866. function detachRef(ref, component, owner) {
  26867. if (typeof ref === 'function') {
  26868. ref(null);
  26869. } else {
  26870. // Legacy ref
  26871. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  26872. }
  26873. }
  26874. ReactRef.attachRefs = function (instance, element) {
  26875. if (element === null || typeof element !== 'object') {
  26876. return;
  26877. }
  26878. var ref = element.ref;
  26879. if (ref != null) {
  26880. attachRef(ref, instance, element._owner);
  26881. }
  26882. };
  26883. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  26884. // If either the owner or a `ref` has changed, make sure the newest owner
  26885. // has stored a reference to `this`, and the previous owner (if different)
  26886. // has forgotten the reference to `this`. We use the element instead
  26887. // of the public this.props because the post processing cannot determine
  26888. // a ref. The ref conceptually lives on the element.
  26889. // TODO: Should this even be possible? The owner cannot change because
  26890. // it's forbidden by shouldUpdateReactComponent. The ref can change
  26891. // if you swap the keys of but not the refs. Reconsider where this check
  26892. // is made. It probably belongs where the key checking and
  26893. // instantiateReactComponent is done.
  26894. var prevRef = null;
  26895. var prevOwner = null;
  26896. if (prevElement !== null && typeof prevElement === 'object') {
  26897. prevRef = prevElement.ref;
  26898. prevOwner = prevElement._owner;
  26899. }
  26900. var nextRef = null;
  26901. var nextOwner = null;
  26902. if (nextElement !== null && typeof nextElement === 'object') {
  26903. nextRef = nextElement.ref;
  26904. nextOwner = nextElement._owner;
  26905. }
  26906. return prevRef !== nextRef ||
  26907. // If owner changes but we have an unchanged function ref, don't update refs
  26908. typeof nextRef === 'string' && nextOwner !== prevOwner;
  26909. };
  26910. ReactRef.detachRefs = function (instance, element) {
  26911. if (element === null || typeof element !== 'object') {
  26912. return;
  26913. }
  26914. var ref = element.ref;
  26915. if (ref != null) {
  26916. detachRef(ref, instance, element._owner);
  26917. }
  26918. };
  26919. module.exports = ReactRef;
  26920. /***/ }),
  26921. /* 186 */
  26922. /***/ (function(module, exports, __webpack_require__) {
  26923. "use strict";
  26924. /**
  26925. * Copyright 2014-present, Facebook, Inc.
  26926. * All rights reserved.
  26927. *
  26928. * This source code is licensed under the BSD-style license found in the
  26929. * LICENSE file in the root directory of this source tree. An additional grant
  26930. * of patent rights can be found in the PATENTS file in the same directory.
  26931. *
  26932. */
  26933. var _assign = __webpack_require__(3);
  26934. var PooledClass = __webpack_require__(16);
  26935. var Transaction = __webpack_require__(33);
  26936. var ReactInstrumentation = __webpack_require__(11);
  26937. var ReactServerUpdateQueue = __webpack_require__(187);
  26938. /**
  26939. * Executed within the scope of the `Transaction` instance. Consider these as
  26940. * being member methods, but with an implied ordering while being isolated from
  26941. * each other.
  26942. */
  26943. var TRANSACTION_WRAPPERS = [];
  26944. if (false) {
  26945. TRANSACTION_WRAPPERS.push({
  26946. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  26947. close: ReactInstrumentation.debugTool.onEndFlush
  26948. });
  26949. }
  26950. var noopCallbackQueue = {
  26951. enqueue: function () {}
  26952. };
  26953. /**
  26954. * @class ReactServerRenderingTransaction
  26955. * @param {boolean} renderToStaticMarkup
  26956. */
  26957. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  26958. this.reinitializeTransaction();
  26959. this.renderToStaticMarkup = renderToStaticMarkup;
  26960. this.useCreateElement = false;
  26961. this.updateQueue = new ReactServerUpdateQueue(this);
  26962. }
  26963. var Mixin = {
  26964. /**
  26965. * @see Transaction
  26966. * @abstract
  26967. * @final
  26968. * @return {array} Empty list of operation wrap procedures.
  26969. */
  26970. getTransactionWrappers: function () {
  26971. return TRANSACTION_WRAPPERS;
  26972. },
  26973. /**
  26974. * @return {object} The queue to collect `onDOMReady` callbacks with.
  26975. */
  26976. getReactMountReady: function () {
  26977. return noopCallbackQueue;
  26978. },
  26979. /**
  26980. * @return {object} The queue to collect React async events.
  26981. */
  26982. getUpdateQueue: function () {
  26983. return this.updateQueue;
  26984. },
  26985. /**
  26986. * `PooledClass` looks for this, and will invoke this before allowing this
  26987. * instance to be reused.
  26988. */
  26989. destructor: function () {},
  26990. checkpoint: function () {},
  26991. rollback: function () {}
  26992. };
  26993. _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
  26994. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  26995. module.exports = ReactServerRenderingTransaction;
  26996. /***/ }),
  26997. /* 187 */
  26998. /***/ (function(module, exports, __webpack_require__) {
  26999. "use strict";
  27000. /**
  27001. * Copyright 2015-present, Facebook, Inc.
  27002. * All rights reserved.
  27003. *
  27004. * This source code is licensed under the BSD-style license found in the
  27005. * LICENSE file in the root directory of this source tree. An additional grant
  27006. * of patent rights can be found in the PATENTS file in the same directory.
  27007. *
  27008. *
  27009. */
  27010. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  27011. var ReactUpdateQueue = __webpack_require__(59);
  27012. var warning = __webpack_require__(1);
  27013. function warnNoop(publicInstance, callerName) {
  27014. if (false) {
  27015. var constructor = publicInstance.constructor;
  27016. 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;
  27017. }
  27018. }
  27019. /**
  27020. * This is the update queue used for server rendering.
  27021. * It delegates to ReactUpdateQueue while server rendering is in progress and
  27022. * switches to ReactNoopUpdateQueue after the transaction has completed.
  27023. * @class ReactServerUpdateQueue
  27024. * @param {Transaction} transaction
  27025. */
  27026. var ReactServerUpdateQueue = function () {
  27027. function ReactServerUpdateQueue(transaction) {
  27028. _classCallCheck(this, ReactServerUpdateQueue);
  27029. this.transaction = transaction;
  27030. }
  27031. /**
  27032. * Checks whether or not this composite component is mounted.
  27033. * @param {ReactClass} publicInstance The instance we want to test.
  27034. * @return {boolean} True if mounted, false otherwise.
  27035. * @protected
  27036. * @final
  27037. */
  27038. ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
  27039. return false;
  27040. };
  27041. /**
  27042. * Enqueue a callback that will be executed after all the pending updates
  27043. * have processed.
  27044. *
  27045. * @param {ReactClass} publicInstance The instance to use as `this` context.
  27046. * @param {?function} callback Called after state is updated.
  27047. * @internal
  27048. */
  27049. ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
  27050. if (this.transaction.isInTransaction()) {
  27051. ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
  27052. }
  27053. };
  27054. /**
  27055. * Forces an update. This should only be invoked when it is known with
  27056. * certainty that we are **not** in a DOM transaction.
  27057. *
  27058. * You may want to call this when you know that some deeper aspect of the
  27059. * component's state has changed but `setState` was not called.
  27060. *
  27061. * This will not invoke `shouldComponentUpdate`, but it will invoke
  27062. * `componentWillUpdate` and `componentDidUpdate`.
  27063. *
  27064. * @param {ReactClass} publicInstance The instance that should rerender.
  27065. * @internal
  27066. */
  27067. ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
  27068. if (this.transaction.isInTransaction()) {
  27069. ReactUpdateQueue.enqueueForceUpdate(publicInstance);
  27070. } else {
  27071. warnNoop(publicInstance, 'forceUpdate');
  27072. }
  27073. };
  27074. /**
  27075. * Replaces all of the state. Always use this or `setState` to mutate state.
  27076. * You should treat `this.state` as immutable.
  27077. *
  27078. * There is no guarantee that `this.state` will be immediately updated, so
  27079. * accessing `this.state` after calling this method may return the old value.
  27080. *
  27081. * @param {ReactClass} publicInstance The instance that should rerender.
  27082. * @param {object|function} completeState Next state.
  27083. * @internal
  27084. */
  27085. ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
  27086. if (this.transaction.isInTransaction()) {
  27087. ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
  27088. } else {
  27089. warnNoop(publicInstance, 'replaceState');
  27090. }
  27091. };
  27092. /**
  27093. * Sets a subset of the state. This only exists because _pendingState is
  27094. * internal. This provides a merging strategy that is not available to deep
  27095. * properties which is confusing. TODO: Expose pendingState or don't use it
  27096. * during the merge.
  27097. *
  27098. * @param {ReactClass} publicInstance The instance that should rerender.
  27099. * @param {object|function} partialState Next partial state to be merged with state.
  27100. * @internal
  27101. */
  27102. ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
  27103. if (this.transaction.isInTransaction()) {
  27104. ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
  27105. } else {
  27106. warnNoop(publicInstance, 'setState');
  27107. }
  27108. };
  27109. return ReactServerUpdateQueue;
  27110. }();
  27111. module.exports = ReactServerUpdateQueue;
  27112. /***/ }),
  27113. /* 188 */
  27114. /***/ (function(module, exports, __webpack_require__) {
  27115. "use strict";
  27116. /**
  27117. * Copyright 2013-present, Facebook, Inc.
  27118. * All rights reserved.
  27119. *
  27120. * This source code is licensed under the BSD-style license found in the
  27121. * LICENSE file in the root directory of this source tree. An additional grant
  27122. * of patent rights can be found in the PATENTS file in the same directory.
  27123. *
  27124. */
  27125. module.exports = '15.4.2';
  27126. /***/ }),
  27127. /* 189 */
  27128. /***/ (function(module, exports, __webpack_require__) {
  27129. "use strict";
  27130. /**
  27131. * Copyright 2013-present, Facebook, Inc.
  27132. * All rights reserved.
  27133. *
  27134. * This source code is licensed under the BSD-style license found in the
  27135. * LICENSE file in the root directory of this source tree. An additional grant
  27136. * of patent rights can be found in the PATENTS file in the same directory.
  27137. *
  27138. */
  27139. var NS = {
  27140. xlink: 'http://www.w3.org/1999/xlink',
  27141. xml: 'http://www.w3.org/XML/1998/namespace'
  27142. };
  27143. // We use attributes for everything SVG so let's avoid some duplication and run
  27144. // code instead.
  27145. // The following are all specified in the HTML config already so we exclude here.
  27146. // - class (as className)
  27147. // - color
  27148. // - height
  27149. // - id
  27150. // - lang
  27151. // - max
  27152. // - media
  27153. // - method
  27154. // - min
  27155. // - name
  27156. // - style
  27157. // - target
  27158. // - type
  27159. // - width
  27160. var ATTRS = {
  27161. accentHeight: 'accent-height',
  27162. accumulate: 0,
  27163. additive: 0,
  27164. alignmentBaseline: 'alignment-baseline',
  27165. allowReorder: 'allowReorder',
  27166. alphabetic: 0,
  27167. amplitude: 0,
  27168. arabicForm: 'arabic-form',
  27169. ascent: 0,
  27170. attributeName: 'attributeName',
  27171. attributeType: 'attributeType',
  27172. autoReverse: 'autoReverse',
  27173. azimuth: 0,
  27174. baseFrequency: 'baseFrequency',
  27175. baseProfile: 'baseProfile',
  27176. baselineShift: 'baseline-shift',
  27177. bbox: 0,
  27178. begin: 0,
  27179. bias: 0,
  27180. by: 0,
  27181. calcMode: 'calcMode',
  27182. capHeight: 'cap-height',
  27183. clip: 0,
  27184. clipPath: 'clip-path',
  27185. clipRule: 'clip-rule',
  27186. clipPathUnits: 'clipPathUnits',
  27187. colorInterpolation: 'color-interpolation',
  27188. colorInterpolationFilters: 'color-interpolation-filters',
  27189. colorProfile: 'color-profile',
  27190. colorRendering: 'color-rendering',
  27191. contentScriptType: 'contentScriptType',
  27192. contentStyleType: 'contentStyleType',
  27193. cursor: 0,
  27194. cx: 0,
  27195. cy: 0,
  27196. d: 0,
  27197. decelerate: 0,
  27198. descent: 0,
  27199. diffuseConstant: 'diffuseConstant',
  27200. direction: 0,
  27201. display: 0,
  27202. divisor: 0,
  27203. dominantBaseline: 'dominant-baseline',
  27204. dur: 0,
  27205. dx: 0,
  27206. dy: 0,
  27207. edgeMode: 'edgeMode',
  27208. elevation: 0,
  27209. enableBackground: 'enable-background',
  27210. end: 0,
  27211. exponent: 0,
  27212. externalResourcesRequired: 'externalResourcesRequired',
  27213. fill: 0,
  27214. fillOpacity: 'fill-opacity',
  27215. fillRule: 'fill-rule',
  27216. filter: 0,
  27217. filterRes: 'filterRes',
  27218. filterUnits: 'filterUnits',
  27219. floodColor: 'flood-color',
  27220. floodOpacity: 'flood-opacity',
  27221. focusable: 0,
  27222. fontFamily: 'font-family',
  27223. fontSize: 'font-size',
  27224. fontSizeAdjust: 'font-size-adjust',
  27225. fontStretch: 'font-stretch',
  27226. fontStyle: 'font-style',
  27227. fontVariant: 'font-variant',
  27228. fontWeight: 'font-weight',
  27229. format: 0,
  27230. from: 0,
  27231. fx: 0,
  27232. fy: 0,
  27233. g1: 0,
  27234. g2: 0,
  27235. glyphName: 'glyph-name',
  27236. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  27237. glyphOrientationVertical: 'glyph-orientation-vertical',
  27238. glyphRef: 'glyphRef',
  27239. gradientTransform: 'gradientTransform',
  27240. gradientUnits: 'gradientUnits',
  27241. hanging: 0,
  27242. horizAdvX: 'horiz-adv-x',
  27243. horizOriginX: 'horiz-origin-x',
  27244. ideographic: 0,
  27245. imageRendering: 'image-rendering',
  27246. 'in': 0,
  27247. in2: 0,
  27248. intercept: 0,
  27249. k: 0,
  27250. k1: 0,
  27251. k2: 0,
  27252. k3: 0,
  27253. k4: 0,
  27254. kernelMatrix: 'kernelMatrix',
  27255. kernelUnitLength: 'kernelUnitLength',
  27256. kerning: 0,
  27257. keyPoints: 'keyPoints',
  27258. keySplines: 'keySplines',
  27259. keyTimes: 'keyTimes',
  27260. lengthAdjust: 'lengthAdjust',
  27261. letterSpacing: 'letter-spacing',
  27262. lightingColor: 'lighting-color',
  27263. limitingConeAngle: 'limitingConeAngle',
  27264. local: 0,
  27265. markerEnd: 'marker-end',
  27266. markerMid: 'marker-mid',
  27267. markerStart: 'marker-start',
  27268. markerHeight: 'markerHeight',
  27269. markerUnits: 'markerUnits',
  27270. markerWidth: 'markerWidth',
  27271. mask: 0,
  27272. maskContentUnits: 'maskContentUnits',
  27273. maskUnits: 'maskUnits',
  27274. mathematical: 0,
  27275. mode: 0,
  27276. numOctaves: 'numOctaves',
  27277. offset: 0,
  27278. opacity: 0,
  27279. operator: 0,
  27280. order: 0,
  27281. orient: 0,
  27282. orientation: 0,
  27283. origin: 0,
  27284. overflow: 0,
  27285. overlinePosition: 'overline-position',
  27286. overlineThickness: 'overline-thickness',
  27287. paintOrder: 'paint-order',
  27288. panose1: 'panose-1',
  27289. pathLength: 'pathLength',
  27290. patternContentUnits: 'patternContentUnits',
  27291. patternTransform: 'patternTransform',
  27292. patternUnits: 'patternUnits',
  27293. pointerEvents: 'pointer-events',
  27294. points: 0,
  27295. pointsAtX: 'pointsAtX',
  27296. pointsAtY: 'pointsAtY',
  27297. pointsAtZ: 'pointsAtZ',
  27298. preserveAlpha: 'preserveAlpha',
  27299. preserveAspectRatio: 'preserveAspectRatio',
  27300. primitiveUnits: 'primitiveUnits',
  27301. r: 0,
  27302. radius: 0,
  27303. refX: 'refX',
  27304. refY: 'refY',
  27305. renderingIntent: 'rendering-intent',
  27306. repeatCount: 'repeatCount',
  27307. repeatDur: 'repeatDur',
  27308. requiredExtensions: 'requiredExtensions',
  27309. requiredFeatures: 'requiredFeatures',
  27310. restart: 0,
  27311. result: 0,
  27312. rotate: 0,
  27313. rx: 0,
  27314. ry: 0,
  27315. scale: 0,
  27316. seed: 0,
  27317. shapeRendering: 'shape-rendering',
  27318. slope: 0,
  27319. spacing: 0,
  27320. specularConstant: 'specularConstant',
  27321. specularExponent: 'specularExponent',
  27322. speed: 0,
  27323. spreadMethod: 'spreadMethod',
  27324. startOffset: 'startOffset',
  27325. stdDeviation: 'stdDeviation',
  27326. stemh: 0,
  27327. stemv: 0,
  27328. stitchTiles: 'stitchTiles',
  27329. stopColor: 'stop-color',
  27330. stopOpacity: 'stop-opacity',
  27331. strikethroughPosition: 'strikethrough-position',
  27332. strikethroughThickness: 'strikethrough-thickness',
  27333. string: 0,
  27334. stroke: 0,
  27335. strokeDasharray: 'stroke-dasharray',
  27336. strokeDashoffset: 'stroke-dashoffset',
  27337. strokeLinecap: 'stroke-linecap',
  27338. strokeLinejoin: 'stroke-linejoin',
  27339. strokeMiterlimit: 'stroke-miterlimit',
  27340. strokeOpacity: 'stroke-opacity',
  27341. strokeWidth: 'stroke-width',
  27342. surfaceScale: 'surfaceScale',
  27343. systemLanguage: 'systemLanguage',
  27344. tableValues: 'tableValues',
  27345. targetX: 'targetX',
  27346. targetY: 'targetY',
  27347. textAnchor: 'text-anchor',
  27348. textDecoration: 'text-decoration',
  27349. textRendering: 'text-rendering',
  27350. textLength: 'textLength',
  27351. to: 0,
  27352. transform: 0,
  27353. u1: 0,
  27354. u2: 0,
  27355. underlinePosition: 'underline-position',
  27356. underlineThickness: 'underline-thickness',
  27357. unicode: 0,
  27358. unicodeBidi: 'unicode-bidi',
  27359. unicodeRange: 'unicode-range',
  27360. unitsPerEm: 'units-per-em',
  27361. vAlphabetic: 'v-alphabetic',
  27362. vHanging: 'v-hanging',
  27363. vIdeographic: 'v-ideographic',
  27364. vMathematical: 'v-mathematical',
  27365. values: 0,
  27366. vectorEffect: 'vector-effect',
  27367. version: 0,
  27368. vertAdvY: 'vert-adv-y',
  27369. vertOriginX: 'vert-origin-x',
  27370. vertOriginY: 'vert-origin-y',
  27371. viewBox: 'viewBox',
  27372. viewTarget: 'viewTarget',
  27373. visibility: 0,
  27374. widths: 0,
  27375. wordSpacing: 'word-spacing',
  27376. writingMode: 'writing-mode',
  27377. x: 0,
  27378. xHeight: 'x-height',
  27379. x1: 0,
  27380. x2: 0,
  27381. xChannelSelector: 'xChannelSelector',
  27382. xlinkActuate: 'xlink:actuate',
  27383. xlinkArcrole: 'xlink:arcrole',
  27384. xlinkHref: 'xlink:href',
  27385. xlinkRole: 'xlink:role',
  27386. xlinkShow: 'xlink:show',
  27387. xlinkTitle: 'xlink:title',
  27388. xlinkType: 'xlink:type',
  27389. xmlBase: 'xml:base',
  27390. xmlns: 0,
  27391. xmlnsXlink: 'xmlns:xlink',
  27392. xmlLang: 'xml:lang',
  27393. xmlSpace: 'xml:space',
  27394. y: 0,
  27395. y1: 0,
  27396. y2: 0,
  27397. yChannelSelector: 'yChannelSelector',
  27398. z: 0,
  27399. zoomAndPan: 'zoomAndPan'
  27400. };
  27401. var SVGDOMPropertyConfig = {
  27402. Properties: {},
  27403. DOMAttributeNamespaces: {
  27404. xlinkActuate: NS.xlink,
  27405. xlinkArcrole: NS.xlink,
  27406. xlinkHref: NS.xlink,
  27407. xlinkRole: NS.xlink,
  27408. xlinkShow: NS.xlink,
  27409. xlinkTitle: NS.xlink,
  27410. xlinkType: NS.xlink,
  27411. xmlBase: NS.xml,
  27412. xmlLang: NS.xml,
  27413. xmlSpace: NS.xml
  27414. },
  27415. DOMAttributeNames: {}
  27416. };
  27417. Object.keys(ATTRS).forEach(function (key) {
  27418. SVGDOMPropertyConfig.Properties[key] = 0;
  27419. if (ATTRS[key]) {
  27420. SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  27421. }
  27422. });
  27423. module.exports = SVGDOMPropertyConfig;
  27424. /***/ }),
  27425. /* 190 */
  27426. /***/ (function(module, exports, __webpack_require__) {
  27427. "use strict";
  27428. /**
  27429. * Copyright 2013-present, Facebook, Inc.
  27430. * All rights reserved.
  27431. *
  27432. * This source code is licensed under the BSD-style license found in the
  27433. * LICENSE file in the root directory of this source tree. An additional grant
  27434. * of patent rights can be found in the PATENTS file in the same directory.
  27435. *
  27436. */
  27437. var EventPropagators = __webpack_require__(27);
  27438. var ExecutionEnvironment = __webpack_require__(8);
  27439. var ReactDOMComponentTree = __webpack_require__(5);
  27440. var ReactInputSelection = __webpack_require__(83);
  27441. var SyntheticEvent = __webpack_require__(13);
  27442. var getActiveElement = __webpack_require__(73);
  27443. var isTextInputElement = __webpack_require__(92);
  27444. var shallowEqual = __webpack_require__(50);
  27445. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  27446. var eventTypes = {
  27447. select: {
  27448. phasedRegistrationNames: {
  27449. bubbled: 'onSelect',
  27450. captured: 'onSelectCapture'
  27451. },
  27452. dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
  27453. }
  27454. };
  27455. var activeElement = null;
  27456. var activeElementInst = null;
  27457. var lastSelection = null;
  27458. var mouseDown = false;
  27459. // Track whether a listener exists for this plugin. If none exist, we do
  27460. // not extract events. See #3639.
  27461. var hasListener = false;
  27462. /**
  27463. * Get an object which is a unique representation of the current selection.
  27464. *
  27465. * The return value will not be consistent across nodes or browsers, but
  27466. * two identical selections on the same node will return identical objects.
  27467. *
  27468. * @param {DOMElement} node
  27469. * @return {object}
  27470. */
  27471. function getSelection(node) {
  27472. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  27473. return {
  27474. start: node.selectionStart,
  27475. end: node.selectionEnd
  27476. };
  27477. } else if (window.getSelection) {
  27478. var selection = window.getSelection();
  27479. return {
  27480. anchorNode: selection.anchorNode,
  27481. anchorOffset: selection.anchorOffset,
  27482. focusNode: selection.focusNode,
  27483. focusOffset: selection.focusOffset
  27484. };
  27485. } else if (document.selection) {
  27486. var range = document.selection.createRange();
  27487. return {
  27488. parentElement: range.parentElement(),
  27489. text: range.text,
  27490. top: range.boundingTop,
  27491. left: range.boundingLeft
  27492. };
  27493. }
  27494. }
  27495. /**
  27496. * Poll selection to see whether it's changed.
  27497. *
  27498. * @param {object} nativeEvent
  27499. * @return {?SyntheticEvent}
  27500. */
  27501. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  27502. // Ensure we have the right element, and that the user is not dragging a
  27503. // selection (this matches native `select` event behavior). In HTML5, select
  27504. // fires only on input and textarea thus if there's no focused element we
  27505. // won't dispatch.
  27506. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  27507. return null;
  27508. }
  27509. // Only fire when selection has actually changed.
  27510. var currentSelection = getSelection(activeElement);
  27511. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  27512. lastSelection = currentSelection;
  27513. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
  27514. syntheticEvent.type = 'select';
  27515. syntheticEvent.target = activeElement;
  27516. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  27517. return syntheticEvent;
  27518. }
  27519. return null;
  27520. }
  27521. /**
  27522. * This plugin creates an `onSelect` event that normalizes select events
  27523. * across form elements.
  27524. *
  27525. * Supported elements are:
  27526. * - input (see `isTextInputElement`)
  27527. * - textarea
  27528. * - contentEditable
  27529. *
  27530. * This differs from native browser implementations in the following ways:
  27531. * - Fires on contentEditable fields as well as inputs.
  27532. * - Fires for collapsed selection.
  27533. * - Fires after user input.
  27534. */
  27535. var SelectEventPlugin = {
  27536. eventTypes: eventTypes,
  27537. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  27538. if (!hasListener) {
  27539. return null;
  27540. }
  27541. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  27542. switch (topLevelType) {
  27543. // Track the input node that has focus.
  27544. case 'topFocus':
  27545. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  27546. activeElement = targetNode;
  27547. activeElementInst = targetInst;
  27548. lastSelection = null;
  27549. }
  27550. break;
  27551. case 'topBlur':
  27552. activeElement = null;
  27553. activeElementInst = null;
  27554. lastSelection = null;
  27555. break;
  27556. // Don't fire the event while the user is dragging. This matches the
  27557. // semantics of the native select event.
  27558. case 'topMouseDown':
  27559. mouseDown = true;
  27560. break;
  27561. case 'topContextMenu':
  27562. case 'topMouseUp':
  27563. mouseDown = false;
  27564. return constructSelectEvent(nativeEvent, nativeEventTarget);
  27565. // Chrome and IE fire non-standard event when selection is changed (and
  27566. // sometimes when it hasn't). IE's event fires out of order with respect
  27567. // to key and input events on deletion, so we discard it.
  27568. //
  27569. // Firefox doesn't support selectionchange, so check selection status
  27570. // after each key entry. The selection changes after keydown and before
  27571. // keyup, but we check on keydown as well in the case of holding down a
  27572. // key, when multiple keydown events are fired but only one keyup is.
  27573. // This is also our approach for IE handling, for the reason above.
  27574. case 'topSelectionChange':
  27575. if (skipSelectionChangeEvent) {
  27576. break;
  27577. }
  27578. // falls through
  27579. case 'topKeyDown':
  27580. case 'topKeyUp':
  27581. return constructSelectEvent(nativeEvent, nativeEventTarget);
  27582. }
  27583. return null;
  27584. },
  27585. didPutListener: function (inst, registrationName, listener) {
  27586. if (registrationName === 'onSelect') {
  27587. hasListener = true;
  27588. }
  27589. }
  27590. };
  27591. module.exports = SelectEventPlugin;
  27592. /***/ }),
  27593. /* 191 */
  27594. /***/ (function(module, exports, __webpack_require__) {
  27595. "use strict";
  27596. /**
  27597. * Copyright 2013-present, Facebook, Inc.
  27598. * All rights reserved.
  27599. *
  27600. * This source code is licensed under the BSD-style license found in the
  27601. * LICENSE file in the root directory of this source tree. An additional grant
  27602. * of patent rights can be found in the PATENTS file in the same directory.
  27603. *
  27604. *
  27605. */
  27606. var _prodInvariant = __webpack_require__(2);
  27607. var EventListener = __webpack_require__(71);
  27608. var EventPropagators = __webpack_require__(27);
  27609. var ReactDOMComponentTree = __webpack_require__(5);
  27610. var SyntheticAnimationEvent = __webpack_require__(192);
  27611. var SyntheticClipboardEvent = __webpack_require__(193);
  27612. var SyntheticEvent = __webpack_require__(13);
  27613. var SyntheticFocusEvent = __webpack_require__(196);
  27614. var SyntheticKeyboardEvent = __webpack_require__(198);
  27615. var SyntheticMouseEvent = __webpack_require__(32);
  27616. var SyntheticDragEvent = __webpack_require__(195);
  27617. var SyntheticTouchEvent = __webpack_require__(199);
  27618. var SyntheticTransitionEvent = __webpack_require__(200);
  27619. var SyntheticUIEvent = __webpack_require__(29);
  27620. var SyntheticWheelEvent = __webpack_require__(201);
  27621. var emptyFunction = __webpack_require__(10);
  27622. var getEventCharCode = __webpack_require__(61);
  27623. var invariant = __webpack_require__(0);
  27624. /**
  27625. * Turns
  27626. * ['abort', ...]
  27627. * into
  27628. * eventTypes = {
  27629. * 'abort': {
  27630. * phasedRegistrationNames: {
  27631. * bubbled: 'onAbort',
  27632. * captured: 'onAbortCapture',
  27633. * },
  27634. * dependencies: ['topAbort'],
  27635. * },
  27636. * ...
  27637. * };
  27638. * topLevelEventsToDispatchConfig = {
  27639. * 'topAbort': { sameConfig }
  27640. * };
  27641. */
  27642. var eventTypes = {};
  27643. var topLevelEventsToDispatchConfig = {};
  27644. ['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) {
  27645. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  27646. var onEvent = 'on' + capitalizedEvent;
  27647. var topEvent = 'top' + capitalizedEvent;
  27648. var type = {
  27649. phasedRegistrationNames: {
  27650. bubbled: onEvent,
  27651. captured: onEvent + 'Capture'
  27652. },
  27653. dependencies: [topEvent]
  27654. };
  27655. eventTypes[event] = type;
  27656. topLevelEventsToDispatchConfig[topEvent] = type;
  27657. });
  27658. var onClickListeners = {};
  27659. function getDictionaryKey(inst) {
  27660. // Prevents V8 performance issue:
  27661. // https://github.com/facebook/react/pull/7232
  27662. return '.' + inst._rootNodeID;
  27663. }
  27664. function isInteractive(tag) {
  27665. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  27666. }
  27667. var SimpleEventPlugin = {
  27668. eventTypes: eventTypes,
  27669. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  27670. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  27671. if (!dispatchConfig) {
  27672. return null;
  27673. }
  27674. var EventConstructor;
  27675. switch (topLevelType) {
  27676. case 'topAbort':
  27677. case 'topCanPlay':
  27678. case 'topCanPlayThrough':
  27679. case 'topDurationChange':
  27680. case 'topEmptied':
  27681. case 'topEncrypted':
  27682. case 'topEnded':
  27683. case 'topError':
  27684. case 'topInput':
  27685. case 'topInvalid':
  27686. case 'topLoad':
  27687. case 'topLoadedData':
  27688. case 'topLoadedMetadata':
  27689. case 'topLoadStart':
  27690. case 'topPause':
  27691. case 'topPlay':
  27692. case 'topPlaying':
  27693. case 'topProgress':
  27694. case 'topRateChange':
  27695. case 'topReset':
  27696. case 'topSeeked':
  27697. case 'topSeeking':
  27698. case 'topStalled':
  27699. case 'topSubmit':
  27700. case 'topSuspend':
  27701. case 'topTimeUpdate':
  27702. case 'topVolumeChange':
  27703. case 'topWaiting':
  27704. // HTML Events
  27705. // @see http://www.w3.org/TR/html5/index.html#events-0
  27706. EventConstructor = SyntheticEvent;
  27707. break;
  27708. case 'topKeyPress':
  27709. // Firefox creates a keypress event for function keys too. This removes
  27710. // the unwanted keypress events. Enter is however both printable and
  27711. // non-printable. One would expect Tab to be as well (but it isn't).
  27712. if (getEventCharCode(nativeEvent) === 0) {
  27713. return null;
  27714. }
  27715. /* falls through */
  27716. case 'topKeyDown':
  27717. case 'topKeyUp':
  27718. EventConstructor = SyntheticKeyboardEvent;
  27719. break;
  27720. case 'topBlur':
  27721. case 'topFocus':
  27722. EventConstructor = SyntheticFocusEvent;
  27723. break;
  27724. case 'topClick':
  27725. // Firefox creates a click event on right mouse clicks. This removes the
  27726. // unwanted click events.
  27727. if (nativeEvent.button === 2) {
  27728. return null;
  27729. }
  27730. /* falls through */
  27731. case 'topDoubleClick':
  27732. case 'topMouseDown':
  27733. case 'topMouseMove':
  27734. case 'topMouseUp':
  27735. // TODO: Disabled elements should not respond to mouse events
  27736. /* falls through */
  27737. case 'topMouseOut':
  27738. case 'topMouseOver':
  27739. case 'topContextMenu':
  27740. EventConstructor = SyntheticMouseEvent;
  27741. break;
  27742. case 'topDrag':
  27743. case 'topDragEnd':
  27744. case 'topDragEnter':
  27745. case 'topDragExit':
  27746. case 'topDragLeave':
  27747. case 'topDragOver':
  27748. case 'topDragStart':
  27749. case 'topDrop':
  27750. EventConstructor = SyntheticDragEvent;
  27751. break;
  27752. case 'topTouchCancel':
  27753. case 'topTouchEnd':
  27754. case 'topTouchMove':
  27755. case 'topTouchStart':
  27756. EventConstructor = SyntheticTouchEvent;
  27757. break;
  27758. case 'topAnimationEnd':
  27759. case 'topAnimationIteration':
  27760. case 'topAnimationStart':
  27761. EventConstructor = SyntheticAnimationEvent;
  27762. break;
  27763. case 'topTransitionEnd':
  27764. EventConstructor = SyntheticTransitionEvent;
  27765. break;
  27766. case 'topScroll':
  27767. EventConstructor = SyntheticUIEvent;
  27768. break;
  27769. case 'topWheel':
  27770. EventConstructor = SyntheticWheelEvent;
  27771. break;
  27772. case 'topCopy':
  27773. case 'topCut':
  27774. case 'topPaste':
  27775. EventConstructor = SyntheticClipboardEvent;
  27776. break;
  27777. }
  27778. !EventConstructor ? false ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
  27779. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  27780. EventPropagators.accumulateTwoPhaseDispatches(event);
  27781. return event;
  27782. },
  27783. didPutListener: function (inst, registrationName, listener) {
  27784. // Mobile Safari does not fire properly bubble click events on
  27785. // non-interactive elements, which means delegated click listeners do not
  27786. // fire. The workaround for this bug involves attaching an empty click
  27787. // listener on the target node.
  27788. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  27789. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  27790. var key = getDictionaryKey(inst);
  27791. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  27792. if (!onClickListeners[key]) {
  27793. onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
  27794. }
  27795. }
  27796. },
  27797. willDeleteListener: function (inst, registrationName) {
  27798. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  27799. var key = getDictionaryKey(inst);
  27800. onClickListeners[key].remove();
  27801. delete onClickListeners[key];
  27802. }
  27803. }
  27804. };
  27805. module.exports = SimpleEventPlugin;
  27806. /***/ }),
  27807. /* 192 */
  27808. /***/ (function(module, exports, __webpack_require__) {
  27809. "use strict";
  27810. /**
  27811. * Copyright 2013-present, Facebook, Inc.
  27812. * All rights reserved.
  27813. *
  27814. * This source code is licensed under the BSD-style license found in the
  27815. * LICENSE file in the root directory of this source tree. An additional grant
  27816. * of patent rights can be found in the PATENTS file in the same directory.
  27817. *
  27818. */
  27819. var SyntheticEvent = __webpack_require__(13);
  27820. /**
  27821. * @interface Event
  27822. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  27823. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  27824. */
  27825. var AnimationEventInterface = {
  27826. animationName: null,
  27827. elapsedTime: null,
  27828. pseudoElement: null
  27829. };
  27830. /**
  27831. * @param {object} dispatchConfig Configuration used to dispatch this event.
  27832. * @param {string} dispatchMarker Marker identifying the event target.
  27833. * @param {object} nativeEvent Native browser event.
  27834. * @extends {SyntheticEvent}
  27835. */
  27836. function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  27837. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  27838. }
  27839. SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
  27840. module.exports = SyntheticAnimationEvent;
  27841. /***/ }),
  27842. /* 193 */
  27843. /***/ (function(module, exports, __webpack_require__) {
  27844. "use strict";
  27845. /**
  27846. * Copyright 2013-present, Facebook, Inc.
  27847. * All rights reserved.
  27848. *
  27849. * This source code is licensed under the BSD-style license found in the
  27850. * LICENSE file in the root directory of this source tree. An additional grant
  27851. * of patent rights can be found in the PATENTS file in the same directory.
  27852. *
  27853. */
  27854. var SyntheticEvent = __webpack_require__(13);
  27855. /**
  27856. * @interface Event
  27857. * @see http://www.w3.org/TR/clipboard-apis/
  27858. */
  27859. var ClipboardEventInterface = {
  27860. clipboardData: function (event) {
  27861. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  27862. }
  27863. };
  27864. /**
  27865. * @param {object} dispatchConfig Configuration used to dispatch this event.
  27866. * @param {string} dispatchMarker Marker identifying the event target.
  27867. * @param {object} nativeEvent Native browser event.
  27868. * @extends {SyntheticUIEvent}
  27869. */
  27870. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  27871. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  27872. }
  27873. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  27874. module.exports = SyntheticClipboardEvent;
  27875. /***/ }),
  27876. /* 194 */
  27877. /***/ (function(module, exports, __webpack_require__) {
  27878. "use strict";
  27879. /**
  27880. * Copyright 2013-present, Facebook, Inc.
  27881. * All rights reserved.
  27882. *
  27883. * This source code is licensed under the BSD-style license found in the
  27884. * LICENSE file in the root directory of this source tree. An additional grant
  27885. * of patent rights can be found in the PATENTS file in the same directory.
  27886. *
  27887. */
  27888. var SyntheticEvent = __webpack_require__(13);
  27889. /**
  27890. * @interface Event
  27891. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  27892. */
  27893. var CompositionEventInterface = {
  27894. data: null
  27895. };
  27896. /**
  27897. * @param {object} dispatchConfig Configuration used to dispatch this event.
  27898. * @param {string} dispatchMarker Marker identifying the event target.
  27899. * @param {object} nativeEvent Native browser event.
  27900. * @extends {SyntheticUIEvent}
  27901. */
  27902. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  27903. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  27904. }
  27905. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  27906. module.exports = SyntheticCompositionEvent;
  27907. /***/ }),
  27908. /* 195 */
  27909. /***/ (function(module, exports, __webpack_require__) {
  27910. "use strict";
  27911. /**
  27912. * Copyright 2013-present, Facebook, Inc.
  27913. * All rights reserved.
  27914. *
  27915. * This source code is licensed under the BSD-style license found in the
  27916. * LICENSE file in the root directory of this source tree. An additional grant
  27917. * of patent rights can be found in the PATENTS file in the same directory.
  27918. *
  27919. */
  27920. var SyntheticMouseEvent = __webpack_require__(32);
  27921. /**
  27922. * @interface DragEvent
  27923. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  27924. */
  27925. var DragEventInterface = {
  27926. dataTransfer: null
  27927. };
  27928. /**
  27929. * @param {object} dispatchConfig Configuration used to dispatch this event.
  27930. * @param {string} dispatchMarker Marker identifying the event target.
  27931. * @param {object} nativeEvent Native browser event.
  27932. * @extends {SyntheticUIEvent}
  27933. */
  27934. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  27935. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  27936. }
  27937. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  27938. module.exports = SyntheticDragEvent;
  27939. /***/ }),
  27940. /* 196 */
  27941. /***/ (function(module, exports, __webpack_require__) {
  27942. "use strict";
  27943. /**
  27944. * Copyright 2013-present, Facebook, Inc.
  27945. * All rights reserved.
  27946. *
  27947. * This source code is licensed under the BSD-style license found in the
  27948. * LICENSE file in the root directory of this source tree. An additional grant
  27949. * of patent rights can be found in the PATENTS file in the same directory.
  27950. *
  27951. */
  27952. var SyntheticUIEvent = __webpack_require__(29);
  27953. /**
  27954. * @interface FocusEvent
  27955. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  27956. */
  27957. var FocusEventInterface = {
  27958. relatedTarget: null
  27959. };
  27960. /**
  27961. * @param {object} dispatchConfig Configuration used to dispatch this event.
  27962. * @param {string} dispatchMarker Marker identifying the event target.
  27963. * @param {object} nativeEvent Native browser event.
  27964. * @extends {SyntheticUIEvent}
  27965. */
  27966. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  27967. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  27968. }
  27969. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  27970. module.exports = SyntheticFocusEvent;
  27971. /***/ }),
  27972. /* 197 */
  27973. /***/ (function(module, exports, __webpack_require__) {
  27974. "use strict";
  27975. /**
  27976. * Copyright 2013-present, Facebook, Inc.
  27977. * All rights reserved.
  27978. *
  27979. * This source code is licensed under the BSD-style license found in the
  27980. * LICENSE file in the root directory of this source tree. An additional grant
  27981. * of patent rights can be found in the PATENTS file in the same directory.
  27982. *
  27983. */
  27984. var SyntheticEvent = __webpack_require__(13);
  27985. /**
  27986. * @interface Event
  27987. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  27988. * /#events-inputevents
  27989. */
  27990. var InputEventInterface = {
  27991. data: null
  27992. };
  27993. /**
  27994. * @param {object} dispatchConfig Configuration used to dispatch this event.
  27995. * @param {string} dispatchMarker Marker identifying the event target.
  27996. * @param {object} nativeEvent Native browser event.
  27997. * @extends {SyntheticUIEvent}
  27998. */
  27999. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28000. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28001. }
  28002. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  28003. module.exports = SyntheticInputEvent;
  28004. /***/ }),
  28005. /* 198 */
  28006. /***/ (function(module, exports, __webpack_require__) {
  28007. "use strict";
  28008. /**
  28009. * Copyright 2013-present, Facebook, Inc.
  28010. * All rights reserved.
  28011. *
  28012. * This source code is licensed under the BSD-style license found in the
  28013. * LICENSE file in the root directory of this source tree. An additional grant
  28014. * of patent rights can be found in the PATENTS file in the same directory.
  28015. *
  28016. */
  28017. var SyntheticUIEvent = __webpack_require__(29);
  28018. var getEventCharCode = __webpack_require__(61);
  28019. var getEventKey = __webpack_require__(206);
  28020. var getEventModifierState = __webpack_require__(62);
  28021. /**
  28022. * @interface KeyboardEvent
  28023. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28024. */
  28025. var KeyboardEventInterface = {
  28026. key: getEventKey,
  28027. location: null,
  28028. ctrlKey: null,
  28029. shiftKey: null,
  28030. altKey: null,
  28031. metaKey: null,
  28032. repeat: null,
  28033. locale: null,
  28034. getModifierState: getEventModifierState,
  28035. // Legacy Interface
  28036. charCode: function (event) {
  28037. // `charCode` is the result of a KeyPress event and represents the value of
  28038. // the actual printable character.
  28039. // KeyPress is deprecated, but its replacement is not yet final and not
  28040. // implemented in any major browser. Only KeyPress has charCode.
  28041. if (event.type === 'keypress') {
  28042. return getEventCharCode(event);
  28043. }
  28044. return 0;
  28045. },
  28046. keyCode: function (event) {
  28047. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  28048. // physical keyboard key.
  28049. // The actual meaning of the value depends on the users' keyboard layout
  28050. // which cannot be detected. Assuming that it is a US keyboard layout
  28051. // provides a surprisingly accurate mapping for US and European users.
  28052. // Due to this, it is left to the user to implement at this time.
  28053. if (event.type === 'keydown' || event.type === 'keyup') {
  28054. return event.keyCode;
  28055. }
  28056. return 0;
  28057. },
  28058. which: function (event) {
  28059. // `which` is an alias for either `keyCode` or `charCode` depending on the
  28060. // type of the event.
  28061. if (event.type === 'keypress') {
  28062. return getEventCharCode(event);
  28063. }
  28064. if (event.type === 'keydown' || event.type === 'keyup') {
  28065. return event.keyCode;
  28066. }
  28067. return 0;
  28068. }
  28069. };
  28070. /**
  28071. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28072. * @param {string} dispatchMarker Marker identifying the event target.
  28073. * @param {object} nativeEvent Native browser event.
  28074. * @extends {SyntheticUIEvent}
  28075. */
  28076. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28077. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28078. }
  28079. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  28080. module.exports = SyntheticKeyboardEvent;
  28081. /***/ }),
  28082. /* 199 */
  28083. /***/ (function(module, exports, __webpack_require__) {
  28084. "use strict";
  28085. /**
  28086. * Copyright 2013-present, Facebook, Inc.
  28087. * All rights reserved.
  28088. *
  28089. * This source code is licensed under the BSD-style license found in the
  28090. * LICENSE file in the root directory of this source tree. An additional grant
  28091. * of patent rights can be found in the PATENTS file in the same directory.
  28092. *
  28093. */
  28094. var SyntheticUIEvent = __webpack_require__(29);
  28095. var getEventModifierState = __webpack_require__(62);
  28096. /**
  28097. * @interface TouchEvent
  28098. * @see http://www.w3.org/TR/touch-events/
  28099. */
  28100. var TouchEventInterface = {
  28101. touches: null,
  28102. targetTouches: null,
  28103. changedTouches: null,
  28104. altKey: null,
  28105. metaKey: null,
  28106. ctrlKey: null,
  28107. shiftKey: null,
  28108. getModifierState: getEventModifierState
  28109. };
  28110. /**
  28111. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28112. * @param {string} dispatchMarker Marker identifying the event target.
  28113. * @param {object} nativeEvent Native browser event.
  28114. * @extends {SyntheticUIEvent}
  28115. */
  28116. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28117. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28118. }
  28119. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  28120. module.exports = SyntheticTouchEvent;
  28121. /***/ }),
  28122. /* 200 */
  28123. /***/ (function(module, exports, __webpack_require__) {
  28124. "use strict";
  28125. /**
  28126. * Copyright 2013-present, Facebook, Inc.
  28127. * All rights reserved.
  28128. *
  28129. * This source code is licensed under the BSD-style license found in the
  28130. * LICENSE file in the root directory of this source tree. An additional grant
  28131. * of patent rights can be found in the PATENTS file in the same directory.
  28132. *
  28133. */
  28134. var SyntheticEvent = __webpack_require__(13);
  28135. /**
  28136. * @interface Event
  28137. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  28138. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  28139. */
  28140. var TransitionEventInterface = {
  28141. propertyName: null,
  28142. elapsedTime: null,
  28143. pseudoElement: null
  28144. };
  28145. /**
  28146. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28147. * @param {string} dispatchMarker Marker identifying the event target.
  28148. * @param {object} nativeEvent Native browser event.
  28149. * @extends {SyntheticEvent}
  28150. */
  28151. function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28152. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28153. }
  28154. SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
  28155. module.exports = SyntheticTransitionEvent;
  28156. /***/ }),
  28157. /* 201 */
  28158. /***/ (function(module, exports, __webpack_require__) {
  28159. "use strict";
  28160. /**
  28161. * Copyright 2013-present, Facebook, Inc.
  28162. * All rights reserved.
  28163. *
  28164. * This source code is licensed under the BSD-style license found in the
  28165. * LICENSE file in the root directory of this source tree. An additional grant
  28166. * of patent rights can be found in the PATENTS file in the same directory.
  28167. *
  28168. */
  28169. var SyntheticMouseEvent = __webpack_require__(32);
  28170. /**
  28171. * @interface WheelEvent
  28172. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28173. */
  28174. var WheelEventInterface = {
  28175. deltaX: function (event) {
  28176. return 'deltaX' in event ? event.deltaX :
  28177. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  28178. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  28179. },
  28180. deltaY: function (event) {
  28181. return 'deltaY' in event ? event.deltaY :
  28182. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  28183. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  28184. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  28185. 'wheelDelta' in event ? -event.wheelDelta : 0;
  28186. },
  28187. deltaZ: null,
  28188. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  28189. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  28190. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  28191. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  28192. deltaMode: null
  28193. };
  28194. /**
  28195. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28196. * @param {string} dispatchMarker Marker identifying the event target.
  28197. * @param {object} nativeEvent Native browser event.
  28198. * @extends {SyntheticMouseEvent}
  28199. */
  28200. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28201. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28202. }
  28203. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  28204. module.exports = SyntheticWheelEvent;
  28205. /***/ }),
  28206. /* 202 */
  28207. /***/ (function(module, exports, __webpack_require__) {
  28208. "use strict";
  28209. /**
  28210. * Copyright 2013-present, Facebook, Inc.
  28211. * All rights reserved.
  28212. *
  28213. * This source code is licensed under the BSD-style license found in the
  28214. * LICENSE file in the root directory of this source tree. An additional grant
  28215. * of patent rights can be found in the PATENTS file in the same directory.
  28216. *
  28217. *
  28218. */
  28219. var MOD = 65521;
  28220. // adler32 is not cryptographically strong, and is only used to sanity check that
  28221. // markup generated on the server matches the markup generated on the client.
  28222. // This implementation (a modified version of the SheetJS version) has been optimized
  28223. // for our use case, at the expense of conforming to the adler32 specification
  28224. // for non-ascii inputs.
  28225. function adler32(data) {
  28226. var a = 1;
  28227. var b = 0;
  28228. var i = 0;
  28229. var l = data.length;
  28230. var m = l & ~0x3;
  28231. while (i < m) {
  28232. var n = Math.min(i + 4096, m);
  28233. for (; i < n; i += 4) {
  28234. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  28235. }
  28236. a %= MOD;
  28237. b %= MOD;
  28238. }
  28239. for (; i < l; i++) {
  28240. b += a += data.charCodeAt(i);
  28241. }
  28242. a %= MOD;
  28243. b %= MOD;
  28244. return a | b << 16;
  28245. }
  28246. module.exports = adler32;
  28247. /***/ }),
  28248. /* 203 */
  28249. /***/ (function(module, exports, __webpack_require__) {
  28250. "use strict";
  28251. /**
  28252. * Copyright 2013-present, Facebook, Inc.
  28253. * All rights reserved.
  28254. *
  28255. * This source code is licensed under the BSD-style license found in the
  28256. * LICENSE file in the root directory of this source tree. An additional grant
  28257. * of patent rights can be found in the PATENTS file in the same directory.
  28258. *
  28259. */
  28260. var CSSProperty = __webpack_require__(75);
  28261. var warning = __webpack_require__(1);
  28262. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  28263. var styleWarnings = {};
  28264. /**
  28265. * Convert a value into the proper css writable value. The style name `name`
  28266. * should be logical (no hyphens), as specified
  28267. * in `CSSProperty.isUnitlessNumber`.
  28268. *
  28269. * @param {string} name CSS property name such as `topMargin`.
  28270. * @param {*} value CSS property value such as `10px`.
  28271. * @param {ReactDOMComponent} component
  28272. * @return {string} Normalized style value with dimensions applied.
  28273. */
  28274. function dangerousStyleValue(name, value, component) {
  28275. // Note that we've removed escapeTextForBrowser() calls here since the
  28276. // whole string will be escaped when the attribute is injected into
  28277. // the markup. If you provide unsafe user data here they can inject
  28278. // arbitrary CSS which may be problematic (I couldn't repro this):
  28279. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  28280. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  28281. // This is not an XSS hole but instead a potential CSS injection issue
  28282. // which has lead to a greater discussion about how we're going to
  28283. // trust URLs moving forward. See #2115901
  28284. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  28285. if (isEmpty) {
  28286. return '';
  28287. }
  28288. var isNonNumeric = isNaN(value);
  28289. if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  28290. return '' + value; // cast to string
  28291. }
  28292. if (typeof value === 'string') {
  28293. if (false) {
  28294. // Allow '0' to pass through without warning. 0 is already special and
  28295. // doesn't require units, so we don't need to warn about it.
  28296. if (component && value !== '0') {
  28297. var owner = component._currentElement._owner;
  28298. var ownerName = owner ? owner.getName() : null;
  28299. if (ownerName && !styleWarnings[ownerName]) {
  28300. styleWarnings[ownerName] = {};
  28301. }
  28302. var warned = false;
  28303. if (ownerName) {
  28304. var warnings = styleWarnings[ownerName];
  28305. warned = warnings[name];
  28306. if (!warned) {
  28307. warnings[name] = true;
  28308. }
  28309. }
  28310. if (!warned) {
  28311. 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;
  28312. }
  28313. }
  28314. }
  28315. value = value.trim();
  28316. }
  28317. return value + 'px';
  28318. }
  28319. module.exports = dangerousStyleValue;
  28320. /***/ }),
  28321. /* 204 */
  28322. /***/ (function(module, exports, __webpack_require__) {
  28323. "use strict";
  28324. /**
  28325. * Copyright 2013-present, Facebook, Inc.
  28326. * All rights reserved.
  28327. *
  28328. * This source code is licensed under the BSD-style license found in the
  28329. * LICENSE file in the root directory of this source tree. An additional grant
  28330. * of patent rights can be found in the PATENTS file in the same directory.
  28331. *
  28332. */
  28333. var _prodInvariant = __webpack_require__(2);
  28334. var ReactCurrentOwner = __webpack_require__(14);
  28335. var ReactDOMComponentTree = __webpack_require__(5);
  28336. var ReactInstanceMap = __webpack_require__(28);
  28337. var getHostComponentFromComposite = __webpack_require__(89);
  28338. var invariant = __webpack_require__(0);
  28339. var warning = __webpack_require__(1);
  28340. /**
  28341. * Returns the DOM node rendered by this element.
  28342. *
  28343. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
  28344. *
  28345. * @param {ReactComponent|DOMElement} componentOrElement
  28346. * @return {?DOMElement} The root node of this element.
  28347. */
  28348. function findDOMNode(componentOrElement) {
  28349. if (false) {
  28350. var owner = ReactCurrentOwner.current;
  28351. if (owner !== null) {
  28352. 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;
  28353. owner._warnedAboutRefsInRender = true;
  28354. }
  28355. }
  28356. if (componentOrElement == null) {
  28357. return null;
  28358. }
  28359. if (componentOrElement.nodeType === 1) {
  28360. return componentOrElement;
  28361. }
  28362. var inst = ReactInstanceMap.get(componentOrElement);
  28363. if (inst) {
  28364. inst = getHostComponentFromComposite(inst);
  28365. return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
  28366. }
  28367. if (typeof componentOrElement.render === 'function') {
  28368. true ? false ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
  28369. } else {
  28370. true ? false ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
  28371. }
  28372. }
  28373. module.exports = findDOMNode;
  28374. /***/ }),
  28375. /* 205 */
  28376. /***/ (function(module, exports, __webpack_require__) {
  28377. "use strict";
  28378. /* WEBPACK VAR INJECTION */(function(process) {/**
  28379. * Copyright 2013-present, Facebook, Inc.
  28380. * All rights reserved.
  28381. *
  28382. * This source code is licensed under the BSD-style license found in the
  28383. * LICENSE file in the root directory of this source tree. An additional grant
  28384. * of patent rights can be found in the PATENTS file in the same directory.
  28385. *
  28386. *
  28387. */
  28388. var KeyEscapeUtils = __webpack_require__(55);
  28389. var traverseAllChildren = __webpack_require__(94);
  28390. var warning = __webpack_require__(1);
  28391. var ReactComponentTreeHook;
  28392. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  28393. // Temporary hack.
  28394. // Inline requires don't work well with Jest:
  28395. // https://github.com/facebook/react/issues/7240
  28396. // Remove the inline requires when we don't need them anymore:
  28397. // https://github.com/facebook/react/pull/7178
  28398. ReactComponentTreeHook = __webpack_require__(95);
  28399. }
  28400. /**
  28401. * @param {function} traverseContext Context passed through traversal.
  28402. * @param {?ReactComponent} child React child component.
  28403. * @param {!string} name String name of key path to child.
  28404. * @param {number=} selfDebugID Optional debugID of the current internal instance.
  28405. */
  28406. function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
  28407. // We found a component instance.
  28408. if (traverseContext && typeof traverseContext === 'object') {
  28409. var result = traverseContext;
  28410. var keyUnique = result[name] === undefined;
  28411. if (false) {
  28412. if (!ReactComponentTreeHook) {
  28413. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  28414. }
  28415. if (!keyUnique) {
  28416. 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;
  28417. }
  28418. }
  28419. if (keyUnique && child != null) {
  28420. result[name] = child;
  28421. }
  28422. }
  28423. }
  28424. /**
  28425. * Flattens children that are typically specified as `props.children`. Any null
  28426. * children will not be included in the resulting object.
  28427. * @return {!object} flattened children keyed by name.
  28428. */
  28429. function flattenChildren(children, selfDebugID) {
  28430. if (children == null) {
  28431. return children;
  28432. }
  28433. var result = {};
  28434. if (false) {
  28435. traverseAllChildren(children, function (traverseContext, child, name) {
  28436. return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
  28437. }, result);
  28438. } else {
  28439. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  28440. }
  28441. return result;
  28442. }
  28443. module.exports = flattenChildren;
  28444. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  28445. /***/ }),
  28446. /* 206 */
  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. var getEventCharCode = __webpack_require__(61);
  28459. /**
  28460. * Normalization of deprecated HTML5 `key` values
  28461. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  28462. */
  28463. var normalizeKey = {
  28464. 'Esc': 'Escape',
  28465. 'Spacebar': ' ',
  28466. 'Left': 'ArrowLeft',
  28467. 'Up': 'ArrowUp',
  28468. 'Right': 'ArrowRight',
  28469. 'Down': 'ArrowDown',
  28470. 'Del': 'Delete',
  28471. 'Win': 'OS',
  28472. 'Menu': 'ContextMenu',
  28473. 'Apps': 'ContextMenu',
  28474. 'Scroll': 'ScrollLock',
  28475. 'MozPrintableKey': 'Unidentified'
  28476. };
  28477. /**
  28478. * Translation from legacy `keyCode` to HTML5 `key`
  28479. * Only special keys supported, all others depend on keyboard layout or browser
  28480. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  28481. */
  28482. var translateToKey = {
  28483. 8: 'Backspace',
  28484. 9: 'Tab',
  28485. 12: 'Clear',
  28486. 13: 'Enter',
  28487. 16: 'Shift',
  28488. 17: 'Control',
  28489. 18: 'Alt',
  28490. 19: 'Pause',
  28491. 20: 'CapsLock',
  28492. 27: 'Escape',
  28493. 32: ' ',
  28494. 33: 'PageUp',
  28495. 34: 'PageDown',
  28496. 35: 'End',
  28497. 36: 'Home',
  28498. 37: 'ArrowLeft',
  28499. 38: 'ArrowUp',
  28500. 39: 'ArrowRight',
  28501. 40: 'ArrowDown',
  28502. 45: 'Insert',
  28503. 46: 'Delete',
  28504. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  28505. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  28506. 144: 'NumLock',
  28507. 145: 'ScrollLock',
  28508. 224: 'Meta'
  28509. };
  28510. /**
  28511. * @param {object} nativeEvent Native browser event.
  28512. * @return {string} Normalized `key` property.
  28513. */
  28514. function getEventKey(nativeEvent) {
  28515. if (nativeEvent.key) {
  28516. // Normalize inconsistent values reported by browsers due to
  28517. // implementations of a working draft specification.
  28518. // FireFox implements `key` but returns `MozPrintableKey` for all
  28519. // printable characters (normalized to `Unidentified`), ignore it.
  28520. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  28521. if (key !== 'Unidentified') {
  28522. return key;
  28523. }
  28524. }
  28525. // Browser does not implement `key`, polyfill as much of it as we can.
  28526. if (nativeEvent.type === 'keypress') {
  28527. var charCode = getEventCharCode(nativeEvent);
  28528. // The enter-key is technically both printable and non-printable and can
  28529. // thus be captured by `keypress`, no other non-printable key should.
  28530. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  28531. }
  28532. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  28533. // While user keyboard layout determines the actual meaning of each
  28534. // `keyCode` value, almost all function keys have a universal value.
  28535. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  28536. }
  28537. return '';
  28538. }
  28539. module.exports = getEventKey;
  28540. /***/ }),
  28541. /* 207 */
  28542. /***/ (function(module, exports, __webpack_require__) {
  28543. "use strict";
  28544. /**
  28545. * Copyright 2013-present, Facebook, Inc.
  28546. * All rights reserved.
  28547. *
  28548. * This source code is licensed under the BSD-style license found in the
  28549. * LICENSE file in the root directory of this source tree. An additional grant
  28550. * of patent rights can be found in the PATENTS file in the same directory.
  28551. *
  28552. *
  28553. */
  28554. /* global Symbol */
  28555. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  28556. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  28557. /**
  28558. * Returns the iterator method function contained on the iterable object.
  28559. *
  28560. * Be sure to invoke the function with the iterable as context:
  28561. *
  28562. * var iteratorFn = getIteratorFn(myIterable);
  28563. * if (iteratorFn) {
  28564. * var iterator = iteratorFn.call(myIterable);
  28565. * ...
  28566. * }
  28567. *
  28568. * @param {?object} maybeIterable
  28569. * @return {?function}
  28570. */
  28571. function getIteratorFn(maybeIterable) {
  28572. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  28573. if (typeof iteratorFn === 'function') {
  28574. return iteratorFn;
  28575. }
  28576. }
  28577. module.exports = getIteratorFn;
  28578. /***/ }),
  28579. /* 208 */
  28580. /***/ (function(module, exports, __webpack_require__) {
  28581. "use strict";
  28582. /**
  28583. * Copyright 2013-present, Facebook, Inc.
  28584. * All rights reserved.
  28585. *
  28586. * This source code is licensed under the BSD-style license found in the
  28587. * LICENSE file in the root directory of this source tree. An additional grant
  28588. * of patent rights can be found in the PATENTS file in the same directory.
  28589. *
  28590. *
  28591. */
  28592. var nextDebugID = 1;
  28593. function getNextDebugID() {
  28594. return nextDebugID++;
  28595. }
  28596. module.exports = getNextDebugID;
  28597. /***/ }),
  28598. /* 209 */
  28599. /***/ (function(module, exports, __webpack_require__) {
  28600. "use strict";
  28601. /**
  28602. * Copyright 2013-present, Facebook, Inc.
  28603. * All rights reserved.
  28604. *
  28605. * This source code is licensed under the BSD-style license found in the
  28606. * LICENSE file in the root directory of this source tree. An additional grant
  28607. * of patent rights can be found in the PATENTS file in the same directory.
  28608. *
  28609. */
  28610. /**
  28611. * Given any node return the first leaf node without children.
  28612. *
  28613. * @param {DOMElement|DOMTextNode} node
  28614. * @return {DOMElement|DOMTextNode}
  28615. */
  28616. function getLeafNode(node) {
  28617. while (node && node.firstChild) {
  28618. node = node.firstChild;
  28619. }
  28620. return node;
  28621. }
  28622. /**
  28623. * Get the next sibling within a container. This will walk up the
  28624. * DOM if a node's siblings have been exhausted.
  28625. *
  28626. * @param {DOMElement|DOMTextNode} node
  28627. * @return {?DOMElement|DOMTextNode}
  28628. */
  28629. function getSiblingNode(node) {
  28630. while (node) {
  28631. if (node.nextSibling) {
  28632. return node.nextSibling;
  28633. }
  28634. node = node.parentNode;
  28635. }
  28636. }
  28637. /**
  28638. * Get object describing the nodes which contain characters at offset.
  28639. *
  28640. * @param {DOMElement|DOMTextNode} root
  28641. * @param {number} offset
  28642. * @return {?object}
  28643. */
  28644. function getNodeForCharacterOffset(root, offset) {
  28645. var node = getLeafNode(root);
  28646. var nodeStart = 0;
  28647. var nodeEnd = 0;
  28648. while (node) {
  28649. if (node.nodeType === 3) {
  28650. nodeEnd = nodeStart + node.textContent.length;
  28651. if (nodeStart <= offset && nodeEnd >= offset) {
  28652. return {
  28653. node: node,
  28654. offset: offset - nodeStart
  28655. };
  28656. }
  28657. nodeStart = nodeEnd;
  28658. }
  28659. node = getLeafNode(getSiblingNode(node));
  28660. }
  28661. }
  28662. module.exports = getNodeForCharacterOffset;
  28663. /***/ }),
  28664. /* 210 */
  28665. /***/ (function(module, exports, __webpack_require__) {
  28666. "use strict";
  28667. /**
  28668. * Copyright 2013-present, Facebook, Inc.
  28669. * All rights reserved.
  28670. *
  28671. * This source code is licensed under the BSD-style license found in the
  28672. * LICENSE file in the root directory of this source tree. An additional grant
  28673. * of patent rights can be found in the PATENTS file in the same directory.
  28674. *
  28675. */
  28676. var ExecutionEnvironment = __webpack_require__(8);
  28677. /**
  28678. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  28679. *
  28680. * @param {string} styleProp
  28681. * @param {string} eventName
  28682. * @returns {object}
  28683. */
  28684. function makePrefixMap(styleProp, eventName) {
  28685. var prefixes = {};
  28686. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  28687. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  28688. prefixes['Moz' + styleProp] = 'moz' + eventName;
  28689. prefixes['ms' + styleProp] = 'MS' + eventName;
  28690. prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
  28691. return prefixes;
  28692. }
  28693. /**
  28694. * A list of event names to a configurable list of vendor prefixes.
  28695. */
  28696. var vendorPrefixes = {
  28697. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  28698. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  28699. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  28700. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  28701. };
  28702. /**
  28703. * Event names that have already been detected and prefixed (if applicable).
  28704. */
  28705. var prefixedEventNames = {};
  28706. /**
  28707. * Element to check for prefixes on.
  28708. */
  28709. var style = {};
  28710. /**
  28711. * Bootstrap if a DOM exists.
  28712. */
  28713. if (ExecutionEnvironment.canUseDOM) {
  28714. style = document.createElement('div').style;
  28715. // On some platforms, in particular some releases of Android 4.x,
  28716. // the un-prefixed "animation" and "transition" properties are defined on the
  28717. // style object but the events that fire will still be prefixed, so we need
  28718. // to check if the un-prefixed events are usable, and if not remove them from the map.
  28719. if (!('AnimationEvent' in window)) {
  28720. delete vendorPrefixes.animationend.animation;
  28721. delete vendorPrefixes.animationiteration.animation;
  28722. delete vendorPrefixes.animationstart.animation;
  28723. }
  28724. // Same as above
  28725. if (!('TransitionEvent' in window)) {
  28726. delete vendorPrefixes.transitionend.transition;
  28727. }
  28728. }
  28729. /**
  28730. * Attempts to determine the correct vendor prefixed event name.
  28731. *
  28732. * @param {string} eventName
  28733. * @returns {string}
  28734. */
  28735. function getVendorPrefixedEventName(eventName) {
  28736. if (prefixedEventNames[eventName]) {
  28737. return prefixedEventNames[eventName];
  28738. } else if (!vendorPrefixes[eventName]) {
  28739. return eventName;
  28740. }
  28741. var prefixMap = vendorPrefixes[eventName];
  28742. for (var styleProp in prefixMap) {
  28743. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  28744. return prefixedEventNames[eventName] = prefixMap[styleProp];
  28745. }
  28746. }
  28747. return '';
  28748. }
  28749. module.exports = getVendorPrefixedEventName;
  28750. /***/ }),
  28751. /* 211 */
  28752. /***/ (function(module, exports, __webpack_require__) {
  28753. "use strict";
  28754. /**
  28755. * Copyright 2013-present, Facebook, Inc.
  28756. * All rights reserved.
  28757. *
  28758. * This source code is licensed under the BSD-style license found in the
  28759. * LICENSE file in the root directory of this source tree. An additional grant
  28760. * of patent rights can be found in the PATENTS file in the same directory.
  28761. *
  28762. */
  28763. var escapeTextContentForBrowser = __webpack_require__(34);
  28764. /**
  28765. * Escapes attribute value to prevent scripting attacks.
  28766. *
  28767. * @param {*} value Value to escape.
  28768. * @return {string} An escaped string.
  28769. */
  28770. function quoteAttributeValueForBrowser(value) {
  28771. return '"' + escapeTextContentForBrowser(value) + '"';
  28772. }
  28773. module.exports = quoteAttributeValueForBrowser;
  28774. /***/ }),
  28775. /* 212 */
  28776. /***/ (function(module, exports, __webpack_require__) {
  28777. "use strict";
  28778. /**
  28779. * Copyright 2013-present, Facebook, Inc.
  28780. * All rights reserved.
  28781. *
  28782. * This source code is licensed under the BSD-style license found in the
  28783. * LICENSE file in the root directory of this source tree. An additional grant
  28784. * of patent rights can be found in the PATENTS file in the same directory.
  28785. *
  28786. */
  28787. var ReactMount = __webpack_require__(84);
  28788. module.exports = ReactMount.renderSubtreeIntoContainer;
  28789. /***/ }),
  28790. /* 213 */
  28791. /***/ (function(module, exports, __webpack_require__) {
  28792. "use strict";
  28793. /**
  28794. * Copyright 2013-present, Facebook, Inc.
  28795. * All rights reserved.
  28796. *
  28797. * This source code is licensed under the BSD-style license found in the
  28798. * LICENSE file in the root directory of this source tree. An additional grant
  28799. * of patent rights can be found in the PATENTS file in the same directory.
  28800. *
  28801. *
  28802. */
  28803. /**
  28804. * Escape and wrap key so it is safe to use as a reactid
  28805. *
  28806. * @param {string} key to be escaped.
  28807. * @return {string} the escaped key.
  28808. */
  28809. function escape(key) {
  28810. var escapeRegex = /[=:]/g;
  28811. var escaperLookup = {
  28812. '=': '=0',
  28813. ':': '=2'
  28814. };
  28815. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  28816. return escaperLookup[match];
  28817. });
  28818. return '$' + escapedString;
  28819. }
  28820. /**
  28821. * Unescape and unwrap key for human-readable display
  28822. *
  28823. * @param {string} key to unescape.
  28824. * @return {string} the unescaped key.
  28825. */
  28826. function unescape(key) {
  28827. var unescapeRegex = /(=0|=2)/g;
  28828. var unescaperLookup = {
  28829. '=0': '=',
  28830. '=2': ':'
  28831. };
  28832. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  28833. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  28834. return unescaperLookup[match];
  28835. });
  28836. }
  28837. var KeyEscapeUtils = {
  28838. escape: escape,
  28839. unescape: unescape
  28840. };
  28841. module.exports = KeyEscapeUtils;
  28842. /***/ }),
  28843. /* 214 */
  28844. /***/ (function(module, exports, __webpack_require__) {
  28845. "use strict";
  28846. /**
  28847. * Copyright 2013-present, Facebook, Inc.
  28848. * All rights reserved.
  28849. *
  28850. * This source code is licensed under the BSD-style license found in the
  28851. * LICENSE file in the root directory of this source tree. An additional grant
  28852. * of patent rights can be found in the PATENTS file in the same directory.
  28853. *
  28854. *
  28855. */
  28856. var _prodInvariant = __webpack_require__(23);
  28857. var invariant = __webpack_require__(0);
  28858. /**
  28859. * Static poolers. Several custom versions for each potential number of
  28860. * arguments. A completely generic pooler is easy to implement, but would
  28861. * require accessing the `arguments` object. In each of these, `this` refers to
  28862. * the Class itself, not an instance. If any others are needed, simply add them
  28863. * here, or in their own files.
  28864. */
  28865. var oneArgumentPooler = function (copyFieldsFrom) {
  28866. var Klass = this;
  28867. if (Klass.instancePool.length) {
  28868. var instance = Klass.instancePool.pop();
  28869. Klass.call(instance, copyFieldsFrom);
  28870. return instance;
  28871. } else {
  28872. return new Klass(copyFieldsFrom);
  28873. }
  28874. };
  28875. var twoArgumentPooler = function (a1, a2) {
  28876. var Klass = this;
  28877. if (Klass.instancePool.length) {
  28878. var instance = Klass.instancePool.pop();
  28879. Klass.call(instance, a1, a2);
  28880. return instance;
  28881. } else {
  28882. return new Klass(a1, a2);
  28883. }
  28884. };
  28885. var threeArgumentPooler = function (a1, a2, a3) {
  28886. var Klass = this;
  28887. if (Klass.instancePool.length) {
  28888. var instance = Klass.instancePool.pop();
  28889. Klass.call(instance, a1, a2, a3);
  28890. return instance;
  28891. } else {
  28892. return new Klass(a1, a2, a3);
  28893. }
  28894. };
  28895. var fourArgumentPooler = function (a1, a2, a3, a4) {
  28896. var Klass = this;
  28897. if (Klass.instancePool.length) {
  28898. var instance = Klass.instancePool.pop();
  28899. Klass.call(instance, a1, a2, a3, a4);
  28900. return instance;
  28901. } else {
  28902. return new Klass(a1, a2, a3, a4);
  28903. }
  28904. };
  28905. var standardReleaser = function (instance) {
  28906. var Klass = this;
  28907. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  28908. instance.destructor();
  28909. if (Klass.instancePool.length < Klass.poolSize) {
  28910. Klass.instancePool.push(instance);
  28911. }
  28912. };
  28913. var DEFAULT_POOL_SIZE = 10;
  28914. var DEFAULT_POOLER = oneArgumentPooler;
  28915. /**
  28916. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  28917. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  28918. * you give this may have a `poolSize` property, and will look for a
  28919. * prototypical `destructor` on instances.
  28920. *
  28921. * @param {Function} CopyConstructor Constructor that can be used to reset.
  28922. * @param {Function} pooler Customizable pooler.
  28923. */
  28924. var addPoolingTo = function (CopyConstructor, pooler) {
  28925. // Casting as any so that flow ignores the actual implementation and trusts
  28926. // it to match the type we declared
  28927. var NewKlass = CopyConstructor;
  28928. NewKlass.instancePool = [];
  28929. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  28930. if (!NewKlass.poolSize) {
  28931. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  28932. }
  28933. NewKlass.release = standardReleaser;
  28934. return NewKlass;
  28935. };
  28936. var PooledClass = {
  28937. addPoolingTo: addPoolingTo,
  28938. oneArgumentPooler: oneArgumentPooler,
  28939. twoArgumentPooler: twoArgumentPooler,
  28940. threeArgumentPooler: threeArgumentPooler,
  28941. fourArgumentPooler: fourArgumentPooler
  28942. };
  28943. module.exports = PooledClass;
  28944. /***/ }),
  28945. /* 215 */
  28946. /***/ (function(module, exports, __webpack_require__) {
  28947. "use strict";
  28948. /**
  28949. * Copyright 2013-present, Facebook, Inc.
  28950. * All rights reserved.
  28951. *
  28952. * This source code is licensed under the BSD-style license found in the
  28953. * LICENSE file in the root directory of this source tree. An additional grant
  28954. * of patent rights can be found in the PATENTS file in the same directory.
  28955. *
  28956. */
  28957. var PooledClass = __webpack_require__(214);
  28958. var ReactElement = __webpack_require__(22);
  28959. var emptyFunction = __webpack_require__(10);
  28960. var traverseAllChildren = __webpack_require__(223);
  28961. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  28962. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  28963. var userProvidedKeyEscapeRegex = /\/+/g;
  28964. function escapeUserProvidedKey(text) {
  28965. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  28966. }
  28967. /**
  28968. * PooledClass representing the bookkeeping associated with performing a child
  28969. * traversal. Allows avoiding binding callbacks.
  28970. *
  28971. * @constructor ForEachBookKeeping
  28972. * @param {!function} forEachFunction Function to perform traversal with.
  28973. * @param {?*} forEachContext Context to perform context with.
  28974. */
  28975. function ForEachBookKeeping(forEachFunction, forEachContext) {
  28976. this.func = forEachFunction;
  28977. this.context = forEachContext;
  28978. this.count = 0;
  28979. }
  28980. ForEachBookKeeping.prototype.destructor = function () {
  28981. this.func = null;
  28982. this.context = null;
  28983. this.count = 0;
  28984. };
  28985. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  28986. function forEachSingleChild(bookKeeping, child, name) {
  28987. var func = bookKeeping.func,
  28988. context = bookKeeping.context;
  28989. func.call(context, child, bookKeeping.count++);
  28990. }
  28991. /**
  28992. * Iterates through children that are typically specified as `props.children`.
  28993. *
  28994. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
  28995. *
  28996. * The provided forEachFunc(child, index) will be called for each
  28997. * leaf child.
  28998. *
  28999. * @param {?*} children Children tree container.
  29000. * @param {function(*, int)} forEachFunc
  29001. * @param {*} forEachContext Context for forEachContext.
  29002. */
  29003. function forEachChildren(children, forEachFunc, forEachContext) {
  29004. if (children == null) {
  29005. return children;
  29006. }
  29007. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  29008. traverseAllChildren(children, forEachSingleChild, traverseContext);
  29009. ForEachBookKeeping.release(traverseContext);
  29010. }
  29011. /**
  29012. * PooledClass representing the bookkeeping associated with performing a child
  29013. * mapping. Allows avoiding binding callbacks.
  29014. *
  29015. * @constructor MapBookKeeping
  29016. * @param {!*} mapResult Object containing the ordered map of results.
  29017. * @param {!function} mapFunction Function to perform mapping with.
  29018. * @param {?*} mapContext Context to perform mapping with.
  29019. */
  29020. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  29021. this.result = mapResult;
  29022. this.keyPrefix = keyPrefix;
  29023. this.func = mapFunction;
  29024. this.context = mapContext;
  29025. this.count = 0;
  29026. }
  29027. MapBookKeeping.prototype.destructor = function () {
  29028. this.result = null;
  29029. this.keyPrefix = null;
  29030. this.func = null;
  29031. this.context = null;
  29032. this.count = 0;
  29033. };
  29034. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  29035. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  29036. var result = bookKeeping.result,
  29037. keyPrefix = bookKeeping.keyPrefix,
  29038. func = bookKeeping.func,
  29039. context = bookKeeping.context;
  29040. var mappedChild = func.call(context, child, bookKeeping.count++);
  29041. if (Array.isArray(mappedChild)) {
  29042. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  29043. } else if (mappedChild != null) {
  29044. if (ReactElement.isValidElement(mappedChild)) {
  29045. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  29046. // Keep both the (mapped) and old keys if they differ, just as
  29047. // traverseAllChildren used to do for objects as children
  29048. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  29049. }
  29050. result.push(mappedChild);
  29051. }
  29052. }
  29053. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  29054. var escapedPrefix = '';
  29055. if (prefix != null) {
  29056. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  29057. }
  29058. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  29059. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  29060. MapBookKeeping.release(traverseContext);
  29061. }
  29062. /**
  29063. * Maps children that are typically specified as `props.children`.
  29064. *
  29065. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
  29066. *
  29067. * The provided mapFunction(child, key, index) will be called for each
  29068. * leaf child.
  29069. *
  29070. * @param {?*} children Children tree container.
  29071. * @param {function(*, int)} func The map function.
  29072. * @param {*} context Context for mapFunction.
  29073. * @return {object} Object containing the ordered map of results.
  29074. */
  29075. function mapChildren(children, func, context) {
  29076. if (children == null) {
  29077. return children;
  29078. }
  29079. var result = [];
  29080. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  29081. return result;
  29082. }
  29083. function forEachSingleChildDummy(traverseContext, child, name) {
  29084. return null;
  29085. }
  29086. /**
  29087. * Count the number of children that are typically specified as
  29088. * `props.children`.
  29089. *
  29090. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
  29091. *
  29092. * @param {?*} children Children tree container.
  29093. * @return {number} The number of children.
  29094. */
  29095. function countChildren(children, context) {
  29096. return traverseAllChildren(children, forEachSingleChildDummy, null);
  29097. }
  29098. /**
  29099. * Flatten a children object (typically specified as `props.children`) and
  29100. * return an array with appropriately re-keyed children.
  29101. *
  29102. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
  29103. */
  29104. function toArray(children) {
  29105. var result = [];
  29106. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  29107. return result;
  29108. }
  29109. var ReactChildren = {
  29110. forEach: forEachChildren,
  29111. map: mapChildren,
  29112. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  29113. count: countChildren,
  29114. toArray: toArray
  29115. };
  29116. module.exports = ReactChildren;
  29117. /***/ }),
  29118. /* 216 */
  29119. /***/ (function(module, exports, __webpack_require__) {
  29120. "use strict";
  29121. /**
  29122. * Copyright 2013-present, Facebook, Inc.
  29123. * All rights reserved.
  29124. *
  29125. * This source code is licensed under the BSD-style license found in the
  29126. * LICENSE file in the root directory of this source tree. An additional grant
  29127. * of patent rights can be found in the PATENTS file in the same directory.
  29128. *
  29129. */
  29130. var _prodInvariant = __webpack_require__(23),
  29131. _assign = __webpack_require__(3);
  29132. var ReactComponent = __webpack_require__(67);
  29133. var ReactElement = __webpack_require__(22);
  29134. var ReactPropTypeLocationNames = __webpack_require__(97);
  29135. var ReactNoopUpdateQueue = __webpack_require__(68);
  29136. var emptyObject = __webpack_require__(25);
  29137. var invariant = __webpack_require__(0);
  29138. var warning = __webpack_require__(1);
  29139. var MIXINS_KEY = 'mixins';
  29140. // Helper function to allow the creation of anonymous functions which do not
  29141. // have .name set to the name of the variable being assigned to.
  29142. function identity(fn) {
  29143. return fn;
  29144. }
  29145. /**
  29146. * Policies that describe methods in `ReactClassInterface`.
  29147. */
  29148. var injectedMixins = [];
  29149. /**
  29150. * Composite components are higher-level components that compose other composite
  29151. * or host components.
  29152. *
  29153. * To create a new type of `ReactClass`, pass a specification of
  29154. * your new class to `React.createClass`. The only requirement of your class
  29155. * specification is that you implement a `render` method.
  29156. *
  29157. * var MyComponent = React.createClass({
  29158. * render: function() {
  29159. * return <div>Hello World</div>;
  29160. * }
  29161. * });
  29162. *
  29163. * The class specification supports a specific protocol of methods that have
  29164. * special meaning (e.g. `render`). See `ReactClassInterface` for
  29165. * more the comprehensive protocol. Any other properties and methods in the
  29166. * class specification will be available on the prototype.
  29167. *
  29168. * @interface ReactClassInterface
  29169. * @internal
  29170. */
  29171. var ReactClassInterface = {
  29172. /**
  29173. * An array of Mixin objects to include when defining your component.
  29174. *
  29175. * @type {array}
  29176. * @optional
  29177. */
  29178. mixins: 'DEFINE_MANY',
  29179. /**
  29180. * An object containing properties and methods that should be defined on
  29181. * the component's constructor instead of its prototype (static methods).
  29182. *
  29183. * @type {object}
  29184. * @optional
  29185. */
  29186. statics: 'DEFINE_MANY',
  29187. /**
  29188. * Definition of prop types for this component.
  29189. *
  29190. * @type {object}
  29191. * @optional
  29192. */
  29193. propTypes: 'DEFINE_MANY',
  29194. /**
  29195. * Definition of context types for this component.
  29196. *
  29197. * @type {object}
  29198. * @optional
  29199. */
  29200. contextTypes: 'DEFINE_MANY',
  29201. /**
  29202. * Definition of context types this component sets for its children.
  29203. *
  29204. * @type {object}
  29205. * @optional
  29206. */
  29207. childContextTypes: 'DEFINE_MANY',
  29208. // ==== Definition methods ====
  29209. /**
  29210. * Invoked when the component is mounted. Values in the mapping will be set on
  29211. * `this.props` if that prop is not specified (i.e. using an `in` check).
  29212. *
  29213. * This method is invoked before `getInitialState` and therefore cannot rely
  29214. * on `this.state` or use `this.setState`.
  29215. *
  29216. * @return {object}
  29217. * @optional
  29218. */
  29219. getDefaultProps: 'DEFINE_MANY_MERGED',
  29220. /**
  29221. * Invoked once before the component is mounted. The return value will be used
  29222. * as the initial value of `this.state`.
  29223. *
  29224. * getInitialState: function() {
  29225. * return {
  29226. * isOn: false,
  29227. * fooBaz: new BazFoo()
  29228. * }
  29229. * }
  29230. *
  29231. * @return {object}
  29232. * @optional
  29233. */
  29234. getInitialState: 'DEFINE_MANY_MERGED',
  29235. /**
  29236. * @return {object}
  29237. * @optional
  29238. */
  29239. getChildContext: 'DEFINE_MANY_MERGED',
  29240. /**
  29241. * Uses props from `this.props` and state from `this.state` to render the
  29242. * structure of the component.
  29243. *
  29244. * No guarantees are made about when or how often this method is invoked, so
  29245. * it must not have side effects.
  29246. *
  29247. * render: function() {
  29248. * var name = this.props.name;
  29249. * return <div>Hello, {name}!</div>;
  29250. * }
  29251. *
  29252. * @return {ReactComponent}
  29253. * @nosideeffects
  29254. * @required
  29255. */
  29256. render: 'DEFINE_ONCE',
  29257. // ==== Delegate methods ====
  29258. /**
  29259. * Invoked when the component is initially created and about to be mounted.
  29260. * This may have side effects, but any external subscriptions or data created
  29261. * by this method must be cleaned up in `componentWillUnmount`.
  29262. *
  29263. * @optional
  29264. */
  29265. componentWillMount: 'DEFINE_MANY',
  29266. /**
  29267. * Invoked when the component has been mounted and has a DOM representation.
  29268. * However, there is no guarantee that the DOM node is in the document.
  29269. *
  29270. * Use this as an opportunity to operate on the DOM when the component has
  29271. * been mounted (initialized and rendered) for the first time.
  29272. *
  29273. * @param {DOMElement} rootNode DOM element representing the component.
  29274. * @optional
  29275. */
  29276. componentDidMount: 'DEFINE_MANY',
  29277. /**
  29278. * Invoked before the component receives new props.
  29279. *
  29280. * Use this as an opportunity to react to a prop transition by updating the
  29281. * state using `this.setState`. Current props are accessed via `this.props`.
  29282. *
  29283. * componentWillReceiveProps: function(nextProps, nextContext) {
  29284. * this.setState({
  29285. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  29286. * });
  29287. * }
  29288. *
  29289. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  29290. * transition may cause a state change, but the opposite is not true. If you
  29291. * need it, you are probably looking for `componentWillUpdate`.
  29292. *
  29293. * @param {object} nextProps
  29294. * @optional
  29295. */
  29296. componentWillReceiveProps: 'DEFINE_MANY',
  29297. /**
  29298. * Invoked while deciding if the component should be updated as a result of
  29299. * receiving new props, state and/or context.
  29300. *
  29301. * Use this as an opportunity to `return false` when you're certain that the
  29302. * transition to the new props/state/context will not require a component
  29303. * update.
  29304. *
  29305. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  29306. * return !equal(nextProps, this.props) ||
  29307. * !equal(nextState, this.state) ||
  29308. * !equal(nextContext, this.context);
  29309. * }
  29310. *
  29311. * @param {object} nextProps
  29312. * @param {?object} nextState
  29313. * @param {?object} nextContext
  29314. * @return {boolean} True if the component should update.
  29315. * @optional
  29316. */
  29317. shouldComponentUpdate: 'DEFINE_ONCE',
  29318. /**
  29319. * Invoked when the component is about to update due to a transition from
  29320. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  29321. * and `nextContext`.
  29322. *
  29323. * Use this as an opportunity to perform preparation before an update occurs.
  29324. *
  29325. * NOTE: You **cannot** use `this.setState()` in this method.
  29326. *
  29327. * @param {object} nextProps
  29328. * @param {?object} nextState
  29329. * @param {?object} nextContext
  29330. * @param {ReactReconcileTransaction} transaction
  29331. * @optional
  29332. */
  29333. componentWillUpdate: 'DEFINE_MANY',
  29334. /**
  29335. * Invoked when the component's DOM representation has been updated.
  29336. *
  29337. * Use this as an opportunity to operate on the DOM when the component has
  29338. * been updated.
  29339. *
  29340. * @param {object} prevProps
  29341. * @param {?object} prevState
  29342. * @param {?object} prevContext
  29343. * @param {DOMElement} rootNode DOM element representing the component.
  29344. * @optional
  29345. */
  29346. componentDidUpdate: 'DEFINE_MANY',
  29347. /**
  29348. * Invoked when the component is about to be removed from its parent and have
  29349. * its DOM representation destroyed.
  29350. *
  29351. * Use this as an opportunity to deallocate any external resources.
  29352. *
  29353. * NOTE: There is no `componentDidUnmount` since your component will have been
  29354. * destroyed by that point.
  29355. *
  29356. * @optional
  29357. */
  29358. componentWillUnmount: 'DEFINE_MANY',
  29359. // ==== Advanced methods ====
  29360. /**
  29361. * Updates the component's currently mounted DOM representation.
  29362. *
  29363. * By default, this implements React's rendering and reconciliation algorithm.
  29364. * Sophisticated clients may wish to override this.
  29365. *
  29366. * @param {ReactReconcileTransaction} transaction
  29367. * @internal
  29368. * @overridable
  29369. */
  29370. updateComponent: 'OVERRIDE_BASE'
  29371. };
  29372. /**
  29373. * Mapping from class specification keys to special processing functions.
  29374. *
  29375. * Although these are declared like instance properties in the specification
  29376. * when defining classes using `React.createClass`, they are actually static
  29377. * and are accessible on the constructor instead of the prototype. Despite
  29378. * being static, they must be defined outside of the "statics" key under
  29379. * which all other static methods are defined.
  29380. */
  29381. var RESERVED_SPEC_KEYS = {
  29382. displayName: function (Constructor, displayName) {
  29383. Constructor.displayName = displayName;
  29384. },
  29385. mixins: function (Constructor, mixins) {
  29386. if (mixins) {
  29387. for (var i = 0; i < mixins.length; i++) {
  29388. mixSpecIntoComponent(Constructor, mixins[i]);
  29389. }
  29390. }
  29391. },
  29392. childContextTypes: function (Constructor, childContextTypes) {
  29393. if (false) {
  29394. validateTypeDef(Constructor, childContextTypes, 'childContext');
  29395. }
  29396. Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
  29397. },
  29398. contextTypes: function (Constructor, contextTypes) {
  29399. if (false) {
  29400. validateTypeDef(Constructor, contextTypes, 'context');
  29401. }
  29402. Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
  29403. },
  29404. /**
  29405. * Special case getDefaultProps which should move into statics but requires
  29406. * automatic merging.
  29407. */
  29408. getDefaultProps: function (Constructor, getDefaultProps) {
  29409. if (Constructor.getDefaultProps) {
  29410. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  29411. } else {
  29412. Constructor.getDefaultProps = getDefaultProps;
  29413. }
  29414. },
  29415. propTypes: function (Constructor, propTypes) {
  29416. if (false) {
  29417. validateTypeDef(Constructor, propTypes, 'prop');
  29418. }
  29419. Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
  29420. },
  29421. statics: function (Constructor, statics) {
  29422. mixStaticSpecIntoComponent(Constructor, statics);
  29423. },
  29424. autobind: function () {} };
  29425. function validateTypeDef(Constructor, typeDef, location) {
  29426. for (var propName in typeDef) {
  29427. if (typeDef.hasOwnProperty(propName)) {
  29428. // use a warning instead of an invariant so components
  29429. // don't show up in prod but only in __DEV__
  29430. 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;
  29431. }
  29432. }
  29433. }
  29434. function validateMethodOverride(isAlreadyDefined, name) {
  29435. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  29436. // Disallow overriding of base class methods unless explicitly allowed.
  29437. if (ReactClassMixin.hasOwnProperty(name)) {
  29438. !(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;
  29439. }
  29440. // Disallow defining methods more than once unless explicitly allowed.
  29441. if (isAlreadyDefined) {
  29442. !(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;
  29443. }
  29444. }
  29445. /**
  29446. * Mixin helper which handles policy validation and reserved
  29447. * specification keys when building React classes.
  29448. */
  29449. function mixSpecIntoComponent(Constructor, spec) {
  29450. if (!spec) {
  29451. if (false) {
  29452. var typeofSpec = typeof spec;
  29453. var isMixinValid = typeofSpec === 'object' && spec !== null;
  29454. 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;
  29455. }
  29456. return;
  29457. }
  29458. !(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;
  29459. !!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;
  29460. var proto = Constructor.prototype;
  29461. var autoBindPairs = proto.__reactAutoBindPairs;
  29462. // By handling mixins before any other properties, we ensure the same
  29463. // chaining order is applied to methods with DEFINE_MANY policy, whether
  29464. // mixins are listed before or after these methods in the spec.
  29465. if (spec.hasOwnProperty(MIXINS_KEY)) {
  29466. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  29467. }
  29468. for (var name in spec) {
  29469. if (!spec.hasOwnProperty(name)) {
  29470. continue;
  29471. }
  29472. if (name === MIXINS_KEY) {
  29473. // We have already handled mixins in a special case above.
  29474. continue;
  29475. }
  29476. var property = spec[name];
  29477. var isAlreadyDefined = proto.hasOwnProperty(name);
  29478. validateMethodOverride(isAlreadyDefined, name);
  29479. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  29480. RESERVED_SPEC_KEYS[name](Constructor, property);
  29481. } else {
  29482. // Setup methods on prototype:
  29483. // The following member methods should not be automatically bound:
  29484. // 1. Expected ReactClass methods (in the "interface").
  29485. // 2. Overridden methods (that were mixed in).
  29486. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  29487. var isFunction = typeof property === 'function';
  29488. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  29489. if (shouldAutoBind) {
  29490. autoBindPairs.push(name, property);
  29491. proto[name] = property;
  29492. } else {
  29493. if (isAlreadyDefined) {
  29494. var specPolicy = ReactClassInterface[name];
  29495. // These cases should already be caught by validateMethodOverride.
  29496. !(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;
  29497. // For methods which are defined more than once, call the existing
  29498. // methods before calling the new property, merging if appropriate.
  29499. if (specPolicy === 'DEFINE_MANY_MERGED') {
  29500. proto[name] = createMergedResultFunction(proto[name], property);
  29501. } else if (specPolicy === 'DEFINE_MANY') {
  29502. proto[name] = createChainedFunction(proto[name], property);
  29503. }
  29504. } else {
  29505. proto[name] = property;
  29506. if (false) {
  29507. // Add verbose displayName to the function, which helps when looking
  29508. // at profiling tools.
  29509. if (typeof property === 'function' && spec.displayName) {
  29510. proto[name].displayName = spec.displayName + '_' + name;
  29511. }
  29512. }
  29513. }
  29514. }
  29515. }
  29516. }
  29517. }
  29518. function mixStaticSpecIntoComponent(Constructor, statics) {
  29519. if (!statics) {
  29520. return;
  29521. }
  29522. for (var name in statics) {
  29523. var property = statics[name];
  29524. if (!statics.hasOwnProperty(name)) {
  29525. continue;
  29526. }
  29527. var isReserved = name in RESERVED_SPEC_KEYS;
  29528. !!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;
  29529. var isInherited = name in Constructor;
  29530. !!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;
  29531. Constructor[name] = property;
  29532. }
  29533. }
  29534. /**
  29535. * Merge two objects, but throw if both contain the same key.
  29536. *
  29537. * @param {object} one The first object, which is mutated.
  29538. * @param {object} two The second object
  29539. * @return {object} one after it has been mutated to contain everything in two.
  29540. */
  29541. function mergeIntoWithNoDuplicateKeys(one, two) {
  29542. !(one && two && typeof one === 'object' && typeof two === 'object') ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
  29543. for (var key in two) {
  29544. if (two.hasOwnProperty(key)) {
  29545. !(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;
  29546. one[key] = two[key];
  29547. }
  29548. }
  29549. return one;
  29550. }
  29551. /**
  29552. * Creates a function that invokes two functions and merges their return values.
  29553. *
  29554. * @param {function} one Function to invoke first.
  29555. * @param {function} two Function to invoke second.
  29556. * @return {function} Function that invokes the two argument functions.
  29557. * @private
  29558. */
  29559. function createMergedResultFunction(one, two) {
  29560. return function mergedResult() {
  29561. var a = one.apply(this, arguments);
  29562. var b = two.apply(this, arguments);
  29563. if (a == null) {
  29564. return b;
  29565. } else if (b == null) {
  29566. return a;
  29567. }
  29568. var c = {};
  29569. mergeIntoWithNoDuplicateKeys(c, a);
  29570. mergeIntoWithNoDuplicateKeys(c, b);
  29571. return c;
  29572. };
  29573. }
  29574. /**
  29575. * Creates a function that invokes two functions and ignores their return vales.
  29576. *
  29577. * @param {function} one Function to invoke first.
  29578. * @param {function} two Function to invoke second.
  29579. * @return {function} Function that invokes the two argument functions.
  29580. * @private
  29581. */
  29582. function createChainedFunction(one, two) {
  29583. return function chainedFunction() {
  29584. one.apply(this, arguments);
  29585. two.apply(this, arguments);
  29586. };
  29587. }
  29588. /**
  29589. * Binds a method to the component.
  29590. *
  29591. * @param {object} component Component whose method is going to be bound.
  29592. * @param {function} method Method to be bound.
  29593. * @return {function} The bound method.
  29594. */
  29595. function bindAutoBindMethod(component, method) {
  29596. var boundMethod = method.bind(component);
  29597. if (false) {
  29598. boundMethod.__reactBoundContext = component;
  29599. boundMethod.__reactBoundMethod = method;
  29600. boundMethod.__reactBoundArguments = null;
  29601. var componentName = component.constructor.displayName;
  29602. var _bind = boundMethod.bind;
  29603. boundMethod.bind = function (newThis) {
  29604. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  29605. args[_key - 1] = arguments[_key];
  29606. }
  29607. // User is trying to bind() an autobound method; we effectively will
  29608. // ignore the value of "this" that the user is trying to use, so
  29609. // let's warn.
  29610. if (newThis !== component && newThis !== null) {
  29611. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
  29612. } else if (!args.length) {
  29613. 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;
  29614. return boundMethod;
  29615. }
  29616. var reboundMethod = _bind.apply(boundMethod, arguments);
  29617. reboundMethod.__reactBoundContext = component;
  29618. reboundMethod.__reactBoundMethod = method;
  29619. reboundMethod.__reactBoundArguments = args;
  29620. return reboundMethod;
  29621. };
  29622. }
  29623. return boundMethod;
  29624. }
  29625. /**
  29626. * Binds all auto-bound methods in a component.
  29627. *
  29628. * @param {object} component Component whose method is going to be bound.
  29629. */
  29630. function bindAutoBindMethods(component) {
  29631. var pairs = component.__reactAutoBindPairs;
  29632. for (var i = 0; i < pairs.length; i += 2) {
  29633. var autoBindKey = pairs[i];
  29634. var method = pairs[i + 1];
  29635. component[autoBindKey] = bindAutoBindMethod(component, method);
  29636. }
  29637. }
  29638. /**
  29639. * Add more to the ReactClass base class. These are all legacy features and
  29640. * therefore not already part of the modern ReactComponent.
  29641. */
  29642. var ReactClassMixin = {
  29643. /**
  29644. * TODO: This will be deprecated because state should always keep a consistent
  29645. * type signature and the only use case for this, is to avoid that.
  29646. */
  29647. replaceState: function (newState, callback) {
  29648. this.updater.enqueueReplaceState(this, newState);
  29649. if (callback) {
  29650. this.updater.enqueueCallback(this, callback, 'replaceState');
  29651. }
  29652. },
  29653. /**
  29654. * Checks whether or not this composite component is mounted.
  29655. * @return {boolean} True if mounted, false otherwise.
  29656. * @protected
  29657. * @final
  29658. */
  29659. isMounted: function () {
  29660. return this.updater.isMounted(this);
  29661. }
  29662. };
  29663. var ReactClassComponent = function () {};
  29664. _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  29665. /**
  29666. * Module for creating composite components.
  29667. *
  29668. * @class ReactClass
  29669. */
  29670. var ReactClass = {
  29671. /**
  29672. * Creates a composite component class given a class specification.
  29673. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
  29674. *
  29675. * @param {object} spec Class specification (which must define `render`).
  29676. * @return {function} Component constructor function.
  29677. * @public
  29678. */
  29679. createClass: function (spec) {
  29680. // To keep our warnings more understandable, we'll use a little hack here to
  29681. // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
  29682. // unnecessarily identify a class without displayName as 'Constructor'.
  29683. var Constructor = identity(function (props, context, updater) {
  29684. // This constructor gets overridden by mocks. The argument is used
  29685. // by mocks to assert on what gets mounted.
  29686. if (false) {
  29687. 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;
  29688. }
  29689. // Wire up auto-binding
  29690. if (this.__reactAutoBindPairs.length) {
  29691. bindAutoBindMethods(this);
  29692. }
  29693. this.props = props;
  29694. this.context = context;
  29695. this.refs = emptyObject;
  29696. this.updater = updater || ReactNoopUpdateQueue;
  29697. this.state = null;
  29698. // ReactClasses doesn't have constructors. Instead, they use the
  29699. // getInitialState and componentWillMount methods for initialization.
  29700. var initialState = this.getInitialState ? this.getInitialState() : null;
  29701. if (false) {
  29702. // We allow auto-mocks to proceed as if they're returning null.
  29703. if (initialState === undefined && this.getInitialState._isMockFunction) {
  29704. // This is probably bad practice. Consider warning here and
  29705. // deprecating this convenience.
  29706. initialState = null;
  29707. }
  29708. }
  29709. !(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;
  29710. this.state = initialState;
  29711. });
  29712. Constructor.prototype = new ReactClassComponent();
  29713. Constructor.prototype.constructor = Constructor;
  29714. Constructor.prototype.__reactAutoBindPairs = [];
  29715. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  29716. mixSpecIntoComponent(Constructor, spec);
  29717. // Initialize the defaultProps property after all mixins have been merged.
  29718. if (Constructor.getDefaultProps) {
  29719. Constructor.defaultProps = Constructor.getDefaultProps();
  29720. }
  29721. if (false) {
  29722. // This is a tag to indicate that the use of these method names is ok,
  29723. // since it's used with createClass. If it's not, then it's likely a
  29724. // mistake so we'll warn you to use the static property, property
  29725. // initializer or constructor respectively.
  29726. if (Constructor.getDefaultProps) {
  29727. Constructor.getDefaultProps.isReactClassApproved = {};
  29728. }
  29729. if (Constructor.prototype.getInitialState) {
  29730. Constructor.prototype.getInitialState.isReactClassApproved = {};
  29731. }
  29732. }
  29733. !Constructor.prototype.render ? false ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
  29734. if (false) {
  29735. 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;
  29736. 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;
  29737. }
  29738. // Reduce time spent doing lookups by setting these on the prototype.
  29739. for (var methodName in ReactClassInterface) {
  29740. if (!Constructor.prototype[methodName]) {
  29741. Constructor.prototype[methodName] = null;
  29742. }
  29743. }
  29744. return Constructor;
  29745. },
  29746. injection: {
  29747. injectMixin: function (mixin) {
  29748. injectedMixins.push(mixin);
  29749. }
  29750. }
  29751. };
  29752. module.exports = ReactClass;
  29753. /***/ }),
  29754. /* 217 */
  29755. /***/ (function(module, exports, __webpack_require__) {
  29756. "use strict";
  29757. /**
  29758. * Copyright 2013-present, Facebook, Inc.
  29759. * All rights reserved.
  29760. *
  29761. * This source code is licensed under the BSD-style license found in the
  29762. * LICENSE file in the root directory of this source tree. An additional grant
  29763. * of patent rights can be found in the PATENTS file in the same directory.
  29764. *
  29765. */
  29766. var ReactElement = __webpack_require__(22);
  29767. /**
  29768. * Create a factory that creates HTML tag elements.
  29769. *
  29770. * @private
  29771. */
  29772. var createDOMFactory = ReactElement.createFactory;
  29773. if (false) {
  29774. var ReactElementValidator = require('./ReactElementValidator');
  29775. createDOMFactory = ReactElementValidator.createFactory;
  29776. }
  29777. /**
  29778. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  29779. * This is also accessible via `React.DOM`.
  29780. *
  29781. * @public
  29782. */
  29783. var ReactDOMFactories = {
  29784. a: createDOMFactory('a'),
  29785. abbr: createDOMFactory('abbr'),
  29786. address: createDOMFactory('address'),
  29787. area: createDOMFactory('area'),
  29788. article: createDOMFactory('article'),
  29789. aside: createDOMFactory('aside'),
  29790. audio: createDOMFactory('audio'),
  29791. b: createDOMFactory('b'),
  29792. base: createDOMFactory('base'),
  29793. bdi: createDOMFactory('bdi'),
  29794. bdo: createDOMFactory('bdo'),
  29795. big: createDOMFactory('big'),
  29796. blockquote: createDOMFactory('blockquote'),
  29797. body: createDOMFactory('body'),
  29798. br: createDOMFactory('br'),
  29799. button: createDOMFactory('button'),
  29800. canvas: createDOMFactory('canvas'),
  29801. caption: createDOMFactory('caption'),
  29802. cite: createDOMFactory('cite'),
  29803. code: createDOMFactory('code'),
  29804. col: createDOMFactory('col'),
  29805. colgroup: createDOMFactory('colgroup'),
  29806. data: createDOMFactory('data'),
  29807. datalist: createDOMFactory('datalist'),
  29808. dd: createDOMFactory('dd'),
  29809. del: createDOMFactory('del'),
  29810. details: createDOMFactory('details'),
  29811. dfn: createDOMFactory('dfn'),
  29812. dialog: createDOMFactory('dialog'),
  29813. div: createDOMFactory('div'),
  29814. dl: createDOMFactory('dl'),
  29815. dt: createDOMFactory('dt'),
  29816. em: createDOMFactory('em'),
  29817. embed: createDOMFactory('embed'),
  29818. fieldset: createDOMFactory('fieldset'),
  29819. figcaption: createDOMFactory('figcaption'),
  29820. figure: createDOMFactory('figure'),
  29821. footer: createDOMFactory('footer'),
  29822. form: createDOMFactory('form'),
  29823. h1: createDOMFactory('h1'),
  29824. h2: createDOMFactory('h2'),
  29825. h3: createDOMFactory('h3'),
  29826. h4: createDOMFactory('h4'),
  29827. h5: createDOMFactory('h5'),
  29828. h6: createDOMFactory('h6'),
  29829. head: createDOMFactory('head'),
  29830. header: createDOMFactory('header'),
  29831. hgroup: createDOMFactory('hgroup'),
  29832. hr: createDOMFactory('hr'),
  29833. html: createDOMFactory('html'),
  29834. i: createDOMFactory('i'),
  29835. iframe: createDOMFactory('iframe'),
  29836. img: createDOMFactory('img'),
  29837. input: createDOMFactory('input'),
  29838. ins: createDOMFactory('ins'),
  29839. kbd: createDOMFactory('kbd'),
  29840. keygen: createDOMFactory('keygen'),
  29841. label: createDOMFactory('label'),
  29842. legend: createDOMFactory('legend'),
  29843. li: createDOMFactory('li'),
  29844. link: createDOMFactory('link'),
  29845. main: createDOMFactory('main'),
  29846. map: createDOMFactory('map'),
  29847. mark: createDOMFactory('mark'),
  29848. menu: createDOMFactory('menu'),
  29849. menuitem: createDOMFactory('menuitem'),
  29850. meta: createDOMFactory('meta'),
  29851. meter: createDOMFactory('meter'),
  29852. nav: createDOMFactory('nav'),
  29853. noscript: createDOMFactory('noscript'),
  29854. object: createDOMFactory('object'),
  29855. ol: createDOMFactory('ol'),
  29856. optgroup: createDOMFactory('optgroup'),
  29857. option: createDOMFactory('option'),
  29858. output: createDOMFactory('output'),
  29859. p: createDOMFactory('p'),
  29860. param: createDOMFactory('param'),
  29861. picture: createDOMFactory('picture'),
  29862. pre: createDOMFactory('pre'),
  29863. progress: createDOMFactory('progress'),
  29864. q: createDOMFactory('q'),
  29865. rp: createDOMFactory('rp'),
  29866. rt: createDOMFactory('rt'),
  29867. ruby: createDOMFactory('ruby'),
  29868. s: createDOMFactory('s'),
  29869. samp: createDOMFactory('samp'),
  29870. script: createDOMFactory('script'),
  29871. section: createDOMFactory('section'),
  29872. select: createDOMFactory('select'),
  29873. small: createDOMFactory('small'),
  29874. source: createDOMFactory('source'),
  29875. span: createDOMFactory('span'),
  29876. strong: createDOMFactory('strong'),
  29877. style: createDOMFactory('style'),
  29878. sub: createDOMFactory('sub'),
  29879. summary: createDOMFactory('summary'),
  29880. sup: createDOMFactory('sup'),
  29881. table: createDOMFactory('table'),
  29882. tbody: createDOMFactory('tbody'),
  29883. td: createDOMFactory('td'),
  29884. textarea: createDOMFactory('textarea'),
  29885. tfoot: createDOMFactory('tfoot'),
  29886. th: createDOMFactory('th'),
  29887. thead: createDOMFactory('thead'),
  29888. time: createDOMFactory('time'),
  29889. title: createDOMFactory('title'),
  29890. tr: createDOMFactory('tr'),
  29891. track: createDOMFactory('track'),
  29892. u: createDOMFactory('u'),
  29893. ul: createDOMFactory('ul'),
  29894. 'var': createDOMFactory('var'),
  29895. video: createDOMFactory('video'),
  29896. wbr: createDOMFactory('wbr'),
  29897. // SVG
  29898. circle: createDOMFactory('circle'),
  29899. clipPath: createDOMFactory('clipPath'),
  29900. defs: createDOMFactory('defs'),
  29901. ellipse: createDOMFactory('ellipse'),
  29902. g: createDOMFactory('g'),
  29903. image: createDOMFactory('image'),
  29904. line: createDOMFactory('line'),
  29905. linearGradient: createDOMFactory('linearGradient'),
  29906. mask: createDOMFactory('mask'),
  29907. path: createDOMFactory('path'),
  29908. pattern: createDOMFactory('pattern'),
  29909. polygon: createDOMFactory('polygon'),
  29910. polyline: createDOMFactory('polyline'),
  29911. radialGradient: createDOMFactory('radialGradient'),
  29912. rect: createDOMFactory('rect'),
  29913. stop: createDOMFactory('stop'),
  29914. svg: createDOMFactory('svg'),
  29915. text: createDOMFactory('text'),
  29916. tspan: createDOMFactory('tspan')
  29917. };
  29918. module.exports = ReactDOMFactories;
  29919. /***/ }),
  29920. /* 218 */
  29921. /***/ (function(module, exports, __webpack_require__) {
  29922. "use strict";
  29923. /**
  29924. * Copyright 2013-present, Facebook, Inc.
  29925. * All rights reserved.
  29926. *
  29927. * This source code is licensed under the BSD-style license found in the
  29928. * LICENSE file in the root directory of this source tree. An additional grant
  29929. * of patent rights can be found in the PATENTS file in the same directory.
  29930. *
  29931. */
  29932. var ReactElement = __webpack_require__(22);
  29933. var ReactPropTypeLocationNames = __webpack_require__(97);
  29934. var ReactPropTypesSecret = __webpack_require__(219);
  29935. var emptyFunction = __webpack_require__(10);
  29936. var getIteratorFn = __webpack_require__(99);
  29937. var warning = __webpack_require__(1);
  29938. /**
  29939. * Collection of methods that allow declaration and validation of props that are
  29940. * supplied to React components. Example usage:
  29941. *
  29942. * var Props = require('ReactPropTypes');
  29943. * var MyArticle = React.createClass({
  29944. * propTypes: {
  29945. * // An optional string prop named "description".
  29946. * description: Props.string,
  29947. *
  29948. * // A required enum prop named "category".
  29949. * category: Props.oneOf(['News','Photos']).isRequired,
  29950. *
  29951. * // A prop named "dialog" that requires an instance of Dialog.
  29952. * dialog: Props.instanceOf(Dialog).isRequired
  29953. * },
  29954. * render: function() { ... }
  29955. * });
  29956. *
  29957. * A more formal specification of how these methods are used:
  29958. *
  29959. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  29960. * decl := ReactPropTypes.{type}(.isRequired)?
  29961. *
  29962. * Each and every declaration produces a function with the same signature. This
  29963. * allows the creation of custom validation functions. For example:
  29964. *
  29965. * var MyLink = React.createClass({
  29966. * propTypes: {
  29967. * // An optional string or URI prop named "href".
  29968. * href: function(props, propName, componentName) {
  29969. * var propValue = props[propName];
  29970. * if (propValue != null && typeof propValue !== 'string' &&
  29971. * !(propValue instanceof URI)) {
  29972. * return new Error(
  29973. * 'Expected a string or an URI for ' + propName + ' in ' +
  29974. * componentName
  29975. * );
  29976. * }
  29977. * }
  29978. * },
  29979. * render: function() {...}
  29980. * });
  29981. *
  29982. * @internal
  29983. */
  29984. var ANONYMOUS = '<<anonymous>>';
  29985. var ReactPropTypes = {
  29986. array: createPrimitiveTypeChecker('array'),
  29987. bool: createPrimitiveTypeChecker('boolean'),
  29988. func: createPrimitiveTypeChecker('function'),
  29989. number: createPrimitiveTypeChecker('number'),
  29990. object: createPrimitiveTypeChecker('object'),
  29991. string: createPrimitiveTypeChecker('string'),
  29992. symbol: createPrimitiveTypeChecker('symbol'),
  29993. any: createAnyTypeChecker(),
  29994. arrayOf: createArrayOfTypeChecker,
  29995. element: createElementTypeChecker(),
  29996. instanceOf: createInstanceTypeChecker,
  29997. node: createNodeChecker(),
  29998. objectOf: createObjectOfTypeChecker,
  29999. oneOf: createEnumTypeChecker,
  30000. oneOfType: createUnionTypeChecker,
  30001. shape: createShapeTypeChecker
  30002. };
  30003. /**
  30004. * inlined Object.is polyfill to avoid requiring consumers ship their own
  30005. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  30006. */
  30007. /*eslint-disable no-self-compare*/
  30008. function is(x, y) {
  30009. // SameValue algorithm
  30010. if (x === y) {
  30011. // Steps 1-5, 7-10
  30012. // Steps 6.b-6.e: +0 != -0
  30013. return x !== 0 || 1 / x === 1 / y;
  30014. } else {
  30015. // Step 6.a: NaN == NaN
  30016. return x !== x && y !== y;
  30017. }
  30018. }
  30019. /*eslint-enable no-self-compare*/
  30020. /**
  30021. * We use an Error-like object for backward compatibility as people may call
  30022. * PropTypes directly and inspect their output. However we don't use real
  30023. * Errors anymore. We don't inspect their stack anyway, and creating them
  30024. * is prohibitively expensive if they are created too often, such as what
  30025. * happens in oneOfType() for any type before the one that matched.
  30026. */
  30027. function PropTypeError(message) {
  30028. this.message = message;
  30029. this.stack = '';
  30030. }
  30031. // Make `instanceof Error` still work for returned errors.
  30032. PropTypeError.prototype = Error.prototype;
  30033. function createChainableTypeChecker(validate) {
  30034. if (false) {
  30035. var manualPropTypeCallCache = {};
  30036. }
  30037. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  30038. componentName = componentName || ANONYMOUS;
  30039. propFullName = propFullName || propName;
  30040. if (false) {
  30041. if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
  30042. var cacheKey = componentName + ':' + propName;
  30043. if (!manualPropTypeCallCache[cacheKey]) {
  30044. 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;
  30045. manualPropTypeCallCache[cacheKey] = true;
  30046. }
  30047. }
  30048. }
  30049. if (props[propName] == null) {
  30050. var locationName = ReactPropTypeLocationNames[location];
  30051. if (isRequired) {
  30052. if (props[propName] === null) {
  30053. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  30054. }
  30055. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  30056. }
  30057. return null;
  30058. } else {
  30059. return validate(props, propName, componentName, location, propFullName);
  30060. }
  30061. }
  30062. var chainedCheckType = checkType.bind(null, false);
  30063. chainedCheckType.isRequired = checkType.bind(null, true);
  30064. return chainedCheckType;
  30065. }
  30066. function createPrimitiveTypeChecker(expectedType) {
  30067. function validate(props, propName, componentName, location, propFullName, secret) {
  30068. var propValue = props[propName];
  30069. var propType = getPropType(propValue);
  30070. if (propType !== expectedType) {
  30071. var locationName = ReactPropTypeLocationNames[location];
  30072. // `propValue` being instance of, say, date/regexp, pass the 'object'
  30073. // check, but we can offer a more precise error message here rather than
  30074. // 'of type `object`'.
  30075. var preciseType = getPreciseType(propValue);
  30076. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  30077. }
  30078. return null;
  30079. }
  30080. return createChainableTypeChecker(validate);
  30081. }
  30082. function createAnyTypeChecker() {
  30083. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  30084. }
  30085. function createArrayOfTypeChecker(typeChecker) {
  30086. function validate(props, propName, componentName, location, propFullName) {
  30087. if (typeof typeChecker !== 'function') {
  30088. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  30089. }
  30090. var propValue = props[propName];
  30091. if (!Array.isArray(propValue)) {
  30092. var locationName = ReactPropTypeLocationNames[location];
  30093. var propType = getPropType(propValue);
  30094. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  30095. }
  30096. for (var i = 0; i < propValue.length; i++) {
  30097. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  30098. if (error instanceof Error) {
  30099. return error;
  30100. }
  30101. }
  30102. return null;
  30103. }
  30104. return createChainableTypeChecker(validate);
  30105. }
  30106. function createElementTypeChecker() {
  30107. function validate(props, propName, componentName, location, propFullName) {
  30108. var propValue = props[propName];
  30109. if (!ReactElement.isValidElement(propValue)) {
  30110. var locationName = ReactPropTypeLocationNames[location];
  30111. var propType = getPropType(propValue);
  30112. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  30113. }
  30114. return null;
  30115. }
  30116. return createChainableTypeChecker(validate);
  30117. }
  30118. function createInstanceTypeChecker(expectedClass) {
  30119. function validate(props, propName, componentName, location, propFullName) {
  30120. if (!(props[propName] instanceof expectedClass)) {
  30121. var locationName = ReactPropTypeLocationNames[location];
  30122. var expectedClassName = expectedClass.name || ANONYMOUS;
  30123. var actualClassName = getClassName(props[propName]);
  30124. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  30125. }
  30126. return null;
  30127. }
  30128. return createChainableTypeChecker(validate);
  30129. }
  30130. function createEnumTypeChecker(expectedValues) {
  30131. if (!Array.isArray(expectedValues)) {
  30132. false ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  30133. return emptyFunction.thatReturnsNull;
  30134. }
  30135. function validate(props, propName, componentName, location, propFullName) {
  30136. var propValue = props[propName];
  30137. for (var i = 0; i < expectedValues.length; i++) {
  30138. if (is(propValue, expectedValues[i])) {
  30139. return null;
  30140. }
  30141. }
  30142. var locationName = ReactPropTypeLocationNames[location];
  30143. var valuesString = JSON.stringify(expectedValues);
  30144. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  30145. }
  30146. return createChainableTypeChecker(validate);
  30147. }
  30148. function createObjectOfTypeChecker(typeChecker) {
  30149. function validate(props, propName, componentName, location, propFullName) {
  30150. if (typeof typeChecker !== 'function') {
  30151. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  30152. }
  30153. var propValue = props[propName];
  30154. var propType = getPropType(propValue);
  30155. if (propType !== 'object') {
  30156. var locationName = ReactPropTypeLocationNames[location];
  30157. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  30158. }
  30159. for (var key in propValue) {
  30160. if (propValue.hasOwnProperty(key)) {
  30161. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  30162. if (error instanceof Error) {
  30163. return error;
  30164. }
  30165. }
  30166. }
  30167. return null;
  30168. }
  30169. return createChainableTypeChecker(validate);
  30170. }
  30171. function createUnionTypeChecker(arrayOfTypeCheckers) {
  30172. if (!Array.isArray(arrayOfTypeCheckers)) {
  30173. false ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  30174. return emptyFunction.thatReturnsNull;
  30175. }
  30176. function validate(props, propName, componentName, location, propFullName) {
  30177. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  30178. var checker = arrayOfTypeCheckers[i];
  30179. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  30180. return null;
  30181. }
  30182. }
  30183. var locationName = ReactPropTypeLocationNames[location];
  30184. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  30185. }
  30186. return createChainableTypeChecker(validate);
  30187. }
  30188. function createNodeChecker() {
  30189. function validate(props, propName, componentName, location, propFullName) {
  30190. if (!isNode(props[propName])) {
  30191. var locationName = ReactPropTypeLocationNames[location];
  30192. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  30193. }
  30194. return null;
  30195. }
  30196. return createChainableTypeChecker(validate);
  30197. }
  30198. function createShapeTypeChecker(shapeTypes) {
  30199. function validate(props, propName, componentName, location, propFullName) {
  30200. var propValue = props[propName];
  30201. var propType = getPropType(propValue);
  30202. if (propType !== 'object') {
  30203. var locationName = ReactPropTypeLocationNames[location];
  30204. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  30205. }
  30206. for (var key in shapeTypes) {
  30207. var checker = shapeTypes[key];
  30208. if (!checker) {
  30209. continue;
  30210. }
  30211. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  30212. if (error) {
  30213. return error;
  30214. }
  30215. }
  30216. return null;
  30217. }
  30218. return createChainableTypeChecker(validate);
  30219. }
  30220. function isNode(propValue) {
  30221. switch (typeof propValue) {
  30222. case 'number':
  30223. case 'string':
  30224. case 'undefined':
  30225. return true;
  30226. case 'boolean':
  30227. return !propValue;
  30228. case 'object':
  30229. if (Array.isArray(propValue)) {
  30230. return propValue.every(isNode);
  30231. }
  30232. if (propValue === null || ReactElement.isValidElement(propValue)) {
  30233. return true;
  30234. }
  30235. var iteratorFn = getIteratorFn(propValue);
  30236. if (iteratorFn) {
  30237. var iterator = iteratorFn.call(propValue);
  30238. var step;
  30239. if (iteratorFn !== propValue.entries) {
  30240. while (!(step = iterator.next()).done) {
  30241. if (!isNode(step.value)) {
  30242. return false;
  30243. }
  30244. }
  30245. } else {
  30246. // Iterator will provide entry [k,v] tuples rather than values.
  30247. while (!(step = iterator.next()).done) {
  30248. var entry = step.value;
  30249. if (entry) {
  30250. if (!isNode(entry[1])) {
  30251. return false;
  30252. }
  30253. }
  30254. }
  30255. }
  30256. } else {
  30257. return false;
  30258. }
  30259. return true;
  30260. default:
  30261. return false;
  30262. }
  30263. }
  30264. function isSymbol(propType, propValue) {
  30265. // Native Symbol.
  30266. if (propType === 'symbol') {
  30267. return true;
  30268. }
  30269. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  30270. if (propValue['@@toStringTag'] === 'Symbol') {
  30271. return true;
  30272. }
  30273. // Fallback for non-spec compliant Symbols which are polyfilled.
  30274. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  30275. return true;
  30276. }
  30277. return false;
  30278. }
  30279. // Equivalent of `typeof` but with special handling for array and regexp.
  30280. function getPropType(propValue) {
  30281. var propType = typeof propValue;
  30282. if (Array.isArray(propValue)) {
  30283. return 'array';
  30284. }
  30285. if (propValue instanceof RegExp) {
  30286. // Old webkits (at least until Android 4.0) return 'function' rather than
  30287. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  30288. // passes PropTypes.object.
  30289. return 'object';
  30290. }
  30291. if (isSymbol(propType, propValue)) {
  30292. return 'symbol';
  30293. }
  30294. return propType;
  30295. }
  30296. // This handles more types than `getPropType`. Only used for error messages.
  30297. // See `createPrimitiveTypeChecker`.
  30298. function getPreciseType(propValue) {
  30299. var propType = getPropType(propValue);
  30300. if (propType === 'object') {
  30301. if (propValue instanceof Date) {
  30302. return 'date';
  30303. } else if (propValue instanceof RegExp) {
  30304. return 'regexp';
  30305. }
  30306. }
  30307. return propType;
  30308. }
  30309. // Returns class name of the object, if any.
  30310. function getClassName(propValue) {
  30311. if (!propValue.constructor || !propValue.constructor.name) {
  30312. return ANONYMOUS;
  30313. }
  30314. return propValue.constructor.name;
  30315. }
  30316. module.exports = ReactPropTypes;
  30317. /***/ }),
  30318. /* 219 */
  30319. /***/ (function(module, exports, __webpack_require__) {
  30320. "use strict";
  30321. /**
  30322. * Copyright 2013-present, Facebook, Inc.
  30323. * All rights reserved.
  30324. *
  30325. * This source code is licensed under the BSD-style license found in the
  30326. * LICENSE file in the root directory of this source tree. An additional grant
  30327. * of patent rights can be found in the PATENTS file in the same directory.
  30328. *
  30329. *
  30330. */
  30331. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  30332. module.exports = ReactPropTypesSecret;
  30333. /***/ }),
  30334. /* 220 */
  30335. /***/ (function(module, exports, __webpack_require__) {
  30336. "use strict";
  30337. /**
  30338. * Copyright 2013-present, Facebook, Inc.
  30339. * All rights reserved.
  30340. *
  30341. * This source code is licensed under the BSD-style license found in the
  30342. * LICENSE file in the root directory of this source tree. An additional grant
  30343. * of patent rights can be found in the PATENTS file in the same directory.
  30344. *
  30345. */
  30346. var _assign = __webpack_require__(3);
  30347. var ReactComponent = __webpack_require__(67);
  30348. var ReactNoopUpdateQueue = __webpack_require__(68);
  30349. var emptyObject = __webpack_require__(25);
  30350. /**
  30351. * Base class helpers for the updating state of a component.
  30352. */
  30353. function ReactPureComponent(props, context, updater) {
  30354. // Duplicated from ReactComponent.
  30355. this.props = props;
  30356. this.context = context;
  30357. this.refs = emptyObject;
  30358. // We initialize the default updater but the real one gets injected by the
  30359. // renderer.
  30360. this.updater = updater || ReactNoopUpdateQueue;
  30361. }
  30362. function ComponentDummy() {}
  30363. ComponentDummy.prototype = ReactComponent.prototype;
  30364. ReactPureComponent.prototype = new ComponentDummy();
  30365. ReactPureComponent.prototype.constructor = ReactPureComponent;
  30366. // Avoid an extra prototype jump for these methods.
  30367. _assign(ReactPureComponent.prototype, ReactComponent.prototype);
  30368. ReactPureComponent.prototype.isPureReactComponent = true;
  30369. module.exports = ReactPureComponent;
  30370. /***/ }),
  30371. /* 221 */
  30372. /***/ (function(module, exports, __webpack_require__) {
  30373. "use strict";
  30374. /**
  30375. * Copyright 2013-present, Facebook, Inc.
  30376. * All rights reserved.
  30377. *
  30378. * This source code is licensed under the BSD-style license found in the
  30379. * LICENSE file in the root directory of this source tree. An additional grant
  30380. * of patent rights can be found in the PATENTS file in the same directory.
  30381. *
  30382. */
  30383. module.exports = '15.4.2';
  30384. /***/ }),
  30385. /* 222 */
  30386. /***/ (function(module, exports, __webpack_require__) {
  30387. "use strict";
  30388. /**
  30389. * Copyright 2013-present, Facebook, Inc.
  30390. * All rights reserved.
  30391. *
  30392. * This source code is licensed under the BSD-style license found in the
  30393. * LICENSE file in the root directory of this source tree. An additional grant
  30394. * of patent rights can be found in the PATENTS file in the same directory.
  30395. *
  30396. */
  30397. var _prodInvariant = __webpack_require__(23);
  30398. var ReactElement = __webpack_require__(22);
  30399. var invariant = __webpack_require__(0);
  30400. /**
  30401. * Returns the first child in a collection of children and verifies that there
  30402. * is only one child in the collection.
  30403. *
  30404. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
  30405. *
  30406. * The current implementation of this function assumes that a single child gets
  30407. * passed without a wrapper, but the purpose of this helper function is to
  30408. * abstract away the particular structure of children.
  30409. *
  30410. * @param {?object} children Child collection structure.
  30411. * @return {ReactElement} The first and only `ReactElement` contained in the
  30412. * structure.
  30413. */
  30414. function onlyChild(children) {
  30415. !ReactElement.isValidElement(children) ? false ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
  30416. return children;
  30417. }
  30418. module.exports = onlyChild;
  30419. /***/ }),
  30420. /* 223 */
  30421. /***/ (function(module, exports, __webpack_require__) {
  30422. "use strict";
  30423. /**
  30424. * Copyright 2013-present, Facebook, Inc.
  30425. * All rights reserved.
  30426. *
  30427. * This source code is licensed under the BSD-style license found in the
  30428. * LICENSE file in the root directory of this source tree. An additional grant
  30429. * of patent rights can be found in the PATENTS file in the same directory.
  30430. *
  30431. */
  30432. var _prodInvariant = __webpack_require__(23);
  30433. var ReactCurrentOwner = __webpack_require__(14);
  30434. var REACT_ELEMENT_TYPE = __webpack_require__(96);
  30435. var getIteratorFn = __webpack_require__(99);
  30436. var invariant = __webpack_require__(0);
  30437. var KeyEscapeUtils = __webpack_require__(213);
  30438. var warning = __webpack_require__(1);
  30439. var SEPARATOR = '.';
  30440. var SUBSEPARATOR = ':';
  30441. /**
  30442. * This is inlined from ReactElement since this file is shared between
  30443. * isomorphic and renderers. We could extract this to a
  30444. *
  30445. */
  30446. /**
  30447. * TODO: Test that a single child and an array with one item have the same key
  30448. * pattern.
  30449. */
  30450. var didWarnAboutMaps = false;
  30451. /**
  30452. * Generate a key string that identifies a component within a set.
  30453. *
  30454. * @param {*} component A component that could contain a manual key.
  30455. * @param {number} index Index that is used if a manual key is not provided.
  30456. * @return {string}
  30457. */
  30458. function getComponentKey(component, index) {
  30459. // Do some typechecking here since we call this blindly. We want to ensure
  30460. // that we don't block potential future ES APIs.
  30461. if (component && typeof component === 'object' && component.key != null) {
  30462. // Explicit key
  30463. return KeyEscapeUtils.escape(component.key);
  30464. }
  30465. // Implicit key determined by the index in the set
  30466. return index.toString(36);
  30467. }
  30468. /**
  30469. * @param {?*} children Children tree container.
  30470. * @param {!string} nameSoFar Name of the key path so far.
  30471. * @param {!function} callback Callback to invoke with each child found.
  30472. * @param {?*} traverseContext Used to pass information throughout the traversal
  30473. * process.
  30474. * @return {!number} The number of children in this subtree.
  30475. */
  30476. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  30477. var type = typeof children;
  30478. if (type === 'undefined' || type === 'boolean') {
  30479. // All of the above are perceived as null.
  30480. children = null;
  30481. }
  30482. if (children === null || type === 'string' || type === 'number' ||
  30483. // The following is inlined from ReactElement. This means we can optimize
  30484. // some checks. React Fiber also inlines this logic for similar purposes.
  30485. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  30486. callback(traverseContext, children,
  30487. // If it's the only child, treat the name as if it was wrapped in an array
  30488. // so that it's consistent if the number of children grows.
  30489. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  30490. return 1;
  30491. }
  30492. var child;
  30493. var nextName;
  30494. var subtreeCount = 0; // Count of children found in the current subtree.
  30495. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  30496. if (Array.isArray(children)) {
  30497. for (var i = 0; i < children.length; i++) {
  30498. child = children[i];
  30499. nextName = nextNamePrefix + getComponentKey(child, i);
  30500. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30501. }
  30502. } else {
  30503. var iteratorFn = getIteratorFn(children);
  30504. if (iteratorFn) {
  30505. var iterator = iteratorFn.call(children);
  30506. var step;
  30507. if (iteratorFn !== children.entries) {
  30508. var ii = 0;
  30509. while (!(step = iterator.next()).done) {
  30510. child = step.value;
  30511. nextName = nextNamePrefix + getComponentKey(child, ii++);
  30512. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30513. }
  30514. } else {
  30515. if (false) {
  30516. var mapsAsChildrenAddendum = '';
  30517. if (ReactCurrentOwner.current) {
  30518. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  30519. if (mapsAsChildrenOwnerName) {
  30520. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  30521. }
  30522. }
  30523. 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;
  30524. didWarnAboutMaps = true;
  30525. }
  30526. // Iterator will provide entry [k,v] tuples rather than values.
  30527. while (!(step = iterator.next()).done) {
  30528. var entry = step.value;
  30529. if (entry) {
  30530. child = entry[1];
  30531. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  30532. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30533. }
  30534. }
  30535. }
  30536. } else if (type === 'object') {
  30537. var addendum = '';
  30538. if (false) {
  30539. 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.';
  30540. if (children._isReactElement) {
  30541. 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.';
  30542. }
  30543. if (ReactCurrentOwner.current) {
  30544. var name = ReactCurrentOwner.current.getName();
  30545. if (name) {
  30546. addendum += ' Check the render method of `' + name + '`.';
  30547. }
  30548. }
  30549. }
  30550. var childrenString = String(children);
  30551. 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;
  30552. }
  30553. }
  30554. return subtreeCount;
  30555. }
  30556. /**
  30557. * Traverses children that are typically specified as `props.children`, but
  30558. * might also be specified through attributes:
  30559. *
  30560. * - `traverseAllChildren(this.props.children, ...)`
  30561. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  30562. *
  30563. * The `traverseContext` is an optional argument that is passed through the
  30564. * entire traversal. It can be used to store accumulations or anything else that
  30565. * the callback might find relevant.
  30566. *
  30567. * @param {?*} children Children tree object.
  30568. * @param {!function} callback To invoke upon traversing each child.
  30569. * @param {?*} traverseContext Context for traversal.
  30570. * @return {!number} The number of children in this subtree.
  30571. */
  30572. function traverseAllChildren(children, callback, traverseContext) {
  30573. if (children == null) {
  30574. return 0;
  30575. }
  30576. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  30577. }
  30578. module.exports = traverseAllChildren;
  30579. /***/ }),
  30580. /* 224 */
  30581. /***/ (function(module, exports) {
  30582. /**
  30583. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  30584. * embed the css on the page. This breaks all relative urls because now they are relative to a
  30585. * bundle instead of the current page.
  30586. *
  30587. * One solution is to only use full urls, but that may be impossible.
  30588. *
  30589. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  30590. *
  30591. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  30592. *
  30593. */
  30594. module.exports = function (css) {
  30595. // get current location
  30596. var location = typeof window !== "undefined" && window.location;
  30597. if (!location) {
  30598. throw new Error("fixUrls requires window.location");
  30599. }
  30600. // blank or null?
  30601. if (!css || typeof css !== "string") {
  30602. return css;
  30603. }
  30604. var baseUrl = location.protocol + "//" + location.host;
  30605. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  30606. // convert each url(...)
  30607. /*
  30608. This regular expression is just a way to recursively match brackets within
  30609. a string.
  30610. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  30611. ( = Start a capturing group
  30612. (?: = Start a non-capturing group
  30613. [^)(] = Match anything that isn't a parentheses
  30614. | = OR
  30615. \( = Match a start parentheses
  30616. (?: = Start another non-capturing groups
  30617. [^)(]+ = Match anything that isn't a parentheses
  30618. | = OR
  30619. \( = Match a start parentheses
  30620. [^)(]* = Match anything that isn't a parentheses
  30621. \) = Match a end parentheses
  30622. ) = End Group
  30623. *\) = Match anything and then a close parens
  30624. ) = Close non-capturing group
  30625. * = Match anything
  30626. ) = Close capturing group
  30627. \) = Match a close parens
  30628. /gi = Get all matches, not the first. Be case insensitive.
  30629. */
  30630. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  30631. // strip quotes (if they exist)
  30632. var unquotedOrigUrl = origUrl
  30633. .trim()
  30634. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  30635. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  30636. // already a full url? no change
  30637. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
  30638. return fullMatch;
  30639. }
  30640. // convert the url to a full url
  30641. var newUrl;
  30642. if (unquotedOrigUrl.indexOf("//") === 0) {
  30643. //TODO: should we add protocol?
  30644. newUrl = unquotedOrigUrl;
  30645. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  30646. // path should be relative to the base url
  30647. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  30648. } else {
  30649. // path should be relative to current directory
  30650. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  30651. }
  30652. // send back the fixed url(...)
  30653. return "url(" + JSON.stringify(newUrl) + ")";
  30654. });
  30655. // send back the fixed css
  30656. return fixedCss;
  30657. };
  30658. /***/ }),
  30659. /* 225 */
  30660. /***/ (function(module, exports, __webpack_require__) {
  30661. // style-loader: Adds some css to the DOM by adding a <style> tag
  30662. // load the styles
  30663. var content = __webpack_require__(122);
  30664. if(typeof content === 'string') content = [[module.i, content, '']];
  30665. // add the styles to the DOM
  30666. var update = __webpack_require__(9)(content, {});
  30667. if(content.locals) module.exports = content.locals;
  30668. // Hot Module Replacement
  30669. if(false) {
  30670. // When the styles change, update the <style> tags
  30671. if(!content.locals) {
  30672. module.hot.accept("!!../../css-loader/index.js!./codemirror.css", function() {
  30673. var newContent = require("!!../../css-loader/index.js!./codemirror.css");
  30674. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30675. update(newContent);
  30676. });
  30677. }
  30678. // When the module is disposed, remove the <style> tags
  30679. module.hot.dispose(function() { update(); });
  30680. }
  30681. /***/ }),
  30682. /* 226 */
  30683. /***/ (function(module, exports, __webpack_require__) {
  30684. // style-loader: Adds some css to the DOM by adding a <style> tag
  30685. // load the styles
  30686. var content = __webpack_require__(123);
  30687. if(typeof content === 'string') content = [[module.i, content, '']];
  30688. // add the styles to the DOM
  30689. var update = __webpack_require__(9)(content, {});
  30690. if(content.locals) module.exports = content.locals;
  30691. // Hot Module Replacement
  30692. if(false) {
  30693. // When the styles change, update the <style> tags
  30694. if(!content.locals) {
  30695. module.hot.accept("!!../node_modules/css-loader/index.js!../node_modules/less-loader/dist/index.js!./app.less", function() {
  30696. var newContent = require("!!../node_modules/css-loader/index.js!../node_modules/less-loader/dist/index.js!./app.less");
  30697. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30698. update(newContent);
  30699. });
  30700. }
  30701. // When the module is disposed, remove the <style> tags
  30702. module.hot.dispose(function() { update(); });
  30703. }
  30704. /***/ }),
  30705. /* 227 */
  30706. /***/ (function(module, exports, __webpack_require__) {
  30707. // style-loader: Adds some css to the DOM by adding a <style> tag
  30708. // load the styles
  30709. var content = __webpack_require__(124);
  30710. if(typeof content === 'string') content = [[module.i, content, '']];
  30711. // add the styles to the DOM
  30712. var update = __webpack_require__(9)(content, {});
  30713. if(content.locals) module.exports = content.locals;
  30714. // Hot Module Replacement
  30715. if(false) {
  30716. // When the styles change, update the <style> tags
  30717. if(!content.locals) {
  30718. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./content.less", function() {
  30719. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./content.less");
  30720. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30721. update(newContent);
  30722. });
  30723. }
  30724. // When the module is disposed, remove the <style> tags
  30725. module.hot.dispose(function() { update(); });
  30726. }
  30727. /***/ }),
  30728. /* 228 */
  30729. /***/ (function(module, exports, __webpack_require__) {
  30730. // style-loader: Adds some css to the DOM by adding a <style> tag
  30731. // load the styles
  30732. var content = __webpack_require__(125);
  30733. if(typeof content === 'string') content = [[module.i, content, '']];
  30734. // add the styles to the DOM
  30735. var update = __webpack_require__(9)(content, {});
  30736. if(content.locals) module.exports = content.locals;
  30737. // Hot Module Replacement
  30738. if(false) {
  30739. // When the styles change, update the <style> tags
  30740. if(!content.locals) {
  30741. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./editor.less", function() {
  30742. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./editor.less");
  30743. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30744. update(newContent);
  30745. });
  30746. }
  30747. // When the module is disposed, remove the <style> tags
  30748. module.hot.dispose(function() { update(); });
  30749. }
  30750. /***/ }),
  30751. /* 229 */
  30752. /***/ (function(module, exports, __webpack_require__) {
  30753. // style-loader: Adds some css to the DOM by adding a <style> tag
  30754. // load the styles
  30755. var content = __webpack_require__(126);
  30756. if(typeof content === 'string') content = [[module.i, content, '']];
  30757. // add the styles to the DOM
  30758. var update = __webpack_require__(9)(content, {});
  30759. if(content.locals) module.exports = content.locals;
  30760. // Hot Module Replacement
  30761. if(false) {
  30762. // When the styles change, update the <style> tags
  30763. if(!content.locals) {
  30764. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./edit.less", function() {
  30765. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./edit.less");
  30766. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30767. update(newContent);
  30768. });
  30769. }
  30770. // When the module is disposed, remove the <style> tags
  30771. module.hot.dispose(function() { update(); });
  30772. }
  30773. /***/ }),
  30774. /* 230 */
  30775. /***/ (function(module, exports, __webpack_require__) {
  30776. // style-loader: Adds some css to the DOM by adding a <style> tag
  30777. // load the styles
  30778. var content = __webpack_require__(127);
  30779. if(typeof content === 'string') content = [[module.i, content, '']];
  30780. // add the styles to the DOM
  30781. var update = __webpack_require__(9)(content, {});
  30782. if(content.locals) module.exports = content.locals;
  30783. // Hot Module Replacement
  30784. if(false) {
  30785. // When the styles change, update the <style> tags
  30786. if(!content.locals) {
  30787. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./frame.less", function() {
  30788. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./frame.less");
  30789. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30790. update(newContent);
  30791. });
  30792. }
  30793. // When the module is disposed, remove the <style> tags
  30794. module.hot.dispose(function() { update(); });
  30795. }
  30796. /***/ }),
  30797. /* 231 */
  30798. /***/ (function(module, exports, __webpack_require__) {
  30799. // style-loader: Adds some css to the DOM by adding a <style> tag
  30800. // load the styles
  30801. var content = __webpack_require__(128);
  30802. if(typeof content === 'string') content = [[module.i, content, '']];
  30803. // add the styles to the DOM
  30804. var update = __webpack_require__(9)(content, {});
  30805. if(content.locals) module.exports = content.locals;
  30806. // Hot Module Replacement
  30807. if(false) {
  30808. // When the styles change, update the <style> tags
  30809. if(!content.locals) {
  30810. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./group.less", function() {
  30811. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./group.less");
  30812. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30813. update(newContent);
  30814. });
  30815. }
  30816. // When the module is disposed, remove the <style> tags
  30817. module.hot.dispose(function() { update(); });
  30818. }
  30819. /***/ }),
  30820. /* 232 */
  30821. /***/ (function(module, exports, __webpack_require__) {
  30822. // style-loader: Adds some css to the DOM by adding a <style> tag
  30823. // load the styles
  30824. var content = __webpack_require__(129);
  30825. if(typeof content === 'string') content = [[module.i, content, '']];
  30826. // add the styles to the DOM
  30827. var update = __webpack_require__(9)(content, {});
  30828. if(content.locals) module.exports = content.locals;
  30829. // Hot Module Replacement
  30830. if(false) {
  30831. // When the styles change, update the <style> tags
  30832. if(!content.locals) {
  30833. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./preferences.less", function() {
  30834. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./preferences.less");
  30835. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30836. update(newContent);
  30837. });
  30838. }
  30839. // When the module is disposed, remove the <style> tags
  30840. module.hot.dispose(function() { update(); });
  30841. }
  30842. /***/ }),
  30843. /* 233 */
  30844. /***/ (function(module, exports, __webpack_require__) {
  30845. // style-loader: Adds some css to the DOM by adding a <style> tag
  30846. // load the styles
  30847. var content = __webpack_require__(130);
  30848. if(typeof content === 'string') content = [[module.i, content, '']];
  30849. // add the styles to the DOM
  30850. var update = __webpack_require__(9)(content, {});
  30851. if(content.locals) module.exports = content.locals;
  30852. // Hot Module Replacement
  30853. if(false) {
  30854. // When the styles change, update the <style> tags
  30855. if(!content.locals) {
  30856. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./sudo.less", function() {
  30857. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./sudo.less");
  30858. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30859. update(newContent);
  30860. });
  30861. }
  30862. // When the module is disposed, remove the <style> tags
  30863. module.hot.dispose(function() { update(); });
  30864. }
  30865. /***/ }),
  30866. /* 234 */
  30867. /***/ (function(module, exports, __webpack_require__) {
  30868. // style-loader: Adds some css to the DOM by adding a <style> tag
  30869. // load the styles
  30870. var content = __webpack_require__(131);
  30871. if(typeof content === 'string') content = [[module.i, content, '']];
  30872. // add the styles to the DOM
  30873. var update = __webpack_require__(9)(content, {});
  30874. if(content.locals) module.exports = content.locals;
  30875. // Hot Module Replacement
  30876. if(false) {
  30877. // When the styles change, update the <style> tags
  30878. if(!content.locals) {
  30879. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./buttons.less", function() {
  30880. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./buttons.less");
  30881. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30882. update(newContent);
  30883. });
  30884. }
  30885. // When the module is disposed, remove the <style> tags
  30886. module.hot.dispose(function() { update(); });
  30887. }
  30888. /***/ }),
  30889. /* 235 */
  30890. /***/ (function(module, exports, __webpack_require__) {
  30891. // style-loader: Adds some css to the DOM by adding a <style> tag
  30892. // load the styles
  30893. var content = __webpack_require__(132);
  30894. if(typeof content === 'string') content = [[module.i, content, '']];
  30895. // add the styles to the DOM
  30896. var update = __webpack_require__(9)(content, {});
  30897. if(content.locals) module.exports = content.locals;
  30898. // Hot Module Replacement
  30899. if(false) {
  30900. // When the styles change, update the <style> tags
  30901. if(!content.locals) {
  30902. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list-item.less", function() {
  30903. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list-item.less");
  30904. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30905. update(newContent);
  30906. });
  30907. }
  30908. // When the module is disposed, remove the <style> tags
  30909. module.hot.dispose(function() { update(); });
  30910. }
  30911. /***/ }),
  30912. /* 236 */
  30913. /***/ (function(module, exports, __webpack_require__) {
  30914. // style-loader: Adds some css to the DOM by adding a <style> tag
  30915. // load the styles
  30916. var content = __webpack_require__(133);
  30917. if(typeof content === 'string') content = [[module.i, content, '']];
  30918. // add the styles to the DOM
  30919. var update = __webpack_require__(9)(content, {});
  30920. if(content.locals) module.exports = content.locals;
  30921. // Hot Module Replacement
  30922. if(false) {
  30923. // When the styles change, update the <style> tags
  30924. if(!content.locals) {
  30925. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list.less", function() {
  30926. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./list.less");
  30927. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30928. update(newContent);
  30929. });
  30930. }
  30931. // When the module is disposed, remove the <style> tags
  30932. module.hot.dispose(function() { update(); });
  30933. }
  30934. /***/ }),
  30935. /* 237 */
  30936. /***/ (function(module, exports, __webpack_require__) {
  30937. // style-loader: Adds some css to the DOM by adding a <style> tag
  30938. // load the styles
  30939. var content = __webpack_require__(134);
  30940. if(typeof content === 'string') content = [[module.i, content, '']];
  30941. // add the styles to the DOM
  30942. var update = __webpack_require__(9)(content, {});
  30943. if(content.locals) module.exports = content.locals;
  30944. // Hot Module Replacement
  30945. if(false) {
  30946. // When the styles change, update the <style> tags
  30947. if(!content.locals) {
  30948. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./panel.less", function() {
  30949. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./panel.less");
  30950. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30951. update(newContent);
  30952. });
  30953. }
  30954. // When the module is disposed, remove the <style> tags
  30955. module.hot.dispose(function() { update(); });
  30956. }
  30957. /***/ }),
  30958. /* 238 */
  30959. /***/ (function(module, exports, __webpack_require__) {
  30960. // style-loader: Adds some css to the DOM by adding a <style> tag
  30961. // load the styles
  30962. var content = __webpack_require__(135);
  30963. if(typeof content === 'string') content = [[module.i, content, '']];
  30964. // add the styles to the DOM
  30965. var update = __webpack_require__(9)(content, {});
  30966. if(content.locals) module.exports = content.locals;
  30967. // Hot Module Replacement
  30968. if(false) {
  30969. // When the styles change, update the <style> tags
  30970. if(!content.locals) {
  30971. module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./searchbar.less", function() {
  30972. var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/less-loader/dist/index.js!./searchbar.less");
  30973. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30974. update(newContent);
  30975. });
  30976. }
  30977. // When the module is disposed, remove the <style> tags
  30978. module.hot.dispose(function() { update(); });
  30979. }
  30980. /***/ }),
  30981. /* 239 */
  30982. /***/ (function(module, exports) {
  30983. module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiID4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8bWV0YWRhdGE+CkNyZWF0ZWQgYnkgRm9udEZvcmdlIDIwMTIwNzMxIGF0IFNhdCBBcHIgIDEgMTA6NTc6MTIgMjAxNwogQnkgYWRtaW4KPC9tZXRhZGF0YT4KPGRlZnM+Cjxmb250IGlkPSJpY29uZm9udCIgaG9yaXotYWR2LXg9IjEwMjQiID4KICA8Zm9udC1mYWNlIAogICAgZm9udC1mYW1pbHk9Imljb25mb250IgogICAgZm9udC13ZWlnaHQ9IjUwMCIKICAgIGZvbnQtc3RyZXRjaD0ibm9ybWFsIgogICAgdW5pdHMtcGVyLWVtPSIxMDI0IgogICAgcGFub3NlLTE9IjIgMCA2IDMgMCAwIDAgMCAwIDAiCiAgICBhc2NlbnQ9Ijg5NiIKICAgIGRlc2NlbnQ9Ii0xMjgiCiAgICB4LWhlaWdodD0iNzkyIgogICAgYmJveD0iMCAtMjEyIDEwMjQgODk2IgogICAgdW5kZXJsaW5lLXRoaWNrbmVzcz0iMCIKICAgIHVuZGVybGluZS1wb3NpdGlvbj0iMCIKICAgIHVuaWNvZGUtcmFuZ2U9IlUrMDA3OC1FNzdEIgogIC8+CjxtaXNzaW5nLWdseXBoIAogLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSIubm90ZGVmIiAKIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iLm5vdGRlZiIgCiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Ii5udWxsIiBob3Jpei1hZHYteD0iMCIgCiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im5vbm1hcmtpbmdyZXR1cm4iIGhvcml6LWFkdi14PSIzNDEiIAogLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJ4IiB1bmljb2RlPSJ4IiBob3Jpei1hZHYteD0iMTAwMSIgCmQ9Ik0yODEgNTQzcS0yNyAtMSAtNTMgLTFoLTgzcS0xOCAwIC0zNi41IC02dC0zMi41IC0xOC41dC0yMyAtMzJ0LTkgLTQ1LjV2LTc2aDkxMnY0MXEwIDE2IC0wLjUgMzB0LTAuNSAxOHEwIDEzIC01IDI5dC0xNyAyOS41dC0zMS41IDIyLjV0LTQ5LjUgOWgtMTMzdi05N2gtNDM4djk3ek05NTUgMzEwdi01MnEwIC0yMyAwLjUgLTUydDAuNSAtNTh0LTEwLjUgLTQ3LjV0LTI2IC0zMHQtMzMgLTE2dC0zMS41IC00LjVxLTE0IC0xIC0yOS41IC0wLjUKdC0yOS41IDAuNWgtMzJsLTQ1IDEyOGgtNDM5bC00NCAtMTI4aC0yOWgtMzRxLTIwIDAgLTQ1IDFxLTI1IDAgLTQxIDkuNXQtMjUuNSAyM3QtMTMuNSAyOS41dC00IDMwdjE2N2g5MTF6TTE2MyAyNDdxLTEyIDAgLTIxIC04LjV0LTkgLTIxLjV0OSAtMjEuNXQyMSAtOC41cTEzIDAgMjIgOC41dDkgMjEuNXQtOSAyMS41dC0yMiA4LjV6TTMxNiAxMjNxLTggLTI2IC0xNCAtNDhxLTUgLTE5IC0xMC41IC0zN3QtNy41IC0yNXQtMyAtMTV0MSAtMTQuNQp0OS41IC0xMC41dDIxLjUgLTRoMzdoNjdoODFoODBoNjRoMzZxMjMgMCAzNCAxMnQyIDM4cS01IDEzIC05LjUgMzAuNXQtOS41IDM0LjVxLTUgMTkgLTExIDM5aC0zNjh6TTMzNiA0OTh2MjI4cTAgMTEgMi41IDIzdDEwIDIxLjV0MjAuNSAxNS41dDM0IDZoMTg4cTMxIDAgNTEuNSAtMTQuNXQyMC41IC01Mi41di0yMjdoLTMyN3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ic3dpdGNob2ZmIiB1bmljb2RlPSImI3hlNjBkOyIgCmQ9Ik04MzIgODEyaC02NDBxLTgwIDAgLTEzNiAtNTZ0LTU2IC0xMzZ2LTY0MHEwIC03OSA1NiAtMTM1LjV0MTM2IC01Ni41aDY0MHE3OSAwIDEzNS41IDU2LjV0NTYuNSAxMzUuNXY2NDBxMCA4MCAtNTYuNSAxMzZ0LTEzNS41IDU2ek0xNjAgLTg0cS0xMyAwIC0yMi41IDkuNXQtOS41IDIyLjV0OS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTE2MCA2MjBxLTEzIDAgLTIyLjUgOS41CnQtOS41IDIyLjV0OS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTcwNCAtMjBxMCAtMjcgLTE4LjUgLTQ1LjV0LTQ1LjUgLTE4LjVoLTI1NnEtMjcgMCAtNDUuNSAxOC41dC0xOC41IDQ1LjV2NjQwcTAgMjYgMTkgNDV0NDUgMTloMjU2cTI3IDAgNDUuNSAtMTguNXQxOC41IC00NS41di02NDB6TTg2NCAtODRxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNQp0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTg2NCA2MjBxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNTc2IDMwMGgtMTI4cS0yNiAwIC00NSAtMTl0LTE5IC00NXYtMTkycTAgLTI3IDE4LjUgLTQ1LjV0NDUuNSAtMTguNWgxMjhxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djE5MgpxMCAyNyAtMTguNSA0NS41dC00NS41IDE4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Imljb24iIHVuaWNvZGU9IiYjeGU2MDA7IiAKZD0iTTQ4OCA3NDVsMTMyIC0yNjlsMjk3IC00M2wtMjE1IC0yMDlsNTEgLTI5NmwtMjY1IDE0MGwtMjY2IC0xNDBsNTEgMjk2bC0yMTUgMjA5bDI5NyA0M3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0id2FybmZpbGwiIHVuaWNvZGU9IiYjeGU2MDc7IiAKZD0iTTk0MyAxMjdsLTM0MSA2MDlxLTM1IDYzIC05MC41IDYzdC05MC41IC02M2wtMzQwIC02MDlxLTM0IC02MiAtNiAtMTExcTI5IC00OCAxMDAgLTQ4aDY3NHE3MSAwIDk5LjUgNDguNXQtNS41IDExMC41ek00ODAgNTc2cTAgMTMgOS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXYtMjg4cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNXQtMjIuNSA5LjV0LTkuNSAyMi41djI4OHpNNTEyIDY0cS0yMCAwIC0zNCAxNHQtMTQgMzQKdDE0IDM0dDM0IDE0dDM0IC0xNHQxNCAtMzR0LTE0IC0zNHQtMzQgLTE0eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJ3YXJuIiB1bmljb2RlPSImI3hlNjA4OyIgCmQ9Ik04NDkgLTMzaC02NzRxLTcxIDAgLTk5LjUgNDl0NS41IDExMWwzNDAgNjA5cTM1IDYzIDkwLjUgNjN0OTAuNSAtNjNsMzQxIC02MDlxMzQgLTYzIDUuNSAtMTExLjV0LTk5LjUgLTQ4LjV6TTUxMiA3MzVxLTE4IDAgLTM1IC0zMGwtMzQwIC02MTBxLTE3IC0zMCAtNyAtNDd0NDUgLTE3aDY3NHEzNSAwIDQ1IDE3dC03IDQ3bC0zNDEgNjEwcS0xNiAzMCAtMzQgMzB6TTUxMiAyNTZxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXYyODgKcTAgMTMgOS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXYtMjg4cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNTEyIDE0NHpNNDY0IDE0NHEwIDIwIDE0IDM0dDM0IDE0dDM0IC0xNHQxNCAtMzR0LTE0IC0zNHQtMzQgLTE0dC0zNCAxNHQtMTQgMzR6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im9rIiB1bmljb2RlPSImI3hlNjA0OyIgCmQ9Ik01MTIgNzA5cS0xMTEgMCAtMjA1LjUgLTU0LjV0LTE0OSAtMTQ5dC01NC41IC0yMDUuNXQ1NC41IC0yMDUuNXQxNDkgLTE0OXQyMDUuNSAtNTQuNXQyMDUuNSA1NC41dDE0OSAxNDl0NTQuNSAyMDUuNXQtNTQuNSAyMDUuNXQtMTQ5IDE0OXQtMjA1LjUgNTQuNXpNMzc2IDI1M3EwIC0xIDUgLTZsOSAtOXQxMCAtNy41dDEwIC0zLjVxMTYgMCAxMDkgMTA0bDEzOCAxNThxNyA4IDE1IDlxMTMgMCAyMSAtN2w0NSAtNDRxNyAtOCA3LjUgLTE4LjUKdC02LjUgLTE4LjVsLTI1MCAtMjY0djBsLTUzIC01N3EtNyAtNyAtMTggLTcuNXQtMTggNi41bC0xNTEgMTQycS04IDcgLTguNSAxOHQ3LjUgMTlsMzUgMzdxNyA4IDE4IDguNXQxOSAtNy41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJoIiB1bmljb2RlPSImI3hlNjE3OyIgCmQ9Ik01MTIgODAycS0xMDQgMCAtMTkyLjUgLTUxLjV0LTE0MCAtMTQwdC01MS41IC0xOTN0NTEuNSAtMTkzdDE0MCAtMTQwdDE5Mi41IC01MS41dDE5Mi41IDUxLjV0MTQwIDE0MHQ1MS41IDE5M3QtNTEuNSAxOTN0LTE0MCAxNDB0LTE5Mi41IDUxLjV6TTY2MCAyMTRoLTUwdjE3NWgtMTk2di0xNzVoLTUwdjM5NWg1MHYtMTc5aDE5NnYxNzloNTB2LTM5NXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibG9jayIgdW5pY29kZT0iJiN4ZTYxZDsiIApkPSJNNDI3IDE1MXEwIDM1IDI1IDYwdDYwIDI1dDYwIC0yNXQyNSAtNjBxMCAtNDcgLTM5IC03MnE5IC01MCAxOCAtMTEwcTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNWgtNjRxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNWwxOCAxMTBxLTM5IDI1IC0zOSA3MnpNMzQxIDM4NXYxNTBxMCA3MCA1MCAxMjB0MTIxIDUwdDEyMSAtNTB0NTAgLTEyMHYtMTUwaC0zNDJ6TTIzNSA1MzV2LTE1MGgtNjRxLTM2IDAgLTYxIC0yNXQtMjUgLTYwdi00MjcKcTAgLTM1IDI1IC02MHQ2MSAtMjVoNjgycTM2IDAgNjEgMjV0MjUgNjB2NDI3cTAgMzUgLTI1IDYwdC02MSAyNWgtNjR2MTUwcTAgMTE1IC04MSAxOTZ0LTE5NiA4MXQtMTk2IC04MXQtODEgLTE5NnYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJvZmYiIHVuaWNvZGU9IiYjeGU2MTM7IiAKZD0iTTcyOSA5MGgtNDM0cS0xMTYgMCAtMTk3LjUgODEuNXQtODEuNSAxOTYuNXYzMnEwIDExNSA4MS41IDE5Ni41dDE5Ny41IDgxLjVoNDM0cTExNiAwIDE5Ny41IC04MS41dDgxLjUgLTE5Ni41di0zMnEwIC0xMTUgLTgxLjUgLTE5Ni41dC0xOTcuNSAtODEuNXpNOTQ2IDQwMHEwIDkwIC02My41IDE1M3QtMTUzLjUgNjNoLTQzNHEtOTAgMCAtMTUzLjUgLTYzdC02My41IC0xNTN2LTMycTAgLTkwIDYzLjUgLTE1My41dDE1My41IC02My41aDQzNApxOTAgMCAxNTMuNSA2My41dDYzLjUgMTUzLjV2MzJ6TTMyMiAyMjNxLTY4IDAgLTExNiA0OC41dC00OCAxMTYuNXQ0OCAxMTZ0MTE2IDQ4dDExNiAtNDh0NDggLTExNnQtNDggLTExNi41dC0xMTYgLTQ4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im9uIiB1bmljb2RlPSImI3hlNjE0OyIgCmQ9Ik03MjkgOTBoLTQzNHEtMTE2IDAgLTE5Ny41IDgxLjV0LTgxLjUgMTk2LjV2MzJxMCAxMTUgODEuNSAxOTYuNXQxOTcuNSA4MS41aDQzNHExMTYgMCAxOTcuNSAtODEuNXQ4MS41IC0xOTYuNXYtMzJxMCAtMTE1IC04MS41IC0xOTYuNXQtMTk3LjUgLTgxLjV6TTk0NyAzOTlxMCA5MCAtNjMuNSAxNTMuNXQtMTUzLjUgNjMuNWgtNDM2cS04OSAwIC0xNTIuNSAtNjMuNXQtNjMuNSAtMTUzLjV2LTMxcTAgLTkwIDYzLjUgLTE1My41CnQxNTIuNSAtNjMuNWg0MzZxOTAgMCAxNTMuNSA2My41dDYzLjUgMTUzLjV2MzF2MHpNNzAyIDIyM3EtNjggMCAtMTE2IDQ4LjV0LTQ4IDExNi41dDQ4IDExNnQxMTYgNDh0MTE2LjUgLTQ4dDQ4LjUgLTExNnQtNDguNSAtMTE2LjV0LTExNi41IC00OC41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJzZWFyY2giIHVuaWNvZGU9IiYjeGU2MWM7IiAKZD0iTTk5NSAzbC0yNzIgMjI3cS0yIDIgLTYgNHEzNyA3OSAzNyAxNjBxMCA4MiAtMzQuNSAxNTh0LTk5LjUgMTMxcS0xMDUgODkgLTI0MyA4OXEtODIgMCAtMTU4IC0zNXQtMTMxIC0xMDBxLTg4IC0xMDUgLTg4IC0yNDNxMCAtODIgMzQuNSAtMTU4LjV0MTAwLjUgLTEzMS41cTEwNSAtODggMjQxIC04OGgxcTEyMSAwIDIyMSA3MnExIDAgMiAtMS41bDEgLTEuNWwyNzIgLTIyN3EyNyAtMjMgNjMgLTE4LjV0NTkgMzMuNWw2IDcKcTI0IDI4IDIyIDY0LjV0LTI4IDU4LjV6TTU4NSAyMTlxLTQwIC00NyAtOTQuNSAtNzJ0LTExMy41IC0yNXEtOTggMSAtMTc0IDY0cS00NyAzOSAtNzIgOTR0LTI1IDExNHEwIDk5IDY0IDE3NHEzOSA0OCA5My41IDcyLjV0MTEzLjUgMjQuNXE5OSAwIDE3NCAtNjNxNDcgLTQwIDcyIC05NC41dDI1IC0xMTMuNXEwIC05OSAtNjMgLTE3NXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZWRpdCIgdW5pY29kZT0iJiN4ZTYwOTsiIApkPSJNMzg0IDNsLTE2OSAxNjlxLTYgNSAtNiAxMy41dDYgMTQuNWwzODAgMzgwcTYgNiAxNCA2dDE0IC02bDE2OSAtMTY5cTYgLTYgNiAtMTR0LTYgLTE0bC0zODAgLTM4MHEtNiAtNiAtMTQuNSAtNnQtMTMuNSA2ek02OTMgNjc4cTE4IDE4IDQyLjUgMTh0NDIuNSAtMThsMTEyIC0xMTJxMTggLTE4IDE4IC00Mi41dC0xOCAtNDIuNWwtNTYgLTU2bC0xOTcgMTk3ek0xMTYgLTk2bDU2IDI1NGwxOTggLTE5OHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iaW5mbyIgdW5pY29kZT0iJiN4ZTYwMTsiIApkPSJNNTEyIC0yMHEtMTEwIDAgLTIwMyA1NHQtMTQ3IDE0N3QtNTQgMjAzdDU0IDIwM3QxNDcgMTQ3dDIwMyA1NHQyMDMgLTU0dDE0NyAtMTQ3dDU0IC0yMDN0LTU0IC0yMDN0LTE0NyAtMTQ3dC0yMDMgLTU0ek01NjcgNjA1cTAgNyAtNS41IDEyLjV0LTEyLjUgNS41aC03NHEtNyAwIC0xMi41IC01LjV0LTUuNSAtMTIuNXYtNzRxMCAtOCA1LjUgLTEzdDEyLjUgLTVoNzRxNyAwIDEyLjUgNXQ1LjUgMTN2NzR6TTU2NyA0MDJxMCA4IC01LjUgMTMuNQp0LTEyLjUgNS41aC03NHEtNyAwIC0xMi41IC01LjV0LTUuNSAtMTMuNXYtMjM5cTAgLTcgNS41IC0xMi41dDEyLjUgLTUuNWg3NHE3IDAgMTIuNSA1LjV0NS41IDEyLjV2MjM5eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJhZGQtcyIgdW5pY29kZT0iJiN4ZTYxMjsiIApkPSJNNjk5IDM1OGgtMTU3di0xNThxMCAtMTAgLTcuNSAtMTh0LTE4LjUgLTh0LTE5IDh0LTggMTh2MTU4aC0xNTdxLTExIDAgLTE4LjUgNy41dC03LjUgMTguNXQ3LjUgMTguNXQxOC41IDcuNWgxNTd2MTU3cTAgMTEgOCAxOC41dDE5IDcuNXQxOC41IC03LjV0Ny41IC0xOC41di0xNTdoMTU3cTExIDAgMTguNSAtNy41dDcuNSAtMTguNXQtNy41IC0xOC41dC0xOC41IC03LjV2MHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibW9yZSIgdW5pY29kZT0iJiN4ZTYwMjsiIApkPSJNMTc0LjUgNTAxcS00MS41IDAgLTcxIC0yOS41dC0yOS41IC03MS41dDI5LjUgLTcxLjV0NzEgLTI5LjV0NzEuNSAyOS41dDMwIDcxLjV0LTMwIDcxLjV0LTcxLjUgMjkuNXpNNTExIDUwMXEtNDIgMCAtNzEuNSAtMjkuNXQtMjkuNSAtNzEuNXQyOS41IC03MS41dDcxLjUgLTI5LjV0NzEuNSAyOS41dDI5LjUgNzEuNXQtMjkuNSA3MS41dC03MS41IDI5LjV6TTg0OCA1MDFxLTQyIDAgLTcxLjUgLTI5LjV0LTI5LjUgLTcxLjV0MjkuNSAtNzEuNQp0NzEuNSAtMjkuNXQ3MS41IDI5LjV0MjkuNSA3MS41dC0yOS41IDcxLjV0LTcxLjUgMjkuNXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZ3JpZCIgdW5pY29kZT0iJiN4ZTYwMzsiIApkPSJNNjAxIDgzMGgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMiA5IC0yMXQyMSAtOWgxNzlxMTIgMCAyMSA5dDkgMjF2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTkyOSA4MzBoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTIgOSAtMjF0MjEgLTloMTc5cTEyIDAgMjEgOXQ5IDIxdjE3OXEwIDEyIC05IDIxdC0yMSA5ek0yNzMgODMwaC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEyIDkgLTIxdDIxIC05CmgxNzlxMTIgMCAyMSA5dDkgMjF2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTYwMSA1MDJoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTMgOSAtMjEuNXQyMSAtOC41aDE3OXExMiAwIDIxIDguNXQ5IDIxLjV2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTkyOSA1MDJoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTMgOSAtMjEuNXQyMSAtOC41aDE3OXExMiAwIDIxIDguNXQ5IDIxLjV2MTc5cTAgMTIgLTkgMjF0LTIxIDl6Ck0yNzMgNTAyaC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEzIDkgLTIxLjV0MjEgLTguNWgxNzlxMTIgMCAyMSA4LjV0OSAyMS41djE3OXEwIDEyIC05IDIxdC0yMSA5ek02MDEgMTc0aC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEzIDkgLTIxLjV0MjEgLTguNWgxNzlxMTIgMCAyMSA4LjV0OSAyMS41djE3OXEwIDEyIC05IDIxdC0yMSA5ek05MjkgMTc0aC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5CnEwIC0xMyA5IC0yMS41dDIxIC04LjVoMTc5cTEyIDAgMjEgOC41dDkgMjEuNXYxNzlxMCAxMiAtOSAyMXQtMjEgOXpNMjczIDE3NGgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMyA5IC0yMS41dDIxIC04LjVoMTc5cTEyIDAgMjEgOC41dDkgMjEuNXYxNzlxMCAxMiAtOSAyMXQtMjEgOXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibW92ZWRvd24iIHVuaWNvZGU9IiYjeGU2MGE7IiAKZD0iTTc2OCAxMDh2Mzg0aC02NHYtMzg0aC0xNjBsMTkyIC0xOTJsMTkyIDE5MmgtMTYwek0zMjAgNTU2di0xOTJoLTE5MnYxOTJoMTkyek0zODQgNjIwaC0zMjB2LTMyMGgzMjB2MzIwek02NCAxNzJoOTZ2LTY0aC05NnY2NHpNMTkyIDE3Mmg5NnYtNjRoLTk2djY0ek0zMjAgMTcyaDY0di05NmgtNjR2OTZ6TTY0IC01Mmg2NHYtOTZoLTY0djk2ek0xNjAgLTg0aDk2di02NGgtOTZ2NjR6TTI4OCAtODRoOTZ2LTY0aC05NnY2NHpNNjQgNzZoNjQKdi05NmgtNjR2OTZ6TTMyMCA0NGg2NHYtOTZoLTY0djk2eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJtb3ZldXAiIHVuaWNvZGU9IiYjeGU2MGI7IiAKZD0iTTcwNCAzMDB2LTM4NGg2NHYzODRoMTYwbC0xOTIgMTkybC0xOTIgLTE5MmgxNjB6TTY0IDYyMGg5NnYtNjRoLTk2djY0ek0xOTIgNjIwaDk2di02NGgtOTZ2NjR6TTMyMCA2MjBoNjR2LTk2aC02NHY5NnpNNjQgMzk2aDY0di05NmgtNjR2OTZ6TTE2MCAzNjRoOTZ2LTY0aC05NnY2NHpNMjg4IDM2NGg5NnYtNjRoLTk2djY0ek02NCA1MjRoNjR2LTk2aC02NHY5NnpNMzIwIDQ5Mmg2NHYtOTZoLTY0djk2ek0zMjAgMTA4di0xOTJoLTE5MnYxOTIKaDE5MnpNMzg0IDE3MmgtMzIwdi0zMjBoMzIwdjMyMHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iYWRkIiB1bmljb2RlPSImI3hlNjBjOyIgCmQ9Ik01MTIgLTQxcS0xMTUgMCAtMjEzIDU3dC0xNTUgMTU1dC01NyAyMTN0NTcgMjEzdDE1NSAxNTV0MjEzIDU3dDIxMyAtNTd0MTU1IC0xNTV0NTcgLTIxM3QtNTcgLTIxM3QtMTU1IC0xNTV0LTIxMyAtNTd6TTcyNCA0MjZoLTE3MHYxNzBoLTg0di0xNzBoLTE3MHYtODRoMTcwdi0xNzBoODR2MTcwaDE3MHY4NHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZm9sZGVyIiB1bmljb2RlPSImI3hlNjE4OyIgCmQ9Ik05NjEgNjQwcTAgNDAgLTI4LjUgNjh0LTY3LjUgMjhoLTE4NmgtMWgtMXEtNiAtMSAtMTAgLTJsLTEgLTFoLTFxLTUgLTMgLTggLTZxLTE4IC0xNyAtMzUgLTg4cS0zIC0xMiAtNCAtMTRxLTQgLTE3IC0yNyAtMTdoLTcuNWgtNy41aC00MTZxLTQwIDAgLTY4IC0yOC41dC0yOCAtNjkuNWwzMiAtNDE0cTAgLTQwIDI4IC02OHQ2OCAtMjhoNjQwcTQwIDAgNjggMjh0MjggNjZ6TTg2NCA5NnEwIC0xMyAtOS41IC0yMi41dC0yMi41IC05LjUKaC02NDBxLTEzIDAgLTIyLjUgMTB0LTkuNSAyNGwtMzIgNDE0cTAgMTMgOS41IDIyLjV0MjIuNSA5LjVoNDE2aDcuNWg3LjVxMzUgMCA1OC41IDE3dDMwLjUgNDhxMiA0IDQgMTVxOCAzNCAxMyA0OGgxNjhxMTMgMCAyMi41IC05LjV0OS41IC0yMi41di0ydi0xek0xMjggNjcyaDQxNnExMyAwIDIyLjUgOS41dDkuNSAyMi41dC05LjUgMjIuNXQtMjIuNSA5LjVoLTQxNnEtMTMgMCAtMjIuNSAtOS41dC05LjUgLTIyLjV0OS41IC0yMi41CnQyMi41IC05LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Imdyb3VwIiB1bmljb2RlPSImI3hlNjE5OyIgCmQ9Ik01MjEgMTk0bC0zNzYgMjQ3bC01MCAtNTJsNDI2IC0yOTFsNDI2IDI5MWwtNTEgNTN6TTk0NyA1NTBsLTQyNiAyOTFsLTQyNiAtMjkxbDQyNiAtMjkxek01MjEgNzU2bDMwMiAtMjA2bC0zMDIgLTIwN2wtMzAyIDIwN3pNNTIxIDMzbC0zNzYgMjQ4bC01MCAtNTJsNDI2IC0yOTFsNDI2IDI5MWwtNTEgNTN6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImxvY2syIiB1bmljb2RlPSImI3hlNjFlOyIgCmQ9Ik03NjkgNDQ4djEzNXYwcS0zIDEwNCAtNzcuNSAxNzYuNXQtMTc4LjUgNzIuNXQtMTc4LjUgLTcyLjV0LTc3LjUgLTE3NS41djB2LTEzNmgtMXEtMjcgMCAtNDUuNSAtMTguNXQtMTguNSAtNDUuNXYtMzg0cTAgLTI3IDE4LjUgLTQ1LjV0NDUuNSAtMTguNWg1MTJxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djM4NHEwIDI2IC0xOC41IDQ1dC00NC41IDE5ek0zMjEgNTgxdjBxMiA3OCA1OCAxMzIuNXQxMzQgNTQuNXQxMzQgLTU0LjUKdDU4IC0xMzIuNXYwdi0xMzNoLTM4NHYxMzN6TTc2OCAzMnEwIC0xMyAtOS41IC0yMi41dC0yMi41IC05LjVoLTQ0OHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41djMyMHEwIDEzIDkuNSAyMi41dDIyLjUgOS41aDQ0OHExMyAwIDIyLjUgLTkuNXQ5LjUgLTIyLjV2LTMyMHpNNTQ0IDIwNnY1MnEwIDEzIC05LjUgMjIuNXQtMjIuNSA5LjV0LTIyLjUgLTkuNXQtOS41IC0yMi41di01MnEtMjggLTE4IC0yOCAtNTFxMCAtMjUgMTcuNSAtNDIuNQp0NDIuNSAtMTcuNXQ0Mi41IDE3LjV0MTcuNSA0Mi41cTAgMzMgLTI4IDUxeiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJmaWxlcyIgdW5pY29kZT0iJiN4ZTYxZjsiIApkPSJNNzQ0IDQzNGgtMjYwcS0xMiAwIC0yMC41IC04LjV0LTguNSAtMjAuNXQ4LjUgLTIwLjV0MjAuNSAtOC41aDI2MHExMiAwIDIwLjUgOC41dDguNSAyMC41dC04LjUgMjAuNXQtMjAuNSA4LjV6TTc0NCAyOTBoLTI2MHEtMTIgMCAtMjAuNSAtOC41dC04LjUgLTIwLjV0OC41IC0yMC41dDIwLjUgLTguNWgyNjBxMTIgMCAyMC41IDguNXQ4LjUgMjAuNXQtOC41IDIwLjV0LTIwLjUgOC41ek03NDQgODM5aC0zNDdxLTQ1IDAgLTgwIC0zNS41CnQtMzUgLTgwLjVoLTM0cS00NSAwIC03OCAtMzV0LTMzIC04MHYtNTc4cTAgLTQ1IDM1IC04MC41dDgxIC0zNS41aDQzM3E0NiAwIDgxIDM1LjV0MzUgODAuNWgyOXE0NiAwIDgxIDM1LjV0MzUgNzkuNXY0MDV2NTd6TTY4NiAtMjhoLTQzM3EtMjMgMCAtNDAuNSAxOHQtMTcuNSA0MHY1NzhxMCAyMiAxNi41IDM5LjV0MzguNSAxNy41bDMyIDF2LTUyMXEwIC00NCAzNSAtNzkuNXQ4MCAtMzUuNWgzNDdxMCAtMjIgLTE3LjUgLTQwdC00MC41IC0xOHYwCnpNODg5IDE0NXEwIC0yMiAtMTcuNSAtMzkuNXQtNDAuNSAtMTcuNWgtNDM0cS0yMiAwIC0zOS41IDE3LjV0LTE3LjUgMzkuNXY1NzhxMCAyMyAxNy41IDQwLjV0MzkuNSAxNy41aDI4OXYtMTE2cTAgLTQ1IDM1IC04MHQ4MSAtMzVoODd2LTQwNXpNODAyIDYwOHEtMjEgMCAtMzkuNSAzMC41dC0xOC41IDU1LjV2ODZ2MGwxNDUgLTE3MmgtODd6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InRpbWVzY2lyY2xlIiB1bmljb2RlPSImI3hlNjBlOyIgCmQ9Ik02NTcgMTcxcTAgMTUgLTExIDI2bC0xMDQgMTAzbDEwNCAxMDNxMTEgMTEgMTEgMjZxMCAxNiAtMTEgMjZsLTUyIDUycS0xMSAxMSAtMjYgMTF0LTI2IC0xMWwtMTAzIC0xMDRsLTEwNCAxMDRxLTEwIDExIC0yNSAxMXEtMTYgMCAtMjcgLTExbC01MSAtNTJxLTExIC0xMCAtMTEgLTI2cTAgLTE1IDExIC0yNmwxMDMgLTEwM2wtMTAzIC0xMDNxLTExIC0xMSAtMTEgLTI2cTAgLTE2IDExIC0yNmw1MSAtNTJxMTEgLTExIDI3IC0xMQpxMTUgMCAyNSAxMWwxMDQgMTA0bDEwMyAtMTA0cTExIC0xMSAyNiAtMTF0MjYgMTFsNTIgNTJxMTEgMTAgMTEgMjZ6TTg3OCAzMDBxMCAtMTE5IC01OSAtMjIwdC0xNjAgLTE2MHQtMjIwLjUgLTU5dC0yMjAgNTl0LTE1OS41IDE2MHQtNTkgMjIwdDU5IDIyMHQxNTkuNSAxNjB0MjIwIDU5dDIyMC41IC01OXQxNjAgLTE2MHQ1OSAtMjIweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJlYXJ0aCIgdW5pY29kZT0iJiN4ZTYxYTsiIApkPSJNODc0IDY2MnEtNzMgNzMgLTE2NiAxMTEuNXQtMTk2IDM4LjV0LTE5NiAtMzguNXQtMTY2IC0xMTEuNXQtMTExLjUgLTE2NnQtMzguNSAtMTk2dDM4LjUgLTE5NnQxMTEuNSAtMTY2dDE2NiAtMTExLjV0MTk2IC0zOC41dDE5NiAzOC41dDE2NiAxMTEuNXQxMTEuNSAxNjZ0MzguNSAxOTZ0LTM4LjUgMTk2dC0xMTEuNSAxNjZ6TTk0MiA0NjZxLTcgMTIgLTIyIDE5LjV0LTQ2IDE4LjVxLTE2IDUgLTI4LjUgMjB0LTE4LjUgMjguNXQtMTUgNDEuNQpxLTggMjQgLTEzLjUgMzd0LTE3IDMxdC0yNS41IDI5cTEzMCAtODIgMTg2IC0yMjV6TTc5OCAyOTBxMiAtMTkgMi41IC0zNS41dC04LjUgLTM4LjV0LTI5IC00NXEtMTIgLTEzIC0yNiAtNTBxLTggLTIyIC0xMy41IC0zMy41dC0xNi41IC0yNnQtMjggLTIxdC00MSAtNi41cS03IDggLTEyIDM3cS00IDI0IC0xMCA5MHEtOCAxMTEgLTIxIDE2MHEtMjUgOTIgLTg0IDExMnEtMjYgOSAtNTUgOXEtMTQgMCAtMzkgLTNxLTE3IC0yIC0yNCAtMnYwCnEtOCAwIC0xMyAxLjV0LTEzIDEwLjV0LTE2IDI2cS0xMSAzMCAtMTAgNjMuNXQyMC41IDY5dDUzLjUgNTcuNXE1NSAzNyA4OSAzN3EyNyAwIDY5IC0yM3EzOSAtMjAgODEgLTIwcTggMCAyMiAxaDE2cTE4IDAgMzEgLTl0MjEuNSAtMjZ0MTkuNSAtNDhxOCAtMjQgMTMuNSAtMzcuNXQxNi41IC0zM3QyNyAtMzJ0MzcgLTE5LjVxMjIgLTggMzEgLTExcS05IC05IC0zNiAtMzRxLTIxIC0xOCAtMzAgLTI3cS0yMSAtMTkgLTI1LjUgLTQ2dDAuNSAtNDcKdjB6TTUxIDMwNHE4IC0xIDE4IC0zcTM0IC04IDQ4IC0xNXEtMyAtNiAtMTIgLTE4cS0yOCAtNDEgLTIyIC02NXE1IC0yMiAtNiAtNTZxLTI2IDc0IC0yNiAxNTN2MnYydjB6TTUxMiAtMTYxcS0xMjkgMCAtMjM4IDY2LjV0LTE2OCAxNzYuNXE0MCA3NiAyNyAxMzJxMCA1IDE0IDI0cTYgOCA5IDEyLjV0NyAxM3Q1LjUgMTQuNXQxIDE0LjV0LTQuNSAxNS41cS0xMiAyNiAtODAgNDFxLTEzIDMgLTMxIDZxMTQgMTEzIDc4IDIwNnQxNjQgMTQ2LjUKdDIxNiA1My41cTExOSAwIDIyMyAtNThxLTE5IDggLTQzIDhoLTE5cS0xMyAtMSAtMTkgLTFxLTI5IDAgLTU3IDE1cS01MyAyOCAtOTMgMjhxLTQ5IDAgLTExNyAtNDVxLTY0IC00MiAtODggLTExN3EtMjMgLTczIDUgLTEzNnEzMCAtNjkgODkgLTY5djBxMTAgMCAzMCAycTIyIDMgMzMgM3EyMCAwIDM4IC02cTM0IC0xMSA1MSAtNzdxMTIgLTQ0IDIwIC0xNTFxNiAtODAgMTMgLTExMHE2IC0yNiAxNyAtNDFxMTYgLTI0IDQxIC0yNApxNjggMCAxMDggNDRxMjEgMjQgNDEgNzdxMTEgMjggMTYgMzRxMjcgMzAgMzkuNSA2MS41dDExIDUzLjV0LTIuNSA0NHEtMyAyMSAtMS41IDMxLjV0OS41IDE4LjVxMTMgMTEgMzAgMjZxMzIgMjkgNDEgMzlxMjIgMjQgMTggNDR2MXEyNyAtNzUgMjcgLTE1NnEwIC05NCAtMzYuNSAtMTc5dC05OC41IC0xNDd0LTE0Ny41IC05OC41dC0xNzguNSAtMzYuNXYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJtb3ZlIiB1bmljb2RlPSImI3hlNjBmOyIgCmQ9Ik0xMDA4IDMzMGwtMTU2IDE1NXEtMTQgMTQgLTMzLjUgMTR0LTMzIC0xMy41dC0xMy41IC0zM3QxNCAtMzMuNWw3NiAtNzZoLTMwM3YzMDlsNzYgLTc1cTE0IC0xNCAzMy41IC0xNHQzMyAxMy41dDEzLjUgMzN0LTE0IDMzLjVsLTE1NSAxNTVxLTE0IDE0IC0zMy41IDE0dC0zMi41IC0xNGwtMTU2IC0xNTVxLTE0IC0xNCAtMTQgLTMzLjV0MTMuNSAtMzN0MzMgLTEzLjV0MzMuNSAxM2w3NiA3NnYtMzA5aC0zMDRsNzYgNzYKcTE0IDE0IDE0IDMzLjV0LTEzLjUgMzN0LTMzIDEzLjV0LTMzLjUgLTE0bC0xNTYgLTE1NXEtMTMgLTE0IC0xMyAtMzMuNXQxMyAtMzIuNWwxNTYgLTE1NnExNCAtMTQgMzMuNSAtMTR0MzMgMTR0MTMuNSAzM3QtMTQgMzNsLTc2IDc2aDMwNHYtMzAzbC03NiA3NnEtMTQgMTQgLTMzLjUgMTR0LTMzIC0xMy41dC0xMy41IC0zM3QxNCAtMzMuNWwxNTUgLTE1NXExNCAtMTQgMzMuNSAtMTR0MzMuNSAxNGwxNTUgMTU1cTE0IDE0IDE0IDMzLjUKdC0xMy41IDMzdC0zMyAxMy41dC0zMy41IC0xNGwtNzYgLTc1djMwMmgzMDNsLTc2IC03NnEtMTQgLTE0IC0xNCAtMzN0MTMuNSAtMzN0MzMgLTE0dDMzLjUgMTRsMTU2IDE1NnExMyAxMyAxMyAzMi41dC0xMyAzMy41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJkZWxldGUiIHVuaWNvZGU9IiYjeGU2MTA7IiAKZD0iTTkyNCA1NzNoLTE1NHYxMDVxMCAyOSAtMjAuNSA0OS41dC00OS41IDIwLjVoLTM3NnEtMjkgMCAtNDkuNSAtMjAuNXQtMjAuNSAtNDkuNXYtMTA1aC0xNTVxLTE0IDAgLTI0IC0xMHQtMTAgLTI0LjV0MTAgLTI0LjV0MjQgLTEwaDc5di01ODFxMCAtMjkgMjAuNSAtNDkuNXQ0OS41IC0yMC41aDUyOHEyOSAwIDQ5LjUgMjAuNXQyMC41IDQ5LjV2NTU4djB2MjNoNzhxMTUgMCAyNSAxMHQxMCAyNC41dC0xMCAyNC41dC0yNSAxMHoKTTQxMi41IC0xMHEtMTQuNSAwIC0yNC41IDEwdC0xMCAyNWwtMSAzNzJxMCAxNSAxMC41IDI1dDI1IDEwdDI0LjUgLTEwdDEwIC0yNXYtMzcycTAgLTE1IC0xMCAtMjV0LTI0LjUgLTEwek02MTEuNSAtMTBxLTE0LjUgMCAtMjQuNSAxMHQtMTAgMjV2MzcycTAgMTUgMTAgMjV0MjQuNSAxMHQyNC41IC0xMHQxMCAtMjVsMSAtMzcycTAgLTE1IC0xMC41IC0yNXQtMjUgLTEwek0zMjMgNjM1cTAgMTcgMTMgMzB0MzEgMTNoMjkwcTE4IDAgMzEgLTEzCnQxMyAtMzB2LTYyaC0zNzh2NjJ6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InJlZnJlc2giIHVuaWNvZGU9IiYjeGU2M2E7IiAKZD0iTTY3NiA2MXEtNzUgLTU0IC0xNjcgLTUycS0xMiAwIC0yNCAxcS0yIDAgLTUgMC41dC00IDAuNXEtMTMgMiAtMTggM3EtMSAwIC0xMSAycS0xMSAzIC0xNyA1cS0yIDAgLTUgMXQtNCAycS0xMiA0IC0xOSA3cS0xIDAgLTQgMnEtMTMgNiAtMjIgMTFoLTF2MHEtMzYgMjAgLTY1IDUwbC0xIDFxLTggOSAtMTcgMTlxLTEgMSAtMiAyLjVsLTEgMS41cS02MyA4MCAtNjMgMTgyaDY2cTMgMCA0LjUgMi41dC0wLjUgNS41bC0xMTEgMTcwCnEtMiAyIC00LjUgMnQtMy41IC0ybC0xMTIgLTE3MHEtMSAtMyAwIC01LjV0NCAtMi41aDY3cTAgLTExOSA2NiAtMjE3cTAgLTEgMC41IC0ydDEuNSAtMXEzIC01IDE0IC0xOHE0IC02IDUgLTdxOCAtMTAgMjEgLTI0cTEgMCAxLjUgLTFsMC41IC0xcTM4IC0zOSA4NSAtNjVxMiAtMSAyIC0ycTEyIC02IDI4IC0xM3ExIC0xIDMuNSAtMnQzLjUgLTFxMTAgLTQgMjQgLTlxMTAgLTQgMTIgLTRxOCAtMyAyMiAtNnExMSAtMyAxNSAtMwpxMCAtMSAyIC0xLjV0NCAtMC41cTQgMCAyMSAtM3ExIDAgMy41IC0wLjV0My41IC0wLjVxMjEgLTIgMzggLTJxMTE3IDAgMjE1IDcwcTE1IDExIDE4LjUgMjkuNXQtNy41IDM0LjV0LTI5LjUgMTl0LTMzLjUgLTh6TTg4OCAzMDBxMCAxMTkgLTY2IDIxN2wtMC41IDEuNXQtMS41IDEuNXEtNSA3IC0xNiAyMmwtMSAxbC0xIDFxLTU4IDcyIC0xNDEgMTA4bC0xLjUgMXQtMi41IDFxLTExIDUgLTI2IDEwcS0xIDAgLTQuNSAxLjV0LTUuNSAxLjUKcS04IDMgLTI0IDZxLTEgMSAtNS41IDJ0LTcuNSAxcS0xIDEgLTMgMS41dC00IDAuNXQtNSAwLjV0LTYuNSAxdC01LjUgMC41dC02IDF0LTcgMXEtMTMgMSAtMzAgMWwtMiAwLjV0LTMgMC41aC0wLjVoLTAuNXEtMTE4IDAgLTIxNSAtNzBxLTE1IC0xMSAtMTguNSAtMjkuNXQ3LjUgLTM0dDI5LjUgLTE5dDMzLjUgNy41cTc1IDUzIDE2NiA1M3ExMyAtMSAyNSAtMnEyIDAgNC41IC0wLjV0My41IC0wLjVxMTEgLTEgMjAgLTNxMiAwIDkgLTIKcTExIC0zIDE5IC01cTEgMCAzIC0xdDMgLTFxMTIgLTQgMjIgLThsMC41IC0wLjV0MS41IC0wLjVxNjMgLTI4IDEwOCAtODJ2LTF2MHE2NSAtODEgNjUgLTE4NWgtNjZxLTMgMCAtNC41IC0yLjV0MC41IC00LjVsMTExIC0xNzFxMiAtMiA0LjUgLTJ0My41IDJsMTEyIDE3MXExIDIgMCA0LjV0LTQgMi41aC02N3YwdjB2MHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZG9jIiB1bmljb2RlPSImI3hlNjA2OyIgaG9yaXotYWR2LXg9IjEyODEiIApkPSJNMTI4MCA0MjJ6TTQ5MiAtN3EyIC0xIDMuNSAtMnQ1LjUgLTUuNXQ1LjUgLTkuNXQtMS41IC0xMS41dC0xMiAtMTMuNWgtMTUxcS00IDAgLTEwLjUgMS41dC0yNC41IDkuNXQtMzIgMjAuNXQtMjYuNSAzOHQtMTUuNSA1OC41djM5N3YwcTAgNCAxIDEydDcuNSAyOC41dDE3IDM3dDMyIDMydDQ5LjUgMTkuNWgzNDFxNCAwIDEwLjUgLTEuNXQyNCAtMTAuNXQzMS41IC0yMnQyNi41IC00MHQxNC41IC02MnYtMTAydi0xNjB0MCAtNzUKcS0xIC00IC0yLjUgLTExLjV0LTExLjUgLTI5LjV0LTI0LjUgLTQzdC00MyAtNDh0LTY1LjUgLTQ5aC0yaC01aC03aC04LjVoLTcuNWgtNWgtMnEtMTUgNCAtMTUuNSAyNC41dDAuNSA4Ni41djBxMCAzIDEgOHQ2IDE4LjV0MTIuNSAyNC41dDIzLjUgMjEuNXQzNiAxNC41aDgxdjMyNnEwIDMgLTEgOC41dC01LjUgMjB0LTExLjUgMjUuNXQtMjEgMjEuNXQtMzIgMTIuNWgtMzMycS0zIDAgLTcuNSAtMXQtMTYuNSAtNnQtMjEgLTEzLjUKdC0xNy41IC0yNy41dC0xMC41IC00NHEtMSAtMjAzIC0xIC0zODZxMSAtMyAxLjUgLTl0NSAtMjF0MTEuNSAtMjYuNXQyMS41IC0yMi41dDM0LjUgLTEzaDE0NnpNNzM2IDEwNmgtNzBxLTQgLTEgLTkuNSAtMy41dC0xNi41IC0xNS41dC0xMiAtMzB2LTE2di0zMS41di0xNS41bDggLTFxNSAwIDM0IDI5cTM3IDM3IDY2IDg0ek02NTEgNDMwcTAgLTEwIC03LjUgLTE3LjV0LTE3LjUgLTcuNWgtMjIxcS0xMCAwIC0xNy41IDcuNXQtNy41IDE3LjV2MApxMCAxMSA3LjUgMTguNXQxNy41IDcuNWgyMjFxMTAgMCAxNy41IC03LjV0Ny41IC0xOC41djB6TTY1MiAyODJxMCAtMTEgLTcuNSAtMTguNXQtMTguNSAtNy41aC0yMjBxLTExIDAgLTE4LjUgNy41dC03LjUgMTguNXYwcTAgMTEgNy41IDE4LjV0MTguNSA3LjVoMjIwcTExIDAgMTguNSAtNy41dDcuNSAtMTguNXYwek01MjQgMTMzcTAgLTExIC03LjUgLTE5dC0xOC41IC04aC05MXEtMTEgMCAtMTkgOHQtOCAxOXYwcTAgMTEgOCAxOXQxOSA4aDkxCnExMSAwIDE4LjUgLTh0Ny41IC0xOXYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJsaW5lIiB1bmljb2RlPSImI3hlNjExOyIgCmQ9Ik05NjAgNTUycTAgLTE3IC0xMiAtMjkuNXQtMzAgLTEyLjVoLTgxMnEtMTggMCAtMzAgMTIuNXQtMTIgMjkuNXYwcTAgMTggMTIgMzB0MzAgMTJoODEycTE4IDAgMzAgLTEydDEyIC0zMHYwek05NjAgMzAwcTAgLTE3IC0xMiAtMjkuNXQtMzAgLTEyLjVoLTgxMnEtMTggMCAtMzAgMTIuNXQtMTIgMjkuNXYwcTAgMTcgMTIgMjkuNXQzMCAxMi41aDgxMnExOCAwIDMwIC0xMi41dDEyIC0yOS41djB6TTk2MCA0OHEwIC0xOCAtMTIgLTMwCnQtMzAgLTEyaC04MTJxLTE4IDAgLTMwIDEydC0xMiAzMHYwcTAgMTcgMTIgMjkuNXQzMCAxMi41aDgxMnExOCAwIDMwIC0xMi41dDEyIC0yOS41djB6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImZpbGUtYm94IiB1bmljb2RlPSImI3hlNjFiOyIgCmQ9Ik04MDQgNzcwbDUwIC00MzFsLTU3IC03bC00NSAzODZoLTQ4MGwtNDUgLTM4NmwtNTcgN2w1MCA0MzFoNTg0ek0zMTkgNjc0aDM4NnYtNDhoLTM4NnY0OHpNMzE5IDU3N2gzODZ2LTQ4aC0zODZ2NDh6TTMxOSA0ODFoMzg2di00OWgtMzg2djQ5ek0zMTkgMzg0aDM4NnYtNDhoLTM4NnY0OHpNODc0IDI4N2gtNzI0cS0xMCAwIC0xNSAtNi41dC0yIC0xNS41bDgyIC0yNDRxMyAtMTAgMTIgLTE2LjV0MTkgLTYuNWg1MzJxMTAgMCAxOSA2LjUKdDEyIDE2LjVsODIgMjQ0cTMgOSAtMiAxNS41dC0xNSA2LjV6TTYwOSAxOTFoLTE5NHY0OGgxOTR2LTQ4eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJzd2l0Y2hvbiIgdW5pY29kZT0iJiN4ZTYxNTsiIApkPSJNODMyIDg5NmgtNjQwcS04MCAwIC0xMzYgLTU2dC01NiAtMTM2di02NDBxMCAtNzkgNTYgLTEzNS41dDEzNiAtNTYuNWg2NDBxNzkgMCAxMzUuNSA1Ni41dDU2LjUgMTM1LjV2NjQwcTAgODAgLTU2LjUgMTM2dC0xMzUuNSA1NnpNMTYwIDBxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNMTYwIDcwNHEtMTMgMCAtMjIuNSA5LjUKdC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNzA0IDY0cTAgLTI3IC0xOC41IC00NS41dC00NS41IC0xOC41aC0yNTZxLTI3IDAgLTQ1LjUgMTguNXQtMTguNSA0NS41djY0MHEwIDI2IDE5IDQ1dDQ1IDE5aDI1NnEyNyAwIDQ1LjUgLTE4LjV0MTguNSAtNDUuNXYtNjQwek04NjQgMHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41dDkuNSAyMi41dDIyLjUgOS41CnQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNODY0IDcwNHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41dDkuNSAyMi41dDIyLjUgOS41dDIyLjUgLTkuNXQ5LjUgLTIyLjV0LTkuNSAtMjIuNXQtMjIuNSAtOS41ek01NzYgNzA0aC0xMjhxLTI2IDAgLTQ1IC0xOXQtMTkgLTQ1di0xOTJxMCAtMjYgMTkgLTQ1dDQ1IC0xOWgxMjhxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djE5MnEwIDI3IC0xOC41IDQ1LjUKdC00NS41IDE4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InN5c3NlcnZlciIgdW5pY29kZT0iJiN4ZTYwNTsiIApkPSJNNTE1IDE0NXEtMzYgMCAtNzEgLTEydC02NCAtNDF0LTM2IC02OWgzMzhxLTUgNTMgLTU3IDg3LjV0LTExMCAzNC41ek05NTUgMTU3cS0zIDI2NSAwIDUyOHEwIDM0IC0xMi41IDQ3dC00Ni41IDEzcS00NSAtMSAtMzg0IC0xdjBxLTMzOSAwIC0zOTAgMXEtMjggMCAtNDAuNSAtMTF0LTEyLjUgLTM5cTEgLTIzMSAwIC01NDRxMCAtMjggMTEuNSAtNDAuNXQzOS41IC0xMS41cTM1IDEgMTA3IDAuNXQxMDcgMC41cTI1IDEgNDggMTcKcTU2IDQwIDExNS41IDQ1dDExNi41IC0yOHE2MyAtMzcgMTUwIC0zNXE5NCAyIDEzMiAwcTMzIC0yIDQ2IDExdDEzIDQ3ek04OTIgMjEzaC03NjB2NDU2aDc2MHYtNDU2eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJmaWxlIiB1bmljb2RlPSImI3hlNzdkOyIgCmQ9Ik02NDUgODA5aC0zNzJxLTQ0IDAgLTc1IC0zMXQtMzEgLTc1di02MzhxMCAtNDQgMzEgLTc1dDc1IC0zMWg0NzhxNDQgMCA3NSAzMXQzMSA3NXY1MzJ6TTY0MyA3MjZsMTI3IC0xMjdoLTEwNHEtOSAwIC0xNiA2LjV0LTcgMTYuNXYxMDR6TTc1MSAxOWgtNDc4cS0xOSAwIC0zMi41IDEzLjV0LTEzLjUgMzIuNXY2MzhxMCAxOSAxMy41IDMyLjV0MzIuNSAxMy41aDMxMHYtMTI3cTAgLTM0IDI0LjUgLTU4LjV0NTguNSAtMjQuNWgxMzF2LTQ3NApxMCAtMTkgLTEzLjUgLTMyLjV0LTMyLjUgLTEzLjV6TTY4MiAzODhoLTM0MHEtMTIgMCAtMjEgLTl0LTkgLTIxLjV0OSAtMjF0MjEgLTguNWgzNDBxMTIgMCAyMSA4LjV0OSAyMXQtOSAyMS41dC0yMSA5ek02ODIgMjMyaC0zNDBxLTEyIDAgLTIxIC05dC05IC0yMS41dDkgLTIxdDIxIC04LjVoMzQwcTEyIDAgMjEgOC41dDkgMjF0LTkgMjEuNXQtMjEgOXoiIC8+CiAgPC9mb250Pgo8L2RlZnM+PC9zdmc+Cg=="
  30984. /***/ }),
  30985. /* 240 */
  30986. /***/ (function(module, exports) {
  30987. module.exports = "data:application/x-font-ttf;base64,AAEAAAAQAQAABAAARkZUTXZHMeAAAAEMAAAAHEdERUYAUgAGAAABKAAAACBPUy8yV6halgAAAUgAAABWY21hcL2Ds2kAAAGgAAABqGN2dCANZf5MAAA0OAAAACRmcGdtMPeelQAANFwAAAmWZ2FzcAAAABAAADQwAAAACGdseWZJFyqxAAADSAAALDRoZWFkDijSuQAAL3wAAAA2aGhlYQjeBE8AAC+0AAAAJGhtdHh/CAn8AAAv2AAAAIxsb2Nho5yvDgAAMGQAAABMbWF4cAIkCrwAADCwAAAAIG5hbWUckFeqAAAw0AAAAihwb3N0xwSeMQAAMvgAAAE2cHJlcKW5vmYAAD30AAAAlQAAAAEAAAAAzD2izwAAAADVBMeIAAAAANUEx4gAAQAAAA4AAAAYAAAAAAACAAEAAwAkAAEABAAAAAIAAAABBAYB9AAFAAgCmQLMAAAAjwKZAswAAAHrADMBCQAAAgAGAwAAAAAAAAAAAAEQAAAAAAAAAAAAAABQZkVkAEAAeOd9A4D/gABcA4AA1AAAAAEAAAAAAAAAAAADAAAAAwAAABwAAQAAAAAAogADAAEAAAAcAAQAhgAAAA4ACAACAAYAAAB45hXmH+Y6533//wAAAAAAeOYA5hfmOud9//8AAP+LAAAAABnkGKcAAQAAAAAACgA0AAAAAAAAAAUADwARABIACAAjAB8ABgAHAA4AEwAUABUABAAaABwAHQAgABAACwAMACIACQAWABcAGwAhAA0ACgAYABkAAAEGAAABAAAAAAAAAAECAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUALP/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/j8TDQEgDRMTDf7gDYMUKBwcKBwAAAIAZv+SA5oCxgALACoAOEA1DAECBQFAAAMABQADBWYABQIABQJkAAAAAgQAAlkABAEBBE0ABAQBUQABBAFFFxkUKRUQBhQrACIOARQeATI+ATQmARQeAjMyPwE2NzIfAR4BBwMxBw4BLwEuAT8BPgEXAm/evW1tvd69bW3+TAoIDAQQXYoHCA0ILQcBB/o1BxYHlwgBCCMHFggCxW293r1tbb3evf6lAQoIB2ieCAEHLAgVCP74OQcBB44HFgglCAEIAAACAH8AIQOBAyMACwAXAGZLsDJQWEAkBwEFAAYABQZmBAECAwEDAgFmAAMAAQMBVQAGBgBSAAAACgZCG0AqBwEFAAYABQZmBAECAwEDAgFmAAAABgMABlcAAwIBA0sAAwMBUQABAwFFWUAKEREREREVFRAIFisAIg4BFB4BMj4BNCYDIzUjFSMRMxUzNTMCaNCxZ2ex0LFnZ4UyxDIyxDIDImex0bFnZ7HRsf4br68Bi7OzAAADAFX/LAOrAywAEgAaADMAcUAOMxsCAwIREAkHBAEAAkBLsBpQWEAdBgQIAwMAAAEDAFkAAQAFAQVWAAICB1EABwcKAkIbQCMABwACAwcCWQYECAMDAAABAwBZAAEFBQFNAAEBBVIABQEFRllAExMTMTAtKyYjHhwTGhMaGDgSCRErJTQ2MhYVFAcWFxQGKwEiJjU3JgM1NDYyFh0BJRUjIgYVERQWMyEyNjURNCYrATU0JiIGFQGrMkYyJwkJEw1ADRMSJ1ZkjmT+QEAkMjIkAqokMjIkQKLmopcjMjIjLxkyPA0TEw1uGQEZlkZkZEaWlpYyI/5VIzIyIwGrIzKWc6KicwAAAAADAA8AWQPxAqcADwAfACcANkAzAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAlJCEgHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY1BCImNDYyFhQC2f5OdKOjdAGydKOjZX9a/k5af39aAbJaf/3UiGBgiGBao3Mgc6OjcyBzowE2Wn5+WiBaf39akWGIYGCIAAAAAAMADwBZA/ECpwAPACAAKAA9QDogEAIEBQFAAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAmJSIhHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY9AQYiJjQ2MhYUAtn+TnSjo3QBsnSjo2Z/Wv5MWX9/WQG0Wn+xiGBgiGFao3Mgc6OjcyBzowE1Wn9/Wh9af39aH7BhiGBgiAAAAAACAAD/XwQAAwQAIQA1AFW1AwEDBAFAS7AaUFhAGgACAwEDAgFmAAMAAQMBVQAEBABRAAAACgRCG0AgAAIDAQMCAWYAAAAEAwAEWQADAgEDTQADAwFRAAEDAUVZtigsETgpBRMrLQEmJzY1NCYnJiMiBgcGFRQWFxY7ATI3MhYxBRY2PwE2JiUOASMmJy4BNTQ3PgEzMhceARUUA+P+8AIEJUVBaYpSmDdYRUJpiAF5ZAECARAbSBcGGAT+TChtO2JMLzJAJ207Y0svMgPjAgJPUVKYN1lGQWmKUpk3WEgD4xcJHQccSe4vMgE/J247Y0swMT8obTtjAAMAdP+gA4wCuAAPABkAHAAmQCMZAQACGxgCAQACQBwaAgE9AAIAAmgAAAEAaAABAV8SFxYDESslJyY0NwE2Mh8BFhQHAQYiATYyHwEWFA8BJwE3FwGAqQYGAXwGEAapBgb+hAYRATASMRJwEhI4xf33OMYDqQURBgF8BgapBhAG/oQGAqkSEnASMRI4xf0y/sYAAAADAGv/6wOVAxUACwAbACsATEuwLlBYQB0AAwAEBQMEWQACAgFRAAEBCkEABQUAUQAAAAsAQhtAGgADAAQFAwRZAAUAAAUAVQACAgFRAAEBCgJCWbc1NTU3FRAGFCsEIi4BND4BMh4BFAYDNCYrASIGHQEUFjsBMjY1FTQmKwEiBh0BFBY7ATI2NQJu3LpsbLrcumxs8QsHSgcLCwdKBwsLB0oHCwsHSgcLFGy63LpsbLrcugIFBwsLB0oICgoIgQgLCwjvBwsLBwAAAAABATIArgLWAlIAHAAnQCQABAMBBE0FAQMGAgIAAQMAWQAEBAFRAAEEAUUTIxMjIxMQBxUrASMVFAYiJj0BIyImNDY7ATU0NjIWHQEzMhYUBiMCu50PFhCdCw8PC50QFg+dCw8PCwFmngoQEAqeDxYPnQsPDwudDxYPAAAAAwBJASsDtQH2AAcADwAXACFAHgQCAgABAQBNBAICAAABUQUDAgEAAUUTExMTExAGFCsSIgYUFjI2NCQiBhQWMjY0JCIGFBYyNjTYUzs7UzwBFVQ7O1Q7ARZUOztUOwH1O1Q7O1Q7O1Q7O1Q7O1Q7O1QAAAAJAED/vgO/Az4ADwAfAC8APwBPAF8AbwB/AI8Ah0CEFAQTAhIFAAUDAgEGAAFZFwoWCBUFBgsJAgcMBgdZGhAZDhgFDA0NDE0aEBkOGAUMDA1REQ8CDQwNRYKAcnBiYFJQQkAyMCIgEhACAIqHgI+Cj3p3cH9yf2pnYG9ib1pXUF9SX0pHQE9CTzo3MD8yPyonIC8iLxoXEB8SHwoHAA8CDxsOKwEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgJZswwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgM+EgyzDBISDLMMEhIMswwSEgyzDBISDLMMEhIMswwS/rgSDLMNERENswwSEgyzDRERDbMMEhIMsw0REQ2zDBL+uBIMsw0REQ2zDBISDLMNERENswwSEgyzDRERDbMMEgALAED/awOgAmwABgAKAA4AEgAWABoAHgAiACYAKgAuAU20BQEPAT9LsApQWEBRAAAEAwQAA2YLCQIHBgEGB14SEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0uwGFBYQFIAAAQDBAADZgsJAgcGAQYHAWYSEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0BXAAAEAwQAA2YLCQIHBgEGBwFmEhACDg8OaQAFGAEEAAUEVwADAAYHAwZXCggXAgQBABMMARNXAAwAFRQMFVcAFAANFhQNVwAWDw8WSwAWFg9PEQEPFg9DWVlANgcHAAAuLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsHCgcKCQgABgAGEREZECslESMRIxc3ARUjNSUhESEFMxUjNzMVIzczFSMFMxUjNzMVIzczFSMnMxUjJTMVIwMAQKDAwP2gwAEA/sABQP7AYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQGwBgP6AwMABwMDAQP7AgEBAQEBggGBAQEBA4GBAYAAAAAsAQP9sA6ECbAAGAAoADgASABYAGgAeACIAJgAqAC4BA7QFAREBP0uwClBYQFwHBQIDBANoFwICAQsKCwEKZg4MAgoVFQpcAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRBtAXQcFAgMEA2gXAgIBCwoLAQpmDgwCChULChVkAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRFlANicnAAAuLSwrJyonKikoJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcABgAGEREZECsBETMRMycHATMVIzczFSM3MxUjBTMVIzczFSM3MxUjJzMVIyUzFSMRFSM1JSERIQLAQKDAwP4gYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQMABAP7AAUABLP6AAYDAwAFAQEBAQGCAYEBAQEDgYEBg/uDAwED+wAACAFf/1wOpAykACwAXAJRLsB1QWEAmBAECAwUDAgVmBwEFBgMFBmQAAwMBUQABAQpBAAYGAFIAAAALAEIbS7AyUFhAJAQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgYAUgAAAAsAQhtAKQQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgAABksABgYAUgAABgBGWVlAChERERERFRUQCBYrBCIuATQ+ATIeARQGAyM1IxUjFTMVMzUzAnPmxHJyxObEcnJjqlSqqlSqKXLE5sRycsTmxAFhqqpUqqoAAAMAQAAAA8EC4AAjAEAATABLQEgJAQcALCscGwQFBgJABwEAPgkCAQMACggCBwMAB1kAAwAGBQMGWQAFBAQFTQAFBQRRAAQFBEVDQUlGQUxDTCZlNTVnFREiCxYrATQmKwEwIjEGBwYwIwYHBgcGBwYjKgEjISIGFRMUFjMhMjY1JxQGIyEiJjUDNDYzIToBMzI2NzY3NjczMhYdAiUhMjY0JiMhIgYUFgPBOSe6AgYEAQEFAxIRAwEEFwENAf5gKDggOCgCgCg4QBMN/YANEyATDQGgAQ0BIy8HAgIIBagNE/z/AaANExMN/mANExMCgCg4AQEBAwMRRwwCETkp/mIoODgmAg0TFA4Bng0TIh8ECyIOEw0CASMTGhMTGhMAAAQAX//BA7MDSQAFAAkADQATAA1AChMRDAoJBwUDBCYrLQEHCQEnNwkCEQ0BJQElBwkBJwIJ/ogyAaoBqjMz/lb+VgGqAS7+0v7SAS7+iDIBqgGqM8L3NP7dASM1bAEj/t3+3QHxzs/P/fv4NP7dASM1AAAABAC//8ADQANAABkAIwAzAEMAV0BUISAbGgkIAgEIAQQ7NAIJCAJAAAAABAEABFkFCgMDAQAHCAEHWQAIAAkGCAlZAAYCAgZNAAYGAlIAAgYCRgAAQD84NzEuKSYjIh4dABkAGTUkJAsRKwE1MS4BIyIGBzEVIyIGFREUFjMhMjY1ETQmJTE+ATIWFzEVIQEUBiMhIiY1ETQ2MyEyFhUHNTQmIgYdAQYVFBYyNjU0AwEDlWholQMBGyUlGwIAGyUl/iYCcJxwAv6AAb8TDf5ADRMTDQHADRPgExoTHCMyIwHAh2iRkWeIJRv+gBslJRsBgBomhU5tbU6F/mANExMNAUANExMNkjQNExMNNBIhGSMjGSEABgCJ/6oDswNIAAsAFwAuAEAAUgBZAIFAflcBBQ0uAQ4PAkAABAANBQQNWQAFAAkPBQlZEgEPAA4ADw5ZEAEAAAECAAFZEQECAAMMAgNZAAwKAQcIDAdZCwEIBgYITQsBCAgGUQAGCAZFVFMODAIAU1lUWVJQTUtGQ0A/PTs4NjEvKigmIx4cGhgUEQwXDhcIBQALAgsTDisBISIGFBYzITI2NCYHISIGFBYzITI2NCYDISIGFSMiBhURFBYzITI2NTMyNjURNQEhIiY1ETQ2MzcRFBYzIRQGIzcUBiMhIiY1ETQ2MyEVFBY7ASciJj0BMRcC6P78DBERDAEEDBERDP78DBERDAEEDBERDP6lLUYiLUJGLgGxLkYdLkb++/5PFyMhFiBGLQFbIxfLIxf+ThYjIxYBIUYuV1cVJZEBshEYEREYEZARGBERGBECJUctRi39vi1HRy1HLAGVOf2FJBYCQhYjAf33LEcWJK0WIyMWAkIXI3QtRjo9GVasAAAAAgAA/3UDbgLjACsANwAvQCwkGQ4DBAIAAUAABQEBAAIFAFkDAQIEBAJNAwECAgRRAAQCBEUVFyQuJCoGFCslNC8BNzY1NC8BJiMiDwEnJiMiDwEGFRQfAQcGFRQfARYzMj8BFxYzMj8BNhIUDgEiLgE0PgEyFgKRC2hoCws0Cw8PC2doCg8QCzMLC2dnCwszCxAPCmhnCw8PCzQL3XbK78l2dsnvyqsPC2dnCw8QCjQLC2hoCws0ChAPC2dnCw8QCjQLC2hoCws0CgEI7sp2dsruynZ2AAAABf///ywEAAMsAA8AHABcAGwAwwGuQBuEAQYLGwEHBrpVEAMDB7F+cnBsZ2FdCAIOBEBLsAtQWEBBAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZEgEJAAEJAVUACgoAUQAAAApBAAICEVEAERELEUIbS7AMUFhAOwANAAYHDQZZDAELCAEHAwsHWQUEAgMQDwIOAgMOWRIBCQABCQFVAAoKAFEAAAAKQQACAhFRABERCxFCG0uwGlBYQEEADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQAKCgBRAAAACkEAAgIRUQAREQsRQhtLsCZQWEA/AAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQACAhFRABERCxFCG0BGAAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkAAgARCQIRWRIBCQEBCU0SAQkJAVEAAQkBRVlZWVlAJsPCqKacmpiXlpWPjYuJiIWDgW5tSkdGREJAODc2NTMxKCcXEhMQKwAuASIOAhQeAjI+AjQnLgEnLgInLgInFgMeAQYHBgcOAyMmJyYnJicmJyYjIgcGIzEiLgEnJj4BNzYzMhcWMzI3MjMyFx4BFx4DFxYXBgcGBw4BFyUWFxYXBgcGFxYHJjU8ATUBIiYnNic0Nz4DJicmJyYnPgIzMhcmIyIjBiMiJyYjIgcGBwYXFjMxMjc2MzIXFhcWFxYXFhcWMzI3Njc2Nz4BJicmNjc2NzY3Nic0MRYVFA4CIwOzkrrOupJNTZK6zrqSTVIHHh8QGQwJCAsXDoJYAgESFAwOCAsWIhgHBQQGCA0ZOxodDhkRBwgKEAgLAiciNyIbKicqCA4KBhINDRELCAsWIBUWCQkbFQkVCQX9FQgKIg4DCRwGBQsaAc2B2jsoDQ4GBggDAQQMRA0SDoDIdHdoExgICw0GHRw1KDFEQBgXHB47ChQWCxQSIhEMCAYHBgsQGUQoFRQLBRsZAwEDAwgNESAJFgQbSXyrXQJNkk1NkrrOupJNTZK6zj8MDwsFHhscGBokC1L+wRMhLBcNJRYXHQ0IHRhCbzFcFAkDAgMSER5DRxYlFxQBCQkiHxgbJxkHCAMJGRIJEzYUDgECCAcGDCkYFiJKTwECAf4vhW5MOAUTCAkRDBEHGg8DA3G6azoIAQ8cLSpLST9FAgMGC0Isa1AeGg8YLBg1HAYePywWFRUICw8dChgUAUtRXqp8SQAAAAEAAv8sA/4DLABLAKRADBoJAgIDQC8CCgkCQEuwGlBYQDcEAQIDAAMCAGYGAQABAwABZA0BBwgJCAcJZgsBCQoICQpkBQEBDAEIBwEIWAAKCgNRAAMDCgpCG0A8BAECAwADAgBmBgEAAQMAAWQNAQcICQgHCWYLAQkKCAkKZAADAgoDTQUBAQwBCAcBCFgAAwMKUQAKAwpFWUAVR0ZCQT49ODcyMRQXFBMVFRMUEg4XKwEnJiIGFB8BIREXFjI2NC8BJiIPAQYUFjI/AREhNzY0JiIPAQYUHwEWMjY0LwEhEScmIgYUHwEWMj8BNjQmIg8BESEHBhQWMj8BNjQD8JwOJxsOTP7RTA4nGw6bDicNnA4bJw5M/tBMDhsnDpwNDZwOJxsOTAEwTA4nGw6bDicOmw4bJw5MAS9MDhsnDpwNAUqbDhsnDkwBNUsOGycOmw4Omw4nGw1M/stMDicbDpsOJw2cDhwmDkz+0UwOGycOmw4Omw4nGw5LAS5MDiYcDpwNJwAEAED/bAPAAuwAIQAtADkAQwBVQFIbGgIHAwFAAAEACgABClkFAQMHAANNCwIMAwAJAQcGAAdZCAEGBAQGTQgBBgYEUQAEBgRFAQBDQj88NTQvLikoIyIeHBcUEQ8MCgcEACEBIQ0OKwEjNTQmIyEiBh0BIyIGFBY7AREUFjMhMjY1ETE1MzI2NCYAIiY1AzQ2MhYVERQWIiY1ETQ2MhYVExQBNDYzITIWHQEhA5yaKR3+iB0pmw4UFA5PKR0CEB0pTg8UFP4AHRQBFR0Usx0UFB0UAf68GhIBIhIa/oYCPWkdKSkdaRQdFP27HSkpHQIuFxQdFP25FA8BdA8UFA/+jA8UFA8BdA8UFA/+jA8CcREaGhE+AAAAAgBB/6wDvwKsAGAAvgNNQBylASUjqgEIEzMBCidDAQwABEC+vWEDJhYBBgI/S7ALUFhArhkYAhcaFRoXFWYWARUUGhUUZAAUHxoUH2QAIh8jHyIjZiQBIyUfIyVkACUTHyUTZAATCB8TCGQACAcfCAdkCQEHJh8HJmQoASYnHyYnZAAnCh8nCmQACgYfCgZkAAYLHwYLZAALBR8LBWQABQQfBQRkAAQDHwQDZAADAB8DAGQADQwODA0OZg8BDhAMDhBkHh0cGwQaISACHyIaH1kCAQIAEhECEAAQVgAMDAsMQhtLsAxQWECuGRgCFxoVGhcVZhYBFRQaFRRkABQfGhQfZAAiHyMfIiNmJAEjJR8jJWQAJRMfJRNkABMIHxMIZAAIBx8IB2QJAQcmHwcmZCgBJicfJidkACcKHycKZAAKBh8KBmQABgsfBgtkAAsFHwsFZAAFBB8FBGQABAMfBANkAAMAHwMAZAANDA4MDQ5mEA8CDhEMDhFkHh0cGwQaISACHyIaH1kCAQIAEgERABFWAAwMCwxCG0uwFlBYQK4ZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAA0MDgwNDmYPAQ4QDA4QZB4dHBsEGiEgAh8iGh9ZAgECABIRAhAAEFYADAwLDEIbQLoZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAAwADQAMDWYADQ4ADQ5kDwEOEAAOEGQeHRwbBBohIAIfIhofWQIBAgAMEABNAgECAAAQUhIRAhAAEEZZWVlAS7y6trWxr6ino6KhoJ2cmpmYl5WUjYyLiomIhoWEg4KAfnx6eXV0c3Jwb2ZlW1lYV1ZVVFJQT0xLSEc9PDY1MS8ULBQUExIRESEpFyslBiciJyImIyYnIicmJyImJyYnIicmJzAjMSYnMCcmJy4BMSY1MzI2LwEmIg8BBhY7ARQXFBYzFhcWFxYXMhYxFhcWFRYXHgEzFhcWMxYXFjMUFjMyFzIWMxYzMjc+AS4BNzQnMCYjJicwJjEmJzAmIyYnIiYjJicuASMuASMiLgEjIiYjJiMwJiMwIjEiBw4BHgE3NjMWFzIWMxYXMhcWFzIWMxYXMBYzFhcUMDEWFSMiBh8BFjI/ATYmKwE5AQKkS1wMDAIGAQ0FAQoLBgIGAQwHAQMNCQEkHQEICQECP0IDAwJvAgUBcAECA0NCAQEDCwQBCA0BASYvAgwQAQUBCg4KAggOCwQEAgQRAQUBFRF1Yg8HFiXFQgEBBQsCOlMDAQsPAQcCCBABCQMBBAICBgcCAggDDREEAQF2YQ8HFiUPS1sNDAIFAQsJAgcLCAEEAQwKAQE/LUFCAwMCbwIFAXABAgNDPTYCAQECAQIDAgIBBAMCBgUUHgEJCgEDUGYFA6oCAqoDBXdiAQIFDQYBCg4CJxoBAQYHAQIEBQQDAwMBAQMBAkYLJSAG5HdiAwcPAkgkAgUFAwMDAQIBAQEBAgEBRgslHwcLNQEBAQECAgMCAgQEARw2AVFoBQKrAgKrAgUABgDo/84FAQJeAAAAUgBgAHAAgACQAMlAKEoREAMJBHBpaGEABQgJgHl4cQQKC5CJiIEiBQYDXFhMNDMOBgUGBUBLsBxQWEA1AAEABAkBBFkACQAICwkIWQALAAoNCwpZAA0DBg1NAAMMAQYFAwZZBw4CBQUAUQIBAAALAEIbQDwAAQAECQEEWQAJAAgLCQhZAAsACg0LClkADQMGDU0AAwwBBgUDBlkHDgIFAAAFTQcOAgUFAFECAQAFAEVZQCABAY6LhoN+e3ZzbmtmY15dVFMBUgFSRUM7OjApLicPECsJAR4DBgcjIi4DJzQRMTQ+AzchMh4DFxwCNQ4EBzAqBCsBLgE3MTQ+AzczETQuAycwISIOAwcGFR4EFyUjDgIHMBwBMRcyNzYDFAYrASImNTE0NjsBMhYVFxQGKwEiJjUxNDY7ATIWFQcUBisBIiY1MTQ2OwEyFhUFAPzsAgMIAwYJlwQNJBwZAwINFSscAVUEDSMcGQIBAxQdOSUEBggJBgICDwEBAgoPIBRRAgkOHBL+tAMJGBIRAgEBAQkOHRQBhkYECxYBCAUdJTgPCt0KDw8K3QoPAQ8L3AsPDwvcCw+ADwtbCxAQC1sLDwGm/lMBAgkKDQcDEBkzIU0BQAQQKSEfBAMSGjYjEqiYAQQPLCo2FgQpQgMKGxYVBAFGAwsdFhUCAgoRJhnLtwMMHhcWAnEBBRoRIB8BHSUBcwoPDwoLDw8LlAsPDwsLDw8LlQsQEAsLEBALAAMAPwAFA8ECUwAPAB8ALwBCQD8PCAcABAABHxgXEAQCAy8oJyAEBAUDQAABAAADAQBZAAMAAgUDAlkABQQEBU0ABQUEUQAEBQRFNTU1NTUyBhQrARQGIyEiJjUxNDYzITIWHQEUBiMhIiY1MTQ2MyEyFh0BFAYjISImNTE0NjMhMhYVA8AYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgCKBEZGRESGBgS/BEZGRERGRkR/BIYGBIRGRkRAAAABwCF//0DewMDAAcACwAPABMAFwAnACsAyLYGAQIJCAFAS7AbUFhARg4BAQABaAAJCAoKCV4AAAACAwACVwADAAQFAwRXAAUABgcFBlcABwAICQcIVw8BCgANDAoNWAAMCwsMSwAMDAtRAAsMC0UbQEcOAQEAAWgACQgKCAkKZgAAAAIDAAJXAAMABAUDBFcABQAGBwUGVwAHAAgJBwhXDwEKAA0MCg1YAAwLCwxLAAwMC1EACwwLRVlAJRoYAAArKikoIh8YJxonFxYVFBMSERAPDg0MCwoJCAAHAAcTEA8rARMHAyEDJxMXIRUhFSEVIRUhFSEVIRUhBSEiBh8BHgEzITI2PwE2JgUjNTMDJDI5Lf4gLTkyYwGC/n4Bgv5+AYL+fgGC/n4CK/0sCgoDUgMSCgIUChIDUgMK/u3CwgMC/lEHAYL+fgcBr2AwMTAwMTAwMQ0J9AoNDQr0CQ1gMAAAAAAHAAD/gAQAA4AADwAXAB8ALwA3AD8ATwBaQFcOAQALBwIFBAAFWQANAwQNTQ8MCgMECQEDAgQDWQgGAgIBAQJNCAYCAgIBUQABAgFFQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAUjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYmGoAbJSUDgHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExoTJhrAGiYlG8AbJQADAEQAFwO8AukABwAoACwAPUA6AwECAAcGAgdXCAEABAEATQAGBQEEAQYEWQgBAAABTwABAAFDAQAsKyopJyMeGRMQDwwFBAAHAQcJDislIg4BByEuASUCEzQmIwYhMSAnIgYVFgMUFjc2Fjc2Nz4BFxY3NhcWNichESECAyRGOgcBUgVoAX4DAxkiLf6t/q0zHBkBARccI5AjGRc4dzk/V14mIRo//QgC+JEYOig1RQwBCQEHIhoBARYc5/7HHBkBAQEBARAoCiElAgICAhpaAcgAAAUApv/WA1oDKgANABMAJQAxAD0A1EAKDgECBA0BBQICQEuwHVBYQDAAAgAFBgIFWQsBBgAHCAYHWQwBCAAJAwgJWQAEBABRAAAACkEKAQMDAVEAAQELAUIbS7AyUFhALgAAAAQCAARZAAIABQYCBVkLAQYABwgGB1kMAQgACQMICVkKAQMDAVEAAQELAUIbQDQAAAAEAgAEWQACAAUGAgVZCwEGAAcIBgdZDAEIAAkDCAlZCgEDAQEDTQoBAwMBUQABAwFFWVlAHzQyKCYWFDo3Mj00PS4rJjEoMSIgHRsUJRYlJTUgDRErASEiBhURFBYzITI2NREnFyMiJjUTISImNRE0NjMhFRQWOwERFAYDISIGFBYzITI2NCYHISIGFBYzITI2NCYChf6MLD4+LAHeLD7Wf2gJDmz+IhMbGxMBNjEigxtY/qwMEhIMAVQMEhIM/qwMEhIMAVQMEhIDKT4s/YIsPj4sAhSBfw0K/aUbEwJ+Ext/IjH+JhMbAXESGRERGRKcEhkRERkSAAEAAAABAADFmT0qXw889QALBAAAAAAA1QTHiAAAAADVBMeI////LAUBA4AAAAAIAAIAAAAAAAAAAQAAA4D/LABcBQH//wAABQEAAQAAAAAAAAAAAAAAAAAAACEEAAAAAAAAAAFVAAAD6QAsBAAAAAQAADoEAABLBAAASwQAAGYEAAB/BAAAVQQAAA8EAAAPBAAAAAQAAHQEAABrBAABMgQAAEkEAABABAAAQAQAAEAEAABXBAAAQAQAAF8EAAC/BAAAiQQAAAAEAAAABAAAAgQAAEAEAABBBQEA6AQAAD8AhQAAAEQApgAAAAAAAAAAATwCGgI4AoQC9ANWA7AENASMBOgFZAWuBhQGUgaMB4gIfAlKCboKSgqECw4Lzgw6DigO6g92EhYTMhOWFEgU6hVUFhoAAQAAACUAxAALAAAAAAACAFIAYABsAAABNQmWAAAAAAAAAAwAlgABAAAAAAABAAgAAAABAAAAAAACAAYACAABAAAAAAADACMADgABAAAAAAAEAAgAMQABAAAAAAAFAEUAOQABAAAAAAAGAAgAfgADAAEECQABABAAhgADAAEECQACAAwAlgADAAEECQADAEYAogADAAEECQAEABAA6AADAAEECQAFAIoA+AADAAEECQAGABABgmljb25mb250TWVkaXVtRm9udEZvcmdlIDIuMCA6IGljb25mb250IDogMS00LTIwMTdpY29uZm9udFZlcnNpb24gMS4wOyB0dGZhdXRvaGludCAodjAuOTQpIC1sIDggLXIgNTAgLUcgMjAwIC14IDE0IC13ICJHIiAtZiAtc2ljb25mb250AGkAYwBvAG4AZgBvAG4AdABNAGUAZABpAHUAbQBGAG8AbgB0AEYAbwByAGcAZQAgADIALgAwACAAOgAgAGkAYwBvAG4AZgBvAG4AdAAgADoAIAAxAC0ANAAtADIAMAAxADcAaQBjAG8AbgBmAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AMAA7ACAAdAB0AGYAYQB1AHQAbwBoAGkAbgB0ACAAKAB2ADAALgA5ADQAKQAgAC0AbAAgADgAIAAtAHIAIAA1ADAAIAAtAEcAIAAyADAAMAAgAC0AeAAgADEANAAgAC0AdwAgACIARwAiACAALQBmACAALQBzAGkAYwBvAG4AZgBvAG4AdAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUAAAABAAIAWwECAQMBBAEFAQYASwEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETARQBFQEWARcBGAEZARoBGwEcAR0BHgEfASABIQlzd2l0Y2hvZmYEaWNvbgh3YXJuZmlsbAR3YXJuAm9rBGxvY2sDb2ZmAm9uBnNlYXJjaARlZGl0BGluZm8FYWRkLXMEbW9yZQRncmlkCG1vdmVkb3duBm1vdmV1cANhZGQGZm9sZGVyBWdyb3VwBWxvY2syBWZpbGVzC3RpbWVzY2lyY2xlBWVhcnRoBG1vdmUGZGVsZXRlB3JlZnJlc2gDZG9jBGxpbmUIZmlsZS1ib3gIc3dpdGNob24Jc3lzc2VydmVyBGZpbGUAAAABAAH//wAPAAAAAAAAAAAAAAAAAAAAAAAyADIDGP/hA4D/LAMY/+EDgP8ssAAssCBgZi2wASwgZCCwwFCwBCZasARFW1ghIyEbilggsFBQWCGwQFkbILA4UFghsDhZWSCwCkVhZLAoUFghsApFILAwUFghsDBZGyCwwFBYIGYgiophILAKUFhgGyCwIFBYIbAKYBsgsDZQWCGwNmAbYFlZWRuwACtZWSOwAFBYZVlZLbACLCBFILAEJWFkILAFQ1BYsAUjQrAGI0IbISFZsAFgLbADLCMhIyEgZLEFYkIgsAYjQrIKAAIqISCwBkMgiiCKsAArsTAFJYpRWGBQG2FSWVgjWSEgsEBTWLAAKxshsEBZI7AAUFhlWS2wBCywCCNCsAcjQrAAI0KwAEOwB0NRWLAIQyuyAAEAQ2BCsBZlHFktsAUssABDIEUgsAJFY7ABRWJgRC2wBiywAEMgRSCwACsjsQQEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERC2wByyxBQVFsAFhRC2wCCywAWAgILAKQ0qwAFBYILAKI0JZsAtDSrAAUlggsAsjQlktsAksILgEAGIguAQAY4ojYbAMQ2AgimAgsAwjQiMtsAosS1RYsQcBRFkksA1lI3gtsAssS1FYS1NYsQcBRFkbIVkksBNlI3gtsAwssQANQ1VYsQ0NQ7ABYUKwCStZsABDsAIlQrIAAQBDYEKxCgIlQrELAiVCsAEWIyCwAyVQWLAAQ7AEJUKKiiCKI2GwCCohI7ABYSCKI2GwCCohG7AAQ7ACJUKwAiVhsAgqIVmwCkNHsAtDR2CwgGIgsAJFY7ABRWJgsQAAEyNEsAFDsAA+sgEBAUNgQi2wDSyxAAVFVFgAsA0jQiBgsAFhtQ4OAQAMAEJCimCxDAQrsGsrGyJZLbAOLLEADSstsA8ssQENKy2wECyxAg0rLbARLLEDDSstsBIssQQNKy2wEyyxBQ0rLbAULLEGDSstsBUssQcNKy2wFiyxCA0rLbAXLLEJDSstsBgssAcrsQAFRVRYALANI0IgYLABYbUODgEADABCQopgsQwEK7BrKxsiWS2wGSyxABgrLbAaLLEBGCstsBsssQIYKy2wHCyxAxgrLbAdLLEEGCstsB4ssQUYKy2wHyyxBhgrLbAgLLEHGCstsCEssQgYKy2wIiyxCRgrLbAjLCBgsA5gIEMjsAFgQ7ACJbACJVFYIyA8sAFgI7ASZRwbISFZLbAkLLAjK7AjKi2wJSwgIEcgILACRWOwAUViYCNhOCMgilVYIEcgILACRWOwAUViYCNhOBshWS2wJiyxAAVFVFgAsAEWsCUqsAEVMBsiWS2wJyywByuxAAVFVFgAsAEWsCUqsAEVMBsiWS2wKCwgNbABYC2wKSwAsANFY7ABRWKwACuwAkVjsAFFYrAAK7AAFrQAAAAAAEQ+IzixKAEVKi2wKiwgPCBHILACRWOwAUViYLAAQ2E4LbArLC4XPC2wLCwgPCBHILACRWOwAUViYLAAQ2GwAUNjOC2wLSyxAgAWJSAuIEewACNCsAIlSYqKRyNHI2EgWGIbIVmwASNCsiwBARUUKi2wLiywABawBCWwBCVHI0cjYbAGRStlii4jICA8ijgtsC8ssAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgsAlDIIojRyNHI2EjRmCwBEOwgGJgILAAKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwgGJhIyAgsAQmI0ZhOBsjsAlDRrACJbAJQ0cjRyNhYCCwBEOwgGJgIyCwACsjsARDYLAAK7AFJWGwBSWwgGKwBCZhILAEJWBkI7ADJWBkUFghGyMhWSMgILAEJiNGYThZLbAwLLAAFiAgILAFJiAuRyNHI2EjPDgtsDEssAAWILAJI0IgICBGI0ewACsjYTgtsDIssAAWsAMlsAIlRyNHI2GwAFRYLiA8IyEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbABRWMjIFhiGyFZY7ABRWJgIy4jICA8ijgjIVktsDMssAAWILAJQyAuRyNHI2EgYLAgYGawgGIjICA8ijgtsDQsIyAuRrACJUZSWCA8WS6xJAEUKy2wNSwjIC5GsAIlRlBYIDxZLrEkARQrLbA2LCMgLkawAiVGUlggPFkjIC5GsAIlRlBYIDxZLrEkARQrLbA3LLAuKyMgLkawAiVGUlggPFkusSQBFCstsDgssC8riiAgPLAEI0KKOCMgLkawAiVGUlggPFkusSQBFCuwBEMusCQrLbA5LLAAFrAEJbAEJiAuRyNHI2GwBkUrIyA8IC4jOLEkARQrLbA6LLEJBCVCsAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgR7AEQ7CAYmAgsAArIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbCAYmGwAiVGYTgjIDwjOBshICBGI0ewACsjYTghWbEkARQrLbA7LLAuKy6xJAEUKy2wPCywLyshIyAgPLAEI0IjOLEkARQrsARDLrAkKy2wPSywABUgR7AAI0KyAAEBFRQTLrAqKi2wPiywABUgR7AAI0KyAAEBFRQTLrAqKi2wPyyxAAEUE7ArKi2wQCywLSotsEEssAAWRSMgLiBGiiNhOLEkARQrLbBCLLAJI0KwQSstsEMssgAAOistsEQssgABOistsEUssgEAOistsEYssgEBOistsEcssgAAOystsEgssgABOystsEkssgEAOystsEossgEBOystsEsssgAANystsEwssgABNystsE0ssgEANystsE4ssgEBNystsE8ssgAAOSstsFAssgABOSstsFEssgEAOSstsFIssgEBOSstsFMssgAAPCstsFQssgABPCstsFUssgEAPCstsFYssgEBPCstsFcssgAAOCstsFgssgABOCstsFkssgEAOCstsFossgEBOCstsFsssDArLrEkARQrLbBcLLAwK7A0Ky2wXSywMCuwNSstsF4ssAAWsDArsDYrLbBfLLAxKy6xJAEUKy2wYCywMSuwNCstsGEssDErsDUrLbBiLLAxK7A2Ky2wYyywMisusSQBFCstsGQssDIrsDQrLbBlLLAyK7A1Ky2wZiywMiuwNistsGcssDMrLrEkARQrLbBoLLAzK7A0Ky2waSywMyuwNSstsGossDMrsDYrLbBrLCuwCGWwAyRQeLABFTAtAABLuADIUlixAQGOWbkIAAgAYyCwASNEILADI3CwDkUgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbABRWMjYrACI0SzCgkFBCuzCgsFBCuzDg8FBCtZsgQoCUVSRLMKDQYEK7EGAUSxJAGIUViwQIhYsQYDRLEmAYhRWLgEAIhYsQYBRFlZWVm4Af+FsASNsQUARAAAAA=="
  30988. /***/ }),
  30989. /* 241 */
  30990. /***/ (function(module, exports) {
  30991. module.exports = "data:application/font-woff;base64,d09GRgABAAAAACUAABAAAAAAPjwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABbAAAABoAAAAcdkcx4EdERUYAAAGIAAAAHQAAACAAUgAET1MvMgAAAagAAABHAAAAVleoWpZjbWFwAAAB8AAAAF8AAAFq0CrRwmN2dCAAAAJQAAAAGAAAACQNZf5MZnBnbQAAAmgAAAT8AAAJljD3npVnYXNwAAAHZAAAAAgAAAAIAAAAEGdseWYAAAdsAAAZzAAALDRJFSqwaGVhZAAAITgAAAAvAAAANg480rloaGVhAAAhaAAAAB4AAAAkCN4EOmhtdHgAACGIAAAAUAAAAGIvjQWEbG9jYQAAIdgAAABMAAAATKhUsOBtYXhwAAAiJAAAACAAAAAgAiQEc25hbWUAACJEAAABPwAAAjrsQmpTcG9zdAAAI4QAAADiAAABNthrgtNwcmVwAAAkaAAAAJUAAACVpbm+ZnicY2BgYGQAgjO2i86D6KssxztgNABJ+wbMAAB4nGNgZGBg4ANiCQYQYGJgBEIVIGYB8xgABdYAVwAAAHicY2BkYWP8wsDKwME0k+kMAwNDP4RmfM1gzMjJwMDEwMbMAAOMAgwIEJDmmsLgwFDxvJa54X8DQwxzA8MVkBqQHAANXgzlAHicY2BgYGaAYBkGRgYQSAHyGMF8FgYPIM3HwMHAxMAGZFU8E30m/8zqee3//2CVFc8YnonD+P+7pVikmCVfSiyHmoMEGIG6YYKMTECCCV0Bug7qAWbaGU0SAADKrRKBAHicY2BAA0YMRswS/x8yN/zXgdEAQh4Ht3icnVVpd9NGFJW8ZE/aksRQRNsxE6c0GpmwBQMuBCmyC+niQGgl6CInMV34A3zsZ/2ap9Ce04/8tN47XhJaek7bHEvvvpk7b9N7E3GMqOx5IK5RR0pe96Sy/lQq8bOkrutenijp9ZK6bKeekhZRK02VzMX9I7lEdS5WskmwScbrXqKeqzzvg9JLMqwoSyLaItrKvCxNU08cP021OL1kkKaBlIyCnUqjjxCqUS+Rqg5lSodevZ6KmwVSNhrxqKOiehAq7hzPOaWNOmCkcpXDXLFZbeR7Sdbz+o/SRKfY236cYMNj9CNXgVSMzMD2NB6HTyTT0V4iM5F/7LhOlIVSG1wAr2qwx6BK8aG48UG2E8jUeM3xdVGpNDIV57rPstksHY+VEOXB39ihlBu6v4Oz06aoVmNx+8AzBjkplCh6SBaADlOZp/YI2jy0QGaN+qPiHPB1CC+yEGUqz5Qs6FAHMmd295Ni2t1J12RxoF8GMm9295Ldx8NFr471Zbu+YApnMXqSFIuLEdyHMuunTLvUCEcZF3PAxTxe4ta0QsjIAoxKI8xRW/ie2ahrnB1jb3Qej9VTZNJF/N1Mfj04qVjhOMt6R9xInLvHruvCVSCLCKca7yeOLOpQZbD6+9KS6yw4YZhnxULFlxe+dxH5LzFuP5B3TOFSvmuKEuV7pihTnjFFhXIZhaVcMcUU5aoppilrppihPGuKWcpzRqb9f+n7ffg+hzPn4ZvSg2/KC/BN+QF8U34I35QfwTelgm/KOnxTXoRvSm3gbSlTEaqYsXT47SVataFqOTO4wD4PZM2I9kVvBNIwSnXVSSl1v6VV/iT566LHY+uTkro1aWyIu7pps/j4dMZvbl0y6oadq0+MI+WhPXT12DShU/vN4d/OXd0qLrmriGrDqDYimASANui3AvFN82w7EPOWXXz8QzAC1M+pNVRTde3UlRoP8ryruxie5MDjiGOgjeuursBLE1NWQ/PhZykyFfuDvKmVauewdflkWzWHNqTC2yL2lWScpu295FVJlZX3qrRePp+GIXp6FteEtmzdyaQSoVEzzvHwripF2ZGWctQ/QueXor4HnHF2QevDMe5E3UG1Nex0+PlmI2sLJoamtL0ToGQsXRVjUeVZnGN0DWsdb9wSnq6nJxbxKTaZj8JKdX2Uj24jzSt2WWbRqEp1dJf2WeyrNv0yO2hYHWc/aao27uphW40qUj1Vvga0B3ZW3fhQDys+6qBRVTXb6NrIYzQua8Z/DMhiXPnrRqsm0+/glmqnzWLNXUFz35gs904vb73JfivnppGm/1ajLSOX/RyO+W0R4N85KHZT1kC9NWmIcQHZCxgu1UTnDs3dxiDiOvsfndP9b83CIDmrbY3ZPPXh6ukokjtMeZxlm1nW9SjNUbSTxD5FYqvDicFNjeFYbsoGBuTuP6zfwz3griyLD7xtJIC4z9rEqJ7q4O4eVyM07Cu5DxiZY8e5DbAD4BLE5ti1Kx0Au9Il5w7AZ+QQPCCH4CE5BLvk3AT4nByCL8gh+JIcgq/IuQXQI4dgjxyCR+QQPCanDbBPDsETcgi+JofgG3JaAAk5BCk5BE/JIXhmZHNS5m+pyHWg7yy6AfS97RooW1B+MHJlws6oWHbfIrIPLCL10MjVCfWIiqUOLCL1uUWk/mjk2oT6ExVL/dkiUn+xiNQXxpeZgZTXei95Rwd/Aiu+rH4AAQAB//8AD3iczXoJdBvHmWb9VX03uoFGNxo3QQAEQIonQICkRItsUSZli6QlUpIpyLYsyQxFbyRbPmJvMn4WfShREk9iZ2M7h+P12jllO5bjJJNVDjOeZCbHm2Q8L7uZ3TeZ9T7Pm528l51k3s5s8nbM5v4FkDKlOD4ymQNo1NH1199Vf9X//99fDSKSrtX/yb7GYsQlfWQLmSUH4fbJs/bu/d5OCsQwDWIuEGaCyQ4SUBS4OgSqoknqQQsCkiAFDhJd0K8PgkKkgCLtJ5osUkHXhHoYTNOYIYahmWPJybNR5Dj5OhwVVVt4iyxjyHLqzbEUFt4UT++Ki9jBAvIzQZn/7RjW63Wvfc+e4eFKORrdc3DPwav2D88Oz05uH6yVt1S2RPuifTNWOWa1Rzzb7QSpE3ImTUO2Vi3Wqj20EyJZMeK4jknzUrETSlkZKUq5HroVojnJcfsrA9ViVJJN1gLDUmWg1AOlYglq1RE6DBU3DRBPJvaEC6kwux+0WKnllL+TPg6RTN40M2Zrt395VzrnxOOttnJ7IBwOGOHwfYok6gIVgmZh+8xury3qqqIqipL/STGYiHwt00EzEIiXElMdoZRgtCbDh09Xo1u2FKIqwNIS2MlW8zOjVsLC646Ea7eZIUOJJYy8ZTtw+1/pMTuQLr5MCJAtq19hD9KfEpVIzwkEcHq2KNsF0S4V4G/uhY4f9/u/9P9v/4+hg/7U/z+dL/p/ft990P5iJyGMHFv9Gfswc4hOkqSTTE2e7cGtkMYGQWRCnVAKMwRA20ZEkcwQgnS4tonz7SLBa995MjpW/4NarTYYCUlOp5DrgeoIVFrAkVgVR5WT0uC4KM6BWuSiOr3hL84dO3aOJ3+nyztl/aLEabZhQsXGLUXTlLsUXVd+zqs4MBzSTuhkX4J/IDIJkijJei0CpTgqMs1zAjMiwz0J4zb/8AGG+cLjurddlP85brM9l0Bk7/Dw3mFwm9k/DDfyDRc+UyXe6vPseTaCT8yQXjJKdpFryY3kJPkgeY93ryPYNCwS/lyJQD2quUpElHSVygFJridCcTMmBgwjML1WDBgzVpAaAWP87qWbTxw5NLt7zKv05VrDIUre956lD979wXfdfuLkzSf/3dFDNx658cDc7mtnr925w9s1tmvLYN9oZXRTqbU315uIhjLhjIZSoMGk2Qn5V+W8FarF7BvU/7npaf05riA8gUvOF1fmX+vub0nARpr5b0r8r2BmWJbRvPFrpTdqJ5QcXf0P7KP026gPm8iQVwsAFcHDPSgSJi4QkeI1jxuECoTWiQAgTBNB4EoiwHg07nQ0NITkTHBaoDLCxei00P7KKAwMVjLQAjIryyb0Qg+MwghE6Y1/+fXjx7/OE39KUwJC6Jr3yYqhdMsg/7+a7MoPK6DkZVeh325SYeJ/CjRFXnxUAblLiSj+rzYj8QeQpoC0XF/GSZR9Fe2GTNpJF9nqbWFAiSxReU4BHDOZJpKI45WEOtYJ7EJTA9uBdHVu6ijlW+J2KBgQBYJMVbOzgFORsz1QoHa1mJey5dZSToq4zHEHB/AaxDlgFnUHSlkrS1nbxBYZZsVFuJOxeK7bf9p/uj8VB4im8vfn49Gh2zePzh0sZhOjKwr91QOxLe218QCoIOcSAG7qf/l/zInxE2rXsgWKn8QB+A4hEvnp6g9FQq9B0c+SQ+QEWSL3k+967TutEFOFE9cvHiaioi6989/fJGj6/e89fVdOlNjV+6eq/aYkSqI3eTaF9q+GMxVUQPumEkVXlTous2boWp0YTDKmCQuAJDKpLpuUm0W0Kk27eMlb6IeGc/rV/iIZr3utAB94/7vvufP3brvlhrcvXHfwmr17YBZmx7cPb+nr6CkFQ50qtDBJzud6WKlqlasjbDBbaWHRFK2Zgty3SejE/TLYuN9vVZGoL5szmSxFWoRoIW9SuS8F5WhlcIA53EEWa+XqAPdukehFdfmiukhe+RllCpPUhwWjLRVn1Ih0pmCfYORTcQrMSW8uCJKiSpQGAagWbHVmqGqmwv4XmRoLWxSXSjXTDrx7QtBdUMR0YSio/UQLNhII6n+hBxvJUlC/Sg+FMAnCp/09QFXNkFko3p+dBk8IdWQzAgsnBvLhz34EhGDXpgFX6BhjWtKNCDDB9LQboVSzivHv/wELtERdehOICas1A+kC3MKfxh/zYZ7w34P8SfyHujC5+hL7EsuQAImRVtLuFbguC0zkLrDh+NAFNhUYdBiz7YhTC6MGF6CYk0GKuv3ZygBUB1BWliOh5Nxckdcc9oz/ZP7GvP9ULpXeQR/fsdkP2gkbr2p7KtWeOkkPj46u/MeRct9hWDVs2/Bf4ulLKd7Kfevk6v9ojEtHj5Ynbain495YG8gSWhuRCJKIm00iMu6Kjc6aMTKjNHclRX1tL2Va4jHHMgKyRHSqo76K2VxxEAYqUXAlwqfQmEEJKI7dWpuHLDWmIOXYzMrBHZtzsBdnAvtym/13tVn+U5aTp4/nHct/MtKYUWtfY9TZIyPNSY0eZqRl5dGWXK6FHvFHbQNa12Z4j9OYPLdBt64+xu6jX0H/GScpUvTycSA0GUOVoF4qQWEr2lq6yFHOIk7t2nDUZVZnoVSs8sFnwHVw6Lm1YhBKMBiFpc9JEtwhhSTM/XslC/rC5fCJcHjo2yu/HPoj9jnR4s3YGuLN9HNhbCzz1or/Rw2E460eY4/RYyhXjZgkjHg+QVpIjhTR1vfA9BdFCMLo5FkNLQXuDIEJhC1wpy6BJB9EX20GzeuJGAMBd9AczlHC5ZnTlChFm2oHwJ7DXRZxApE54loQNN3gHHEcYxcCXd1YR+OzFzOGhX8yZ2/un8jUIYbrGMg8GHQniesGd+FT3OB2xOYDMoKwnm7uG9pLxUJbPpdtzbSkU8lEPBZ1I44dtkJB0wjosiZrKkJ9IllWPNRZsPJWPjoIkXytgJ5B7I/kB9d+G8sl/BXwx4j32PLyymPLQPxl8PzlQ4eW8PK8VeJ5hxqVlzwPsHIMlvyl5WVYXl5GMqTA9qVDPHvpkHfoTawzw3W21tf5aoxJmMAWo6hjuqaDtmAGqBaJaFcT4tgOsRcklF9QEVDiCrFCijVHQkQNh9Q5EjbQZIT1ORKJgYOS3E9s17UniW27u4lru5cmvWtem72uReZ/B/xxdUql5uqUNpVwgV5vfXBx5POrA1a/1V+S4Q1WxVpbPbrMV8dv/Y2LsrZs0OUvAV8c76Jl8V9qrBbq/Nzqj9nnWEfD7n148mwa16AoAGWIpcUFGdBri9I82rl1iydJ6PCbbnjybAWp236dGggCcTa3kdbreB0yxBOTa8QSmcBNrln8E4mEFPfC6CZfy0fykf5If62f3vLX37r55m/x5Loze8/g1dGsYQKHef0MQcRFVrtQEbsakQqPHAYbscMPJs8mcOxlReKRC4V9utxACCZwB6SBILAZQ6WM6duCEAisVxifNA/cepGQd0FVrp/n8XrdvPKGHkgYYMI0kvB2GmANHujPp3necC4UxlEOxTGPkmbgsfWSzUO1armve1Mhl07FYxHHCjVDjxCGHlnEgJbTcC3oVYpkzSnStRxFl882HQ6SuJHwxe0XhQ7MW1nafeLEbrq066abVloaXqd5UVJIrpJkoZgATJ/e0IK6nygWkkvJQoF1ndi9wrvuosjmlaUGAX26ka0cR4IkbdCueBtb/KeLiWXeiAmPMzGUXH0Hu4G+jPHyIOn1utriJhNQ1OiQMdhEZFdHHC0IdBozKswQgQrjkWhbT9smDhiqvTA4UMO0mM+hw2qkUsTJoEvnqctjgGgjHQg7JqztMpc+oC8u6nqV45aji1owpPfr+tGjOmahoLZ4lN+v6j+57Xs//+5tt3335997MshbgyGtqjc7aqFfuwPK337vttu+xxPCPSxb7WIruCcnySe9QEKllHm9VFOp19yVg1xVUDcI2iICjMC8AbKC5kJd0EHlRzrzKIAAKDIo+4mmsRnUT03juPiNe2KrxqY39MeuM0RjGuLiyI6JsW0jW4cGK2Un6tiRiO2EzWgnCg8D9gxkrSiP2lGiXJQYwY+ClR0cqDarKNJGY9ZaI+ftzUYrKzfJB6rsF4+YpaQ55b84xfOPmyXjETNZwht/OsXzRwyjSQB96wT44wTQu0YAO9du1CZ5/nGTEyWNKf/7G1imis1nvEpgTkLPlFlMIYcSEci21ePsefozkiXdZDPZTvZ5s8kElRnuLkA3BVpdBCYTNq2jfhKMiBD8YXgmCYI0jZnE95skjAPZPjZ6CW6zno72fK4lFXWsYECTBZKFrMHPBGoYpWW5duX5occwnNfScq1xFIaqWmNrONA9jwltB5qqmoYse+RjHWn/dLrj46bjmLs60jSU7rgi6Dg+QaAfSTvPpR0HS/7XEmHIhRP+u+nW69MdHenr8e7KV3mJ9kR5+T8jcrsVOwb9+3h6vkxvshIJa6RxtuMRiS3T2bVzljFvNIhuSiCQiUVDAmW97aVWQRAZlxJhQOrYhaJZryOmEcRpIopcMKIwXuOfCiriuu0pr0/o9esRthwLv/KjcCwWZl08fe0ybbficatxjxf47xVe4wWuY1Ahn6f/hc4g1i15bYjGQMBNzxqmmuGoz58R2Hk7n7dDcgTXKsIjiq24UkUejtX4SqShnyPzPP3qJ4Ju6BNc+z8RcoONAiw8qoVC2qPBtTpSBBsyDJED7Bf00w0ZlsiA10+4uQIuJBwJjyQYkk03ogdUVEbG0ay2ZVvTiUi4adNlDPSzfCyvCsle30hrG0hYt+H/zb/i1ieeuBW+gOnbTh7wrzhw8uQB+MKBkys/On3o0OlDB564pfWWJxoJDBy4884DrZzggcO8kVw0XozI+PlEa4gKYkMT3mjYxUIu+1aGvRWjiNcY9wKOe6p+8mQdvnjg5LN8ZIc3DrvGR5xpJGfPj5v79iX07UsX+fYD3twGX0sMJhjTqJNMUIFR4bV97b+QnxV/V362mGj42aXfxs/a6Gb5Xe5mKVkiWbbEcg38t7CG6BChIRATpQXuTlBosICLDQz2rSM6TUJns+k1yBDAYVwz1wB2k2uokSGUuQDRbTyNayI6q4noFv/02aNHn+XJqcq3Knix3NFnX+T3XnzWTz7zDLz/ueeaNoqwb9KXME73yBSZ9C5D84zRdyopiBL1ZCAjKj6faArac7TaPNTip0EXm6jt2y6f2Da1far4tlrtaMTK6W4n8OPyvlxZkqW+PCb8m98EfAejTW6ue2ltkRlf5C1oHwYG+RftRJoWstymc3LHZd/cXDpHJQFAZGELDVAUDPAPtQ+1DrXTpfYhzzZWlgy7FeP1x7Al3ytTqoifNexXVuGxRgB/CFNOCQCMWTsC1Nrc4R9pHxoqUsNGzPKoYecygp4zbYNCvrm4GHmSa1dfYM+xy1FtVWIQmxieZlsBTZVFJhQ7u0FWoTSoUsuAAhR4har+6QqcgTP9/f6V/pVY6vH/zP8zTNduv/DLqv8TdGbHIO//BEt/94Mf/nDlH3/VvEn4+cmrODtFribHyB/C573kvSDpSXSd5/aFGJOfvfPmE8eOHr5GoaaAUEfHrbYNxyfJhlQPgK6AzPTGaoVMFkL3KwTBpIJZD4NKQMXdp2nrJ0SUWjPEsnSLA/IAMhr+dUYiuqtQkJqUvTGLxO9qLEVkNMrvG4SfRr4FhhvYeBNvhQMqsYWLyTkBqNOYqVztVB5B8BjiD1/47Kcf+dhHHn7owQ/+/vvfe/rUPXfdcHznjolLx7whBMj95fZSNGyHOjESz5nUaaGVEVrlb+V6KL9c1gJcDUyWL5bWvvkcakU5x9/cjSDI7q9wHD1YwbwFoi0s6kYbPSBacJvlqCsXa5dADXLF0kCpOjjCmpxGKPZBdnkpn2uy5bT95UqT6foXmQ80jraxT1PZkEkZg2mT5tlzHzr3g3Mfmp5uZrNySyYUD6iKHjXv3k8h7ARMRXdzMVkUJMWIDyfSZtySFS2k6LSUG8wlMVBXTE0KG4alI2VrxFXVZESNqOJKRNFyJlNTkqgn4E/u+u/D7YYpSQqqcuBSI2wufefW2xftmKIbUjpVay9f6sWiqZZhzXF1J5yzAgrORg/FL22POLqYjKOJZIphtaqukLz8jievodPnR82z0UBQF1uSqViiTZ/1v2lnu6IGyi9tKOnY2I3lqx2VUbQjLdt3uIWog4ucy8SSpbisMDUeVu0BtAdUkaVAR8zN7dyFTs3vPXXD1JBoK6oVsOREkLGbzr19iwLBVPemyctHxymT9LGut+9uSQRjXbFaSmoZ7XIjEUUPprWYA5MzB8/ccXnDz55a9dnvYVQho5cIoj2JIqrpJN/5sgRUVQBVOYm7fsLEoAwWiapomnqQx2+IDOfWXmDOoYWQZBE9g0wUVVbmgqARI6AZ+0lA1wOTJBDQZ4ge0MeT3o5XGfG31781p7pXSMQI4QdlKKpSonTx8QtykO1QsBNsmWVZyY5mIxd8RTTj/BURt/oYuxTFfK2ftVU2d/ut3Zsr18Hd/p0bf7RzpQuDsVkW1qijhbGg+f/7hRcY9Wdk3i7DM4f6yn2Ny1D/XjMM7e9V41Dfeqx7LVtlGDeQGtn3JdwrAqyFgwlykRMWhKbpEdBStJJXXa+AEqo3XO/0Btf75fYua6hDtNHuo/JhOMIVTeJBMGoWApHBilsW3cYECyagkvcg8kVda2hzxGEv+7+gQmF82/Xvm/3I4P7xsetPwzvncXuFkpdFpZjgT7UfHz4y1VvxSseHr5vsrbCXKd01g7T1Cd7no4P7L2MvR9W0nLr8b3srMFq6Acn6yqPY7Tqc0T6MhZ9EvxEmCdJPbvLM/iRl1AqpssCPppsiSEuCgqizCd0Bw3/xSrSX8gyRZY2iFPK4lJTJtH4BnSjCNEYC4izvMFH3bNtGXNdZzLek0FEmYkNh1eosNOItR3bXX80MFtka8i9E8hfCvU6UDMa2EXiyMlEpqapteIYdLl05/4F53/PaKpU2eoan3uN//fjD+Uol3xuvXMI9+Q1xiD80MT8/8dBDD1Xy/j7eBk/mKw/d8vjjt/D1F8jy6jLzMKyKI6rpx3h0ztubbU0mVIWCAsJwFTWNepwScJFFDdeXyOgS6kQhqqSodYJoVppGgIaxG5UoehBvdGiw3NOBq92SRrbxWlubbuEUyj08FpXLF8+uUObnH9FyJHsxjJUb007z4xOM8WtV3HEPLi4+yKABMRGfFvwiPfHICeovwfOIWzw+Z1g27JdQzqk8znX5PYsPPHD0dCHpc9yaBISlp644fvyKUw2MY0Cjx4eqPK2Gs/F8Pp5FaPne1TOIY3Y0sGkPYr1ZXNW7vDvnQDR6wAyiPARiiILBAxQ1KKroAoPEJEGzHuLvUTHUq1uYsgBldRLQQFYCcl0HBW34NGaKNEMkRRrfu8cMULKnvrc+u3t6cmK7N7p1eGig3LupnW+VRMyxAlEzqoj8jY7dDAKaUqsW5Q1lxkHiRpn2c7nWYF2Sg437KNrBjeKN8GigxGOmcpT+jf9KwLIC6F8wvaD8qe6JXPfYRA882zOR7pnw/9HfFc1n3daJbrgqH/1+Pupf4ebzLmQneubmIoUH4AtWzMLr/mZGCzu6J7pXvtG9Y0f3ji54cPPKqTaXjrl5WPll1w637WnemY5F87d2T2zZGr/yqYZN2rb6FHuePkUOkW+waS/1KSjkz4Bi94NW2g4BInjf+PphVnRBoqNNOPf5eIxGE5FENLLgou1IRJx54mQSTmae5DL5TC6/0Ab5QiZfmCcFO1Ow54mtZGxlnihyRpHnEcYXM3Jxvh0tVaZYmiclLVPS5jHcyGjSPJH0jKTPE13M6OI8gvmMKMyj0csIbB4NSYaReXQEZsAwFxAZhQJmaJ6fuwuJbCvN5BKZOsW9ELZoiISu5F4isI4d/62MmoNVK2BarzVssIj16qjdf0OjfrOy9s79aw84gGg6YCwQw8Rrno+bvOa4AyEyzXMSmm1OYYLj6Mmvnfvyl5595rOfeeLx//TYJx752Ec/8vCDH/79+97/vveefvepe++5e+nOO971znfcesvNJ25ceNtV9f1zV+7bO7t719TkZTu2XjJQK/c6XQ6HH1a2I9pZkEo5VHr0toh7sVBqFvryZUxK3AeXi9x+rJ21oolwomg9mngYHTZmERf9M7/T+PE/1mFDP8fKI/zPCdVSH2ffV+QcGw8qNnx7nlt//sNqHhsw2M0hVG/hON5tcIhWomuFPp44fYi08xwJNU5w0QluBvrJyasDASqBIYKmS1gIyMAMFdrSoKhAR8cYozdSEU4AZdvHMHzVBVAMgGIvDYQAO5kaVUxdEKhgYTViveNIUHYL30ZSUadb9jDQgyBTJQQqom30bDw2ZoaFwfRthzllcPIqI4AP4C9YMTQSAM07jHZvu+DBWwf4QQ+WKAWBUUl0WkDVgO1eENkZSs8w8fYjQEVDwvHQUgL4i1oqiAJD74rYiU7ohVbpr24/wuQgvayNiiJv4H+x4Ak2ZmS91qjxJwgCpAZgZlGkT1K8RPRJn1n9MauzjkYMXiBlspX8yNMQpgsGiJRjG/62rQ8NrShRER2ThC5dkjHYQ5/OuE9fR3rbcNBs/T8Ra+/dejgYoBzx/cb+F/Tyqm+qA058er0fa7yEylQr7UXX2TJY2Vrd2tNZLLeXc63ppFNwC4Vaq2FddCpWiuLeqtkXOjjLkdhvcJv0lH9f18hIF/xl18h/Pbmomsf8nJ1M2jBQzt2T3O8/xf8QBnt5uqHMOka6Vu7m/ahz10lDW/lU0qZ32smTubJftJNwU5gfCocfaWb/Hw/i7E14nGNgZGBgAOLi6qdR8fw2XxnkWRhA4CrL8Q4E/V+HlYG5AcjlYGACiQIAKaUJ/wB4nGNgZGBgbvivwxDDCmQxMLAyMIBpJMADAD3VAiQAAHicY2GAAMZQBgbmlww6LAwMVkCcA8ReQOwAxOlA7MrKyPASSHsDYQmDAxCGg7UxMzgyODAaMQgAIQNDA1A8Hki3AnEowwGGTqDscgDQUgs8AAAAAAAAAAABPAFaAcAB+gL2A1gDwgTeBSoFmgXkBtgHpggWCPQJYAoiCq4LEgtQC6gMBAymDQANkA3KD7gQahDmEWoR9BK0FVQWGgABAAAAJQDEAAsAAAAAAAIAUgBgAGwAAAE1A00AAAAAeJx9j7tOw0AQRa/zUpAoIlqakWniYq215Yg8ShS7oqWPEjuxFGzJdh6/AB9AA99Ay+9xvVkaitjamTM7d+cB4BYfcNB+Doa4s9zBAJ7lLh5wttyj5ttyH0vnyfIAQ+eTSqd3w5uRedVyh/XvLXcRQ1vuUfNluY93/FgeYOS8IccaJQpkxjZAvi6LrCxIz0ixoeCAVwbpJj/Qx1bX+gpbSgQhfHYTzHn+17vcBlCIeELqAjyyDDvEZbVNJfS1zOWvKzFQkQp1QNGV2V7YuEJNSZtqG7QjLEgN/wwrTt0wt6PiMsYYRyp8zDiIx1hhTzs1VNFOzAoKiVlI2+hsakeGT7Qu866JMmNrjpJWdV4WEvh6IU2TrQ5Nucu5yvio/VnkidrLVFQlEy0qkVDTnSWIRJ3ETVxRmaj62rK/HwFYqgB4nH2NyW7DMAxEPTbl2E33fU976DGX/kY/oSdXomIhihhITtz+fS2g5xIgMYN5AxZl8f+8TYuiLD5RogJBocYMDVocYI5DHOEYJzjFGc5xgUtc4Ro3xQducYd7POART3jGAi94JaclkAtWaCORaRWdKWXdpp+UOO45VkZ0M3YxWOc9ZUFs3NBsZM9GxlBnsdtWnTFtGt2ge7F2PrgNJ+2i9kwZqA17Hpi8C6wmdJmqCSslNH+dUFvxhqNaRdltFXdx6JvpJS+/5LtOk9c9edFrlc+7ylGaRbaRU0/Z/QIgAUpiAABLuADIUlixAQGOWbkIAAgAYyCwASNEILADI3CwDkUgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbABRWMjYrACI0SzCgkFBCuzCgsFBCuzDg8FBCtZsgQoCUVSRLMKDQYEK7EGAUSxJAGIUViwQIhYsQYDRLEmAYhRWLgEAIhYsQYBRFlZWVm4Af+FsASNsQUARAAAAA=="
  30992. /***/ }),
  30993. /* 242 */
  30994. /***/ (function(module, exports, __webpack_require__) {
  30995. "use strict";
  30996. /**
  30997. * @author oldj
  30998. * @blog https://oldj.net
  30999. */
  31000. module.exports = (element) => {
  31001. let rect = element.getBoundingClientRect()
  31002. let docEl = document.documentElement
  31003. return (
  31004. rect.top >= 0 &&
  31005. rect.left >= 0 &&
  31006. rect.bottom <= (window.innerHeight || docEl.clientHeight) &&
  31007. rect.right <= (window.innerWidth || docEl.clientWidth)
  31008. )
  31009. }
  31010. /***/ }),
  31011. /* 243 */
  31012. /***/ (function(module, exports, __webpack_require__) {
  31013. var map = {
  31014. "./alert": 36,
  31015. "./alert.js": 36,
  31016. "./check_hosts_refresh": 37,
  31017. "./check_hosts_refresh.js": 37,
  31018. "./del_hosts": 38,
  31019. "./del_hosts.js": 38,
  31020. "./esc": 39,
  31021. "./esc.js": 39,
  31022. "./get_on_hosts": 40,
  31023. "./get_on_hosts.js": 40,
  31024. "./index": 30,
  31025. "./index.js": 30,
  31026. "./list_updated": 17,
  31027. "./list_updated.js": 17,
  31028. "./reload": 41,
  31029. "./reload.js": 41,
  31030. "./save": 24,
  31031. "./save.js": 24,
  31032. "./sort": 42,
  31033. "./sort.js": 42,
  31034. "./sudo_cancel": 43,
  31035. "./sudo_cancel.js": 43,
  31036. "./sudo_pswd": 44,
  31037. "./sudo_pswd.js": 44,
  31038. "./toggle_hosts": 45,
  31039. "./toggle_hosts.js": 45,
  31040. "./top_toggle": 46,
  31041. "./top_toggle.js": 46,
  31042. "./update_hosts": 47,
  31043. "./update_hosts.js": 47
  31044. };
  31045. function webpackContext(req) {
  31046. return __webpack_require__(webpackContextResolve(req));
  31047. };
  31048. function webpackContextResolve(req) {
  31049. var id = map[req];
  31050. if(!(id + 1)) // check for number or string
  31051. throw new Error("Cannot find module '" + req + "'.");
  31052. return id;
  31053. };
  31054. webpackContext.keys = function webpackContextKeys() {
  31055. return Object.keys(map);
  31056. };
  31057. webpackContext.resolve = webpackContextResolve;
  31058. module.exports = webpackContext;
  31059. webpackContext.id = 243;
  31060. /***/ }),
  31061. /* 244 */
  31062. /***/ (function(module, exports, __webpack_require__) {
  31063. var map = {
  31064. "./alert.js": 36,
  31065. "./check_hosts_refresh.js": 37,
  31066. "./del_hosts.js": 38,
  31067. "./esc.js": 39,
  31068. "./get_on_hosts.js": 40,
  31069. "./index.js": 30,
  31070. "./list_updated.js": 17,
  31071. "./reload.js": 41,
  31072. "./save.js": 24,
  31073. "./sort.js": 42,
  31074. "./sudo_cancel.js": 43,
  31075. "./sudo_pswd.js": 44,
  31076. "./toggle_hosts.js": 45,
  31077. "./top_toggle.js": 46,
  31078. "./update_hosts.js": 47
  31079. };
  31080. function webpackContext(req) {
  31081. return __webpack_require__(webpackContextResolve(req));
  31082. };
  31083. function webpackContextResolve(req) {
  31084. var id = map[req];
  31085. if(!(id + 1)) // check for number or string
  31086. throw new Error("Cannot find module '" + req + "'.");
  31087. return id;
  31088. };
  31089. webpackContext.keys = function webpackContextKeys() {
  31090. return Object.keys(map);
  31091. };
  31092. webpackContext.resolve = webpackContextResolve;
  31093. module.exports = webpackContext;
  31094. webpackContext.id = 244;
  31095. /***/ })
  31096. /******/ ]);
  31097. //# sourceMappingURL=bundle.js.map