1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517 |
- /*!
- * Mditor embed version 1.3.3
- * Homepage: http://mditor.com
- */
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId])
- /******/ return installedModules[moduleId].exports;
- /******/
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ exports: {},
- /******/ id: moduleId,
- /******/ loaded: false
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.loaded = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(0);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var mokit = __webpack_require__(1);
- var Toolbar = __webpack_require__(84);
- var Editor = __webpack_require__(89);
- var Viewer = __webpack_require__(94);
- var Finder = __webpack_require__(97);
- var Shortcut = __webpack_require__(100);
- var Parser = __webpack_require__(102);
-
- __webpack_require__(151);
- __webpack_require__(158);
- __webpack_require__(159);
- __webpack_require__(160);
-
- var HIDDEN_CLASS_NAME = 'mditor-hidden';
-
- var Mditor = new mokit.Component({
- template: __webpack_require__(162),
-
- /*istanbul ignore next*/onInit: function onInit() {
- this.PLATFORM = navigator.platform.toLowerCase();
- this.EOL = this.PLATFORM == 'win32' ? '\r\n' : '\n';
- this.CMD = this.PLATFORM.indexOf('mac') > -1 ? 'command' : 'ctrl';
- this.INDENT = ' ';
- this.shortcut = new Shortcut(this);
- this.Parser = Parser;
- this.parser = new Parser(this);
- },
- /*istanbul ignore next*/onReady: function onReady() {
- /*istanbul ignore next*/var _this = this;
-
- this.shortcut.bind('tab', this.editor.addIndent.bind(this.editor));
- this.shortcut.bind('shift+tab', this.editor.removeIndent.bind(this.editor));
- this.shortcut.bind('enter', function (event) {
- /*istanbul ignore next*/_this._ulAndQuoteAutoComplete(event);
- /*istanbul ignore next*/_this._olAutoComplete(event);
- /*istanbul ignore next*/_this._keepIndent(event);
- }, true);
- setTimeout(function () {
- /*istanbul ignore next*/_this.$emit('ready');
- }, 0);
- },
-
-
- components: {
- Toolbar: Toolbar,
- Editor: Editor,
- Viewer: Viewer,
- Finder: Finder
- },
-
- props: {
- height: '400px',
- width: 'auto',
- preview: false,
- split: true,
- fullscreen: false
- },
-
- /*istanbul ignore next*/data: function data() {
- return {
- self: this,
- value: ''
- };
- },
- /*istanbul ignore next*/find: function find(text) {
- this.finder.show(text);
- },
- /*istanbul ignore next*/syncScroll: function syncScroll() {
- if (!this.split || this.preview) return;
- var offsetHeight = this.editor.textarea.offsetHeight;
- var editorScrollHeight = this.editor.textarea.scrollHeight;
- var viewerScrollHeight = this.viewer.$element.scrollHeight;
- var editorScrollTop = this.editor.textarea.scrollTop;
- var viewerScrollTop = editorScrollTop * (viewerScrollHeight - offsetHeight) / (editorScrollHeight - offsetHeight);
- this.viewer.$element.scrollTop = viewerScrollTop;
- },
- /*istanbul ignore next*/onChanged: function onChanged(event) {
- this.$emit('changed', event);
- this.syncScroll();
- },
- /*istanbul ignore next*/onInput: function onInput(event) {
- this.$emit('input', event);
- },
- /*istanbul ignore next*/onPaste: function onPaste(event) {
- this.$emit('paste', event);
- this.syncScroll();
- },
- /*istanbul ignore next*/onHeadDblClick: function onHeadDblClick(event) {
- if (event.target.tagName == 'I') return;
- this.$emit('head-dblclick', event);
- },
- /*istanbul ignore next*/_keepIndent: function _keepIndent(event) {
- var text = this.editor.getBeforeTextInLine();
- var parts = text.split(this.INDENT);
- if (parts.length < 2) return;
- var count = 0;
- var buffer = [this.EOL];
- while (parts[count] === '' && count < parts.length - 1) {
- count++;
- buffer.push(this.INDENT);
- }
- this.editor.insertBeforeText(buffer.join(''));
- event.preventDefault();
- },
- /*istanbul ignore next*/_ulAndQuoteAutoComplete: function _ulAndQuoteAutoComplete(event) {
- var text = this.editor.getBeforeTextInLine();
- var prefix = text.substr(0, 2);
- if (prefix != '- ' && prefix != '* ' && prefix != '> ') return;
- if (text.length > prefix.length) {
- this.editor.insertBeforeText(this.EOL + prefix);
- } else {
- this.editor.selectBeforeText(prefix.length);
- this.editor.setSelectText('');
- }
- event.preventDefault();
- },
- /*istanbul ignore next*/_olAutoComplete: function _olAutoComplete(event) {
- var exp = /^\d+\./;
- var text = this.editor.getBeforeTextInLine();
- var trimedText = text.trim();
- if (!exp.test(trimedText)) return;
- var num = trimedText.split('.')[0];
- if (trimedText.length > num.length + 1) {
- this.editor.insertBeforeText(this.EOL + (parseInt(num) + 1) + '. ');
- } else {
- this.editor.selectBeforeText(text.length);
- this.editor.setSelectText('');
- }
- event.preventDefault();
- },
- /*istanbul ignore next*/focus: function focus() {
- if (this.preview) {
- this.$element.focus();
- } else {
- this.editor.focus();
- }
- },
- /*istanbul ignore next*/blur: function blur() {
- this.editor.blur();
- },
- /*istanbul ignore next*/addCommand: function addCommand(item) {
- if (!item.name || !item.handler) return;
- this.commands = this.commands || {};
- this.commands[item.name] = item;
- if (item.key) {
- this.shortcut.bind(item.key, item.name, item.allowDefault, item.owner);
- }
- },
- /*istanbul ignore next*/removeCommand: function removeCommand(name) {
- this.commands = this.commands || {};
- var item = this.commands[name];
- if (!item) return;
- this.shortcut.unbind(item.key);
- this.commands[name] = null;
- delete this.commands[name];
- },
- /*istanbul ignore next*/execCommand: function execCommand(name, event) {
- event = event || {};
- event.mditor = this;
- event.toolbar = this.toolbar;
- event.editor = this.editor;
- this.commands[name].handler.call(this, event);
- }
- });
-
- Mditor.fromTextarea = function (textarea) {
- textarea.classList.add(HIDDEN_CLASS_NAME);
- var mditor = new Mditor();
- mditor.value = textarea.value;
- mditor.$watch('value', function () {
- textarea.value = mditor.value;
- });
- mditor.$mount(textarea);
- mditor.switchTextarea = function () {
- if (textarea.classList.contains(HIDDEN_CLASS_NAME)) {
- textarea.value = mditor.value;
- mditor.$element.classList.add(HIDDEN_CLASS_NAME);
- textarea.classList.remove(HIDDEN_CLASS_NAME);
- } else {
- mditor.value = textarea.value;
- textarea.classList.add(HIDDEN_CLASS_NAME);
- mditor.$element.classList.remove(HIDDEN_CLASS_NAME);
- }
- };
- return mditor;
- };
-
- Mditor.Parser = Parser;
-
- module.exports = window.Mditor = Mditor;
- /***/ }),
- /* 1 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var info = __webpack_require__(2);
- var utils = __webpack_require__(3);
- var Class = __webpack_require__(4);
- var Watcher = __webpack_require__(5);
- var Observer = __webpack_require__(6);
- var Template = __webpack_require__(51);
- var Component = __webpack_require__(79);
- var EventEmitter = __webpack_require__(50);
-
- //持载模板相关对象
- utils.copy(Template, Component);
-
- Component.version = info.version;
- Component.Template = Template;
- Component.Watcher = Watcher;
- Component.Observer = Observer;
- Component.EventEmitter = EventEmitter;
- Component.utils = utils;
- Component.Class = Class;
-
- //定义安装插件的方法
- Component.use = function (plugin) {
- var install = plugin.install || plugin;
- if (!utils.isFunction(install)) {
- throw new Error('Invalid Plugin');
- }
- return install.call(plugin, this);
- };
-
- //安装内置的路由插件
- //Component.use(Router);
-
- module.exports = Component;
- /***/ }),
- /* 2 */
- /***/ (function(module, exports) {
- module.exports = {"name":"mokit","version":"3.1.3"}
- /***/ }),
- /* 3 */
- /***/ (function(module, exports, __webpack_require__) {
- (function (ntils) {
-
- /**
- * 空函数
- */
- ntils.noop = function () { };
-
- /**
- * 验证一个对象是否为NULL
- * @method isNull
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isNull = function (obj) {
- return obj === null || typeof obj === "undefined";
- };
-
- /**
- * 除去字符串两端的空格
- * @method trim
- * @param {String} str 源字符串
- * @return {String} 结果字符串
- * @static
- */
- ntils.trim = function (str) {
- if (this.isNull(str)) return str;
- if (str.trim) {
- return str.trim();
- } else {
- return str.replace(/(^[\\s]*)|([\\s]*$)/g, "");
- }
- };
-
- /**
- * 替换所有
- * @method replace
- * @param {String} str 源字符串
- * @param {String} str1 要替换的字符串
- * @param {String} str2 替换为的字符串
- * @static
- */
- ntils.replace = function (str, str1, str2) {
- if (this.isNull(str)) return str;
- return str.replace(new RegExp(str1, 'g'), str2);
- };
-
- /**
- * 从字符串开头匹配
- * @method startWith
- * @param {String} str1 源字符串
- * @param {String} str2 要匹配的字符串
- * @return {Boolean} 匹配结果
- * @static
- */
- ntils.startWith = function (str1, str2) {
- if (this.isNull(str1) || this.isNull(str2)) return false;
- return str1.indexOf(str2) === 0;
- };
-
- /**
- * 是否包含
- * @method contains
- * @param {String} str1 源字符串
- * @param {String} str2 检查包括字符串
- * @return {Boolean} 结果
- * @static
- */
- ntils.contains = function (str1, str2) {
- var self = this;
- if (this.isNull(str1) || this.isNull(str2)) return false;
- return str1.indexOf(str2) > -1;
- };
-
- /**
- * 从字符串结束匹配
- * @method endWidth
- * @param {String} str1 源字符串
- * @param {String} str2 匹配字符串
- * @return {Boolean} 匹配结果
- * @static
- */
- ntils.endWith = function (str1, str2) {
- if (this.isNull(str1) || this.isNull(str2)) return false;
- return str1.indexOf(str2) === (str1.length - str2.length);
- };
-
- /**
- * 是否包含属性
- * @method hasProperty
- * @param {Object} obj 对象
- * @param {String} name 属性名
- * @return {Boolean} 结果
- * @static
- */
- ntils.has = ntils.hasProperty = function (obj, name) {
- if (this.isNull(obj) || this.isNull(name)) return false;
- return (name in obj) || (obj.hasOwnProperty(name));
- };
-
- /**
- * 验证一个对象是否为Function
- * @method isFunction
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isFunction = function (obj) {
- if (this.isNull(obj)) return false;
- return typeof obj === "function";
- };
-
- /**
- * 验证一个对象是否为String
- * @method isString
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isString = function (obj) {
- if (this.isNull(obj)) return false;
- return typeof obj === 'string' || obj instanceof String;
- };
-
- /**
- * 验证一个对象是否为Number
- * @method isNumber
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isNumber = function (obj) {
- if (this.isNull(obj)) return false;
- return typeof obj === 'number' || obj instanceof Number;
- };
-
- /**
- * 验证一个对象是否为Boolean
- * @method isBoolean
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isBoolean = function (obj) {
- if (this.isNull(obj)) return false;
- return typeof obj === 'boolean' || obj instanceof Boolean;
- };
-
- /**
- * 验证一个对象是否为HTML Element
- * @method isElement
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isElement = function (obj) {
- if (this.isNull(obj)) return false;
- if (window.Element) {
- return obj instanceof Element;
- } else {
- return (obj.tagName && obj.nodeType && obj.nodeName && obj.attributes && obj.ownerDocument);
- }
- };
-
- /**
- * 验证一个对象是否为HTML Text Element
- * @method isText
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isText = function (obj) {
- if (this.isNull(obj)) return false;
- return obj instanceof Text;
- };
-
- /**
- * 验证一个对象是否为Object
- * @method isObject
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isObject = function (obj) {
- if (this.isNull(obj)) return false;
- return typeof obj === "object";
- };
-
- /**
- * 验证一个对象是否为Array或伪Array
- * @method isArray
- * @param {Object} obj 要验证的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isArray = function (obj) {
- if (this.isNull(obj)) return false;
- var v1 = Object.prototype.toString.call(obj) === '[object Array]';
- var v2 = obj instanceof Array;
- var v3 = !this.isString(obj) && this.isNumber(obj.length) && this.isFunction(obj.splice);
- var v4 = !this.isString(obj) && this.isNumber(obj.length) && obj[0];
- return v1 || v2 || v3 || v4;
- };
-
- /**
- * 验证是不是一个日期对象
- * @method isDate
- * @param {Object} val 要检查的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isDate = function (val) {
- if (this.isNull(val)) return false;
- return val instanceof Date;
- };
-
- /**
- * 验证是不是一个正则对象
- * @method isDate
- * @param {Object} val 要检查的对象
- * @return {Boolean} 结果
- * @static
- */
- ntils.isRegexp = function (val) {
- return val instanceof RegExp;
- };
-
- /**
- * 转换为数组
- * @method toArray
- * @param {Array|Object} array 伪数组
- * @return {Array} 转换结果数组
- * @static
- */
- ntils.toArray = function (array) {
- if (this.isNull(array)) return [];
- return Array.prototype.slice.call(array);
- };
-
- /**
- * 转为日期格式
- * @method toDate
- * @param {Number|String} val 日期字符串或整型数值
- * @return {Date} 日期对象
- * @static
- */
- ntils.toDate = function (val) {
- var self = this;
- if (self.isNumber(val))
- return new Date(val);
- else if (self.isString(val))
- return new Date(self.replace(self.replace(val, '-', '/'), 'T', ' '));
- else if (self.isDate(val))
- return val;
- else
- return null;
- };
-
- /**
- * 遍历一个对像或数组
- * @method each
- * @param {Object or Array} obj 要遍历的数组或对象
- * @param {Function} fn 处理函数
- * @return {void} 无返回值
- * @static
- */
- ntils.each = function (list, handler, scope) {
- if (this.isNull(list) || this.isNull(handler)) return;
- if (this.isArray(list)) {
- var listLength = list.length;
- for (var i = 0; i < listLength; i++) {
- var rs = handler.call(scope || list[i], i, list[i]);
- if (!this.isNull(rs)) return rs;
- }
- } else {
- for (var key in list) {
- var rs = handler.call(scope || list[key], key, list[key]);
- if (!this.isNull(rs)) return rs;
- }
- }
- };
-
- /**
- * 格式化日期
- * @method formatDate
- * @param {Date|String|Number} date 日期
- * @param {String} format 格式化字符串
- * @param {object} dict 反译字典
- * @return {String} 格式化结果
- * @static
- */
- ntils.formatDate = function (date, format, dict) {
- if (this.isNull(format) || this.isNull(date)) return date;
- date = this.toDate(date);
- dict = dict || {};
- var placeholder = {
- "M+": date.getMonth() + 1, //month
- "d+": date.getDate(), //day
- "h+": date.getHours(), //hour
- "m+": date.getMinutes(), //minute
- "s+": date.getSeconds(), //second
- "w+": date.getDay(), //week
- "q+": Math.floor((date.getMonth() + 3) / 3), //quarter
- "S": date.getMilliseconds() //millisecond
- }
- if (/(y+)/.test(format)) {
- format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
- }
- for (var key in placeholder) {
- if (new RegExp("(" + key + ")").test(format)) {
- var value = placeholder[key];
- value = dict[value] || value;
- format = format.replace(RegExp.$1, RegExp.$1.length == 1
- ? value : ("00" + value).substr(("" + value).length));
- }
- }
- return format;
- };
-
- /**
- * 拷贝对象
- * @method copy
- * @param {Object} src 源对象
- * @param {Object} dst 目标对象
- * @static
- */
- ntils.copy = function (src, dst, igonres) {
- dst = dst || (this.isArray(src) ? [] : {});
- this.each(src, function (key) {
- if (igonres && igonres.indexOf(key) > -1) return;
- delete dst[key];
- if (Object.getOwnPropertyDescriptor) {
- try {
- Object.defineProperty(dst, key, Object.getOwnPropertyDescriptor(src, key));
- } catch (ex) {
- dst[key] = src[key];
- }
- } else {
- dst[key] = src[key];
- }
- })
- return dst;
- };
-
- /**
- * 深度克隆对象
- * @method clone
- * @param {Object} src 源对象
- * @return {Object} 新对象
- * @static
- */
- ntils.clone = function (src, igonres) {
- if (this.isNull(src) ||
- this.isString(src) ||
- this.isNumber(src) ||
- this.isBoolean(src) ||
- this.isDate(src)) {
- return src;
- }
- var objClone = src;
- try {
- objClone = new src.constructor();
- } catch (ex) { }
- this.each(src, function (key, value) {
- if (objClone[key] != value && !this.contains(igonres, key)) {
- if (this.isObject(value)) {
- objClone[key] = this.clone(value, igonres);
- } else {
- objClone[key] = value;
- }
- }
- }, this);
- ['toString', 'valueOf'].forEach(function (key) {
- if (this.contains(igonres, key)) return;
- this.defineFreezeProp(objClone, key, src[key]);
- }, this);
- return objClone;
- };
-
- /**
- * 合并对象
- * @method mix
- * @return 合并后的对象
- * @param {Object} dst 目标对象
- * @param {Object} src 源对象
- * @param {Array} igonres 忽略的属性名,
- * @param {Number} mode 模式
- */
- ntils.mix = function (dst, src, igonres, mode, igonreNull) {
- //根据模式来判断,默认是Obj to Obj的
- if (mode) {
- switch (mode) {
- case 1: // proto to proto
- return ntils.mix(dst.prototype, src.prototype, igonres, 0);
- case 2: // object to object and proto to proto
- ntils.mix(dst.prototype, src.prototype, igonres, 0);
- break; // pass through
- case 3: // proto to static
- return ntils.mix(dst, src.prototype, igonres, 0);
- case 4: // static to proto
- return ntils.mix(dst.prototype, src, igonres, 0);
- default: // object to object is what happens below
- }
- }
- //---
- src = src || {};
- dst = dst || (this.isArray(src) ? [] : {});
- this.keys(src).forEach(function (key) {
- if (this.contains(igonres, key)) return;
- if (igonreNull && this.isNull(src[key])) return;
- if (this.isObject(src[key]) &&
- (src[key].constructor == Object ||
- src[key].constructor == Array ||
- src[key].constructor == null)) {
- dst[key] = ntils.mix(dst[key], src[key], igonres, 0, igonreNull);
- } else {
- dst[key] = src[key];
- }
- }, this);
- return dst;
- };
-
- /**
- * 定义不可遍历的属性
- **/
- ntils.defineFreezeProp = function (obj, name, value) {
- try {
- Object.defineProperty(obj, name, {
- value: value,
- enumerable: false,
- configurable: true, //能不能重写定义
- writable: false //能不能用「赋值」运算更改
- });
- } catch (err) {
- obj[name] = value;
- }
- };
-
- /**
- * 获取所有 key
- */
- ntils.keys = function (obj) {
- if (Object.keys) return Object.keys(obj);
- var keys = [];
- this.each(obj, function (key) {
- keys.push(key);
- });
- return keys;
- };
-
- /**
- * 创建一个对象
- */
- ntils.create = function (proto, props) {
- if (Object.create) return Object.create(proto, props);
- var Cotr = function () { };
- Cotr.prototype = proto;
- var obj = new Cotr();
- if (props) this.copy(props, obj);
- return obj;
- };
-
- /**
- * 设置 proto
- * 在不支持 setPrototypeOf 也不支持 __proto__ 的浏览器
- * 中,会采用 copy 方式
- */
- ntils.setPrototypeOf = function (obj, proto) {
- if (Object.setPrototypeOf) {
- return Object.setPrototypeOf(obj, proto || this.create(null));
- } else {
- if (!('__proto__' in Object)) this.copy(proto, obj);
- obj.__proto__ = proto;
- }
- };
-
- /**
- * 获取 proto
- */
- ntils.getPrototypeOf = function (obj) {
- if (obj.__proto__) return obj.__proto__;
- if (Object.getPrototypeOf) return Object.getPrototypeOf(obj);
- if (obj.constructor) return obj.constructor.prototype;
- };
-
- /**
- * 是否深度相等
- */
- ntils.deepEqual = function (a, b) {
- if (a === b) return true;
- if (!this.isObject(a) || !this.isObject(b)) return false;
- var aKeys = this.keys(a);
- var bKeys = this.keys(b);
- if (aKeys.length !== bKeys.length) return false;
- var allKeys = aKeys.concat(bKeys);
- var checkedMap = this.create(null);
- var result = true;
- this.each(allKeys, function (i, key) {
- if (checkedMap[key]) return;
- if (!this.deepEqual(a[key], b[key])) result = false;
- checkedMap[key] = true;
- }, this);
- return result;
- };
-
- /**
- * 从一个数值循环到别一个数
- * @param {number} fromNum 开始数值
- * @param {Number} toNum 结束数值
- * @param {Number} step 步长值
- * @param {function} handler 执行函数
- * @returns {void} 无返回
- */
- ntils.fromTo = function (fromNum, toNum, step, handler) {
- if (!handler) handler = [step, step = handler][0];
- step = Math.abs(step || 1);
- if (fromNum < toNum) {
- for (var i = fromNum; i <= toNum; i += step) handler(i);
- } else {
- for (var i = fromNum; i >= toNum; i -= step) handler(i);
- }
- };
-
- /**
- * 生成一个Guid
- * @method newGuid
- * @return {String} GUID字符串
- * @static
- */
- ntils.newGuid = function () {
- var S4 = function () {
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
- };
- return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
- };
-
- /**
- * 对象变换
- **/
- ntils.map = function (list, fn) {
- var buffer = this.isArray(list) ? [] : {};
- this.each(list, function (name, value) {
- buffer[name] = fn(name, value);
- });
- return buffer;
- };
-
- /**
- * 通过路径设置属性值
- */
- ntils.setByPath = function (obj, path, value) {
- if (this.isNull(obj) || this.isNull(path) || path === '') {
- return;
- }
- if (!this.isArray(path)) {
- path = path.replace(/\[/, '.').replace(/\]/, '.').split('.');
- }
- this.each(path, function (index, name) {
- if (this.isNull(name) || name.length < 1) return;
- if (index === path.length - 1) {
- obj[name] = value;
- } else {
- obj[name] = obj[name] || {};
- obj = obj[name];
- }
- }, this);
- };
-
- /**
- * 通过路径获取属性值
- */
- ntils.getByPath = function (obj, path) {
- if (this.isNull(obj) || this.isNull(path) || path === '') {
- return obj;
- }
- if (!this.isArray(path)) {
- path = path.replace(/\[/, '.').replace(/\]/, '.').split('.');
- }
- this.each(path, function (index, name) {
- if (this.isNull(name) || name.length < 1) return;
- if (!this.isNull(obj)) obj = obj[name];
- }, this);
- return obj;
- };
-
- /**
- * 数组去重
- **/
- ntils.unique = function (array) {
- if (this.isNull(array)) return array;
- var newArray = [];
- this.each(array, function (i, value) {
- if (newArray.indexOf(value) > -1) return;
- newArray.push(value);
- });
- return newArray;
- };
-
- /**
- * 解析 function 的参数列表
- **/
- ntils.getFunctionArgumentNames = function (fn) {
- if (!fn) return [];
- var src = fn.toString();
- var parts = src.split(')')[0].split('=>')[0].split('(');
- return (parts[1] || parts[0]).split(',').map(function (name) {
- return name.trim();
- }).filter(function (name) {
- return name != 'function';
- });
- };
-
- /**
- * 缩短字符串
- */
- ntils.short = function (str, maxLength) {
- if (!str) return str;
- maxLength = maxLength || 40;
- var strLength = str.length;
- var trimLength = maxLength / 2;
- return strLength > maxLength ? str.substr(0, trimLength) + '...' + str.substr(strLength - trimLength) : str;
- };
-
- /**
- * 首字母大写
- */
- ntils.firstUpper = function (str) {
- if (this.isNull(str)) return;
- return str.substring(0, 1).toUpperCase() + str.substring(1);
- };
-
- /**
- * 编码正则字符串
- */
- ntils.escapeRegExp = function (str) {
- return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
- };
-
- /**
- * 解析字符串为 dom
- * @param {string} str 字符串
- * @returns {HTMLNode} 解析后的 DOM
- */
- ntils.parseDom = function (str) {
- this._PDD_ = this._PDD_ || document.createElement('div');
- this._PDD_.innerHTML = ntils.trim(str);
- var firstNode = this._PDD_.childNodes[0];
- //先 clone 一份再通过 innerHTML 清空
- //否则 IE9 下,清空时会导出返回的 DOM 没有子结点
- if (firstNode) firstNode = firstNode.cloneNode(true);
- this._PDD_.innerHTML = '';
- return firstNode;
- };
-
- })(( false) ? (window.ntils = {}) : exports);
- /***/ }),
- /* 4 */
- /***/ (function(module, exports, __webpack_require__) {
- const utils = __webpack_require__(3);
-
- function ClassFactory(options) {
- //处理 options
- options = options || utils.create(null);
- options.$name = options.$name || 'Class';
- options.$extends = options.$extends || ClassFactory;
- options.$static = options.$static || utils.create(null);
- //处理父类 prototype
- var superPrototype = utils.isFunction(options.$extends) ?
- options.$extends.prototype : options.$extends;
- //定义新类
- var Class = function () {
- //处理 super
- if (!this.$super) {
- utils.defineFreezeProp(this, '$super', function () {
- if (this._super_called_) return this._super_ret_;
- this._super_called_ = true;
- if (utils.isFunction(options.$extends)) {
- this._super_ret_ = options.$extends.apply(this, arguments);
- //这几行确保可继承于数组
- if (this._super_ret_) {
- var proto = utils.getPrototypeOf(this);
- utils.setPrototypeOf(proto, this._super_ret_);
- }
- } else {
- this._super_ret_ = options.$extends;
- }
- return this._super_ret_;
- });
- for (var name in superPrototype) {
- var value = superPrototype[name];
- if (utils.isFunction(value)) {
- this.$super[name] = value.bind(this);
- } else {
- this.$super[name] = value;
- }
- }
- }
- //调用构造
- if (utils.isFunction(options.constructor) &&
- options.constructor !== Object) {
- return options.constructor.apply(this, arguments);
- } else {
- //如果没有实现 constructor 则调用父类构造
- this.$super.apply(this, arguments);
- }
- };
- //处理 prototype
- Class.prototype = utils.create(superPrototype);
- utils.copy(options, Class.prototype);
- utils.defineFreezeProp(Class.prototype, '$class', Class);
- //处理静态成员
- utils.copy(options.$static, Class);
- if (utils.isFunction(options.$extends)) {
- utils.setPrototypeOf(Class, options.$extends);
- }
- if (!options.$extends.$extend) {
- utils.copy(ClassFactory, Class);
- }
- utils.defineFreezeProp(Class, '$super', options.$extends);
- //--
- return Class;
- }
-
- //定义扩展方法
- ClassFactory.$extend = function (options) {
- options.$extends = this;
- return new ClassFactory(options);
- };
-
- ClassFactory.Class = ClassFactory;
- module.exports = ClassFactory;
- /***/ }),
- /* 5 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Class = __webpack_require__(4);
- var utils = __webpack_require__(3);
-
- /**
- * Watcher 类
- * 通过「计算函数」、「执行函数」可以创建一个 Watcher 实例
- */
- var Watcher = new Class({
-
- /**
- * 通过「计算函数」、「执行函数」构建一个 Watcher 实例
- * @param {function} calcor 计算函数
- * @param {function} handler 处理函数
- * @param {boolean} first 是否自动执行第一次
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(calcor, handler, first) {
- if (!utils.isFunction(calcor) || !utils.isFunction(handler)) {
- throw new Error('Invalid parameters');
- }
- this.calcor = calcor;
- this.handler = handler;
- if (first) this.calc(true);
- },
-
- /**
- * 执行计算
- * @param {boolean} force 是否强制触发「计算函数」
- * @returns {Object} 计算后的值
- */
- calc: function /*istanbul ignore next*/calc(force) {
- var newValue = this.calcor();
- if (force || !utils.deepEqual(newValue, this.value)) {
- this.handler(newValue, this.value);
- }
- this.value = utils.clone(newValue);
- }
-
- });
-
- module.exports = Watcher;
- /***/ }),
- /* 6 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- /*istanbul ignore next*/var _keys = __webpack_require__(7);
-
- var _keys2 = _interopRequireDefault(_keys);
-
- var _getOwnPropertyDescriptor = __webpack_require__(42);
-
- var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
-
- var _defineProperty = __webpack_require__(47);
-
- var _defineProperty2 = _interopRequireDefault(_defineProperty);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- var Class = __webpack_require__(4);
- var utils = __webpack_require__(3);
- var EventEmitter = __webpack_require__(50);
-
- var OBSERVER_PROP_NAME = '_observer_';
- var CHANGE_EVENT_NAME = 'change';
- var EVENT_MAX_DISPATCH_LAYER = 10;
- var IGNORE_REGEXPS = [/^\_(.*)\_$/i, /^\_\_/i];
-
- /**
- * 对象观察类,可以监控对象变化
- * 目前方案问题:
- * 对于父子关系和事件冒泡,目前方案如果用 delete 删除一个属性,无关真实删除关系,
- * 即便调用 clearReference 也无法再清除关系,子对象的 parents 中会一直有一个引用,当前方案最高效
- * 其它方法一:
- * 将「关系」放入全局数组中,然后将 ob.parents 变成一个「属性」从全局数组件中 filter 出来,
- * 基本和目前方法类似,但是关系在外部存领教,所以 clearReference 可清除。
- * 其它方案二:
- * 构造时添加到全局数组,每一个 observer change 时都让放到全局的 observer 遍历自身的,
- * 检果事件源是不是自已的子对象,如果是则触发自身 change 事件,这样 ob 对象本身没有相关引用
- * clearReference 时只从全局清除掉就行了,并且 delete 操作也不会影响,但效率稍差。
- * 其它方案三:
- * 给构造函数添加一个 deep 属性,只有 deep 的 ob 对象,才放入到全局数组中,检查时逻辑同方案二
- * 但是因为要检查的对象会少很多,效率会更高一点。
- */
- var Observer = new Class({
- $extends: EventEmitter,
-
- /**
- * 通过目标对象构造一个观察对象
- * @param {Object} target 目标对象
- * @param {Object} options 选项
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(target, options) {
- if (utils.isNull(target)) {
- throw new Error('Invalid target');
- }
- options = options || {};
- var observer = target[OBSERVER_PROP_NAME];
- if (observer) {
- utils.copy(options, observer.options);
- //当时一个组件 A 的为组件 B 的 prop 时,A 更新不会触发 B 更新
- //所在暂注释这里,另一种方法是更新 prop 指令,重写 excute 方法,而不是现在的 update 方法
- // if (observer.options.root) {
- // observer.parents.length = 0;
- // }
- observer.apply();
- return observer;
- }
- EventEmitter.call(this);
- utils.defineFreezeProp(this, 'options', options);
- utils.defineFreezeProp(this, 'shadow', {});
- utils.defineFreezeProp(this, 'target', target);
- utils.defineFreezeProp(this, 'parents', []);
- utils.defineFreezeProp(target, OBSERVER_PROP_NAME, this);
- this.apply();
- },
-
- /**
- * 添加一个属性,动态添中的属性,无法被观察,
- * 但是通过 set 方法添加的属性可能被观察。
- * @param {string} name 名称
- * @param {Object} value 值
- * @returns {void} 无返回
- */
- set: function /*istanbul ignore next*/set(name, value) {
- if (utils.isFunction(value) || Observer.isIgnore(name)) {
- return;
- }
- /*istanbul ignore next*/(0, _defineProperty2.default)(this.target, name, {
- get: function /*istanbul ignore next*/get() {
- return this[OBSERVER_PROP_NAME].shadow[name];
- },
- set: function /*istanbul ignore next*/set(value) {
- var observer = this[OBSERVER_PROP_NAME];
- var oldValue = observer.shadow[name];
- if (oldValue === value) return;
- if (utils.isObject(value)) {
- var childObserver = new Observer(value);
- observer.addChild(childObserver, name);
- }
- //移除旧值的父引用
- //如果用 delete 删除属性将无法移除父子引用
- if (oldValue && oldValue[OBSERVER_PROP_NAME]) {
- observer.removeChild(oldValue[OBSERVER_PROP_NAME], name);
- }
- observer.shadow[name] = value;
- observer.emitChange({ path: name, value: value });
- },
- configurable: true,
- enumerable: true
- });
- this.target[name] = value;
- },
-
- /**
- * 自动应用所有动态添加的属性
- * @returns {void} 无返回
- */
- apply: function /*istanbul ignore next*/apply() {
- if (utils.isArray(this.target)) {
- this._wrapArray(this.target);
- }
- var names = this._getPropertyNames(this.target);
- names.forEach(function (name) {
- var desc = /*istanbul ignore next*/(0, _getOwnPropertyDescriptor2.default)(this.target, name);
- if (!('value' in desc)) return;
- this.set(name, this.target[name]);
- }, this);
- },
-
- /**
- * 清除所有父子引用
- * @returns {void} 无返回
- */
- clearReference: function /*istanbul ignore next*/clearReference() {
- utils.each(this.target, function (name, value) {
- if (utils.isNull(value)) return;
- var child = value[OBSERVER_PROP_NAME];
- if (child) this.removeChild(child);
- }, this);
- },
-
- /**
- * 派发一个事件,事件会向父级对象冒泡
- * @param {string} eventName 事件名称
- * @param {Object} event 事件对象
- * @returns {void} 无返回
- */
- dispatch: function /*istanbul ignore next*/dispatch(eventName, event) {
- if (event._src_ === this) return;
- event._src_ = event._src_ || this;
- event._layer_ = event._layer_ || 0;
- if (event._layer_++ >= EVENT_MAX_DISPATCH_LAYER) return;
- this.emit(eventName, event);
- if (!this.parents || this.parents.length < 1) return;
- this.parents.forEach(function (item) {
- if (!(item.name in item.parent.target)) {
- return item.parent.removeChild(this);
- }
- var parentEvent = utils.copy(event);
- parentEvent.path = item.name + '.' + event.path;
- item.parent.dispatch(eventName, parentEvent);
- }, this);
- },
-
- /**
- * 添子观察者对象
- * @param {Object} child 父对象
- * @param {String} name 属性名
- * @returns {void} 无返回
- */
- addChild: function /*istanbul ignore next*/addChild(child, name) {
- if (utils.isNull(child) || utils.isNull(name)) {
- throw new Error('Invalid paramaters');
- }
- if (child.options.root) return;
- child.parents.push({ parent: this, name: name });
- },
-
- /**
- * 移除子对象
- * @param {Object} child 父对象
- * @param {String} name 属性名
- * @returns {void} 无返回
- */
- removeChild: function /*istanbul ignore next*/removeChild(child, name) {
- if (utils.isNull(child)) {
- throw new Error('Invalid paramaters');
- }
- var foundIndex = -1;
- child.parents.forEach(function (item, index) {
- if (item.parent === this && item.name === name) {
- foundIndex = index;
- }
- }, this);
- if (foundIndex > -1) {
- child.parents.splice(foundIndex, 1);
- }
- },
-
- /**
- * 触发 change 事件
- * @param {Object} event 事件对象
- * @returns {void} 无返回
- */
- emitChange: function /*istanbul ignore next*/emitChange(event) {
- this.dispatch(CHANGE_EVENT_NAME, event);
- },
-
- /**
- * 获取所有成员名称列表
- * @returns {Array} 所有成员名称列表
- */
- _getPropertyNames: function /*istanbul ignore next*/_getPropertyNames() {
- var names = utils.isArray(this.target) ? this.target.map(function (item, index) {
- return index;
- }) : /*istanbul ignore next*/(0, _keys2.default)(this.target);
- return names.filter(function (name) {
- return name !== OBSERVER_PROP_NAME;
- });
- },
-
- /**
- * 包裹数组
- * @param {array} array 源数组
- * @returns {array} 处理后的数组
- */
- _wrapArray: function /*istanbul ignore next*/_wrapArray(array) {
- utils.defineFreezeProp(array, 'push', function () {
- var items = [].slice.call(arguments);
- items.forEach(function (item) {
- //这里也会触发对应 index 的 change 事件
- this[OBSERVER_PROP_NAME].set(array.length, item);
- }, this);
- this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
- });
- utils.defineFreezeProp(array, 'pop', function () {
- var item = [].pop.apply(this, arguments);
- this[OBSERVER_PROP_NAME].emitChange({ path: this.length, value: item });
- this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
- return item;
- });
- utils.defineFreezeProp(array, 'unshift', function () {
- var items = [].slice.call(arguments);
- items.forEach(function (item) {
- //这里也会触发对应 index 的 change 事件
- this[OBSERVER_PROP_NAME].set(0, item);
- }, this);
- this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
- });
- utils.defineFreezeProp(array, 'shift', function () {
- var item = [].shift.apply(this, arguments);
- this[OBSERVER_PROP_NAME].emitChange({ path: 0, value: item });
- this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
- return item;
- });
- utils.defineFreezeProp(array, 'splice', function () {
- var startIndex = arguments[0];
- var endIndex = utils.isNull(arguments[1]) ? startIndex + arguments[1] : this.length - 1;
- var items = [].splice.apply(this, arguments);
- for (var i = startIndex; i <= endIndex; i++) {
- this[OBSERVER_PROP_NAME].emitChange({ path: i, value: items[i - startIndex] });
- }
- this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
- return items;
- });
- utils.defineFreezeProp(array, 'set', function (index, value) {
- if (index >= this.length) {
- this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
- }
- this[OBSERVER_PROP_NAME].set(index, value);
- });
- }
-
- });
-
- /**
- * 观察一个对象
- * @param {Object} target 目标对象
- * @return {Observer} 观察者对象
- */
- Observer.observe = function (target) {
- return new Observer(target);
- };
-
- /**
- * 检查是不是忽略的属性名
- * @param {string} word 待检查的字符串
- * @returns {void} 无返回
- */
- Observer.isIgnore = function (word) {
- return IGNORE_REGEXPS.some(function (re) /*istanbul ignore next*/{
- return re.test(word);
- });
- };
-
- module.exports = Observer;
- /***/ }),
- /* 7 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = { "default": __webpack_require__(8), __esModule: true };
- /***/ }),
- /* 8 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(9);
- module.exports = __webpack_require__(29).Object.keys;
- /***/ }),
- /* 9 */
- /***/ (function(module, exports, __webpack_require__) {
- // 19.1.2.14 Object.keys(O)
- var toObject = __webpack_require__(10);
- var $keys = __webpack_require__(12);
-
- __webpack_require__(27)('keys', function () {
- return function keys(it) {
- return $keys(toObject(it));
- };
- });
- /***/ }),
- /* 10 */
- /***/ (function(module, exports, __webpack_require__) {
- // 7.1.13 ToObject(argument)
- var defined = __webpack_require__(11);
- module.exports = function (it) {
- return Object(defined(it));
- };
- /***/ }),
- /* 11 */
- /***/ (function(module, exports) {
- // 7.2.1 RequireObjectCoercible(argument)
- module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- /***/ }),
- /* 12 */
- /***/ (function(module, exports, __webpack_require__) {
- // 19.1.2.14 / 15.2.3.14 Object.keys(O)
- var $keys = __webpack_require__(13);
- var enumBugKeys = __webpack_require__(26);
-
- module.exports = Object.keys || function keys(O) {
- return $keys(O, enumBugKeys);
- };
- /***/ }),
- /* 13 */
- /***/ (function(module, exports, __webpack_require__) {
- var has = __webpack_require__(14);
- var toIObject = __webpack_require__(15);
- var arrayIndexOf = __webpack_require__(18)(false);
- var IE_PROTO = __webpack_require__(22)('IE_PROTO');
-
- module.exports = function (object, names) {
- var O = toIObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- return result;
- };
- /***/ }),
- /* 14 */
- /***/ (function(module, exports) {
- var hasOwnProperty = {}.hasOwnProperty;
- module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- /***/ }),
- /* 15 */
- /***/ (function(module, exports, __webpack_require__) {
- // to indexed object, toObject with fallback for non-array-like ES3 strings
- var IObject = __webpack_require__(16);
- var defined = __webpack_require__(11);
- module.exports = function (it) {
- return IObject(defined(it));
- };
- /***/ }),
- /* 16 */
- /***/ (function(module, exports, __webpack_require__) {
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- var cof = __webpack_require__(17);
- // eslint-disable-next-line no-prototype-builtins
- module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return cof(it) == 'String' ? it.split('') : Object(it);
- };
- /***/ }),
- /* 17 */
- /***/ (function(module, exports) {
- var toString = {}.toString;
-
- module.exports = function (it) {
- return toString.call(it).slice(8, -1);
- };
- /***/ }),
- /* 18 */
- /***/ (function(module, exports, __webpack_require__) {
- // false -> Array#indexOf
- // true -> Array#includes
- var toIObject = __webpack_require__(15);
- var toLength = __webpack_require__(19);
- var toAbsoluteIndex = __webpack_require__(21);
- module.exports = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- /***/ }),
- /* 19 */
- /***/ (function(module, exports, __webpack_require__) {
- // 7.1.15 ToLength
- var toInteger = __webpack_require__(20);
- var min = Math.min;
- module.exports = function (it) {
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
- };
- /***/ }),
- /* 20 */
- /***/ (function(module, exports) {
- // 7.1.4 ToInteger
- var ceil = Math.ceil;
- var floor = Math.floor;
- module.exports = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
- };
- /***/ }),
- /* 21 */
- /***/ (function(module, exports, __webpack_require__) {
- var toInteger = __webpack_require__(20);
- var max = Math.max;
- var min = Math.min;
- module.exports = function (index, length) {
- index = toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
- };
- /***/ }),
- /* 22 */
- /***/ (function(module, exports, __webpack_require__) {
- var shared = __webpack_require__(23)('keys');
- var uid = __webpack_require__(25);
- module.exports = function (key) {
- return shared[key] || (shared[key] = uid(key));
- };
- /***/ }),
- /* 23 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(24);
- var SHARED = '__core-js_shared__';
- var store = global[SHARED] || (global[SHARED] = {});
- module.exports = function (key) {
- return store[key] || (store[key] = {});
- };
- /***/ }),
- /* 24 */
- /***/ (function(module, exports) {
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global = module.exports = typeof window != 'undefined' && window.Math == Math
- ? window : typeof self != 'undefined' && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
- if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
- /***/ }),
- /* 25 */
- /***/ (function(module, exports) {
- var id = 0;
- var px = Math.random();
- module.exports = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
- };
- /***/ }),
- /* 26 */
- /***/ (function(module, exports) {
- // IE 8- don't enum bug keys
- module.exports = (
- 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
- ).split(',');
- /***/ }),
- /* 27 */
- /***/ (function(module, exports, __webpack_require__) {
- // most Object methods by ES6 should accept primitives
- var $export = __webpack_require__(28);
- var core = __webpack_require__(29);
- var fails = __webpack_require__(38);
- module.exports = function (KEY, exec) {
- var fn = (core.Object || {})[KEY] || Object[KEY];
- var exp = {};
- exp[KEY] = exec(fn);
- $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
- };
- /***/ }),
- /* 28 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(24);
- var core = __webpack_require__(29);
- var ctx = __webpack_require__(30);
- var hide = __webpack_require__(32);
- var PROTOTYPE = 'prototype';
-
- var $export = function (type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var IS_WRAP = type & $export.W;
- var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
- var expProto = exports[PROTOTYPE];
- var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
- var key, own, out;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- if (own && key in exports) continue;
- // export native or passed
- out = own ? target[key] : source[key];
- // prevent global pollution for namespaces
- exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
- // bind timers to global for call from export context
- : IS_BIND && own ? ctx(out, global)
- // wrap global constructors for prevent change them in library
- : IS_WRAP && target[key] == out ? (function (C) {
- var F = function (a, b, c) {
- if (this instanceof C) {
- switch (arguments.length) {
- case 0: return new C();
- case 1: return new C(a);
- case 2: return new C(a, b);
- } return new C(a, b, c);
- } return C.apply(this, arguments);
- };
- F[PROTOTYPE] = C[PROTOTYPE];
- return F;
- // make static versions for prototype methods
- })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
- if (IS_PROTO) {
- (exports.virtual || (exports.virtual = {}))[key] = out;
- // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
- if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
- }
- }
- };
- // type bitmap
- $export.F = 1; // forced
- $export.G = 2; // global
- $export.S = 4; // static
- $export.P = 8; // proto
- $export.B = 16; // bind
- $export.W = 32; // wrap
- $export.U = 64; // safe
- $export.R = 128; // real proto method for `library`
- module.exports = $export;
- /***/ }),
- /* 29 */
- /***/ (function(module, exports) {
- var core = module.exports = { version: '2.5.1' };
- if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
- /***/ }),
- /* 30 */
- /***/ (function(module, exports, __webpack_require__) {
- // optional / simple context binding
- var aFunction = __webpack_require__(31);
- module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- /***/ }),
- /* 31 */
- /***/ (function(module, exports) {
- module.exports = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
- };
- /***/ }),
- /* 32 */
- /***/ (function(module, exports, __webpack_require__) {
- var dP = __webpack_require__(33);
- var createDesc = __webpack_require__(41);
- module.exports = __webpack_require__(37) ? function (object, key, value) {
- return dP.f(object, key, createDesc(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- /***/ }),
- /* 33 */
- /***/ (function(module, exports, __webpack_require__) {
- var anObject = __webpack_require__(34);
- var IE8_DOM_DEFINE = __webpack_require__(36);
- var toPrimitive = __webpack_require__(40);
- var dP = Object.defineProperty;
-
- exports.f = __webpack_require__(37) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return dP(O, P, Attributes);
- } catch (e) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- /***/ }),
- /* 34 */
- /***/ (function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(35);
- module.exports = function (it) {
- if (!isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
- };
- /***/ }),
- /* 35 */
- /***/ (function(module, exports) {
- module.exports = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
- /***/ }),
- /* 36 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = !__webpack_require__(37) && !__webpack_require__(38)(function () {
- return Object.defineProperty(__webpack_require__(39)('div'), 'a', { get: function () { return 7; } }).a != 7;
- });
- /***/ }),
- /* 37 */
- /***/ (function(module, exports, __webpack_require__) {
- // Thank's IE8 for his funny defineProperty
- module.exports = !__webpack_require__(38)(function () {
- return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
- });
- /***/ }),
- /* 38 */
- /***/ (function(module, exports) {
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
- };
- /***/ }),
- /* 39 */
- /***/ (function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(35);
- var document = __webpack_require__(24).document;
- // typeof document.createElement is 'object' in old IE
- var is = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return is ? document.createElement(it) : {};
- };
- /***/ }),
- /* 40 */
- /***/ (function(module, exports, __webpack_require__) {
- // 7.1.1 ToPrimitive(input [, PreferredType])
- var isObject = __webpack_require__(35);
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- module.exports = function (it, S) {
- if (!isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
- };
- /***/ }),
- /* 41 */
- /***/ (function(module, exports) {
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- /***/ }),
- /* 42 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = { "default": __webpack_require__(43), __esModule: true };
- /***/ }),
- /* 43 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(44);
- var $Object = __webpack_require__(29).Object;
- module.exports = function getOwnPropertyDescriptor(it, key) {
- return $Object.getOwnPropertyDescriptor(it, key);
- };
- /***/ }),
- /* 44 */
- /***/ (function(module, exports, __webpack_require__) {
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- var toIObject = __webpack_require__(15);
- var $getOwnPropertyDescriptor = __webpack_require__(45).f;
-
- __webpack_require__(27)('getOwnPropertyDescriptor', function () {
- return function getOwnPropertyDescriptor(it, key) {
- return $getOwnPropertyDescriptor(toIObject(it), key);
- };
- });
- /***/ }),
- /* 45 */
- /***/ (function(module, exports, __webpack_require__) {
- var pIE = __webpack_require__(46);
- var createDesc = __webpack_require__(41);
- var toIObject = __webpack_require__(15);
- var toPrimitive = __webpack_require__(40);
- var has = __webpack_require__(14);
- var IE8_DOM_DEFINE = __webpack_require__(36);
- var gOPD = Object.getOwnPropertyDescriptor;
-
- exports.f = __webpack_require__(37) ? gOPD : function getOwnPropertyDescriptor(O, P) {
- O = toIObject(O);
- P = toPrimitive(P, true);
- if (IE8_DOM_DEFINE) try {
- return gOPD(O, P);
- } catch (e) { /* empty */ }
- if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
- };
- /***/ }),
- /* 46 */
- /***/ (function(module, exports) {
- exports.f = {}.propertyIsEnumerable;
- /***/ }),
- /* 47 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = { "default": __webpack_require__(48), __esModule: true };
- /***/ }),
- /* 48 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(49);
- var $Object = __webpack_require__(29).Object;
- module.exports = function defineProperty(it, key, desc) {
- return $Object.defineProperty(it, key, desc);
- };
- /***/ }),
- /* 49 */
- /***/ (function(module, exports, __webpack_require__) {
- var $export = __webpack_require__(28);
- // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
- $export($export.S + $export.F * !__webpack_require__(37), 'Object', { defineProperty: __webpack_require__(33).f });
- /***/ }),
- /* 50 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var utils = __webpack_require__(3);
- var Class = __webpack_require__(4);
-
- /**
- * 事件触发器基类
- */
- var EventEmitter = new Class({
- $extends: Function,
-
- /**
- * 构建一个一个事修的触发器对象
- * @param {object} target 将代理的目标对象可以省略
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(target) {
- target = target || this;
- var emitter = target._emitter_;
- if (emitter) return emitter;
- utils.defineFreezeProp(this, '_target_', target);
- utils.defineFreezeProp(target, '_emitter_', this);
- this._isNative_ = this._isNativeObject(this._target_);
- this._listeners_ = this._listeners_ || {};
- this.on = this.$on = this.$addListener = this.addListener;
- this.off = this.$off = this.$removeListener = this.removeListener;
- this.$emit = this.emit;
- },
-
- /**
- * 检查是否原生支持事件
- * @param {object} obj 对象
- * @returns {void} 检查结果
- */
- _isNativeObject: function /*istanbul ignore next*/_isNativeObject(obj) {
- return obj.addEventListener && obj.removeEventListener && obj.dispatchEvent;
- },
-
- /**
- * 添加一个事件监听函数
- * @param {string} name 事件名称
- * @param {function} listener 事件处理函数
- * @param {capture} capture 是否是捕获阶段事件(只在代理 dom 对象时有效)
- * @returns {void} 无返回
- */
- addListener: function /*istanbul ignore next*/addListener(name, listener, capture) {
- if (this._isNative_) {
- this._addNativeEventListener(name, listener, capture);
- }
- this._listeners_[name] = this._listeners_[name] || [];
- this._listeners_[name].push(listener);
- if (this._listeners_[name].length > EventEmitter._maxListeners) {
- throw new Error('The `' + name + '` event listener is not more than 10');
- }
- },
-
- /**
- * 移除「一个/一组/所有」事件监听函数
- * @param {string} name 事件名称
- * @param {function} listener 事件处理函数
- * @param {capture} capture 是否是捕获阶段事件(只在代理 dom 对象时有效)
- * @returns {void} 无返回
- */
- removeListener: function /*istanbul ignore next*/removeListener(name, listener, capture) {
- if (name && listener) {
- if (this._isNative_) {
- this._removeNativeEventListener(name, listener, capture);
- }
- if (!this._listeners_[name]) return;
- var index = this._listeners_[name].indexOf(listener);
- this._listeners_[name].splice(index, 1);
- } else if (name) {
- if (this._isNative_ && this._listeners_[name]) {
- this._listeners_[name].forEach(function (_listener) {
- this.removeListener(name, _listener, capture);
- }, this);
- }
- delete this._listeners_[name];
- } else {
- utils.each(this._listeners_, function (name) {
- this.removeListener(name, null, capture);
- }, this);
- this._listeners_ = {};
- }
- },
-
- /**
- * 触发自身的一个事件
- * @param {string} name 事件名称
- * @param {object} data 传递的对象
- * @param {string} canBubble 能否冒泡(只在代理 dom 对象时有效)
- * @param {object} cancelAble 能否取消(只在代理 dom 对象时有效)
- * @returns {void} 无返回
- */
- emit: function /*istanbul ignore next*/emit(name, data, canBubble, cancelAble) {
- if (this._isNative_) {
- return this._emitNativeEvent(name, data, canBubble, cancelAble);
- }
- if (!this._listeners_[name]) return;
- var stopPropagation = false;
- this._listeners_[name].forEach(function (handler) {
- var rs = handler.call(this._target_, data);
- if (rs === false) stopPropagation = true;
- }, this);
- return stopPropagation;
- },
-
- /**
- * 添加 DOM 元素事件
- * @param {string} name 事件名称
- * @param {function} listener 事件处理函数
- * @param {capture} capture 是否是捕获阶段事件
- * @returns {void} 无返回
- */
- _addNativeEventListener: function /*istanbul ignore next*/_addNativeEventListener(name, listener, capture) {
- this._target_.addEventListener(name, listener, capture);
- //如果存在已注册的自定义 “组合事件”
- var descriptor = EventEmitter._events[name];
- if (descriptor) {
- descriptor.addListener = descriptor.addListener || descriptor.on;
- descriptor.addListener(this, name, listener, capture);
- }
- },
-
- /**
- * 移除 DOM 元素事件
- * @param {string} name 事件名称
- * @param {function} listener 事件处理函数
- * @param {capture} capture 是否是捕获阶段事件
- * @returns {void} 无返回
- */
- _removeNativeEventListener: function /*istanbul ignore next*/_removeNativeEventListener(name, listener, capture) {
- this._target_.removeEventListener(name, listener, capture);
- //如果存在已注册的自定义 “组合事件”
- var descriptor = EventEmitter._events[name];
- if (descriptor) {
- descriptor.removeListener = descriptor.removeListener || descriptor.off;
- descriptor.removeListener(this, name, listener, capture);
- }
- },
-
- /**
- * 触发 DOM 元素事件
- * @param {string} name 事件名称
- * @param {object} data 传递的对象
- * @param {string} canBubble 能否冒泡
- * @param {object} cancelAble 能否取消
- * @returns {void} 无返回
- */
- _emitNativeEvent: function /*istanbul ignore next*/_emitNativeEvent(name, data, canBubble, cancelAble) {
- var event = document.createEvent('HTMLEvents');
- event.initEvent(name, canBubble, cancelAble);
- utils.copy(data, event, ['data']);
- event.data = data;
- return this._target_.dispatchEvent(event);
- }
-
- });
-
- //最多添加多少个 listener
- EventEmitter._maxListeners = 10;
-
- //所有自定义事件
- EventEmitter._events = [];
-
- /**
- * 注册自定义事件(只在代理 dom 对象时有效)
- * @param {object} descriptor 事件定义
- * @returns {void} 无返回
- */
- EventEmitter.register = function (descriptor) {
- var names = descriptor.name;
- if (!names) return;
- if (!utils.isArray(names)) names = names.split(',');
- names.forEach(function (name) {
- this._events[name] = descriptor;
- }, this);
- };
-
- module.exports = EventEmitter;
- /***/ }),
- /* 51 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Compiler = __webpack_require__(52);
- var Directive = __webpack_require__(53);
- var Expression = __webpack_require__(54);
- var Template = __webpack_require__(78);
- var directives = __webpack_require__(55);
-
- Template.Template = Template;
- Template.Compiler = Compiler;
- Template.Directive = Directive;
- Template.directives = directives;
- Template.Expression = Expression;
-
- module.exports = Template;
- /***/ }),
- /* 52 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Class = __webpack_require__(4);
- var Directive = __webpack_require__(53);
- var utils = __webpack_require__(3);
- var Expression = __webpack_require__(54);
- var commonDirectives = __webpack_require__(55);
-
- var DEFAULT_PREFIX = 'm';
-
- /**
- * 模板编译器
- * 可以通过指定「前缀」或「指令集」构建实例
- */
- var Compiler = new Class({
-
- /**
- * 构造一个编译器
- * @param {Object} options 选项
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(options) {
- options = options || {};
- this.prefix = options.prefix || DEFAULT_PREFIX;
- this.elementDirectives = {};
- this.attributeDirectives = {};
- this.registerDirectives(commonDirectives);
- this.registerDirectives(options.directives);
- },
-
- /**
- * 将字符串转成「驼峰」式
- * @param {string} str 原始字符串
- * @param {number} mode 1 大驼峰,0 小驼峰
- * @return {string} 转换后的字符串
- */
- toCamelCase: function /*istanbul ignore next*/toCamelCase(str, mode) {
- if (str) {
- str = str.replace(/\-[a-z0-9]/g, function ($1) /*istanbul ignore next*/{
- return $1.slice(1).toUpperCase();
- });
- str = str.replace(/^[a-z]/i, function ($1) {
- return mode ? $1.toUpperCase() : $1.toLowerCase();
- });
- }
- return str;
- },
-
- /**
- * 将字符串转成分隔形式
- * @param {string} str 原始字符串
- * @return {string} 转换后的字符串
- */
- toSplitCase: function /*istanbul ignore next*/toSplitCase(str) {
- if (str) {
- str = str.replace(/([A-Z])/g, '-$1');
- if (str[0] == '-') str = str.slice(1);
- }
- return str;
- },
-
- /**
- * 添加指令
- * @param {Object} directives 指令集
- * @returns {void} 无返回
- */
- registerDirectives: function /*istanbul ignore next*/registerDirectives(directives) {
- utils.each(directives, function (name, directive) {
- name = this.toSplitCase(name);
- var fullName = directive.options.prefix === false ? name : /*istanbul ignore next*/this.prefix + ':' + name;
- if (directive.options.type == Directive.TE) {
- this.elementDirectives[fullName.toUpperCase()] = directive;
- } else {
- this.attributeDirectives[fullName.toLowerCase()] = directive;
- }
- }, this);
- },
-
- /**
- * 解析要 attr 指令信息
- * @param {string} attrName 要解析的名称字符串
- * @returns {Object} 解析后的对象
- */
- _parseAttrInfo: function /*istanbul ignore next*/_parseAttrInfo(attrName) {
- /*istanbul ignore next*/var _this = this;
-
- var parts = attrName.toLowerCase().split(':');
- var info = {};
- if (parts.length > 1) {
- info.name = /*istanbul ignore next*/parts[0] + ':' + parts[1];
- info.decorates = parts.slice(2).map(function (item) /*istanbul ignore next*/{
- return (/*istanbul ignore next*/_this.toCamelCase(item)
- );
- });
- } else {
- info.name = parts[0];
- info.decorates = [];
- }
- return info;
- },
-
- /**
- * 创建一个指令实例
- * @param {Directive} Directive 指令类
- * @param {Object} options 指令构建选项
- * @returns {Directive} 指令实例
- */
- _createDirectiveInstance: function /*istanbul ignore next*/_createDirectiveInstance(Directive, options) {
- options.compiler = this;
- options.prefix = this.prefix;
- return new Directive(options);
- },
-
- /**
- * 初始化一个编译完成的 handler
- * @param {function} handler 编译后的的模板函数
- * @returns {void} 无返回
- */
- _bindHandler: function /*istanbul ignore next*/_bindHandler(handler) {
- //排序 directives
- handler.directives = handler.directives.sort(function (a, b) {
- return b.level - a.level;
- });
- //初始化 directives
- var boundDirectives = [];
- utils.each(handler.directives, function (index, directive) {
- directive.index = index;
- directive.bind();
- boundDirectives.push(directive);
- //移除完成绑定的指令对应的 attribute
- if (directive.remove !== false && directive.attribute) {
- directive.node.removeAttribute(directive.attribute.name);
- }
- //如果遇到一个「终态」指令,停止向下初始化
- if (directive.final) {
- return handler.final = true;
- }
- }, this);
- handler.directives = boundDirectives;
- },
-
- /**
- * 编译一个元素本身
- * @param {function} handler 当前模板函数
- * @param {HTMLNode} node 当前 HTML 结点
- * @returns {void} 无返回
- */
- _compileElement: function /*istanbul ignore next*/_compileElement(handler, node) {
- var ElementDirective = this.elementDirectives[node.nodeName.toUpperCase()];
- if (!ElementDirective) return;
- handler.directives.push(this._createDirectiveInstance(ElementDirective, {
- handler: handler,
- node: node
- }));
- },
-
- /**
- * 编译一个元素所有 attributes
- * @param {function} handler 当前模板函数
- * @param {HTMLNode} node 当前 HTML 结点
- * @returns {void} 无返回
- */
- _compileAttributes: function /*istanbul ignore next*/_compileAttributes(handler, node) {
- utils.toArray(node.attributes).forEach(function (attribute) {
- var attrInfo = this._parseAttrInfo(attribute.name);
- var AttrDirective = this.attributeDirectives[attrInfo.name] || this.attributeDirectives['*'];
- if (!AttrDirective) return;
- var directiveOptions = AttrDirective.options;
- handler.directives.push(this._createDirectiveInstance(AttrDirective, {
- handler: handler,
- node: node,
- attribute: attribute,
- expression: directiveOptions.literal ? attribute.value : new Expression(attribute.value, directiveOptions.mixed),
- decorates: attrInfo.decorates
- }));
- }, this);
- },
-
- /**
- * 编译所有子结点
- * @param {function} handler 当前模板函数
- * @param {HTMLNode} node 当前 HTML 结点
- * @returns {void} 无返回
- */
- _compileChildren: function /*istanbul ignore next*/_compileChildren(handler, node) {
- if (handler.final) return;
- utils.toArray(node.childNodes).forEach(function (childNode) {
- if (childNode._compiled_) return;
- var childHandler = this.compile(childNode);
- childHandler.parent = this;
- handler.children.push(childHandler);
- }, this);
- },
-
- /**
- * 编译一个模板
- * @param {HTMLNode} node 模板根元素
- * @param {Object} options 选项
- * @returns {function} 模板函数
- */
- compile: function /*istanbul ignore next*/compile(node, options) {
- if (!node) {
- throw new Error('Invalid node for compile');
- }
- node._compiled_ = true;
- options = options || {};
- //定义编译结果函数
- var handler = function handler(scope) {
- if (utils.isNull(scope)) scope = {};
- handler.directives.forEach(function (directive) {
- directive.scope = scope;
- directive.execute(scope);
- }, this);
- handler.children.forEach(function (childHandler) {
- childHandler(scope);
- }, this);
- };
- //--
- handler.dispose = function () {
- handler.directives.forEach(function (directive) {
- directive.unbind();
- }, this);
- handler.children.forEach(function (childHandler) {
- childHandler.dispose();
- }, this);
- };
- handler.node = node;
- //定义 children & directives
- handler.directives = [];
- handler.children = [];
- //编译相关指令
- if (options.element !== false) this._compileElement(handler, node);
- if (options.attribute !== false) this._compileAttributes(handler, node);
- this._bindHandler(handler);
- if (options.children !== false) this._compileChildren(handler, node);
- //返回编译后函数
- return handler;
- }
-
- });
-
- module.exports = Compiler;
- /***/ }),
- /* 53 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Class = __webpack_require__(4);
- var utils = __webpack_require__(3);
- var Expression = __webpack_require__(54);
-
- /**
- * 指令定义工场函数
- * @param {Object} classOptions 选项
- * @returns {Directive} 指令类
- */
- function Directive(classOptions) {
- //处理指令选项
- classOptions = classOptions || {};
- classOptions.type = classOptions.type || Directive.TA;
- classOptions.level = classOptions.level || Directive.LG;
-
- //生成指令类
- var DirectiveClass = new Class({
-
- $extends: classOptions,
- //指令构建函数
- constructor: function /*istanbul ignore next*/constructor(instanceOptions) {
- utils.copy(instanceOptions, this);
- },
- //挂载实例上的 options
- options: classOptions,
- //挂载实例核心方法
- bind: classOptions.bind || utils.noop,
- execute: classOptions.execute || function (scope) {
- this.scope = scope;
- if (this.options.type === Directive.TE) {
- return this.update();
- }
- var newValue = this.options.literal ? this.attribute.value : this.expression.execute(scope);
- if (!utils.deepEqual(this._value_, newValue)) {
- this.update(newValue, this._value_);
- this._value_ = newValue;
- }
- },
- update: classOptions.update || utils.noop,
- unbind: classOptions.unbind || utils.noop,
- //挂载指令常用的类型
- utils: utils,
- Expression: Expression
- });
- //向指令类添加「指令定义信息」
- DirectiveClass.options = classOptions;
- utils.setPrototypeOf(DirectiveClass, classOptions);
- return DirectiveClass;
- }
-
- //指令类型
- Directive.TA = 'A';
- Directive.TE = 'E';
-
- //指令级别
- Directive.LP = 3000; //prevent
- Directive.LS = 2000; //statement
- Directive.LE = 1000; //eleemtn
- Directive.LG = 0; //general
- Directive.LA = -1000; //any attribute
- Directive.LC = -2000; //cloak
-
- module.exports = Directive;
- /***/ }),
- /* 54 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Class = __webpack_require__(4);
- var utils = __webpack_require__(3);
-
- /**
- * 表达式类型,将字符串构析为可执行表达式实例
- */
- var Expression = new Class({
-
- /**
- * 通过字符串构造一个表达式实例
- * @param {string} code 代码字符串
- * @param {boolean} mix 是否是混合代码
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(code, mix) {
- this.func = mix ? this._compileMixedCode(code) : this._compileCode(code);
- },
-
- /**
- * 编译普通表达式代码
- * @param {string} code 代码字符串
- * @returns {function} 编辑后的函数
- */
- _compileCode: function /*istanbul ignore next*/_compileCode(code) {
- code = this._escapeEOL(this._wrapCode(code));
- return this._createFunction(code);
- },
-
- /**
- * 编辑混合的表达式代码
- * @param {string} code 代码字符串
- * @returns {function} 编辑后的函数
- */
- _compileMixedCode: function /*istanbul ignore next*/_compileMixedCode(code) {
- var statements = this._parseMixedCode(code);
- code = this._escapeEOL(statements.join('+'));
- return this._createFunction(code);
- },
-
- /**
- * 通过符串代码创建一个可执行函数
- * @param {string} code 代码字符串
- * @returns {function} 创建的函数
- */
- _createFunction: function /*istanbul ignore next*/_createFunction(code) {
- var func = new Function('utils', 'scope', 'with(scope){return ' + code + '}');
- return func.bind(null, utils);
- },
-
- /**
- * 解析混合代码字符串
- * @param {string} code 混合代码字符串
- * @returns {Array} 解析后的「token」列表
- */
- _parseMixedCode: function /*istanbul ignore next*/_parseMixedCode(code) {
- var index = 0,
- length = code.length;
- var token = '',
- isExpr = false,
- tokens = [];
- while (index <= length) {
- var char = code[index++];
- var nextChar = code[index];
- if (utils.isNull(char)) {
- if (token.length > 0) {
- tokens.push('"' + this._escapeCode(token) + '"');
- }
- token = '';
- isExpr = false;
- } else if (!isExpr && char + nextChar == '{{') {
- if (token.length > 0) {
- tokens.push('"' + this._escapeCode(token) + '"');
- }
- token = '';
- isExpr = true;
- index++;
- } else if (isExpr && char + nextChar == '}}') {
- if (token.length > 0) {
- tokens.push(this._wrapCode(token));
- }
- token = '';
- isExpr = false;
- index++;
- } else {
- token += char;
- }
- }
- return tokens;
- },
-
- /**
- * 转义处理代码字符串
- * @param {string} code 源字符串
- * @returns {string} 处理后的字符串
- */
- _escapeCode: function /*istanbul ignore next*/_escapeCode(code) {
- return code.replace(/"/, '\\"').replace('\r\n', '\\r\\n').replace('\n', '\\n');
- },
-
- /**
- * 转义换行符
- * @param {string} code 源字符串
- * @returns {string} 处理后的字符串
- */
- _escapeEOL: function /*istanbul ignore next*/_escapeEOL(code) {
- return code.replace(/\n/gm, '\\\n');
- },
-
- /**
- * 通过闭包和 try/cache 包裹代码
- * 将模板中错误的代码直接显示在「模板中用到的位置」,更易于定位错误。
- * @param {string} code 源字符串
- * @returns {string} 处理后的字符串
- */
- _wrapCode: function /*istanbul ignore next*/_wrapCode(code) {
- return '((function(){try{return (' + code + ')}catch(err){console.error(err);return err;}})())';
- },
-
- /**
- * 通过 scope 对象执行表达式
- * @param {Object} scope 上下文对象
- * @returns {Object} 执行结果
- */
- execute: function /*istanbul ignore next*/execute(scope) {
- if (utils.isNull(scope)) {
- scope = {};
- }
- return this.func.call(scope, scope);
- }
-
- });
-
- module.exports = Expression;
- /***/ }),
- /* 55 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- module.exports = {
- '#text': __webpack_require__(56),
- 'each': __webpack_require__(57),
- 'if': __webpack_require__(59),
- 'prop': __webpack_require__(60),
- 'attr': __webpack_require__(61),
- 'on': __webpack_require__(62),
- 'html': __webpack_require__(63),
- 'text': __webpack_require__(64),
- 'prevent': __webpack_require__(65),
- 'id': __webpack_require__(66),
- 'cloak': __webpack_require__(67),
- 'show': __webpack_require__(68),
- 'model': __webpack_require__(69),
- 'focus': __webpack_require__(76),
- '*': __webpack_require__(77) //处理所有未知 attr
- };
- /***/ }),
- /* 56 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var Expression = __webpack_require__(54);
-
- module.exports = new Directive({
- type: Directive.TE,
- prefix: false,
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.expr = new Expression(this.node.nodeValue, true);
- this.node.nodeValue = '';
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- this.scope = scope;
- var newValue = this.expr.execute(scope);
- if (this.node.nodeValue !== newValue) {
- this.node.nodeValue = newValue;
- }
- }
-
- });
- /***/ }),
- /* 57 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- /*istanbul ignore next*/var _defineProperty = __webpack_require__(47);
-
- var _defineProperty2 = _interopRequireDefault(_defineProperty);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- var Directive = __webpack_require__(53);
- var utils = __webpack_require__(3);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
- level: Directive.LS + 1, //比 if 要高一个权重
- final: true,
- literal: true,
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.mountNode = document.createTextNode('');
- this.node.parentNode.insertBefore(this.mountNode, this.node);
- //虽然,bind 完成后,也会进行 attribute 的移除,
- //但 each 指令必须先移除,否再进行 item 编译时 each 还会生效
- this.node.removeAttribute(this.attribute.name);
- this.node.parentNode.removeChild(this.node);
- this.parseExpr();
- this.eachItems = {};
- },
-
- parseExpr: function /*istanbul ignore next*/parseExpr() {
- this.eachType = this.attribute.value.indexOf(' in ') > -1 ? 'in' : 'of';
- var tokens = this.attribute.value.split(' ' + this.eachType + ' ');
- var fnText = /*istanbul ignore next*/'with(scope){utils.each(' + tokens[1] + ',fn.bind(this,' + tokens[1] + '))}';
- this.each = new Function('utils', 'scope', 'fn', fnText).bind(null, this.utils);
- var names = tokens[0].split(',').map(function (name) {
- return name.trim();
- });
- if (this.eachType == 'in') {
- this.keyName = names[0];
- this.valueName = names[1];
- } else {
- this.keyName = names[1];
- this.valueName = names[0];
- }
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- /*istanbul ignore next*/var _this = this;
-
- var currentEachKeys = [];
- var itemsFragment = document.createDocumentFragment();
- var self = this;
- this.each(scope, function (eachTarget, key) {
- //创建新 scope,必须选创建再设置 prototype 或采用定义「属性」的方式
- //因为指令参数指定的名称有可能和 scope 原有变量冲突
- //将导致针对 watch 变量的赋值,从引用发循环
- var newScope = new Scope(this.scope);
- if (self.keyName) {
- /*istanbul ignore next*/(0, _defineProperty2.default)(newScope, self.keyName, {
- /*istanbul ignore next*/get: function get() {
- return key;
- }
- });
- }
- //value 采用「属性」进行代理,否则将会使「双向」绑定无把回设值
- if (self.valueName) {
- /*istanbul ignore next*/(0, _defineProperty2.default)(newScope, self.valueName, {
- /*istanbul ignore next*/get: function get() {
- return eachTarget[key];
- },
- /*istanbul ignore next*/set: function set(value) {
- eachTarget[key] = value;
- }
- });
- }
- var oldItem = this.eachItems[key];
- if (oldItem) {
- oldItem.handler(newScope);
- } else {
- var newItem = {};
- //创建新元素
- newItem.node = this.node.cloneNode(true);
- itemsFragment.appendChild(newItem.node);
- newItem.handler = this.compiler.compile(newItem.node);
- newItem.handler(newScope);
- this.eachItems[key] = newItem;
- }
- currentEachKeys.push(key);
- }.bind(this));
- utils.each(this.eachItems, function (key, item) {
- if (currentEachKeys.some(function (k) /*istanbul ignore next*/{
- return k == key;
- })) return;
- if (item.node.parentNode) {
- item.node.parentNode.removeChild(item.node);
- }
- delete /*istanbul ignore next*/_this.eachItems[key];
- }, this);
- if (itemsFragment.childNodes.length > 0) {
- this.mountNode.parentNode.insertBefore(itemsFragment, this.mountNode);
- }
- }
-
- });
- /***/ }),
- /* 58 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var utils = __webpack_require__(3);
-
- var Scope = function Scope(parent, props) {
- //新的 scope 因为「继承」了 _observer_
- //所以在新 scope 上进行双向绑定时,将将值成功回写
- //如果有天不须用 utils.cteate 继承法,需要注意 _observer_
- //或在新 scope 上 defineProperty 代理 parentScope
- var scope = utils.create(parent);
- utils.copy(props, scope);
- //将 func 绑定到原 scope 上;
- utils.each(parent, function (key, value) {
- if (!utils.isFunction(value)) return;
- scope[key] = value.bind(parent);
- });
- return scope;
- };
-
- module.exports = Scope;
- /***/ }),
- /* 59 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- level: Directive.LS,
- final: true,
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.mountNode = document.createTextNode('');
- this.node.parentNode.insertBefore(this.mountNode, this.node);
- //虽然,bind 完成后,也会进行 attribute 的移除,
- //但 if 指令必须先移除,否再进行 item 编译时 if 还会生效
- this.node.removeAttribute(this.attribute.name);
- this.node.parentNode.removeChild(this.node);
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- var newValue = this.expression.execute(scope);
- if (newValue) {
- //如果新计算的结果为 true 才执行
- this._handler = this._handler || this.compiler.compile(this.node);
- this._handler(scope);
- var node = this.node.$substitute || this.node;
- if (!node.parentNode) {
- this.mountNode.parentNode.insertBefore(node, this.mountNode);
- }
- } else {
- var _node = this.node.$substitute || this.node;
- if (_node.parentNode) _node.parentNode.removeChild(_node);
- }
- }
-
- });
- /***/ }),
- /* 60 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- update: function /*istanbul ignore next*/update(value) {
- var target = this.node.$target || this.node;
- target[this.decorates[0]] = value;
- }
- // execute: function (scope) {
- // this.scope = scope;
- // let newValue = this.expression.execute(scope);
- // let target = this.node.$target || this.node;
- // target[this.decorates[0]] = newValue;
- // }
- });
- /***/ }),
- /* 61 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- update: function /*istanbul ignore next*/update(value) {
- var target = this.node.$target || this.node;
- if (target.setAttribute) {
- target.setAttribute(this.decorates[0], value);
- } else {
- target[this.decorates[0]] = value;
- }
- }
- });
- /***/ }),
- /* 62 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var EventEmitter = __webpack_require__(50);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
- literal: true,
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- var attrValue = this.attribute.value || '';
- if (attrValue.indexOf('(') < 0 && attrValue.indexOf(')') < 0) {
- attrValue += '($event)';
- }
- this.expr = new this.Expression(attrValue);
- var eventTarget = this.node.$target || this.node;
- this.emiter = new EventEmitter(eventTarget);
- this.emiter.addListener(this.decorates[0], function (event) {
- if (this.utils.isNull(this.scope)) return;
- this.expr.execute(new Scope(this.scope, {
- $event: event
- }));
- }.bind(this), false);
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.emiter.removeListener();
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- this.scope = scope;
- }
-
- });
- /***/ }),
- /* 63 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- update: function /*istanbul ignore next*/update(newValue) {
- this.node.innerHTML = newValue;
- }
- });
- /***/ }),
- /* 64 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- update: function /*istanbul ignore next*/update(newValue) {
- this.node.innerText = newValue;
- }
- });
- /***/ }),
- /* 65 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- level: Directive.LP,
- final: true
- });
- /***/ }),
- /* 66 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- literal: true,
-
- update: function /*istanbul ignore next*/update(id) {
- if (id in this.scope) {
- throw new Error('Conflicting component id `' + id + '`');
- }
- this.scope[id] = this.node.$target || this.node;
- }
-
- });
- /***/ }),
- /* 67 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- level: Directive.LC,
- literal: true,
- prefix: false,
-
- bind: function /*istanbul ignore next*/bind() {
- this.node.removeAttribute(this.attribute.name);
- }
-
- });
- /***/ }),
- /* 68 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- update: function /*istanbul ignore next*/update(value) {
- this.node.style.display = value ? '' : 'none';
- }
- });
- /***/ }),
- /* 69 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var SelectDirective = __webpack_require__(70);
- var EditableDirective = __webpack_require__(71);
- var InputDirective = __webpack_require__(72);
- var RadioDirective = __webpack_require__(73);
- var CheckboxDirective = __webpack_require__(74);
- var PropDirective = __webpack_require__(75);
-
- var Directive = function Directive(options) {
- var node = options.node;
- var tagName = node.tagName;
- if (options.decorates[0]) {
- return new PropDirective(options);
- } else if (tagName == 'INPUT') {
- var type = node.getAttribute('type');
- if (type == 'radio') {
- return new RadioDirective(options);
- } else if (type == 'checkbox') {
- return new CheckboxDirective(options);
- } else {
- return new InputDirective(options);
- }
- } else if (tagName == 'TEXTAREA') {
- return new InputDirective(options);
- } else if (tagName == 'SELECT') {
- return new SelectDirective(options);
- } else if (node.isContentEditable) {
- return new EditableDirective(options);
- } else {
- throw new Error( /*istanbul ignore next*/'Directive `model` cannot be used on `' + tagName + '`');
- }
- };
-
- //手动添加 classOptions
- Directive.options = {
- level: Directive.LA
- };
-
- module.exports = Directive;
- /***/ }),
- /* 70 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var EventEmitter = __webpack_require__(50);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
- final: true,
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
- this.node.removeAttribute(this.attribute.name);
- this._handler = this.compiler.compile(this.node);
- this.emiter = new EventEmitter(this.node);
- this.emiter.addListener('change', function () {
- if (this.utils.isNull(this.scope)) return;
- var selectedOptions = this.node.selectedOptions;
- var value = this.node.multiple ? [].slice.call(selectedOptions).map(function (option) {
- return option.value;
- }, this) : selectedOptions[0].value;
- this.backExpr.execute(new Scope(this.scope, {
- _value_: value
- }));
- }.bind(this), false);
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.emiter.removeListener();
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- this.scope = scope;
- this._handler(scope);
- var value = this.expression.execute(scope);
- if (!this.utils.isArray(value)) value = [value];
- [].slice.call(this.node.options).forEach(function (option) {
- option.selected = value.indexOf(option.value) > -1;
- }, this);
- }
-
- });
- /***/ }),
- /* 71 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var EventEmitter = __webpack_require__(50);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
- this.emiter = new EventEmitter(this.node);
- this.emiter.addListener('input', function () {
- if (this.utils.isNull(this.scope)) return;
- this.backExpr.execute(new Scope(this.scope, {
- _value_: this.node.innerHTML
- }));
- }.bind(this), false);
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.emiter.removeListener();
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- var value = this.expression.execute(scope);
- if (this.node.innerHTML !== value) {
- this.node.innerHTML = value;
- }
- }
-
- });
- /***/ }),
- /* 72 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var EventEmitter = __webpack_require__(50);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
- this.emiter = new EventEmitter(this.node);
- this.emiter.addListener('input', function () {
- if (this.utils.isNull(this.scope)) return;
- this.backExpr.execute(new Scope(this.scope, {
- _value_: this.node.value
- }));
- }.bind(this), false);
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.emiter.removeListener();
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- var value = this.expression.execute(scope);
- if (this.node.value !== value) {
- this.node.value = value;
- }
- }
-
- });
- /***/ }),
- /* 73 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var EventEmitter = __webpack_require__(50);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
- this.emiter = new EventEmitter(this.node);
- this.emiter.addListener('change', function () {
- if (this.utils.isNull(this.scope)) return;
- this.backExpr.execute(new Scope(this.scope, {
- _value_: this.node.value
- }));
- }.bind(this), false);
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.emiter.removeListener();
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- this.scope = scope;
- var value = this.expression.execute(scope);
- this.node.checked = value == this.node.value;
- }
-
- });
- /***/ }),
- /* 74 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var EventEmitter = __webpack_require__(50);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
- this.emiter = new EventEmitter(this.node);
- this.emiter.addListener('change', function () {
- if (this.utils.isNull(this.scope)) return;
- var value = this.expression.execute(this.scope);
- if (this.utils.isArray(value) && this.node.checked) {
- value.push(this.node.value);
- } else if (this.utils.isArray(value) && !this.node.checked) {
- var index = value.indexOf(this.node.value);
- value.splice(index, 1);
- } else {
- this.backExpr.execute(new Scope(this.scope, {
- _value_: this.node.checked
- }));
- }
- }.bind(this), false);
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.emiter.removeListener();
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- this.scope = scope;
- var value = this.expression.execute(scope);
- if (this.utils.isArray(value)) {
- this.node.checked = value.indexOf(this.node.value) > -1;
- } else {
- this.node.checked = value;
- }
- }
-
- });
- /***/ }),
- /* 75 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
- var Scope = __webpack_require__(58);
-
- module.exports = new Directive({
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- /*istanbul ignore next*/var _this = this;
-
- this.target = this.node.$target;
- this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
- this.bindProp = this.decorates[0];
- if (!this.target) {
- throw new Error( /*istanbul ignore next*/'Directive `model:' + this.bindProp + '` cannot be used on `' + this.node.tagName + '`');
- }
- this.watcher = this.target.$watch(this.bindProp, function (value) {
- if ( /*istanbul ignore next*/_this.utils.isNull( /*istanbul ignore next*/_this.scope)) return;
- /*istanbul ignore next*/_this.backExpr.execute(new Scope( /*istanbul ignore next*/_this.scope, {
- _value_: value
- }));
- });
- },
-
- unbind: function /*istanbul ignore next*/unbind() {
- this.target.$unWatch(this.watcher);
- },
-
- update: function /*istanbul ignore next*/update(value) {
- this.target[this.bindProp] = value;
- }
-
- });
- /***/ }),
- /* 76 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- module.exports = new Directive({
- execute: function /*istanbul ignore next*/execute(scope) {
- /*istanbul ignore next*/var _this = this;
-
- var state = this.expression.execute(scope);
- setTimeout(function () {
- if (state) /*istanbul ignore next*/_this.node.focus();else /*istanbul ignore next*/_this.node.blur();
- }, 0);
- }
- });
- /***/ }),
- /* 77 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Directive = __webpack_require__(53);
-
- /**
- * 通用的 attribute 指令
- * 用于所有 attribute 的处理
- * 例如:
- * <div attr1="{{expr1}}" {{expr2}} {{attr3}}="{{expr3}}">
- * </div>
- */
- module.exports = new Directive({
- level: Directive.LA,
- prefix: false,
- literal: true,
- remove: false,
-
- /**
- * 初始化指令
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind() {
- this.computedName = this.attribute.name;
- this.computedValue = this.attribute.value;
- this.nameExpr = new this.Expression(this.attribute.name, true);
- this.valueExpr = new this.Expression(this.attribute.value, true);
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- var target = this.node.$target || this.node;
- var newComputedName = this.nameExpr.execute(scope);
- if (this.computedName !== newComputedName) {
- //移除旧名称
- if (target.removeAttribute) {
- target.removeAttribute(this.computedName);
- }
- //设置新名称
- this.computedName = newComputedName;
- if (!this.utils.isNull(this.computedName) && this.computedName.length > 0) {
- if (target.setAttribute) {
- target.setAttribute(this.computedName, this.computedValue || '');
- }
- }
- }
- var newComputeValue = this.valueExpr.execute(scope);
- if (this.computedValue !== newComputeValue) {
- this.computedValue = newComputeValue;
- if (target.setAttribute) {
- target.setAttribute(this.computedName, this.computedValue || '');
- } else {
- target[this.computedName] = this.computedValue;
- }
- }
- }
-
- });
- /***/ }),
- /* 78 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Class = __webpack_require__(4);
- var Observer = __webpack_require__(6);
- var EventEmitter = __webpack_require__(50);
- var Compiler = __webpack_require__(52);
-
- /**
- * 模板类
- * 可能通过 element 作为参数,创建一个模板实例
- */
- var Template = new Class({
-
- $extends: EventEmitter,
-
- /**
- * 构建一个模板板实例
- * @param {HTMLNode} element HTML 元素
- * @param {Object} options 选项
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(element, options) {
- options = options || {};
- EventEmitter.call(this);
- this.options = options;
- this.element = element;
- this.compiler = options.compiler || new Compiler(options);
- this.render = this.compiler.compile(this.element);
- this.update = this.update.bind(this);
- this._update = this._update.bind(this);
- this._updateTimer = 0;
- },
-
- /**
- * 更新当前模板 (会过滤不必要的更新)
- * @returns {void} 无返回
- */
- update: function /*istanbul ignore next*/update() {
- if (this._updateTimer) {
- clearTimeout(this._updateTimer);
- this._updateTimer = null;
- }
- this._updateTimer = setTimeout(this._update, 0);
- },
-
- /**
- * 更新当前模板内部方法
- * @returns {void} 无返回
- */
- _update: function /*istanbul ignore next*/_update() {
- if (!this._updateTimer || !this.observer) return;
- this.emit('update', this);
- this.render(this.observer.target);
- this._onBind();
- },
-
- /**
- * 在绑定成功时
- * @returns {void} 无返回
- */
- _onBind: function /*istanbul ignore next*/_onBind() {
- if (this._bound) return;
- this._bound = true;
- this.emit('bind', this);
- },
-
- /**
- * 将模板绑定到一个 scope
- * @param {Object} scope 绑定的上下文对象
- * @param {boolean} disableFirst 是否禁用第一次的自动渲染
- * @returns {void} 无返回
- */
- bind: function /*istanbul ignore next*/bind(scope, disableFirst) {
- if (!scope) return;
- this.unbind();
- this.observer = new Observer(scope, {
- root: this.options.root
- });
- scope.$self = scope;
- this.observer.on('change', this.update);
- if (disableFirst) {
- this._onBind();
- } else {
- this.update();
- }
- },
-
- /**
- * 解绑定
- * @returns {void} 无返回
- */
- unbind: function /*istanbul ignore next*/unbind() {
- if (!this.observer) return;
- this.observer.removeListener('change', this.update);
- this.observer.clearReference();
- this.observer = null;
- },
-
- /**
- * 释放
- * @returns {void} 无返回
- */
- dispose: function /*istanbul ignore next*/dispose() {
- this.unbind();
- this.render.dispose();
- }
-
- });
-
- module.exports = Template;
- /***/ }),
- /* 79 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Component = __webpack_require__(80);
- var components = __webpack_require__(82);
- var directives = __webpack_require__(51).directives;
-
- Component.components = components;
- Component.Component = Component;
-
- Component.component = function (name, component) {
- if (!component) return components[name];
- components[name] = component;
- };
-
- Component.directive = function (name, directive) {
- if (!directive) return directives[name];
- directives[name] = directive;
- };
-
- module.exports = Component;
- /***/ }),
- /* 80 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- /*istanbul ignore next*/var _defineProperty = __webpack_require__(47);
-
- var _defineProperty2 = _interopRequireDefault(_defineProperty);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- var Class = __webpack_require__(4);
- var Template = __webpack_require__(51);
- var Watcher = __webpack_require__(5);
- var utils = __webpack_require__(3);
- var EventEmitter = __webpack_require__(50);
- var Observer = __webpack_require__(6);
- var ComponentDirective = __webpack_require__(81);
-
- /**
- * 组件类
- * 用于定义一个新的组件
- * @param {Object} classOpts 类选项
- * @returns {Component} 组件类
- */
- function Component(classOpts) {
-
- //处理组件选项
- classOpts = classOpts || {};
-
- //处理「继承」,目前的机制,只能用「合并类选项」
- var mixes = classOpts.mixes;
- delete classOpts.mixes;
- if (mixes && !utils.isArray(mixes)) {
- mixes = [mixes];
- } else {
- mixes = [];
- }
- var extendComponent = classOpts.extend || Component;
- delete classOpts.extend;
- //extend 会覆盖 mixes 中的同名成员
- mixes.push(extendComponent);
- //classOpts 会覆盖 extend 或 mixes 中的同名成员
- mixes.push(classOpts);
- var mixedClassOpts = {};
- mixes.forEach(function (mixItem) {
- if (mixItem instanceof Component || mixItem == Component) {
- mixItem = mixItem.$options || {};
- }
- utils.mix(mixedClassOpts, mixItem);
- });
- classOpts = mixedClassOpts;
-
- /**
- * 定义组件类
- * 可以通过 new ComponentClass() 创建组件实例
- */
- var ComponentClass = new Class({
- $extends: extendComponent,
-
- /**
- * 组件类构造函数
- * @param {object} instanceOpts 实例选项
- * @returns {void} 无返回
- */
- constructor: function /*istanbul ignore next*/constructor(instanceOpts) {
- /*istanbul ignore next*/var _this = this;
-
- if (this == window) return new this.$class(instanceOpts);
- EventEmitter.call(this);
- instanceOpts = instanceOpts || {};
- //创建组件实例时可以给实例添加成员
- utils.each(instanceOpts, function (key, value) {
- if (key in /*istanbul ignore next*/_this) return;
- /*istanbul ignore next*/_this[key] = value;
- });
- this._onTemplateUpdate_ = this._onTemplateUpdate_.bind(this);
- this._createdData_(classOpts.data);
- this._createProperties_(classOpts.properties || classOpts.props);
- this._createWatches_(classOpts.watches || classOpts.watch);
- this.$directives = this.$directives || {};
- this._importDirectives_(classOpts.directives);
- this.$components = this.$components || {};
- this._importComponents_(__webpack_require__(82));
- this._importComponents_({
- 'self': ComponentClass
- });
- this._importComponents_(classOpts.components);
- utils.defineFreezeProp(this, '$children', []);
- if (instanceOpts.parent) this.$setParent(instanceOpts.parent);
- this.$callHook('init', [instanceOpts]);
- Observer.observe(this);
- if (classOpts.element) {
- this.$mount();
- } else {
- this.$compile();
- }
- },
-
- /**
- * 设定父组件
- * @param {Object} parent 父组件
- * @returns {void} 无返回
- */
- $setParent: function /*istanbul ignore next*/$setParent(parent) {
- if (this.$parent === parent) return;
- if (this.$parent) {
- this.$parent.$removeChild(this);
- }
- if (parent) {
- parent.$addChild(this);
- }
- },
-
- /**
- * 添加子组件
- * @param {Object} child 子组件
- * @returns {void} 无返回
- */
- $addChild: function /*istanbul ignore next*/$addChild(child) {
- if (!(child instanceof Component)) return;
- this.$children.push(child);
- utils.defineFreezeProp(child, '$parent', this);
- utils.defineFreezeProp(child, '$root', this.$root || this);
- },
-
- /**
- * 移除子组件
- * @param {Object} child 子组件
- * @returns {void} 无返回
- */
- $removeChild: function /*istanbul ignore next*/$removeChild(child) {
- var index = this.$children.indexOf(child);
- this.$children.splice(index, 1);
- utils.defineFreezeProp(child, '$parent', null);
- //utils.defineFreezeProp(child, '$root', null);
- },
-
- /**
- * 获取根组件, 为了能通过 polyfill 处理 IE8 暂不用这种方式
- */
- get $root() {
- if (this.$parent) {
- return this.$parent.$root;
- } else {
- return this;
- }
- },
-
- /**
- * 导入用到的子组件类
- * @param {Object} components 引入的组件
- * @returns {void} 无返回
- */
- _importComponents_: function /*istanbul ignore next*/_importComponents_(components) {
- utils.each(components, function (name, component) {
- if (!component) return;
- this.$components[name] = component;
- this.$directives[name] = new ComponentDirective({
- name: name,
- component: component,
- parent: this
- });
- }, this);
- },
-
- /**
- * 导入一个用到的指令
- * @param {Object} directives 引入的指令
- * @returns {void} 无返回
- */
- _importDirectives_: function /*istanbul ignore next*/_importDirectives_(directives) {
- utils.each(directives, function (name, directive) {
- if (!directive) return;
- this.$directives[name] = directive;
- }, this);
- },
-
- /**
- * 调用生命周期 hook
- * @param {string} name 调用的 hook 名称
- * @param {Array} args 调用 hook 的参数列表
- * @returns {void} 无反回
- */
- $callHook: function /*istanbul ignore next*/$callHook(name, args) {
- var hook = this[/*istanbul ignore next*/'on' + utils.firstUpper(name)];
- if (!utils.isFunction(hook)) return;
- hook.apply(this, args || []);
- this.$emit( /*istanbul ignore next*/'$' + name, args);
- },
-
- /**
- * 创建数据对象
- * @param {Object} data 组件数据对象
- * @returns {void} 无返回
- */
- _createdData_: function /*istanbul ignore next*/_createdData_(data) {
- if (utils.isFunction(data)) {
- this.$data = data.call(this);
- } else {
- this.$data = data || {};
- }
- utils.each(this.$data, function (name) {
- /*istanbul ignore next*/(0, _defineProperty2.default)(this, name, {
- configurable: true,
- enumerable: true,
- get: function /*istanbul ignore next*/get() {
- if (!this.$data) return;
- return this.$data[name];
- },
- set: function /*istanbul ignore next*/set(value) {
- if (!this.$data) return;
- this.$data[name] = value;
- }
- });
- }, this);
- },
-
- /**
- * 创建组件属性
- * @param {Object} properties 属性定义对象
- * @returns {void} 无返回
- */
- _createProperties_: function /*istanbul ignore next*/_createProperties_(properties) {
- this.$properties = {};
- utils.each(properties, function (name, descriptor) {
- if (utils.isFunction(descriptor)) {
- //get 简化写法
- descriptor = {
- get: descriptor
- };
- } else if (!utils.isObject(descriptor)) {
- //基本类型
- descriptor = {
- value: descriptor
- };
- } else {
- //通过 descriptor 定义 get/set/value
- //不能直接用 descriptor,
- //因为为会导到多个组件实例间的影响
- descriptor = utils.copy(descriptor);
- }
- //如果 get/set 都没有,则自动生成
- var hasGetterOrSetter = !!descriptor.get || !!descriptor.set;
- if (!hasGetterOrSetter) {
- descriptor.get = function () {
- return descriptor.value;
- };
- descriptor.set = function (value) {
- descriptor.value = value;
- };
- }
- //定义为属性
- /*istanbul ignore next*/(0, _defineProperty2.default)(this, name, {
- configurable: true,
- enumerable: true,
- get: function /*istanbul ignore next*/get() {
- if (!descriptor.get) {
- throw new Error('Property `' + name + '` cannot be read');
- }
- return descriptor.get.call(this);
- },
- set: function /*istanbul ignore next*/set(value) {
- if (!descriptor.set) {
- throw new Error('Property `' + name + '` cannot be written');
- }
- if (descriptor.test && !descriptor.test(value)) {
- throw new Error('Invalid value `' + value + '` for property `' + name + '`');
- }
- descriptor.set.call(this, value);
- if (this._observer_) {
- this._observer_.emitChange({
- path: name,
- value: value
- });
- }
- }
- });
- this.$properties[name] = descriptor;
- }, this);
- },
-
- /**
- * 创建监控
- * 为什么用 watches 而不是 watchers 或其它?
- * 因为,这里仅是「监控配置」并且是「复数」
- * @param {Object} watches 监控定义对象
- * @returns {void} 无返回
- */
- _createWatches_: function /*istanbul ignore next*/_createWatches_(watches) {
- this._watchers_ = this._watchers_ || [];
- utils.each(watches, function (name, handler) {
- this.$watch(name, handler);
- }, this);
- },
-
- /**
- * 在模板发生更新时
- * @returns {void} 无返回
- */
- _onTemplateUpdate_: function /*istanbul ignore next*/_onTemplateUpdate_() {
- this._watchers_.forEach(function (watcher) {
- watcher.calc();
- }, this);
- },
-
- /**
- * 添加一个监控
- * @param {string|function} path 计算函数或路径
- * @param {function} handler 处理函数
- * @returns {void} 无返回
- */
- $watch: function /*istanbul ignore next*/$watch(path, handler) {
- if (!utils.isFunction(handler)) return;
- var calcer = path;
- if (!utils.isFunction(path)) {
- calcer = function /*istanbul ignore next*/calcer() {
- return utils.getByPath(this, path);
- };
- }
- var watcher = new Watcher(calcer.bind(this), handler.bind(this));
- this._watchers_.push(watcher);
- return watcher;
- },
-
- /**
- * 取消一个 watcher 对象
- * @param {object} watcher 监控对象实例
- * @returns {void} 无返回
- */
- $unWatch: function /*istanbul ignore next*/$unWatch(watcher) {
- var index = this._watchers_.findIndex(function (w) /*istanbul ignore next*/{
- return w === watcher;
- });
- this._watchers_.splice(index, 1);
- },
-
- /**
- * 创建元素
- * @returns {void} 无返回
- */
- _createElement_: function /*istanbul ignore next*/_createElement_() {
- if (this._created_) return;
- this._created_ = true;
- this.$callHook('create');
- utils.defineFreezeProp(this, '$element', this.element || ComponentClass.$template.cloneNode(true));
- if (!this.$element || this.$element.nodeName === '#text') {
- throw new Error('Invalid component template');
- }
- this.$callHook('created');
- },
-
- /**
- * 编译自身模板并完成绑定
- * @returns {void} 无返回
- */
- $compile: function /*istanbul ignore next*/$compile() {
- if (this._compiled_) return;
- this._compiled_ = true;
- this._createElement_();
- utils.defineFreezeProp(this, '_template_', new Template(this.$element, {
- directives: this.$directives,
- root: true
- }));
- this._template_.bind(this);
- this._template_.on('update', this._onTemplateUpdate_);
- this._template_.on('bind', function () {
- if (!this.deferReady) this.$callHook('ready');
- }.bind(this));
- },
-
- /**
- * 向 DOM tree 中挂截组件
- * @param {HTMLNode} mountNode 挂载点元素
- * @param {append} append 是否 append 到挂载元素内
- * @returns {void} 无返回
- */
- $mount: function /*istanbul ignore next*/$mount(mountNode, append) {
- if (this._mounted_) return;
- this.$compile();
- this.$callHook('mount');
- if (mountNode) {
- mountNode.$substitute = this.$element;
- this.$element._mountNode = mountNode;
- if (append) {
- mountNode.appendChild(this.$element);
- } else if (mountNode.parentNode) {
- mountNode.parentNode.insertBefore(this.$element, mountNode);
- }
- }
- this._mounted_ = true;
- this._removed_ = false;
- this.$callHook('mounted');
- },
-
- /**
- * 将组件添加到指定容器元素内
- * @param {HTMLNode} node 容器元素
- * @returns {void} 无返回
- */
- $appendTo: function /*istanbul ignore next*/$appendTo(node) {
- this.$mount(node, true);
- },
-
- /**
- * 移除组件
- * @returns {void} 无返回
- */
- $remove: function /*istanbul ignore next*/$remove() {
- if (this._removed_ || !this._mounted_) return;
- this.$callHook('remove');
- if (this.$element.parentNode) {
- this.$element.parentNode.removeChild(this.$element);
- }
- this._removed_ = true;
- this._mounted_ = false;
- this.$callHook('removed');
- },
-
- /**
- * 触发自身的一个事件并向上冒泡
- * @param {string} name 事件名称
- * @param {object} data 传递的对象
- * @returns {void} 无返回
- */
- $dispatch: function /*istanbul ignore next*/$dispatch(name, data) {
- var stopPropagation = this.$emit(name, data);
- if (!stopPropagation && this.$parent) {
- this.$parent.$dispatch(name, data);
- }
- },
-
- /**
- * 触发自身的一个事件并向下广播
- * @param {string} name 事件名称
- * @param {object} data 传递的对象
- * @returns {void} 无返回
- */
- $broadcast: function /*istanbul ignore next*/$broadcast(name, data) {
- var stopPropagation = this.$emit(name, data);
- if (!stopPropagation && this.$children && this.$children.length > 0) {
- this.$children.forEach(function (child) {
- child.$broadcast(name, data);
- }, this);
- }
- },
-
- /**
- * 释放组件
- * @returns {void} 无返回
- */
- $dispose: function /*istanbul ignore next*/$dispose() {
- this.$remove();
- this._emitter_.off();
- this.$children.forEach(function (child) {
- child.$dispose();
- }, this);
- if (this.$parent) {
- var index = this.$parent.$children.indexOf(this);
- this.$parent.$children.splice(index, 1);
- }
- this.$callHook('dispose');
- if (this._compiled_) {
- this._template_.unbind();
- }
- this.$callHook('disposed');
- for (var key in this) {
- delete this[key];
- }
- ['_observer_', '$element', '$children', '$parent', '_template_'].forEach(function (key) {
- delete this[key];
- }, this);
- utils.setPrototypeOf(this, null);
- }
-
- });
-
- //保存类选项
- ComponentClass.$options = classOpts;
- ComponentClass.$template = utils.parseDom(classOpts.template);
-
- //向 ComponentClass.prototype 上拷贝成员
- utils.copy(classOpts, ComponentClass.prototype);
- utils.copy(classOpts.methods, ComponentClass.prototype);
-
- //使 ComponentClass instanceof Component === true
- //IE9/10 下为 false,并且动态为 Component.prototype 添加的成员不会在 ComponentClass 上生效
- utils.setPrototypeOf(ComponentClass, Component.prototype);
-
- return ComponentClass;
- }
-
- //继承自 EventEmitter
- Component.prototype = utils.create(EventEmitter.prototype);
-
- //组件扩展方法,简单封装 extends
- Component.extend = function (classOpts) {
- return new Component(classOpts);
- };
-
- //定义扩展方法
- Component.prototype.extend = function (classOpts) {
- classOpts = classOpts || {};
- classOpts.extend = this;
- return new Component(classOpts);
- };
-
- //创建实例的方法
- Component.prototype.create = function (instanceOpts) {
- return new this(instanceOpts);
- };
-
- //针对包括 element 组件类的启动方法
- Component.prototype.start = function (instanceOpts) {
- if (!this.$options || !this.$options.element) {
- throw new Error('Start method cannot be called');
- }
- return this.create(instanceOpts);
- };
-
- module.exports = Component;
- /***/ }),
- /* 81 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Template = __webpack_require__(51);
- var Directive = Template.Directive;
-
- /**
- * 创建一个组件指令
- * @param {object} options 选项
- * @returns {object} 组件指令
- */
- function ComponentDirective(options) {
-
- return new Directive({
- type: Directive.TE,
- literal: true,
- final: true,
- level: Directive.LE,
-
- bind: function /*istanbul ignore next*/bind() {
- this.component = new options.component({
- deferReady: true,
- parent: options.parent || this.scope
- });
- this.handleAttrs();
- this.node.$target = this.component;
- this.handler = this.compiler.compile(this.node, {
- element: false,
- children: false
- });
- this.handleContents();
- this.component.$mount(this.node);
- if (this.node.parentNode) {
- this.node.parentNode.removeChild(this.node);
- }
- },
-
- handleAttrs: function /*istanbul ignore next*/handleAttrs() {
- this.attrs = [].slice.call(this.node.attributes);
- var directiveRegexp = new RegExp('^' + this.prefix + ':', 'i');
- this.attrs.forEach(function (attr) {
- if (directiveRegexp.test(attr.name)) return;
- if (attr.name in this.component.$properties) return;
- this.component.$element.setAttribute(attr.name, attr.value);
- this.node.removeAttribute(attr.name);
- }, this);
- },
-
- handleContents: function /*istanbul ignore next*/handleContents() {
- this.placeHandlers = [];
- var places = [].slice.call(this.component.$element.querySelectorAll('[' + this.prefix + '\\:content]'));
- places.forEach(function (place) {
- //将内容插入到指定的「位置」
- var contents = null;
- var selector = place.getAttribute(this.prefix + ':content');
- if (!selector) {
- contents = [].slice.call(this.node.childNodes);
- } else {
- contents = [].slice.call(this.node.querySelectorAll(selector));
- }
- if (!contents || contents.length < 1) return;
- place.innerHTML = '';
- contents.forEach(function (content) {
- place.appendChild(content.cloneNode(true));
- }, this);
- //编译插入后的子「内容模板」
- var handler = this.compiler.compile(place);
- this.placeHandlers.push(handler);
- }, this);
- },
-
- execute: function /*istanbul ignore next*/execute(scope) {
- this.handler(scope);
- if (!this._ready_) {
- this._ready_ = true;
- this.component.$callHook('ready');
- }
- this.placeHandlers.forEach(function (handler) {
- handler(scope);
- }, this);
- }
-
- });
- }
-
- module.exports = ComponentDirective;
- /***/ }),
- /* 82 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- module.exports = {
- View: __webpack_require__(83)
- };
- /***/ }),
- /* 83 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Component = __webpack_require__(80);
- var utils = __webpack_require__(3);
-
- /**
- * 内置视图组件
- * 可以加载并显示其它组件,并可以指定「转场效果」
- */
- var View = new Component({
-
- template: '<div></div>',
-
- properties: {
-
- /**
- * 显示到视图中的组件
- */
- component: {
- test: function /*istanbul ignore next*/test(value) {
- if (!value) return false;
- return value instanceof Component || utils.isString(value);
- },
- set: function /*istanbul ignore next*/set(component) {
- if (this._transitioning) return;
- this._transitioning = true;
- //如果 value 是字符串则尝试从 $parent.components 中获取组件类
- if (utils.isString(component)) {
- if (this.$parent && this.$parent.$components) {
- this.component = this.$parent.$components[component];
- } else {
- this.component = null;
- }
- return;
- }
- //声明新旧组件变量
- var newComponentInstance = null;
- var oldComponentInstance = this.componentInstance;
- //创建新组件实例
- if (utils.isFunction(component)) {
- newComponentInstance = new component({
- parent: this
- });
- } else {
- component.$setParent(this);
- newComponentInstance = component;
- }
- //通过转场控制器进行转场准备
- this.transition.prep(newComponentInstance, oldComponentInstance);
- //挂载新组件实例
- newComponentInstance.$appendTo(this.$element);
- //通过转场控制器进行转场
- this.transition.go(newComponentInstance, oldComponentInstance, function () {
- //触发相关事件
- this.$emit('enter', newComponentInstance);
- this.$emit('leave', oldComponentInstance);
- //销毁旧组件实例
- if (oldComponentInstance) {
- oldComponentInstance.$dispose();
- }
- this._transitioning = false;
- }.bind(this));
- //暂存当前组件实例
- this.componentInstance = newComponentInstance;
- },
- get: function /*istanbul ignore next*/get() {
- return this._Component;
- }
- },
-
- /**
- * 视图的转场控制对象
- */
- transition: {
- get: function /*istanbul ignore next*/get() {
- return this._transition || View.transition;
- },
- set: function /*istanbul ignore next*/set(transition) {
- if (this._transitioning) return;
- if (!transition || utils.isFunction(transition.prep) && utils.isFunction(transition.go)) {
- if (this._transition && utils.isFunction(this._transition.clean)) {
- this._transition.clean(this);
- }
- if (transition && utils.isFunction(transition.init)) {
- transition.init(this);
- }
- this._transition = transition;
- } else {
- throw new Error('Invalid transition');
- }
- }
- }
- },
-
- /**
- * 切换到指定的组件
- * @param {Component} component 组件
- * @param {transition} transition 转场控制组件
- * @returns {void} 无返回
- */
- switchTo: function /*istanbul ignore next*/switchTo(component, transition) {
- if (transition) {
- this.transition = transition;
- }
- this.component = component;
- }
-
- });
-
- /**
- * 默认转场设置
- */
- View.transition = {
- //init: function () { },
- //clean: function () { },
-
- /**
- * 转场开始前的准备
- * @param {Component} newComponent 新组件
- * @param {Component} oldComponent 旧组件
- * @returns {void} 无返回
- */
- prep: function /*istanbul ignore next*/prep(newComponent, oldComponent) {
- if (oldComponent) oldComponent.$element.style.display = 'none';
- },
-
- /**
- * 执行转场动画
- * @param {Component} newComponent 新组件
- * @param {Component} oldComponent 旧组件
- * @param {Function} done 完成后的回调
- * @returns {void} 无返回
- */
- go: function /*istanbul ignore next*/go(newComponent, oldComponent, done) {
- done();
- }
- };
-
- module.exports = View;
- /***/ }),
- /* 84 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var mokit = __webpack_require__(1);
- var items = __webpack_require__(85);
-
- __webpack_require__(86);
-
- var Toolbar = new mokit.Component({
- template: __webpack_require__(88),
- props: {
- mditor: null
- },
-
- /*istanbul ignore next*/data: function data() {
- return {
- items: items.slice(0)
- };
- },
- /*istanbul ignore next*/onReady: function onReady() {
- this.bindCommands();
- },
-
-
- watch: {
- /*istanbul ignore next*/items: function items() {
- this.bindCommands();
- }
- },
-
- /*istanbul ignore next*/bindCommands: function bindCommands() {
- /*istanbul ignore next*/var _this = this;
-
- if (!this.mditor) return;
- this.items.forEach(function (item) {
- /*istanbul ignore next*/_this.mditor.removeCommand(item.name);
- /*istanbul ignore next*/_this.mditor.addCommand(item);
- });
- },
- /*istanbul ignore next*/isActive: function isActive(item) {
- return this.mditor && item.state && this.mditor[item.state];
- },
- /*istanbul ignore next*/exec: function exec(name, event) {
- event.preventDefault();
- this.mditor.execCommand(name, event);
- },
- /*istanbul ignore next*/getItem: function getItem(name) {
- return this.items.find(function (item) /*istanbul ignore next*/{
- return item.name === name;
- });
- },
- /*istanbul ignore next*/removeItem: function removeItem(name) {
- var index = this.items.findIndex(function (item) /*istanbul ignore next*/{
- return item.name === name;
- });
- return this.items.splice(index, 1);
- },
- /*istanbul ignore next*/addItem: function addItem(item) {
- this.items.push(item);
- },
- /*istanbul ignore next*/replaceItem: function replaceItem(name, newItem) {
- var index = this.items.findIndex(function (item) /*istanbul ignore next*/{
- return item.name === name;
- });
- var oldItem = this.items.splice(index, 1);
- this.items.splice(index, 0, newItem);
- return oldItem;
- }
- });
-
- module.exports = Toolbar;
- /***/ }),
- /* 85 */
- /***/ (function(module, exports) {
- /*istanbul ignore next*/'use strict';
-
- module.exports = [{
- name: 'bold',
- title: '粗体',
- key: 'shift+alt+b',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('**', '**');
- }
- }, {
- name: 'italic',
- title: '斜体',
- key: 'shift+alt+i',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('*', '*');
- }
- }, {
- name: 'underline',
- title: '下划线',
- key: 'shift+alt+e',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('<u>', '</u>');
- }
- }, {
- name: 'strikethrough',
- title: '删除线',
- key: 'shift+alt+d',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('~~', '~~');
- }
- }, {
- name: 'header',
- title: '标题',
- key: 'shift+alt+1',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('# ');
- }
- }, {
- name: 'quote',
- icon: 'quote-left',
- title: '引用',
- key: 'shift+alt+q',
- /*istanbul ignore next*/handler: function handler() {
- var selectText = this.editor.getSelectText();
- if (selectText.length < 1) {
- this.editor.wrapSelectText('> ');
- return;
- }
- var textArray = selectText.split(this.EOL);
- var buffer = [];
- textArray.forEach(function (line) {
- buffer.push('> ' + line + ' ');
- });
- this.editor.setSelectText(buffer.join(this.EOL) + this.EOL);
- }
- }, {
- name: 'code',
- title: '代码',
- key: 'shift+alt+c',
- /*istanbul ignore next*/handler: function handler() {
- var lang = 'js' + this.EOL;
- var before = '```' + lang;
- var after = '``` ' + this.EOL;
- var text = this.editor.getSelectText().trim();
- if (text.length > 0) {
- text += this.EOL;
- }
- this.editor.setSelectText(text);
- this.editor.wrapSelectText(before, after);
- var range = this.editor.getSelectRange();
- var start = range.start - lang.length;
- var end = range.start - this.EOL.length;
- this.editor.setSelectRange(start, end);
- }
- }, {
- name: 'list-ol',
- title: '有序列表',
- key: 'shift+alt+o',
- /*istanbul ignore next*/handler: function handler() {
- var selectText = this.editor.getSelectText();
- if (selectText.length < 1) {
- this.editor.wrapSelectText('1. ');
- return;
- }
- var textArray = selectText.split(this.EOL);
- var buffer = [];
- for (var i = 0; i < textArray.length; i++) {
- var line = textArray[i];
- buffer.push(i + 1 + '. ' + line);
- }
- this.editor.setSelectText(buffer.join(this.EOL) + this.EOL);
- }
- }, {
- name: 'list-ul',
- title: '无序列表',
- key: 'shift+alt+u',
- /*istanbul ignore next*/handler: function handler() {
- var selectText = this.editor.getSelectText();
- if (selectText.length < 1) {
- this.editor.wrapSelectText('- ');
- return;
- }
- var textArray = selectText.split(this.EOL);
- var buffer = [];
- textArray.forEach(function (line) {
- buffer.push('- ' + line);
- });
- this.editor.setSelectText(buffer.join(this.EOL) + this.EOL);
- }
- }, {
- name: 'link',
- title: '链接',
- key: 'shift+alt+l',
- /*istanbul ignore next*/handler: function handler() {
- var text = this.editor.getSelectText();
- if (!text || /^(https:|http:|ftp:|file:|mailto:|\/|\.)/i.test(text)) {
- this.editor.wrapSelectText('[link](', ')');
- if (!text) return;
- var range = this.editor.getSelectRange();
- var start = range.start - 6;
- this.editor.setSelectRange(start, start + 4);
- } else {
- this.editor.wrapSelectText('[', ']()');
- var _range = this.editor.getSelectRange();
- var index = _range.end + 2;
- this.editor.setSelectRange(index, index);
- }
- }
- }, {
- name: 'table',
- title: '表格',
- key: 'shift+alt+t',
- /*istanbul ignore next*/handler: function handler() {
- var buffer = ['column1 | column2 | column3 ', '------- | ------- | ------- ', 'column1 | column2 | column3 ', 'column1 | column2 | column3 ', 'column1 | column2 | column3 '];
- this.editor.wrapSelectText(buffer.join(this.EOL) + this.EOL);
- }
- }, {
- name: 'line',
- title: '分隔线',
- icon: 'minus',
- key: 'shift+alt+h',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('----' + this.EOL);
- }
- }, {
- name: 'image',
- title: '图片',
- key: 'shift+alt+p',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('');
- }
- }, {
- name: 'help',
- title: '帮助',
- icon: 'question',
- key: 'shift+alt+/',
- /*istanbul ignore next*/handler: function handler() {
- window.open('http://mditor.com', '_blank');
- }
- }, {
- name: 'toggleFullScreen',
- title: '全屏',
- icon: 'arrows-alt',
- key: 'shift+alt+f',
- control: true,
- state: 'fullscreen',
- owner: function /*istanbul ignore next*/owner(mditor) {
- return mditor.$element;
- },
- /*istanbul ignore next*/handler: function handler() {
- this.fullscreen = !this.fullscreen;
- }
- }, {
- name: 'togglePreview',
- title: '预览',
- icon: 'desktop',
- key: 'shift+alt+v',
- control: true,
- state: 'preview',
- owner: function /*istanbul ignore next*/owner(mditor) {
- return mditor.$element;
- },
- /*istanbul ignore next*/handler: function handler() {
- this.preview = !this.preview;
- if (this.preview) {
- this._split = this.split;
- this.split = false;
- } else {
- this.split = this._split;
- }
- }
- }, {
- name: 'toggleSplit',
- title: '分屏',
- icon: 'columns',
- key: 'shift+alt+s',
- control: true,
- state: 'split',
- owner: function /*istanbul ignore next*/owner(mditor) {
- return mditor.$element;
- },
- /*istanbul ignore next*/handler: function handler() {
- this.split = !this.split;
- if (this.split) {
- this.preview = false;
- }
- }
- }];
- /***/ }),
- /* 86 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 87 */,
- /* 88 */
- /***/ (function(module, exports) {
- module.exports = "<ul class=\"toolbar\">\n <i m:each=\"item of items\" data-cmd=\"{{item.name}}\" m:on:click=\"exec(item.name,$event)\" class=\"item fa fa-{{item.icon || item.name}} {{isActive(item)?'active':''}} {{item.control?'control':''}}\" title=\"{{item.title || item.name}} {{item.key}}\"></i>\n</ul>"
- /***/ }),
- /* 89 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var mokit = __webpack_require__(1);
- var EventEmitter = mokit.EventEmitter;
- var utils = __webpack_require__(3);
- var Stack = __webpack_require__(90);
- var commands = __webpack_require__(91);
-
- __webpack_require__(92);
-
- var ua = window.navigator.userAgent.toLowerCase();
- var isIE = !!ua.match(/msie|trident\/7|edge/);
- //const isWinPhone = ua.indexOf('windows phone') !== -1;
- //const isIOS = !isWinPhone && !!ua.match(/ipad|iphone|ipod/);
-
- module.exports = new mokit.Component({
- template: __webpack_require__(93),
-
- props: {
- mditor: null,
- value: null,
- markExp: null
- },
-
- /*istanbul ignore next*/onReady: function onReady() {
- /*istanbul ignore next*/var _this = this;
-
- this.stack = new Stack();
- setTimeout(function () {
- /*istanbul ignore next*/_this.textareaEmitter = new EventEmitter( /*istanbul ignore next*/_this.textarea);
- /*istanbul ignore next*/_this.stack.init({
- value: /*istanbul ignore next*/_this.getValue()
- });
- }, 300);
- this._bindCommands();
- },
- /*istanbul ignore next*/_bindCommands: function _bindCommands() {
- /*istanbul ignore next*/var _this2 = this;
-
- commands.forEach(function (item) {
- /*istanbul ignore next*/_this2.mditor.removeCommand(item.name);
- /*istanbul ignore next*/_this2.mditor.addCommand(item);
- });
- },
- /*istanbul ignore next*/onCompositionStart: function onCompositionStart() {
- this._compositionLock = true;
- },
- /*istanbul ignore next*/onCompositionEnd: function onCompositionEnd() {
- /*istanbul ignore next*/var _this3 = this;
-
- this._compositionLock = false;
- setTimeout(function () /*istanbul ignore next*/{
- return (/*istanbul ignore next*/_this3.onInput()
- );
- }, 300);
- /**
- * 在输入中文时,输入法「候选词面板」位置会发生定位错误
- * 经过反复尝试发现了「规律」,第一次「侯选词」上屏后才会位置错误
- * 在「候选词」上屏后让输入框「失去焦点再获取焦点」可「规避」这个 Bug
- * 附上相关 issues
- * https://github.com/electron/electron/issues/8894
- * https://github.com/electron/electron/issues/4539
- */
- // this.textarea.blur();
- // this.textarea.focus();
- },
- /*istanbul ignore next*/onInput: function onInput() {
- /*istanbul ignore next*/var _this4 = this;
-
- this.$emit('input');
- if (this._changedTimer) {
- clearTimeout(this._changedTimer);
- this._changedTimer = null;
- }
- if (this._compositionLock) return;
- this._changedTimer = setTimeout(function () {
- if (! /*istanbul ignore next*/_this4._changedTimer) return;
- /*istanbul ignore next*/_this4.stack.push({
- value: /*istanbul ignore next*/_this4.getValue(),
- range: /*istanbul ignore next*/_this4.getSelectRange()
- });
- /*istanbul ignore next*/_this4.$emit('changed');
- }, 300);
- },
- /*istanbul ignore next*/undo: function undo() {
- /*istanbul ignore next*/var _this5 = this;
-
- var last = this.stack.last();
- var item = this.stack.undo();
- if (utils.isNull(item) || utils.isNull(item.value)) return;
- var valGap = last.value.length - item.value.length;
- this.value = item.value;
- if (last.range) {
- setTimeout(function () {
- var start = last.range.start - valGap;
- var end = last.range.end - valGap;
- /*istanbul ignore next*/_this5.setSelectRange(start, end);
- });
- }
- },
- /*istanbul ignore next*/redo: function redo() {
- /*istanbul ignore next*/var _this6 = this;
-
- var item = this.stack.redo();
- if (utils.isNull(item) || utils.isNull(item.value)) return;
- this.value = item.value;
- if (item.range) {
- setTimeout(function () {
- /*istanbul ignore next*/_this6.setSelectRange(item.range.start, item.range.end);
- });
- }
- },
- /*istanbul ignore next*/onPaste: function onPaste(event) {
- this.$emit('paste', event);
- },
- /*istanbul ignore next*/onDragover: function onDragover(event) {
- event.preventDefault();
- this.$emit('dragover', event);
- },
- /*istanbul ignore next*/onDrop: function onDrop(event) {
- event.preventDefault();
- this.$emit('drop', event);
- },
- /*istanbul ignore next*/focus: function focus() {
- this.textarea.focus();
- },
- /*istanbul ignore next*/blur: function blur() {
- this.textarea.blur();
- },
- /*istanbul ignore next*/onScroll: function onScroll(event) {
- this.syncScroll();
- this.$emit('scroll', event);
- },
- /*istanbul ignore next*/syncScroll: function syncScroll(disTwice) {
- /*istanbul ignore next*/var _this7 = this;
-
- this.marks.scrollTop = this.textarea.scrollTop;
- this.marks.scrollLeft = this.textarea.scrollLeft;
- if (disTwice) return;
- setTimeout(function () {
- /*istanbul ignore next*/_this7.syncScroll(true);
- }, 0);
- },
- /*istanbul ignore next*/applyMarks: function applyMarks(text) {
- if (!text || !this.markExp) return;
- text = text.replace(/\n$/g, '\n\n').replace(this.markExp, '<mark>$&</mark>');
- if (isIE) {
- // IE wraps whitespace differently in a div vs textarea, this fixes it
- text = text.replace(/ /g, ' <wbr>');
- }
- return text;
- },
- /*istanbul ignore next*/activeMark: function activeMark(index) {
- var marks = [].slice.call(this.marks.querySelectorAll('mark'));
- if (marks.length < 1) return;
- this.activeMarkIndex = utils.isNull(this.activeMarkIndex) ? -1 : this.activeMarkIndex;
- if (utils.isNull(index)) {
- this.activeMarkIndex++;
- } else {
- this.activeMarkIndex = index;
- }
- if (this.activeMarkIndex >= marks.length) {
- this.activeMarkIndex = 0;
- }
- marks.forEach(function (mark) {
- mark.classList.remove('active');
- });
- var activeMark = marks[this.activeMarkIndex];
- activeMark.classList.add('active');
- this.scrollToMark(activeMark);
- },
- /*istanbul ignore next*/scrollToMark: function scrollToMark(mark) {
- // mark.scrollIntoView();
- // this.textarea.scrollTop = this.marks.scrollTop;
- // this.textarea.scrollTop -= 20;
- this.textarea.scrollTop = mark.offsetTop - 20;
- },
- /*istanbul ignore next*/getValue: function getValue() {
- return this.textarea.value;
- },
- /*istanbul ignore next*/setValue: function setValue(value) {
- this.textarea.value = value;
- },
- /*istanbul ignore next*/getActiveElement: function getActiveElement() {
- this.textarea.focus();
- return document.activeElement;
- },
- /*istanbul ignore next*/getSelectRange: function getSelectRange() {
- var box = this.getActiveElement();
- return {
- 'start': box.selectionStart,
- 'end': box.selectionEnd
- };
- },
- /*istanbul ignore next*/setSelectRange: function setSelectRange(start, end) {
- var box = this.getActiveElement();
- box.setSelectionRange(start, end);
- },
- /*istanbul ignore next*/getSelectText: function getSelectText() {
- var box = this.getActiveElement();
- var range = this.getSelectRange();
- return box.value.substring(range.start, range.end);
- },
- /*istanbul ignore next*/setSelectText: function setSelectText(text) {
- /*istanbul ignore next*/var _this8 = this;
-
- var box = this.getActiveElement();
- var range = this.getSelectRange();
- box.setRangeText(text);
- if (range.end == range.start) {
- this.setSelectRange(range.start, range.end + text.length);
- }
- this.value = this.getValue();
- this.onInput();
- setTimeout(function () {
- /*istanbul ignore next*/_this8.blur();
- /*istanbul ignore next*/_this8.focus();
- }, 0);
- },
- /*istanbul ignore next*/wrapSelectText: function wrapSelectText(before, after) {
- before = before !== null && before !== undefined ? before : '';
- after = after !== null && after !== undefined ? after : '';
- var range = this.getSelectRange();
- var text = this.getSelectText();
- this.setSelectText(before + text + after);
- var newStart = range.start + before.length;
- var newEnd = range.end + before.length;
- this.setSelectRange(newStart, newEnd);
- },
- /*istanbul ignore next*/insertBeforeText: function insertBeforeText(text) {
- this.wrapSelectText(text);
- },
- /*istanbul ignore next*/insertAfterText: function insertAfterText(text) {
- this.wrapSelectText('', text);
- },
- /*istanbul ignore next*/getBeforeText: function getBeforeText(length) {
- var range = this.getSelectRange();
- var end = range.start;
- var start = end - length;
- var value = this.getValue();
- return value.substring(start, end);
- },
- /*istanbul ignore next*/getBeforeFirstCharIndex: function getBeforeFirstCharIndex(char) {
- var range = this.getSelectRange();
- var end = range.start;
- var start = 0;
- var value = this.getValue();
- return value.substring(start, end).lastIndexOf(char);
- },
- /*istanbul ignore next*/getBeforeWord: function getBeforeWord() {
- /*istanbul ignore next*/var _this9 = this;
-
- var chars = [' ', '\t', this.mditor.EOL];
- var start = 0;
- chars.forEach(function (char) {
- var index = /*istanbul ignore next*/_this9.getBeforeFirstCharIndex(char);
- if (index + char.length > start) {
- start = index + char.length;
- }
- });
- var range = this.getSelectRange();
- var value = this.getValue();
- return value.substring(start, range.end);
- },
- /*istanbul ignore next*/getBeforeTextInLine: function getBeforeTextInLine() {
- var start = this.getBeforeFirstCharIndex(this.mditor.EOL) + this.mditor.EOL.length;
- var range = this.getSelectRange();
- var value = this.getValue();
- return value.substring(start, range.end);
- },
- /*istanbul ignore next*/selectBeforeText: function selectBeforeText(length) {
- var range = this.getSelectRange();
- this.setSelectRange(range.start - length, range.end);
- },
- /*istanbul ignore next*/selectAfterText: function selectAfterText(length) {
- var range = this.getSelectRange();
- this.setSelectRange(range.start, range.end + length);
- },
- /*istanbul ignore next*/selectBeforeTextInLine: function selectBeforeTextInLine() {
- var start = this.getBeforeFirstCharIndex(this.mditor.EOL) + this.mditor.EOL.length;
- var range = this.getSelectRange();
- this.setSelectRange(start, range.end);
- },
- /*istanbul ignore next*/addIndent: function addIndent() {
- /*istanbul ignore next*/var _this10 = this;
-
- var selectText = this.getSelectText();
- if (selectText.length < 1) {
- this.insertBeforeText(this.mditor.INDENT);
- return;
- }
- var textArray = selectText.split(this.mditor.EOL);
- var buffer = [];
- var lineCount = textArray.length - 1;
- textArray.forEach(function (line, index) {
- line = line.trim() !== '' ? /*istanbul ignore next*/_this10.mditor.INDENT + line : line;
- if (index < lineCount || line.trim() !== '') {
- buffer.push(line);
- }
- });
- this.setSelectText(buffer.join(this.mditor.EOL));
- },
- /*istanbul ignore next*/removeIndent: function removeIndent() {
- /*istanbul ignore next*/var _this11 = this;
-
- var indentRegExp = new RegExp('^' + this.mditor.INDENT);
- var selectText = this.getSelectText();
- if (selectText.length < 1) {
- this.selectBeforeTextInLine();
- if (this.getSelectText().length > 0) {
- event.clearSelected = true;
- this.removeIndent();
- }
- return;
- }
- var textArray = selectText.split(this.mditor.EOL);
- var buffer = [];
- textArray.forEach(function (line) {
- if (indentRegExp.test(line)) {
- line = line.replace( /*istanbul ignore next*/_this11.mditor.INDENT, '');
- }
- buffer.push(line);
- });
- this.setSelectText(buffer.join(this.mditor.EOL));
- if (event.clearSelected) {
- var range = this.getSelectRange();
- this.setSelectRange(range.end, range.end);
- }
- }
- });
- /***/ }),
- /* 90 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var Class = __webpack_require__(4).Class;
- var utils = __webpack_require__(3);
-
- var Stack = new Class({
- /*istanbul ignore next*/constructor: function constructor(item) {
- this.init(item);
- },
- /*istanbul ignore next*/init: function init(item) {
- this.undoList = [item || {
- value: null
- }];
- this.redoList = [];
- },
- /*istanbul ignore next*/push: function push(item) {
- if (this.last() === item) return;
- this.undoList.push(item);
- },
- /*istanbul ignore next*/last: function last() {
- return this.undoList[this.undoList.length - 1];
- },
- /*istanbul ignore next*/undo: function undo() {
- if (this.undoList.length > 1) {
- var item = this.undoList.pop();
- if (utils.isNull(item) || utils.isNull(item.value)) return;
- this.redoList.push(item);
- }
- return this.last();
- },
- /*istanbul ignore next*/redo: function redo() {
- var item = this.redoList.pop();
- if (utils.isNull(item) || utils.isNull(item.value)) return;
- this.undoList.push(item);
- return item;
- }
- });
-
- module.exports = Stack;
- /***/ }),
- /* 91 */
- /***/ (function(module, exports) {
- /*istanbul ignore next*/'use strict';
-
- module.exports = [{
- name: 'undo',
- key: '{cmd}+z',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.undo();
- }
- }, {
- name: 'redo',
- key: '{cmd}+shift+z',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.redo();
- }
- }, {
- name: 'h2',
- key: 'shift+alt+2',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('## ');
- }
- }, {
- name: 'h3',
- key: 'shift+alt+3',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('### ');
- }
- }, {
- name: 'h4',
- key: 'shift+alt+4',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('#### ');
- }
- }, {
- name: 'h5',
- key: 'shift+alt+5',
- /*istanbul ignore next*/handler: function handler() {
- this.editor.wrapSelectText('##### ');
- }
- }];
- /***/ }),
- /* 92 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 93 */
- /***/ (function(module, exports) {
- module.exports = "<div class=\"editor\">\n <div class=\"backdrop\" m:id=\"marks\">\n <div class=\"inner\" m:html=\"applyMarks(value)\"></div>\n </div>\n <textarea class=\"textarea\" m:id=\"textarea\" m:model=\"value\" m:on:paste=\"onPaste\" m:on:dragover=\"onDragover\" m:on:drop=\"onDrop\"\n m:on:scroll=\"onScroll()\" m:on:input=\"onInput\" m:on:compositionStart=\"onCompositionStart\" m:on:compositionEnd=\"onCompositionEnd\"></textarea>\n</div>"
- /***/ }),
- /* 94 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var mokit = __webpack_require__(1);
-
- __webpack_require__(95);
-
- var Viewer = new mokit.Component({
- template: __webpack_require__(96),
-
- /*istanbul ignore next*/data: function data() {
- return {
- html: '',
- alert: '预览区域'
- };
- },
-
-
- props: {
- mditor: null,
- value: {
- /*istanbul ignore next*/get: function get() {
- return this._value;
- },
- /*istanbul ignore next*/set: function set(value) {
- /*istanbul ignore next*/var _this = this;
-
- this._value = value;
- var beforeEvent = { value: this._value };
- this.$emit('beforeRender', beforeEvent);
- this.mditor.parser.parse(beforeEvent.value, function (err, result) {
- var afterEvent = { value: result || err };
- /*istanbul ignore next*/_this.$emit('afterRender', afterEvent);
- /*istanbul ignore next*/_this.html = afterEvent.value;
- });
- }
- }
- },
-
- /*istanbul ignore next*/onClick: function onClick(event) {
- event.preventDefault();
- var tag = event.target;
- if (tag.tagName == 'A') {
- var href = tag.getAttribute('href');
- if (href) window.open(href, '_blank');
- }
- }
- });
-
- module.exports = Viewer;
- /***/ }),
- /* 95 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 96 */
- /***/ (function(module, exports) {
- module.exports = "<div class=\"viewer\" m:on:click=\"onClick\">\n <div m:show=\"html\" class=\"markdown-body\" m:html=\"html\"></div>\n <div m:show=\"!html\" class=\"alert\" m:html=\"alert\"></div>\n</div>"
- /***/ }),
- /* 97 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var mokit = __webpack_require__(1);
- var utils = __webpack_require__(3);
-
- __webpack_require__(98);
-
- var CHECK_REGEXP = /^\/[\s\S]+\/(i|g|m)*$/;
-
- var Finder = new mokit.Component({
- template: __webpack_require__(99),
- props: {
- mditor: null,
- active: false,
- findWord: '',
- replaceWord: ''
- },
- /*istanbul ignore next*/onReady: function onReady() {
- this.mditor.removeCommand('find');
- this.mditor.addCommand({
- name: 'find',
- key: '{cmd}+f',
- owner: this.mditor.$element,
- handler: this.show.bind(this, null)
- });
- this.mditor.removeCommand('cancel-find');
- this.mditor.addCommand({
- name: 'cancel-find',
- key: 'esc',
- owner: this.mditor.$element,
- handler: this.hide.bind(this)
- });
- },
- /*istanbul ignore next*/hide: function hide() {
- this.findWord = '';
- this.replaceWord = '';
- this.mditor.editor.markExp = null;
- this.active = false;
- },
- /*istanbul ignore next*/show: function show(text) {
- /*istanbul ignore next*/var _this = this;
-
- this.active = true;
- this.findWord = text || this.mditor.editor.getSelectText();
- if (this.active) {
- setTimeout(function () {
- /*istanbul ignore next*/_this.findBox.focus();
- }, 200);
- }
- this.mditor.editor.syncScroll();
- },
-
- watch: {
- /*istanbul ignore next*/findWord: function findWord() {
- /*istanbul ignore next*/var _this2 = this;
-
- if (!this.mditor || !this.mditor.editor) return;
- if (!this.findWord) {
- this.mditor.editor.markExp = null;
- } else {
- this.mditor.editor.markExp = this.parseRegexp(this.findWord);
- }
- setTimeout(function () {
- /*istanbul ignore next*/_this2.mditor.editor.activeMark(0);
- }, 100);
- }
- },
- /*istanbul ignore next*/parseRegexp: function parseRegexp(text, forceStr) {
- if (!forceStr && CHECK_REGEXP.test(text)) {
- try {
- return new Function( /*istanbul ignore next*/'return ' + text)();
- } catch (err) {
- return this.parseRegexp(text, true);
- }
- } else {
- return new RegExp(utils.escapeRegExp(text), 'gm');
- }
- },
- /*istanbul ignore next*/find: function find() {
- this.mditor.editor.activeMark();
- },
- /*istanbul ignore next*/replace: function replace() {
- this.mditor.value = this.mditor.value.replace(this.mditor.editor.markExp, this.replaceWord || '');
- },
- /*istanbul ignore next*/onFindEnter: function onFindEnter(event) {
- if (event.keyCode != 13) return;
- event.preventDefault();
- this.find();
- },
- /*istanbul ignore next*/onReplaceEnter: function onReplaceEnter(event) {
- if (event.keyCode != 13) return;
- event.preventDefault();
- this.replace();
- },
- /*istanbul ignore next*/onCompositionEnd: function onCompositionEnd(event) {
- event.target.blur();
- event.target.focus();
- }
- });
-
- module.exports = Finder;
- /***/ }),
- /* 98 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 99 */
- /***/ (function(module, exports) {
- module.exports = "<div class=\"finder {{active?'active':''}}\">\n <div>\n <input m:id=\"findBox\" m:model=\"findWord\" m:on:keydown=\"onFindEnter\" m:on:compositionend=\"onCompositionEnd\" type=\"text\" placeholder=\"Find\">\n <i class=\"fa fa-search\" aria-hidden=\"true\" tabindex=\"-1\" m:on:click=\"find()\"></i>\n </div>\n <div>\n <input m:id=\"replaceBox\" m:model=\"replaceWord\" m:on:keydown=\"onReplaceEnter\" m:on:compositionend=\"onCompositionEnd\" type=\"text\"\n placeholder=\"Replace\">\n <i class=\"fa fa-exchange\" aria-hidden=\"true\" tabindex=\"-1\" m:on:click=\"replace()\"></i>\n </div>\n</div>"
- /***/ }),
- /* 100 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var shortcuts = __webpack_require__(101);
- var utils = __webpack_require__(3);
-
- shortcuts.filter = function (event) {
- return !!event.target;
- };
-
- var Shortcut = module.exports = function (mditor) {
- utils.defineFreezeProp(this, 'mditor', mditor);
- };
-
- Shortcut.prototype._inRegion = function (target, owner) {
- if (!target) return false;
- owner = owner || this.mditor.editor.$element;
- if (utils.isFunction(owner)) owner = owner(this.mditor);
- return target === owner || this._inRegion(target.parentNode, owner);
- };
-
- Shortcut.prototype.bind = function (key, cmd, allowDefault, owner) {
- /*istanbul ignore next*/var _this = this;
-
- var mditor = this.mditor;
- //检查参数
- if (!key || !cmd) return;
- key = key.replace('{cmd}', mditor.CMD);
- shortcuts(key, function (event) {
- if (! /*istanbul ignore next*/_this._inRegion(event.target, owner)) return;
- //禁用浏览器默认快捷键
- if (!allowDefault) {
- event.preventDefault();
- }
- if (cmd instanceof Function) {
- cmd.call(mditor, event);
- } else {
- mditor.execCommand(cmd, event);
- }
- setTimeout(function () {
- mditor.focus();
- }, 0);
- });
- };
-
- Shortcut.prototype.unbind = function (key) {
- shortcuts.unbind(key);
- };
- /***/ }),
- /* 101 */
- /***/ (function(module, exports, __webpack_require__) {
- (function (global) {
- var k,
- _handlers = {},
- _mods = {
- 16: false,
- 18: false,
- 17: false,
- 91: false
- },
- _scope = 'all',
- // modifier keys
- _MODIFIERS = {
- '⇧': 16,
- shift: 16,
- '⌥': 18,
- alt: 18,
- option: 18,
- '⌃': 17,
- ctrl: 17,
- control: 17,
- '⌘': 91,
- command: 91
- },
- // special keys
- _MAP = {
- backspace: 8,
- tab: 9,
- clear: 12,
- enter: 13,
- 'return': 13,
- esc: 27,
- escape: 27,
- space: 32,
- left: 37,
- up: 38,
- right: 39,
- down: 40,
- del: 46,
- 'delete': 46,
- home: 36,
- end: 35,
- pageup: 33,
- pagedown: 34,
- ',': 188,
- '.': 190,
- '/': 191,
- '`': 192,
- '-': 189,
- '=': 187,
- ';': 186,
- '\'': 222,
- '[': 219,
- ']': 221,
- '\\': 220
- },
- code = function (x) {
- return _MAP[x] || x.toUpperCase().charCodeAt(0);
- },
- _downKeys = [];
-
- for (k = 1; k < 20; k++) _MAP['f' + k] = 111 + k;
-
- // IE doesn't support Array#indexOf, so have a simple replacement
- function index(array, item) {
- var i = array.length;
- while (i--)
- if (array[i] === item) return i;
- return -1;
- }
-
- // for comparing mods before unassignment
- function compareArray(a1, a2) {
- if (a1.length != a2.length) return false;
- for (var i = 0; i < a1.length; i++) {
- if (a1[i] !== a2[i]) return false;
- }
- return true;
- }
-
- var modifierMap = {
- 16: 'shiftKey',
- 18: 'altKey',
- 17: 'ctrlKey',
- 91: 'metaKey'
- };
-
- function updateModifierKey(event) {
- for (k in _mods) _mods[k] = event[modifierMap[k]];
- };
-
- // handle keydown event
- function dispatch(event) {
- var key, handler, k, i, modifiersMatch, scope;
- key = event.keyCode;
-
- if (index(_downKeys, key) == -1) {
- _downKeys.push(key);
- }
-
- // if a modifier key, set the key.<modifierkeyname> property to true and return
- if (key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko
- if (key in _mods) {
- _mods[key] = true;
- // 'assignKey' from inside this closure is exported to window.key
- for (k in _MODIFIERS)
- if (_MODIFIERS[k] == key) assignKey[k] = true;
- return;
- }
- updateModifierKey(event);
-
- // see if we need to ignore the keypress (filter() can can be overridden)
- // by default ignore key presses if a select, textarea, or input is focused
- if (!assignKey.filter.call(this, event)) return;
-
- // abort if no potentially matching shortcuts found
- if (!(key in _handlers)) return;
-
- scope = getScope();
-
- // for each potential shortcut
- for (i = 0; i < _handlers[key].length; i++) {
- handler = _handlers[key][i];
-
- // see if it's in the current scope
- if (handler.scope == scope || handler.scope == 'all') {
- // check if modifiers match if any
- modifiersMatch = handler.mods.length > 0;
- for (k in _mods)
- if ((!_mods[k] && index(handler.mods, +k) > -1) ||
- (_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
- // call the handler and stop the event if neccessary
- if ((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch) {
- if (handler.method(event, handler) === false) {
- if (event.preventDefault) event.preventDefault();
- else event.returnValue = false;
- if (event.stopPropagation) event.stopPropagation();
- if (event.cancelBubble) event.cancelBubble = true;
- }
- }
- }
- }
- };
-
- // unset modifier keys on keyup
- function clearModifier(event) {
- var key = event.keyCode,
- k,
- i = index(_downKeys, key);
-
- // remove key from _downKeys
- if (i >= 0) {
- _downKeys.splice(i, 1);
- }
-
- if (key == 93 || key == 224) key = 91;
- if (key in _mods) {
- _mods[key] = false;
- for (k in _MODIFIERS)
- if (_MODIFIERS[k] == key) assignKey[k] = false;
- }
- };
-
- function resetModifiers() {
- for (k in _mods) _mods[k] = false;
- for (k in _MODIFIERS) assignKey[k] = false;
- };
-
- // parse and assign shortcut
- function assignKey(key, scope, method) {
- var keys, mods;
- keys = getKeys(key);
- if (method === undefined) {
- method = scope;
- scope = 'all';
- }
-
- // for each shortcut
- for (var i = 0; i < keys.length; i++) {
- // set modifier keys if any
- mods = [];
- key = keys[i].split('+');
- if (key.length > 1) {
- mods = getMods(key);
- key = [key[key.length - 1]];
- }
- // convert to keycode and...
- key = key[0]
- key = code(key);
- // ...store handler
- if (!(key in _handlers)) _handlers[key] = [];
- _handlers[key].push({
- shortcut: keys[i],
- scope: scope,
- method: method,
- key: keys[i],
- mods: mods
- });
- }
- };
-
- // unbind all handlers for given key in current scope
- function unbindKey(key, scope) {
- var multipleKeys, keys,
- mods = [],
- i, j, obj;
-
- multipleKeys = getKeys(key);
-
- for (j = 0; j < multipleKeys.length; j++) {
- keys = multipleKeys[j].split('+');
-
- if (keys.length > 1) {
- mods = getMods(keys);
- key = keys[keys.length - 1];
- }
-
- key = code(key);
-
- if (scope === undefined) {
- scope = getScope();
- }
- if (!_handlers[key]) {
- return;
- }
- for (i in _handlers[key]) {
- obj = _handlers[key][i];
- // only clear handlers if correct scope and mods match
- if (obj.scope === scope && compareArray(obj.mods, mods)) {
- _handlers[key][i] = {};
- }
- }
- }
- };
-
- // Returns true if the key with code 'keyCode' is currently down
- // Converts strings into key codes.
- function isPressed(keyCode) {
- if (typeof (keyCode) == 'string') {
- keyCode = code(keyCode);
- }
- return index(_downKeys, keyCode) != -1;
- }
-
- function getPressedKeyCodes() {
- return _downKeys.slice(0);
- }
-
- function filter(event) {
- var tagName = (event.target || event.srcElement).tagName;
- // ignore keypressed in any elements that support keyboard data input
- return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
- }
-
- // initialize key.<modifier> to false
- for (k in _MODIFIERS) assignKey[k] = false;
-
- // set current scope (default 'all')
- function setScope(scope) {
- _scope = scope || 'all'
- };
-
- function getScope() {
- return _scope || 'all'
- };
-
- // delete all handlers for a given scope
- function deleteScope(scope) {
- var key, handlers, i;
-
- for (key in _handlers) {
- handlers = _handlers[key];
- for (i = 0; i < handlers.length;) {
- if (handlers[i].scope === scope) handlers.splice(i, 1);
- else i++;
- }
- }
- };
-
- // abstract key logic for assign and unassign
- function getKeys(key) {
- var keys;
- key = key.replace(/\s/g, '');
- keys = key.split(',');
- if ((keys[keys.length - 1]) == '') {
- keys[keys.length - 2] += ',';
- }
- return keys;
- }
-
- // abstract mods logic for assign and unassign
- function getMods(key) {
- var mods = key.slice(0, key.length - 1);
- for (var mi = 0; mi < mods.length; mi++)
- mods[mi] = _MODIFIERS[mods[mi]];
- return mods;
- }
-
- // cross-browser events
- function addEvent(object, event, method) {
- if (object.addEventListener)
- object.addEventListener(event, method, false);
- else if (object.attachEvent)
- object.attachEvent('on' + event, function () {
- method(window.event)
- });
- };
-
- // set the handlers globally on document
- addEvent(document, 'keydown', function (event) {
- dispatch(event)
- }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
- addEvent(document, 'keyup', clearModifier);
-
- // reset modifiers to false whenever the window is (re)focused.
- addEvent(window, 'focus', resetModifiers);
-
- // store previously defined key
- var previousKey = global.key;
-
- // restore previously defined key and return reference to our key object
- function noConflict() {
- var k = global.key;
- global.key = previousKey;
- return k;
- }
-
- // set window.key and window.key.set/get/deleteScope, and the default filter
- global.key = assignKey;
- global.key.setScope = setScope;
- global.key.getScope = getScope;
- global.key.deleteScope = deleteScope;
- global.key.filter = filter;
- global.key.isPressed = isPressed;
- global.key.getPressedKeyCodes = getPressedKeyCodes;
- global.key.noConflict = noConflict;
- global.key.unbind = unbindKey;
-
- if (true) module.exports = key;
-
- })(window);
- /***/ }),
- /* 102 */
- /***/ (function(module, exports, __webpack_require__) {
- /*istanbul ignore next*/'use strict';
-
- var marked = __webpack_require__(103);
- var Prism = __webpack_require__(104);
-
- //language
- __webpack_require__(105);
- __webpack_require__(106);
- __webpack_require__(107);
- __webpack_require__(108);
- __webpack_require__(109);
- __webpack_require__(110);
- __webpack_require__(111);
- __webpack_require__(112);
- __webpack_require__(113);
- __webpack_require__(114);
- __webpack_require__(115);
- __webpack_require__(116);
- __webpack_require__(117);
- __webpack_require__(118);
- __webpack_require__(119);
- __webpack_require__(120);
- __webpack_require__(121);
- __webpack_require__(122);
- __webpack_require__(123);
- __webpack_require__(124);
- __webpack_require__(125);
- __webpack_require__(126);
- __webpack_require__(127);
- __webpack_require__(128);
- __webpack_require__(129);
- __webpack_require__(130);
- __webpack_require__(131);
- __webpack_require__(132);
- __webpack_require__(133);
- __webpack_require__(134);
- __webpack_require__(135);
- __webpack_require__(136);
- __webpack_require__(137);
- __webpack_require__(138);
- __webpack_require__(139);
- __webpack_require__(140);
- __webpack_require__(141);
- __webpack_require__(142);
- __webpack_require__(143);
- __webpack_require__(144);
- __webpack_require__(145);
- __webpack_require__(146);
- __webpack_require__(147);
- __webpack_require__(148);
- __webpack_require__(149);
- __webpack_require__(150);
-
- //alias
- Prism.languages.js = Prism.languages.javascript;
- Prism.languages['c#'] = Prism.languages.csharp;
- Prism.languages['f#'] = Prism.languages.fsharp;
- Prism.languages.sh = Prism.languages.bash;
- Prism.languages.md = Prism.languages.markdown;
- Prism.languages.py = Prism.languages.python;
- Prism.languages.yml = Prism.languages.yaml;
- Prism.languages.rb = Prism.languages.ruby;
-
- var Parser = function Parser(options) {
- options = options || {};
- this.options = options;
- };
-
- Parser.highlights = {};
- Parser.marked = marked;
- Parser.Prism = Prism;
-
- //使标题解析 # 号可以无空格
- marked.Lexer.rules.gfm.heading = marked.Lexer.rules.heading;
- marked.Lexer.rules.tables.heading = marked.Lexer.rules.heading;
-
- var renderer = new marked.Renderer();
- Parser.renderer = renderer;
- marked.setOptions({
- renderer: renderer, gfm: true, tables: true, breaks: true, //可行尾不加两空格直接换行
- pedantic: false,
- sanitize: false,
- smartLists: true,
- smartypants: false,
- mangle: false,
- highlight: function /*istanbul ignore next*/highlight(code, lang, callback) {
- if (Parser.highlights[lang]) {
- var result = Parser.highlights[lang].parse(code, lang, callback);
- if (!callback) return result;
- } else if (Prism.languages[lang]) {
- var _result = Prism.highlight(code, Prism.languages[lang]);
- if (callback) return callback(null, _result);else return _result;
- } else {
- if (callback) //eslint-disable-line
- return callback(null, code);else return code;
- }
- }
- });
-
- Parser.prototype.parse = function (mdText, callback) {
- return marked(mdText, callback);
- };
-
- module.exports = Parser;
- /***/ }),
- /* 103 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {/**
- * marked - a markdown parser
- * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
- * https://github.com/chjj/marked
- */
-
- ;(function() {
-
- /**
- * Block-Level Grammar
- */
-
- var block = {
- newline: /^\n+/,
- code: /^( {4}[^\n]+\n*)+/,
- fences: noop,
- hr: /^( *[-*_]){3,} *(?:\n+|$)/,
- heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
- nptable: noop,
- lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
- blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
- list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
- html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
- table: noop,
- paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
- text: /^[^\n]+/
- };
-
- block.bullet = /(?:[*+-]|\d+\.)/;
- block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
- block.item = replace(block.item, 'gm')
- (/bull/g, block.bullet)
- ();
-
- block.list = replace(block.list)
- (/bull/g, block.bullet)
- ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
- ('def', '\\n+(?=' + block.def.source + ')')
- ();
-
- block.blockquote = replace(block.blockquote)
- ('def', block.def)
- ();
-
- block._tag = '(?!(?:'
- + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
- + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
- + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
-
- block.html = replace(block.html)
- ('comment', /<!--[\s\S]*?-->/)
- ('closed', /<(tag)[\s\S]+?<\/\1>/)
- ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
- (/tag/g, block._tag)
- ();
-
- block.paragraph = replace(block.paragraph)
- ('hr', block.hr)
- ('heading', block.heading)
- ('lheading', block.lheading)
- ('blockquote', block.blockquote)
- ('tag', '<' + block._tag)
- ('def', block.def)
- ();
-
- /**
- * Normal Block Grammar
- */
-
- block.normal = merge({}, block);
-
- /**
- * GFM Block Grammar
- */
-
- block.gfm = merge({}, block.normal, {
- fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,
- paragraph: /^/,
- heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
- });
-
- block.gfm.paragraph = replace(block.paragraph)
- ('(?!', '(?!'
- + block.gfm.fences.source.replace('\\1', '\\2') + '|'
- + block.list.source.replace('\\1', '\\3') + '|')
- ();
-
- /**
- * GFM + Tables Block Grammar
- */
-
- block.tables = merge({}, block.gfm, {
- nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
- table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
- });
-
- /**
- * Block Lexer
- */
-
- function Lexer(options) {
- this.tokens = [];
- this.tokens.links = {};
- this.options = options || marked.defaults;
- this.rules = block.normal;
-
- if (this.options.gfm) {
- if (this.options.tables) {
- this.rules = block.tables;
- } else {
- this.rules = block.gfm;
- }
- }
- }
-
- /**
- * Expose Block Rules
- */
-
- Lexer.rules = block;
-
- /**
- * Static Lex Method
- */
-
- Lexer.lex = function(src, options) {
- var lexer = new Lexer(options);
- return lexer.lex(src);
- };
-
- /**
- * Preprocessing
- */
-
- Lexer.prototype.lex = function(src) {
- src = src
- .replace(/\r\n|\r/g, '\n')
- .replace(/\t/g, ' ')
- .replace(/\u00a0/g, ' ')
- .replace(/\u2424/g, '\n');
-
- return this.token(src, true);
- };
-
- /**
- * Lexing
- */
-
- Lexer.prototype.token = function(src, top, bq) {
- var src = src.replace(/^ +$/gm, '')
- , next
- , loose
- , cap
- , bull
- , b
- , item
- , space
- , i
- , l;
-
- while (src) {
- // newline
- if (cap = this.rules.newline.exec(src)) {
- src = src.substring(cap[0].length);
- if (cap[0].length > 1) {
- this.tokens.push({
- type: 'space'
- });
- }
- }
-
- // code
- if (cap = this.rules.code.exec(src)) {
- src = src.substring(cap[0].length);
- cap = cap[0].replace(/^ {4}/gm, '');
- this.tokens.push({
- type: 'code',
- text: !this.options.pedantic
- ? cap.replace(/\n+$/, '')
- : cap
- });
- continue;
- }
-
- // fences (gfm)
- if (cap = this.rules.fences.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'code',
- lang: cap[2],
- text: cap[3] || ''
- });
- continue;
- }
-
- // heading
- if (cap = this.rules.heading.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'heading',
- depth: cap[1].length,
- text: cap[2]
- });
- continue;
- }
-
- // table no leading pipe (gfm)
- if (top && (cap = this.rules.nptable.exec(src))) {
- src = src.substring(cap[0].length);
-
- item = {
- type: 'table',
- header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3].replace(/\n$/, '').split('\n')
- };
-
- for (i = 0; i < item.align.length; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
- }
- }
-
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = item.cells[i].split(/ *\| */);
- }
-
- this.tokens.push(item);
-
- continue;
- }
-
- // lheading
- if (cap = this.rules.lheading.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'heading',
- depth: cap[2] === '=' ? 1 : 2,
- text: cap[1]
- });
- continue;
- }
-
- // hr
- if (cap = this.rules.hr.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'hr'
- });
- continue;
- }
-
- // blockquote
- if (cap = this.rules.blockquote.exec(src)) {
- src = src.substring(cap[0].length);
-
- this.tokens.push({
- type: 'blockquote_start'
- });
-
- cap = cap[0].replace(/^ *> ?/gm, '');
-
- // Pass `top` to keep the current
- // "toplevel" state. This is exactly
- // how markdown.pl works.
- this.token(cap, top, true);
-
- this.tokens.push({
- type: 'blockquote_end'
- });
-
- continue;
- }
-
- // list
- if (cap = this.rules.list.exec(src)) {
- src = src.substring(cap[0].length);
- bull = cap[2];
-
- this.tokens.push({
- type: 'list_start',
- ordered: bull.length > 1
- });
-
- // Get each top-level item.
- cap = cap[0].match(this.rules.item);
-
- next = false;
- l = cap.length;
- i = 0;
-
- for (; i < l; i++) {
- item = cap[i];
-
- // Remove the list item's bullet
- // so it is seen as the next token.
- space = item.length;
- item = item.replace(/^ *([*+-]|\d+\.) +/, '');
-
- // Outdent whatever the
- // list item contains. Hacky.
- if (~item.indexOf('\n ')) {
- space -= item.length;
- item = !this.options.pedantic
- ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
- : item.replace(/^ {1,4}/gm, '');
- }
-
- // Determine whether the next list item belongs here.
- // Backpedal if it does not belong in this list.
- if (this.options.smartLists && i !== l - 1) {
- b = block.bullet.exec(cap[i + 1])[0];
- if (bull !== b && !(bull.length > 1 && b.length > 1)) {
- src = cap.slice(i + 1).join('\n') + src;
- i = l - 1;
- }
- }
-
- // Determine whether item is loose or not.
- // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
- // for discount behavior.
- loose = next || /\n\n(?!\s*$)/.test(item);
- if (i !== l - 1) {
- next = item.charAt(item.length - 1) === '\n';
- if (!loose) loose = next;
- }
-
- this.tokens.push({
- type: loose
- ? 'loose_item_start'
- : 'list_item_start'
- });
-
- // Recurse.
- this.token(item, false, bq);
-
- this.tokens.push({
- type: 'list_item_end'
- });
- }
-
- this.tokens.push({
- type: 'list_end'
- });
-
- continue;
- }
-
- // html
- if (cap = this.rules.html.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: this.options.sanitize
- ? 'paragraph'
- : 'html',
- pre: !this.options.sanitizer
- && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
- text: cap[0]
- });
- continue;
- }
-
- // def
- if ((!bq && top) && (cap = this.rules.def.exec(src))) {
- src = src.substring(cap[0].length);
- this.tokens.links[cap[1].toLowerCase()] = {
- href: cap[2],
- title: cap[3]
- };
- continue;
- }
-
- // table (gfm)
- if (top && (cap = this.rules.table.exec(src))) {
- src = src.substring(cap[0].length);
-
- item = {
- type: 'table',
- header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
- };
-
- for (i = 0; i < item.align.length; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
- }
- }
-
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = item.cells[i]
- .replace(/^ *\| *| *\| *$/g, '')
- .split(/ *\| */);
- }
-
- this.tokens.push(item);
-
- continue;
- }
-
- // top-level paragraph
- if (top && (cap = this.rules.paragraph.exec(src))) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'paragraph',
- text: cap[1].charAt(cap[1].length - 1) === '\n'
- ? cap[1].slice(0, -1)
- : cap[1]
- });
- continue;
- }
-
- // text
- if (cap = this.rules.text.exec(src)) {
- // Top-level should never reach here.
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'text',
- text: cap[0]
- });
- continue;
- }
-
- if (src) {
- throw new
- Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
- }
-
- return this.tokens;
- };
-
- /**
- * Inline-Level Grammar
- */
-
- var inline = {
- escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
- autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
- url: noop,
- tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
- link: /^!?\[(inside)\]\(href\)/,
- reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
- nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
- strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
- em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
- code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
- br: /^ {2,}\n(?!\s*$)/,
- del: noop,
- text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
- };
-
- inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
- inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
-
- inline.link = replace(inline.link)
- ('inside', inline._inside)
- ('href', inline._href)
- ();
-
- inline.reflink = replace(inline.reflink)
- ('inside', inline._inside)
- ();
-
- /**
- * Normal Inline Grammar
- */
-
- inline.normal = merge({}, inline);
-
- /**
- * Pedantic Inline Grammar
- */
-
- inline.pedantic = merge({}, inline.normal, {
- strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
- em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
- });
-
- /**
- * GFM Inline Grammar
- */
-
- inline.gfm = merge({}, inline.normal, {
- escape: replace(inline.escape)('])', '~|])')(),
- url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
- del: /^~~(?=\S)([\s\S]*?\S)~~/,
- text: replace(inline.text)
- (']|', '~]|')
- ('|', '|https?://|')
- ()
- });
-
- /**
- * GFM + Line Breaks Inline Grammar
- */
-
- inline.breaks = merge({}, inline.gfm, {
- br: replace(inline.br)('{2,}', '*')(),
- text: replace(inline.gfm.text)('{2,}', '*')()
- });
-
- /**
- * Inline Lexer & Compiler
- */
-
- function InlineLexer(links, options) {
- this.options = options || marked.defaults;
- this.links = links;
- this.rules = inline.normal;
- this.renderer = this.options.renderer || new Renderer;
- this.renderer.options = this.options;
-
- if (!this.links) {
- throw new
- Error('Tokens array requires a `links` property.');
- }
-
- if (this.options.gfm) {
- if (this.options.breaks) {
- this.rules = inline.breaks;
- } else {
- this.rules = inline.gfm;
- }
- } else if (this.options.pedantic) {
- this.rules = inline.pedantic;
- }
- }
-
- /**
- * Expose Inline Rules
- */
-
- InlineLexer.rules = inline;
-
- /**
- * Static Lexing/Compiling Method
- */
-
- InlineLexer.output = function(src, links, options) {
- var inline = new InlineLexer(links, options);
- return inline.output(src);
- };
-
- /**
- * Lexing/Compiling
- */
-
- InlineLexer.prototype.output = function(src) {
- var out = ''
- , link
- , text
- , href
- , cap;
-
- while (src) {
- // escape
- if (cap = this.rules.escape.exec(src)) {
- src = src.substring(cap[0].length);
- out += cap[1];
- continue;
- }
-
- // autolink
- if (cap = this.rules.autolink.exec(src)) {
- src = src.substring(cap[0].length);
- if (cap[2] === '@') {
- text = cap[1].charAt(6) === ':'
- ? this.mangle(cap[1].substring(7))
- : this.mangle(cap[1]);
- href = this.mangle('mailto:') + text;
- } else {
- text = escape(cap[1]);
- href = text;
- }
- out += this.renderer.link(href, null, text);
- continue;
- }
-
- // url (gfm)
- if (!this.inLink && (cap = this.rules.url.exec(src))) {
- src = src.substring(cap[0].length);
- text = escape(cap[1]);
- href = text;
- out += this.renderer.link(href, null, text);
- continue;
- }
-
- // tag
- if (cap = this.rules.tag.exec(src)) {
- if (!this.inLink && /^<a /i.test(cap[0])) {
- this.inLink = true;
- } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
- this.inLink = false;
- }
- src = src.substring(cap[0].length);
- out += this.options.sanitize
- ? this.options.sanitizer
- ? this.options.sanitizer(cap[0])
- : escape(cap[0])
- : cap[0]
- continue;
- }
-
- // link
- if (cap = this.rules.link.exec(src)) {
- src = src.substring(cap[0].length);
- this.inLink = true;
- out += this.outputLink(cap, {
- href: cap[2],
- title: cap[3]
- });
- this.inLink = false;
- continue;
- }
-
- // reflink, nolink
- if ((cap = this.rules.reflink.exec(src))
- || (cap = this.rules.nolink.exec(src))) {
- src = src.substring(cap[0].length);
- link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
- link = this.links[link.toLowerCase()];
- if (!link || !link.href) {
- out += cap[0].charAt(0);
- src = cap[0].substring(1) + src;
- continue;
- }
- this.inLink = true;
- out += this.outputLink(cap, link);
- this.inLink = false;
- continue;
- }
-
- // strong
- if (cap = this.rules.strong.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.strong(this.output(cap[2] || cap[1]));
- continue;
- }
-
- // em
- if (cap = this.rules.em.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.em(this.output(cap[2] || cap[1]));
- continue;
- }
-
- // code
- if (cap = this.rules.code.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.codespan(escape(cap[2], true));
- continue;
- }
-
- // br
- if (cap = this.rules.br.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.br();
- continue;
- }
-
- // del (gfm)
- if (cap = this.rules.del.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.del(this.output(cap[1]));
- continue;
- }
-
- // text
- if (cap = this.rules.text.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.text(escape(this.smartypants(cap[0])));
- continue;
- }
-
- if (src) {
- throw new
- Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
- }
-
- return out;
- };
-
- /**
- * Compile Link
- */
-
- InlineLexer.prototype.outputLink = function(cap, link) {
- var href = escape(link.href)
- , title = link.title ? escape(link.title) : null;
-
- return cap[0].charAt(0) !== '!'
- ? this.renderer.link(href, title, this.output(cap[1]))
- : this.renderer.image(href, title, escape(cap[1]));
- };
-
- /**
- * Smartypants Transformations
- */
-
- InlineLexer.prototype.smartypants = function(text) {
- if (!this.options.smartypants) return text;
- return text
- // em-dashes
- .replace(/---/g, '\u2014')
- // en-dashes
- .replace(/--/g, '\u2013')
- // opening singles
- .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
- // closing singles & apostrophes
- .replace(/'/g, '\u2019')
- // opening doubles
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
- // closing doubles
- .replace(/"/g, '\u201d')
- // ellipses
- .replace(/\.{3}/g, '\u2026');
- };
-
- /**
- * Mangle Links
- */
-
- InlineLexer.prototype.mangle = function(text) {
- if (!this.options.mangle) return text;
- var out = ''
- , l = text.length
- , i = 0
- , ch;
-
- for (; i < l; i++) {
- ch = text.charCodeAt(i);
- if (Math.random() > 0.5) {
- ch = 'x' + ch.toString(16);
- }
- out += '&#' + ch + ';';
- }
-
- return out;
- };
-
- /**
- * Renderer
- */
-
- function Renderer(options) {
- this.options = options || {};
- }
-
- Renderer.prototype.code = function(code, lang, escaped) {
- if (this.options.highlight) {
- var out = this.options.highlight(code, lang);
- if (out != null && out !== code) {
- escaped = true;
- code = out;
- }
- }
-
- if (!lang) {
- return '<pre><code>'
- + (escaped ? code : escape(code, true))
- + '\n</code></pre>';
- }
-
- return '<pre><code class="'
- + this.options.langPrefix
- + escape(lang, true)
- + '">'
- + (escaped ? code : escape(code, true))
- + '\n</code></pre>\n';
- };
-
- Renderer.prototype.blockquote = function(quote) {
- return '<blockquote>\n' + quote + '</blockquote>\n';
- };
-
- Renderer.prototype.html = function(html) {
- return html;
- };
-
- Renderer.prototype.heading = function(text, level, raw) {
- return '<h'
- + level
- + ' id="'
- + this.options.headerPrefix
- + raw.toLowerCase().replace(/[^\w]+/g, '-')
- + '">'
- + text
- + '</h'
- + level
- + '>\n';
- };
-
- Renderer.prototype.hr = function() {
- return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
- };
-
- Renderer.prototype.list = function(body, ordered) {
- var type = ordered ? 'ol' : 'ul';
- return '<' + type + '>\n' + body + '</' + type + '>\n';
- };
-
- Renderer.prototype.listitem = function(text) {
- return '<li>' + text + '</li>\n';
- };
-
- Renderer.prototype.paragraph = function(text) {
- return '<p>' + text + '</p>\n';
- };
-
- Renderer.prototype.table = function(header, body) {
- return '<table>\n'
- + '<thead>\n'
- + header
- + '</thead>\n'
- + '<tbody>\n'
- + body
- + '</tbody>\n'
- + '</table>\n';
- };
-
- Renderer.prototype.tablerow = function(content) {
- return '<tr>\n' + content + '</tr>\n';
- };
-
- Renderer.prototype.tablecell = function(content, flags) {
- var type = flags.header ? 'th' : 'td';
- var tag = flags.align
- ? '<' + type + ' style="text-align:' + flags.align + '">'
- : '<' + type + '>';
- return tag + content + '</' + type + '>\n';
- };
-
- // span level renderer
- Renderer.prototype.strong = function(text) {
- return '<strong>' + text + '</strong>';
- };
-
- Renderer.prototype.em = function(text) {
- return '<em>' + text + '</em>';
- };
-
- Renderer.prototype.codespan = function(text) {
- return '<code>' + text + '</code>';
- };
-
- Renderer.prototype.br = function() {
- return this.options.xhtml ? '<br/>' : '<br>';
- };
-
- Renderer.prototype.del = function(text) {
- return '<del>' + text + '</del>';
- };
-
- Renderer.prototype.link = function(href, title, text) {
- if (this.options.sanitize) {
- try {
- var prot = decodeURIComponent(unescape(href))
- .replace(/[^\w:]/g, '')
- .toLowerCase();
- } catch (e) {
- return '';
- }
- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
- return '';
- }
- }
- var out = '<a href="' + href + '"';
- if (title) {
- out += ' title="' + title + '"';
- }
- out += '>' + text + '</a>';
- return out;
- };
-
- Renderer.prototype.image = function(href, title, text) {
- var out = '<img src="' + href + '" alt="' + text + '"';
- if (title) {
- out += ' title="' + title + '"';
- }
- out += this.options.xhtml ? '/>' : '>';
- return out;
- };
-
- Renderer.prototype.text = function(text) {
- return text;
- };
-
- /**
- * Parsing & Compiling
- */
-
- function Parser(options) {
- this.tokens = [];
- this.token = null;
- this.options = options || marked.defaults;
- this.options.renderer = this.options.renderer || new Renderer;
- this.renderer = this.options.renderer;
- this.renderer.options = this.options;
- }
-
- /**
- * Static Parse Method
- */
-
- Parser.parse = function(src, options, renderer) {
- var parser = new Parser(options, renderer);
- return parser.parse(src);
- };
-
- /**
- * Parse Loop
- */
-
- Parser.prototype.parse = function(src) {
- this.inline = new InlineLexer(src.links, this.options, this.renderer);
- this.tokens = src.reverse();
-
- var out = '';
- while (this.next()) {
- out += this.tok();
- }
-
- return out;
- };
-
- /**
- * Next Token
- */
-
- Parser.prototype.next = function() {
- return this.token = this.tokens.pop();
- };
-
- /**
- * Preview Next Token
- */
-
- Parser.prototype.peek = function() {
- return this.tokens[this.tokens.length - 1] || 0;
- };
-
- /**
- * Parse Text Tokens
- */
-
- Parser.prototype.parseText = function() {
- var body = this.token.text;
-
- while (this.peek().type === 'text') {
- body += '\n' + this.next().text;
- }
-
- return this.inline.output(body);
- };
-
- /**
- * Parse Current Token
- */
-
- Parser.prototype.tok = function() {
- switch (this.token.type) {
- case 'space': {
- return '';
- }
- case 'hr': {
- return this.renderer.hr();
- }
- case 'heading': {
- return this.renderer.heading(
- this.inline.output(this.token.text),
- this.token.depth,
- this.token.text);
- }
- case 'code': {
- return this.renderer.code(this.token.text,
- this.token.lang,
- this.token.escaped);
- }
- case 'table': {
- var header = ''
- , body = ''
- , i
- , row
- , cell
- , flags
- , j;
-
- // header
- cell = '';
- for (i = 0; i < this.token.header.length; i++) {
- flags = { header: true, align: this.token.align[i] };
- cell += this.renderer.tablecell(
- this.inline.output(this.token.header[i]),
- { header: true, align: this.token.align[i] }
- );
- }
- header += this.renderer.tablerow(cell);
-
- for (i = 0; i < this.token.cells.length; i++) {
- row = this.token.cells[i];
-
- cell = '';
- for (j = 0; j < row.length; j++) {
- cell += this.renderer.tablecell(
- this.inline.output(row[j]),
- { header: false, align: this.token.align[j] }
- );
- }
-
- body += this.renderer.tablerow(cell);
- }
- return this.renderer.table(header, body);
- }
- case 'blockquote_start': {
- var body = '';
-
- while (this.next().type !== 'blockquote_end') {
- body += this.tok();
- }
-
- return this.renderer.blockquote(body);
- }
- case 'list_start': {
- var body = ''
- , ordered = this.token.ordered;
-
- while (this.next().type !== 'list_end') {
- body += this.tok();
- }
-
- return this.renderer.list(body, ordered);
- }
- case 'list_item_start': {
- var body = '';
-
- while (this.next().type !== 'list_item_end') {
- body += this.token.type === 'text'
- ? this.parseText()
- : this.tok();
- }
-
- return this.renderer.listitem(body);
- }
- case 'loose_item_start': {
- var body = '';
-
- while (this.next().type !== 'list_item_end') {
- body += this.tok();
- }
-
- return this.renderer.listitem(body);
- }
- case 'html': {
- var html = !this.token.pre && !this.options.pedantic
- ? this.inline.output(this.token.text)
- : this.token.text;
- return this.renderer.html(html);
- }
- case 'paragraph': {
- return this.renderer.paragraph(this.inline.output(this.token.text));
- }
- case 'text': {
- return this.renderer.paragraph(this.parseText());
- }
- }
- };
-
- /**
- * Helpers
- */
-
- function escape(html, encode) {
- return html
- .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''');
- }
-
- function unescape(html) {
- // explicitly match decimal, hex, and named HTML entities
- return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) {
- n = n.toLowerCase();
- if (n === 'colon') return ':';
- if (n.charAt(0) === '#') {
- return n.charAt(1) === 'x'
- ? String.fromCharCode(parseInt(n.substring(2), 16))
- : String.fromCharCode(+n.substring(1));
- }
- return '';
- });
- }
-
- function replace(regex, opt) {
- regex = regex.source;
- opt = opt || '';
- return function self(name, val) {
- if (!name) return new RegExp(regex, opt);
- val = val.source || val;
- val = val.replace(/(^|[^\[])\^/g, '$1');
- regex = regex.replace(name, val);
- return self;
- };
- }
-
- function noop() {}
- noop.exec = noop;
-
- function merge(obj) {
- var i = 1
- , target
- , key;
-
- for (; i < arguments.length; i++) {
- target = arguments[i];
- for (key in target) {
- if (Object.prototype.hasOwnProperty.call(target, key)) {
- obj[key] = target[key];
- }
- }
- }
-
- return obj;
- }
-
-
- /**
- * Marked
- */
-
- function marked(src, opt, callback) {
- if (callback || typeof opt === 'function') {
- if (!callback) {
- callback = opt;
- opt = null;
- }
-
- opt = merge({}, marked.defaults, opt || {});
-
- var highlight = opt.highlight
- , tokens
- , pending
- , i = 0;
-
- try {
- tokens = Lexer.lex(src, opt)
- } catch (e) {
- return callback(e);
- }
-
- pending = tokens.length;
-
- var done = function(err) {
- if (err) {
- opt.highlight = highlight;
- return callback(err);
- }
-
- var out;
-
- try {
- out = Parser.parse(tokens, opt);
- } catch (e) {
- err = e;
- }
-
- opt.highlight = highlight;
-
- return err
- ? callback(err)
- : callback(null, out);
- };
-
- if (!highlight || highlight.length < 3) {
- return done();
- }
-
- delete opt.highlight;
-
- if (!pending) return done();
-
- for (; i < tokens.length; i++) {
- (function(token) {
- if (token.type !== 'code') {
- return --pending || done();
- }
- return highlight(token.text, token.lang, function(err, code) {
- if (err) return done(err);
- if (code == null || code === token.text) {
- return --pending || done();
- }
- token.text = code;
- token.escaped = true;
- --pending || done();
- });
- })(tokens[i]);
- }
-
- return;
- }
- try {
- if (opt) opt = merge({}, marked.defaults, opt);
- return Parser.parse(Lexer.lex(src, opt), opt);
- } catch (e) {
- e.message += '\nPlease report this to https://github.com/chjj/marked.';
- if ((opt || marked.defaults).silent) {
- return '<p>An error occured:</p><pre>'
- + escape(e.message + '', true)
- + '</pre>';
- }
- throw e;
- }
- }
-
- /**
- * Options
- */
-
- marked.options =
- marked.setOptions = function(opt) {
- merge(marked.defaults, opt);
- return marked;
- };
-
- marked.defaults = {
- gfm: true,
- tables: true,
- breaks: false,
- pedantic: false,
- sanitize: false,
- sanitizer: null,
- mangle: true,
- smartLists: false,
- silent: false,
- highlight: null,
- langPrefix: 'lang-',
- smartypants: false,
- headerPrefix: '',
- renderer: new Renderer,
- xhtml: false
- };
-
- /**
- * Expose
- */
-
- marked.Parser = Parser;
- marked.parser = Parser.parse;
-
- marked.Renderer = Renderer;
-
- marked.Lexer = Lexer;
- marked.lexer = Lexer.lex;
-
- marked.InlineLexer = InlineLexer;
- marked.inlineLexer = InlineLexer.output;
-
- marked.parse = marked;
-
- if (true) {
- module.exports = marked;
- } else if (typeof define === 'function' && define.amd) {
- define(function() { return marked; });
- } else {
- this.marked = marked;
- }
-
- }).call(function() {
- return this || (typeof window !== 'undefined' ? window : global);
- }());
-
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
- /***/ }),
- /* 104 */
- /***/ (function(module, exports) {
- /* WEBPACK VAR INJECTION */(function(global) {
- /* **********************************************
- Begin prism-core.js
- ********************************************** */
-
- var _self = (typeof window !== 'undefined')
- ? window // if in browser
- : (
- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
- ? self // if in worker
- : {} // if in node js
- );
-
- /**
- * Prism: Lightweight, robust, elegant syntax highlighting
- * MIT license http://www.opensource.org/licenses/mit-license.php/
- * @author Lea Verou http://lea.verou.me
- */
-
- var Prism = (function(){
-
- // Private helper vars
- var lang = /\blang(?:uage)?-(\w+)\b/i;
- var uniqueId = 0;
-
- var _ = _self.Prism = {
- manual: _self.Prism && _self.Prism.manual,
- util: {
- encode: function (tokens) {
- if (tokens instanceof Token) {
- return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
- } else if (_.util.type(tokens) === 'Array') {
- return tokens.map(_.util.encode);
- } else {
- return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
- }
- },
-
- type: function (o) {
- return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
- },
-
- objId: function (obj) {
- if (!obj['__id']) {
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
- }
- return obj['__id'];
- },
-
- // Deep clone a language definition (e.g. to extend it)
- clone: function (o) {
- var type = _.util.type(o);
-
- switch (type) {
- case 'Object':
- var clone = {};
-
- for (var key in o) {
- if (o.hasOwnProperty(key)) {
- clone[key] = _.util.clone(o[key]);
- }
- }
-
- return clone;
-
- case 'Array':
- return o.map(function(v) { return _.util.clone(v); });
- }
-
- return o;
- }
- },
-
- languages: {
- extend: function (id, redef) {
- var lang = _.util.clone(_.languages[id]);
-
- for (var key in redef) {
- lang[key] = redef[key];
- }
-
- return lang;
- },
-
- /**
- * Insert a token before another token in a language literal
- * As this needs to recreate the object (we cannot actually insert before keys in object literals),
- * we cannot just provide an object, we need anobject and a key.
- * @param inside The key (or language id) of the parent
- * @param before The key to insert before. If not provided, the function appends instead.
- * @param insert Object with the key/value pairs to insert
- * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
- */
- insertBefore: function (inside, before, insert, root) {
- root = root || _.languages;
- var grammar = root[inside];
-
- if (arguments.length == 2) {
- insert = arguments[1];
-
- for (var newToken in insert) {
- if (insert.hasOwnProperty(newToken)) {
- grammar[newToken] = insert[newToken];
- }
- }
-
- return grammar;
- }
-
- var ret = {};
-
- for (var token in grammar) {
-
- if (grammar.hasOwnProperty(token)) {
-
- if (token == before) {
-
- for (var newToken in insert) {
-
- if (insert.hasOwnProperty(newToken)) {
- ret[newToken] = insert[newToken];
- }
- }
- }
-
- ret[token] = grammar[token];
- }
- }
-
- // Update references in other language definitions
- _.languages.DFS(_.languages, function(key, value) {
- if (value === root[inside] && key != inside) {
- this[key] = ret;
- }
- });
-
- return root[inside] = ret;
- },
-
- // Traverse a language definition with Depth First Search
- DFS: function(o, callback, type, visited) {
- visited = visited || {};
- for (var i in o) {
- if (o.hasOwnProperty(i)) {
- callback.call(o, i, o[i], type || i);
-
- if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
- visited[_.util.objId(o[i])] = true;
- _.languages.DFS(o[i], callback, null, visited);
- }
- else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
- visited[_.util.objId(o[i])] = true;
- _.languages.DFS(o[i], callback, i, visited);
- }
- }
- }
- }
- },
- plugins: {},
-
- highlightAll: function(async, callback) {
- var env = {
- callback: callback,
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
- };
-
- _.hooks.run("before-highlightall", env);
-
- var elements = env.elements || document.querySelectorAll(env.selector);
-
- for (var i=0, element; element = elements[i++];) {
- _.highlightElement(element, async === true, env.callback);
- }
- },
-
- highlightElement: function(element, async, callback) {
- // Find language
- var language, grammar, parent = element;
-
- while (parent && !lang.test(parent.className)) {
- parent = parent.parentNode;
- }
-
- if (parent) {
- language = (parent.className.match(lang) || [,''])[1].toLowerCase();
- grammar = _.languages[language];
- }
-
- // Set language on the element, if not present
- element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
-
- // Set language on the parent, for styling
- parent = element.parentNode;
-
- if (/pre/i.test(parent.nodeName)) {
- parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
- }
-
- var code = element.textContent;
-
- var env = {
- element: element,
- language: language,
- grammar: grammar,
- code: code
- };
-
- _.hooks.run('before-sanity-check', env);
-
- if (!env.code || !env.grammar) {
- if (env.code) {
- _.hooks.run('before-highlight', env);
- env.element.textContent = env.code;
- _.hooks.run('after-highlight', env);
- }
- _.hooks.run('complete', env);
- return;
- }
-
- _.hooks.run('before-highlight', env);
-
- if (async && _self.Worker) {
- var worker = new Worker(_.filename);
-
- worker.onmessage = function(evt) {
- env.highlightedCode = evt.data;
-
- _.hooks.run('before-insert', env);
-
- env.element.innerHTML = env.highlightedCode;
-
- callback && callback.call(env.element);
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
- };
-
- worker.postMessage(JSON.stringify({
- language: env.language,
- code: env.code,
- immediateClose: true
- }));
- }
- else {
- env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
-
- _.hooks.run('before-insert', env);
-
- env.element.innerHTML = env.highlightedCode;
-
- callback && callback.call(element);
-
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
- }
- },
-
- highlight: function (text, grammar, language) {
- var tokens = _.tokenize(text, grammar);
- return Token.stringify(_.util.encode(tokens), language);
- },
-
- matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
- var Token = _.Token;
-
- for (var token in grammar) {
- if(!grammar.hasOwnProperty(token) || !grammar[token]) {
- continue;
- }
-
- if (token == target) {
- return;
- }
-
- var patterns = grammar[token];
- patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
-
- for (var j = 0; j < patterns.length; ++j) {
- var pattern = patterns[j],
- inside = pattern.inside,
- lookbehind = !!pattern.lookbehind,
- greedy = !!pattern.greedy,
- lookbehindLength = 0,
- alias = pattern.alias;
-
- if (greedy && !pattern.pattern.global) {
- // Without the global flag, lastIndex won't work
- var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
- pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
- }
-
- pattern = pattern.pattern || pattern;
-
- // Don’t cache length as it changes during the loop
- for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
-
- var str = strarr[i];
-
- if (strarr.length > text.length) {
- // Something went terribly wrong, ABORT, ABORT!
- return;
- }
-
- if (str instanceof Token) {
- continue;
- }
-
- pattern.lastIndex = 0;
-
- var match = pattern.exec(str),
- delNum = 1;
-
- // Greedy patterns can override/remove up to two previously matched tokens
- if (!match && greedy && i != strarr.length - 1) {
- pattern.lastIndex = pos;
- match = pattern.exec(text);
- if (!match) {
- break;
- }
-
- var from = match.index + (lookbehind ? match[1].length : 0),
- to = match.index + match[0].length,
- k = i,
- p = pos;
-
- for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
- p += strarr[k].length;
- // Move the index i to the element in strarr that is closest to from
- if (from >= p) {
- ++i;
- pos = p;
- }
- }
-
- /*
- * If strarr[i] is a Token, then the match starts inside another Token, which is invalid
- * If strarr[k - 1] is greedy we are in conflict with another greedy pattern
- */
- if (strarr[i] instanceof Token || strarr[k - 1].greedy) {
- continue;
- }
-
- // Number of tokens to delete and replace with the new match
- delNum = k - i;
- str = text.slice(pos, p);
- match.index -= pos;
- }
-
- if (!match) {
- if (oneshot) {
- break;
- }
-
- continue;
- }
-
- if(lookbehind) {
- lookbehindLength = match[1].length;
- }
-
- var from = match.index + lookbehindLength,
- match = match[0].slice(lookbehindLength),
- to = from + match.length,
- before = str.slice(0, from),
- after = str.slice(to);
-
- var args = [i, delNum];
-
- if (before) {
- ++i;
- pos += before.length;
- args.push(before);
- }
-
- var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
-
- args.push(wrapped);
-
- if (after) {
- args.push(after);
- }
-
- Array.prototype.splice.apply(strarr, args);
-
- if (delNum != 1)
- _.matchGrammar(text, strarr, grammar, i, pos, true, token);
-
- if (oneshot)
- break;
- }
- }
- }
- },
-
- tokenize: function(text, grammar, language) {
- var strarr = [text];
-
- var rest = grammar.rest;
-
- if (rest) {
- for (var token in rest) {
- grammar[token] = rest[token];
- }
-
- delete grammar.rest;
- }
-
- _.matchGrammar(text, strarr, grammar, 0, 0, false);
-
- return strarr;
- },
-
- hooks: {
- all: {},
-
- add: function (name, callback) {
- var hooks = _.hooks.all;
-
- hooks[name] = hooks[name] || [];
-
- hooks[name].push(callback);
- },
-
- run: function (name, env) {
- var callbacks = _.hooks.all[name];
-
- if (!callbacks || !callbacks.length) {
- return;
- }
-
- for (var i=0, callback; callback = callbacks[i++];) {
- callback(env);
- }
- }
- }
- };
-
- var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
- this.type = type;
- this.content = content;
- this.alias = alias;
- // Copy of the full string this token was created from
- this.length = (matchedStr || "").length|0;
- this.greedy = !!greedy;
- };
-
- Token.stringify = function(o, language, parent) {
- if (typeof o == 'string') {
- return o;
- }
-
- if (_.util.type(o) === 'Array') {
- return o.map(function(element) {
- return Token.stringify(element, language, o);
- }).join('');
- }
-
- var env = {
- type: o.type,
- content: Token.stringify(o.content, language, parent),
- tag: 'span',
- classes: ['token', o.type],
- attributes: {},
- language: language,
- parent: parent
- };
-
- if (env.type == 'comment') {
- env.attributes['spellcheck'] = 'true';
- }
-
- if (o.alias) {
- var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
- Array.prototype.push.apply(env.classes, aliases);
- }
-
- _.hooks.run('wrap', env);
-
- var attributes = Object.keys(env.attributes).map(function(name) {
- return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
- }).join(' ');
-
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
-
- };
-
- if (!_self.document) {
- if (!_self.addEventListener) {
- // in Node.js
- return _self.Prism;
- }
- // In worker
- _self.addEventListener('message', function(evt) {
- var message = JSON.parse(evt.data),
- lang = message.language,
- code = message.code,
- immediateClose = message.immediateClose;
-
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
- if (immediateClose) {
- _self.close();
- }
- }, false);
-
- return _self.Prism;
- }
-
- //Get current script and highlight
- var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
-
- if (script) {
- _.filename = script.src;
-
- if (!_.manual && !script.hasAttribute('data-manual')) {
- if(document.readyState !== "loading") {
- if (window.requestAnimationFrame) {
- window.requestAnimationFrame(_.highlightAll);
- } else {
- window.setTimeout(_.highlightAll, 16);
- }
- }
- else {
- document.addEventListener('DOMContentLoaded', _.highlightAll);
- }
- }
- }
-
- return _self.Prism;
-
- })();
-
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = Prism;
- }
-
- // hack for components to work correctly in node.js
- if (typeof global !== 'undefined') {
- global.Prism = Prism;
- }
-
-
- /* **********************************************
- Begin prism-markup.js
- ********************************************** */
-
- Prism.languages.markup = {
- 'comment': /<!--[\s\S]*?-->/,
- 'prolog': /<\?[\s\S]+?\?>/,
- 'doctype': /<!DOCTYPE[\s\S]+?>/i,
- 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
- 'tag': {
- pattern: /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\s\S])*\1|[^\s'">=]+))?)*\s*\/?>/i,
- inside: {
- 'tag': {
- pattern: /^<\/?[^\s>\/]+/i,
- inside: {
- 'punctuation': /^<\/?/,
- 'namespace': /^[^\s>\/:]+:/
- }
- },
- 'attr-value': {
- pattern: /=(?:('|")[\s\S]*?(\1)|[^\s>]+)/i,
- inside: {
- 'punctuation': /[=>"']/
- }
- },
- 'punctuation': /\/?>/,
- 'attr-name': {
- pattern: /[^\s>\/]+/,
- inside: {
- 'namespace': /^[^\s>\/:]+:/
- }
- }
-
- }
- },
- 'entity': /&#?[\da-z]{1,8};/i
- };
-
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
- Prism.languages.markup['entity'];
-
- // Plugin to make entity title show the real entity, idea by Roman Komarov
- Prism.hooks.add('wrap', function(env) {
-
- if (env.type === 'entity') {
- env.attributes['title'] = env.content.replace(/&/, '&');
- }
- });
-
- Prism.languages.xml = Prism.languages.markup;
- Prism.languages.html = Prism.languages.markup;
- Prism.languages.mathml = Prism.languages.markup;
- Prism.languages.svg = Prism.languages.markup;
-
-
- /* **********************************************
- Begin prism-css.js
- ********************************************** */
-
- Prism.languages.css = {
- 'comment': /\/\*[\s\S]*?\*\//,
- 'atrule': {
- pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
- inside: {
- 'rule': /@[\w-]+/
- // See rest below
- }
- },
- 'url': /url\((?:(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
- 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
- 'string': {
- pattern: /("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'property': /(\b|\B)[\w-]+(?=\s*:)/i,
- 'important': /\B!important\b/i,
- 'function': /[-a-z0-9]+(?=\()/i,
- 'punctuation': /[(){};:]/
- };
-
- Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
-
- if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'style': {
- pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
- lookbehind: true,
- inside: Prism.languages.css,
- alias: 'language-css'
- }
- });
-
- Prism.languages.insertBefore('inside', 'attr-value', {
- 'style-attr': {
- pattern: /\s*style=("|').*?\1/i,
- inside: {
- 'attr-name': {
- pattern: /^\s*style/i,
- inside: Prism.languages.markup.tag.inside
- },
- 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
- 'attr-value': {
- pattern: /.+/i,
- inside: Prism.languages.css
- }
- },
- alias: 'language-css'
- }
- }, Prism.languages.markup.tag);
- }
-
- /* **********************************************
- Begin prism-clike.js
- ********************************************** */
-
- Prism.languages.clike = {
- 'comment': [
- {
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
- lookbehind: true
- },
- {
- pattern: /(^|[^\\:])\/\/.*/,
- lookbehind: true
- }
- ],
- 'string': {
- pattern: /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'class-name': {
- pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
- lookbehind: true,
- inside: {
- punctuation: /(\.|\\)/
- }
- },
- 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
- 'boolean': /\b(true|false)\b/,
- 'function': /[a-z0-9_]+(?=\()/i,
- 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
- 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
- 'punctuation': /[{}[\];(),.:]/
- };
-
-
- /* **********************************************
- Begin prism-javascript.js
- ********************************************** */
-
- Prism.languages.javascript = Prism.languages.extend('clike', {
- 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
- 'number': /\b-?(0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
- 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\s*\()/i,
- 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
- });
-
- Prism.languages.insertBefore('javascript', 'keyword', {
- 'regex': {
- pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
- lookbehind: true,
- greedy: true
- },
- // This must be declared before keyword because we use "function" inside the look-forward
- 'function-variable': {
- pattern: /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)\s*=>))/i,
- alias: 'function'
- }
- });
-
- Prism.languages.insertBefore('javascript', 'string', {
- 'template-string': {
- pattern: /`(?:\\\\|\\?[^\\])*?`/,
- greedy: true,
- inside: {
- 'interpolation': {
- pattern: /\$\{[^}]+\}/,
- inside: {
- 'interpolation-punctuation': {
- pattern: /^\$\{|\}$/,
- alias: 'punctuation'
- },
- rest: Prism.languages.javascript
- }
- },
- 'string': /[\s\S]+/
- }
- }
- });
-
- if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'script': {
- pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
- lookbehind: true,
- inside: Prism.languages.javascript,
- alias: 'language-javascript'
- }
- });
- }
-
- Prism.languages.js = Prism.languages.javascript;
-
-
- /* **********************************************
- Begin prism-file-highlight.js
- ********************************************** */
-
- (function () {
- if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
- return;
- }
-
- self.Prism.fileHighlight = function() {
-
- var Extensions = {
- 'js': 'javascript',
- 'py': 'python',
- 'rb': 'ruby',
- 'ps1': 'powershell',
- 'psm1': 'powershell',
- 'sh': 'bash',
- 'bat': 'batch',
- 'h': 'c',
- 'tex': 'latex'
- };
-
- Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
- var src = pre.getAttribute('data-src');
-
- var language, parent = pre;
- var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
- while (parent && !lang.test(parent.className)) {
- parent = parent.parentNode;
- }
-
- if (parent) {
- language = (pre.className.match(lang) || [, ''])[1];
- }
-
- if (!language) {
- var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
- language = Extensions[extension] || extension;
- }
-
- var code = document.createElement('code');
- code.className = 'language-' + language;
-
- pre.textContent = '';
-
- code.textContent = 'Loading…';
-
- pre.appendChild(code);
-
- var xhr = new XMLHttpRequest();
-
- xhr.open('GET', src, true);
-
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
-
- if (xhr.status < 400 && xhr.responseText) {
- code.textContent = xhr.responseText;
-
- Prism.highlightElement(code);
- }
- else if (xhr.status >= 400) {
- code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
- }
- else {
- code.textContent = '✖ Error: File does not exist or is empty';
- }
- }
- };
-
- xhr.send(null);
- });
-
- };
-
- document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight);
-
- })();
-
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
- /***/ }),
- /* 105 */
- /***/ (function(module, exports) {
- Prism.languages.java = Prism.languages.extend('clike', {
- 'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
- 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,
- 'operator': {
- pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
- lookbehind: true
- }
- });
-
- Prism.languages.insertBefore('java','function', {
- 'annotation': {
- alias: 'punctuation',
- pattern: /(^|[^.])@\w+/,
- lookbehind: true
- }
- });
- /***/ }),
- /* 106 */
- /***/ (function(module, exports) {
- Prism.languages.csharp = Prism.languages.extend('clike', {
- 'keyword': /\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,
- 'string': [
- {
- pattern: /@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,
- greedy: true
- },
- {
- pattern: /("|')(\\?.)*?\1/,
- greedy: true
- }
- ],
- 'number': /\b-?(0x[\da-f]+|\d*\.?\d+f?)\b/i
- });
-
- Prism.languages.insertBefore('csharp', 'keyword', {
- 'generic-method': {
- pattern: /[a-z0-9_]+\s*<[^>\r\n]+?>\s*(?=\()/i,
- alias: 'function',
- inside: {
- keyword: Prism.languages.csharp.keyword,
- punctuation: /[<>(),.:]/
- }
- },
- 'preprocessor': {
- pattern: /(^\s*)#.*/m,
- lookbehind: true,
- alias: 'property',
- inside: {
- // highlight preprocessor directives as keywords
- 'directive': {
- pattern: /(\s*#)\b(define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,
- lookbehind: true,
- alias: 'keyword'
- }
- }
- }
- });
- /***/ }),
- /* 107 */
- /***/ (function(module, exports) {
- /**
- * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
- * Modified by Miles Johnson: http://milesj.me
- *
- * Supports the following:
- * - Extends clike syntax
- * - Support for PHP 5.3+ (namespaces, traits, generators, etc)
- * - Smarter constant and function matching
- *
- * Adds the following new token classes:
- * constant, delimiter, variable, function, package
- */
-
- Prism.languages.php = Prism.languages.extend('clike', {
- 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
- 'constant': /\b[A-Z0-9_]{2,}\b/,
- 'comment': {
- pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
- lookbehind: true
- }
- });
-
- // Shell-like comments are matched after strings, because they are less
- // common than strings containing hashes...
- Prism.languages.insertBefore('php', 'class-name', {
- 'shell-comment': {
- pattern: /(^|[^\\])#.*/,
- lookbehind: true,
- alias: 'comment'
- }
- });
-
- Prism.languages.insertBefore('php', 'keyword', {
- 'delimiter': {
- pattern: /\?>|<\?(?:php|=)?/i,
- alias: 'important'
- },
- 'variable': /\$\w+\b/i,
- 'package': {
- pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
- lookbehind: true,
- inside: {
- punctuation: /\\/
- }
- }
- });
-
- // Must be defined after the function pattern
- Prism.languages.insertBefore('php', 'operator', {
- 'property': {
- pattern: /(->)[\w]+/,
- lookbehind: true
- }
- });
-
- // Add HTML support if the markup language exists
- if (Prism.languages.markup) {
-
- // Tokenize all inline PHP blocks that are wrapped in <?php ?>
- // This allows for easy PHP + markup highlighting
- Prism.hooks.add('before-highlight', function(env) {
- if (env.language !== 'php' || !/(?:<\?php|<\?)/ig.test(env.code)) {
- return;
- }
-
- env.tokenStack = [];
-
- env.backupCode = env.code;
- env.code = env.code.replace(/(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig, function(match) {
- var i = env.tokenStack.length;
- // Check for existing strings
- while (env.backupCode.indexOf('___PHP' + i + '___') !== -1)
- ++i;
-
- // Create a sparse array
- env.tokenStack[i] = match;
-
- return '___PHP' + i + '___';
- });
-
- // Switch the grammar to markup
- env.grammar = Prism.languages.markup;
- });
-
- // Restore env.code for other plugins (e.g. line-numbers)
- Prism.hooks.add('before-insert', function(env) {
- if (env.language === 'php' && env.backupCode) {
- env.code = env.backupCode;
- delete env.backupCode;
- }
- });
-
- // Re-insert the tokens after highlighting
- Prism.hooks.add('after-highlight', function(env) {
- if (env.language !== 'php' || !env.tokenStack) {
- return;
- }
-
- // Switch the grammar back
- env.grammar = Prism.languages.php;
-
- for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) {
- var k = keys[i];
- var t = env.tokenStack[k];
-
- // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
- env.highlightedCode = env.highlightedCode.replace('___PHP' + k + '___',
- "<span class=\"token php language-php\">" +
- Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$') +
- "</span>");
- }
-
- env.element.innerHTML = env.highlightedCode;
- });
- }
- /***/ }),
- /* 108 */
- /***/ (function(module, exports) {
- Prism.languages.python= {
- 'triple-quoted-string': {
- pattern: /"""[\s\S]+?"""|'''[\s\S]+?'''/,
- alias: 'string'
- },
- 'comment': {
- pattern: /(^|[^\\])#.*/,
- lookbehind: true
- },
- 'string': {
- pattern: /("|')(?:\\\\|\\?[^\\\r\n])*?\1/,
- greedy: true
- },
- 'function' : {
- pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
- lookbehind: true
- },
- 'class-name': {
- pattern: /(\bclass\s+)[a-z0-9_]+/i,
- lookbehind: true
- },
- 'keyword' : /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,
- 'boolean' : /\b(?:True|False)\b/,
- 'number' : /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
- 'operator' : /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
- 'punctuation' : /[{}[\];(),.:]/
- };
- /***/ }),
- /* 109 */
- /***/ (function(module, exports) {
- Prism.languages.json = {
- 'property': /"(?:\\.|[^\\"])*"(?=\s*:)/ig,
- 'string': /"(?!:)(?:\\.|[^\\"])*"(?!:)/g,
- 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,
- 'punctuation': /[{}[\]);,]/g,
- 'operator': /:/g,
- 'boolean': /\b(true|false)\b/gi,
- 'null': /\bnull\b/gi
- };
-
- Prism.languages.jsonp = Prism.languages.json;
- /***/ }),
- /* 110 */
- /***/ (function(module, exports) {
- Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*(?:^|[:\-,[{\r\n?])[ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#\s]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0,greedy:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./};
- /***/ }),
- /* 111 */
- /***/ (function(module, exports) {
- Prism.languages.perl = {
- 'comment': [
- {
- // POD
- pattern: /(^\s*)=\w+[\s\S]*?=cut.*/m,
- lookbehind: true
- },
- {
- pattern: /(^|[^\\$])#.*/,
- lookbehind: true
- }
- ],
- // TODO Could be nice to handle Heredoc too.
- 'string': [
- // q/.../
- {
- pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
- greedy: true
- },
-
- // q a...a
- {
- pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\1/,
- greedy: true
- },
-
- // q(...)
- {
- pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/,
- greedy: true
- },
-
- // q{...}
- {
- pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/,
- greedy: true
- },
-
- // q[...]
- {
- pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/,
- greedy: true
- },
-
- // q<...>
- {
- pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/,
- greedy: true
- },
-
- // "...", `...`
- {
- pattern: /("|`)(?:[^\\]|\\[\s\S])*?\1/,
- greedy: true
- },
-
- // '...'
- // FIXME Multi-line single-quoted strings are not supported as they would break variables containing '
- {
- pattern: /'(?:[^'\\\r\n]|\\.)*'/,
- greedy: true
- }
- ],
- 'regex': [
- // m/.../
- {
- pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[msixpodualngc]*/,
- greedy: true
- },
-
- // m a...a
- {
- pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:[^\\]|\\.)*?\1[msixpodualngc]*/,
- greedy: true
- },
-
- // m(...)
- {
- pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/,
- greedy: true
- },
-
- // m{...}
- {
- pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/,
- greedy: true
- },
-
- // m[...]
- {
- pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/,
- greedy: true
- },
-
- // m<...>
- {
- pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/,
- greedy: true
- },
-
- // The lookbehinds prevent -s from breaking
- // FIXME We don't handle change of separator like s(...)[...]
- // s/.../.../
- {
- pattern: /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,
- lookbehind: true,
- greedy: true
- },
-
- // s a...a...a
- {
- pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,
- lookbehind: true,
- greedy: true
- },
-
- // s(...)(...)
- {
- pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/,
- lookbehind: true,
- greedy: true
- },
-
- // s{...}{...}
- {
- pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/,
- lookbehind: true,
- greedy: true
- },
-
- // s[...][...]
- {
- pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/,
- lookbehind: true,
- greedy: true
- },
-
- // s<...><...>
- {
- pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/,
- lookbehind: true,
- greedy: true
- },
-
- // /.../
- // The look-ahead tries to prevent two divisions on
- // the same line from being highlighted as regex.
- // This does not support multi-line regex.
- {
- pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/,
- greedy: true
- }
- ],
-
- // FIXME Not sure about the handling of ::, ', and #
- 'variable': [
- // ${^POSTMATCH}
- /[&*$@%]\{\^[A-Z]+\}/,
- // $^V
- /[&*$@%]\^[A-Z_]/,
- // ${...}
- /[&*$@%]#?(?=\{)/,
- // $foo
- /[&*$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/i,
- // $1
- /[&*$@%]\d+/,
- // $_, @_, %!
- // The negative lookahead prevents from breaking the %= operator
- /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
- ],
- 'filehandle': {
- // <>, <FOO>, _
- pattern: /<(?![<=])\S*>|\b_\b/,
- alias: 'symbol'
- },
- 'vstring': {
- // v1.2, 1.2.3
- pattern: /v\d+(\.\d+)*|\d+(\.\d+){2,}/,
- alias: 'string'
- },
- 'function': {
- pattern: /sub [a-z0-9_]+/i,
- inside: {
- keyword: /sub/
- }
- },
- 'keyword': /\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
- 'number': /\b-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)\b/,
- 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,
- 'punctuation': /[{}[\];(),:]/
- };
- /***/ }),
- /* 112 */
- /***/ (function(module, exports) {
- Prism.languages.go = Prism.languages.extend('clike', {
- 'keyword': /\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
- 'builtin': /\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/,
- 'boolean': /\b(_|iota|nil|true|false)\b/,
- 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
- 'number': /\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/i,
- 'string': {
- pattern: /("|'|`)(\\?.|\r|\n)*?\1/,
- greedy: true
- }
- });
- delete Prism.languages.go['class-name'];
- /***/ }),
- /* 113 */
- /***/ (function(module, exports) {
- (function(Prism) {
- var insideString = {
- variable: [
- // Arithmetic Environment
- {
- pattern: /\$?\(\([\s\S]+?\)\)/,
- inside: {
- // If there is a $ sign at the beginning highlight $(( and )) as variable
- variable: [{
- pattern: /(^\$\(\([\s\S]+)\)\)/,
- lookbehind: true
- },
- /^\$\(\(/,
- ],
- number: /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,
- // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
- operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
- // If there is no $ sign at the beginning highlight (( and )) as punctuation
- punctuation: /\(\(?|\)\)?|,|;/
- }
- },
- // Command Substitution
- {
- pattern: /\$\([^)]+\)|`[^`]+`/,
- inside: {
- variable: /^\$\(|^`|\)$|`$/
- }
- },
- /\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i
- ],
- };
-
- Prism.languages.bash = {
- 'shebang': {
- pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
- alias: 'important'
- },
- 'comment': {
- pattern: /(^|[^"{\\])#.*/,
- lookbehind: true
- },
- 'string': [
- //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
- {
- pattern: /((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,
- lookbehind: true,
- greedy: true,
- inside: insideString
- },
- {
- pattern: /(["'])(?:\\\\|\\?[^\\])*?\1/g,
- greedy: true,
- inside: insideString
- }
- ],
- 'variable': insideString.variable,
- // Originally based on http://ss64.com/bash/
- 'function': {
- pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,
- lookbehind: true
- },
- 'keyword': {
- pattern: /(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,
- lookbehind: true
- },
- 'boolean': {
- pattern: /(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,
- lookbehind: true
- },
- 'operator': /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
- 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
- };
-
- var inside = insideString.variable[1].inside;
- inside['function'] = Prism.languages.bash['function'];
- inside.keyword = Prism.languages.bash.keyword;
- inside.boolean = Prism.languages.bash.boolean;
- inside.operator = Prism.languages.bash.operator;
- inside.punctuation = Prism.languages.bash.punctuation;
- })(Prism);
- /***/ }),
- /* 114 */
- /***/ (function(module, exports) {
- Prism.languages.fsharp = Prism.languages.extend('clike', {
- 'comment': [
- {
- pattern: /(^|[^\\])\(\*[\s\S]*?\*\)/,
- lookbehind: true
- },
- {
- pattern: /(^|[^\\:])\/\/.*/,
- lookbehind: true
- }
- ],
- 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
- 'string': {
- pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|("|')(?:\\\1|\\?(?!\1)[\s\S])*\1)B?/,
- greedy: true
- },
- 'number': [
- /\b-?0x[\da-fA-F]+(un|lf|LF)?\b/,
- /\b-?0b[01]+(y|uy)?\b/,
- /\b-?(\d*\.?\d+|\d+\.)([fFmM]|[eE][+-]?\d+)?\b/,
- /\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/
- ]
- });
- Prism.languages.insertBefore('fsharp', 'keyword', {
- 'preprocessor': {
- pattern: /^[^\r\n\S]*#.*/m,
- alias: 'property',
- inside: {
- 'directive': {
- pattern: /(\s*#)\b(else|endif|if|light|line|nowarn)\b/,
- lookbehind: true,
- alias: 'keyword'
- }
- }
- }
- });
- /***/ }),
- /* 115 */
- /***/ (function(module, exports) {
- Prism.languages.typescript = Prism.languages.extend('javascript', {
- // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words
- 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield|false|true|module|declare|constructor|string|Function|any|number|boolean|Array|enum|symbol|namespace|abstract|require|type)\b/
- });
-
- Prism.languages.ts = Prism.languages.typescript;
- /***/ }),
- /* 116 */
- /***/ (function(module, exports) {
- (function (Prism) {
- var inside = {
- 'url': /url\((["']?).*?\1\)/i,
- 'string': {
- pattern: /("|')(?:[^\\\r\n]|\\(?:\r\n|[\s\S]))*?\1/,
- greedy: true
- },
- 'interpolation': null, // See below
- 'func': null, // See below
- 'important': /\B!(?:important|optional)\b/i,
- 'keyword': {
- pattern: /(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,
- lookbehind: true
- },
- 'hexcode': /#[\da-f]{3,6}/i,
- 'number': /\b\d+(?:\.\d+)?%?/,
- 'boolean': /\b(?:true|false)\b/,
- 'operator': [
- // We want non-word chars around "-" because it is
- // accepted in property names.
- /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/
- ],
- 'punctuation': /[{}()\[\];:,]/
- };
-
- inside['interpolation'] = {
- pattern: /\{[^\r\n}:]+\}/,
- alias: 'variable',
- inside: Prism.util.clone(inside)
- };
- inside['func'] = {
- pattern: /[\w-]+\([^)]*\).*/,
- inside: {
- 'function': /^[^(]+/,
- rest: Prism.util.clone(inside)
- }
- };
-
- Prism.languages.stylus = {
- 'comment': {
- pattern: /(^|[^\\])(\/\*[\s\S]*?\*\/|\/\/.*)/,
- lookbehind: true
- },
- 'atrule-declaration': {
- pattern: /(^\s*)@.+/m,
- lookbehind: true,
- inside: {
- 'atrule': /^@[\w-]+/,
- rest: inside
- }
- },
- 'variable-declaration': {
- pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,
- lookbehind: true,
- inside: {
- 'variable': /^\S+/,
- rest: inside
- }
- },
-
- 'statement': {
- pattern: /(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,
- lookbehind: true,
- inside: {
- keyword: /^\S+/,
- rest: inside
- }
- },
-
- // A property/value pair cannot end with a comma or a brace
- // It cannot have indented content unless it ended with a semicolon
- 'property-declaration': {
- pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(\r?\n|\r)(?:\{|\2[ \t]+)))/m,
- lookbehind: true,
- inside: {
- 'property': {
- pattern: /^[^\s:]+/,
- inside: {
- 'interpolation': inside.interpolation
- }
- },
- rest: inside
- }
- },
-
-
-
- // A selector can contain parentheses only as part of a pseudo-element
- // It can span multiple lines.
- // It must end with a comma or an accolade or have indented content.
- 'selector': {
- pattern: /(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,
- lookbehind: true,
- inside: {
- 'interpolation': inside.interpolation,
- 'punctuation': /[{},]/
- }
- },
-
- 'func': inside.func,
- 'string': inside.string,
- 'interpolation': inside.interpolation,
- 'punctuation': /[{}()\[\];:.]/
- };
- }(Prism));
- /***/ }),
- /* 117 */
- /***/ (function(module, exports) {
- /* FIXME :
- :extend() is not handled specifically : its highlighting is buggy.
- Mixin usage must be inside a ruleset to be highlighted.
- At-rules (e.g. import) containing interpolations are buggy.
- Detached rulesets are highlighted as at-rules.
- A comment before a mixin usage prevents the latter to be properly highlighted.
- */
-
- Prism.languages.less = Prism.languages.extend('css', {
- 'comment': [
- /\/\*[\s\S]*?\*\//,
- {
- pattern: /(^|[^\\])\/\/.*/,
- lookbehind: true
- }
- ],
- 'atrule': {
- pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i,
- inside: {
- 'punctuation': /[:()]/
- }
- },
- // selectors and mixins are considered the same
- 'selector': {
- pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/,
- inside: {
- // mixin parameters
- 'variable': /@+[\w-]+/
- }
- },
-
- 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
- 'punctuation': /[{}();:,]/,
- 'operator': /[+\-*\/]/
- });
-
- // Invert function and punctuation positions
- Prism.languages.insertBefore('less', 'punctuation', {
- 'function': Prism.languages.less.function
- });
-
- Prism.languages.insertBefore('less', 'property', {
- 'variable': [
- // Variable declaration (the colon must be consumed!)
- {
- pattern: /@[\w-]+\s*:/,
- inside: {
- "punctuation": /:/
- }
- },
-
- // Variable usage
- /@@?[\w-]+/
- ],
- 'mixin-usage': {
- pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,
- lookbehind: true,
- alias: 'function'
- }
- });
- /***/ }),
- /* 118 */
- /***/ (function(module, exports) {
- (function(Prism) {
- Prism.languages.sass = Prism.languages.extend('css', {
- // Sass comments don't need to be closed, only indented
- 'comment': {
- pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m,
- lookbehind: true
- }
- });
-
- Prism.languages.insertBefore('sass', 'atrule', {
- // We want to consume the whole line
- 'atrule-line': {
- // Includes support for = and + shortcuts
- pattern: /^(?:[ \t]*)[@+=].+/m,
- inside: {
- 'atrule': /(?:@[\w-]+|[+=])/m
- }
- }
- });
- delete Prism.languages.sass.atrule;
-
-
- var variable = /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i;
- var operator = [
- /[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,
- {
- pattern: /(\s+)-(?=\s)/,
- lookbehind: true
- }
- ];
-
- Prism.languages.insertBefore('sass', 'property', {
- // We want to consume the whole line
- 'variable-line': {
- pattern: /^[ \t]*\$.+/m,
- inside: {
- 'punctuation': /:/,
- 'variable': variable,
- 'operator': operator
- }
- },
- // We want to consume the whole line
- 'property-line': {
- pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,
- inside: {
- 'property': [
- /[^:\s]+(?=\s*:)/,
- {
- pattern: /(:)[^:\s]+/,
- lookbehind: true
- }
- ],
- 'punctuation': /:/,
- 'variable': variable,
- 'operator': operator,
- 'important': Prism.languages.sass.important
- }
- }
- });
- delete Prism.languages.sass.property;
- delete Prism.languages.sass.important;
-
- // Now that whole lines for other patterns are consumed,
- // what's left should be selectors
- delete Prism.languages.sass.selector;
- Prism.languages.insertBefore('sass', 'punctuation', {
- 'selector': {
- pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
- lookbehind: true
- }
- });
-
- }(Prism));
- /***/ }),
- /* 119 */
- /***/ (function(module, exports) {
- (function(Prism) {
-
- var handlebars_pattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
-
- Prism.languages.handlebars = Prism.languages.extend('markup', {
- 'handlebars': {
- pattern: handlebars_pattern,
- inside: {
- 'delimiter': {
- pattern: /^\{\{\{?|\}\}\}?$/i,
- alias: 'punctuation'
- },
- 'string': /(["'])(\\?.)*?\1/,
- 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/,
- 'boolean': /\b(true|false)\b/,
- 'block': {
- pattern: /^(\s*~?\s*)[#\/]\S+?(?=\s*~?\s*$|\s)/i,
- lookbehind: true,
- alias: 'keyword'
- },
- 'brackets': {
- pattern: /\[[^\]]+\]/,
- inside: {
- punctuation: /\[|\]/,
- variable: /[\s\S]+/
- }
- },
- 'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,
- 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~\s]+/
- }
- }
- });
-
- // Comments are inserted at top so that they can
- // surround markup
- Prism.languages.insertBefore('handlebars', 'tag', {
- 'handlebars-comment': {
- pattern: /\{\{![\s\S]*?\}\}/,
- alias: ['handlebars','comment']
- }
- });
-
- // Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}}
- // This allows for easy Handlebars + markup highlighting
- Prism.hooks.add('before-highlight', function(env) {
- if (env.language !== 'handlebars') {
- return;
- }
-
- env.tokenStack = [];
-
- env.backupCode = env.code;
- env.code = env.code.replace(handlebars_pattern, function(match) {
- var i = env.tokenStack.length;
- // Check for existing strings
- while (env.backupCode.indexOf('___HANDLEBARS' + i + '___') !== -1)
- ++i;
-
- // Create a sparse array
- env.tokenStack[i] = match;
-
- return '___HANDLEBARS' + i + '___';
- });
- });
-
- // Restore env.code for other plugins (e.g. line-numbers)
- Prism.hooks.add('before-insert', function(env) {
- if (env.language === 'handlebars') {
- env.code = env.backupCode;
- delete env.backupCode;
- }
- });
-
- // Re-insert the tokens after highlighting
- // and highlight them with defined grammar
- Prism.hooks.add('after-highlight', function(env) {
- if (env.language !== 'handlebars') {
- return;
- }
-
- for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) {
- var k = keys[i];
- var t = env.tokenStack[k];
-
- // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
- env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + k + '___', Prism.highlight(t, env.grammar, 'handlebars').replace(/\$/g, '$$$$'));
- }
-
- env.element.innerHTML = env.highlightedCode;
- });
-
- }(Prism));
- /***/ }),
- /* 120 */
- /***/ (function(module, exports) {
- Prism.languages.applescript = {
- 'comment': [
- // Allow one level of nesting
- /\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/,
- /--.+/,
- /#.+/
- ],
- 'string': /"(?:\\?.)*?"/,
- 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/,
- 'operator': [
- /[&=≠≤≥*+\-\/÷^]|[<>]=?/,
- /\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/
- ],
- 'keyword': /\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,
- 'class': {
- pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,
- alias: 'builtin'
- },
- 'punctuation': /[{}():,¬«»《》]/
- };
- /***/ }),
- /* 121 */
- /***/ (function(module, exports) {
- Prism.languages.actionscript = Prism.languages.extend('javascript', {
- 'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,
- 'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/
- });
- Prism.languages.actionscript['class-name'].alias = 'function';
-
- if (Prism.languages.markup) {
- Prism.languages.insertBefore('actionscript', 'string', {
- 'xml': {
- pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\\1|\\?(?!\1)[\s\S])*\2)*\s*\/?>/,
- lookbehind: true,
- inside: {
- rest: Prism.languages.markup
- }
- }
- });
- }
- /***/ }),
- /* 122 */
- /***/ (function(module, exports) {
- Prism.languages.aspnet = Prism.languages.extend('markup', {
- 'page-directive tag': {
- pattern: /<%\s*@.*%>/i,
- inside: {
- 'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,
- rest: Prism.languages.markup.tag.inside
- }
- },
- 'directive tag': {
- pattern: /<%.*%>/i,
- inside: {
- 'directive tag': /<%\s*?[$=%#:]{0,2}|%>/i,
- rest: Prism.languages.csharp
- }
- }
- });
- // Regexp copied from prism-markup, with a negative look-ahead added
- Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\s\S])*\1|[^\s'">=]+))?)*\s*\/?>/i;
-
- // match directives of attribute value foo="<% Bar %>"
- Prism.languages.insertBefore('inside', 'punctuation', {
- 'directive tag': Prism.languages.aspnet['directive tag']
- }, Prism.languages.aspnet.tag.inside["attr-value"]);
-
- Prism.languages.insertBefore('aspnet', 'comment', {
- 'asp comment': /<%--[\s\S]*?--%>/
- });
-
- // script runat="server" contains csharp, not javascript
- Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', {
- 'asp script': {
- pattern: /(<script(?=.*runat=['"]?server['"]?)[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
- lookbehind: true,
- inside: Prism.languages.csharp || {}
- }
- });
- /***/ }),
- /* 123 */
- /***/ (function(module, exports) {
- Prism.languages.basic = {
- 'string': /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,
- 'comment': {
- pattern: /(?:!|REM\b).+/i,
- inside: {
- 'keyword': /^REM/i
- }
- },
- 'number': /(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i,
- 'keyword': /\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,
- 'function': /\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,
- 'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,
- 'punctuation': /[,;:()]/
- };
- /***/ }),
- /* 124 */
- /***/ (function(module, exports) {
- Prism.languages.c = Prism.languages.extend('clike', {
- 'keyword': /\b(_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
- 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
- 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i
- });
-
- Prism.languages.insertBefore('c', 'string', {
- 'macro': {
- // allow for multiline macro definitions
- // spaces after the # character compile fine with gcc
- pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,
- lookbehind: true,
- alias: 'property',
- inside: {
- // highlight the path of the include statement as a string
- 'string': {
- pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
- lookbehind: true
- },
- // highlight macro directives as keywords
- 'directive': {
- pattern: /(#\s*)\b(define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
- lookbehind: true,
- alias: 'keyword'
- }
- }
- },
- // highlight predefined macros as constants
- 'constant': /\b(__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
- });
-
- delete Prism.languages.c['class-name'];
- delete Prism.languages.c['boolean'];
- /***/ }),
- /* 125 */
- /***/ (function(module, exports) {
- // Based on Free Pascal
-
- /* TODO
- Support inline asm ?
- */
-
- Prism.languages.pascal = {
- 'comment': [
- /\(\*[\s\S]+?\*\)/,
- /\{[\s\S]+?\}/,
- /\/\/.*/
- ],
- 'string': {
- pattern: /(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
- greedy: true
- },
- 'keyword': [
- {
- // Turbo Pascal
- pattern: /(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
- lookbehind: true
- },
- {
- // Free Pascal
- pattern: /(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,
- lookbehind: true
- },
- {
- // Object Pascal
- pattern: /(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
- lookbehind: true
- },
- {
- // Modifiers
- pattern: /(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
- lookbehind: true
- }
- ],
- 'number': [
- // Hexadecimal, octal and binary
- /[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,
- // Decimal
- /([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
- ],
- 'operator': [
- /\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,
- {
- pattern: /(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
- lookbehind: true
- }
- ],
- 'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
- };
- /***/ }),
- /* 126 */
- /***/ (function(module, exports) {
- Prism.languages.vim = {
- 'string': /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,
- 'comment': /".*/,
- 'function': /\w+(?=\()/,
- 'keyword': /\b(?:ab|abbreviate|abc|abclear|abo|aboveleft|al|all|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|ar|args|argu|argument|as|ascii|bad|badd|ba|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bN|bNext|bo|botright|bp|bprevious|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|br|brewind|bro|browse|bufdo|b|buffer|buffers|bun|bunload|bw|bwipeout|ca|cabbrev|cabc|cabclear|caddb|caddbuffer|cad|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cgetb|cgetbuffer|cgete|cgetexpr|cg|cgetfile|c|change|changes|chd|chdir|che|checkpath|checkt|checktime|cla|clast|cl|clist|clo|close|cmapc|cmapclear|cnew|cnewer|cn|cnext|cN|cNext|cnf|cnfile|cNfcNfile|cnorea|cnoreabbrev|col|colder|colo|colorscheme|comc|comclear|comp|compiler|conf|confirm|con|continue|cope|copen|co|copy|cpf|cpfile|cp|cprevious|cq|cquit|cr|crewind|cuna|cunabbrev|cu|cunmap|cw|cwindow|debugg|debuggreedy|delc|delcommand|d|delete|delf|delfunction|delm|delmarks|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|di|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|earlier|echoe|echoerr|echom|echomsg|echon|e|edit|el|else|elsei|elseif|em|emenu|endfo|endfor|endf|endfunction|endfun|en|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fina|finally|fin|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|folddoc|folddoclosed|foldd|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|ha|hardcopy|h|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iuna|iunabbrev|iu|iunmap|j|join|ju|jumps|k|keepalt|keepj|keepjumps|kee|keepmarks|laddb|laddbuffer|lad|laddexpr|laddf|laddfile|lan|language|la|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|let|left|lefta|leftabove|lex|lexpr|lf|lfile|lfir|lfirst|lgetb|lgetbuffer|lgete|lgetexpr|lg|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|l|list|ll|lla|llast|lli|llist|lmak|lmake|lm|lmap|lmapc|lmapclear|lnew|lnewer|lne|lnext|lN|lNext|lnf|lnfile|lNf|lNfile|ln|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lpf|lpfile|lp|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|mak|make|ma|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkvie|mkview|mkv|mkvimrc|mod|mode|m|move|mzf|mzfile|mz|mzscheme|nbkey|new|n|next|N|Next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|omapc|omapclear|on|only|o|open|opt|options|ou|ounmap|pc|pclose|ped|pedit|pe|perl|perld|perldo|po|pop|popu|popu|popup|pp|ppop|pre|preserve|prev|previous|p|print|P|Print|profd|profdel|prof|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptN|ptNext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|pyf|pyfile|py|python|qa|qall|q|quit|quita|quitall|r|read|rec|recover|redi|redir|red|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|rub|ruby|rubyd|rubydo|rubyf|rubyfile|ru|runtime|rv|rviminfo|sal|sall|san|sandbox|sa|sargument|sav|saveas|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbN|sbNext|sbp|sbprevious|sbr|sbrewind|sb|sbuffer|scripte|scriptencoding|scrip|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sla|slast|sl|sleep|sm|smagic|sm|smap|smapc|smapclear|sme|smenu|sn|snext|sN|sNext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|sor|sort|so|source|spelld|spelldump|spe|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|sp|split|spr|sprevious|sre|srewind|sta|stag|startg|startgreplace|star|startinsert|startr|startreplace|stj|stjump|st|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tab|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabnew|tabn|tabnext|tabN|tabNext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|ta|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tm|tmenu|tn|tnext|tN|tNext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tu|tunmenu|una|unabbreviate|u|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|verb|verbose|ve|version|vert|vertical|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|vi|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|wa|wall|wh|while|winc|wincmd|windo|winp|winpos|win|winsize|wn|wnext|wN|wNext|wp|wprevious|wq|wqa|wqall|w|write|ws|wsverb|wv|wviminfo|X|xa|xall|x|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|XMLent|XMLns|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,
- 'builtin': /\b(?:autocmd|acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|t_AB|t_AF|t_al|t_AL|t_bc|t_cd|t_ce|t_Ce|t_cl|t_cm|t_Co|t_cs|t_Cs|t_CS|t_CV|t_da|t_db|t_dl|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_fs|t_IE|t_IS|t_k1|t_K1|t_k2|t_k3|t_K3|t_k4|t_K4|t_k5|t_K5|t_k6|t_K6|t_k7|t_K7|t_k8|t_K8|t_k9|t_K9|t_KA|t_kb|t_kB|t_KB|t_KC|t_kd|t_kD|t_KD|t_ke|t_KE|t_KF|t_KG|t_kh|t_KH|t_kI|t_KI|t_KJ|t_KK|t_kl|t_KL|t_kN|t_kP|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_RI|t_RV|t_Sb|t_se|t_Sf|t_SI|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_WP|t_WS|t_xs|t_ZH|t_ZR)\b/,
- 'number': /\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,
- 'operator': /\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,
- 'punctuation': /[{}[\](),;:]/
- };
- /***/ }),
- /* 127 */
- /***/ (function(module, exports) {
- // issues: nested multiline comments
- Prism.languages.swift = Prism.languages.extend('clike', {
- 'string': {
- pattern: /("|')(\\(?:\((?:[^()]|\([^)]+\))+\)|\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true,
- inside: {
- 'interpolation': {
- pattern: /\\\((?:[^()]|\([^)]+\))+\)/,
- inside: {
- delimiter: {
- pattern: /^\\\(|\)$/,
- alias: 'variable'
- }
- // See rest below
- }
- }
- }
- },
- 'keyword': /\b(as|associativity|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic(?:Type)?|else|enum|extension|fallthrough|final|for|func|get|guard|if|import|in|infix|init|inout|internal|is|lazy|left|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precedence|prefix|private|Protocol|public|repeat|required|rethrows|return|right|safe|self|Self|set|static|struct|subscript|super|switch|throws?|try|Type|typealias|unowned|unsafe|var|weak|where|while|willSet|__(?:COLUMN__|FILE__|FUNCTION__|LINE__))\b/,
- 'number': /\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
- 'constant': /\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
- 'atrule': /@\b(IB(?:Outlet|Designable|Action|Inspectable)|class_protocol|exported|noreturn|NS(?:Copying|Managed)|objc|UIApplicationMain|auto_closure)\b/,
- 'builtin': /\b([A-Z]\S+|abs|advance|alignof(?:Value)?|assert|contains|count(?:Elements)?|debugPrint(?:ln)?|distance|drop(?:First|Last)|dump|enumerate|equal|filter|find|first|getVaList|indices|isEmpty|join|last|lexicographicalCompare|map|max(?:Element)?|min(?:Element)?|numericCast|overlaps|partition|print(?:ln)?|reduce|reflect|reverse|sizeof(?:Value)?|sort(?:ed)?|split|startsWith|stride(?:of(?:Value)?)?|suffix|swap|toDebugString|toString|transcode|underestimateCount|unsafeBitCast|with(?:ExtendedLifetime|Unsafe(?:MutablePointers?|Pointers?)|VaList))\b/
- });
- Prism.languages.swift['string'].inside['interpolation'].inside.rest = Prism.util.clone(Prism.languages.swift);
- /***/ }),
- /* 128 */
- /***/ (function(module, exports) {
- Prism.languages.objectivec = Prism.languages.extend('c', {
- 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b|(@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
- 'string': /("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
- 'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
- });
- /***/ }),
- /* 129 */
- /***/ (function(module, exports) {
- Prism.languages.sql= {
- 'comment': {
- pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
- lookbehind: true
- },
- 'string' : {
- pattern: /(^|[^@\\])("|')(?:\\?[\s\S])*?\2/,
- greedy: true,
- lookbehind: true
- },
- 'variable': /@[\w.$]+|@("|'|`)(?:\\?[\s\S])+?\1/,
- 'function': /\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/i, // Should we highlight user defined functions too?
- 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR VARYING|CHARACTER (?:SET|VARYING)|CHARSET|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|DATA(?:BASES?)?|DATE(?:TIME)?|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITER(?:S)?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE(?: PRECISION)?|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE(?:D BY)?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEYS?|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL(?: CHAR VARYING| CHARACTER(?: VARYING)?| VARCHAR)?|NATURAL|NCHAR(?: VARCHAR)?|NEXT|NO(?: SQL|CHECK|CYCLE)?|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READ(?:S SQL DATA|TEXT)?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START(?:ING BY)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED BY|TEXT(?:SIZE)?|THEN|TIMESTAMP|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNPIVOT|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?)\b/i,
- 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
- 'number': /\b-?(?:0x)?\d*\.?[\da-f]+\b/,
- 'operator': /[-+*\/=%^~]|&&?|\|?\||!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
- 'punctuation': /[;[\]()`,.]/
- };
- /***/ }),
- /* 130 */
- /***/ (function(module, exports) {
- Prism.languages.scheme = {
- 'comment' : /;.*/,
- 'string' : {
- pattern: /"(?:[^"\\\r\n]|\\.)*?"|'[^('\s]*/,
- greedy: true
- },
- 'keyword' : {
- pattern : /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)/,
- lookbehind : true
- },
- 'builtin' : {
- pattern : /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)/,
- lookbehind : true
- },
- 'number' : {
- pattern: /(\s|\))[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,
- lookbehind: true
- },
- 'boolean' : /#[tf]/,
- 'operator': {
- pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)/,
- lookbehind: true
- },
- 'function' : {
- pattern : /(\()[^\s()]*(?=\s)/,
- lookbehind : true
- },
- 'punctuation' : /[()]/
- };
- /***/ }),
- /* 131 */
- /***/ (function(module, exports) {
- /**
- * Original by Samuel Flores
- *
- * Adds the following new token classes:
- * constant, builtin, variable, symbol, regex
- */
- (function(Prism) {
- Prism.languages.ruby = Prism.languages.extend('clike', {
- 'comment': [
- /#(?!\{[^\r\n]*?\}).*/,
- /^=begin(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?=end/m
- ],
- 'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/
- });
-
- var interpolation = {
- pattern: /#\{[^}]+\}/,
- inside: {
- 'delimiter': {
- pattern: /^#\{|\}$/,
- alias: 'tag'
- },
- rest: Prism.util.clone(Prism.languages.ruby)
- }
- };
-
- Prism.languages.insertBefore('ruby', 'keyword', {
- 'regex': [
- {
- pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- // Here we need to specifically allow interpolation
- pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
- lookbehind: true,
- greedy: true
- }
- ],
- 'variable': /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,
- 'symbol': /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/
- });
-
- Prism.languages.insertBefore('ruby', 'number', {
- 'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
- 'constant': /\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/
- });
-
- Prism.languages.ruby.string = [
- {
- pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- // Here we need to specifically allow interpolation
- pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- },
- {
- pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- }
- ];
- }(Prism));
- /***/ }),
- /* 132 */
- /***/ (function(module, exports) {
- /* TODO
- Add support for variables inside double quoted strings
- Add support for {php}
- */
-
- (function(Prism) {
-
- var smarty_pattern = /\{\*[\s\S]+?\*\}|\{[\s\S]+?\}/g;
- var smarty_litteral_start = '{literal}';
- var smarty_litteral_end = '{/literal}';
- var smarty_litteral_mode = false;
-
- Prism.languages.smarty = Prism.languages.extend('markup', {
- 'smarty': {
- pattern: smarty_pattern,
- inside: {
- 'delimiter': {
- pattern: /^\{|\}$/i,
- alias: 'punctuation'
- },
- 'string': /(["'])(?:\\?.)*?\1/,
- 'number': /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee][-+]?\d+)?)\b/,
- 'variable': [
- /\$(?!\d)\w+/,
- /#(?!\d)\w+#/,
- {
- pattern: /(\.|->)(?!\d)\w+/,
- lookbehind: true
- },
- {
- pattern: /(\[)(?!\d)\w+(?=\])/,
- lookbehind: true
- }
- ],
- 'function': [
- {
- pattern: /(\|\s*)@?(?!\d)\w+/,
- lookbehind: true
- },
- /^\/?(?!\d)\w+/,
- /(?!\d)\w+(?=\()/
- ],
- 'attr-name': {
- // Value is made optional because it may have already been tokenized
- pattern: /\w+\s*=\s*(?:(?!\d)\w+)?/,
- inside: {
- "variable": {
- pattern: /(=\s*)(?!\d)\w+/,
- lookbehind: true
- },
- "operator": /=/
- }
- },
- 'punctuation': [
- /[\[\]().,:`]|\->/
- ],
- 'operator': [
- /[+\-*\/%]|==?=?|[!<>]=?|&&|\|\|?/,
- /\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,
- /\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/
- ],
- 'keyword': /\b(?:false|off|on|no|true|yes)\b/
- }
- }
- });
-
- // Comments are inserted at top so that they can
- // surround markup
- Prism.languages.insertBefore('smarty', 'tag', {
- 'smarty-comment': {
- pattern: /\{\*[\s\S]*?\*\}/,
- alias: ['smarty','comment']
- }
- });
-
- // Tokenize all inline Smarty expressions
- Prism.hooks.add('before-highlight', function(env) {
- if (env.language !== 'smarty') {
- return;
- }
-
- env.tokenStack = [];
-
- env.backupCode = env.code;
- env.code = env.code.replace(smarty_pattern, function(match) {
-
- // Smarty tags inside {literal} block are ignored
- if(match === smarty_litteral_end) {
- smarty_litteral_mode = false;
- }
-
- if(!smarty_litteral_mode) {
- if(match === smarty_litteral_start) {
- smarty_litteral_mode = true;
- }
-
- var i = env.tokenStack.length;
- // Check for existing strings
- while (env.backupCode.indexOf('___SMARTY' + i + '___') !== -1)
- ++i;
-
- // Create a sparse array
- env.tokenStack[i] = match;
-
- return '___SMARTY' + i + '___';
- }
- return match;
- });
- });
-
- // Restore env.code for other plugins (e.g. line-numbers)
- Prism.hooks.add('before-insert', function(env) {
- if (env.language === 'smarty') {
- env.code = env.backupCode;
- delete env.backupCode;
- }
- });
-
- // Re-insert the tokens after highlighting
- // and highlight them with defined grammar
- Prism.hooks.add('after-highlight', function(env) {
- if (env.language !== 'smarty') {
- return;
- }
-
- for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) {
- var k = keys[i];
- var t = env.tokenStack[k];
-
- // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
- env.highlightedCode = env.highlightedCode.replace('___SMARTY' + k + '___', Prism.highlight(t, env.grammar, 'smarty').replace(/\$/g, '$$$$'));
- }
-
- env.element.innerHTML = env.highlightedCode;
- });
-
- }(Prism));
- /***/ }),
- /* 133 */
- /***/ (function(module, exports) {
- Prism.languages.smalltalk = {
- 'comment': /"(?:""|[^"])+"/,
- 'string': /'(?:''|[^'])+'/,
- 'symbol': /#[\da-z]+|#(?:-|([+\/\\*~<>=@%|&?!])\1?)|#(?=\()/i,
- 'block-arguments': {
- pattern: /(\[\s*):[^\[|]*?\|/,
- lookbehind: true,
- inside: {
- 'variable': /:[\da-z]+/i,
- 'punctuation': /\|/
- }
- },
- 'temporary-variables': {
- pattern: /\|[^|]+\|/,
- inside: {
- 'variable': /[\da-z]+/i,
- 'punctuation': /\|/
- }
- },
- 'keyword': /\b(?:nil|true|false|self|super|new)\b/,
- 'character': {
- pattern: /\$./,
- alias: 'string'
- },
- 'number': [
- /\d+r-?[\dA-Z]+(?:\.[\dA-Z]+)?(?:e-?\d+)?/,
- /(?:\B-|\b)\d+(?:\.\d+)?(?:e-?\d+)?/
- ],
- 'operator': /[<=]=?|:=|~[~=]|\/\/?|\\\\|>[>=]?|[!^+\-*&|,@]/,
- 'punctuation': /[.;:?\[\](){}]/
- };
- /***/ }),
- /* 134 */
- /***/ (function(module, exports) {
- /* TODO
- Add support for Markdown notation inside doc comments
- Add support for nested block comments...
- Match closure params even when not followed by dash or brace
- Add better support for macro definition
- */
-
- Prism.languages.rust = {
- 'comment': [
- {
- pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
- lookbehind: true
- },
- {
- pattern: /(^|[^\\:])\/\/.*/,
- lookbehind: true
- }
- ],
- 'string': [
- {
- pattern: /b?r(#*)"(?:\\?.)*?"\1/,
- greedy: true
- },
- {
- pattern: /b?("|')(?:\\?.)*?\1/,
- greedy: true
- }
- ],
- 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/,
-
- 'attribute': {
- pattern: /#!?\[.+?\]/,
- greedy: true,
- alias: 'attr-name'
- },
-
- 'function': [
- /[a-z0-9_]+(?=\s*\()/i,
- // Macros can use parens or brackets
- /[a-z0-9_]+!(?=\s*\(|\[)/i
- ],
- 'macro-rules': {
- pattern: /[a-z0-9_]+!/i,
- alias: 'function'
- },
-
- // Hex, oct, bin, dec numbers with visual separators and type suffix
- 'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32|64)?|f32|f64))?\b/,
-
- // Closure params should not be confused with bitwise OR |
- 'closure-params': {
- pattern: /\|[^|]*\|(?=\s*[{-])/,
- inside: {
- 'punctuation': /[\|:,]/,
- 'operator': /[&*]/
- }
- },
- 'punctuation': /[{}[\];(),:]|\.+|->/,
- 'operator': /[-+*\/%!^=]=?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/
- };
- /***/ }),
- /* 135 */
- /***/ (function(module, exports) {
- Prism.languages.r = {
- 'comment': /#.*/,
- 'string': {
- pattern: /(['"])(?:\\?.)*?\1/,
- greedy: true
- },
- 'percent-operator': {
- // Includes user-defined operators
- // and %%, %*%, %/%, %in%, %o%, %x%
- pattern: /%[^%\s]*%/,
- alias: 'operator'
- },
- 'boolean': /\b(?:TRUE|FALSE)\b/,
- 'ellipsis': /\.\.(?:\.|\d+)/,
- 'number': [
- /\b(?:NaN|Inf)\b/,
- /\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]?\d+)?[iL]?\b/
- ],
- 'keyword': /\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/,
- 'operator': /->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,
- 'punctuation': /[(){}\[\],;]/
- };
- /***/ }),
- /* 136 */
- /***/ (function(module, exports) {
- Prism.languages.d = Prism.languages.extend('clike', {
- 'string': [
- // r"", x""
- /\b[rx]"(\\.|[^\\"])*"[cwd]?/,
- // q"[]", q"()", q"<>", q"{}"
- /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,
- // q"IDENT
- // ...
- // IDENT"
- /\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/,
- // q"//", q"||", etc.
- /\bq"(.)[\s\S]*?\1"/,
- // Characters
- /'(?:\\'|\\?[^']+)'/,
-
- /(["`])(\\.|(?!\1)[^\\])*\1[cwd]?/
- ],
-
- 'number': [
- // The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
- // Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
- /\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,
- {
- pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,
- lookbehind: true
- }
- ],
-
- // In order: $, keywords and special tokens, globally defined symbols
- 'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,
- 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/
- });
-
-
- Prism.languages.d.comment = [
- // Shebang
- /^\s*#!.+/,
- // /+ +/
- {
- // Allow one level of nesting
- pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//,
- lookbehind: true
- }
- ].concat(Prism.languages.d.comment);
-
- Prism.languages.insertBefore('d', 'comment', {
- 'token-string': {
- // Allow one level of nesting
- pattern: /\bq\{(?:|\{[^}]*\}|[^}])*\}/,
- alias: 'string'
- }
- });
-
- Prism.languages.insertBefore('d', 'keyword', {
- 'property': /\B@\w*/
- });
-
- Prism.languages.insertBefore('d', 'function', {
- 'register': {
- // Iasm registers
- pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,
- alias: 'variable'
- }
- });
- /***/ }),
- /* 137 */
- /***/ (function(module, exports) {
- Prism.languages.dart = Prism.languages.extend('clike', {
- 'string': [
- {
- pattern: /r?("""|''')[\s\S]*?\1/,
- greedy: true
- },
- {
- pattern: /r?("|')(\\?.)*?\1/,
- greedy: true
- }
- ],
- 'keyword': [
- /\b(?:async|sync|yield)\*/,
- /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/
- ],
- 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
- });
-
- Prism.languages.insertBefore('dart','function',{
- 'metadata': {
- pattern: /@\w+/,
- alias: 'symbol'
- }
- });
- /***/ }),
- /* 138 */
- /***/ (function(module, exports) {
- (function(Prism) {
-
- // Ignore comments starting with { to privilege string interpolation highlighting
- var comment = /#(?!\{).+/,
- interpolation = {
- pattern: /#\{[^}]+\}/,
- alias: 'variable'
- };
-
- Prism.languages.coffeescript = Prism.languages.extend('javascript', {
- 'comment': comment,
- 'string': [
-
- // Strings are multiline
- {
- pattern: /'(?:\\?[^\\])*?'/,
- greedy: true
- },
-
- {
- // Strings are multiline
- pattern: /"(?:\\?[^\\])*?"/,
- greedy: true,
- inside: {
- 'interpolation': interpolation
- }
- }
- ],
- 'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
- 'class-member': {
- pattern: /@(?!\d)\w+/,
- alias: 'variable'
- }
- });
-
- Prism.languages.insertBefore('coffeescript', 'comment', {
- 'multiline-comment': {
- pattern: /###[\s\S]+?###/,
- alias: 'comment'
- },
-
- // Block regexp can contain comments and interpolation
- 'block-regex': {
- pattern: /\/{3}[\s\S]*?\/{3}/,
- alias: 'regex',
- inside: {
- 'comment': comment,
- 'interpolation': interpolation
- }
- }
- });
-
- Prism.languages.insertBefore('coffeescript', 'string', {
- 'inline-javascript': {
- pattern: /`(?:\\?[\s\S])*?`/,
- inside: {
- 'delimiter': {
- pattern: /^`|`$/,
- alias: 'punctuation'
- },
- rest: Prism.languages.javascript
- }
- },
-
- // Block strings
- 'multiline-string': [
- {
- pattern: /'''[\s\S]*?'''/,
- greedy: true,
- alias: 'string'
- },
- {
- pattern: /"""[\s\S]*?"""/,
- greedy: true,
- alias: 'string',
- inside: {
- interpolation: interpolation
- }
- }
- ]
-
- });
-
- Prism.languages.insertBefore('coffeescript', 'keyword', {
- // Object property
- 'property': /(?!\d)\w+(?=\s*:(?!:))/
- });
-
- delete Prism.languages.coffeescript['template-string'];
-
- }(Prism));
- /***/ }),
- /* 139 */
- /***/ (function(module, exports) {
- (function (Prism) {
- var variable = /%%?[~:\w]+%?|!\S+!/;
- var parameter = {
- pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,
- alias: 'attr-name',
- inside: {
- 'punctuation': /:/
- }
- };
- var string = /"[^"]*"/;
- var number = /(?:\b|-)\d+\b/;
-
- Prism.languages.batch = {
- 'comment': [
- /^::.*/m,
- {
- pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
- lookbehind: true
- }
- ],
- 'label': {
- pattern: /^:.*/m,
- alias: 'property'
- },
- 'command': [
- {
- // FOR command
- pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im,
- lookbehind: true,
- inside: {
- 'keyword': /^for\b|\b(?:in|do)\b/i,
- 'string': string,
- 'parameter': parameter,
- 'variable': variable,
- 'number': number,
- 'punctuation': /[()',]/
- }
- },
- {
- // IF command
- pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im,
- lookbehind: true,
- inside: {
- 'keyword': /^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i,
- 'string': string,
- 'parameter': parameter,
- 'variable': variable,
- 'number': number,
- 'operator': /\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i
- }
- },
- {
- // ELSE command
- pattern: /((?:^|[&()])[ \t]*)else\b/im,
- lookbehind: true,
- inside: {
- 'keyword': /^else\b/i
- }
- },
- {
- // SET command
- pattern: /((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
- lookbehind: true,
- inside: {
- 'keyword': /^set\b/i,
- 'string': string,
- 'parameter': parameter,
- 'variable': [
- variable,
- /\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/
- ],
- 'number': number,
- 'operator': /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,
- 'punctuation': /[()',]/
- }
- },
- {
- // Other commands
- pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
- lookbehind: true,
- inside: {
- 'keyword': /^\w+\b/i,
- 'string': string,
- 'parameter': parameter,
- 'label': {
- pattern: /(^\s*):\S+/m,
- lookbehind: true,
- alias: 'property'
- },
- 'variable': variable,
- 'number': number,
- 'operator': /\^/
- }
- }
- ],
- 'operator': /[&@]/,
- 'punctuation': /[()']/
- };
- }(Prism));
- /***/ }),
- /* 140 */
- /***/ (function(module, exports) {
- Prism.languages.cpp = Prism.languages.extend('c', {
- 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
- 'boolean': /\b(true|false)\b/,
- 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
- });
-
- Prism.languages.insertBefore('cpp', 'keyword', {
- 'class-name': {
- pattern: /(class\s+)[a-z0-9_]+/i,
- lookbehind: true
- }
- });
- /***/ }),
- /* 141 */
- /***/ (function(module, exports) {
- Prism.languages.lua = {
- 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
- // \z may be used to skip the following space
- 'string': {
- pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[\s\S]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
- greedy: true
- },
- 'number': /\b0x[a-f\d]+\.?[a-f\d]*(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|\.?\d*(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
- 'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
- 'function': /(?!\d)\w+(?=\s*(?:[({]))/,
- 'operator': [
- /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
- {
- // Match ".." but don't break "..."
- pattern: /(^|[^.])\.\.(?!\.)/,
- lookbehind: true
- }
- ],
- 'punctuation': /[\[\](){},;]|\.+|:+/
- };
- /***/ }),
- /* 142 */
- /***/ (function(module, exports) {
- Prism.languages.livescript = {
- 'interpolated-string': {
- pattern: /("""|")(?:\\[\s\S]|(?!\1)[^\\])*\1/,
- greedy: true,
- inside: {
- 'variable': {
- pattern: /(^|[^\\])#[a-z_](?:-?[a-z]|\d)*/m,
- lookbehind: true
- },
- 'interpolation': {
- pattern: /(^|[^\\])#\{[^}]+\}/m,
- lookbehind: true,
- inside: {
- 'interpolation-punctuation': {
- pattern: /^#\{|\}$/,
- alias: 'variable'
- }
- // See rest below
- }
- },
- 'string': /[\s\S]+/
- }
- },
- 'comment': [
- {
- pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
- lookbehind: true,
- greedy: true
- },
- {
- pattern: /(^|[^\\])#.*/,
- lookbehind: true,
- greedy: true
- }
- ],
- 'string': [
- {
- pattern: /('''|')(?:\\[\s\S]|(?!\1)[^\\])*\1/,
- greedy: true
- },
- {
- pattern: /<\[[\s\S]*?\]>/,
- greedy: true
- },
- /\\[^\s,;\])}]+/
- ],
- 'regex': [
- {
- pattern: /\/\/(\[.+?]|\\.|(?!\/\/)[^\\])+\/\/[gimyu]{0,5}/,
- greedy: true,
- inside: {
- 'comment': {
- pattern: /(^|[^\\])#.*/,
- lookbehind: true
- }
- }
- },
- {
- pattern: /\/(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}/,
- greedy: true
- }
- ],
- 'keyword': {
- pattern: /(^|(?!-).)\b(?:break|case|catch|class|const|continue|default|do|else|extends|fallthrough|finally|for(?: ever)?|function|if|implements|it|let|loop|new|null|otherwise|own|return|super|switch|that|then|this|throw|try|unless|until|var|void|when|while|yield)(?!-)\b/m,
- lookbehind: true
- },
- 'keyword-operator': {
- pattern: /(^|[^-])\b(?:(?:delete|require|typeof)!|(?:and|by|delete|export|from|import(?: all)?|in|instanceof|is(?:nt| not)?|not|of|or|til|to|typeof|with|xor)(?!-)\b)/m,
- lookbehind: true,
- alias: 'operator'
- },
- 'boolean': {
- pattern: /(^|[^-])\b(?:false|no|off|on|true|yes)(?!-)\b/m,
- lookbehind: true
- },
- 'argument': {
- // Don't match .&. nor &&
- pattern: /(^|(?!\.&\.)[^&])&(?!&)\d*/m,
- lookbehind: true,
- alias: 'variable'
- },
- 'number': /\b(?:\d+~[\da-z]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[a-z]\w*)?)/i,
- 'identifier': /[a-z_](?:-?[a-z]|\d)*/i,
- 'operator': [
- // Spaced .
- {
- pattern: /( )\.(?= )/,
- lookbehind: true
- },
- // Full list, in order:
- // .= .~ .. ...
- // .&. .^. .<<. .>>. .>>>.
- // := :: ::=
- // &&
- // || |>
- // < << <<< <<<<
- // <- <-- <-! <--!
- // <~ <~~ <~! <~~!
- // <| <= <?
- // > >> >= >?
- // - -- -> -->
- // + ++
- // @ @@
- // % %%
- // * **
- // ! != !~=
- // !~> !~~>
- // !-> !-->
- // ~ ~> ~~> ~=
- // = ==
- // ^ ^^
- // / ?
- /\.(?:[=~]|\.\.?)|\.(?:[&|^]|<<|>>>?)\.|:(?:=|:=?)|&&|\|[|>]|<(?:<<?<?|--?!?|~~?!?|[|=?])?|>[>=?]?|-(?:->?|>)?|\+\+?|@@?|%%?|\*\*?|!(?:~?=|--?>|~?~>)?|~(?:~?>|=)?|==?|\^\^?|[\/?]/
- ],
- 'punctuation': /[(){}\[\]|.,:;`]/
- };
-
- Prism.languages.livescript['interpolated-string'].inside['interpolation'].inside.rest = Prism.languages.livescript;
- /***/ }),
- /* 143 */
- /***/ (function(module, exports) {
- (function(Prism) {
- var funcPattern = /\\([^a-z()[\]]|[a-z\*]+)/i,
- insideEqu = {
- 'equation-command': {
- pattern: funcPattern,
- alias: 'regex'
- }
- };
-
- Prism.languages.latex = {
- 'comment': /%.*/m,
- // the verbatim environment prints whitespace to the document
- 'cdata': {
- pattern: /(\\begin\{((?:verbatim|lstlisting)\*?)\})([\s\S]*?)(?=\\end\{\2\})/,
- lookbehind: true
- },
- /*
- * equations can be between $ $ or \( \) or \[ \]
- * (all are multiline)
- */
- 'equation': [
- {
- pattern: /\$(?:\\?[\s\S])*?\$|\\\((?:\\?[\s\S])*?\\\)|\\\[(?:\\?[\s\S])*?\\\]/,
- inside: insideEqu,
- alias: 'string'
- },
- {
- pattern: /(\\begin\{((?:equation|math|eqnarray|align|multline|gather)\*?)\})([\s\S]*?)(?=\\end\{\2\})/,
- lookbehind: true,
- inside: insideEqu,
- alias: 'string'
- }
- ],
- /*
- * arguments which are keywords or references are highlighted
- * as keywords
- */
- 'keyword': {
- pattern: /(\\(?:begin|end|ref|cite|label|usepackage|documentclass)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
- lookbehind: true
- },
- 'url': {
- pattern: /(\\url\{)[^}]+(?=\})/,
- lookbehind: true
- },
- /*
- * section or chapter headlines are highlighted as bold so that
- * they stand out more
- */
- 'headline': {
- pattern: /(\\(?:part|chapter|section|subsection|frametitle|subsubsection|paragraph|subparagraph|subsubparagraph|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\}(?:\[[^\]]+\])?)/,
- lookbehind: true,
- alias: 'class-name'
- },
- 'function': {
- pattern: funcPattern,
- alias: 'selector'
- },
- 'punctuation': /[[\]{}&]/
- };
- })(Prism);
- /***/ }),
- /* 144 */
- /***/ (function(module, exports) {
- Prism.languages.groovy = Prism.languages.extend('clike', {
- 'keyword': /\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,
- 'string': [
- {
- pattern: /("""|''')[\s\S]*?\1|(\$\/)(\$\/\$|[\s\S])*?\/\$/,
- greedy: true
- },
- {
- pattern: /("|'|\/)(?:\\?.)*?\1/,
- greedy: true
- }
- ],
- 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i,
- 'operator': {
- pattern: /(^|[^.])(~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
- lookbehind: true
- },
- 'punctuation': /\.+|[{}[\];(),:$]/
- });
-
- Prism.languages.insertBefore('groovy', 'string', {
- 'shebang': {
- pattern: /#!.+/,
- alias: 'comment'
- }
- });
-
- Prism.languages.insertBefore('groovy', 'punctuation', {
- 'spock-block': /\b(setup|given|when|then|and|cleanup|expect|where):/
- });
-
- Prism.languages.insertBefore('groovy', 'function', {
- 'annotation': {
- alias: 'punctuation',
- pattern: /(^|[^.])@\w+/,
- lookbehind: true
- }
- });
-
- // Handle string interpolation
- Prism.hooks.add('wrap', function(env) {
- if (env.language === 'groovy' && env.type === 'string') {
- var delimiter = env.content[0];
-
- if (delimiter != "'") {
- var pattern = /([^\\])(\$(\{.*?\}|[\w\.]+))/;
- if (delimiter === '$') {
- pattern = /([^\$])(\$(\{.*?\}|[\w\.]+))/;
- }
-
- // To prevent double HTML-encoding we have to decode env.content first
- env.content = env.content.replace(/</g, '<').replace(/&/g, '&');
-
- env.content = Prism.highlight(env.content, {
- 'expression': {
- pattern: pattern,
- lookbehind: true,
- inside: Prism.languages.groovy
- }
- });
-
- env.classes.push(delimiter === '/' ? 'regex' : 'gstring');
- }
- }
- });
- /***/ }),
- /* 145 */
- /***/ (function(module, exports) {
- Prism.languages.graphql = {
- 'comment': /#.*/,
- 'string': {
- pattern: /"(?:\\.|[^\\"])*"/,
- greedy: true
- },
- 'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,
- 'boolean': /\b(?:true|false)\b/,
- 'variable': /\$[a-z_]\w*/i,
- 'directive': {
- pattern: /@[a-z_]\w*/i,
- alias: 'function'
- },
- 'attr-name': /[a-z_]\w*(?=\s*:)/i,
- 'keyword': [
- {
- pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.\.\.\s*)on\b/,
- lookbehind: true
- },
- /\b(?:query|fragment|mutation)\b/
- ],
- 'operator': /!|=|\.{3}/,
- 'punctuation': /[!(){}\[\]:=,]/
- };
- /***/ }),
- /* 146 */
- /***/ (function(module, exports) {
- Prism.languages.nginx = Prism.languages.extend('clike', {
- 'comment': {
- pattern: /(^|[^"{\\])#.*/,
- lookbehind: true
- },
- 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|server|events|location|include|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types)\b/i,
- });
-
- Prism.languages.insertBefore('nginx', 'keyword', {
- 'variable': /\$[a-z_]+/i
- });
- /***/ }),
- /* 147 */
- /***/ (function(module, exports) {
- Prism.languages.erlang = {
- 'comment': /%.+/,
- 'string': {
- pattern: /"(?:\\?.)*?"/,
- greedy: true
- },
- 'quoted-function': {
- pattern: /'(?:\\.|[^'\\])+'(?=\()/,
- alias: 'function'
- },
- 'quoted-atom': {
- pattern: /'(?:\\.|[^'\\])+'/,
- alias: 'atom'
- },
- 'boolean': /\b(?:true|false)\b/,
- 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,
- 'number': [
- /\$\\?./,
- /\d+#[a-z0-9]+/i,
- /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/
- ],
- 'function': /\b[a-z][\w@]*(?=\()/,
- 'variable': {
- // Look-behind is used to prevent wrong highlighting of atoms containing "@"
- pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
- lookbehind: true
- },
- 'operator': [
- /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
- {
- // We don't want to match <<
- pattern: /(^|[^<])<(?!<)/,
- lookbehind: true
- },
- {
- // We don't want to match >>
- pattern: /(^|[^>])>(?!>)/,
- lookbehind: true
- }
- ],
- 'atom': /\b[a-z][\w@]*/,
- 'punctuation': /[()[\]{}:;,.#|]|<<|>>/
-
- };
- /***/ }),
- /* 148 */
- /***/ (function(module, exports) {
- Prism.languages.powershell = {
- 'comment': [
- {
- pattern: /(^|[^`])<#[\s\S]*?#>/,
- lookbehind: true
- },
- {
- pattern: /(^|[^`])#.*/,
- lookbehind: true
- }
- ],
- 'string': [
- {
- pattern: /"(`?[\s\S])*?"/,
- greedy: true,
- inside: {
- 'function': {
- pattern: /[^`]\$\(.*?\)/,
- // Populated at end of file
- inside: {}
- }
- }
- },
- {
- pattern: /'([^']|'')*'/,
- greedy: true
- }
- ],
- // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
- 'namespace': /\[[a-z][\s\S]*?\]/i,
- 'boolean': /\$(true|false)\b/i,
- 'variable': /\$\w+\b/i,
- // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
- // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
- // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
- 'function': [
- /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(Csv|Json|StringData)|Convert-Path|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-Process|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(Command|Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(Job|PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(Computer|Service)|Restore-Computer|Resume-(Job|Service)|Save-Help|Select-(Object|String|Xml)|Send-MailMessage|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-Object|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData|Help|List|TypeData)|Use-Transaction|Wait-(Event|Job|Process)|Where-Object|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,
- /\b(ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i
- ],
- // per http://technet.microsoft.com/en-us/library/hh847744.aspx
- 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
- 'operator': {
- pattern: /(\W?)(!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(and|x?or)|(Not)?(Like|Match|Contains|In)|Replace|Join|is(Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
- lookbehind: true
- },
- 'punctuation': /[|{}[\];(),.]/
- };
-
- // Variable interpolation inside strings, and nested expressions
- Prism.languages.powershell.string[0].inside.boolean = Prism.languages.powershell.boolean;
- Prism.languages.powershell.string[0].inside.variable = Prism.languages.powershell.variable;
- Prism.languages.powershell.string[0].inside.function.inside = Prism.util.clone(Prism.languages.powershell);
- /***/ }),
- /* 149 */
- /***/ (function(module, exports) {
- Prism.languages.makefile = {
- 'comment': {
- pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|.)*/,
- lookbehind: true
- },
- 'string': {
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
-
- // Built-in target names
- 'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
-
- // Targets
- 'symbol': {
- pattern: /^[^:=\r\n]+(?=\s*:(?!=))/m,
- inside: {
- 'variable': /\$+(?:[^(){}:#=\s]+|(?=[({]))/
- }
- },
- 'variable': /\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
-
- 'keyword': [
- // Directives
- /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
- // Functions
- {
- pattern: /(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/,
- lookbehind: true
- }
- ],
- 'operator': /(?:::|[?:+!])?=|[|@]/,
- 'punctuation': /[:;(){}]/
- };
- /***/ }),
- /* 150 */
- /***/ (function(module, exports) {
- Prism.languages.markdown = Prism.languages.extend('markup', {});
- Prism.languages.insertBefore('markdown', 'prolog', {
- 'blockquote': {
- // > ...
- pattern: /^>(?:[\t ]*>)*/m,
- alias: 'punctuation'
- },
- 'code': [
- {
- // Prefixed by 4 spaces or 1 tab
- pattern: /^(?: {4}|\t).+/m,
- alias: 'keyword'
- },
- {
- // `code`
- // ``code``
- pattern: /``.+?``|`[^`\n]+`/,
- alias: 'keyword'
- }
- ],
- 'title': [
- {
- // title 1
- // =======
-
- // title 2
- // -------
- pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/,
- alias: 'important',
- inside: {
- punctuation: /==+$|--+$/
- }
- },
- {
- // # title 1
- // ###### title 6
- pattern: /(^\s*)#+.+/m,
- lookbehind: true,
- alias: 'important',
- inside: {
- punctuation: /^#+|#+$/
- }
- }
- ],
- 'hr': {
- // ***
- // ---
- // * * *
- // -----------
- pattern: /(^\s*)([*-])([\t ]*\2){2,}(?=\s*$)/m,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'list': {
- // * item
- // + item
- // - item
- // 1. item
- pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'url-reference': {
- // [id]: http://example.com "Optional title"
- // [id]: http://example.com 'Optional title'
- // [id]: http://example.com (Optional title)
- // [id]: <http://example.com> "Optional title"
- pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
- inside: {
- 'variable': {
- pattern: /^(!?\[)[^\]]+/,
- lookbehind: true
- },
- 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
- 'punctuation': /^[\[\]!:]|[<>]/
- },
- alias: 'url'
- },
- 'bold': {
- // **strong**
- // __strong__
-
- // Allow only one line break
- pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
- lookbehind: true,
- inside: {
- 'punctuation': /^\*\*|^__|\*\*$|__$/
- }
- },
- 'italic': {
- // *em*
- // _em_
-
- // Allow only one line break
- pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
- lookbehind: true,
- inside: {
- 'punctuation': /^[*_]|[*_]$/
- }
- },
- 'url': {
- // [example](http://example.com "Optional title")
- // [example] [id]
- pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,
- inside: {
- 'variable': {
- pattern: /(!?\[)[^\]]+(?=\]$)/,
- lookbehind: true
- },
- 'string': {
- pattern: /"(?:\\.|[^"\\])*"(?=\)$)/
- }
- }
- }
- });
-
- Prism.languages.markdown['bold'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']);
- Prism.languages.markdown['italic'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']);
- Prism.languages.markdown['bold'].inside['italic'] = Prism.util.clone(Prism.languages.markdown['italic']);
- Prism.languages.markdown['italic'].inside['bold'] = Prism.util.clone(Prism.languages.markdown['bold']);
- /***/ }),
- /* 151 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 152 */,
- /* 153 */,
- /* 154 */,
- /* 155 */,
- /* 156 */,
- /* 157 */,
- /* 158 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 159 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 160 */
- /***/ (function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ }),
- /* 161 */,
- /* 162 */
- /***/ (function(module, exports) {
- module.exports = "<div tabindex=\"1\" class=\"mditor {{split?'split':''}} {{preview?'preview':''}} {{fullscreen?'fullscreen':''}}\" style=\"width:{{width}};height:{{height}}\">\n <div class=\"head\" m:on:dblclick=\"onHeadDblClick\">\n <m:toolbar m:id=\"toolbar\" m:prop:mditor=\"self\"></m:toolbar>\n </div>\n <div class=\"body\">\n <m:editor m:id=\"editor\" m:prop:mditor=\"self\" m:model:value=\"value\" m:on:scroll=\"syncScroll\" m:on:changed=\"onChanged\" m:on:input=\"onInput\" m:on:paste=\"onPaste\"></m:editor>\n <m:viewer m:id=\"viewer\" m:prop:mditor=\"self\" m:model:value=\"value\"></m:viewer>\n <m:finder m:id=\"finder\" m:prop:mditor=\"self\"></m:viewer>\n </div>\n</div>"
- /***/ })
- /******/ ]);
- //# sourceMappingURL=mditor.js.map
|