blocks.js 451 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335
  1. this["wp"] = this["wp"] || {}; this["wp"]["blocks"] =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 347);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 0:
  90. /***/ (function(module, exports) {
  91. (function() { module.exports = this["wp"]["element"]; }());
  92. /***/ }),
  93. /***/ 1:
  94. /***/ (function(module, exports) {
  95. (function() { module.exports = this["wp"]["i18n"]; }());
  96. /***/ }),
  97. /***/ 10:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
  101. function _defineProperty(obj, key, value) {
  102. if (key in obj) {
  103. Object.defineProperty(obj, key, {
  104. value: value,
  105. enumerable: true,
  106. configurable: true,
  107. writable: true
  108. });
  109. } else {
  110. obj[key] = value;
  111. }
  112. return obj;
  113. }
  114. /***/ }),
  115. /***/ 11:
  116. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  117. "use strict";
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
  119. function _defineProperties(target, props) {
  120. for (var i = 0; i < props.length; i++) {
  121. var descriptor = props[i];
  122. descriptor.enumerable = descriptor.enumerable || false;
  123. descriptor.configurable = true;
  124. if ("value" in descriptor) descriptor.writable = true;
  125. Object.defineProperty(target, descriptor.key, descriptor);
  126. }
  127. }
  128. function _createClass(Constructor, protoProps, staticProps) {
  129. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  130. if (staticProps) _defineProperties(Constructor, staticProps);
  131. return Constructor;
  132. }
  133. /***/ }),
  134. /***/ 12:
  135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  136. "use strict";
  137. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
  138. function _classCallCheck(instance, Constructor) {
  139. if (!(instance instanceof Constructor)) {
  140. throw new TypeError("Cannot call a class as a function");
  141. }
  142. }
  143. /***/ }),
  144. /***/ 144:
  145. /***/ (function(module, exports) {
  146. (function() { module.exports = this["wp"]["shortcode"]; }());
  147. /***/ }),
  148. /***/ 17:
  149. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  150. "use strict";
  151. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
  152. function _arrayWithoutHoles(arr) {
  153. if (Array.isArray(arr)) {
  154. for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
  155. arr2[i] = arr[i];
  156. }
  157. return arr2;
  158. }
  159. }
  160. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
  161. var iterableToArray = __webpack_require__(30);
  162. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
  163. function _nonIterableSpread() {
  164. throw new TypeError("Invalid attempt to spread non-iterable instance");
  165. }
  166. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
  167. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
  168. function _toConsumableArray(arr) {
  169. return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
  170. }
  171. /***/ }),
  172. /***/ 18:
  173. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  174. "use strict";
  175. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
  176. function _extends() {
  177. _extends = Object.assign || function (target) {
  178. for (var i = 1; i < arguments.length; i++) {
  179. var source = arguments[i];
  180. for (var key in source) {
  181. if (Object.prototype.hasOwnProperty.call(source, key)) {
  182. target[key] = source[key];
  183. }
  184. }
  185. }
  186. return target;
  187. };
  188. return _extends.apply(this, arguments);
  189. }
  190. /***/ }),
  191. /***/ 2:
  192. /***/ (function(module, exports) {
  193. (function() { module.exports = this["lodash"]; }());
  194. /***/ }),
  195. /***/ 222:
  196. /***/ (function(module, exports) {
  197. (function() { module.exports = this["wp"]["blockSerializationDefaultParser"]; }());
  198. /***/ }),
  199. /***/ 223:
  200. /***/ (function(module, exports, __webpack_require__) {
  201. var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.0 - 10-11-2018 */
  202. (function(){
  203. /**
  204. * Created by Tivie on 13-07-2015.
  205. */
  206. function getDefaultOpts (simple) {
  207. 'use strict';
  208. var defaultOptions = {
  209. omitExtraWLInCodeBlocks: {
  210. defaultValue: false,
  211. describe: 'Omit the default extra whiteline added to code blocks',
  212. type: 'boolean'
  213. },
  214. noHeaderId: {
  215. defaultValue: false,
  216. describe: 'Turn on/off generated header id',
  217. type: 'boolean'
  218. },
  219. prefixHeaderId: {
  220. defaultValue: false,
  221. describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
  222. type: 'string'
  223. },
  224. rawPrefixHeaderId: {
  225. defaultValue: false,
  226. describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
  227. type: 'boolean'
  228. },
  229. ghCompatibleHeaderId: {
  230. defaultValue: false,
  231. describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
  232. type: 'boolean'
  233. },
  234. rawHeaderId: {
  235. defaultValue: false,
  236. describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
  237. type: 'boolean'
  238. },
  239. headerLevelStart: {
  240. defaultValue: false,
  241. describe: 'The header blocks level start',
  242. type: 'integer'
  243. },
  244. parseImgDimensions: {
  245. defaultValue: false,
  246. describe: 'Turn on/off image dimension parsing',
  247. type: 'boolean'
  248. },
  249. simplifiedAutoLink: {
  250. defaultValue: false,
  251. describe: 'Turn on/off GFM autolink style',
  252. type: 'boolean'
  253. },
  254. excludeTrailingPunctuationFromURLs: {
  255. defaultValue: false,
  256. describe: 'Excludes trailing punctuation from links generated with autoLinking',
  257. type: 'boolean'
  258. },
  259. literalMidWordUnderscores: {
  260. defaultValue: false,
  261. describe: 'Parse midword underscores as literal underscores',
  262. type: 'boolean'
  263. },
  264. literalMidWordAsterisks: {
  265. defaultValue: false,
  266. describe: 'Parse midword asterisks as literal asterisks',
  267. type: 'boolean'
  268. },
  269. strikethrough: {
  270. defaultValue: false,
  271. describe: 'Turn on/off strikethrough support',
  272. type: 'boolean'
  273. },
  274. tables: {
  275. defaultValue: false,
  276. describe: 'Turn on/off tables support',
  277. type: 'boolean'
  278. },
  279. tablesHeaderId: {
  280. defaultValue: false,
  281. describe: 'Add an id to table headers',
  282. type: 'boolean'
  283. },
  284. ghCodeBlocks: {
  285. defaultValue: true,
  286. describe: 'Turn on/off GFM fenced code blocks support',
  287. type: 'boolean'
  288. },
  289. tasklists: {
  290. defaultValue: false,
  291. describe: 'Turn on/off GFM tasklist support',
  292. type: 'boolean'
  293. },
  294. smoothLivePreview: {
  295. defaultValue: false,
  296. describe: 'Prevents weird effects in live previews due to incomplete input',
  297. type: 'boolean'
  298. },
  299. smartIndentationFix: {
  300. defaultValue: false,
  301. description: 'Tries to smartly fix indentation in es6 strings',
  302. type: 'boolean'
  303. },
  304. disableForced4SpacesIndentedSublists: {
  305. defaultValue: false,
  306. description: 'Disables the requirement of indenting nested sublists by 4 spaces',
  307. type: 'boolean'
  308. },
  309. simpleLineBreaks: {
  310. defaultValue: false,
  311. description: 'Parses simple line breaks as <br> (GFM Style)',
  312. type: 'boolean'
  313. },
  314. requireSpaceBeforeHeadingText: {
  315. defaultValue: false,
  316. description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
  317. type: 'boolean'
  318. },
  319. ghMentions: {
  320. defaultValue: false,
  321. description: 'Enables github @mentions',
  322. type: 'boolean'
  323. },
  324. ghMentionsLink: {
  325. defaultValue: 'https://github.com/{u}',
  326. description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
  327. type: 'string'
  328. },
  329. encodeEmails: {
  330. defaultValue: true,
  331. description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
  332. type: 'boolean'
  333. },
  334. openLinksInNewWindow: {
  335. defaultValue: false,
  336. description: 'Open all links in new windows',
  337. type: 'boolean'
  338. },
  339. backslashEscapesHTMLTags: {
  340. defaultValue: false,
  341. description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
  342. type: 'boolean'
  343. },
  344. emoji: {
  345. defaultValue: false,
  346. description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
  347. type: 'boolean'
  348. },
  349. underline: {
  350. defaultValue: false,
  351. description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
  352. type: 'boolean'
  353. },
  354. completeHTMLDocument: {
  355. defaultValue: false,
  356. description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
  357. type: 'boolean'
  358. },
  359. metadata: {
  360. defaultValue: false,
  361. description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
  362. type: 'boolean'
  363. },
  364. splitAdjacentBlockquotes: {
  365. defaultValue: false,
  366. description: 'Split adjacent blockquote blocks',
  367. type: 'boolean'
  368. }
  369. };
  370. if (simple === false) {
  371. return JSON.parse(JSON.stringify(defaultOptions));
  372. }
  373. var ret = {};
  374. for (var opt in defaultOptions) {
  375. if (defaultOptions.hasOwnProperty(opt)) {
  376. ret[opt] = defaultOptions[opt].defaultValue;
  377. }
  378. }
  379. return ret;
  380. }
  381. function allOptionsOn () {
  382. 'use strict';
  383. var options = getDefaultOpts(true),
  384. ret = {};
  385. for (var opt in options) {
  386. if (options.hasOwnProperty(opt)) {
  387. ret[opt] = true;
  388. }
  389. }
  390. return ret;
  391. }
  392. /**
  393. * Created by Tivie on 06-01-2015.
  394. */
  395. // Private properties
  396. var showdown = {},
  397. parsers = {},
  398. extensions = {},
  399. globalOptions = getDefaultOpts(true),
  400. setFlavor = 'vanilla',
  401. flavor = {
  402. github: {
  403. omitExtraWLInCodeBlocks: true,
  404. simplifiedAutoLink: true,
  405. excludeTrailingPunctuationFromURLs: true,
  406. literalMidWordUnderscores: true,
  407. strikethrough: true,
  408. tables: true,
  409. tablesHeaderId: true,
  410. ghCodeBlocks: true,
  411. tasklists: true,
  412. disableForced4SpacesIndentedSublists: true,
  413. simpleLineBreaks: true,
  414. requireSpaceBeforeHeadingText: true,
  415. ghCompatibleHeaderId: true,
  416. ghMentions: true,
  417. backslashEscapesHTMLTags: true,
  418. emoji: true,
  419. splitAdjacentBlockquotes: true
  420. },
  421. original: {
  422. noHeaderId: true,
  423. ghCodeBlocks: false
  424. },
  425. ghost: {
  426. omitExtraWLInCodeBlocks: true,
  427. parseImgDimensions: true,
  428. simplifiedAutoLink: true,
  429. excludeTrailingPunctuationFromURLs: true,
  430. literalMidWordUnderscores: true,
  431. strikethrough: true,
  432. tables: true,
  433. tablesHeaderId: true,
  434. ghCodeBlocks: true,
  435. tasklists: true,
  436. smoothLivePreview: true,
  437. simpleLineBreaks: true,
  438. requireSpaceBeforeHeadingText: true,
  439. ghMentions: false,
  440. encodeEmails: true
  441. },
  442. vanilla: getDefaultOpts(true),
  443. allOn: allOptionsOn()
  444. };
  445. /**
  446. * helper namespace
  447. * @type {{}}
  448. */
  449. showdown.helper = {};
  450. /**
  451. * TODO LEGACY SUPPORT CODE
  452. * @type {{}}
  453. */
  454. showdown.extensions = {};
  455. /**
  456. * Set a global option
  457. * @static
  458. * @param {string} key
  459. * @param {*} value
  460. * @returns {showdown}
  461. */
  462. showdown.setOption = function (key, value) {
  463. 'use strict';
  464. globalOptions[key] = value;
  465. return this;
  466. };
  467. /**
  468. * Get a global option
  469. * @static
  470. * @param {string} key
  471. * @returns {*}
  472. */
  473. showdown.getOption = function (key) {
  474. 'use strict';
  475. return globalOptions[key];
  476. };
  477. /**
  478. * Get the global options
  479. * @static
  480. * @returns {{}}
  481. */
  482. showdown.getOptions = function () {
  483. 'use strict';
  484. return globalOptions;
  485. };
  486. /**
  487. * Reset global options to the default values
  488. * @static
  489. */
  490. showdown.resetOptions = function () {
  491. 'use strict';
  492. globalOptions = getDefaultOpts(true);
  493. };
  494. /**
  495. * Set the flavor showdown should use as default
  496. * @param {string} name
  497. */
  498. showdown.setFlavor = function (name) {
  499. 'use strict';
  500. if (!flavor.hasOwnProperty(name)) {
  501. throw Error(name + ' flavor was not found');
  502. }
  503. showdown.resetOptions();
  504. var preset = flavor[name];
  505. setFlavor = name;
  506. for (var option in preset) {
  507. if (preset.hasOwnProperty(option)) {
  508. globalOptions[option] = preset[option];
  509. }
  510. }
  511. };
  512. /**
  513. * Get the currently set flavor
  514. * @returns {string}
  515. */
  516. showdown.getFlavor = function () {
  517. 'use strict';
  518. return setFlavor;
  519. };
  520. /**
  521. * Get the options of a specified flavor. Returns undefined if the flavor was not found
  522. * @param {string} name Name of the flavor
  523. * @returns {{}|undefined}
  524. */
  525. showdown.getFlavorOptions = function (name) {
  526. 'use strict';
  527. if (flavor.hasOwnProperty(name)) {
  528. return flavor[name];
  529. }
  530. };
  531. /**
  532. * Get the default options
  533. * @static
  534. * @param {boolean} [simple=true]
  535. * @returns {{}}
  536. */
  537. showdown.getDefaultOptions = function (simple) {
  538. 'use strict';
  539. return getDefaultOpts(simple);
  540. };
  541. /**
  542. * Get or set a subParser
  543. *
  544. * subParser(name) - Get a registered subParser
  545. * subParser(name, func) - Register a subParser
  546. * @static
  547. * @param {string} name
  548. * @param {function} [func]
  549. * @returns {*}
  550. */
  551. showdown.subParser = function (name, func) {
  552. 'use strict';
  553. if (showdown.helper.isString(name)) {
  554. if (typeof func !== 'undefined') {
  555. parsers[name] = func;
  556. } else {
  557. if (parsers.hasOwnProperty(name)) {
  558. return parsers[name];
  559. } else {
  560. throw Error('SubParser named ' + name + ' not registered!');
  561. }
  562. }
  563. }
  564. };
  565. /**
  566. * Gets or registers an extension
  567. * @static
  568. * @param {string} name
  569. * @param {object|function=} ext
  570. * @returns {*}
  571. */
  572. showdown.extension = function (name, ext) {
  573. 'use strict';
  574. if (!showdown.helper.isString(name)) {
  575. throw Error('Extension \'name\' must be a string');
  576. }
  577. name = showdown.helper.stdExtName(name);
  578. // Getter
  579. if (showdown.helper.isUndefined(ext)) {
  580. if (!extensions.hasOwnProperty(name)) {
  581. throw Error('Extension named ' + name + ' is not registered!');
  582. }
  583. return extensions[name];
  584. // Setter
  585. } else {
  586. // Expand extension if it's wrapped in a function
  587. if (typeof ext === 'function') {
  588. ext = ext();
  589. }
  590. // Ensure extension is an array
  591. if (!showdown.helper.isArray(ext)) {
  592. ext = [ext];
  593. }
  594. var validExtension = validate(ext, name);
  595. if (validExtension.valid) {
  596. extensions[name] = ext;
  597. } else {
  598. throw Error(validExtension.error);
  599. }
  600. }
  601. };
  602. /**
  603. * Gets all extensions registered
  604. * @returns {{}}
  605. */
  606. showdown.getAllExtensions = function () {
  607. 'use strict';
  608. return extensions;
  609. };
  610. /**
  611. * Remove an extension
  612. * @param {string} name
  613. */
  614. showdown.removeExtension = function (name) {
  615. 'use strict';
  616. delete extensions[name];
  617. };
  618. /**
  619. * Removes all extensions
  620. */
  621. showdown.resetExtensions = function () {
  622. 'use strict';
  623. extensions = {};
  624. };
  625. /**
  626. * Validate extension
  627. * @param {array} extension
  628. * @param {string} name
  629. * @returns {{valid: boolean, error: string}}
  630. */
  631. function validate (extension, name) {
  632. 'use strict';
  633. var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
  634. ret = {
  635. valid: true,
  636. error: ''
  637. };
  638. if (!showdown.helper.isArray(extension)) {
  639. extension = [extension];
  640. }
  641. for (var i = 0; i < extension.length; ++i) {
  642. var baseMsg = errMsg + ' sub-extension ' + i + ': ',
  643. ext = extension[i];
  644. if (typeof ext !== 'object') {
  645. ret.valid = false;
  646. ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
  647. return ret;
  648. }
  649. if (!showdown.helper.isString(ext.type)) {
  650. ret.valid = false;
  651. ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
  652. return ret;
  653. }
  654. var type = ext.type = ext.type.toLowerCase();
  655. // normalize extension type
  656. if (type === 'language') {
  657. type = ext.type = 'lang';
  658. }
  659. if (type === 'html') {
  660. type = ext.type = 'output';
  661. }
  662. if (type !== 'lang' && type !== 'output' && type !== 'listener') {
  663. ret.valid = false;
  664. ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
  665. return ret;
  666. }
  667. if (type === 'listener') {
  668. if (showdown.helper.isUndefined(ext.listeners)) {
  669. ret.valid = false;
  670. ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
  671. return ret;
  672. }
  673. } else {
  674. if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
  675. ret.valid = false;
  676. ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
  677. return ret;
  678. }
  679. }
  680. if (ext.listeners) {
  681. if (typeof ext.listeners !== 'object') {
  682. ret.valid = false;
  683. ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
  684. return ret;
  685. }
  686. for (var ln in ext.listeners) {
  687. if (ext.listeners.hasOwnProperty(ln)) {
  688. if (typeof ext.listeners[ln] !== 'function') {
  689. ret.valid = false;
  690. ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
  691. ' must be a function but ' + typeof ext.listeners[ln] + ' given';
  692. return ret;
  693. }
  694. }
  695. }
  696. }
  697. if (ext.filter) {
  698. if (typeof ext.filter !== 'function') {
  699. ret.valid = false;
  700. ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
  701. return ret;
  702. }
  703. } else if (ext.regex) {
  704. if (showdown.helper.isString(ext.regex)) {
  705. ext.regex = new RegExp(ext.regex, 'g');
  706. }
  707. if (!(ext.regex instanceof RegExp)) {
  708. ret.valid = false;
  709. ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
  710. return ret;
  711. }
  712. if (showdown.helper.isUndefined(ext.replace)) {
  713. ret.valid = false;
  714. ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
  715. return ret;
  716. }
  717. }
  718. }
  719. return ret;
  720. }
  721. /**
  722. * Validate extension
  723. * @param {object} ext
  724. * @returns {boolean}
  725. */
  726. showdown.validateExtension = function (ext) {
  727. 'use strict';
  728. var validateExtension = validate(ext, null);
  729. if (!validateExtension.valid) {
  730. console.warn(validateExtension.error);
  731. return false;
  732. }
  733. return true;
  734. };
  735. /**
  736. * showdownjs helper functions
  737. */
  738. if (!showdown.hasOwnProperty('helper')) {
  739. showdown.helper = {};
  740. }
  741. /**
  742. * Check if var is string
  743. * @static
  744. * @param {string} a
  745. * @returns {boolean}
  746. */
  747. showdown.helper.isString = function (a) {
  748. 'use strict';
  749. return (typeof a === 'string' || a instanceof String);
  750. };
  751. /**
  752. * Check if var is a function
  753. * @static
  754. * @param {*} a
  755. * @returns {boolean}
  756. */
  757. showdown.helper.isFunction = function (a) {
  758. 'use strict';
  759. var getType = {};
  760. return a && getType.toString.call(a) === '[object Function]';
  761. };
  762. /**
  763. * isArray helper function
  764. * @static
  765. * @param {*} a
  766. * @returns {boolean}
  767. */
  768. showdown.helper.isArray = function (a) {
  769. 'use strict';
  770. return Array.isArray(a);
  771. };
  772. /**
  773. * Check if value is undefined
  774. * @static
  775. * @param {*} value The value to check.
  776. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  777. */
  778. showdown.helper.isUndefined = function (value) {
  779. 'use strict';
  780. return typeof value === 'undefined';
  781. };
  782. /**
  783. * ForEach helper function
  784. * Iterates over Arrays and Objects (own properties only)
  785. * @static
  786. * @param {*} obj
  787. * @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
  788. */
  789. showdown.helper.forEach = function (obj, callback) {
  790. 'use strict';
  791. // check if obj is defined
  792. if (showdown.helper.isUndefined(obj)) {
  793. throw new Error('obj param is required');
  794. }
  795. if (showdown.helper.isUndefined(callback)) {
  796. throw new Error('callback param is required');
  797. }
  798. if (!showdown.helper.isFunction(callback)) {
  799. throw new Error('callback param must be a function/closure');
  800. }
  801. if (typeof obj.forEach === 'function') {
  802. obj.forEach(callback);
  803. } else if (showdown.helper.isArray(obj)) {
  804. for (var i = 0; i < obj.length; i++) {
  805. callback(obj[i], i, obj);
  806. }
  807. } else if (typeof (obj) === 'object') {
  808. for (var prop in obj) {
  809. if (obj.hasOwnProperty(prop)) {
  810. callback(obj[prop], prop, obj);
  811. }
  812. }
  813. } else {
  814. throw new Error('obj does not seem to be an array or an iterable object');
  815. }
  816. };
  817. /**
  818. * Standardidize extension name
  819. * @static
  820. * @param {string} s extension name
  821. * @returns {string}
  822. */
  823. showdown.helper.stdExtName = function (s) {
  824. 'use strict';
  825. return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
  826. };
  827. function escapeCharactersCallback (wholeMatch, m1) {
  828. 'use strict';
  829. var charCodeToEscape = m1.charCodeAt(0);
  830. return '¨E' + charCodeToEscape + 'E';
  831. }
  832. /**
  833. * Callback used to escape characters when passing through String.replace
  834. * @static
  835. * @param {string} wholeMatch
  836. * @param {string} m1
  837. * @returns {string}
  838. */
  839. showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
  840. /**
  841. * Escape characters in a string
  842. * @static
  843. * @param {string} text
  844. * @param {string} charsToEscape
  845. * @param {boolean} afterBackslash
  846. * @returns {XML|string|void|*}
  847. */
  848. showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
  849. 'use strict';
  850. // First we have to escape the escape characters so that
  851. // we can build a character class out of them
  852. var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
  853. if (afterBackslash) {
  854. regexString = '\\\\' + regexString;
  855. }
  856. var regex = new RegExp(regexString, 'g');
  857. text = text.replace(regex, escapeCharactersCallback);
  858. return text;
  859. };
  860. /**
  861. * Unescape HTML entities
  862. * @param txt
  863. * @returns {string}
  864. */
  865. showdown.helper.unescapeHTMLEntities = function (txt) {
  866. 'use strict';
  867. return txt
  868. .replace(/&quot;/g, '"')
  869. .replace(/&lt;/g, '<')
  870. .replace(/&gt;/g, '>')
  871. .replace(/&amp;/g, '&');
  872. };
  873. var rgxFindMatchPos = function (str, left, right, flags) {
  874. 'use strict';
  875. var f = flags || '',
  876. g = f.indexOf('g') > -1,
  877. x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
  878. l = new RegExp(left, f.replace(/g/g, '')),
  879. pos = [],
  880. t, s, m, start, end;
  881. do {
  882. t = 0;
  883. while ((m = x.exec(str))) {
  884. if (l.test(m[0])) {
  885. if (!(t++)) {
  886. s = x.lastIndex;
  887. start = s - m[0].length;
  888. }
  889. } else if (t) {
  890. if (!--t) {
  891. end = m.index + m[0].length;
  892. var obj = {
  893. left: {start: start, end: s},
  894. match: {start: s, end: m.index},
  895. right: {start: m.index, end: end},
  896. wholeMatch: {start: start, end: end}
  897. };
  898. pos.push(obj);
  899. if (!g) {
  900. return pos;
  901. }
  902. }
  903. }
  904. }
  905. } while (t && (x.lastIndex = s));
  906. return pos;
  907. };
  908. /**
  909. * matchRecursiveRegExp
  910. *
  911. * (c) 2007 Steven Levithan <stevenlevithan.com>
  912. * MIT License
  913. *
  914. * Accepts a string to search, a left and right format delimiter
  915. * as regex patterns, and optional regex flags. Returns an array
  916. * of matches, allowing nested instances of left/right delimiters.
  917. * Use the "g" flag to return all matches, otherwise only the
  918. * first is returned. Be careful to ensure that the left and
  919. * right format delimiters produce mutually exclusive matches.
  920. * Backreferences are not supported within the right delimiter
  921. * due to how it is internally combined with the left delimiter.
  922. * When matching strings whose format delimiters are unbalanced
  923. * to the left or right, the output is intentionally as a
  924. * conventional regex library with recursion support would
  925. * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
  926. * "<" and ">" as the delimiters (both strings contain a single,
  927. * balanced instance of "<x>").
  928. *
  929. * examples:
  930. * matchRecursiveRegExp("test", "\\(", "\\)")
  931. * returns: []
  932. * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
  933. * returns: ["t<<e>><s>", ""]
  934. * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
  935. * returns: ["test"]
  936. */
  937. showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
  938. 'use strict';
  939. var matchPos = rgxFindMatchPos (str, left, right, flags),
  940. results = [];
  941. for (var i = 0; i < matchPos.length; ++i) {
  942. results.push([
  943. str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
  944. str.slice(matchPos[i].match.start, matchPos[i].match.end),
  945. str.slice(matchPos[i].left.start, matchPos[i].left.end),
  946. str.slice(matchPos[i].right.start, matchPos[i].right.end)
  947. ]);
  948. }
  949. return results;
  950. };
  951. /**
  952. *
  953. * @param {string} str
  954. * @param {string|function} replacement
  955. * @param {string} left
  956. * @param {string} right
  957. * @param {string} flags
  958. * @returns {string}
  959. */
  960. showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
  961. 'use strict';
  962. if (!showdown.helper.isFunction(replacement)) {
  963. var repStr = replacement;
  964. replacement = function () {
  965. return repStr;
  966. };
  967. }
  968. var matchPos = rgxFindMatchPos(str, left, right, flags),
  969. finalStr = str,
  970. lng = matchPos.length;
  971. if (lng > 0) {
  972. var bits = [];
  973. if (matchPos[0].wholeMatch.start !== 0) {
  974. bits.push(str.slice(0, matchPos[0].wholeMatch.start));
  975. }
  976. for (var i = 0; i < lng; ++i) {
  977. bits.push(
  978. replacement(
  979. str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
  980. str.slice(matchPos[i].match.start, matchPos[i].match.end),
  981. str.slice(matchPos[i].left.start, matchPos[i].left.end),
  982. str.slice(matchPos[i].right.start, matchPos[i].right.end)
  983. )
  984. );
  985. if (i < lng - 1) {
  986. bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
  987. }
  988. }
  989. if (matchPos[lng - 1].wholeMatch.end < str.length) {
  990. bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
  991. }
  992. finalStr = bits.join('');
  993. }
  994. return finalStr;
  995. };
  996. /**
  997. * Returns the index within the passed String object of the first occurrence of the specified regex,
  998. * starting the search at fromIndex. Returns -1 if the value is not found.
  999. *
  1000. * @param {string} str string to search
  1001. * @param {RegExp} regex Regular expression to search
  1002. * @param {int} [fromIndex = 0] Index to start the search
  1003. * @returns {Number}
  1004. * @throws InvalidArgumentError
  1005. */
  1006. showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
  1007. 'use strict';
  1008. if (!showdown.helper.isString(str)) {
  1009. throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
  1010. }
  1011. if (regex instanceof RegExp === false) {
  1012. throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
  1013. }
  1014. var indexOf = str.substring(fromIndex || 0).search(regex);
  1015. return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
  1016. };
  1017. /**
  1018. * Splits the passed string object at the defined index, and returns an array composed of the two substrings
  1019. * @param {string} str string to split
  1020. * @param {int} index index to split string at
  1021. * @returns {[string,string]}
  1022. * @throws InvalidArgumentError
  1023. */
  1024. showdown.helper.splitAtIndex = function (str, index) {
  1025. 'use strict';
  1026. if (!showdown.helper.isString(str)) {
  1027. throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
  1028. }
  1029. return [str.substring(0, index), str.substring(index)];
  1030. };
  1031. /**
  1032. * Obfuscate an e-mail address through the use of Character Entities,
  1033. * transforming ASCII characters into their equivalent decimal or hex entities.
  1034. *
  1035. * Since it has a random component, subsequent calls to this function produce different results
  1036. *
  1037. * @param {string} mail
  1038. * @returns {string}
  1039. */
  1040. showdown.helper.encodeEmailAddress = function (mail) {
  1041. 'use strict';
  1042. var encode = [
  1043. function (ch) {
  1044. return '&#' + ch.charCodeAt(0) + ';';
  1045. },
  1046. function (ch) {
  1047. return '&#x' + ch.charCodeAt(0).toString(16) + ';';
  1048. },
  1049. function (ch) {
  1050. return ch;
  1051. }
  1052. ];
  1053. mail = mail.replace(/./g, function (ch) {
  1054. if (ch === '@') {
  1055. // this *must* be encoded. I insist.
  1056. ch = encode[Math.floor(Math.random() * 2)](ch);
  1057. } else {
  1058. var r = Math.random();
  1059. // roughly 10% raw, 45% hex, 45% dec
  1060. ch = (
  1061. r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
  1062. );
  1063. }
  1064. return ch;
  1065. });
  1066. return mail;
  1067. };
  1068. /**
  1069. *
  1070. * @param str
  1071. * @param targetLength
  1072. * @param padString
  1073. * @returns {string}
  1074. */
  1075. showdown.helper.padEnd = function padEnd (str, targetLength, padString) {
  1076. 'use strict';
  1077. /*jshint bitwise: false*/
  1078. // eslint-disable-next-line space-infix-ops
  1079. targetLength = targetLength>>0; //floor if number or convert non-number to 0;
  1080. /*jshint bitwise: true*/
  1081. padString = String(padString || ' ');
  1082. if (str.length > targetLength) {
  1083. return String(str);
  1084. } else {
  1085. targetLength = targetLength - str.length;
  1086. if (targetLength > padString.length) {
  1087. padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
  1088. }
  1089. return String(str) + padString.slice(0,targetLength);
  1090. }
  1091. };
  1092. /**
  1093. * POLYFILLS
  1094. */
  1095. // use this instead of builtin is undefined for IE8 compatibility
  1096. if (typeof(console) === 'undefined') {
  1097. console = {
  1098. warn: function (msg) {
  1099. 'use strict';
  1100. alert(msg);
  1101. },
  1102. log: function (msg) {
  1103. 'use strict';
  1104. alert(msg);
  1105. },
  1106. error: function (msg) {
  1107. 'use strict';
  1108. throw msg;
  1109. }
  1110. };
  1111. }
  1112. /**
  1113. * Common regexes.
  1114. * We declare some common regexes to improve performance
  1115. */
  1116. showdown.helper.regexes = {
  1117. asteriskDashAndColon: /([*_:~])/g
  1118. };
  1119. /**
  1120. * EMOJIS LIST
  1121. */
  1122. showdown.helper.emojis = {
  1123. '+1':'\ud83d\udc4d',
  1124. '-1':'\ud83d\udc4e',
  1125. '100':'\ud83d\udcaf',
  1126. '1234':'\ud83d\udd22',
  1127. '1st_place_medal':'\ud83e\udd47',
  1128. '2nd_place_medal':'\ud83e\udd48',
  1129. '3rd_place_medal':'\ud83e\udd49',
  1130. '8ball':'\ud83c\udfb1',
  1131. 'a':'\ud83c\udd70\ufe0f',
  1132. 'ab':'\ud83c\udd8e',
  1133. 'abc':'\ud83d\udd24',
  1134. 'abcd':'\ud83d\udd21',
  1135. 'accept':'\ud83c\ude51',
  1136. 'aerial_tramway':'\ud83d\udea1',
  1137. 'airplane':'\u2708\ufe0f',
  1138. 'alarm_clock':'\u23f0',
  1139. 'alembic':'\u2697\ufe0f',
  1140. 'alien':'\ud83d\udc7d',
  1141. 'ambulance':'\ud83d\ude91',
  1142. 'amphora':'\ud83c\udffa',
  1143. 'anchor':'\u2693\ufe0f',
  1144. 'angel':'\ud83d\udc7c',
  1145. 'anger':'\ud83d\udca2',
  1146. 'angry':'\ud83d\ude20',
  1147. 'anguished':'\ud83d\ude27',
  1148. 'ant':'\ud83d\udc1c',
  1149. 'apple':'\ud83c\udf4e',
  1150. 'aquarius':'\u2652\ufe0f',
  1151. 'aries':'\u2648\ufe0f',
  1152. 'arrow_backward':'\u25c0\ufe0f',
  1153. 'arrow_double_down':'\u23ec',
  1154. 'arrow_double_up':'\u23eb',
  1155. 'arrow_down':'\u2b07\ufe0f',
  1156. 'arrow_down_small':'\ud83d\udd3d',
  1157. 'arrow_forward':'\u25b6\ufe0f',
  1158. 'arrow_heading_down':'\u2935\ufe0f',
  1159. 'arrow_heading_up':'\u2934\ufe0f',
  1160. 'arrow_left':'\u2b05\ufe0f',
  1161. 'arrow_lower_left':'\u2199\ufe0f',
  1162. 'arrow_lower_right':'\u2198\ufe0f',
  1163. 'arrow_right':'\u27a1\ufe0f',
  1164. 'arrow_right_hook':'\u21aa\ufe0f',
  1165. 'arrow_up':'\u2b06\ufe0f',
  1166. 'arrow_up_down':'\u2195\ufe0f',
  1167. 'arrow_up_small':'\ud83d\udd3c',
  1168. 'arrow_upper_left':'\u2196\ufe0f',
  1169. 'arrow_upper_right':'\u2197\ufe0f',
  1170. 'arrows_clockwise':'\ud83d\udd03',
  1171. 'arrows_counterclockwise':'\ud83d\udd04',
  1172. 'art':'\ud83c\udfa8',
  1173. 'articulated_lorry':'\ud83d\ude9b',
  1174. 'artificial_satellite':'\ud83d\udef0',
  1175. 'astonished':'\ud83d\ude32',
  1176. 'athletic_shoe':'\ud83d\udc5f',
  1177. 'atm':'\ud83c\udfe7',
  1178. 'atom_symbol':'\u269b\ufe0f',
  1179. 'avocado':'\ud83e\udd51',
  1180. 'b':'\ud83c\udd71\ufe0f',
  1181. 'baby':'\ud83d\udc76',
  1182. 'baby_bottle':'\ud83c\udf7c',
  1183. 'baby_chick':'\ud83d\udc24',
  1184. 'baby_symbol':'\ud83d\udebc',
  1185. 'back':'\ud83d\udd19',
  1186. 'bacon':'\ud83e\udd53',
  1187. 'badminton':'\ud83c\udff8',
  1188. 'baggage_claim':'\ud83d\udec4',
  1189. 'baguette_bread':'\ud83e\udd56',
  1190. 'balance_scale':'\u2696\ufe0f',
  1191. 'balloon':'\ud83c\udf88',
  1192. 'ballot_box':'\ud83d\uddf3',
  1193. 'ballot_box_with_check':'\u2611\ufe0f',
  1194. 'bamboo':'\ud83c\udf8d',
  1195. 'banana':'\ud83c\udf4c',
  1196. 'bangbang':'\u203c\ufe0f',
  1197. 'bank':'\ud83c\udfe6',
  1198. 'bar_chart':'\ud83d\udcca',
  1199. 'barber':'\ud83d\udc88',
  1200. 'baseball':'\u26be\ufe0f',
  1201. 'basketball':'\ud83c\udfc0',
  1202. 'basketball_man':'\u26f9\ufe0f',
  1203. 'basketball_woman':'\u26f9\ufe0f&zwj;\u2640\ufe0f',
  1204. 'bat':'\ud83e\udd87',
  1205. 'bath':'\ud83d\udec0',
  1206. 'bathtub':'\ud83d\udec1',
  1207. 'battery':'\ud83d\udd0b',
  1208. 'beach_umbrella':'\ud83c\udfd6',
  1209. 'bear':'\ud83d\udc3b',
  1210. 'bed':'\ud83d\udecf',
  1211. 'bee':'\ud83d\udc1d',
  1212. 'beer':'\ud83c\udf7a',
  1213. 'beers':'\ud83c\udf7b',
  1214. 'beetle':'\ud83d\udc1e',
  1215. 'beginner':'\ud83d\udd30',
  1216. 'bell':'\ud83d\udd14',
  1217. 'bellhop_bell':'\ud83d\udece',
  1218. 'bento':'\ud83c\udf71',
  1219. 'biking_man':'\ud83d\udeb4',
  1220. 'bike':'\ud83d\udeb2',
  1221. 'biking_woman':'\ud83d\udeb4&zwj;\u2640\ufe0f',
  1222. 'bikini':'\ud83d\udc59',
  1223. 'biohazard':'\u2623\ufe0f',
  1224. 'bird':'\ud83d\udc26',
  1225. 'birthday':'\ud83c\udf82',
  1226. 'black_circle':'\u26ab\ufe0f',
  1227. 'black_flag':'\ud83c\udff4',
  1228. 'black_heart':'\ud83d\udda4',
  1229. 'black_joker':'\ud83c\udccf',
  1230. 'black_large_square':'\u2b1b\ufe0f',
  1231. 'black_medium_small_square':'\u25fe\ufe0f',
  1232. 'black_medium_square':'\u25fc\ufe0f',
  1233. 'black_nib':'\u2712\ufe0f',
  1234. 'black_small_square':'\u25aa\ufe0f',
  1235. 'black_square_button':'\ud83d\udd32',
  1236. 'blonde_man':'\ud83d\udc71',
  1237. 'blonde_woman':'\ud83d\udc71&zwj;\u2640\ufe0f',
  1238. 'blossom':'\ud83c\udf3c',
  1239. 'blowfish':'\ud83d\udc21',
  1240. 'blue_book':'\ud83d\udcd8',
  1241. 'blue_car':'\ud83d\ude99',
  1242. 'blue_heart':'\ud83d\udc99',
  1243. 'blush':'\ud83d\ude0a',
  1244. 'boar':'\ud83d\udc17',
  1245. 'boat':'\u26f5\ufe0f',
  1246. 'bomb':'\ud83d\udca3',
  1247. 'book':'\ud83d\udcd6',
  1248. 'bookmark':'\ud83d\udd16',
  1249. 'bookmark_tabs':'\ud83d\udcd1',
  1250. 'books':'\ud83d\udcda',
  1251. 'boom':'\ud83d\udca5',
  1252. 'boot':'\ud83d\udc62',
  1253. 'bouquet':'\ud83d\udc90',
  1254. 'bowing_man':'\ud83d\ude47',
  1255. 'bow_and_arrow':'\ud83c\udff9',
  1256. 'bowing_woman':'\ud83d\ude47&zwj;\u2640\ufe0f',
  1257. 'bowling':'\ud83c\udfb3',
  1258. 'boxing_glove':'\ud83e\udd4a',
  1259. 'boy':'\ud83d\udc66',
  1260. 'bread':'\ud83c\udf5e',
  1261. 'bride_with_veil':'\ud83d\udc70',
  1262. 'bridge_at_night':'\ud83c\udf09',
  1263. 'briefcase':'\ud83d\udcbc',
  1264. 'broken_heart':'\ud83d\udc94',
  1265. 'bug':'\ud83d\udc1b',
  1266. 'building_construction':'\ud83c\udfd7',
  1267. 'bulb':'\ud83d\udca1',
  1268. 'bullettrain_front':'\ud83d\ude85',
  1269. 'bullettrain_side':'\ud83d\ude84',
  1270. 'burrito':'\ud83c\udf2f',
  1271. 'bus':'\ud83d\ude8c',
  1272. 'business_suit_levitating':'\ud83d\udd74',
  1273. 'busstop':'\ud83d\ude8f',
  1274. 'bust_in_silhouette':'\ud83d\udc64',
  1275. 'busts_in_silhouette':'\ud83d\udc65',
  1276. 'butterfly':'\ud83e\udd8b',
  1277. 'cactus':'\ud83c\udf35',
  1278. 'cake':'\ud83c\udf70',
  1279. 'calendar':'\ud83d\udcc6',
  1280. 'call_me_hand':'\ud83e\udd19',
  1281. 'calling':'\ud83d\udcf2',
  1282. 'camel':'\ud83d\udc2b',
  1283. 'camera':'\ud83d\udcf7',
  1284. 'camera_flash':'\ud83d\udcf8',
  1285. 'camping':'\ud83c\udfd5',
  1286. 'cancer':'\u264b\ufe0f',
  1287. 'candle':'\ud83d\udd6f',
  1288. 'candy':'\ud83c\udf6c',
  1289. 'canoe':'\ud83d\udef6',
  1290. 'capital_abcd':'\ud83d\udd20',
  1291. 'capricorn':'\u2651\ufe0f',
  1292. 'car':'\ud83d\ude97',
  1293. 'card_file_box':'\ud83d\uddc3',
  1294. 'card_index':'\ud83d\udcc7',
  1295. 'card_index_dividers':'\ud83d\uddc2',
  1296. 'carousel_horse':'\ud83c\udfa0',
  1297. 'carrot':'\ud83e\udd55',
  1298. 'cat':'\ud83d\udc31',
  1299. 'cat2':'\ud83d\udc08',
  1300. 'cd':'\ud83d\udcbf',
  1301. 'chains':'\u26d3',
  1302. 'champagne':'\ud83c\udf7e',
  1303. 'chart':'\ud83d\udcb9',
  1304. 'chart_with_downwards_trend':'\ud83d\udcc9',
  1305. 'chart_with_upwards_trend':'\ud83d\udcc8',
  1306. 'checkered_flag':'\ud83c\udfc1',
  1307. 'cheese':'\ud83e\uddc0',
  1308. 'cherries':'\ud83c\udf52',
  1309. 'cherry_blossom':'\ud83c\udf38',
  1310. 'chestnut':'\ud83c\udf30',
  1311. 'chicken':'\ud83d\udc14',
  1312. 'children_crossing':'\ud83d\udeb8',
  1313. 'chipmunk':'\ud83d\udc3f',
  1314. 'chocolate_bar':'\ud83c\udf6b',
  1315. 'christmas_tree':'\ud83c\udf84',
  1316. 'church':'\u26ea\ufe0f',
  1317. 'cinema':'\ud83c\udfa6',
  1318. 'circus_tent':'\ud83c\udfaa',
  1319. 'city_sunrise':'\ud83c\udf07',
  1320. 'city_sunset':'\ud83c\udf06',
  1321. 'cityscape':'\ud83c\udfd9',
  1322. 'cl':'\ud83c\udd91',
  1323. 'clamp':'\ud83d\udddc',
  1324. 'clap':'\ud83d\udc4f',
  1325. 'clapper':'\ud83c\udfac',
  1326. 'classical_building':'\ud83c\udfdb',
  1327. 'clinking_glasses':'\ud83e\udd42',
  1328. 'clipboard':'\ud83d\udccb',
  1329. 'clock1':'\ud83d\udd50',
  1330. 'clock10':'\ud83d\udd59',
  1331. 'clock1030':'\ud83d\udd65',
  1332. 'clock11':'\ud83d\udd5a',
  1333. 'clock1130':'\ud83d\udd66',
  1334. 'clock12':'\ud83d\udd5b',
  1335. 'clock1230':'\ud83d\udd67',
  1336. 'clock130':'\ud83d\udd5c',
  1337. 'clock2':'\ud83d\udd51',
  1338. 'clock230':'\ud83d\udd5d',
  1339. 'clock3':'\ud83d\udd52',
  1340. 'clock330':'\ud83d\udd5e',
  1341. 'clock4':'\ud83d\udd53',
  1342. 'clock430':'\ud83d\udd5f',
  1343. 'clock5':'\ud83d\udd54',
  1344. 'clock530':'\ud83d\udd60',
  1345. 'clock6':'\ud83d\udd55',
  1346. 'clock630':'\ud83d\udd61',
  1347. 'clock7':'\ud83d\udd56',
  1348. 'clock730':'\ud83d\udd62',
  1349. 'clock8':'\ud83d\udd57',
  1350. 'clock830':'\ud83d\udd63',
  1351. 'clock9':'\ud83d\udd58',
  1352. 'clock930':'\ud83d\udd64',
  1353. 'closed_book':'\ud83d\udcd5',
  1354. 'closed_lock_with_key':'\ud83d\udd10',
  1355. 'closed_umbrella':'\ud83c\udf02',
  1356. 'cloud':'\u2601\ufe0f',
  1357. 'cloud_with_lightning':'\ud83c\udf29',
  1358. 'cloud_with_lightning_and_rain':'\u26c8',
  1359. 'cloud_with_rain':'\ud83c\udf27',
  1360. 'cloud_with_snow':'\ud83c\udf28',
  1361. 'clown_face':'\ud83e\udd21',
  1362. 'clubs':'\u2663\ufe0f',
  1363. 'cocktail':'\ud83c\udf78',
  1364. 'coffee':'\u2615\ufe0f',
  1365. 'coffin':'\u26b0\ufe0f',
  1366. 'cold_sweat':'\ud83d\ude30',
  1367. 'comet':'\u2604\ufe0f',
  1368. 'computer':'\ud83d\udcbb',
  1369. 'computer_mouse':'\ud83d\uddb1',
  1370. 'confetti_ball':'\ud83c\udf8a',
  1371. 'confounded':'\ud83d\ude16',
  1372. 'confused':'\ud83d\ude15',
  1373. 'congratulations':'\u3297\ufe0f',
  1374. 'construction':'\ud83d\udea7',
  1375. 'construction_worker_man':'\ud83d\udc77',
  1376. 'construction_worker_woman':'\ud83d\udc77&zwj;\u2640\ufe0f',
  1377. 'control_knobs':'\ud83c\udf9b',
  1378. 'convenience_store':'\ud83c\udfea',
  1379. 'cookie':'\ud83c\udf6a',
  1380. 'cool':'\ud83c\udd92',
  1381. 'policeman':'\ud83d\udc6e',
  1382. 'copyright':'\u00a9\ufe0f',
  1383. 'corn':'\ud83c\udf3d',
  1384. 'couch_and_lamp':'\ud83d\udecb',
  1385. 'couple':'\ud83d\udc6b',
  1386. 'couple_with_heart_woman_man':'\ud83d\udc91',
  1387. 'couple_with_heart_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc68',
  1388. 'couple_with_heart_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc69',
  1389. 'couplekiss_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc68',
  1390. 'couplekiss_man_woman':'\ud83d\udc8f',
  1391. 'couplekiss_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc69',
  1392. 'cow':'\ud83d\udc2e',
  1393. 'cow2':'\ud83d\udc04',
  1394. 'cowboy_hat_face':'\ud83e\udd20',
  1395. 'crab':'\ud83e\udd80',
  1396. 'crayon':'\ud83d\udd8d',
  1397. 'credit_card':'\ud83d\udcb3',
  1398. 'crescent_moon':'\ud83c\udf19',
  1399. 'cricket':'\ud83c\udfcf',
  1400. 'crocodile':'\ud83d\udc0a',
  1401. 'croissant':'\ud83e\udd50',
  1402. 'crossed_fingers':'\ud83e\udd1e',
  1403. 'crossed_flags':'\ud83c\udf8c',
  1404. 'crossed_swords':'\u2694\ufe0f',
  1405. 'crown':'\ud83d\udc51',
  1406. 'cry':'\ud83d\ude22',
  1407. 'crying_cat_face':'\ud83d\ude3f',
  1408. 'crystal_ball':'\ud83d\udd2e',
  1409. 'cucumber':'\ud83e\udd52',
  1410. 'cupid':'\ud83d\udc98',
  1411. 'curly_loop':'\u27b0',
  1412. 'currency_exchange':'\ud83d\udcb1',
  1413. 'curry':'\ud83c\udf5b',
  1414. 'custard':'\ud83c\udf6e',
  1415. 'customs':'\ud83d\udec3',
  1416. 'cyclone':'\ud83c\udf00',
  1417. 'dagger':'\ud83d\udde1',
  1418. 'dancer':'\ud83d\udc83',
  1419. 'dancing_women':'\ud83d\udc6f',
  1420. 'dancing_men':'\ud83d\udc6f&zwj;\u2642\ufe0f',
  1421. 'dango':'\ud83c\udf61',
  1422. 'dark_sunglasses':'\ud83d\udd76',
  1423. 'dart':'\ud83c\udfaf',
  1424. 'dash':'\ud83d\udca8',
  1425. 'date':'\ud83d\udcc5',
  1426. 'deciduous_tree':'\ud83c\udf33',
  1427. 'deer':'\ud83e\udd8c',
  1428. 'department_store':'\ud83c\udfec',
  1429. 'derelict_house':'\ud83c\udfda',
  1430. 'desert':'\ud83c\udfdc',
  1431. 'desert_island':'\ud83c\udfdd',
  1432. 'desktop_computer':'\ud83d\udda5',
  1433. 'male_detective':'\ud83d\udd75\ufe0f',
  1434. 'diamond_shape_with_a_dot_inside':'\ud83d\udca0',
  1435. 'diamonds':'\u2666\ufe0f',
  1436. 'disappointed':'\ud83d\ude1e',
  1437. 'disappointed_relieved':'\ud83d\ude25',
  1438. 'dizzy':'\ud83d\udcab',
  1439. 'dizzy_face':'\ud83d\ude35',
  1440. 'do_not_litter':'\ud83d\udeaf',
  1441. 'dog':'\ud83d\udc36',
  1442. 'dog2':'\ud83d\udc15',
  1443. 'dollar':'\ud83d\udcb5',
  1444. 'dolls':'\ud83c\udf8e',
  1445. 'dolphin':'\ud83d\udc2c',
  1446. 'door':'\ud83d\udeaa',
  1447. 'doughnut':'\ud83c\udf69',
  1448. 'dove':'\ud83d\udd4a',
  1449. 'dragon':'\ud83d\udc09',
  1450. 'dragon_face':'\ud83d\udc32',
  1451. 'dress':'\ud83d\udc57',
  1452. 'dromedary_camel':'\ud83d\udc2a',
  1453. 'drooling_face':'\ud83e\udd24',
  1454. 'droplet':'\ud83d\udca7',
  1455. 'drum':'\ud83e\udd41',
  1456. 'duck':'\ud83e\udd86',
  1457. 'dvd':'\ud83d\udcc0',
  1458. 'e-mail':'\ud83d\udce7',
  1459. 'eagle':'\ud83e\udd85',
  1460. 'ear':'\ud83d\udc42',
  1461. 'ear_of_rice':'\ud83c\udf3e',
  1462. 'earth_africa':'\ud83c\udf0d',
  1463. 'earth_americas':'\ud83c\udf0e',
  1464. 'earth_asia':'\ud83c\udf0f',
  1465. 'egg':'\ud83e\udd5a',
  1466. 'eggplant':'\ud83c\udf46',
  1467. 'eight_pointed_black_star':'\u2734\ufe0f',
  1468. 'eight_spoked_asterisk':'\u2733\ufe0f',
  1469. 'electric_plug':'\ud83d\udd0c',
  1470. 'elephant':'\ud83d\udc18',
  1471. 'email':'\u2709\ufe0f',
  1472. 'end':'\ud83d\udd1a',
  1473. 'envelope_with_arrow':'\ud83d\udce9',
  1474. 'euro':'\ud83d\udcb6',
  1475. 'european_castle':'\ud83c\udff0',
  1476. 'european_post_office':'\ud83c\udfe4',
  1477. 'evergreen_tree':'\ud83c\udf32',
  1478. 'exclamation':'\u2757\ufe0f',
  1479. 'expressionless':'\ud83d\ude11',
  1480. 'eye':'\ud83d\udc41',
  1481. 'eye_speech_bubble':'\ud83d\udc41&zwj;\ud83d\udde8',
  1482. 'eyeglasses':'\ud83d\udc53',
  1483. 'eyes':'\ud83d\udc40',
  1484. 'face_with_head_bandage':'\ud83e\udd15',
  1485. 'face_with_thermometer':'\ud83e\udd12',
  1486. 'fist_oncoming':'\ud83d\udc4a',
  1487. 'factory':'\ud83c\udfed',
  1488. 'fallen_leaf':'\ud83c\udf42',
  1489. 'family_man_woman_boy':'\ud83d\udc6a',
  1490. 'family_man_boy':'\ud83d\udc68&zwj;\ud83d\udc66',
  1491. 'family_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1492. 'family_man_girl':'\ud83d\udc68&zwj;\ud83d\udc67',
  1493. 'family_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1494. 'family_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1495. 'family_man_man_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66',
  1496. 'family_man_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1497. 'family_man_man_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67',
  1498. 'family_man_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1499. 'family_man_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1500. 'family_man_woman_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1501. 'family_man_woman_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
  1502. 'family_man_woman_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1503. 'family_man_woman_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1504. 'family_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc66',
  1505. 'family_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1506. 'family_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc67',
  1507. 'family_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1508. 'family_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1509. 'family_woman_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66',
  1510. 'family_woman_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1511. 'family_woman_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
  1512. 'family_woman_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1513. 'family_woman_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1514. 'fast_forward':'\u23e9',
  1515. 'fax':'\ud83d\udce0',
  1516. 'fearful':'\ud83d\ude28',
  1517. 'feet':'\ud83d\udc3e',
  1518. 'female_detective':'\ud83d\udd75\ufe0f&zwj;\u2640\ufe0f',
  1519. 'ferris_wheel':'\ud83c\udfa1',
  1520. 'ferry':'\u26f4',
  1521. 'field_hockey':'\ud83c\udfd1',
  1522. 'file_cabinet':'\ud83d\uddc4',
  1523. 'file_folder':'\ud83d\udcc1',
  1524. 'film_projector':'\ud83d\udcfd',
  1525. 'film_strip':'\ud83c\udf9e',
  1526. 'fire':'\ud83d\udd25',
  1527. 'fire_engine':'\ud83d\ude92',
  1528. 'fireworks':'\ud83c\udf86',
  1529. 'first_quarter_moon':'\ud83c\udf13',
  1530. 'first_quarter_moon_with_face':'\ud83c\udf1b',
  1531. 'fish':'\ud83d\udc1f',
  1532. 'fish_cake':'\ud83c\udf65',
  1533. 'fishing_pole_and_fish':'\ud83c\udfa3',
  1534. 'fist_raised':'\u270a',
  1535. 'fist_left':'\ud83e\udd1b',
  1536. 'fist_right':'\ud83e\udd1c',
  1537. 'flags':'\ud83c\udf8f',
  1538. 'flashlight':'\ud83d\udd26',
  1539. 'fleur_de_lis':'\u269c\ufe0f',
  1540. 'flight_arrival':'\ud83d\udeec',
  1541. 'flight_departure':'\ud83d\udeeb',
  1542. 'floppy_disk':'\ud83d\udcbe',
  1543. 'flower_playing_cards':'\ud83c\udfb4',
  1544. 'flushed':'\ud83d\ude33',
  1545. 'fog':'\ud83c\udf2b',
  1546. 'foggy':'\ud83c\udf01',
  1547. 'football':'\ud83c\udfc8',
  1548. 'footprints':'\ud83d\udc63',
  1549. 'fork_and_knife':'\ud83c\udf74',
  1550. 'fountain':'\u26f2\ufe0f',
  1551. 'fountain_pen':'\ud83d\udd8b',
  1552. 'four_leaf_clover':'\ud83c\udf40',
  1553. 'fox_face':'\ud83e\udd8a',
  1554. 'framed_picture':'\ud83d\uddbc',
  1555. 'free':'\ud83c\udd93',
  1556. 'fried_egg':'\ud83c\udf73',
  1557. 'fried_shrimp':'\ud83c\udf64',
  1558. 'fries':'\ud83c\udf5f',
  1559. 'frog':'\ud83d\udc38',
  1560. 'frowning':'\ud83d\ude26',
  1561. 'frowning_face':'\u2639\ufe0f',
  1562. 'frowning_man':'\ud83d\ude4d&zwj;\u2642\ufe0f',
  1563. 'frowning_woman':'\ud83d\ude4d',
  1564. 'middle_finger':'\ud83d\udd95',
  1565. 'fuelpump':'\u26fd\ufe0f',
  1566. 'full_moon':'\ud83c\udf15',
  1567. 'full_moon_with_face':'\ud83c\udf1d',
  1568. 'funeral_urn':'\u26b1\ufe0f',
  1569. 'game_die':'\ud83c\udfb2',
  1570. 'gear':'\u2699\ufe0f',
  1571. 'gem':'\ud83d\udc8e',
  1572. 'gemini':'\u264a\ufe0f',
  1573. 'ghost':'\ud83d\udc7b',
  1574. 'gift':'\ud83c\udf81',
  1575. 'gift_heart':'\ud83d\udc9d',
  1576. 'girl':'\ud83d\udc67',
  1577. 'globe_with_meridians':'\ud83c\udf10',
  1578. 'goal_net':'\ud83e\udd45',
  1579. 'goat':'\ud83d\udc10',
  1580. 'golf':'\u26f3\ufe0f',
  1581. 'golfing_man':'\ud83c\udfcc\ufe0f',
  1582. 'golfing_woman':'\ud83c\udfcc\ufe0f&zwj;\u2640\ufe0f',
  1583. 'gorilla':'\ud83e\udd8d',
  1584. 'grapes':'\ud83c\udf47',
  1585. 'green_apple':'\ud83c\udf4f',
  1586. 'green_book':'\ud83d\udcd7',
  1587. 'green_heart':'\ud83d\udc9a',
  1588. 'green_salad':'\ud83e\udd57',
  1589. 'grey_exclamation':'\u2755',
  1590. 'grey_question':'\u2754',
  1591. 'grimacing':'\ud83d\ude2c',
  1592. 'grin':'\ud83d\ude01',
  1593. 'grinning':'\ud83d\ude00',
  1594. 'guardsman':'\ud83d\udc82',
  1595. 'guardswoman':'\ud83d\udc82&zwj;\u2640\ufe0f',
  1596. 'guitar':'\ud83c\udfb8',
  1597. 'gun':'\ud83d\udd2b',
  1598. 'haircut_woman':'\ud83d\udc87',
  1599. 'haircut_man':'\ud83d\udc87&zwj;\u2642\ufe0f',
  1600. 'hamburger':'\ud83c\udf54',
  1601. 'hammer':'\ud83d\udd28',
  1602. 'hammer_and_pick':'\u2692',
  1603. 'hammer_and_wrench':'\ud83d\udee0',
  1604. 'hamster':'\ud83d\udc39',
  1605. 'hand':'\u270b',
  1606. 'handbag':'\ud83d\udc5c',
  1607. 'handshake':'\ud83e\udd1d',
  1608. 'hankey':'\ud83d\udca9',
  1609. 'hatched_chick':'\ud83d\udc25',
  1610. 'hatching_chick':'\ud83d\udc23',
  1611. 'headphones':'\ud83c\udfa7',
  1612. 'hear_no_evil':'\ud83d\ude49',
  1613. 'heart':'\u2764\ufe0f',
  1614. 'heart_decoration':'\ud83d\udc9f',
  1615. 'heart_eyes':'\ud83d\ude0d',
  1616. 'heart_eyes_cat':'\ud83d\ude3b',
  1617. 'heartbeat':'\ud83d\udc93',
  1618. 'heartpulse':'\ud83d\udc97',
  1619. 'hearts':'\u2665\ufe0f',
  1620. 'heavy_check_mark':'\u2714\ufe0f',
  1621. 'heavy_division_sign':'\u2797',
  1622. 'heavy_dollar_sign':'\ud83d\udcb2',
  1623. 'heavy_heart_exclamation':'\u2763\ufe0f',
  1624. 'heavy_minus_sign':'\u2796',
  1625. 'heavy_multiplication_x':'\u2716\ufe0f',
  1626. 'heavy_plus_sign':'\u2795',
  1627. 'helicopter':'\ud83d\ude81',
  1628. 'herb':'\ud83c\udf3f',
  1629. 'hibiscus':'\ud83c\udf3a',
  1630. 'high_brightness':'\ud83d\udd06',
  1631. 'high_heel':'\ud83d\udc60',
  1632. 'hocho':'\ud83d\udd2a',
  1633. 'hole':'\ud83d\udd73',
  1634. 'honey_pot':'\ud83c\udf6f',
  1635. 'horse':'\ud83d\udc34',
  1636. 'horse_racing':'\ud83c\udfc7',
  1637. 'hospital':'\ud83c\udfe5',
  1638. 'hot_pepper':'\ud83c\udf36',
  1639. 'hotdog':'\ud83c\udf2d',
  1640. 'hotel':'\ud83c\udfe8',
  1641. 'hotsprings':'\u2668\ufe0f',
  1642. 'hourglass':'\u231b\ufe0f',
  1643. 'hourglass_flowing_sand':'\u23f3',
  1644. 'house':'\ud83c\udfe0',
  1645. 'house_with_garden':'\ud83c\udfe1',
  1646. 'houses':'\ud83c\udfd8',
  1647. 'hugs':'\ud83e\udd17',
  1648. 'hushed':'\ud83d\ude2f',
  1649. 'ice_cream':'\ud83c\udf68',
  1650. 'ice_hockey':'\ud83c\udfd2',
  1651. 'ice_skate':'\u26f8',
  1652. 'icecream':'\ud83c\udf66',
  1653. 'id':'\ud83c\udd94',
  1654. 'ideograph_advantage':'\ud83c\ude50',
  1655. 'imp':'\ud83d\udc7f',
  1656. 'inbox_tray':'\ud83d\udce5',
  1657. 'incoming_envelope':'\ud83d\udce8',
  1658. 'tipping_hand_woman':'\ud83d\udc81',
  1659. 'information_source':'\u2139\ufe0f',
  1660. 'innocent':'\ud83d\ude07',
  1661. 'interrobang':'\u2049\ufe0f',
  1662. 'iphone':'\ud83d\udcf1',
  1663. 'izakaya_lantern':'\ud83c\udfee',
  1664. 'jack_o_lantern':'\ud83c\udf83',
  1665. 'japan':'\ud83d\uddfe',
  1666. 'japanese_castle':'\ud83c\udfef',
  1667. 'japanese_goblin':'\ud83d\udc7a',
  1668. 'japanese_ogre':'\ud83d\udc79',
  1669. 'jeans':'\ud83d\udc56',
  1670. 'joy':'\ud83d\ude02',
  1671. 'joy_cat':'\ud83d\ude39',
  1672. 'joystick':'\ud83d\udd79',
  1673. 'kaaba':'\ud83d\udd4b',
  1674. 'key':'\ud83d\udd11',
  1675. 'keyboard':'\u2328\ufe0f',
  1676. 'keycap_ten':'\ud83d\udd1f',
  1677. 'kick_scooter':'\ud83d\udef4',
  1678. 'kimono':'\ud83d\udc58',
  1679. 'kiss':'\ud83d\udc8b',
  1680. 'kissing':'\ud83d\ude17',
  1681. 'kissing_cat':'\ud83d\ude3d',
  1682. 'kissing_closed_eyes':'\ud83d\ude1a',
  1683. 'kissing_heart':'\ud83d\ude18',
  1684. 'kissing_smiling_eyes':'\ud83d\ude19',
  1685. 'kiwi_fruit':'\ud83e\udd5d',
  1686. 'koala':'\ud83d\udc28',
  1687. 'koko':'\ud83c\ude01',
  1688. 'label':'\ud83c\udff7',
  1689. 'large_blue_circle':'\ud83d\udd35',
  1690. 'large_blue_diamond':'\ud83d\udd37',
  1691. 'large_orange_diamond':'\ud83d\udd36',
  1692. 'last_quarter_moon':'\ud83c\udf17',
  1693. 'last_quarter_moon_with_face':'\ud83c\udf1c',
  1694. 'latin_cross':'\u271d\ufe0f',
  1695. 'laughing':'\ud83d\ude06',
  1696. 'leaves':'\ud83c\udf43',
  1697. 'ledger':'\ud83d\udcd2',
  1698. 'left_luggage':'\ud83d\udec5',
  1699. 'left_right_arrow':'\u2194\ufe0f',
  1700. 'leftwards_arrow_with_hook':'\u21a9\ufe0f',
  1701. 'lemon':'\ud83c\udf4b',
  1702. 'leo':'\u264c\ufe0f',
  1703. 'leopard':'\ud83d\udc06',
  1704. 'level_slider':'\ud83c\udf9a',
  1705. 'libra':'\u264e\ufe0f',
  1706. 'light_rail':'\ud83d\ude88',
  1707. 'link':'\ud83d\udd17',
  1708. 'lion':'\ud83e\udd81',
  1709. 'lips':'\ud83d\udc44',
  1710. 'lipstick':'\ud83d\udc84',
  1711. 'lizard':'\ud83e\udd8e',
  1712. 'lock':'\ud83d\udd12',
  1713. 'lock_with_ink_pen':'\ud83d\udd0f',
  1714. 'lollipop':'\ud83c\udf6d',
  1715. 'loop':'\u27bf',
  1716. 'loud_sound':'\ud83d\udd0a',
  1717. 'loudspeaker':'\ud83d\udce2',
  1718. 'love_hotel':'\ud83c\udfe9',
  1719. 'love_letter':'\ud83d\udc8c',
  1720. 'low_brightness':'\ud83d\udd05',
  1721. 'lying_face':'\ud83e\udd25',
  1722. 'm':'\u24c2\ufe0f',
  1723. 'mag':'\ud83d\udd0d',
  1724. 'mag_right':'\ud83d\udd0e',
  1725. 'mahjong':'\ud83c\udc04\ufe0f',
  1726. 'mailbox':'\ud83d\udceb',
  1727. 'mailbox_closed':'\ud83d\udcea',
  1728. 'mailbox_with_mail':'\ud83d\udcec',
  1729. 'mailbox_with_no_mail':'\ud83d\udced',
  1730. 'man':'\ud83d\udc68',
  1731. 'man_artist':'\ud83d\udc68&zwj;\ud83c\udfa8',
  1732. 'man_astronaut':'\ud83d\udc68&zwj;\ud83d\ude80',
  1733. 'man_cartwheeling':'\ud83e\udd38&zwj;\u2642\ufe0f',
  1734. 'man_cook':'\ud83d\udc68&zwj;\ud83c\udf73',
  1735. 'man_dancing':'\ud83d\udd7a',
  1736. 'man_facepalming':'\ud83e\udd26&zwj;\u2642\ufe0f',
  1737. 'man_factory_worker':'\ud83d\udc68&zwj;\ud83c\udfed',
  1738. 'man_farmer':'\ud83d\udc68&zwj;\ud83c\udf3e',
  1739. 'man_firefighter':'\ud83d\udc68&zwj;\ud83d\ude92',
  1740. 'man_health_worker':'\ud83d\udc68&zwj;\u2695\ufe0f',
  1741. 'man_in_tuxedo':'\ud83e\udd35',
  1742. 'man_judge':'\ud83d\udc68&zwj;\u2696\ufe0f',
  1743. 'man_juggling':'\ud83e\udd39&zwj;\u2642\ufe0f',
  1744. 'man_mechanic':'\ud83d\udc68&zwj;\ud83d\udd27',
  1745. 'man_office_worker':'\ud83d\udc68&zwj;\ud83d\udcbc',
  1746. 'man_pilot':'\ud83d\udc68&zwj;\u2708\ufe0f',
  1747. 'man_playing_handball':'\ud83e\udd3e&zwj;\u2642\ufe0f',
  1748. 'man_playing_water_polo':'\ud83e\udd3d&zwj;\u2642\ufe0f',
  1749. 'man_scientist':'\ud83d\udc68&zwj;\ud83d\udd2c',
  1750. 'man_shrugging':'\ud83e\udd37&zwj;\u2642\ufe0f',
  1751. 'man_singer':'\ud83d\udc68&zwj;\ud83c\udfa4',
  1752. 'man_student':'\ud83d\udc68&zwj;\ud83c\udf93',
  1753. 'man_teacher':'\ud83d\udc68&zwj;\ud83c\udfeb',
  1754. 'man_technologist':'\ud83d\udc68&zwj;\ud83d\udcbb',
  1755. 'man_with_gua_pi_mao':'\ud83d\udc72',
  1756. 'man_with_turban':'\ud83d\udc73',
  1757. 'tangerine':'\ud83c\udf4a',
  1758. 'mans_shoe':'\ud83d\udc5e',
  1759. 'mantelpiece_clock':'\ud83d\udd70',
  1760. 'maple_leaf':'\ud83c\udf41',
  1761. 'martial_arts_uniform':'\ud83e\udd4b',
  1762. 'mask':'\ud83d\ude37',
  1763. 'massage_woman':'\ud83d\udc86',
  1764. 'massage_man':'\ud83d\udc86&zwj;\u2642\ufe0f',
  1765. 'meat_on_bone':'\ud83c\udf56',
  1766. 'medal_military':'\ud83c\udf96',
  1767. 'medal_sports':'\ud83c\udfc5',
  1768. 'mega':'\ud83d\udce3',
  1769. 'melon':'\ud83c\udf48',
  1770. 'memo':'\ud83d\udcdd',
  1771. 'men_wrestling':'\ud83e\udd3c&zwj;\u2642\ufe0f',
  1772. 'menorah':'\ud83d\udd4e',
  1773. 'mens':'\ud83d\udeb9',
  1774. 'metal':'\ud83e\udd18',
  1775. 'metro':'\ud83d\ude87',
  1776. 'microphone':'\ud83c\udfa4',
  1777. 'microscope':'\ud83d\udd2c',
  1778. 'milk_glass':'\ud83e\udd5b',
  1779. 'milky_way':'\ud83c\udf0c',
  1780. 'minibus':'\ud83d\ude90',
  1781. 'minidisc':'\ud83d\udcbd',
  1782. 'mobile_phone_off':'\ud83d\udcf4',
  1783. 'money_mouth_face':'\ud83e\udd11',
  1784. 'money_with_wings':'\ud83d\udcb8',
  1785. 'moneybag':'\ud83d\udcb0',
  1786. 'monkey':'\ud83d\udc12',
  1787. 'monkey_face':'\ud83d\udc35',
  1788. 'monorail':'\ud83d\ude9d',
  1789. 'moon':'\ud83c\udf14',
  1790. 'mortar_board':'\ud83c\udf93',
  1791. 'mosque':'\ud83d\udd4c',
  1792. 'motor_boat':'\ud83d\udee5',
  1793. 'motor_scooter':'\ud83d\udef5',
  1794. 'motorcycle':'\ud83c\udfcd',
  1795. 'motorway':'\ud83d\udee3',
  1796. 'mount_fuji':'\ud83d\uddfb',
  1797. 'mountain':'\u26f0',
  1798. 'mountain_biking_man':'\ud83d\udeb5',
  1799. 'mountain_biking_woman':'\ud83d\udeb5&zwj;\u2640\ufe0f',
  1800. 'mountain_cableway':'\ud83d\udea0',
  1801. 'mountain_railway':'\ud83d\ude9e',
  1802. 'mountain_snow':'\ud83c\udfd4',
  1803. 'mouse':'\ud83d\udc2d',
  1804. 'mouse2':'\ud83d\udc01',
  1805. 'movie_camera':'\ud83c\udfa5',
  1806. 'moyai':'\ud83d\uddff',
  1807. 'mrs_claus':'\ud83e\udd36',
  1808. 'muscle':'\ud83d\udcaa',
  1809. 'mushroom':'\ud83c\udf44',
  1810. 'musical_keyboard':'\ud83c\udfb9',
  1811. 'musical_note':'\ud83c\udfb5',
  1812. 'musical_score':'\ud83c\udfbc',
  1813. 'mute':'\ud83d\udd07',
  1814. 'nail_care':'\ud83d\udc85',
  1815. 'name_badge':'\ud83d\udcdb',
  1816. 'national_park':'\ud83c\udfde',
  1817. 'nauseated_face':'\ud83e\udd22',
  1818. 'necktie':'\ud83d\udc54',
  1819. 'negative_squared_cross_mark':'\u274e',
  1820. 'nerd_face':'\ud83e\udd13',
  1821. 'neutral_face':'\ud83d\ude10',
  1822. 'new':'\ud83c\udd95',
  1823. 'new_moon':'\ud83c\udf11',
  1824. 'new_moon_with_face':'\ud83c\udf1a',
  1825. 'newspaper':'\ud83d\udcf0',
  1826. 'newspaper_roll':'\ud83d\uddde',
  1827. 'next_track_button':'\u23ed',
  1828. 'ng':'\ud83c\udd96',
  1829. 'no_good_man':'\ud83d\ude45&zwj;\u2642\ufe0f',
  1830. 'no_good_woman':'\ud83d\ude45',
  1831. 'night_with_stars':'\ud83c\udf03',
  1832. 'no_bell':'\ud83d\udd15',
  1833. 'no_bicycles':'\ud83d\udeb3',
  1834. 'no_entry':'\u26d4\ufe0f',
  1835. 'no_entry_sign':'\ud83d\udeab',
  1836. 'no_mobile_phones':'\ud83d\udcf5',
  1837. 'no_mouth':'\ud83d\ude36',
  1838. 'no_pedestrians':'\ud83d\udeb7',
  1839. 'no_smoking':'\ud83d\udead',
  1840. 'non-potable_water':'\ud83d\udeb1',
  1841. 'nose':'\ud83d\udc43',
  1842. 'notebook':'\ud83d\udcd3',
  1843. 'notebook_with_decorative_cover':'\ud83d\udcd4',
  1844. 'notes':'\ud83c\udfb6',
  1845. 'nut_and_bolt':'\ud83d\udd29',
  1846. 'o':'\u2b55\ufe0f',
  1847. 'o2':'\ud83c\udd7e\ufe0f',
  1848. 'ocean':'\ud83c\udf0a',
  1849. 'octopus':'\ud83d\udc19',
  1850. 'oden':'\ud83c\udf62',
  1851. 'office':'\ud83c\udfe2',
  1852. 'oil_drum':'\ud83d\udee2',
  1853. 'ok':'\ud83c\udd97',
  1854. 'ok_hand':'\ud83d\udc4c',
  1855. 'ok_man':'\ud83d\ude46&zwj;\u2642\ufe0f',
  1856. 'ok_woman':'\ud83d\ude46',
  1857. 'old_key':'\ud83d\udddd',
  1858. 'older_man':'\ud83d\udc74',
  1859. 'older_woman':'\ud83d\udc75',
  1860. 'om':'\ud83d\udd49',
  1861. 'on':'\ud83d\udd1b',
  1862. 'oncoming_automobile':'\ud83d\ude98',
  1863. 'oncoming_bus':'\ud83d\ude8d',
  1864. 'oncoming_police_car':'\ud83d\ude94',
  1865. 'oncoming_taxi':'\ud83d\ude96',
  1866. 'open_file_folder':'\ud83d\udcc2',
  1867. 'open_hands':'\ud83d\udc50',
  1868. 'open_mouth':'\ud83d\ude2e',
  1869. 'open_umbrella':'\u2602\ufe0f',
  1870. 'ophiuchus':'\u26ce',
  1871. 'orange_book':'\ud83d\udcd9',
  1872. 'orthodox_cross':'\u2626\ufe0f',
  1873. 'outbox_tray':'\ud83d\udce4',
  1874. 'owl':'\ud83e\udd89',
  1875. 'ox':'\ud83d\udc02',
  1876. 'package':'\ud83d\udce6',
  1877. 'page_facing_up':'\ud83d\udcc4',
  1878. 'page_with_curl':'\ud83d\udcc3',
  1879. 'pager':'\ud83d\udcdf',
  1880. 'paintbrush':'\ud83d\udd8c',
  1881. 'palm_tree':'\ud83c\udf34',
  1882. 'pancakes':'\ud83e\udd5e',
  1883. 'panda_face':'\ud83d\udc3c',
  1884. 'paperclip':'\ud83d\udcce',
  1885. 'paperclips':'\ud83d\udd87',
  1886. 'parasol_on_ground':'\u26f1',
  1887. 'parking':'\ud83c\udd7f\ufe0f',
  1888. 'part_alternation_mark':'\u303d\ufe0f',
  1889. 'partly_sunny':'\u26c5\ufe0f',
  1890. 'passenger_ship':'\ud83d\udef3',
  1891. 'passport_control':'\ud83d\udec2',
  1892. 'pause_button':'\u23f8',
  1893. 'peace_symbol':'\u262e\ufe0f',
  1894. 'peach':'\ud83c\udf51',
  1895. 'peanuts':'\ud83e\udd5c',
  1896. 'pear':'\ud83c\udf50',
  1897. 'pen':'\ud83d\udd8a',
  1898. 'pencil2':'\u270f\ufe0f',
  1899. 'penguin':'\ud83d\udc27',
  1900. 'pensive':'\ud83d\ude14',
  1901. 'performing_arts':'\ud83c\udfad',
  1902. 'persevere':'\ud83d\ude23',
  1903. 'person_fencing':'\ud83e\udd3a',
  1904. 'pouting_woman':'\ud83d\ude4e',
  1905. 'phone':'\u260e\ufe0f',
  1906. 'pick':'\u26cf',
  1907. 'pig':'\ud83d\udc37',
  1908. 'pig2':'\ud83d\udc16',
  1909. 'pig_nose':'\ud83d\udc3d',
  1910. 'pill':'\ud83d\udc8a',
  1911. 'pineapple':'\ud83c\udf4d',
  1912. 'ping_pong':'\ud83c\udfd3',
  1913. 'pisces':'\u2653\ufe0f',
  1914. 'pizza':'\ud83c\udf55',
  1915. 'place_of_worship':'\ud83d\uded0',
  1916. 'plate_with_cutlery':'\ud83c\udf7d',
  1917. 'play_or_pause_button':'\u23ef',
  1918. 'point_down':'\ud83d\udc47',
  1919. 'point_left':'\ud83d\udc48',
  1920. 'point_right':'\ud83d\udc49',
  1921. 'point_up':'\u261d\ufe0f',
  1922. 'point_up_2':'\ud83d\udc46',
  1923. 'police_car':'\ud83d\ude93',
  1924. 'policewoman':'\ud83d\udc6e&zwj;\u2640\ufe0f',
  1925. 'poodle':'\ud83d\udc29',
  1926. 'popcorn':'\ud83c\udf7f',
  1927. 'post_office':'\ud83c\udfe3',
  1928. 'postal_horn':'\ud83d\udcef',
  1929. 'postbox':'\ud83d\udcee',
  1930. 'potable_water':'\ud83d\udeb0',
  1931. 'potato':'\ud83e\udd54',
  1932. 'pouch':'\ud83d\udc5d',
  1933. 'poultry_leg':'\ud83c\udf57',
  1934. 'pound':'\ud83d\udcb7',
  1935. 'rage':'\ud83d\ude21',
  1936. 'pouting_cat':'\ud83d\ude3e',
  1937. 'pouting_man':'\ud83d\ude4e&zwj;\u2642\ufe0f',
  1938. 'pray':'\ud83d\ude4f',
  1939. 'prayer_beads':'\ud83d\udcff',
  1940. 'pregnant_woman':'\ud83e\udd30',
  1941. 'previous_track_button':'\u23ee',
  1942. 'prince':'\ud83e\udd34',
  1943. 'princess':'\ud83d\udc78',
  1944. 'printer':'\ud83d\udda8',
  1945. 'purple_heart':'\ud83d\udc9c',
  1946. 'purse':'\ud83d\udc5b',
  1947. 'pushpin':'\ud83d\udccc',
  1948. 'put_litter_in_its_place':'\ud83d\udeae',
  1949. 'question':'\u2753',
  1950. 'rabbit':'\ud83d\udc30',
  1951. 'rabbit2':'\ud83d\udc07',
  1952. 'racehorse':'\ud83d\udc0e',
  1953. 'racing_car':'\ud83c\udfce',
  1954. 'radio':'\ud83d\udcfb',
  1955. 'radio_button':'\ud83d\udd18',
  1956. 'radioactive':'\u2622\ufe0f',
  1957. 'railway_car':'\ud83d\ude83',
  1958. 'railway_track':'\ud83d\udee4',
  1959. 'rainbow':'\ud83c\udf08',
  1960. 'rainbow_flag':'\ud83c\udff3\ufe0f&zwj;\ud83c\udf08',
  1961. 'raised_back_of_hand':'\ud83e\udd1a',
  1962. 'raised_hand_with_fingers_splayed':'\ud83d\udd90',
  1963. 'raised_hands':'\ud83d\ude4c',
  1964. 'raising_hand_woman':'\ud83d\ude4b',
  1965. 'raising_hand_man':'\ud83d\ude4b&zwj;\u2642\ufe0f',
  1966. 'ram':'\ud83d\udc0f',
  1967. 'ramen':'\ud83c\udf5c',
  1968. 'rat':'\ud83d\udc00',
  1969. 'record_button':'\u23fa',
  1970. 'recycle':'\u267b\ufe0f',
  1971. 'red_circle':'\ud83d\udd34',
  1972. 'registered':'\u00ae\ufe0f',
  1973. 'relaxed':'\u263a\ufe0f',
  1974. 'relieved':'\ud83d\ude0c',
  1975. 'reminder_ribbon':'\ud83c\udf97',
  1976. 'repeat':'\ud83d\udd01',
  1977. 'repeat_one':'\ud83d\udd02',
  1978. 'rescue_worker_helmet':'\u26d1',
  1979. 'restroom':'\ud83d\udebb',
  1980. 'revolving_hearts':'\ud83d\udc9e',
  1981. 'rewind':'\u23ea',
  1982. 'rhinoceros':'\ud83e\udd8f',
  1983. 'ribbon':'\ud83c\udf80',
  1984. 'rice':'\ud83c\udf5a',
  1985. 'rice_ball':'\ud83c\udf59',
  1986. 'rice_cracker':'\ud83c\udf58',
  1987. 'rice_scene':'\ud83c\udf91',
  1988. 'right_anger_bubble':'\ud83d\uddef',
  1989. 'ring':'\ud83d\udc8d',
  1990. 'robot':'\ud83e\udd16',
  1991. 'rocket':'\ud83d\ude80',
  1992. 'rofl':'\ud83e\udd23',
  1993. 'roll_eyes':'\ud83d\ude44',
  1994. 'roller_coaster':'\ud83c\udfa2',
  1995. 'rooster':'\ud83d\udc13',
  1996. 'rose':'\ud83c\udf39',
  1997. 'rosette':'\ud83c\udff5',
  1998. 'rotating_light':'\ud83d\udea8',
  1999. 'round_pushpin':'\ud83d\udccd',
  2000. 'rowing_man':'\ud83d\udea3',
  2001. 'rowing_woman':'\ud83d\udea3&zwj;\u2640\ufe0f',
  2002. 'rugby_football':'\ud83c\udfc9',
  2003. 'running_man':'\ud83c\udfc3',
  2004. 'running_shirt_with_sash':'\ud83c\udfbd',
  2005. 'running_woman':'\ud83c\udfc3&zwj;\u2640\ufe0f',
  2006. 'sa':'\ud83c\ude02\ufe0f',
  2007. 'sagittarius':'\u2650\ufe0f',
  2008. 'sake':'\ud83c\udf76',
  2009. 'sandal':'\ud83d\udc61',
  2010. 'santa':'\ud83c\udf85',
  2011. 'satellite':'\ud83d\udce1',
  2012. 'saxophone':'\ud83c\udfb7',
  2013. 'school':'\ud83c\udfeb',
  2014. 'school_satchel':'\ud83c\udf92',
  2015. 'scissors':'\u2702\ufe0f',
  2016. 'scorpion':'\ud83e\udd82',
  2017. 'scorpius':'\u264f\ufe0f',
  2018. 'scream':'\ud83d\ude31',
  2019. 'scream_cat':'\ud83d\ude40',
  2020. 'scroll':'\ud83d\udcdc',
  2021. 'seat':'\ud83d\udcba',
  2022. 'secret':'\u3299\ufe0f',
  2023. 'see_no_evil':'\ud83d\ude48',
  2024. 'seedling':'\ud83c\udf31',
  2025. 'selfie':'\ud83e\udd33',
  2026. 'shallow_pan_of_food':'\ud83e\udd58',
  2027. 'shamrock':'\u2618\ufe0f',
  2028. 'shark':'\ud83e\udd88',
  2029. 'shaved_ice':'\ud83c\udf67',
  2030. 'sheep':'\ud83d\udc11',
  2031. 'shell':'\ud83d\udc1a',
  2032. 'shield':'\ud83d\udee1',
  2033. 'shinto_shrine':'\u26e9',
  2034. 'ship':'\ud83d\udea2',
  2035. 'shirt':'\ud83d\udc55',
  2036. 'shopping':'\ud83d\udecd',
  2037. 'shopping_cart':'\ud83d\uded2',
  2038. 'shower':'\ud83d\udebf',
  2039. 'shrimp':'\ud83e\udd90',
  2040. 'signal_strength':'\ud83d\udcf6',
  2041. 'six_pointed_star':'\ud83d\udd2f',
  2042. 'ski':'\ud83c\udfbf',
  2043. 'skier':'\u26f7',
  2044. 'skull':'\ud83d\udc80',
  2045. 'skull_and_crossbones':'\u2620\ufe0f',
  2046. 'sleeping':'\ud83d\ude34',
  2047. 'sleeping_bed':'\ud83d\udecc',
  2048. 'sleepy':'\ud83d\ude2a',
  2049. 'slightly_frowning_face':'\ud83d\ude41',
  2050. 'slightly_smiling_face':'\ud83d\ude42',
  2051. 'slot_machine':'\ud83c\udfb0',
  2052. 'small_airplane':'\ud83d\udee9',
  2053. 'small_blue_diamond':'\ud83d\udd39',
  2054. 'small_orange_diamond':'\ud83d\udd38',
  2055. 'small_red_triangle':'\ud83d\udd3a',
  2056. 'small_red_triangle_down':'\ud83d\udd3b',
  2057. 'smile':'\ud83d\ude04',
  2058. 'smile_cat':'\ud83d\ude38',
  2059. 'smiley':'\ud83d\ude03',
  2060. 'smiley_cat':'\ud83d\ude3a',
  2061. 'smiling_imp':'\ud83d\ude08',
  2062. 'smirk':'\ud83d\ude0f',
  2063. 'smirk_cat':'\ud83d\ude3c',
  2064. 'smoking':'\ud83d\udeac',
  2065. 'snail':'\ud83d\udc0c',
  2066. 'snake':'\ud83d\udc0d',
  2067. 'sneezing_face':'\ud83e\udd27',
  2068. 'snowboarder':'\ud83c\udfc2',
  2069. 'snowflake':'\u2744\ufe0f',
  2070. 'snowman':'\u26c4\ufe0f',
  2071. 'snowman_with_snow':'\u2603\ufe0f',
  2072. 'sob':'\ud83d\ude2d',
  2073. 'soccer':'\u26bd\ufe0f',
  2074. 'soon':'\ud83d\udd1c',
  2075. 'sos':'\ud83c\udd98',
  2076. 'sound':'\ud83d\udd09',
  2077. 'space_invader':'\ud83d\udc7e',
  2078. 'spades':'\u2660\ufe0f',
  2079. 'spaghetti':'\ud83c\udf5d',
  2080. 'sparkle':'\u2747\ufe0f',
  2081. 'sparkler':'\ud83c\udf87',
  2082. 'sparkles':'\u2728',
  2083. 'sparkling_heart':'\ud83d\udc96',
  2084. 'speak_no_evil':'\ud83d\ude4a',
  2085. 'speaker':'\ud83d\udd08',
  2086. 'speaking_head':'\ud83d\udde3',
  2087. 'speech_balloon':'\ud83d\udcac',
  2088. 'speedboat':'\ud83d\udea4',
  2089. 'spider':'\ud83d\udd77',
  2090. 'spider_web':'\ud83d\udd78',
  2091. 'spiral_calendar':'\ud83d\uddd3',
  2092. 'spiral_notepad':'\ud83d\uddd2',
  2093. 'spoon':'\ud83e\udd44',
  2094. 'squid':'\ud83e\udd91',
  2095. 'stadium':'\ud83c\udfdf',
  2096. 'star':'\u2b50\ufe0f',
  2097. 'star2':'\ud83c\udf1f',
  2098. 'star_and_crescent':'\u262a\ufe0f',
  2099. 'star_of_david':'\u2721\ufe0f',
  2100. 'stars':'\ud83c\udf20',
  2101. 'station':'\ud83d\ude89',
  2102. 'statue_of_liberty':'\ud83d\uddfd',
  2103. 'steam_locomotive':'\ud83d\ude82',
  2104. 'stew':'\ud83c\udf72',
  2105. 'stop_button':'\u23f9',
  2106. 'stop_sign':'\ud83d\uded1',
  2107. 'stopwatch':'\u23f1',
  2108. 'straight_ruler':'\ud83d\udccf',
  2109. 'strawberry':'\ud83c\udf53',
  2110. 'stuck_out_tongue':'\ud83d\ude1b',
  2111. 'stuck_out_tongue_closed_eyes':'\ud83d\ude1d',
  2112. 'stuck_out_tongue_winking_eye':'\ud83d\ude1c',
  2113. 'studio_microphone':'\ud83c\udf99',
  2114. 'stuffed_flatbread':'\ud83e\udd59',
  2115. 'sun_behind_large_cloud':'\ud83c\udf25',
  2116. 'sun_behind_rain_cloud':'\ud83c\udf26',
  2117. 'sun_behind_small_cloud':'\ud83c\udf24',
  2118. 'sun_with_face':'\ud83c\udf1e',
  2119. 'sunflower':'\ud83c\udf3b',
  2120. 'sunglasses':'\ud83d\ude0e',
  2121. 'sunny':'\u2600\ufe0f',
  2122. 'sunrise':'\ud83c\udf05',
  2123. 'sunrise_over_mountains':'\ud83c\udf04',
  2124. 'surfing_man':'\ud83c\udfc4',
  2125. 'surfing_woman':'\ud83c\udfc4&zwj;\u2640\ufe0f',
  2126. 'sushi':'\ud83c\udf63',
  2127. 'suspension_railway':'\ud83d\ude9f',
  2128. 'sweat':'\ud83d\ude13',
  2129. 'sweat_drops':'\ud83d\udca6',
  2130. 'sweat_smile':'\ud83d\ude05',
  2131. 'sweet_potato':'\ud83c\udf60',
  2132. 'swimming_man':'\ud83c\udfca',
  2133. 'swimming_woman':'\ud83c\udfca&zwj;\u2640\ufe0f',
  2134. 'symbols':'\ud83d\udd23',
  2135. 'synagogue':'\ud83d\udd4d',
  2136. 'syringe':'\ud83d\udc89',
  2137. 'taco':'\ud83c\udf2e',
  2138. 'tada':'\ud83c\udf89',
  2139. 'tanabata_tree':'\ud83c\udf8b',
  2140. 'taurus':'\u2649\ufe0f',
  2141. 'taxi':'\ud83d\ude95',
  2142. 'tea':'\ud83c\udf75',
  2143. 'telephone_receiver':'\ud83d\udcde',
  2144. 'telescope':'\ud83d\udd2d',
  2145. 'tennis':'\ud83c\udfbe',
  2146. 'tent':'\u26fa\ufe0f',
  2147. 'thermometer':'\ud83c\udf21',
  2148. 'thinking':'\ud83e\udd14',
  2149. 'thought_balloon':'\ud83d\udcad',
  2150. 'ticket':'\ud83c\udfab',
  2151. 'tickets':'\ud83c\udf9f',
  2152. 'tiger':'\ud83d\udc2f',
  2153. 'tiger2':'\ud83d\udc05',
  2154. 'timer_clock':'\u23f2',
  2155. 'tipping_hand_man':'\ud83d\udc81&zwj;\u2642\ufe0f',
  2156. 'tired_face':'\ud83d\ude2b',
  2157. 'tm':'\u2122\ufe0f',
  2158. 'toilet':'\ud83d\udebd',
  2159. 'tokyo_tower':'\ud83d\uddfc',
  2160. 'tomato':'\ud83c\udf45',
  2161. 'tongue':'\ud83d\udc45',
  2162. 'top':'\ud83d\udd1d',
  2163. 'tophat':'\ud83c\udfa9',
  2164. 'tornado':'\ud83c\udf2a',
  2165. 'trackball':'\ud83d\uddb2',
  2166. 'tractor':'\ud83d\ude9c',
  2167. 'traffic_light':'\ud83d\udea5',
  2168. 'train':'\ud83d\ude8b',
  2169. 'train2':'\ud83d\ude86',
  2170. 'tram':'\ud83d\ude8a',
  2171. 'triangular_flag_on_post':'\ud83d\udea9',
  2172. 'triangular_ruler':'\ud83d\udcd0',
  2173. 'trident':'\ud83d\udd31',
  2174. 'triumph':'\ud83d\ude24',
  2175. 'trolleybus':'\ud83d\ude8e',
  2176. 'trophy':'\ud83c\udfc6',
  2177. 'tropical_drink':'\ud83c\udf79',
  2178. 'tropical_fish':'\ud83d\udc20',
  2179. 'truck':'\ud83d\ude9a',
  2180. 'trumpet':'\ud83c\udfba',
  2181. 'tulip':'\ud83c\udf37',
  2182. 'tumbler_glass':'\ud83e\udd43',
  2183. 'turkey':'\ud83e\udd83',
  2184. 'turtle':'\ud83d\udc22',
  2185. 'tv':'\ud83d\udcfa',
  2186. 'twisted_rightwards_arrows':'\ud83d\udd00',
  2187. 'two_hearts':'\ud83d\udc95',
  2188. 'two_men_holding_hands':'\ud83d\udc6c',
  2189. 'two_women_holding_hands':'\ud83d\udc6d',
  2190. 'u5272':'\ud83c\ude39',
  2191. 'u5408':'\ud83c\ude34',
  2192. 'u55b6':'\ud83c\ude3a',
  2193. 'u6307':'\ud83c\ude2f\ufe0f',
  2194. 'u6708':'\ud83c\ude37\ufe0f',
  2195. 'u6709':'\ud83c\ude36',
  2196. 'u6e80':'\ud83c\ude35',
  2197. 'u7121':'\ud83c\ude1a\ufe0f',
  2198. 'u7533':'\ud83c\ude38',
  2199. 'u7981':'\ud83c\ude32',
  2200. 'u7a7a':'\ud83c\ude33',
  2201. 'umbrella':'\u2614\ufe0f',
  2202. 'unamused':'\ud83d\ude12',
  2203. 'underage':'\ud83d\udd1e',
  2204. 'unicorn':'\ud83e\udd84',
  2205. 'unlock':'\ud83d\udd13',
  2206. 'up':'\ud83c\udd99',
  2207. 'upside_down_face':'\ud83d\ude43',
  2208. 'v':'\u270c\ufe0f',
  2209. 'vertical_traffic_light':'\ud83d\udea6',
  2210. 'vhs':'\ud83d\udcfc',
  2211. 'vibration_mode':'\ud83d\udcf3',
  2212. 'video_camera':'\ud83d\udcf9',
  2213. 'video_game':'\ud83c\udfae',
  2214. 'violin':'\ud83c\udfbb',
  2215. 'virgo':'\u264d\ufe0f',
  2216. 'volcano':'\ud83c\udf0b',
  2217. 'volleyball':'\ud83c\udfd0',
  2218. 'vs':'\ud83c\udd9a',
  2219. 'vulcan_salute':'\ud83d\udd96',
  2220. 'walking_man':'\ud83d\udeb6',
  2221. 'walking_woman':'\ud83d\udeb6&zwj;\u2640\ufe0f',
  2222. 'waning_crescent_moon':'\ud83c\udf18',
  2223. 'waning_gibbous_moon':'\ud83c\udf16',
  2224. 'warning':'\u26a0\ufe0f',
  2225. 'wastebasket':'\ud83d\uddd1',
  2226. 'watch':'\u231a\ufe0f',
  2227. 'water_buffalo':'\ud83d\udc03',
  2228. 'watermelon':'\ud83c\udf49',
  2229. 'wave':'\ud83d\udc4b',
  2230. 'wavy_dash':'\u3030\ufe0f',
  2231. 'waxing_crescent_moon':'\ud83c\udf12',
  2232. 'wc':'\ud83d\udebe',
  2233. 'weary':'\ud83d\ude29',
  2234. 'wedding':'\ud83d\udc92',
  2235. 'weight_lifting_man':'\ud83c\udfcb\ufe0f',
  2236. 'weight_lifting_woman':'\ud83c\udfcb\ufe0f&zwj;\u2640\ufe0f',
  2237. 'whale':'\ud83d\udc33',
  2238. 'whale2':'\ud83d\udc0b',
  2239. 'wheel_of_dharma':'\u2638\ufe0f',
  2240. 'wheelchair':'\u267f\ufe0f',
  2241. 'white_check_mark':'\u2705',
  2242. 'white_circle':'\u26aa\ufe0f',
  2243. 'white_flag':'\ud83c\udff3\ufe0f',
  2244. 'white_flower':'\ud83d\udcae',
  2245. 'white_large_square':'\u2b1c\ufe0f',
  2246. 'white_medium_small_square':'\u25fd\ufe0f',
  2247. 'white_medium_square':'\u25fb\ufe0f',
  2248. 'white_small_square':'\u25ab\ufe0f',
  2249. 'white_square_button':'\ud83d\udd33',
  2250. 'wilted_flower':'\ud83e\udd40',
  2251. 'wind_chime':'\ud83c\udf90',
  2252. 'wind_face':'\ud83c\udf2c',
  2253. 'wine_glass':'\ud83c\udf77',
  2254. 'wink':'\ud83d\ude09',
  2255. 'wolf':'\ud83d\udc3a',
  2256. 'woman':'\ud83d\udc69',
  2257. 'woman_artist':'\ud83d\udc69&zwj;\ud83c\udfa8',
  2258. 'woman_astronaut':'\ud83d\udc69&zwj;\ud83d\ude80',
  2259. 'woman_cartwheeling':'\ud83e\udd38&zwj;\u2640\ufe0f',
  2260. 'woman_cook':'\ud83d\udc69&zwj;\ud83c\udf73',
  2261. 'woman_facepalming':'\ud83e\udd26&zwj;\u2640\ufe0f',
  2262. 'woman_factory_worker':'\ud83d\udc69&zwj;\ud83c\udfed',
  2263. 'woman_farmer':'\ud83d\udc69&zwj;\ud83c\udf3e',
  2264. 'woman_firefighter':'\ud83d\udc69&zwj;\ud83d\ude92',
  2265. 'woman_health_worker':'\ud83d\udc69&zwj;\u2695\ufe0f',
  2266. 'woman_judge':'\ud83d\udc69&zwj;\u2696\ufe0f',
  2267. 'woman_juggling':'\ud83e\udd39&zwj;\u2640\ufe0f',
  2268. 'woman_mechanic':'\ud83d\udc69&zwj;\ud83d\udd27',
  2269. 'woman_office_worker':'\ud83d\udc69&zwj;\ud83d\udcbc',
  2270. 'woman_pilot':'\ud83d\udc69&zwj;\u2708\ufe0f',
  2271. 'woman_playing_handball':'\ud83e\udd3e&zwj;\u2640\ufe0f',
  2272. 'woman_playing_water_polo':'\ud83e\udd3d&zwj;\u2640\ufe0f',
  2273. 'woman_scientist':'\ud83d\udc69&zwj;\ud83d\udd2c',
  2274. 'woman_shrugging':'\ud83e\udd37&zwj;\u2640\ufe0f',
  2275. 'woman_singer':'\ud83d\udc69&zwj;\ud83c\udfa4',
  2276. 'woman_student':'\ud83d\udc69&zwj;\ud83c\udf93',
  2277. 'woman_teacher':'\ud83d\udc69&zwj;\ud83c\udfeb',
  2278. 'woman_technologist':'\ud83d\udc69&zwj;\ud83d\udcbb',
  2279. 'woman_with_turban':'\ud83d\udc73&zwj;\u2640\ufe0f',
  2280. 'womans_clothes':'\ud83d\udc5a',
  2281. 'womans_hat':'\ud83d\udc52',
  2282. 'women_wrestling':'\ud83e\udd3c&zwj;\u2640\ufe0f',
  2283. 'womens':'\ud83d\udeba',
  2284. 'world_map':'\ud83d\uddfa',
  2285. 'worried':'\ud83d\ude1f',
  2286. 'wrench':'\ud83d\udd27',
  2287. 'writing_hand':'\u270d\ufe0f',
  2288. 'x':'\u274c',
  2289. 'yellow_heart':'\ud83d\udc9b',
  2290. 'yen':'\ud83d\udcb4',
  2291. 'yin_yang':'\u262f\ufe0f',
  2292. 'yum':'\ud83d\ude0b',
  2293. 'zap':'\u26a1\ufe0f',
  2294. 'zipper_mouth_face':'\ud83e\udd10',
  2295. 'zzz':'\ud83d\udca4',
  2296. /* special emojis :P */
  2297. 'octocat': '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
  2298. 'showdown': '<span style="font-family: \'Anonymous Pro\', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;">S</span>'
  2299. };
  2300. /**
  2301. * Created by Estevao on 31-05-2015.
  2302. */
  2303. /**
  2304. * Showdown Converter class
  2305. * @class
  2306. * @param {object} [converterOptions]
  2307. * @returns {Converter}
  2308. */
  2309. showdown.Converter = function (converterOptions) {
  2310. 'use strict';
  2311. var
  2312. /**
  2313. * Options used by this converter
  2314. * @private
  2315. * @type {{}}
  2316. */
  2317. options = {},
  2318. /**
  2319. * Language extensions used by this converter
  2320. * @private
  2321. * @type {Array}
  2322. */
  2323. langExtensions = [],
  2324. /**
  2325. * Output modifiers extensions used by this converter
  2326. * @private
  2327. * @type {Array}
  2328. */
  2329. outputModifiers = [],
  2330. /**
  2331. * Event listeners
  2332. * @private
  2333. * @type {{}}
  2334. */
  2335. listeners = {},
  2336. /**
  2337. * The flavor set in this converter
  2338. */
  2339. setConvFlavor = setFlavor,
  2340. /**
  2341. * Metadata of the document
  2342. * @type {{parsed: {}, raw: string, format: string}}
  2343. */
  2344. metadata = {
  2345. parsed: {},
  2346. raw: '',
  2347. format: ''
  2348. };
  2349. _constructor();
  2350. /**
  2351. * Converter constructor
  2352. * @private
  2353. */
  2354. function _constructor () {
  2355. converterOptions = converterOptions || {};
  2356. for (var gOpt in globalOptions) {
  2357. if (globalOptions.hasOwnProperty(gOpt)) {
  2358. options[gOpt] = globalOptions[gOpt];
  2359. }
  2360. }
  2361. // Merge options
  2362. if (typeof converterOptions === 'object') {
  2363. for (var opt in converterOptions) {
  2364. if (converterOptions.hasOwnProperty(opt)) {
  2365. options[opt] = converterOptions[opt];
  2366. }
  2367. }
  2368. } else {
  2369. throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
  2370. ' was passed instead.');
  2371. }
  2372. if (options.extensions) {
  2373. showdown.helper.forEach(options.extensions, _parseExtension);
  2374. }
  2375. }
  2376. /**
  2377. * Parse extension
  2378. * @param {*} ext
  2379. * @param {string} [name='']
  2380. * @private
  2381. */
  2382. function _parseExtension (ext, name) {
  2383. name = name || null;
  2384. // If it's a string, the extension was previously loaded
  2385. if (showdown.helper.isString(ext)) {
  2386. ext = showdown.helper.stdExtName(ext);
  2387. name = ext;
  2388. // LEGACY_SUPPORT CODE
  2389. if (showdown.extensions[ext]) {
  2390. console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
  2391. 'Please inform the developer that the extension should be updated!');
  2392. legacyExtensionLoading(showdown.extensions[ext], ext);
  2393. return;
  2394. // END LEGACY SUPPORT CODE
  2395. } else if (!showdown.helper.isUndefined(extensions[ext])) {
  2396. ext = extensions[ext];
  2397. } else {
  2398. throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
  2399. }
  2400. }
  2401. if (typeof ext === 'function') {
  2402. ext = ext();
  2403. }
  2404. if (!showdown.helper.isArray(ext)) {
  2405. ext = [ext];
  2406. }
  2407. var validExt = validate(ext, name);
  2408. if (!validExt.valid) {
  2409. throw Error(validExt.error);
  2410. }
  2411. for (var i = 0; i < ext.length; ++i) {
  2412. switch (ext[i].type) {
  2413. case 'lang':
  2414. langExtensions.push(ext[i]);
  2415. break;
  2416. case 'output':
  2417. outputModifiers.push(ext[i]);
  2418. break;
  2419. }
  2420. if (ext[i].hasOwnProperty('listeners')) {
  2421. for (var ln in ext[i].listeners) {
  2422. if (ext[i].listeners.hasOwnProperty(ln)) {
  2423. listen(ln, ext[i].listeners[ln]);
  2424. }
  2425. }
  2426. }
  2427. }
  2428. }
  2429. /**
  2430. * LEGACY_SUPPORT
  2431. * @param {*} ext
  2432. * @param {string} name
  2433. */
  2434. function legacyExtensionLoading (ext, name) {
  2435. if (typeof ext === 'function') {
  2436. ext = ext(new showdown.Converter());
  2437. }
  2438. if (!showdown.helper.isArray(ext)) {
  2439. ext = [ext];
  2440. }
  2441. var valid = validate(ext, name);
  2442. if (!valid.valid) {
  2443. throw Error(valid.error);
  2444. }
  2445. for (var i = 0; i < ext.length; ++i) {
  2446. switch (ext[i].type) {
  2447. case 'lang':
  2448. langExtensions.push(ext[i]);
  2449. break;
  2450. case 'output':
  2451. outputModifiers.push(ext[i]);
  2452. break;
  2453. default:// should never reach here
  2454. throw Error('Extension loader error: Type unrecognized!!!');
  2455. }
  2456. }
  2457. }
  2458. /**
  2459. * Listen to an event
  2460. * @param {string} name
  2461. * @param {function} callback
  2462. */
  2463. function listen (name, callback) {
  2464. if (!showdown.helper.isString(name)) {
  2465. throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
  2466. }
  2467. if (typeof callback !== 'function') {
  2468. throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
  2469. }
  2470. if (!listeners.hasOwnProperty(name)) {
  2471. listeners[name] = [];
  2472. }
  2473. listeners[name].push(callback);
  2474. }
  2475. function rTrimInputText (text) {
  2476. var rsp = text.match(/^\s*/)[0].length,
  2477. rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
  2478. return text.replace(rgx, '');
  2479. }
  2480. /**
  2481. * Dispatch an event
  2482. * @private
  2483. * @param {string} evtName Event name
  2484. * @param {string} text Text
  2485. * @param {{}} options Converter Options
  2486. * @param {{}} globals
  2487. * @returns {string}
  2488. */
  2489. this._dispatch = function dispatch (evtName, text, options, globals) {
  2490. if (listeners.hasOwnProperty(evtName)) {
  2491. for (var ei = 0; ei < listeners[evtName].length; ++ei) {
  2492. var nText = listeners[evtName][ei](evtName, text, this, options, globals);
  2493. if (nText && typeof nText !== 'undefined') {
  2494. text = nText;
  2495. }
  2496. }
  2497. }
  2498. return text;
  2499. };
  2500. /**
  2501. * Listen to an event
  2502. * @param {string} name
  2503. * @param {function} callback
  2504. * @returns {showdown.Converter}
  2505. */
  2506. this.listen = function (name, callback) {
  2507. listen(name, callback);
  2508. return this;
  2509. };
  2510. /**
  2511. * Converts a markdown string into HTML
  2512. * @param {string} text
  2513. * @returns {*}
  2514. */
  2515. this.makeHtml = function (text) {
  2516. //check if text is not falsy
  2517. if (!text) {
  2518. return text;
  2519. }
  2520. var globals = {
  2521. gHtmlBlocks: [],
  2522. gHtmlMdBlocks: [],
  2523. gHtmlSpans: [],
  2524. gUrls: {},
  2525. gTitles: {},
  2526. gDimensions: {},
  2527. gListLevel: 0,
  2528. hashLinkCounts: {},
  2529. langExtensions: langExtensions,
  2530. outputModifiers: outputModifiers,
  2531. converter: this,
  2532. ghCodeBlocks: [],
  2533. metadata: {
  2534. parsed: {},
  2535. raw: '',
  2536. format: ''
  2537. }
  2538. };
  2539. // This lets us use ¨ trema as an escape char to avoid md5 hashes
  2540. // The choice of character is arbitrary; anything that isn't
  2541. // magic in Markdown will work.
  2542. text = text.replace(/¨/g, '¨T');
  2543. // Replace $ with ¨D
  2544. // RegExp interprets $ as a special character
  2545. // when it's in a replacement string
  2546. text = text.replace(/\$/g, '¨D');
  2547. // Standardize line endings
  2548. text = text.replace(/\r\n/g, '\n'); // DOS to Unix
  2549. text = text.replace(/\r/g, '\n'); // Mac to Unix
  2550. // Stardardize line spaces
  2551. text = text.replace(/\u00A0/g, '&nbsp;');
  2552. if (options.smartIndentationFix) {
  2553. text = rTrimInputText(text);
  2554. }
  2555. // Make sure text begins and ends with a couple of newlines:
  2556. text = '\n\n' + text + '\n\n';
  2557. // detab
  2558. text = showdown.subParser('detab')(text, options, globals);
  2559. /**
  2560. * Strip any lines consisting only of spaces and tabs.
  2561. * This makes subsequent regexs easier to write, because we can
  2562. * match consecutive blank lines with /\n+/ instead of something
  2563. * contorted like /[ \t]*\n+/
  2564. */
  2565. text = text.replace(/^[ \t]+$/mg, '');
  2566. //run languageExtensions
  2567. showdown.helper.forEach(langExtensions, function (ext) {
  2568. text = showdown.subParser('runExtension')(ext, text, options, globals);
  2569. });
  2570. // run the sub parsers
  2571. text = showdown.subParser('metadata')(text, options, globals);
  2572. text = showdown.subParser('hashPreCodeTags')(text, options, globals);
  2573. text = showdown.subParser('githubCodeBlocks')(text, options, globals);
  2574. text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
  2575. text = showdown.subParser('hashCodeTags')(text, options, globals);
  2576. text = showdown.subParser('stripLinkDefinitions')(text, options, globals);
  2577. text = showdown.subParser('blockGamut')(text, options, globals);
  2578. text = showdown.subParser('unhashHTMLSpans')(text, options, globals);
  2579. text = showdown.subParser('unescapeSpecialChars')(text, options, globals);
  2580. // attacklab: Restore dollar signs
  2581. text = text.replace(/¨D/g, '$$');
  2582. // attacklab: Restore tremas
  2583. text = text.replace(/¨T/g, '¨');
  2584. // render a complete html document instead of a partial if the option is enabled
  2585. text = showdown.subParser('completeHTMLDocument')(text, options, globals);
  2586. // Run output modifiers
  2587. showdown.helper.forEach(outputModifiers, function (ext) {
  2588. text = showdown.subParser('runExtension')(ext, text, options, globals);
  2589. });
  2590. // update metadata
  2591. metadata = globals.metadata;
  2592. return text;
  2593. };
  2594. /**
  2595. * Converts an HTML string into a markdown string
  2596. * @param src
  2597. * @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
  2598. * @returns {string}
  2599. */
  2600. this.makeMarkdown = this.makeMd = function (src, HTMLParser) {
  2601. // replace \r\n with \n
  2602. src = src.replace(/\r\n/g, '\n');
  2603. src = src.replace(/\r/g, '\n'); // old macs
  2604. // due to an edge case, we need to find this: > <
  2605. // to prevent removing of non silent white spaces
  2606. // ex: <em>this is</em> <strong>sparta</strong>
  2607. src = src.replace(/>[ \t]+</, '>¨NBSP;<');
  2608. if (!HTMLParser) {
  2609. if (window && window.document) {
  2610. HTMLParser = window.document;
  2611. } else {
  2612. throw new Error('HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM');
  2613. }
  2614. }
  2615. var doc = HTMLParser.createElement('div');
  2616. doc.innerHTML = src;
  2617. var globals = {
  2618. preList: substitutePreCodeTags(doc)
  2619. };
  2620. // remove all newlines and collapse spaces
  2621. clean(doc);
  2622. // some stuff, like accidental reference links must now be escaped
  2623. // TODO
  2624. // doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
  2625. var nodes = doc.childNodes,
  2626. mdDoc = '';
  2627. for (var i = 0; i < nodes.length; i++) {
  2628. mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
  2629. }
  2630. function clean (node) {
  2631. for (var n = 0; n < node.childNodes.length; ++n) {
  2632. var child = node.childNodes[n];
  2633. if (child.nodeType === 3) {
  2634. if (!/\S/.test(child.nodeValue)) {
  2635. node.removeChild(child);
  2636. --n;
  2637. } else {
  2638. child.nodeValue = child.nodeValue.split('\n').join(' ');
  2639. child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
  2640. }
  2641. } else if (child.nodeType === 1) {
  2642. clean(child);
  2643. }
  2644. }
  2645. }
  2646. // find all pre tags and replace contents with placeholder
  2647. // we need this so that we can remove all indentation from html
  2648. // to ease up parsing
  2649. function substitutePreCodeTags (doc) {
  2650. var pres = doc.querySelectorAll('pre'),
  2651. presPH = [];
  2652. for (var i = 0; i < pres.length; ++i) {
  2653. if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
  2654. var content = pres[i].firstChild.innerHTML.trim(),
  2655. language = pres[i].firstChild.getAttribute('data-language') || '';
  2656. // if data-language attribute is not defined, then we look for class language-*
  2657. if (language === '') {
  2658. var classes = pres[i].firstChild.className.split(' ');
  2659. for (var c = 0; c < classes.length; ++c) {
  2660. var matches = classes[c].match(/^language-(.+)$/);
  2661. if (matches !== null) {
  2662. language = matches[1];
  2663. break;
  2664. }
  2665. }
  2666. }
  2667. // unescape html entities in content
  2668. content = showdown.helper.unescapeHTMLEntities(content);
  2669. presPH.push(content);
  2670. pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
  2671. } else {
  2672. presPH.push(pres[i].innerHTML);
  2673. pres[i].innerHTML = '';
  2674. pres[i].setAttribute('prenum', i.toString());
  2675. }
  2676. }
  2677. return presPH;
  2678. }
  2679. return mdDoc;
  2680. };
  2681. /**
  2682. * Set an option of this Converter instance
  2683. * @param {string} key
  2684. * @param {*} value
  2685. */
  2686. this.setOption = function (key, value) {
  2687. options[key] = value;
  2688. };
  2689. /**
  2690. * Get the option of this Converter instance
  2691. * @param {string} key
  2692. * @returns {*}
  2693. */
  2694. this.getOption = function (key) {
  2695. return options[key];
  2696. };
  2697. /**
  2698. * Get the options of this Converter instance
  2699. * @returns {{}}
  2700. */
  2701. this.getOptions = function () {
  2702. return options;
  2703. };
  2704. /**
  2705. * Add extension to THIS converter
  2706. * @param {{}} extension
  2707. * @param {string} [name=null]
  2708. */
  2709. this.addExtension = function (extension, name) {
  2710. name = name || null;
  2711. _parseExtension(extension, name);
  2712. };
  2713. /**
  2714. * Use a global registered extension with THIS converter
  2715. * @param {string} extensionName Name of the previously registered extension
  2716. */
  2717. this.useExtension = function (extensionName) {
  2718. _parseExtension(extensionName);
  2719. };
  2720. /**
  2721. * Set the flavor THIS converter should use
  2722. * @param {string} name
  2723. */
  2724. this.setFlavor = function (name) {
  2725. if (!flavor.hasOwnProperty(name)) {
  2726. throw Error(name + ' flavor was not found');
  2727. }
  2728. var preset = flavor[name];
  2729. setConvFlavor = name;
  2730. for (var option in preset) {
  2731. if (preset.hasOwnProperty(option)) {
  2732. options[option] = preset[option];
  2733. }
  2734. }
  2735. };
  2736. /**
  2737. * Get the currently set flavor of this converter
  2738. * @returns {string}
  2739. */
  2740. this.getFlavor = function () {
  2741. return setConvFlavor;
  2742. };
  2743. /**
  2744. * Remove an extension from THIS converter.
  2745. * Note: This is a costly operation. It's better to initialize a new converter
  2746. * and specify the extensions you wish to use
  2747. * @param {Array} extension
  2748. */
  2749. this.removeExtension = function (extension) {
  2750. if (!showdown.helper.isArray(extension)) {
  2751. extension = [extension];
  2752. }
  2753. for (var a = 0; a < extension.length; ++a) {
  2754. var ext = extension[a];
  2755. for (var i = 0; i < langExtensions.length; ++i) {
  2756. if (langExtensions[i] === ext) {
  2757. langExtensions[i].splice(i, 1);
  2758. }
  2759. }
  2760. for (var ii = 0; ii < outputModifiers.length; ++i) {
  2761. if (outputModifiers[ii] === ext) {
  2762. outputModifiers[ii].splice(i, 1);
  2763. }
  2764. }
  2765. }
  2766. };
  2767. /**
  2768. * Get all extension of THIS converter
  2769. * @returns {{language: Array, output: Array}}
  2770. */
  2771. this.getAllExtensions = function () {
  2772. return {
  2773. language: langExtensions,
  2774. output: outputModifiers
  2775. };
  2776. };
  2777. /**
  2778. * Get the metadata of the previously parsed document
  2779. * @param raw
  2780. * @returns {string|{}}
  2781. */
  2782. this.getMetadata = function (raw) {
  2783. if (raw) {
  2784. return metadata.raw;
  2785. } else {
  2786. return metadata.parsed;
  2787. }
  2788. };
  2789. /**
  2790. * Get the metadata format of the previously parsed document
  2791. * @returns {string}
  2792. */
  2793. this.getMetadataFormat = function () {
  2794. return metadata.format;
  2795. };
  2796. /**
  2797. * Private: set a single key, value metadata pair
  2798. * @param {string} key
  2799. * @param {string} value
  2800. */
  2801. this._setMetadataPair = function (key, value) {
  2802. metadata.parsed[key] = value;
  2803. };
  2804. /**
  2805. * Private: set metadata format
  2806. * @param {string} format
  2807. */
  2808. this._setMetadataFormat = function (format) {
  2809. metadata.format = format;
  2810. };
  2811. /**
  2812. * Private: set metadata raw text
  2813. * @param {string} raw
  2814. */
  2815. this._setMetadataRaw = function (raw) {
  2816. metadata.raw = raw;
  2817. };
  2818. };
  2819. /**
  2820. * Turn Markdown link shortcuts into XHTML <a> tags.
  2821. */
  2822. showdown.subParser('anchors', function (text, options, globals) {
  2823. 'use strict';
  2824. text = globals.converter._dispatch('anchors.before', text, options, globals);
  2825. var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
  2826. if (showdown.helper.isUndefined(title)) {
  2827. title = '';
  2828. }
  2829. linkId = linkId.toLowerCase();
  2830. // Special case for explicit empty url
  2831. if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
  2832. url = '';
  2833. } else if (!url) {
  2834. if (!linkId) {
  2835. // lower-case and turn embedded newlines into spaces
  2836. linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
  2837. }
  2838. url = '#' + linkId;
  2839. if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
  2840. url = globals.gUrls[linkId];
  2841. if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
  2842. title = globals.gTitles[linkId];
  2843. }
  2844. } else {
  2845. return wholeMatch;
  2846. }
  2847. }
  2848. //url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
  2849. url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2850. var result = '<a href="' + url + '"';
  2851. if (title !== '' && title !== null) {
  2852. title = title.replace(/"/g, '&quot;');
  2853. //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
  2854. title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2855. result += ' title="' + title + '"';
  2856. }
  2857. // optionLinksInNewWindow only applies
  2858. // to external links. Hash links (#) open in same page
  2859. if (options.openLinksInNewWindow && !/^#/.test(url)) {
  2860. // escaped _
  2861. result += ' target="¨E95Eblank"';
  2862. }
  2863. result += '>' + linkText + '</a>';
  2864. return result;
  2865. };
  2866. // First, handle reference-style links: [link text] [id]
  2867. text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
  2868. // Next, inline-style links: [link text](url "optional title")
  2869. // cases with crazy urls like ./image/cat1).png
  2870. text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
  2871. writeAnchorTag);
  2872. // normal cases
  2873. text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
  2874. writeAnchorTag);
  2875. // handle reference-style shortcuts: [link text]
  2876. // These must come last in case you've also got [link test][1]
  2877. // or [link test](/foo)
  2878. text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
  2879. // Lastly handle GithubMentions if option is enabled
  2880. if (options.ghMentions) {
  2881. text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) {
  2882. if (escape === '\\') {
  2883. return st + mentions;
  2884. }
  2885. //check if options.ghMentionsLink is a string
  2886. if (!showdown.helper.isString(options.ghMentionsLink)) {
  2887. throw new Error('ghMentionsLink option must be a string');
  2888. }
  2889. var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
  2890. target = '';
  2891. if (options.openLinksInNewWindow) {
  2892. target = ' target="¨E95Eblank"';
  2893. }
  2894. return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
  2895. });
  2896. }
  2897. text = globals.converter._dispatch('anchors.after', text, options, globals);
  2898. return text;
  2899. });
  2900. // url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
  2901. var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
  2902. simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
  2903. delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
  2904. simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
  2905. delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
  2906. replaceLink = function (options) {
  2907. 'use strict';
  2908. return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
  2909. link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2910. var lnkTxt = link,
  2911. append = '',
  2912. target = '',
  2913. lmc = leadingMagicChars || '',
  2914. tmc = trailingMagicChars || '';
  2915. if (/^www\./i.test(link)) {
  2916. link = link.replace(/^www\./i, 'http://www.');
  2917. }
  2918. if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
  2919. append = trailingPunctuation;
  2920. }
  2921. if (options.openLinksInNewWindow) {
  2922. target = ' target="¨E95Eblank"';
  2923. }
  2924. return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
  2925. };
  2926. },
  2927. replaceMail = function (options, globals) {
  2928. 'use strict';
  2929. return function (wholeMatch, b, mail) {
  2930. var href = 'mailto:';
  2931. b = b || '';
  2932. mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
  2933. if (options.encodeEmails) {
  2934. href = showdown.helper.encodeEmailAddress(href + mail);
  2935. mail = showdown.helper.encodeEmailAddress(mail);
  2936. } else {
  2937. href = href + mail;
  2938. }
  2939. return b + '<a href="' + href + '">' + mail + '</a>';
  2940. };
  2941. };
  2942. showdown.subParser('autoLinks', function (text, options, globals) {
  2943. 'use strict';
  2944. text = globals.converter._dispatch('autoLinks.before', text, options, globals);
  2945. text = text.replace(delimUrlRegex, replaceLink(options));
  2946. text = text.replace(delimMailRegex, replaceMail(options, globals));
  2947. text = globals.converter._dispatch('autoLinks.after', text, options, globals);
  2948. return text;
  2949. });
  2950. showdown.subParser('simplifiedAutoLinks', function (text, options, globals) {
  2951. 'use strict';
  2952. if (!options.simplifiedAutoLink) {
  2953. return text;
  2954. }
  2955. text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals);
  2956. if (options.excludeTrailingPunctuationFromURLs) {
  2957. text = text.replace(simpleURLRegex2, replaceLink(options));
  2958. } else {
  2959. text = text.replace(simpleURLRegex, replaceLink(options));
  2960. }
  2961. text = text.replace(simpleMailRegex, replaceMail(options, globals));
  2962. text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals);
  2963. return text;
  2964. });
  2965. /**
  2966. * These are all the transformations that form block-level
  2967. * tags like paragraphs, headers, and list items.
  2968. */
  2969. showdown.subParser('blockGamut', function (text, options, globals) {
  2970. 'use strict';
  2971. text = globals.converter._dispatch('blockGamut.before', text, options, globals);
  2972. // we parse blockquotes first so that we can have headings and hrs
  2973. // inside blockquotes
  2974. text = showdown.subParser('blockQuotes')(text, options, globals);
  2975. text = showdown.subParser('headers')(text, options, globals);
  2976. // Do Horizontal Rules:
  2977. text = showdown.subParser('horizontalRule')(text, options, globals);
  2978. text = showdown.subParser('lists')(text, options, globals);
  2979. text = showdown.subParser('codeBlocks')(text, options, globals);
  2980. text = showdown.subParser('tables')(text, options, globals);
  2981. // We already ran _HashHTMLBlocks() before, in Markdown(), but that
  2982. // was to escape raw HTML in the original Markdown source. This time,
  2983. // we're escaping the markup we've just created, so that we don't wrap
  2984. // <p> tags around block-level tags.
  2985. text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
  2986. text = showdown.subParser('paragraphs')(text, options, globals);
  2987. text = globals.converter._dispatch('blockGamut.after', text, options, globals);
  2988. return text;
  2989. });
  2990. showdown.subParser('blockQuotes', function (text, options, globals) {
  2991. 'use strict';
  2992. text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
  2993. // add a couple extra lines after the text and endtext mark
  2994. text = text + '\n\n';
  2995. var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
  2996. if (options.splitAdjacentBlockquotes) {
  2997. rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
  2998. }
  2999. text = text.replace(rgx, function (bq) {
  3000. // attacklab: hack around Konqueror 3.5.4 bug:
  3001. // "----------bug".replace(/^-/g,"") == "bug"
  3002. bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
  3003. // attacklab: clean up hack
  3004. bq = bq.replace(/¨0/g, '');
  3005. bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
  3006. bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
  3007. bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
  3008. bq = bq.replace(/(^|\n)/g, '$1 ');
  3009. // These leading spaces screw with <pre> content, so we need to fix that:
  3010. bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
  3011. var pre = m1;
  3012. // attacklab: hack around Konqueror 3.5.4 bug:
  3013. pre = pre.replace(/^ /mg, '¨0');
  3014. pre = pre.replace(/¨0/g, '');
  3015. return pre;
  3016. });
  3017. return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
  3018. });
  3019. text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
  3020. return text;
  3021. });
  3022. /**
  3023. * Process Markdown `<pre><code>` blocks.
  3024. */
  3025. showdown.subParser('codeBlocks', function (text, options, globals) {
  3026. 'use strict';
  3027. text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
  3028. // sentinel workarounds for lack of \A and \Z, safari\khtml bug
  3029. text += '¨0';
  3030. var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
  3031. text = text.replace(pattern, function (wholeMatch, m1, m2) {
  3032. var codeblock = m1,
  3033. nextChar = m2,
  3034. end = '\n';
  3035. codeblock = showdown.subParser('outdent')(codeblock, options, globals);
  3036. codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
  3037. codeblock = showdown.subParser('detab')(codeblock, options, globals);
  3038. codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
  3039. codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
  3040. if (options.omitExtraWLInCodeBlocks) {
  3041. end = '';
  3042. }
  3043. codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
  3044. return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
  3045. });
  3046. // strip sentinel
  3047. text = text.replace(/¨0/, '');
  3048. text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
  3049. return text;
  3050. });
  3051. /**
  3052. *
  3053. * * Backtick quotes are used for <code></code> spans.
  3054. *
  3055. * * You can use multiple backticks as the delimiters if you want to
  3056. * include literal backticks in the code span. So, this input:
  3057. *
  3058. * Just type ``foo `bar` baz`` at the prompt.
  3059. *
  3060. * Will translate to:
  3061. *
  3062. * <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
  3063. *
  3064. * There's no arbitrary limit to the number of backticks you
  3065. * can use as delimters. If you need three consecutive backticks
  3066. * in your code, use four for delimiters, etc.
  3067. *
  3068. * * You can use spaces to get literal backticks at the edges:
  3069. *
  3070. * ... type `` `bar` `` ...
  3071. *
  3072. * Turns to:
  3073. *
  3074. * ... type <code>`bar`</code> ...
  3075. */
  3076. showdown.subParser('codeSpans', function (text, options, globals) {
  3077. 'use strict';
  3078. text = globals.converter._dispatch('codeSpans.before', text, options, globals);
  3079. if (typeof(text) === 'undefined') {
  3080. text = '';
  3081. }
  3082. text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
  3083. function (wholeMatch, m1, m2, m3) {
  3084. var c = m3;
  3085. c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
  3086. c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
  3087. c = showdown.subParser('encodeCode')(c, options, globals);
  3088. c = m1 + '<code>' + c + '</code>';
  3089. c = showdown.subParser('hashHTMLSpans')(c, options, globals);
  3090. return c;
  3091. }
  3092. );
  3093. text = globals.converter._dispatch('codeSpans.after', text, options, globals);
  3094. return text;
  3095. });
  3096. /**
  3097. * Create a full HTML document from the processed markdown
  3098. */
  3099. showdown.subParser('completeHTMLDocument', function (text, options, globals) {
  3100. 'use strict';
  3101. if (!options.completeHTMLDocument) {
  3102. return text;
  3103. }
  3104. text = globals.converter._dispatch('completeHTMLDocument.before', text, options, globals);
  3105. var doctype = 'html',
  3106. doctypeParsed = '<!DOCTYPE HTML>\n',
  3107. title = '',
  3108. charset = '<meta charset="utf-8">\n',
  3109. lang = '',
  3110. metadata = '';
  3111. if (typeof globals.metadata.parsed.doctype !== 'undefined') {
  3112. doctypeParsed = '<!DOCTYPE ' + globals.metadata.parsed.doctype + '>\n';
  3113. doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
  3114. if (doctype === 'html' || doctype === 'html5') {
  3115. charset = '<meta charset="utf-8">';
  3116. }
  3117. }
  3118. for (var meta in globals.metadata.parsed) {
  3119. if (globals.metadata.parsed.hasOwnProperty(meta)) {
  3120. switch (meta.toLowerCase()) {
  3121. case 'doctype':
  3122. break;
  3123. case 'title':
  3124. title = '<title>' + globals.metadata.parsed.title + '</title>\n';
  3125. break;
  3126. case 'charset':
  3127. if (doctype === 'html' || doctype === 'html5') {
  3128. charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
  3129. } else {
  3130. charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
  3131. }
  3132. break;
  3133. case 'language':
  3134. case 'lang':
  3135. lang = ' lang="' + globals.metadata.parsed[meta] + '"';
  3136. metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
  3137. break;
  3138. default:
  3139. metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
  3140. }
  3141. }
  3142. }
  3143. text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
  3144. text = globals.converter._dispatch('completeHTMLDocument.after', text, options, globals);
  3145. return text;
  3146. });
  3147. /**
  3148. * Convert all tabs to spaces
  3149. */
  3150. showdown.subParser('detab', function (text, options, globals) {
  3151. 'use strict';
  3152. text = globals.converter._dispatch('detab.before', text, options, globals);
  3153. // expand first n-1 tabs
  3154. text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width
  3155. // replace the nth with two sentinels
  3156. text = text.replace(/\t/g, '¨A¨B');
  3157. // use the sentinel to anchor our regex so it doesn't explode
  3158. text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
  3159. var leadingText = m1,
  3160. numSpaces = 4 - leadingText.length % 4; // g_tab_width
  3161. // there *must* be a better way to do this:
  3162. for (var i = 0; i < numSpaces; i++) {
  3163. leadingText += ' ';
  3164. }
  3165. return leadingText;
  3166. });
  3167. // clean up sentinels
  3168. text = text.replace(/¨A/g, ' '); // g_tab_width
  3169. text = text.replace(/¨B/g, '');
  3170. text = globals.converter._dispatch('detab.after', text, options, globals);
  3171. return text;
  3172. });
  3173. showdown.subParser('ellipsis', function (text, options, globals) {
  3174. 'use strict';
  3175. text = globals.converter._dispatch('ellipsis.before', text, options, globals);
  3176. text = text.replace(/\.\.\./g, '…');
  3177. text = globals.converter._dispatch('ellipsis.after', text, options, globals);
  3178. return text;
  3179. });
  3180. /**
  3181. * Turn emoji codes into emojis
  3182. *
  3183. * List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
  3184. */
  3185. showdown.subParser('emoji', function (text, options, globals) {
  3186. 'use strict';
  3187. if (!options.emoji) {
  3188. return text;
  3189. }
  3190. text = globals.converter._dispatch('emoji.before', text, options, globals);
  3191. var emojiRgx = /:([\S]+?):/g;
  3192. text = text.replace(emojiRgx, function (wm, emojiCode) {
  3193. if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
  3194. return showdown.helper.emojis[emojiCode];
  3195. }
  3196. return wm;
  3197. });
  3198. text = globals.converter._dispatch('emoji.after', text, options, globals);
  3199. return text;
  3200. });
  3201. /**
  3202. * Smart processing for ampersands and angle brackets that need to be encoded.
  3203. */
  3204. showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) {
  3205. 'use strict';
  3206. text = globals.converter._dispatch('encodeAmpsAndAngles.before', text, options, globals);
  3207. // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
  3208. // http://bumppo.net/projects/amputator/
  3209. text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&amp;');
  3210. // Encode naked <'s
  3211. text = text.replace(/<(?![a-z\/?$!])/gi, '&lt;');
  3212. // Encode <
  3213. text = text.replace(/</g, '&lt;');
  3214. // Encode >
  3215. text = text.replace(/>/g, '&gt;');
  3216. text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
  3217. return text;
  3218. });
  3219. /**
  3220. * Returns the string, with after processing the following backslash escape sequences.
  3221. *
  3222. * attacklab: The polite way to do this is with the new escapeCharacters() function:
  3223. *
  3224. * text = escapeCharacters(text,"\\",true);
  3225. * text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
  3226. *
  3227. * ...but we're sidestepping its use of the (slow) RegExp constructor
  3228. * as an optimization for Firefox. This function gets called a LOT.
  3229. */
  3230. showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
  3231. 'use strict';
  3232. text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
  3233. text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
  3234. text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
  3235. text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
  3236. return text;
  3237. });
  3238. /**
  3239. * Encode/escape certain characters inside Markdown code runs.
  3240. * The point is that in code, these characters are literals,
  3241. * and lose their special Markdown meanings.
  3242. */
  3243. showdown.subParser('encodeCode', function (text, options, globals) {
  3244. 'use strict';
  3245. text = globals.converter._dispatch('encodeCode.before', text, options, globals);
  3246. // Encode all ampersands; HTML entities are not
  3247. // entities within a Markdown code span.
  3248. text = text
  3249. .replace(/&/g, '&amp;')
  3250. // Do the angle bracket song and dance:
  3251. .replace(/</g, '&lt;')
  3252. .replace(/>/g, '&gt;')
  3253. // Now, escape characters that are magic in Markdown:
  3254. .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
  3255. text = globals.converter._dispatch('encodeCode.after', text, options, globals);
  3256. return text;
  3257. });
  3258. /**
  3259. * Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
  3260. * don't conflict with their use in Markdown for code, italics and strong.
  3261. */
  3262. showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
  3263. 'use strict';
  3264. text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals);
  3265. // Build a regex to find HTML tags.
  3266. var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
  3267. comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
  3268. text = text.replace(tags, function (wholeMatch) {
  3269. return wholeMatch
  3270. .replace(/(.)<\/?code>(?=.)/g, '$1`')
  3271. .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
  3272. });
  3273. text = text.replace(comments, function (wholeMatch) {
  3274. return wholeMatch
  3275. .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
  3276. });
  3277. text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
  3278. return text;
  3279. });
  3280. /**
  3281. * Handle github codeblocks prior to running HashHTML so that
  3282. * HTML contained within the codeblock gets escaped properly
  3283. * Example:
  3284. * ```ruby
  3285. * def hello_world(x)
  3286. * puts "Hello, #{x}"
  3287. * end
  3288. * ```
  3289. */
  3290. showdown.subParser('githubCodeBlocks', function (text, options, globals) {
  3291. 'use strict';
  3292. // early exit if option is not enabled
  3293. if (!options.ghCodeBlocks) {
  3294. return text;
  3295. }
  3296. text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
  3297. text += '¨0';
  3298. text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
  3299. var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
  3300. // First parse the github code block
  3301. codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
  3302. codeblock = showdown.subParser('detab')(codeblock, options, globals);
  3303. codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
  3304. codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
  3305. codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
  3306. codeblock = showdown.subParser('hashBlock')(codeblock, options, globals);
  3307. // Since GHCodeblocks can be false positives, we need to
  3308. // store the primitive text and the parsed text in a global var,
  3309. // and then return a token
  3310. return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
  3311. });
  3312. // attacklab: strip sentinel
  3313. text = text.replace(/¨0/, '');
  3314. return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
  3315. });
  3316. showdown.subParser('hashBlock', function (text, options, globals) {
  3317. 'use strict';
  3318. text = globals.converter._dispatch('hashBlock.before', text, options, globals);
  3319. text = text.replace(/(^\n+|\n+$)/g, '');
  3320. text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
  3321. text = globals.converter._dispatch('hashBlock.after', text, options, globals);
  3322. return text;
  3323. });
  3324. /**
  3325. * Hash and escape <code> elements that should not be parsed as markdown
  3326. */
  3327. showdown.subParser('hashCodeTags', function (text, options, globals) {
  3328. 'use strict';
  3329. text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
  3330. var repFunc = function (wholeMatch, match, left, right) {
  3331. var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
  3332. return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
  3333. };
  3334. // Hash naked <code>
  3335. text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
  3336. text = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
  3337. return text;
  3338. });
  3339. showdown.subParser('hashElement', function (text, options, globals) {
  3340. 'use strict';
  3341. return function (wholeMatch, m1) {
  3342. var blockText = m1;
  3343. // Undo double lines
  3344. blockText = blockText.replace(/\n\n/g, '\n');
  3345. blockText = blockText.replace(/^\n/, '');
  3346. // strip trailing blank lines
  3347. blockText = blockText.replace(/\n+$/g, '');
  3348. // Replace the element text with a marker ("¨KxK" where x is its key)
  3349. blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
  3350. return blockText;
  3351. };
  3352. });
  3353. showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
  3354. 'use strict';
  3355. text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals);
  3356. var blockTags = [
  3357. 'pre',
  3358. 'div',
  3359. 'h1',
  3360. 'h2',
  3361. 'h3',
  3362. 'h4',
  3363. 'h5',
  3364. 'h6',
  3365. 'blockquote',
  3366. 'table',
  3367. 'dl',
  3368. 'ol',
  3369. 'ul',
  3370. 'script',
  3371. 'noscript',
  3372. 'form',
  3373. 'fieldset',
  3374. 'iframe',
  3375. 'math',
  3376. 'style',
  3377. 'section',
  3378. 'header',
  3379. 'footer',
  3380. 'nav',
  3381. 'article',
  3382. 'aside',
  3383. 'address',
  3384. 'audio',
  3385. 'canvas',
  3386. 'figure',
  3387. 'hgroup',
  3388. 'output',
  3389. 'video',
  3390. 'p'
  3391. ],
  3392. repFunc = function (wholeMatch, match, left, right) {
  3393. var txt = wholeMatch;
  3394. // check if this html element is marked as markdown
  3395. // if so, it's contents should be parsed as markdown
  3396. if (left.search(/\bmarkdown\b/) !== -1) {
  3397. txt = left + globals.converter.makeHtml(match) + right;
  3398. }
  3399. return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
  3400. };
  3401. if (options.backslashEscapesHTMLTags) {
  3402. // encode backslash escaped HTML tags
  3403. text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
  3404. return '&lt;' + inside + '&gt;';
  3405. });
  3406. }
  3407. // hash HTML Blocks
  3408. for (var i = 0; i < blockTags.length; ++i) {
  3409. var opTagPos,
  3410. rgx1 = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
  3411. patLeft = '<' + blockTags[i] + '\\b[^>]*>',
  3412. patRight = '</' + blockTags[i] + '>';
  3413. // 1. Look for the first position of the first opening HTML tag in the text
  3414. while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
  3415. // if the HTML tag is \ escaped, we need to escape it and break
  3416. //2. Split the text in that position
  3417. var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
  3418. //3. Match recursively
  3419. newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
  3420. // prevent an infinite loop
  3421. if (newSubText1 === subTexts[1]) {
  3422. break;
  3423. }
  3424. text = subTexts[0].concat(newSubText1);
  3425. }
  3426. }
  3427. // HR SPECIAL CASE
  3428. text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
  3429. showdown.subParser('hashElement')(text, options, globals));
  3430. // Special case for standalone HTML comments
  3431. text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
  3432. return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
  3433. }, '^ {0,3}<!--', '-->', 'gm');
  3434. // PHP and ASP-style processor instructions (<?...?> and <%...%>)
  3435. text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
  3436. showdown.subParser('hashElement')(text, options, globals));
  3437. text = globals.converter._dispatch('hashHTMLBlocks.after', text, options, globals);
  3438. return text;
  3439. });
  3440. /**
  3441. * Hash span elements that should not be parsed as markdown
  3442. */
  3443. showdown.subParser('hashHTMLSpans', function (text, options, globals) {
  3444. 'use strict';
  3445. text = globals.converter._dispatch('hashHTMLSpans.before', text, options, globals);
  3446. function hashHTMLSpan (html) {
  3447. return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
  3448. }
  3449. // Hash Self Closing tags
  3450. text = text.replace(/<[^>]+?\/>/gi, function (wm) {
  3451. return hashHTMLSpan(wm);
  3452. });
  3453. // Hash tags without properties
  3454. text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
  3455. return hashHTMLSpan(wm);
  3456. });
  3457. // Hash tags with properties
  3458. text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
  3459. return hashHTMLSpan(wm);
  3460. });
  3461. // Hash self closing tags without />
  3462. text = text.replace(/<[^>]+?>/gi, function (wm) {
  3463. return hashHTMLSpan(wm);
  3464. });
  3465. /*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/
  3466. text = globals.converter._dispatch('hashHTMLSpans.after', text, options, globals);
  3467. return text;
  3468. });
  3469. /**
  3470. * Unhash HTML spans
  3471. */
  3472. showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
  3473. 'use strict';
  3474. text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals);
  3475. for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
  3476. var repText = globals.gHtmlSpans[i],
  3477. // limiter to prevent infinite loop (assume 10 as limit for recurse)
  3478. limit = 0;
  3479. while (/¨C(\d+)C/.test(repText)) {
  3480. var num = RegExp.$1;
  3481. repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
  3482. if (limit === 10) {
  3483. console.error('maximum nesting of 10 spans reached!!!');
  3484. break;
  3485. }
  3486. ++limit;
  3487. }
  3488. text = text.replace('¨C' + i + 'C', repText);
  3489. }
  3490. text = globals.converter._dispatch('unhashHTMLSpans.after', text, options, globals);
  3491. return text;
  3492. });
  3493. /**
  3494. * Hash and escape <pre><code> elements that should not be parsed as markdown
  3495. */
  3496. showdown.subParser('hashPreCodeTags', function (text, options, globals) {
  3497. 'use strict';
  3498. text = globals.converter._dispatch('hashPreCodeTags.before', text, options, globals);
  3499. var repFunc = function (wholeMatch, match, left, right) {
  3500. // encode html entities
  3501. var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
  3502. return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
  3503. };
  3504. // Hash <pre><code>
  3505. text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
  3506. text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals);
  3507. return text;
  3508. });
  3509. showdown.subParser('headers', function (text, options, globals) {
  3510. 'use strict';
  3511. text = globals.converter._dispatch('headers.before', text, options, globals);
  3512. var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
  3513. // Set text-style headers:
  3514. // Header 1
  3515. // ========
  3516. //
  3517. // Header 2
  3518. // --------
  3519. //
  3520. setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
  3521. setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
  3522. text = text.replace(setextRegexH1, function (wholeMatch, m1) {
  3523. var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
  3524. hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
  3525. hLevel = headerLevelStart,
  3526. hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
  3527. return showdown.subParser('hashBlock')(hashBlock, options, globals);
  3528. });
  3529. text = text.replace(setextRegexH2, function (matchFound, m1) {
  3530. var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
  3531. hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
  3532. hLevel = headerLevelStart + 1,
  3533. hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
  3534. return showdown.subParser('hashBlock')(hashBlock, options, globals);
  3535. });
  3536. // atx-style headers:
  3537. // # Header 1
  3538. // ## Header 2
  3539. // ## Header 2 with closing hashes ##
  3540. // ...
  3541. // ###### Header 6
  3542. //
  3543. var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
  3544. text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
  3545. var hText = m2;
  3546. if (options.customizedHeaderId) {
  3547. hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
  3548. }
  3549. var span = showdown.subParser('spanGamut')(hText, options, globals),
  3550. hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
  3551. hLevel = headerLevelStart - 1 + m1.length,
  3552. header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
  3553. return showdown.subParser('hashBlock')(header, options, globals);
  3554. });
  3555. function headerId (m) {
  3556. var title,
  3557. prefix;
  3558. // It is separate from other options to allow combining prefix and customized
  3559. if (options.customizedHeaderId) {
  3560. var match = m.match(/\{([^{]+?)}\s*$/);
  3561. if (match && match[1]) {
  3562. m = match[1];
  3563. }
  3564. }
  3565. title = m;
  3566. // Prefix id to prevent causing inadvertent pre-existing style matches.
  3567. if (showdown.helper.isString(options.prefixHeaderId)) {
  3568. prefix = options.prefixHeaderId;
  3569. } else if (options.prefixHeaderId === true) {
  3570. prefix = 'section-';
  3571. } else {
  3572. prefix = '';
  3573. }
  3574. if (!options.rawPrefixHeaderId) {
  3575. title = prefix + title;
  3576. }
  3577. if (options.ghCompatibleHeaderId) {
  3578. title = title
  3579. .replace(/ /g, '-')
  3580. // replace previously escaped chars (&, ¨ and $)
  3581. .replace(/&amp;/g, '')
  3582. .replace(/¨T/g, '')
  3583. .replace(/¨D/g, '')
  3584. // replace rest of the chars (&~$ are repeated as they might have been escaped)
  3585. // borrowed from github's redcarpet (some they should produce similar results)
  3586. .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
  3587. .toLowerCase();
  3588. } else if (options.rawHeaderId) {
  3589. title = title
  3590. .replace(/ /g, '-')
  3591. // replace previously escaped chars (&, ¨ and $)
  3592. .replace(/&amp;/g, '&')
  3593. .replace(/¨T/g, '¨')
  3594. .replace(/¨D/g, '$')
  3595. // replace " and '
  3596. .replace(/["']/g, '-')
  3597. .toLowerCase();
  3598. } else {
  3599. title = title
  3600. .replace(/[^\w]/g, '')
  3601. .toLowerCase();
  3602. }
  3603. if (options.rawPrefixHeaderId) {
  3604. title = prefix + title;
  3605. }
  3606. if (globals.hashLinkCounts[title]) {
  3607. title = title + '-' + (globals.hashLinkCounts[title]++);
  3608. } else {
  3609. globals.hashLinkCounts[title] = 1;
  3610. }
  3611. return title;
  3612. }
  3613. text = globals.converter._dispatch('headers.after', text, options, globals);
  3614. return text;
  3615. });
  3616. /**
  3617. * Turn Markdown link shortcuts into XHTML <a> tags.
  3618. */
  3619. showdown.subParser('horizontalRule', function (text, options, globals) {
  3620. 'use strict';
  3621. text = globals.converter._dispatch('horizontalRule.before', text, options, globals);
  3622. var key = showdown.subParser('hashBlock')('<hr />', options, globals);
  3623. text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
  3624. text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
  3625. text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
  3626. text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
  3627. return text;
  3628. });
  3629. /**
  3630. * Turn Markdown image shortcuts into <img> tags.
  3631. */
  3632. showdown.subParser('images', function (text, options, globals) {
  3633. 'use strict';
  3634. text = globals.converter._dispatch('images.before', text, options, globals);
  3635. var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
  3636. crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
  3637. base64RegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
  3638. referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
  3639. refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
  3640. function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
  3641. url = url.replace(/\s/g, '');
  3642. return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
  3643. }
  3644. function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
  3645. var gUrls = globals.gUrls,
  3646. gTitles = globals.gTitles,
  3647. gDims = globals.gDimensions;
  3648. linkId = linkId.toLowerCase();
  3649. if (!title) {
  3650. title = '';
  3651. }
  3652. // Special case for explicit empty url
  3653. if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
  3654. url = '';
  3655. } else if (url === '' || url === null) {
  3656. if (linkId === '' || linkId === null) {
  3657. // lower-case and turn embedded newlines into spaces
  3658. linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
  3659. }
  3660. url = '#' + linkId;
  3661. if (!showdown.helper.isUndefined(gUrls[linkId])) {
  3662. url = gUrls[linkId];
  3663. if (!showdown.helper.isUndefined(gTitles[linkId])) {
  3664. title = gTitles[linkId];
  3665. }
  3666. if (!showdown.helper.isUndefined(gDims[linkId])) {
  3667. width = gDims[linkId].width;
  3668. height = gDims[linkId].height;
  3669. }
  3670. } else {
  3671. return wholeMatch;
  3672. }
  3673. }
  3674. altText = altText
  3675. .replace(/"/g, '&quot;')
  3676. //altText = showdown.helper.escapeCharacters(altText, '*_', false);
  3677. .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  3678. //url = showdown.helper.escapeCharacters(url, '*_', false);
  3679. url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  3680. var result = '<img src="' + url + '" alt="' + altText + '"';
  3681. if (title && showdown.helper.isString(title)) {
  3682. title = title
  3683. .replace(/"/g, '&quot;')
  3684. //title = showdown.helper.escapeCharacters(title, '*_', false);
  3685. .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  3686. result += ' title="' + title + '"';
  3687. }
  3688. if (width && height) {
  3689. width = (width === '*') ? 'auto' : width;
  3690. height = (height === '*') ? 'auto' : height;
  3691. result += ' width="' + width + '"';
  3692. result += ' height="' + height + '"';
  3693. }
  3694. result += ' />';
  3695. return result;
  3696. }
  3697. // First, handle reference-style labeled images: ![alt text][id]
  3698. text = text.replace(referenceRegExp, writeImageTag);
  3699. // Next, handle inline images: ![alt text](url =<width>x<height> "optional title")
  3700. // base64 encoded images
  3701. text = text.replace(base64RegExp, writeImageTagBase64);
  3702. // cases with crazy urls like ./image/cat1).png
  3703. text = text.replace(crazyRegExp, writeImageTag);
  3704. // normal cases
  3705. text = text.replace(inlineRegExp, writeImageTag);
  3706. // handle reference-style shortcuts: ![img text]
  3707. text = text.replace(refShortcutRegExp, writeImageTag);
  3708. text = globals.converter._dispatch('images.after', text, options, globals);
  3709. return text;
  3710. });
  3711. showdown.subParser('italicsAndBold', function (text, options, globals) {
  3712. 'use strict';
  3713. text = globals.converter._dispatch('italicsAndBold.before', text, options, globals);
  3714. // it's faster to have 3 separate regexes for each case than have just one
  3715. // because of backtracing, in some cases, it could lead to an exponential effect
  3716. // called "catastrophic backtrace". Ominous!
  3717. function parseInside (txt, left, right) {
  3718. /*
  3719. if (options.simplifiedAutoLink) {
  3720. txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
  3721. }
  3722. */
  3723. return left + txt + right;
  3724. }
  3725. // Parse underscores
  3726. if (options.literalMidWordUnderscores) {
  3727. text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
  3728. return parseInside (txt, '<strong><em>', '</em></strong>');
  3729. });
  3730. text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
  3731. return parseInside (txt, '<strong>', '</strong>');
  3732. });
  3733. text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
  3734. return parseInside (txt, '<em>', '</em>');
  3735. });
  3736. } else {
  3737. text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
  3738. return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
  3739. });
  3740. text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
  3741. return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
  3742. });
  3743. text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
  3744. // !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
  3745. return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
  3746. });
  3747. }
  3748. // Now parse asterisks
  3749. if (options.literalMidWordAsterisks) {
  3750. text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
  3751. return parseInside (txt, lead + '<strong><em>', '</em></strong>');
  3752. });
  3753. text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
  3754. return parseInside (txt, lead + '<strong>', '</strong>');
  3755. });
  3756. text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) {
  3757. return parseInside (txt, lead + '<em>', '</em>');
  3758. });
  3759. } else {
  3760. text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
  3761. return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
  3762. });
  3763. text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
  3764. return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
  3765. });
  3766. text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
  3767. // !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
  3768. return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
  3769. });
  3770. }
  3771. text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
  3772. return text;
  3773. });
  3774. /**
  3775. * Form HTML ordered (numbered) and unordered (bulleted) lists.
  3776. */
  3777. showdown.subParser('lists', function (text, options, globals) {
  3778. 'use strict';
  3779. /**
  3780. * Process the contents of a single ordered or unordered list, splitting it
  3781. * into individual list items.
  3782. * @param {string} listStr
  3783. * @param {boolean} trimTrailing
  3784. * @returns {string}
  3785. */
  3786. function processListItems (listStr, trimTrailing) {
  3787. // The $g_list_level global keeps track of when we're inside a list.
  3788. // Each time we enter a list, we increment it; when we leave a list,
  3789. // we decrement. If it's zero, we're not in a list anymore.
  3790. //
  3791. // We do this because when we're not inside a list, we want to treat
  3792. // something like this:
  3793. //
  3794. // I recommend upgrading to version
  3795. // 8. Oops, now this line is treated
  3796. // as a sub-list.
  3797. //
  3798. // As a single paragraph, despite the fact that the second line starts
  3799. // with a digit-period-space sequence.
  3800. //
  3801. // Whereas when we're inside a list (or sub-list), that line will be
  3802. // treated as the start of a sub-list. What a kludge, huh? This is
  3803. // an aspect of Markdown's syntax that's hard to parse perfectly
  3804. // without resorting to mind-reading. Perhaps the solution is to
  3805. // change the syntax rules such that sub-lists must start with a
  3806. // starting cardinal number; e.g. "1." or "a.".
  3807. globals.gListLevel++;
  3808. // trim trailing blank lines:
  3809. listStr = listStr.replace(/\n{2,}$/, '\n');
  3810. // attacklab: add sentinel to emulate \z
  3811. listStr += '¨0';
  3812. var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
  3813. isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
  3814. // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
  3815. // which is a syntax breaking change
  3816. // activating this option reverts to old behavior
  3817. if (options.disableForced4SpacesIndentedSublists) {
  3818. rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
  3819. }
  3820. listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
  3821. checked = (checked && checked.trim() !== '');
  3822. var item = showdown.subParser('outdent')(m4, options, globals),
  3823. bulletStyle = '';
  3824. // Support for github tasklists
  3825. if (taskbtn && options.tasklists) {
  3826. bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
  3827. item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
  3828. var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
  3829. if (checked) {
  3830. otp += ' checked';
  3831. }
  3832. otp += '>';
  3833. return otp;
  3834. });
  3835. }
  3836. // ISSUE #312
  3837. // This input: - - - a
  3838. // causes trouble to the parser, since it interprets it as:
  3839. // <ul><li><li><li>a</li></li></li></ul>
  3840. // instead of:
  3841. // <ul><li>- - a</li></ul>
  3842. // So, to prevent it, we will put a marker (¨A)in the beginning of the line
  3843. // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
  3844. item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
  3845. return '¨A' + wm2;
  3846. });
  3847. // m1 - Leading line or
  3848. // Has a double return (multi paragraph) or
  3849. // Has sublist
  3850. if (m1 || (item.search(/\n{2,}/) > -1)) {
  3851. item = showdown.subParser('githubCodeBlocks')(item, options, globals);
  3852. item = showdown.subParser('blockGamut')(item, options, globals);
  3853. } else {
  3854. // Recursion for sub-lists:
  3855. item = showdown.subParser('lists')(item, options, globals);
  3856. item = item.replace(/\n$/, ''); // chomp(item)
  3857. item = showdown.subParser('hashHTMLBlocks')(item, options, globals);
  3858. // Colapse double linebreaks
  3859. item = item.replace(/\n\n+/g, '\n\n');
  3860. if (isParagraphed) {
  3861. item = showdown.subParser('paragraphs')(item, options, globals);
  3862. } else {
  3863. item = showdown.subParser('spanGamut')(item, options, globals);
  3864. }
  3865. }
  3866. // now we need to remove the marker (¨A)
  3867. item = item.replace('¨A', '');
  3868. // we can finally wrap the line in list item tags
  3869. item = '<li' + bulletStyle + '>' + item + '</li>\n';
  3870. return item;
  3871. });
  3872. // attacklab: strip sentinel
  3873. listStr = listStr.replace(/¨0/g, '');
  3874. globals.gListLevel--;
  3875. if (trimTrailing) {
  3876. listStr = listStr.replace(/\s+$/, '');
  3877. }
  3878. return listStr;
  3879. }
  3880. function styleStartNumber (list, listType) {
  3881. // check if ol and starts by a number different than 1
  3882. if (listType === 'ol') {
  3883. var res = list.match(/^ *(\d+)\./);
  3884. if (res && res[1] !== '1') {
  3885. return ' start="' + res[1] + '"';
  3886. }
  3887. }
  3888. return '';
  3889. }
  3890. /**
  3891. * Check and parse consecutive lists (better fix for issue #142)
  3892. * @param {string} list
  3893. * @param {string} listType
  3894. * @param {boolean} trimTrailing
  3895. * @returns {string}
  3896. */
  3897. function parseConsecutiveLists (list, listType, trimTrailing) {
  3898. // check if we caught 2 or more consecutive lists by mistake
  3899. // we use the counterRgx, meaning if listType is UL we look for OL and vice versa
  3900. var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
  3901. ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm,
  3902. counterRxg = (listType === 'ul') ? olRgx : ulRgx,
  3903. result = '';
  3904. if (list.search(counterRxg) !== -1) {
  3905. (function parseCL (txt) {
  3906. var pos = txt.search(counterRxg),
  3907. style = styleStartNumber(list, listType);
  3908. if (pos !== -1) {
  3909. // slice
  3910. result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
  3911. // invert counterType and listType
  3912. listType = (listType === 'ul') ? 'ol' : 'ul';
  3913. counterRxg = (listType === 'ul') ? olRgx : ulRgx;
  3914. //recurse
  3915. parseCL(txt.slice(pos));
  3916. } else {
  3917. result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
  3918. }
  3919. })(list);
  3920. } else {
  3921. var style = styleStartNumber(list, listType);
  3922. result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
  3923. }
  3924. return result;
  3925. }
  3926. /** Start of list parsing **/
  3927. text = globals.converter._dispatch('lists.before', text, options, globals);
  3928. // add sentinel to hack around khtml/safari bug:
  3929. // http://bugs.webkit.org/show_bug.cgi?id=11231
  3930. text += '¨0';
  3931. if (globals.gListLevel) {
  3932. text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
  3933. function (wholeMatch, list, m2) {
  3934. var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
  3935. return parseConsecutiveLists(list, listType, true);
  3936. }
  3937. );
  3938. } else {
  3939. text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
  3940. function (wholeMatch, m1, list, m3) {
  3941. var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
  3942. return parseConsecutiveLists(list, listType, false);
  3943. }
  3944. );
  3945. }
  3946. // strip sentinel
  3947. text = text.replace(/¨0/, '');
  3948. text = globals.converter._dispatch('lists.after', text, options, globals);
  3949. return text;
  3950. });
  3951. /**
  3952. * Parse metadata at the top of the document
  3953. */
  3954. showdown.subParser('metadata', function (text, options, globals) {
  3955. 'use strict';
  3956. if (!options.metadata) {
  3957. return text;
  3958. }
  3959. text = globals.converter._dispatch('metadata.before', text, options, globals);
  3960. function parseMetadataContents (content) {
  3961. // raw is raw so it's not changed in any way
  3962. globals.metadata.raw = content;
  3963. // escape chars forbidden in html attributes
  3964. // double quotes
  3965. content = content
  3966. // ampersand first
  3967. .replace(/&/g, '&amp;')
  3968. // double quotes
  3969. .replace(/"/g, '&quot;');
  3970. content = content.replace(/\n {4}/g, ' ');
  3971. content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) {
  3972. globals.metadata.parsed[key] = value;
  3973. return '';
  3974. });
  3975. }
  3976. text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
  3977. parseMetadataContents(content);
  3978. return '¨M';
  3979. });
  3980. text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
  3981. if (format) {
  3982. globals.metadata.format = format;
  3983. }
  3984. parseMetadataContents(content);
  3985. return '¨M';
  3986. });
  3987. text = text.replace(/¨M/g, '');
  3988. text = globals.converter._dispatch('metadata.after', text, options, globals);
  3989. return text;
  3990. });
  3991. /**
  3992. * Remove one level of line-leading tabs or spaces
  3993. */
  3994. showdown.subParser('outdent', function (text, options, globals) {
  3995. 'use strict';
  3996. text = globals.converter._dispatch('outdent.before', text, options, globals);
  3997. // attacklab: hack around Konqueror 3.5.4 bug:
  3998. // "----------bug".replace(/^-/g,"") == "bug"
  3999. text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width
  4000. // attacklab: clean up hack
  4001. text = text.replace(/¨0/g, '');
  4002. text = globals.converter._dispatch('outdent.after', text, options, globals);
  4003. return text;
  4004. });
  4005. /**
  4006. *
  4007. */
  4008. showdown.subParser('paragraphs', function (text, options, globals) {
  4009. 'use strict';
  4010. text = globals.converter._dispatch('paragraphs.before', text, options, globals);
  4011. // Strip leading and trailing lines:
  4012. text = text.replace(/^\n+/g, '');
  4013. text = text.replace(/\n+$/g, '');
  4014. var grafs = text.split(/\n{2,}/g),
  4015. grafsOut = [],
  4016. end = grafs.length; // Wrap <p> tags
  4017. for (var i = 0; i < end; i++) {
  4018. var str = grafs[i];
  4019. // if this is an HTML marker, copy it
  4020. if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
  4021. grafsOut.push(str);
  4022. // test for presence of characters to prevent empty lines being parsed
  4023. // as paragraphs (resulting in undesired extra empty paragraphs)
  4024. } else if (str.search(/\S/) >= 0) {
  4025. str = showdown.subParser('spanGamut')(str, options, globals);
  4026. str = str.replace(/^([ \t]*)/g, '<p>');
  4027. str += '</p>';
  4028. grafsOut.push(str);
  4029. }
  4030. }
  4031. /** Unhashify HTML blocks */
  4032. end = grafsOut.length;
  4033. for (i = 0; i < end; i++) {
  4034. var blockText = '',
  4035. grafsOutIt = grafsOut[i],
  4036. codeFlag = false;
  4037. // if this is a marker for an html block...
  4038. // use RegExp.test instead of string.search because of QML bug
  4039. while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
  4040. var delim = RegExp.$1,
  4041. num = RegExp.$2;
  4042. if (delim === 'K') {
  4043. blockText = globals.gHtmlBlocks[num];
  4044. } else {
  4045. // we need to check if ghBlock is a false positive
  4046. if (codeFlag) {
  4047. // use encoded version of all text
  4048. blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text, options, globals);
  4049. } else {
  4050. blockText = globals.ghCodeBlocks[num].codeblock;
  4051. }
  4052. }
  4053. blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs
  4054. grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
  4055. // Check if grafsOutIt is a pre->code
  4056. if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
  4057. codeFlag = true;
  4058. }
  4059. }
  4060. grafsOut[i] = grafsOutIt;
  4061. }
  4062. text = grafsOut.join('\n');
  4063. // Strip leading and trailing lines:
  4064. text = text.replace(/^\n+/g, '');
  4065. text = text.replace(/\n+$/g, '');
  4066. return globals.converter._dispatch('paragraphs.after', text, options, globals);
  4067. });
  4068. /**
  4069. * Run extension
  4070. */
  4071. showdown.subParser('runExtension', function (ext, text, options, globals) {
  4072. 'use strict';
  4073. if (ext.filter) {
  4074. text = ext.filter(text, globals.converter, options);
  4075. } else if (ext.regex) {
  4076. // TODO remove this when old extension loading mechanism is deprecated
  4077. var re = ext.regex;
  4078. if (!(re instanceof RegExp)) {
  4079. re = new RegExp(re, 'g');
  4080. }
  4081. text = text.replace(re, ext.replace);
  4082. }
  4083. return text;
  4084. });
  4085. /**
  4086. * These are all the transformations that occur *within* block-level
  4087. * tags like paragraphs, headers, and list items.
  4088. */
  4089. showdown.subParser('spanGamut', function (text, options, globals) {
  4090. 'use strict';
  4091. text = globals.converter._dispatch('spanGamut.before', text, options, globals);
  4092. text = showdown.subParser('codeSpans')(text, options, globals);
  4093. text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals);
  4094. text = showdown.subParser('encodeBackslashEscapes')(text, options, globals);
  4095. // Process anchor and image tags. Images must come first,
  4096. // because ![foo][f] looks like an anchor.
  4097. text = showdown.subParser('images')(text, options, globals);
  4098. text = showdown.subParser('anchors')(text, options, globals);
  4099. // Make links out of things like `<http://example.com/>`
  4100. // Must come after anchors, because you can use < and >
  4101. // delimiters in inline links like [this](<url>).
  4102. text = showdown.subParser('autoLinks')(text, options, globals);
  4103. text = showdown.subParser('simplifiedAutoLinks')(text, options, globals);
  4104. text = showdown.subParser('emoji')(text, options, globals);
  4105. text = showdown.subParser('underline')(text, options, globals);
  4106. text = showdown.subParser('italicsAndBold')(text, options, globals);
  4107. text = showdown.subParser('strikethrough')(text, options, globals);
  4108. text = showdown.subParser('ellipsis')(text, options, globals);
  4109. // we need to hash HTML tags inside spans
  4110. text = showdown.subParser('hashHTMLSpans')(text, options, globals);
  4111. // now we encode amps and angles
  4112. text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
  4113. // Do hard breaks
  4114. if (options.simpleLineBreaks) {
  4115. // GFM style hard breaks
  4116. // only add line breaks if the text does not contain a block (special case for lists)
  4117. if (!/\n\n¨K/.test(text)) {
  4118. text = text.replace(/\n+/g, '<br />\n');
  4119. }
  4120. } else {
  4121. // Vanilla hard breaks
  4122. text = text.replace(/ +\n/g, '<br />\n');
  4123. }
  4124. text = globals.converter._dispatch('spanGamut.after', text, options, globals);
  4125. return text;
  4126. });
  4127. showdown.subParser('strikethrough', function (text, options, globals) {
  4128. 'use strict';
  4129. function parseInside (txt) {
  4130. if (options.simplifiedAutoLink) {
  4131. txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
  4132. }
  4133. return '<del>' + txt + '</del>';
  4134. }
  4135. if (options.strikethrough) {
  4136. text = globals.converter._dispatch('strikethrough.before', text, options, globals);
  4137. text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
  4138. text = globals.converter._dispatch('strikethrough.after', text, options, globals);
  4139. }
  4140. return text;
  4141. });
  4142. /**
  4143. * Strips link definitions from text, stores the URLs and titles in
  4144. * hash references.
  4145. * Link defs are in the form: ^[id]: url "optional title"
  4146. */
  4147. showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
  4148. 'use strict';
  4149. var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
  4150. base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
  4151. // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
  4152. text += '¨0';
  4153. var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) {
  4154. linkId = linkId.toLowerCase();
  4155. if (url.match(/^data:.+?\/.+?;base64,/)) {
  4156. // remove newlines
  4157. globals.gUrls[linkId] = url.replace(/\s/g, '');
  4158. } else {
  4159. globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url, options, globals); // Link IDs are case-insensitive
  4160. }
  4161. if (blankLines) {
  4162. // Oops, found blank lines, so it's not a title.
  4163. // Put back the parenthetical statement we stole.
  4164. return blankLines + title;
  4165. } else {
  4166. if (title) {
  4167. globals.gTitles[linkId] = title.replace(/"|'/g, '&quot;');
  4168. }
  4169. if (options.parseImgDimensions && width && height) {
  4170. globals.gDimensions[linkId] = {
  4171. width: width,
  4172. height: height
  4173. };
  4174. }
  4175. }
  4176. // Completely remove the definition from the text
  4177. return '';
  4178. };
  4179. // first we try to find base64 link references
  4180. text = text.replace(base64Regex, replaceFunc);
  4181. text = text.replace(regex, replaceFunc);
  4182. // attacklab: strip sentinel
  4183. text = text.replace(/¨0/, '');
  4184. return text;
  4185. });
  4186. showdown.subParser('tables', function (text, options, globals) {
  4187. 'use strict';
  4188. if (!options.tables) {
  4189. return text;
  4190. }
  4191. var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
  4192. //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
  4193. singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
  4194. function parseStyles (sLine) {
  4195. if (/^:[ \t]*--*$/.test(sLine)) {
  4196. return ' style="text-align:left;"';
  4197. } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
  4198. return ' style="text-align:right;"';
  4199. } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
  4200. return ' style="text-align:center;"';
  4201. } else {
  4202. return '';
  4203. }
  4204. }
  4205. function parseHeaders (header, style) {
  4206. var id = '';
  4207. header = header.trim();
  4208. // support both tablesHeaderId and tableHeaderId due to error in documentation so we don't break backwards compatibility
  4209. if (options.tablesHeaderId || options.tableHeaderId) {
  4210. id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
  4211. }
  4212. header = showdown.subParser('spanGamut')(header, options, globals);
  4213. return '<th' + id + style + '>' + header + '</th>\n';
  4214. }
  4215. function parseCells (cell, style) {
  4216. var subText = showdown.subParser('spanGamut')(cell, options, globals);
  4217. return '<td' + style + '>' + subText + '</td>\n';
  4218. }
  4219. function buildTable (headers, cells) {
  4220. var tb = '<table>\n<thead>\n<tr>\n',
  4221. tblLgn = headers.length;
  4222. for (var i = 0; i < tblLgn; ++i) {
  4223. tb += headers[i];
  4224. }
  4225. tb += '</tr>\n</thead>\n<tbody>\n';
  4226. for (i = 0; i < cells.length; ++i) {
  4227. tb += '<tr>\n';
  4228. for (var ii = 0; ii < tblLgn; ++ii) {
  4229. tb += cells[i][ii];
  4230. }
  4231. tb += '</tr>\n';
  4232. }
  4233. tb += '</tbody>\n</table>\n';
  4234. return tb;
  4235. }
  4236. function parseTable (rawTable) {
  4237. var i, tableLines = rawTable.split('\n');
  4238. for (i = 0; i < tableLines.length; ++i) {
  4239. // strip wrong first and last column if wrapped tables are used
  4240. if (/^ {0,3}\|/.test(tableLines[i])) {
  4241. tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, '');
  4242. }
  4243. if (/\|[ \t]*$/.test(tableLines[i])) {
  4244. tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
  4245. }
  4246. // parse code spans first, but we only support one line code spans
  4247. tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals);
  4248. }
  4249. var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
  4250. rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}),
  4251. rawCells = [],
  4252. headers = [],
  4253. styles = [],
  4254. cells = [];
  4255. tableLines.shift();
  4256. tableLines.shift();
  4257. for (i = 0; i < tableLines.length; ++i) {
  4258. if (tableLines[i].trim() === '') {
  4259. continue;
  4260. }
  4261. rawCells.push(
  4262. tableLines[i]
  4263. .split('|')
  4264. .map(function (s) {
  4265. return s.trim();
  4266. })
  4267. );
  4268. }
  4269. if (rawHeaders.length < rawStyles.length) {
  4270. return rawTable;
  4271. }
  4272. for (i = 0; i < rawStyles.length; ++i) {
  4273. styles.push(parseStyles(rawStyles[i]));
  4274. }
  4275. for (i = 0; i < rawHeaders.length; ++i) {
  4276. if (showdown.helper.isUndefined(styles[i])) {
  4277. styles[i] = '';
  4278. }
  4279. headers.push(parseHeaders(rawHeaders[i], styles[i]));
  4280. }
  4281. for (i = 0; i < rawCells.length; ++i) {
  4282. var row = [];
  4283. for (var ii = 0; ii < headers.length; ++ii) {
  4284. if (showdown.helper.isUndefined(rawCells[i][ii])) {
  4285. }
  4286. row.push(parseCells(rawCells[i][ii], styles[ii]));
  4287. }
  4288. cells.push(row);
  4289. }
  4290. return buildTable(headers, cells);
  4291. }
  4292. text = globals.converter._dispatch('tables.before', text, options, globals);
  4293. // find escaped pipe characters
  4294. text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback);
  4295. // parse multi column tables
  4296. text = text.replace(tableRgx, parseTable);
  4297. // parse one column tables
  4298. text = text.replace(singeColTblRgx, parseTable);
  4299. text = globals.converter._dispatch('tables.after', text, options, globals);
  4300. return text;
  4301. });
  4302. showdown.subParser('underline', function (text, options, globals) {
  4303. 'use strict';
  4304. if (!options.underline) {
  4305. return text;
  4306. }
  4307. text = globals.converter._dispatch('underline.before', text, options, globals);
  4308. if (options.literalMidWordUnderscores) {
  4309. text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
  4310. return '<u>' + txt + '</u>';
  4311. });
  4312. text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
  4313. return '<u>' + txt + '</u>';
  4314. });
  4315. } else {
  4316. text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
  4317. return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
  4318. });
  4319. text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
  4320. return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
  4321. });
  4322. }
  4323. // escape remaining underscores to prevent them being parsed by italic and bold
  4324. text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
  4325. text = globals.converter._dispatch('underline.after', text, options, globals);
  4326. return text;
  4327. });
  4328. /**
  4329. * Swap back in all the special characters we've hidden.
  4330. */
  4331. showdown.subParser('unescapeSpecialChars', function (text, options, globals) {
  4332. 'use strict';
  4333. text = globals.converter._dispatch('unescapeSpecialChars.before', text, options, globals);
  4334. text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
  4335. var charCodeToReplace = parseInt(m1);
  4336. return String.fromCharCode(charCodeToReplace);
  4337. });
  4338. text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals);
  4339. return text;
  4340. });
  4341. showdown.subParser('makeMarkdown.blockquote', function (node, globals) {
  4342. 'use strict';
  4343. var txt = '';
  4344. if (node.hasChildNodes()) {
  4345. var children = node.childNodes,
  4346. childrenLength = children.length;
  4347. for (var i = 0; i < childrenLength; ++i) {
  4348. var innerTxt = showdown.subParser('makeMarkdown.node')(children[i], globals);
  4349. if (innerTxt === '') {
  4350. continue;
  4351. }
  4352. txt += innerTxt;
  4353. }
  4354. }
  4355. // cleanup
  4356. txt = txt.trim();
  4357. txt = '> ' + txt.split('\n').join('\n> ');
  4358. return txt;
  4359. });
  4360. showdown.subParser('makeMarkdown.codeBlock', function (node, globals) {
  4361. 'use strict';
  4362. var lang = node.getAttribute('language'),
  4363. num = node.getAttribute('precodenum');
  4364. return '```' + lang + '\n' + globals.preList[num] + '\n```';
  4365. });
  4366. showdown.subParser('makeMarkdown.codeSpan', function (node) {
  4367. 'use strict';
  4368. return '`' + node.innerHTML + '`';
  4369. });
  4370. showdown.subParser('makeMarkdown.emphasis', function (node, globals) {
  4371. 'use strict';
  4372. var txt = '';
  4373. if (node.hasChildNodes()) {
  4374. txt += '*';
  4375. var children = node.childNodes,
  4376. childrenLength = children.length;
  4377. for (var i = 0; i < childrenLength; ++i) {
  4378. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4379. }
  4380. txt += '*';
  4381. }
  4382. return txt;
  4383. });
  4384. showdown.subParser('makeMarkdown.header', function (node, globals, headerLevel) {
  4385. 'use strict';
  4386. var headerMark = new Array(headerLevel + 1).join('#'),
  4387. txt = '';
  4388. if (node.hasChildNodes()) {
  4389. txt = headerMark + ' ';
  4390. var children = node.childNodes,
  4391. childrenLength = children.length;
  4392. for (var i = 0; i < childrenLength; ++i) {
  4393. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4394. }
  4395. }
  4396. return txt;
  4397. });
  4398. showdown.subParser('makeMarkdown.hr', function () {
  4399. 'use strict';
  4400. return '---';
  4401. });
  4402. showdown.subParser('makeMarkdown.image', function (node) {
  4403. 'use strict';
  4404. var txt = '';
  4405. if (node.hasAttribute('src')) {
  4406. txt += '![' + node.getAttribute('alt') + '](';
  4407. txt += '<' + node.getAttribute('src') + '>';
  4408. if (node.hasAttribute('width') && node.hasAttribute('height')) {
  4409. txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height');
  4410. }
  4411. if (node.hasAttribute('title')) {
  4412. txt += ' "' + node.getAttribute('title') + '"';
  4413. }
  4414. txt += ')';
  4415. }
  4416. return txt;
  4417. });
  4418. showdown.subParser('makeMarkdown.links', function (node, globals) {
  4419. 'use strict';
  4420. var txt = '';
  4421. if (node.hasChildNodes() && node.hasAttribute('href')) {
  4422. var children = node.childNodes,
  4423. childrenLength = children.length;
  4424. txt = '[';
  4425. for (var i = 0; i < childrenLength; ++i) {
  4426. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4427. }
  4428. txt += '](';
  4429. txt += '<' + node.getAttribute('href') + '>';
  4430. if (node.hasAttribute('title')) {
  4431. txt += ' "' + node.getAttribute('title') + '"';
  4432. }
  4433. txt += ')';
  4434. }
  4435. return txt;
  4436. });
  4437. showdown.subParser('makeMarkdown.list', function (node, globals, type) {
  4438. 'use strict';
  4439. var txt = '';
  4440. if (!node.hasChildNodes()) {
  4441. return '';
  4442. }
  4443. var listItems = node.childNodes,
  4444. listItemsLenght = listItems.length,
  4445. listNum = node.getAttribute('start') || 1;
  4446. for (var i = 0; i < listItemsLenght; ++i) {
  4447. if (typeof listItems[i].tagName === 'undefined' || listItems[i].tagName.toLowerCase() !== 'li') {
  4448. continue;
  4449. }
  4450. // define the bullet to use in list
  4451. var bullet = '';
  4452. if (type === 'ol') {
  4453. bullet = listNum.toString() + '. ';
  4454. } else {
  4455. bullet = '- ';
  4456. }
  4457. // parse list item
  4458. txt += bullet + showdown.subParser('makeMarkdown.listItem')(listItems[i], globals);
  4459. ++listNum;
  4460. }
  4461. // add comment at the end to prevent consecutive lists to be parsed as one
  4462. txt += '\n<!-- -->\n';
  4463. return txt.trim();
  4464. });
  4465. showdown.subParser('makeMarkdown.listItem', function (node, globals) {
  4466. 'use strict';
  4467. var listItemTxt = '';
  4468. var children = node.childNodes,
  4469. childrenLenght = children.length;
  4470. for (var i = 0; i < childrenLenght; ++i) {
  4471. listItemTxt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4472. }
  4473. // if it's only one liner, we need to add a newline at the end
  4474. if (!/\n$/.test(listItemTxt)) {
  4475. listItemTxt += '\n';
  4476. } else {
  4477. // it's multiparagraph, so we need to indent
  4478. listItemTxt = listItemTxt
  4479. .split('\n')
  4480. .join('\n ')
  4481. .replace(/^ {4}$/gm, '')
  4482. .replace(/\n\n+/g, '\n\n');
  4483. }
  4484. return listItemTxt;
  4485. });
  4486. showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) {
  4487. 'use strict';
  4488. spansOnly = spansOnly || false;
  4489. var txt = '';
  4490. // edge case of text without wrapper paragraph
  4491. if (node.nodeType === 3) {
  4492. return showdown.subParser('makeMarkdown.txt')(node, globals);
  4493. }
  4494. // HTML comment
  4495. if (node.nodeType === 8) {
  4496. return '<!--' + node.data + '-->\n\n';
  4497. }
  4498. // process only node elements
  4499. if (node.nodeType !== 1) {
  4500. return '';
  4501. }
  4502. var tagName = node.tagName.toLowerCase();
  4503. switch (tagName) {
  4504. //
  4505. // BLOCKS
  4506. //
  4507. case 'h1':
  4508. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 1) + '\n\n'; }
  4509. break;
  4510. case 'h2':
  4511. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 2) + '\n\n'; }
  4512. break;
  4513. case 'h3':
  4514. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 3) + '\n\n'; }
  4515. break;
  4516. case 'h4':
  4517. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 4) + '\n\n'; }
  4518. break;
  4519. case 'h5':
  4520. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 5) + '\n\n'; }
  4521. break;
  4522. case 'h6':
  4523. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 6) + '\n\n'; }
  4524. break;
  4525. case 'p':
  4526. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.paragraph')(node, globals) + '\n\n'; }
  4527. break;
  4528. case 'blockquote':
  4529. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.blockquote')(node, globals) + '\n\n'; }
  4530. break;
  4531. case 'hr':
  4532. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.hr')(node, globals) + '\n\n'; }
  4533. break;
  4534. case 'ol':
  4535. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ol') + '\n\n'; }
  4536. break;
  4537. case 'ul':
  4538. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ul') + '\n\n'; }
  4539. break;
  4540. case 'precode':
  4541. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.codeBlock')(node, globals) + '\n\n'; }
  4542. break;
  4543. case 'pre':
  4544. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.pre')(node, globals) + '\n\n'; }
  4545. break;
  4546. case 'table':
  4547. if (!spansOnly) { txt = showdown.subParser('makeMarkdown.table')(node, globals) + '\n\n'; }
  4548. break;
  4549. //
  4550. // SPANS
  4551. //
  4552. case 'code':
  4553. txt = showdown.subParser('makeMarkdown.codeSpan')(node, globals);
  4554. break;
  4555. case 'em':
  4556. case 'i':
  4557. txt = showdown.subParser('makeMarkdown.emphasis')(node, globals);
  4558. break;
  4559. case 'strong':
  4560. case 'b':
  4561. txt = showdown.subParser('makeMarkdown.strong')(node, globals);
  4562. break;
  4563. case 'del':
  4564. txt = showdown.subParser('makeMarkdown.strikethrough')(node, globals);
  4565. break;
  4566. case 'a':
  4567. txt = showdown.subParser('makeMarkdown.links')(node, globals);
  4568. break;
  4569. case 'img':
  4570. txt = showdown.subParser('makeMarkdown.image')(node, globals);
  4571. break;
  4572. default:
  4573. txt = node.outerHTML + '\n\n';
  4574. }
  4575. // common normalization
  4576. // TODO eventually
  4577. return txt;
  4578. });
  4579. showdown.subParser('makeMarkdown.paragraph', function (node, globals) {
  4580. 'use strict';
  4581. var txt = '';
  4582. if (node.hasChildNodes()) {
  4583. var children = node.childNodes,
  4584. childrenLength = children.length;
  4585. for (var i = 0; i < childrenLength; ++i) {
  4586. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4587. }
  4588. }
  4589. // some text normalization
  4590. txt = txt.trim();
  4591. return txt;
  4592. });
  4593. showdown.subParser('makeMarkdown.pre', function (node, globals) {
  4594. 'use strict';
  4595. var num = node.getAttribute('prenum');
  4596. return '<pre>' + globals.preList[num] + '</pre>';
  4597. });
  4598. showdown.subParser('makeMarkdown.strikethrough', function (node, globals) {
  4599. 'use strict';
  4600. var txt = '';
  4601. if (node.hasChildNodes()) {
  4602. txt += '~~';
  4603. var children = node.childNodes,
  4604. childrenLength = children.length;
  4605. for (var i = 0; i < childrenLength; ++i) {
  4606. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4607. }
  4608. txt += '~~';
  4609. }
  4610. return txt;
  4611. });
  4612. showdown.subParser('makeMarkdown.strong', function (node, globals) {
  4613. 'use strict';
  4614. var txt = '';
  4615. if (node.hasChildNodes()) {
  4616. txt += '**';
  4617. var children = node.childNodes,
  4618. childrenLength = children.length;
  4619. for (var i = 0; i < childrenLength; ++i) {
  4620. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  4621. }
  4622. txt += '**';
  4623. }
  4624. return txt;
  4625. });
  4626. showdown.subParser('makeMarkdown.table', function (node, globals) {
  4627. 'use strict';
  4628. var txt = '',
  4629. tableArray = [[], []],
  4630. headings = node.querySelectorAll('thead>tr>th'),
  4631. rows = node.querySelectorAll('tbody>tr'),
  4632. i, ii;
  4633. for (i = 0; i < headings.length; ++i) {
  4634. var headContent = showdown.subParser('makeMarkdown.tableCell')(headings[i], globals),
  4635. allign = '---';
  4636. if (headings[i].hasAttribute('style')) {
  4637. var style = headings[i].getAttribute('style').toLowerCase().replace(/\s/g, '');
  4638. switch (style) {
  4639. case 'text-align:left;':
  4640. allign = ':---';
  4641. break;
  4642. case 'text-align:right;':
  4643. allign = '---:';
  4644. break;
  4645. case 'text-align:center;':
  4646. allign = ':---:';
  4647. break;
  4648. }
  4649. }
  4650. tableArray[0][i] = headContent.trim();
  4651. tableArray[1][i] = allign;
  4652. }
  4653. for (i = 0; i < rows.length; ++i) {
  4654. var r = tableArray.push([]) - 1,
  4655. cols = rows[i].getElementsByTagName('td');
  4656. for (ii = 0; ii < headings.length; ++ii) {
  4657. var cellContent = ' ';
  4658. if (typeof cols[ii] !== 'undefined') {
  4659. cellContent = showdown.subParser('makeMarkdown.tableCell')(cols[ii], globals);
  4660. }
  4661. tableArray[r].push(cellContent);
  4662. }
  4663. }
  4664. var cellSpacesCount = 3;
  4665. for (i = 0; i < tableArray.length; ++i) {
  4666. for (ii = 0; ii < tableArray[i].length; ++ii) {
  4667. var strLen = tableArray[i][ii].length;
  4668. if (strLen > cellSpacesCount) {
  4669. cellSpacesCount = strLen;
  4670. }
  4671. }
  4672. }
  4673. for (i = 0; i < tableArray.length; ++i) {
  4674. for (ii = 0; ii < tableArray[i].length; ++ii) {
  4675. if (i === 1) {
  4676. if (tableArray[i][ii].slice(-1) === ':') {
  4677. tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':';
  4678. } else {
  4679. tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-');
  4680. }
  4681. } else {
  4682. tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount);
  4683. }
  4684. }
  4685. txt += '| ' + tableArray[i].join(' | ') + ' |\n';
  4686. }
  4687. return txt.trim();
  4688. });
  4689. showdown.subParser('makeMarkdown.tableCell', function (node, globals) {
  4690. 'use strict';
  4691. var txt = '';
  4692. if (!node.hasChildNodes()) {
  4693. return '';
  4694. }
  4695. var children = node.childNodes,
  4696. childrenLength = children.length;
  4697. for (var i = 0; i < childrenLength; ++i) {
  4698. txt += showdown.subParser('makeMarkdown.node')(children[i], globals, true);
  4699. }
  4700. return txt.trim();
  4701. });
  4702. showdown.subParser('makeMarkdown.txt', function (node) {
  4703. 'use strict';
  4704. var txt = node.nodeValue;
  4705. // multiple spaces are collapsed
  4706. txt = txt.replace(/ +/g, ' ');
  4707. // replace the custom ¨NBSP; with a space
  4708. txt = txt.replace(/¨NBSP;/g, ' ');
  4709. // ", <, > and & should replace escaped html entities
  4710. txt = showdown.helper.unescapeHTMLEntities(txt);
  4711. // escape markdown magic characters
  4712. // emphasis, strong and strikethrough - can appear everywhere
  4713. // we also escape pipe (|) because of tables
  4714. // and escape ` because of code blocks and spans
  4715. txt = txt.replace(/([*_~|`])/g, '\\$1');
  4716. // escape > because of blockquotes
  4717. txt = txt.replace(/^(\s*)>/g, '\\$1>');
  4718. // hash character, only troublesome at the beginning of a line because of headers
  4719. txt = txt.replace(/^#/gm, '\\#');
  4720. // horizontal rules
  4721. txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, '$1\\$2$3');
  4722. // dot, because of ordered lists, only troublesome at the beginning of a line when preceded by an integer
  4723. txt = txt.replace(/^( {0,3}\d+)\./gm, '$1\\.');
  4724. // +, * and -, at the beginning of a line becomes a list, so we need to escape them also (asterisk was already escaped)
  4725. txt = txt.replace(/^( {0,3})([+-])/gm, '$1\\$2');
  4726. // images and links, ] followed by ( is problematic, so we escape it
  4727. txt = txt.replace(/]([\s]*)\(/g, '\\]$1\\(');
  4728. // reference URIs must also be escaped
  4729. txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, '\\[$1]:');
  4730. return txt;
  4731. });
  4732. var root = this;
  4733. // AMD Loader
  4734. if (true) {
  4735. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  4736. 'use strict';
  4737. return showdown;
  4738. }).call(exports, __webpack_require__, exports, module),
  4739. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4740. // CommonJS/nodeJS Loader
  4741. } else {}
  4742. }).call(this);
  4743. /***/ }),
  4744. /***/ 23:
  4745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4746. "use strict";
  4747. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
  4748. var arrayWithHoles = __webpack_require__(38);
  4749. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
  4750. function _iterableToArrayLimit(arr, i) {
  4751. var _arr = [];
  4752. var _n = true;
  4753. var _d = false;
  4754. var _e = undefined;
  4755. try {
  4756. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  4757. _arr.push(_s.value);
  4758. if (i && _arr.length === i) break;
  4759. }
  4760. } catch (err) {
  4761. _d = true;
  4762. _e = err;
  4763. } finally {
  4764. try {
  4765. if (!_n && _i["return"] != null) _i["return"]();
  4766. } finally {
  4767. if (_d) throw _e;
  4768. }
  4769. }
  4770. return _arr;
  4771. }
  4772. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
  4773. var nonIterableRest = __webpack_require__(39);
  4774. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
  4775. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
  4776. function _slicedToArray(arr, i) {
  4777. return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])();
  4778. }
  4779. /***/ }),
  4780. /***/ 25:
  4781. /***/ (function(module, exports) {
  4782. (function() { module.exports = this["wp"]["dom"]; }());
  4783. /***/ }),
  4784. /***/ 27:
  4785. /***/ (function(module, exports) {
  4786. (function() { module.exports = this["wp"]["hooks"]; }());
  4787. /***/ }),
  4788. /***/ 30:
  4789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4790. "use strict";
  4791. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
  4792. function _iterableToArray(iter) {
  4793. if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
  4794. }
  4795. /***/ }),
  4796. /***/ 347:
  4797. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4798. "use strict";
  4799. __webpack_require__.r(__webpack_exports__);
  4800. var selectors_namespaceObject = {};
  4801. __webpack_require__.r(selectors_namespaceObject);
  4802. __webpack_require__.d(selectors_namespaceObject, "getBlockTypes", function() { return getBlockTypes; });
  4803. __webpack_require__.d(selectors_namespaceObject, "getBlockType", function() { return getBlockType; });
  4804. __webpack_require__.d(selectors_namespaceObject, "getBlockStyles", function() { return getBlockStyles; });
  4805. __webpack_require__.d(selectors_namespaceObject, "getCategories", function() { return getCategories; });
  4806. __webpack_require__.d(selectors_namespaceObject, "getDefaultBlockName", function() { return getDefaultBlockName; });
  4807. __webpack_require__.d(selectors_namespaceObject, "getFreeformFallbackBlockName", function() { return getFreeformFallbackBlockName; });
  4808. __webpack_require__.d(selectors_namespaceObject, "getUnregisteredFallbackBlockName", function() { return getUnregisteredFallbackBlockName; });
  4809. __webpack_require__.d(selectors_namespaceObject, "getGroupingBlockName", function() { return getGroupingBlockName; });
  4810. __webpack_require__.d(selectors_namespaceObject, "getChildBlockNames", function() { return selectors_getChildBlockNames; });
  4811. __webpack_require__.d(selectors_namespaceObject, "getBlockSupport", function() { return selectors_getBlockSupport; });
  4812. __webpack_require__.d(selectors_namespaceObject, "hasBlockSupport", function() { return hasBlockSupport; });
  4813. __webpack_require__.d(selectors_namespaceObject, "isMatchingSearchTerm", function() { return isMatchingSearchTerm; });
  4814. __webpack_require__.d(selectors_namespaceObject, "hasChildBlocks", function() { return selectors_hasChildBlocks; });
  4815. __webpack_require__.d(selectors_namespaceObject, "hasChildBlocksWithInserterSupport", function() { return selectors_hasChildBlocksWithInserterSupport; });
  4816. var actions_namespaceObject = {};
  4817. __webpack_require__.r(actions_namespaceObject);
  4818. __webpack_require__.d(actions_namespaceObject, "addBlockTypes", function() { return addBlockTypes; });
  4819. __webpack_require__.d(actions_namespaceObject, "removeBlockTypes", function() { return removeBlockTypes; });
  4820. __webpack_require__.d(actions_namespaceObject, "addBlockStyles", function() { return addBlockStyles; });
  4821. __webpack_require__.d(actions_namespaceObject, "removeBlockStyles", function() { return removeBlockStyles; });
  4822. __webpack_require__.d(actions_namespaceObject, "setDefaultBlockName", function() { return setDefaultBlockName; });
  4823. __webpack_require__.d(actions_namespaceObject, "setFreeformFallbackBlockName", function() { return setFreeformFallbackBlockName; });
  4824. __webpack_require__.d(actions_namespaceObject, "setUnregisteredFallbackBlockName", function() { return setUnregisteredFallbackBlockName; });
  4825. __webpack_require__.d(actions_namespaceObject, "setGroupingBlockName", function() { return setGroupingBlockName; });
  4826. __webpack_require__.d(actions_namespaceObject, "setCategories", function() { return setCategories; });
  4827. __webpack_require__.d(actions_namespaceObject, "updateCategory", function() { return updateCategory; });
  4828. // EXTERNAL MODULE: external {"this":["wp","data"]}
  4829. var external_this_wp_data_ = __webpack_require__(4);
  4830. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
  4831. var defineProperty = __webpack_require__(10);
  4832. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
  4833. var toConsumableArray = __webpack_require__(17);
  4834. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
  4835. var objectSpread = __webpack_require__(7);
  4836. // EXTERNAL MODULE: external "lodash"
  4837. var external_lodash_ = __webpack_require__(2);
  4838. // EXTERNAL MODULE: external {"this":["wp","i18n"]}
  4839. var external_this_wp_i18n_ = __webpack_require__(1);
  4840. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js
  4841. /**
  4842. * External dependencies
  4843. */
  4844. /**
  4845. * WordPress dependencies
  4846. */
  4847. /**
  4848. * Module Constants
  4849. */
  4850. var DEFAULT_CATEGORIES = [{
  4851. slug: 'common',
  4852. title: Object(external_this_wp_i18n_["__"])('Common Blocks')
  4853. }, {
  4854. slug: 'formatting',
  4855. title: Object(external_this_wp_i18n_["__"])('Formatting')
  4856. }, {
  4857. slug: 'layout',
  4858. title: Object(external_this_wp_i18n_["__"])('Layout Elements')
  4859. }, {
  4860. slug: 'widgets',
  4861. title: Object(external_this_wp_i18n_["__"])('Widgets')
  4862. }, {
  4863. slug: 'embed',
  4864. title: Object(external_this_wp_i18n_["__"])('Embeds')
  4865. }, {
  4866. slug: 'reusable',
  4867. title: Object(external_this_wp_i18n_["__"])('Reusable Blocks')
  4868. }];
  4869. /**
  4870. * Reducer managing the block types
  4871. *
  4872. * @param {Object} state Current state.
  4873. * @param {Object} action Dispatched action.
  4874. *
  4875. * @return {Object} Updated state.
  4876. */
  4877. function reducer_blockTypes() {
  4878. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  4879. var action = arguments.length > 1 ? arguments[1] : undefined;
  4880. switch (action.type) {
  4881. case 'ADD_BLOCK_TYPES':
  4882. return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["keyBy"])(Object(external_lodash_["map"])(action.blockTypes, function (blockType) {
  4883. return Object(external_lodash_["omit"])(blockType, 'styles ');
  4884. }), 'name'));
  4885. case 'REMOVE_BLOCK_TYPES':
  4886. return Object(external_lodash_["omit"])(state, action.names);
  4887. }
  4888. return state;
  4889. }
  4890. /**
  4891. * Reducer managing the block style variations.
  4892. *
  4893. * @param {Object} state Current state.
  4894. * @param {Object} action Dispatched action.
  4895. *
  4896. * @return {Object} Updated state.
  4897. */
  4898. function blockStyles() {
  4899. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  4900. var action = arguments.length > 1 ? arguments[1] : undefined;
  4901. switch (action.type) {
  4902. case 'ADD_BLOCK_TYPES':
  4903. return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["mapValues"])(Object(external_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) {
  4904. return Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(blockType, ['styles'], [])), Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [blockType.name], []))), function (style) {
  4905. return style.name;
  4906. });
  4907. }));
  4908. case 'ADD_BLOCK_STYLES':
  4909. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.styles)), function (style) {
  4910. return style.name;
  4911. })));
  4912. case 'REMOVE_BLOCK_STYLES':
  4913. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["filter"])(Object(external_lodash_["get"])(state, [action.blockName], []), function (style) {
  4914. return action.styleNames.indexOf(style.name) === -1;
  4915. })));
  4916. }
  4917. return state;
  4918. }
  4919. /**
  4920. * Higher-order Reducer creating a reducer keeping track of given block name.
  4921. *
  4922. * @param {string} setActionType Action type.
  4923. *
  4924. * @return {Function} Reducer.
  4925. */
  4926. function createBlockNameSetterReducer(setActionType) {
  4927. return function () {
  4928. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4929. var action = arguments.length > 1 ? arguments[1] : undefined;
  4930. switch (action.type) {
  4931. case 'REMOVE_BLOCK_TYPES':
  4932. if (action.names.indexOf(state) !== -1) {
  4933. return null;
  4934. }
  4935. return state;
  4936. case setActionType:
  4937. return action.name || null;
  4938. }
  4939. return state;
  4940. };
  4941. }
  4942. var reducer_defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME');
  4943. var freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME');
  4944. var unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME');
  4945. var groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME');
  4946. /**
  4947. * Reducer managing the categories
  4948. *
  4949. * @param {Object} state Current state.
  4950. * @param {Object} action Dispatched action.
  4951. *
  4952. * @return {Object} Updated state.
  4953. */
  4954. function reducer_categories() {
  4955. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CATEGORIES;
  4956. var action = arguments.length > 1 ? arguments[1] : undefined;
  4957. switch (action.type) {
  4958. case 'SET_CATEGORIES':
  4959. return action.categories || [];
  4960. case 'UPDATE_CATEGORY':
  4961. {
  4962. if (!action.category || Object(external_lodash_["isEmpty"])(action.category)) {
  4963. return state;
  4964. }
  4965. var categoryToChange = Object(external_lodash_["find"])(state, ['slug', action.slug]);
  4966. if (categoryToChange) {
  4967. return Object(external_lodash_["map"])(state, function (category) {
  4968. if (category.slug === action.slug) {
  4969. return Object(objectSpread["a" /* default */])({}, category, action.category);
  4970. }
  4971. return category;
  4972. });
  4973. }
  4974. }
  4975. }
  4976. return state;
  4977. }
  4978. /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({
  4979. blockTypes: reducer_blockTypes,
  4980. blockStyles: blockStyles,
  4981. defaultBlockName: reducer_defaultBlockName,
  4982. freeformFallbackBlockName: freeformFallbackBlockName,
  4983. unregisteredFallbackBlockName: unregisteredFallbackBlockName,
  4984. groupingBlockName: groupingBlockName,
  4985. categories: reducer_categories
  4986. }));
  4987. // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
  4988. var rememo = __webpack_require__(36);
  4989. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
  4990. /**
  4991. * External dependencies
  4992. */
  4993. /**
  4994. * Given a block name or block type object, returns the corresponding
  4995. * normalized block type object.
  4996. *
  4997. * @param {Object} state Blocks state.
  4998. * @param {(string|Object)} nameOrType Block name or type object
  4999. *
  5000. * @return {Object} Block type object.
  5001. */
  5002. var getNormalizedBlockType = function getNormalizedBlockType(state, nameOrType) {
  5003. return 'string' === typeof nameOrType ? getBlockType(state, nameOrType) : nameOrType;
  5004. };
  5005. /**
  5006. * Returns all the available block types.
  5007. *
  5008. * @param {Object} state Data state.
  5009. *
  5010. * @return {Array} Block Types.
  5011. */
  5012. var getBlockTypes = Object(rememo["a" /* default */])(function (state) {
  5013. return Object.values(state.blockTypes);
  5014. }, function (state) {
  5015. return [state.blockTypes];
  5016. });
  5017. /**
  5018. * Returns a block type by name.
  5019. *
  5020. * @param {Object} state Data state.
  5021. * @param {string} name Block type name.
  5022. *
  5023. * @return {Object?} Block Type.
  5024. */
  5025. function getBlockType(state, name) {
  5026. return state.blockTypes[name];
  5027. }
  5028. /**
  5029. * Returns block styles by block name.
  5030. *
  5031. * @param {Object} state Data state.
  5032. * @param {string} name Block type name.
  5033. *
  5034. * @return {Array?} Block Styles.
  5035. */
  5036. function getBlockStyles(state, name) {
  5037. return state.blockStyles[name];
  5038. }
  5039. /**
  5040. * Returns all the available categories.
  5041. *
  5042. * @param {Object} state Data state.
  5043. *
  5044. * @return {Array} Categories list.
  5045. */
  5046. function getCategories(state) {
  5047. return state.categories;
  5048. }
  5049. /**
  5050. * Returns the name of the default block name.
  5051. *
  5052. * @param {Object} state Data state.
  5053. *
  5054. * @return {string?} Default block name.
  5055. */
  5056. function getDefaultBlockName(state) {
  5057. return state.defaultBlockName;
  5058. }
  5059. /**
  5060. * Returns the name of the block for handling non-block content.
  5061. *
  5062. * @param {Object} state Data state.
  5063. *
  5064. * @return {string?} Name of the block for handling non-block content.
  5065. */
  5066. function getFreeformFallbackBlockName(state) {
  5067. return state.freeformFallbackBlockName;
  5068. }
  5069. /**
  5070. * Returns the name of the block for handling unregistered blocks.
  5071. *
  5072. * @param {Object} state Data state.
  5073. *
  5074. * @return {string?} Name of the block for handling unregistered blocks.
  5075. */
  5076. function getUnregisteredFallbackBlockName(state) {
  5077. return state.unregisteredFallbackBlockName;
  5078. }
  5079. /**
  5080. * Returns the name of the block for handling unregistered blocks.
  5081. *
  5082. * @param {Object} state Data state.
  5083. *
  5084. * @return {string?} Name of the block for handling unregistered blocks.
  5085. */
  5086. function getGroupingBlockName(state) {
  5087. return state.groupingBlockName;
  5088. }
  5089. /**
  5090. * Returns an array with the child blocks of a given block.
  5091. *
  5092. * @param {Object} state Data state.
  5093. * @param {string} blockName Block type name.
  5094. *
  5095. * @return {Array} Array of child block names.
  5096. */
  5097. var selectors_getChildBlockNames = Object(rememo["a" /* default */])(function (state, blockName) {
  5098. return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(state.blockTypes, function (blockType) {
  5099. return Object(external_lodash_["includes"])(blockType.parent, blockName);
  5100. }), function (_ref) {
  5101. var name = _ref.name;
  5102. return name;
  5103. });
  5104. }, function (state) {
  5105. return [state.blockTypes];
  5106. });
  5107. /**
  5108. * Returns the block support value for a feature, if defined.
  5109. *
  5110. * @param {Object} state Data state.
  5111. * @param {(string|Object)} nameOrType Block name or type object
  5112. * @param {string} feature Feature to retrieve
  5113. * @param {*} defaultSupports Default value to return if not
  5114. * explicitly defined
  5115. *
  5116. * @return {?*} Block support value
  5117. */
  5118. var selectors_getBlockSupport = function getBlockSupport(state, nameOrType, feature, defaultSupports) {
  5119. var blockType = getNormalizedBlockType(state, nameOrType);
  5120. return Object(external_lodash_["get"])(blockType, ['supports', feature], defaultSupports);
  5121. };
  5122. /**
  5123. * Returns true if the block defines support for a feature, or false otherwise.
  5124. *
  5125. * @param {Object} state Data state.
  5126. * @param {(string|Object)} nameOrType Block name or type object.
  5127. * @param {string} feature Feature to test.
  5128. * @param {boolean} defaultSupports Whether feature is supported by
  5129. * default if not explicitly defined.
  5130. *
  5131. * @return {boolean} Whether block supports feature.
  5132. */
  5133. function hasBlockSupport(state, nameOrType, feature, defaultSupports) {
  5134. return !!selectors_getBlockSupport(state, nameOrType, feature, defaultSupports);
  5135. }
  5136. /**
  5137. * Returns true if the block type by the given name or object value matches a
  5138. * search term, or false otherwise.
  5139. *
  5140. * @param {Object} state Blocks state.
  5141. * @param {(string|Object)} nameOrType Block name or type object.
  5142. * @param {string} searchTerm Search term by which to filter.
  5143. *
  5144. * @return {Object[]} Whether block type matches search term.
  5145. */
  5146. function isMatchingSearchTerm(state, nameOrType, searchTerm) {
  5147. var blockType = getNormalizedBlockType(state, nameOrType);
  5148. var getNormalizedSearchTerm = Object(external_lodash_["flow"])([// Disregard diacritics.
  5149. // Input: "média"
  5150. external_lodash_["deburr"], // Lowercase.
  5151. // Input: "MEDIA"
  5152. function (term) {
  5153. return term.toLowerCase();
  5154. }, // Strip leading and trailing whitespace.
  5155. // Input: " media "
  5156. function (term) {
  5157. return term.trim();
  5158. }]);
  5159. var normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
  5160. var isSearchMatch = Object(external_lodash_["flow"])([getNormalizedSearchTerm, function (normalizedCandidate) {
  5161. return Object(external_lodash_["includes"])(normalizedCandidate, normalizedSearchTerm);
  5162. }]);
  5163. return isSearchMatch(blockType.title) || Object(external_lodash_["some"])(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category);
  5164. }
  5165. /**
  5166. * Returns a boolean indicating if a block has child blocks or not.
  5167. *
  5168. * @param {Object} state Data state.
  5169. * @param {string} blockName Block type name.
  5170. *
  5171. * @return {boolean} True if a block contains child blocks and false otherwise.
  5172. */
  5173. var selectors_hasChildBlocks = function hasChildBlocks(state, blockName) {
  5174. return selectors_getChildBlockNames(state, blockName).length > 0;
  5175. };
  5176. /**
  5177. * Returns a boolean indicating if a block has at least one child block with inserter support.
  5178. *
  5179. * @param {Object} state Data state.
  5180. * @param {string} blockName Block type name.
  5181. *
  5182. * @return {boolean} True if a block contains at least one child blocks with inserter support
  5183. * and false otherwise.
  5184. */
  5185. var selectors_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(state, blockName) {
  5186. return Object(external_lodash_["some"])(selectors_getChildBlockNames(state, blockName), function (childBlockName) {
  5187. return hasBlockSupport(state, childBlockName, 'inserter', true);
  5188. });
  5189. };
  5190. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/actions.js
  5191. /**
  5192. * External dependencies
  5193. */
  5194. /**
  5195. * Returns an action object used in signalling that block types have been added.
  5196. *
  5197. * @param {Array|Object} blockTypes Block types received.
  5198. *
  5199. * @return {Object} Action object.
  5200. */
  5201. function addBlockTypes(blockTypes) {
  5202. return {
  5203. type: 'ADD_BLOCK_TYPES',
  5204. blockTypes: Object(external_lodash_["castArray"])(blockTypes)
  5205. };
  5206. }
  5207. /**
  5208. * Returns an action object used to remove a registered block type.
  5209. *
  5210. * @param {string|Array} names Block name.
  5211. *
  5212. * @return {Object} Action object.
  5213. */
  5214. function removeBlockTypes(names) {
  5215. return {
  5216. type: 'REMOVE_BLOCK_TYPES',
  5217. names: Object(external_lodash_["castArray"])(names)
  5218. };
  5219. }
  5220. /**
  5221. * Returns an action object used in signalling that new block styles have been added.
  5222. *
  5223. * @param {string} blockName Block name.
  5224. * @param {Array|Object} styles Block styles.
  5225. *
  5226. * @return {Object} Action object.
  5227. */
  5228. function addBlockStyles(blockName, styles) {
  5229. return {
  5230. type: 'ADD_BLOCK_STYLES',
  5231. styles: Object(external_lodash_["castArray"])(styles),
  5232. blockName: blockName
  5233. };
  5234. }
  5235. /**
  5236. * Returns an action object used in signalling that block styles have been removed.
  5237. *
  5238. * @param {string} blockName Block name.
  5239. * @param {Array|string} styleNames Block style names.
  5240. *
  5241. * @return {Object} Action object.
  5242. */
  5243. function removeBlockStyles(blockName, styleNames) {
  5244. return {
  5245. type: 'REMOVE_BLOCK_STYLES',
  5246. styleNames: Object(external_lodash_["castArray"])(styleNames),
  5247. blockName: blockName
  5248. };
  5249. }
  5250. /**
  5251. * Returns an action object used to set the default block name.
  5252. *
  5253. * @param {string} name Block name.
  5254. *
  5255. * @return {Object} Action object.
  5256. */
  5257. function setDefaultBlockName(name) {
  5258. return {
  5259. type: 'SET_DEFAULT_BLOCK_NAME',
  5260. name: name
  5261. };
  5262. }
  5263. /**
  5264. * Returns an action object used to set the name of the block used as a fallback
  5265. * for non-block content.
  5266. *
  5267. * @param {string} name Block name.
  5268. *
  5269. * @return {Object} Action object.
  5270. */
  5271. function setFreeformFallbackBlockName(name) {
  5272. return {
  5273. type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME',
  5274. name: name
  5275. };
  5276. }
  5277. /**
  5278. * Returns an action object used to set the name of the block used as a fallback
  5279. * for unregistered blocks.
  5280. *
  5281. * @param {string} name Block name.
  5282. *
  5283. * @return {Object} Action object.
  5284. */
  5285. function setUnregisteredFallbackBlockName(name) {
  5286. return {
  5287. type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME',
  5288. name: name
  5289. };
  5290. }
  5291. /**
  5292. * Returns an action object used to set the name of the block used
  5293. * when grouping other blocks
  5294. * eg: in "Group/Ungroup" interactions
  5295. *
  5296. * @param {string} name Block name.
  5297. *
  5298. * @return {Object} Action object.
  5299. */
  5300. function setGroupingBlockName(name) {
  5301. return {
  5302. type: 'SET_GROUPING_BLOCK_NAME',
  5303. name: name
  5304. };
  5305. }
  5306. /**
  5307. * Returns an action object used to set block categories.
  5308. *
  5309. * @param {Object[]} categories Block categories.
  5310. *
  5311. * @return {Object} Action object.
  5312. */
  5313. function setCategories(categories) {
  5314. return {
  5315. type: 'SET_CATEGORIES',
  5316. categories: categories
  5317. };
  5318. }
  5319. /**
  5320. * Returns an action object used to update a category.
  5321. *
  5322. * @param {string} slug Block category slug.
  5323. * @param {Object} category Object containing the category properties that should be updated.
  5324. *
  5325. * @return {Object} Action object.
  5326. */
  5327. function updateCategory(slug, category) {
  5328. return {
  5329. type: 'UPDATE_CATEGORY',
  5330. slug: slug,
  5331. category: category
  5332. };
  5333. }
  5334. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js
  5335. /**
  5336. * WordPress dependencies
  5337. */
  5338. /**
  5339. * Internal dependencies
  5340. */
  5341. Object(external_this_wp_data_["registerStore"])('core/blocks', {
  5342. reducer: reducer,
  5343. selectors: selectors_namespaceObject,
  5344. actions: actions_namespaceObject
  5345. });
  5346. // EXTERNAL MODULE: ./node_modules/uuid/v4.js
  5347. var v4 = __webpack_require__(67);
  5348. var v4_default = /*#__PURE__*/__webpack_require__.n(v4);
  5349. // EXTERNAL MODULE: external {"this":["wp","hooks"]}
  5350. var external_this_wp_hooks_ = __webpack_require__(27);
  5351. // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js
  5352. var tinycolor = __webpack_require__(48);
  5353. var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor);
  5354. // EXTERNAL MODULE: external {"this":["wp","element"]}
  5355. var external_this_wp_element_ = __webpack_require__(0);
  5356. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js
  5357. /**
  5358. * External dependencies
  5359. */
  5360. /**
  5361. * WordPress dependencies
  5362. */
  5363. /**
  5364. * Internal dependencies
  5365. */
  5366. /**
  5367. * Array of icon colors containing a color to be used if the icon color
  5368. * was not explicitly set but the icon background color was.
  5369. *
  5370. * @type {Object}
  5371. */
  5372. var ICON_COLORS = ['#191e23', '#f8f9f9'];
  5373. /**
  5374. * Determines whether the block is a default block
  5375. * and its attributes are equal to the default attributes
  5376. * which means the block is unmodified.
  5377. *
  5378. * @param {WPBlock} block Block Object
  5379. *
  5380. * @return {boolean} Whether the block is an unmodified default block
  5381. */
  5382. function isUnmodifiedDefaultBlock(block) {
  5383. var defaultBlockName = registration_getDefaultBlockName();
  5384. if (block.name !== defaultBlockName) {
  5385. return false;
  5386. } // Cache a created default block if no cache exists or the default block
  5387. // name changed.
  5388. if (!isUnmodifiedDefaultBlock.block || isUnmodifiedDefaultBlock.block.name !== defaultBlockName) {
  5389. isUnmodifiedDefaultBlock.block = createBlock(defaultBlockName);
  5390. }
  5391. var newDefaultBlock = isUnmodifiedDefaultBlock.block;
  5392. var blockType = registration_getBlockType(defaultBlockName);
  5393. return Object(external_lodash_["every"])(blockType.attributes, function (value, key) {
  5394. return newDefaultBlock.attributes[key] === block.attributes[key];
  5395. });
  5396. }
  5397. /**
  5398. * Function that checks if the parameter is a valid icon.
  5399. *
  5400. * @param {*} icon Parameter to be checked.
  5401. *
  5402. * @return {boolean} True if the parameter is a valid icon and false otherwise.
  5403. */
  5404. function isValidIcon(icon) {
  5405. return !!icon && (Object(external_lodash_["isString"])(icon) || Object(external_this_wp_element_["isValidElement"])(icon) || Object(external_lodash_["isFunction"])(icon) || icon instanceof external_this_wp_element_["Component"]);
  5406. }
  5407. /**
  5408. * Function that receives an icon as set by the blocks during the registration
  5409. * and returns a new icon object that is normalized so we can rely on just on possible icon structure
  5410. * in the codebase.
  5411. *
  5412. * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon;
  5413. * one of a Dashicon slug, an element, or a
  5414. * component.
  5415. *
  5416. * @return {WPBlockTypeIconDescriptor} Object describing the icon.
  5417. */
  5418. function normalizeIconObject(icon) {
  5419. if (isValidIcon(icon)) {
  5420. return {
  5421. src: icon
  5422. };
  5423. }
  5424. if (Object(external_lodash_["has"])(icon, ['background'])) {
  5425. var tinyBgColor = tinycolor_default()(icon.background);
  5426. return Object(objectSpread["a" /* default */])({}, icon, {
  5427. foreground: icon.foreground ? icon.foreground : Object(tinycolor["mostReadable"])(tinyBgColor, ICON_COLORS, {
  5428. includeFallbackColors: true,
  5429. level: 'AA',
  5430. size: 'large'
  5431. }).toHexString(),
  5432. shadowColor: tinyBgColor.setAlpha(0.3).toRgbString()
  5433. });
  5434. }
  5435. return icon;
  5436. }
  5437. /**
  5438. * Normalizes block type passed as param. When string is passed then
  5439. * it converts it to the matching block type object.
  5440. * It passes the original object otherwise.
  5441. *
  5442. * @param {string|Object} blockTypeOrName Block type or name.
  5443. *
  5444. * @return {?Object} Block type.
  5445. */
  5446. function normalizeBlockType(blockTypeOrName) {
  5447. if (Object(external_lodash_["isString"])(blockTypeOrName)) {
  5448. return registration_getBlockType(blockTypeOrName);
  5449. }
  5450. return blockTypeOrName;
  5451. }
  5452. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/constants.js
  5453. /**
  5454. * Array of valid keys in a block type settings deprecation object.
  5455. *
  5456. * @type {string[]}
  5457. */
  5458. var DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible'];
  5459. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js
  5460. /* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */
  5461. /**
  5462. * External dependencies
  5463. */
  5464. /**
  5465. * WordPress dependencies
  5466. */
  5467. /**
  5468. * Internal dependencies
  5469. */
  5470. /**
  5471. * Render behavior of a block type icon; one of a Dashicon slug, an element,
  5472. * or a component.
  5473. *
  5474. * @typedef {(string|WPElement|WPComponent)} WPBlockTypeIconRender
  5475. *
  5476. * @see https://developer.wordpress.org/resource/dashicons/
  5477. */
  5478. /**
  5479. * An object describing a normalized block type icon.
  5480. *
  5481. * @typedef {Object} WPBlockTypeIconDescriptor
  5482. *
  5483. * @property {WPBlockTypeIconRender} src Render behavior of the icon,
  5484. * one of a Dashicon slug, an
  5485. * element, or a component.
  5486. * @property {string} background Optimal background hex string
  5487. * color when displaying icon.
  5488. * @property {string} foreground Optimal foreground hex string
  5489. * color when displaying icon.
  5490. * @property {string} shadowColor Optimal shadow hex string
  5491. * color when displaying icon.
  5492. */
  5493. /**
  5494. * Value to use to render the icon for a block type in an editor interface,
  5495. * either a Dashicon slug, an element, a component, or an object describing
  5496. * the icon.
  5497. *
  5498. * @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon
  5499. */
  5500. /**
  5501. * Defined behavior of a block type.
  5502. *
  5503. * @typedef {Object} WPBlockType
  5504. *
  5505. * @property {string} name Block type's namespaced name.
  5506. * @property {string} title Human-readable block type label.
  5507. * @property {string} category Block type category classification,
  5508. * used in search interfaces to arrange
  5509. * block types by category.
  5510. * @property {WPBlockTypeIcon} [icon] Block type icon.
  5511. * @property {string[]} [keywords] Additional keywords to produce block
  5512. * type as result in search interfaces.
  5513. * @property {Object} [attributes] Block type attributes.
  5514. * @property {WPComponent} [save] Optional component describing
  5515. * serialized markup structure of a
  5516. * block type.
  5517. * @property {WPComponent} edit Component rendering an element to
  5518. * manipulate the attributes of a block
  5519. * in the context of an editor.
  5520. */
  5521. /**
  5522. * Default values to assign for omitted optional block type settings.
  5523. *
  5524. * @type {Object}
  5525. */
  5526. var DEFAULT_BLOCK_TYPE_SETTINGS = {
  5527. icon: 'block-default',
  5528. attributes: {},
  5529. keywords: [],
  5530. save: function save() {
  5531. return null;
  5532. }
  5533. };
  5534. var serverSideBlockDefinitions = {};
  5535. /**
  5536. * Sets the server side block definition of blocks.
  5537. *
  5538. * @param {Object} definitions Server-side block definitions
  5539. */
  5540. function unstable__bootstrapServerSideBlockDefinitions(definitions) {
  5541. // eslint-disable-line camelcase
  5542. serverSideBlockDefinitions = Object(objectSpread["a" /* default */])({}, serverSideBlockDefinitions, definitions);
  5543. }
  5544. /**
  5545. * Registers a new block provided a unique name and an object defining its
  5546. * behavior. Once registered, the block is made available as an option to any
  5547. * editor interface where blocks are implemented.
  5548. *
  5549. * @param {string} name Block name.
  5550. * @param {Object} settings Block settings.
  5551. *
  5552. * @return {?WPBlock} The block, if it has been successfully registered;
  5553. * otherwise `undefined`.
  5554. */
  5555. function registerBlockType(name, settings) {
  5556. settings = Object(objectSpread["a" /* default */])({
  5557. name: name
  5558. }, DEFAULT_BLOCK_TYPE_SETTINGS, Object(external_lodash_["get"])(serverSideBlockDefinitions, name), settings);
  5559. if (typeof name !== 'string') {
  5560. console.error('Block names must be strings.');
  5561. return;
  5562. }
  5563. if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) {
  5564. console.error('Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block');
  5565. return;
  5566. }
  5567. if (Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name)) {
  5568. console.error('Block "' + name + '" is already registered.');
  5569. return;
  5570. }
  5571. var preFilterSettings = Object(objectSpread["a" /* default */])({}, settings);
  5572. settings = Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', settings, name);
  5573. if (settings.deprecated) {
  5574. settings.deprecated = settings.deprecated.map(function (deprecation) {
  5575. return Object(external_lodash_["pick"])( // Only keep valid deprecation keys.
  5576. Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', // Merge deprecation keys with pre-filter settings
  5577. // so that filters that depend on specific keys being
  5578. // present don't fail.
  5579. Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(preFilterSettings, DEPRECATED_ENTRY_KEYS), deprecation), name), DEPRECATED_ENTRY_KEYS);
  5580. });
  5581. }
  5582. if (!Object(external_lodash_["isPlainObject"])(settings)) {
  5583. console.error('Block settings must be a valid object.');
  5584. return;
  5585. }
  5586. if (!Object(external_lodash_["isFunction"])(settings.save)) {
  5587. console.error('The "save" property must be a valid function.');
  5588. return;
  5589. }
  5590. if ('edit' in settings && !Object(external_lodash_["isFunction"])(settings.edit)) {
  5591. console.error('The "edit" property must be a valid function.');
  5592. return;
  5593. }
  5594. if (!('category' in settings)) {
  5595. console.error('The block "' + name + '" must have a category.');
  5596. return;
  5597. }
  5598. if ('category' in settings && !Object(external_lodash_["some"])(Object(external_this_wp_data_["select"])('core/blocks').getCategories(), {
  5599. slug: settings.category
  5600. })) {
  5601. console.error('The block "' + name + '" must have a registered category.');
  5602. return;
  5603. }
  5604. if (!('title' in settings) || settings.title === '') {
  5605. console.error('The block "' + name + '" must have a title.');
  5606. return;
  5607. }
  5608. if (typeof settings.title !== 'string') {
  5609. console.error('Block titles must be strings.');
  5610. return;
  5611. }
  5612. settings.icon = normalizeIconObject(settings.icon);
  5613. if (!isValidIcon(settings.icon.src)) {
  5614. console.error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional');
  5615. return;
  5616. }
  5617. Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockTypes(settings);
  5618. return settings;
  5619. }
  5620. /**
  5621. * Unregisters a block.
  5622. *
  5623. * @param {string} name Block name.
  5624. *
  5625. * @return {?WPBlock} The previous block value, if it has been successfully
  5626. * unregistered; otherwise `undefined`.
  5627. */
  5628. function unregisterBlockType(name) {
  5629. var oldBlock = Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name);
  5630. if (!oldBlock) {
  5631. console.error('Block "' + name + '" is not registered.');
  5632. return;
  5633. }
  5634. Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockTypes(name);
  5635. return oldBlock;
  5636. }
  5637. /**
  5638. * Assigns name of block for handling non-block content.
  5639. *
  5640. * @param {string} blockName Block name.
  5641. */
  5642. function setFreeformContentHandlerName(blockName) {
  5643. Object(external_this_wp_data_["dispatch"])('core/blocks').setFreeformFallbackBlockName(blockName);
  5644. }
  5645. /**
  5646. * Retrieves name of block handling non-block content, or undefined if no
  5647. * handler has been defined.
  5648. *
  5649. * @return {?string} Block name.
  5650. */
  5651. function getFreeformContentHandlerName() {
  5652. return Object(external_this_wp_data_["select"])('core/blocks').getFreeformFallbackBlockName();
  5653. }
  5654. /**
  5655. * Retrieves name of block used for handling grouping interactions.
  5656. *
  5657. * @return {?string} Block name.
  5658. */
  5659. function registration_getGroupingBlockName() {
  5660. return Object(external_this_wp_data_["select"])('core/blocks').getGroupingBlockName();
  5661. }
  5662. /**
  5663. * Assigns name of block handling unregistered block types.
  5664. *
  5665. * @param {string} blockName Block name.
  5666. */
  5667. function setUnregisteredTypeHandlerName(blockName) {
  5668. Object(external_this_wp_data_["dispatch"])('core/blocks').setUnregisteredFallbackBlockName(blockName);
  5669. }
  5670. /**
  5671. * Retrieves name of block handling unregistered block types, or undefined if no
  5672. * handler has been defined.
  5673. *
  5674. * @return {?string} Block name.
  5675. */
  5676. function getUnregisteredTypeHandlerName() {
  5677. return Object(external_this_wp_data_["select"])('core/blocks').getUnregisteredFallbackBlockName();
  5678. }
  5679. /**
  5680. * Assigns the default block name.
  5681. *
  5682. * @param {string} name Block name.
  5683. */
  5684. function registration_setDefaultBlockName(name) {
  5685. Object(external_this_wp_data_["dispatch"])('core/blocks').setDefaultBlockName(name);
  5686. }
  5687. /**
  5688. * Assigns name of block for handling block grouping interactions.
  5689. *
  5690. * @param {string} name Block name.
  5691. */
  5692. function registration_setGroupingBlockName(name) {
  5693. Object(external_this_wp_data_["dispatch"])('core/blocks').setGroupingBlockName(name);
  5694. }
  5695. /**
  5696. * Retrieves the default block name.
  5697. *
  5698. * @return {?string} Block name.
  5699. */
  5700. function registration_getDefaultBlockName() {
  5701. return Object(external_this_wp_data_["select"])('core/blocks').getDefaultBlockName();
  5702. }
  5703. /**
  5704. * Returns a registered block type.
  5705. *
  5706. * @param {string} name Block name.
  5707. *
  5708. * @return {?Object} Block type.
  5709. */
  5710. function registration_getBlockType(name) {
  5711. return Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name);
  5712. }
  5713. /**
  5714. * Returns all registered blocks.
  5715. *
  5716. * @return {Array} Block settings.
  5717. */
  5718. function registration_getBlockTypes() {
  5719. return Object(external_this_wp_data_["select"])('core/blocks').getBlockTypes();
  5720. }
  5721. /**
  5722. * Returns the block support value for a feature, if defined.
  5723. *
  5724. * @param {(string|Object)} nameOrType Block name or type object
  5725. * @param {string} feature Feature to retrieve
  5726. * @param {*} defaultSupports Default value to return if not
  5727. * explicitly defined
  5728. *
  5729. * @return {?*} Block support value
  5730. */
  5731. function registration_getBlockSupport(nameOrType, feature, defaultSupports) {
  5732. return Object(external_this_wp_data_["select"])('core/blocks').getBlockSupport(nameOrType, feature, defaultSupports);
  5733. }
  5734. /**
  5735. * Returns true if the block defines support for a feature, or false otherwise.
  5736. *
  5737. * @param {(string|Object)} nameOrType Block name or type object.
  5738. * @param {string} feature Feature to test.
  5739. * @param {boolean} defaultSupports Whether feature is supported by
  5740. * default if not explicitly defined.
  5741. *
  5742. * @return {boolean} Whether block supports feature.
  5743. */
  5744. function registration_hasBlockSupport(nameOrType, feature, defaultSupports) {
  5745. return Object(external_this_wp_data_["select"])('core/blocks').hasBlockSupport(nameOrType, feature, defaultSupports);
  5746. }
  5747. /**
  5748. * Determines whether or not the given block is a reusable block. This is a
  5749. * special block type that is used to point to a global block stored via the
  5750. * API.
  5751. *
  5752. * @param {Object} blockOrType Block or Block Type to test.
  5753. *
  5754. * @return {boolean} Whether the given block is a reusable block.
  5755. */
  5756. function isReusableBlock(blockOrType) {
  5757. return blockOrType.name === 'core/block';
  5758. }
  5759. /**
  5760. * Returns an array with the child blocks of a given block.
  5761. *
  5762. * @param {string} blockName Name of block (example: “latest-posts”).
  5763. *
  5764. * @return {Array} Array of child block names.
  5765. */
  5766. var registration_getChildBlockNames = function getChildBlockNames(blockName) {
  5767. return Object(external_this_wp_data_["select"])('core/blocks').getChildBlockNames(blockName);
  5768. };
  5769. /**
  5770. * Returns a boolean indicating if a block has child blocks or not.
  5771. *
  5772. * @param {string} blockName Name of block (example: “latest-posts”).
  5773. *
  5774. * @return {boolean} True if a block contains child blocks and false otherwise.
  5775. */
  5776. var registration_hasChildBlocks = function hasChildBlocks(blockName) {
  5777. return Object(external_this_wp_data_["select"])('core/blocks').hasChildBlocks(blockName);
  5778. };
  5779. /**
  5780. * Returns a boolean indicating if a block has at least one child block with inserter support.
  5781. *
  5782. * @param {string} blockName Block type name.
  5783. *
  5784. * @return {boolean} True if a block contains at least one child blocks with inserter support
  5785. * and false otherwise.
  5786. */
  5787. var registration_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(blockName) {
  5788. return Object(external_this_wp_data_["select"])('core/blocks').hasChildBlocksWithInserterSupport(blockName);
  5789. };
  5790. /**
  5791. * Registers a new block style variation for the given block.
  5792. *
  5793. * @param {string} blockName Name of block (example: “core/latest-posts”).
  5794. * @param {Object} styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user.
  5795. */
  5796. var registration_registerBlockStyle = function registerBlockStyle(blockName, styleVariation) {
  5797. Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockStyles(blockName, styleVariation);
  5798. };
  5799. /**
  5800. * Unregisters a block style variation for the given block.
  5801. *
  5802. * @param {string} blockName Name of block (example: “core/latest-posts”).
  5803. * @param {string} styleVariationName Name of class applied to the block.
  5804. */
  5805. var registration_unregisterBlockStyle = function unregisterBlockStyle(blockName, styleVariationName) {
  5806. Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockStyles(blockName, styleVariationName);
  5807. };
  5808. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js
  5809. /**
  5810. * External dependencies
  5811. */
  5812. /**
  5813. * WordPress dependencies
  5814. */
  5815. /**
  5816. * Internal dependencies
  5817. */
  5818. /**
  5819. * Returns a block object given its type and attributes.
  5820. *
  5821. * @param {string} name Block name.
  5822. * @param {Object} attributes Block attributes.
  5823. * @param {?Array} innerBlocks Nested blocks.
  5824. *
  5825. * @return {Object} Block object.
  5826. */
  5827. function createBlock(name) {
  5828. var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5829. var innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  5830. // Get the type definition associated with a registered block.
  5831. var blockType = registration_getBlockType(name); // Ensure attributes contains only values defined by block type, and merge
  5832. // default values for missing attributes.
  5833. var sanitizedAttributes = Object(external_lodash_["reduce"])(blockType.attributes, function (result, schema, key) {
  5834. var value = attributes[key];
  5835. if (undefined !== value) {
  5836. result[key] = value;
  5837. } else if (schema.hasOwnProperty('default')) {
  5838. result[key] = schema.default;
  5839. }
  5840. if (['node', 'children'].indexOf(schema.source) !== -1) {
  5841. // Ensure value passed is always an array, which we're expecting in
  5842. // the RichText component to handle the deprecated value.
  5843. if (typeof result[key] === 'string') {
  5844. result[key] = [result[key]];
  5845. } else if (!Array.isArray(result[key])) {
  5846. result[key] = [];
  5847. }
  5848. }
  5849. return result;
  5850. }, {});
  5851. var clientId = v4_default()(); // Blocks are stored with a unique ID, the assigned type name, the block
  5852. // attributes, and their inner blocks.
  5853. return {
  5854. clientId: clientId,
  5855. name: name,
  5856. isValid: true,
  5857. attributes: sanitizedAttributes,
  5858. innerBlocks: innerBlocks
  5859. };
  5860. }
  5861. /**
  5862. * Given a block object, returns a copy of the block object, optionally merging
  5863. * new attributes and/or replacing its inner blocks.
  5864. *
  5865. * @param {Object} block Block instance.
  5866. * @param {Object} mergeAttributes Block attributes.
  5867. * @param {?Array} newInnerBlocks Nested blocks.
  5868. *
  5869. * @return {Object} A cloned block.
  5870. */
  5871. function cloneBlock(block) {
  5872. var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5873. var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined;
  5874. var clientId = v4_default()();
  5875. return Object(objectSpread["a" /* default */])({}, block, {
  5876. clientId: clientId,
  5877. attributes: Object(objectSpread["a" /* default */])({}, block.attributes, mergeAttributes),
  5878. innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) {
  5879. return cloneBlock(innerBlock);
  5880. })
  5881. });
  5882. }
  5883. /**
  5884. * Returns a boolean indicating whether a transform is possible based on
  5885. * various bits of context.
  5886. *
  5887. * @param {Object} transform The transform object to validate.
  5888. * @param {string} direction Is this a 'from' or 'to' transform.
  5889. * @param {Array} blocks The blocks to transform from.
  5890. *
  5891. * @return {boolean} Is the transform possible?
  5892. */
  5893. var factory_isPossibleTransformForSource = function isPossibleTransformForSource(transform, direction, blocks) {
  5894. if (Object(external_lodash_["isEmpty"])(blocks)) {
  5895. return false;
  5896. } // If multiple blocks are selected, only multi block transforms
  5897. // or wildcard transforms are allowed.
  5898. var isMultiBlock = blocks.length > 1;
  5899. var firstBlockName = Object(external_lodash_["first"])(blocks).name;
  5900. var isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
  5901. if (!isValidForMultiBlocks) {
  5902. return false;
  5903. } // Check non-wildcard transforms to ensure that transform is valid
  5904. // for a block selection of multiple blocks of different types
  5905. if (!isWildcardBlockTransform(transform) && !Object(external_lodash_["every"])(blocks, {
  5906. name: firstBlockName
  5907. })) {
  5908. return false;
  5909. } // Only consider 'block' type transforms as valid.
  5910. var isBlockType = transform.type === 'block';
  5911. if (!isBlockType) {
  5912. return false;
  5913. } // Check if the transform's block name matches the source block (or is a wildcard)
  5914. // only if this is a transform 'from'.
  5915. var sourceBlock = Object(external_lodash_["first"])(blocks);
  5916. var hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
  5917. if (!hasMatchingName) {
  5918. return false;
  5919. } // Don't allow single Grouping blocks to be transformed into
  5920. // a Grouping block.
  5921. if (!isMultiBlock && factory_isContainerGroupBlock(sourceBlock.name) && factory_isContainerGroupBlock(transform.blockName)) {
  5922. return false;
  5923. } // If the transform has a `isMatch` function specified, check that it returns true.
  5924. if (Object(external_lodash_["isFunction"])(transform.isMatch)) {
  5925. var attributes = transform.isMultiBlock ? blocks.map(function (block) {
  5926. return block.attributes;
  5927. }) : sourceBlock.attributes;
  5928. if (!transform.isMatch(attributes)) {
  5929. return false;
  5930. }
  5931. }
  5932. return true;
  5933. };
  5934. /**
  5935. * Returns block types that the 'blocks' can be transformed into, based on
  5936. * 'from' transforms on other blocks.
  5937. *
  5938. * @param {Array} blocks The blocks to transform from.
  5939. *
  5940. * @return {Array} Block types that the blocks can be transformed into.
  5941. */
  5942. var factory_getBlockTypesForPossibleFromTransforms = function getBlockTypesForPossibleFromTransforms(blocks) {
  5943. if (Object(external_lodash_["isEmpty"])(blocks)) {
  5944. return [];
  5945. }
  5946. var allBlockTypes = registration_getBlockTypes(); // filter all blocks to find those with a 'from' transform.
  5947. var blockTypesWithPossibleFromTransforms = Object(external_lodash_["filter"])(allBlockTypes, function (blockType) {
  5948. var fromTransforms = getBlockTransforms('from', blockType.name);
  5949. return !!findTransform(fromTransforms, function (transform) {
  5950. return factory_isPossibleTransformForSource(transform, 'from', blocks);
  5951. });
  5952. });
  5953. return blockTypesWithPossibleFromTransforms;
  5954. };
  5955. /**
  5956. * Returns block types that the 'blocks' can be transformed into, based on
  5957. * the source block's own 'to' transforms.
  5958. *
  5959. * @param {Array} blocks The blocks to transform from.
  5960. *
  5961. * @return {Array} Block types that the source can be transformed into.
  5962. */
  5963. var factory_getBlockTypesForPossibleToTransforms = function getBlockTypesForPossibleToTransforms(blocks) {
  5964. if (Object(external_lodash_["isEmpty"])(blocks)) {
  5965. return [];
  5966. }
  5967. var sourceBlock = Object(external_lodash_["first"])(blocks);
  5968. var blockType = registration_getBlockType(sourceBlock.name);
  5969. var transformsTo = getBlockTransforms('to', blockType.name); // filter all 'to' transforms to find those that are possible.
  5970. var possibleTransforms = Object(external_lodash_["filter"])(transformsTo, function (transform) {
  5971. return transform && factory_isPossibleTransformForSource(transform, 'to', blocks);
  5972. }); // Build a list of block names using the possible 'to' transforms.
  5973. var blockNames = Object(external_lodash_["flatMap"])(possibleTransforms, function (transformation) {
  5974. return transformation.blocks;
  5975. }); // Map block names to block types.
  5976. return blockNames.map(function (name) {
  5977. return registration_getBlockType(name);
  5978. });
  5979. };
  5980. /**
  5981. * Determines whether transform is a "block" type
  5982. * and if so whether it is a "wildcard" transform
  5983. * ie: targets "any" block type
  5984. *
  5985. * @param {Object} t the Block transform object
  5986. *
  5987. * @return {boolean} whether transform is a wildcard transform
  5988. */
  5989. var isWildcardBlockTransform = function isWildcardBlockTransform(t) {
  5990. return t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*');
  5991. };
  5992. /**
  5993. * Determines whether the given Block is the core Block which
  5994. * acts as a container Block for other Blocks as part of the
  5995. * Grouping mechanics
  5996. *
  5997. * @param {string} name the name of the Block to test against
  5998. *
  5999. * @return {boolean} whether or not the Block is the container Block type
  6000. */
  6001. var factory_isContainerGroupBlock = function isContainerGroupBlock(name) {
  6002. return name === registration_getGroupingBlockName();
  6003. };
  6004. /**
  6005. * Determines whether the provided Blocks are of the same type
  6006. * (eg: all `core/paragraph`).
  6007. *
  6008. * @param {Array} blocksArray the Block definitions
  6009. *
  6010. * @return {boolean} whether or not the given Blocks pass the criteria
  6011. */
  6012. var factory_isBlockSelectionOfSameType = function isBlockSelectionOfSameType() {
  6013. var blocksArray = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  6014. if (!blocksArray.length) {
  6015. return false;
  6016. }
  6017. var sourceName = blocksArray[0].name;
  6018. return Object(external_lodash_["every"])(blocksArray, ['name', sourceName]);
  6019. };
  6020. /**
  6021. * Returns an array of block types that the set of blocks received as argument
  6022. * can be transformed into.
  6023. *
  6024. * @param {Array} blocks Blocks array.
  6025. *
  6026. * @return {Array} Block types that the blocks argument can be transformed to.
  6027. */
  6028. function getPossibleBlockTransformations(blocks) {
  6029. if (Object(external_lodash_["isEmpty"])(blocks)) {
  6030. return [];
  6031. }
  6032. var blockTypesForFromTransforms = factory_getBlockTypesForPossibleFromTransforms(blocks);
  6033. var blockTypesForToTransforms = factory_getBlockTypesForPossibleToTransforms(blocks);
  6034. return Object(external_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(blockTypesForFromTransforms), Object(toConsumableArray["a" /* default */])(blockTypesForToTransforms)));
  6035. }
  6036. /**
  6037. * Given an array of transforms, returns the highest-priority transform where
  6038. * the predicate function returns a truthy value. A higher-priority transform
  6039. * is one with a lower priority value (i.e. first in priority order). Returns
  6040. * null if the transforms set is empty or the predicate function returns a
  6041. * falsey value for all entries.
  6042. *
  6043. * @param {Object[]} transforms Transforms to search.
  6044. * @param {Function} predicate Function returning true on matching transform.
  6045. *
  6046. * @return {?Object} Highest-priority transform candidate.
  6047. */
  6048. function findTransform(transforms, predicate) {
  6049. // The hooks library already has built-in mechanisms for managing priority
  6050. // queue, so leverage via locally-defined instance.
  6051. var hooks = Object(external_this_wp_hooks_["createHooks"])();
  6052. var _loop = function _loop(i) {
  6053. var candidate = transforms[i];
  6054. if (predicate(candidate)) {
  6055. hooks.addFilter('transform', 'transform/' + i.toString(), function (result) {
  6056. return result ? result : candidate;
  6057. }, candidate.priority);
  6058. }
  6059. };
  6060. for (var i = 0; i < transforms.length; i++) {
  6061. _loop(i);
  6062. } // Filter name is arbitrarily chosen but consistent with above aggregation.
  6063. return hooks.applyFilters('transform', null);
  6064. }
  6065. /**
  6066. * Returns normal block transforms for a given transform direction, optionally
  6067. * for a specific block by name, or an empty array if there are no transforms.
  6068. * If no block name is provided, returns transforms for all blocks. A normal
  6069. * transform object includes `blockName` as a property.
  6070. *
  6071. * @param {string} direction Transform direction ("to", "from").
  6072. * @param {string|Object} blockTypeOrName Block type or name.
  6073. *
  6074. * @return {Array} Block transforms for direction.
  6075. */
  6076. function getBlockTransforms(direction, blockTypeOrName) {
  6077. // When retrieving transforms for all block types, recurse into self.
  6078. if (blockTypeOrName === undefined) {
  6079. return Object(external_lodash_["flatMap"])(registration_getBlockTypes(), function (_ref) {
  6080. var name = _ref.name;
  6081. return getBlockTransforms(direction, name);
  6082. });
  6083. } // Validate that block type exists and has array of direction.
  6084. var blockType = normalizeBlockType(blockTypeOrName);
  6085. var _ref2 = blockType || {},
  6086. blockName = _ref2.name,
  6087. transforms = _ref2.transforms;
  6088. if (!transforms || !Array.isArray(transforms[direction])) {
  6089. return [];
  6090. } // Map transforms to normal form.
  6091. return transforms[direction].map(function (transform) {
  6092. return Object(objectSpread["a" /* default */])({}, transform, {
  6093. blockName: blockName
  6094. });
  6095. });
  6096. }
  6097. /**
  6098. * Switch one or more blocks into one or more blocks of the new block type.
  6099. *
  6100. * @param {Array|Object} blocks Blocks array or block object.
  6101. * @param {string} name Block name.
  6102. *
  6103. * @return {?Array} Array of blocks or null.
  6104. */
  6105. function switchToBlockType(blocks, name) {
  6106. var blocksArray = Object(external_lodash_["castArray"])(blocks);
  6107. var isMultiBlock = blocksArray.length > 1;
  6108. var firstBlock = blocksArray[0];
  6109. var sourceName = firstBlock.name; // Unless it's a Grouping Block then for multi block selections
  6110. // check that all Blocks are of the same type otherwise
  6111. // we can't run a conversion
  6112. if (!factory_isContainerGroupBlock(name) && isMultiBlock && !factory_isBlockSelectionOfSameType(blocksArray)) {
  6113. return null;
  6114. } // Find the right transformation by giving priority to the "to"
  6115. // transformation.
  6116. var transformationsFrom = getBlockTransforms('from', name);
  6117. var transformationsTo = getBlockTransforms('to', sourceName);
  6118. var transformation = findTransform(transformationsTo, function (t) {
  6119. return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock);
  6120. }) || findTransform(transformationsFrom, function (t) {
  6121. return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock);
  6122. }); // Stop if there is no valid transformation.
  6123. if (!transformation) {
  6124. return null;
  6125. }
  6126. var transformationResults;
  6127. if (transformation.isMultiBlock) {
  6128. if (Object(external_lodash_["has"])(transformation, '__experimentalConvert')) {
  6129. transformationResults = transformation.__experimentalConvert(blocksArray);
  6130. } else {
  6131. transformationResults = transformation.transform(blocksArray.map(function (currentBlock) {
  6132. return currentBlock.attributes;
  6133. }), blocksArray.map(function (currentBlock) {
  6134. return currentBlock.innerBlocks;
  6135. }));
  6136. }
  6137. } else if (Object(external_lodash_["has"])(transformation, '__experimentalConvert')) {
  6138. transformationResults = transformation.__experimentalConvert(firstBlock);
  6139. } else {
  6140. transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks);
  6141. } // Ensure that the transformation function returned an object or an array
  6142. // of objects.
  6143. if (!Object(external_lodash_["isObjectLike"])(transformationResults)) {
  6144. return null;
  6145. } // If the transformation function returned a single object, we want to work
  6146. // with an array instead.
  6147. transformationResults = Object(external_lodash_["castArray"])(transformationResults); // Ensure that every block object returned by the transformation has a
  6148. // valid block type.
  6149. if (transformationResults.some(function (result) {
  6150. return !registration_getBlockType(result.name);
  6151. })) {
  6152. return null;
  6153. }
  6154. var firstSwitchedBlock = Object(external_lodash_["findIndex"])(transformationResults, function (result) {
  6155. return result.name === name;
  6156. }); // Ensure that at least one block object returned by the transformation has
  6157. // the expected "destination" block type.
  6158. if (firstSwitchedBlock < 0) {
  6159. return null;
  6160. }
  6161. return transformationResults.map(function (result, index) {
  6162. var transformedBlock = Object(objectSpread["a" /* default */])({}, result, {
  6163. // The first transformed block whose type matches the "destination"
  6164. // type gets to keep the existing client ID of the first block.
  6165. clientId: index === firstSwitchedBlock ? firstBlock.clientId : result.clientId
  6166. });
  6167. /**
  6168. * Filters an individual transform result from block transformation.
  6169. * All of the original blocks are passed, since transformations are
  6170. * many-to-many, not one-to-one.
  6171. *
  6172. * @param {Object} transformedBlock The transformed block.
  6173. * @param {Object[]} blocks Original blocks transformed.
  6174. */
  6175. return Object(external_this_wp_hooks_["applyFilters"])('blocks.switchToBlockType.transformedBlock', transformedBlock, blocks);
  6176. });
  6177. }
  6178. /**
  6179. * Create a block object from the example API.
  6180. *
  6181. * @param {string} name
  6182. * @param {Object} example
  6183. *
  6184. * @return {Object} block.
  6185. */
  6186. var factory_getBlockFromExample = function getBlockFromExample(name, example) {
  6187. return createBlock(name, example.attributes, Object(external_lodash_["map"])(example.innerBlocks, function (innerBlock) {
  6188. return getBlockFromExample(innerBlock.name, innerBlock);
  6189. }));
  6190. };
  6191. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
  6192. var slicedToArray = __webpack_require__(23);
  6193. // CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js
  6194. /**
  6195. * Given object and string of dot-delimited path segments, returns value at
  6196. * path or undefined if path cannot be resolved.
  6197. *
  6198. * @param {Object} object Lookup object
  6199. * @param {string} path Path to resolve
  6200. * @return {?*} Resolved value
  6201. */
  6202. function getPath(object, path) {
  6203. var segments = path.split('.');
  6204. var segment;
  6205. while (segment = segments.shift()) {
  6206. if (!(segment in object)) {
  6207. return;
  6208. }
  6209. object = object[segment];
  6210. }
  6211. return object;
  6212. }
  6213. // CONCATENATED MODULE: ./node_modules/hpq/es/index.js
  6214. /**
  6215. * Internal dependencies
  6216. */
  6217. /**
  6218. * Function returning a DOM document created by `createHTMLDocument`. The same
  6219. * document is returned between invocations.
  6220. *
  6221. * @return {Document} DOM document.
  6222. */
  6223. var getDocument = function () {
  6224. var doc;
  6225. return function () {
  6226. if (!doc) {
  6227. doc = document.implementation.createHTMLDocument('');
  6228. }
  6229. return doc;
  6230. };
  6231. }();
  6232. /**
  6233. * Given a markup string or DOM element, creates an object aligning with the
  6234. * shape of the matchers object, or the value returned by the matcher.
  6235. *
  6236. * @param {(string|Element)} source Source content
  6237. * @param {(Object|Function)} matchers Matcher function or object of matchers
  6238. * @return {(Object|*)} Matched value(s), shaped by object
  6239. */
  6240. function es_parse(source, matchers) {
  6241. if (!matchers) {
  6242. return;
  6243. } // Coerce to element
  6244. if ('string' === typeof source) {
  6245. var doc = getDocument();
  6246. doc.body.innerHTML = source;
  6247. source = doc.body;
  6248. } // Return singular value
  6249. if ('function' === typeof matchers) {
  6250. return matchers(source);
  6251. } // Bail if we can't handle matchers
  6252. if (Object !== matchers.constructor) {
  6253. return;
  6254. } // Shape result by matcher object
  6255. return Object.keys(matchers).reduce(function (memo, key) {
  6256. memo[key] = es_parse(source, matchers[key]);
  6257. return memo;
  6258. }, {});
  6259. }
  6260. /**
  6261. * Generates a function which matches node of type selector, returning an
  6262. * attribute by property if the attribute exists. If no selector is passed,
  6263. * returns property of the query element.
  6264. *
  6265. * @param {?string} selector Optional selector
  6266. * @param {string} name Property name
  6267. * @return {*} Property value
  6268. */
  6269. function prop(selector, name) {
  6270. if (1 === arguments.length) {
  6271. name = selector;
  6272. selector = undefined;
  6273. }
  6274. return function (node) {
  6275. var match = node;
  6276. if (selector) {
  6277. match = node.querySelector(selector);
  6278. }
  6279. if (match) {
  6280. return getPath(match, name);
  6281. }
  6282. };
  6283. }
  6284. /**
  6285. * Generates a function which matches node of type selector, returning an
  6286. * attribute by name if the attribute exists. If no selector is passed,
  6287. * returns attribute of the query element.
  6288. *
  6289. * @param {?string} selector Optional selector
  6290. * @param {string} name Attribute name
  6291. * @return {?string} Attribute value
  6292. */
  6293. function attr(selector, name) {
  6294. if (1 === arguments.length) {
  6295. name = selector;
  6296. selector = undefined;
  6297. }
  6298. return function (node) {
  6299. var attributes = prop(selector, 'attributes')(node);
  6300. if (attributes && attributes.hasOwnProperty(name)) {
  6301. return attributes[name].value;
  6302. }
  6303. };
  6304. }
  6305. /**
  6306. * Convenience for `prop( selector, 'innerHTML' )`.
  6307. *
  6308. * @see prop()
  6309. *
  6310. * @param {?string} selector Optional selector
  6311. * @return {string} Inner HTML
  6312. */
  6313. function es_html(selector) {
  6314. return prop(selector, 'innerHTML');
  6315. }
  6316. /**
  6317. * Convenience for `prop( selector, 'textContent' )`.
  6318. *
  6319. * @see prop()
  6320. *
  6321. * @param {?string} selector Optional selector
  6322. * @return {string} Text content
  6323. */
  6324. function es_text(selector) {
  6325. return prop(selector, 'textContent');
  6326. }
  6327. /**
  6328. * Creates a new matching context by first finding elements matching selector
  6329. * using querySelectorAll before then running another `parse` on `matchers`
  6330. * scoped to the matched elements.
  6331. *
  6332. * @see parse()
  6333. *
  6334. * @param {string} selector Selector to match
  6335. * @param {(Object|Function)} matchers Matcher function or object of matchers
  6336. * @return {Array.<*,Object>} Array of matched value(s)
  6337. */
  6338. function query(selector, matchers) {
  6339. return function (node) {
  6340. var matches = node.querySelectorAll(selector);
  6341. return [].map.call(matches, function (match) {
  6342. return es_parse(match, matchers);
  6343. });
  6344. };
  6345. }
  6346. // EXTERNAL MODULE: external {"this":["wp","autop"]}
  6347. var external_this_wp_autop_ = __webpack_require__(69);
  6348. // EXTERNAL MODULE: external {"this":["wp","blockSerializationDefaultParser"]}
  6349. var external_this_wp_blockSerializationDefaultParser_ = __webpack_require__(222);
  6350. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
  6351. var arrayWithHoles = __webpack_require__(38);
  6352. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
  6353. var iterableToArray = __webpack_require__(30);
  6354. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
  6355. var nonIterableRest = __webpack_require__(39);
  6356. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js
  6357. function _toArray(arr) {
  6358. return Object(arrayWithHoles["a" /* default */])(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(nonIterableRest["a" /* default */])();
  6359. }
  6360. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
  6361. var classCallCheck = __webpack_require__(12);
  6362. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
  6363. var createClass = __webpack_require__(11);
  6364. // CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js
  6365. /**
  6366. * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json
  6367. * do not edit
  6368. */
  6369. var namedCharRefs = {
  6370. Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "​", NegativeThickSpace: "​", NegativeThinSpace: "​", NegativeVeryThinSpace: "​", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: "  ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "​", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c"
  6371. };
  6372. var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
  6373. var CHARCODE = /^#([0-9]+)$/;
  6374. var NAMED = /^([A-Za-z0-9]+)$/;
  6375. var EntityParser = /** @class */ (function () {
  6376. function EntityParser(named) {
  6377. this.named = named;
  6378. }
  6379. EntityParser.prototype.parse = function (entity) {
  6380. if (!entity) {
  6381. return;
  6382. }
  6383. var matches = entity.match(HEXCHARCODE);
  6384. if (matches) {
  6385. return String.fromCharCode(parseInt(matches[1], 16));
  6386. }
  6387. matches = entity.match(CHARCODE);
  6388. if (matches) {
  6389. return String.fromCharCode(parseInt(matches[1], 10));
  6390. }
  6391. matches = entity.match(NAMED);
  6392. if (matches) {
  6393. return this.named[matches[1]];
  6394. }
  6395. };
  6396. return EntityParser;
  6397. }());
  6398. var WSP = /[\t\n\f ]/;
  6399. var ALPHA = /[A-Za-z]/;
  6400. var CRLF = /\r\n?/g;
  6401. function isSpace(char) {
  6402. return WSP.test(char);
  6403. }
  6404. function isAlpha(char) {
  6405. return ALPHA.test(char);
  6406. }
  6407. function preprocessInput(input) {
  6408. return input.replace(CRLF, '\n');
  6409. }
  6410. var EventedTokenizer = /** @class */ (function () {
  6411. function EventedTokenizer(delegate, entityParser) {
  6412. this.delegate = delegate;
  6413. this.entityParser = entityParser;
  6414. this.state = "beforeData" /* beforeData */;
  6415. this.line = -1;
  6416. this.column = -1;
  6417. this.input = '';
  6418. this.index = -1;
  6419. this.tagNameBuffer = '';
  6420. this.states = {
  6421. beforeData: function () {
  6422. var char = this.peek();
  6423. if (char === '<' && !this.isIgnoredEndTag()) {
  6424. this.transitionTo("tagOpen" /* tagOpen */);
  6425. this.markTagStart();
  6426. this.consume();
  6427. }
  6428. else {
  6429. if (char === '\n') {
  6430. var tag = this.tagNameBuffer.toLowerCase();
  6431. if (tag === 'pre' || tag === 'textarea') {
  6432. this.consume();
  6433. }
  6434. }
  6435. this.transitionTo("data" /* data */);
  6436. this.delegate.beginData();
  6437. }
  6438. },
  6439. data: function () {
  6440. var char = this.peek();
  6441. var tag = this.tagNameBuffer.toLowerCase();
  6442. if (char === '<' && !this.isIgnoredEndTag()) {
  6443. this.delegate.finishData();
  6444. this.transitionTo("tagOpen" /* tagOpen */);
  6445. this.markTagStart();
  6446. this.consume();
  6447. }
  6448. else if (char === '&' && tag !== 'script' && tag !== 'style') {
  6449. this.consume();
  6450. this.delegate.appendToData(this.consumeCharRef() || '&');
  6451. }
  6452. else {
  6453. this.consume();
  6454. this.delegate.appendToData(char);
  6455. }
  6456. },
  6457. tagOpen: function () {
  6458. var char = this.consume();
  6459. if (char === '!') {
  6460. this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */);
  6461. }
  6462. else if (char === '/') {
  6463. this.transitionTo("endTagOpen" /* endTagOpen */);
  6464. }
  6465. else if (char === '@' || char === ':' || isAlpha(char)) {
  6466. this.transitionTo("tagName" /* tagName */);
  6467. this.tagNameBuffer = '';
  6468. this.delegate.beginStartTag();
  6469. this.appendToTagName(char);
  6470. }
  6471. },
  6472. markupDeclarationOpen: function () {
  6473. var char = this.consume();
  6474. if (char === '-' && this.peek() === '-') {
  6475. this.consume();
  6476. this.transitionTo("commentStart" /* commentStart */);
  6477. this.delegate.beginComment();
  6478. }
  6479. },
  6480. commentStart: function () {
  6481. var char = this.consume();
  6482. if (char === '-') {
  6483. this.transitionTo("commentStartDash" /* commentStartDash */);
  6484. }
  6485. else if (char === '>') {
  6486. this.delegate.finishComment();
  6487. this.transitionTo("beforeData" /* beforeData */);
  6488. }
  6489. else {
  6490. this.delegate.appendToCommentData(char);
  6491. this.transitionTo("comment" /* comment */);
  6492. }
  6493. },
  6494. commentStartDash: function () {
  6495. var char = this.consume();
  6496. if (char === '-') {
  6497. this.transitionTo("commentEnd" /* commentEnd */);
  6498. }
  6499. else if (char === '>') {
  6500. this.delegate.finishComment();
  6501. this.transitionTo("beforeData" /* beforeData */);
  6502. }
  6503. else {
  6504. this.delegate.appendToCommentData('-');
  6505. this.transitionTo("comment" /* comment */);
  6506. }
  6507. },
  6508. comment: function () {
  6509. var char = this.consume();
  6510. if (char === '-') {
  6511. this.transitionTo("commentEndDash" /* commentEndDash */);
  6512. }
  6513. else {
  6514. this.delegate.appendToCommentData(char);
  6515. }
  6516. },
  6517. commentEndDash: function () {
  6518. var char = this.consume();
  6519. if (char === '-') {
  6520. this.transitionTo("commentEnd" /* commentEnd */);
  6521. }
  6522. else {
  6523. this.delegate.appendToCommentData('-' + char);
  6524. this.transitionTo("comment" /* comment */);
  6525. }
  6526. },
  6527. commentEnd: function () {
  6528. var char = this.consume();
  6529. if (char === '>') {
  6530. this.delegate.finishComment();
  6531. this.transitionTo("beforeData" /* beforeData */);
  6532. }
  6533. else {
  6534. this.delegate.appendToCommentData('--' + char);
  6535. this.transitionTo("comment" /* comment */);
  6536. }
  6537. },
  6538. tagName: function () {
  6539. var char = this.consume();
  6540. if (isSpace(char)) {
  6541. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  6542. }
  6543. else if (char === '/') {
  6544. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6545. }
  6546. else if (char === '>') {
  6547. this.delegate.finishTag();
  6548. this.transitionTo("beforeData" /* beforeData */);
  6549. }
  6550. else {
  6551. this.appendToTagName(char);
  6552. }
  6553. },
  6554. endTagName: function () {
  6555. var char = this.consume();
  6556. if (isSpace(char)) {
  6557. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  6558. this.tagNameBuffer = '';
  6559. }
  6560. else if (char === '/') {
  6561. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6562. this.tagNameBuffer = '';
  6563. }
  6564. else if (char === '>') {
  6565. this.delegate.finishTag();
  6566. this.transitionTo("beforeData" /* beforeData */);
  6567. this.tagNameBuffer = '';
  6568. }
  6569. else {
  6570. this.appendToTagName(char);
  6571. }
  6572. },
  6573. beforeAttributeName: function () {
  6574. var char = this.peek();
  6575. if (isSpace(char)) {
  6576. this.consume();
  6577. return;
  6578. }
  6579. else if (char === '/') {
  6580. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6581. this.consume();
  6582. }
  6583. else if (char === '>') {
  6584. this.consume();
  6585. this.delegate.finishTag();
  6586. this.transitionTo("beforeData" /* beforeData */);
  6587. }
  6588. else if (char === '=') {
  6589. this.delegate.reportSyntaxError('attribute name cannot start with equals sign');
  6590. this.transitionTo("attributeName" /* attributeName */);
  6591. this.delegate.beginAttribute();
  6592. this.consume();
  6593. this.delegate.appendToAttributeName(char);
  6594. }
  6595. else {
  6596. this.transitionTo("attributeName" /* attributeName */);
  6597. this.delegate.beginAttribute();
  6598. }
  6599. },
  6600. attributeName: function () {
  6601. var char = this.peek();
  6602. if (isSpace(char)) {
  6603. this.transitionTo("afterAttributeName" /* afterAttributeName */);
  6604. this.consume();
  6605. }
  6606. else if (char === '/') {
  6607. this.delegate.beginAttributeValue(false);
  6608. this.delegate.finishAttributeValue();
  6609. this.consume();
  6610. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6611. }
  6612. else if (char === '=') {
  6613. this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
  6614. this.consume();
  6615. }
  6616. else if (char === '>') {
  6617. this.delegate.beginAttributeValue(false);
  6618. this.delegate.finishAttributeValue();
  6619. this.consume();
  6620. this.delegate.finishTag();
  6621. this.transitionTo("beforeData" /* beforeData */);
  6622. }
  6623. else if (char === '"' || char === "'" || char === '<') {
  6624. this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names');
  6625. this.consume();
  6626. this.delegate.appendToAttributeName(char);
  6627. }
  6628. else {
  6629. this.consume();
  6630. this.delegate.appendToAttributeName(char);
  6631. }
  6632. },
  6633. afterAttributeName: function () {
  6634. var char = this.peek();
  6635. if (isSpace(char)) {
  6636. this.consume();
  6637. return;
  6638. }
  6639. else if (char === '/') {
  6640. this.delegate.beginAttributeValue(false);
  6641. this.delegate.finishAttributeValue();
  6642. this.consume();
  6643. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6644. }
  6645. else if (char === '=') {
  6646. this.consume();
  6647. this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
  6648. }
  6649. else if (char === '>') {
  6650. this.delegate.beginAttributeValue(false);
  6651. this.delegate.finishAttributeValue();
  6652. this.consume();
  6653. this.delegate.finishTag();
  6654. this.transitionTo("beforeData" /* beforeData */);
  6655. }
  6656. else {
  6657. this.delegate.beginAttributeValue(false);
  6658. this.delegate.finishAttributeValue();
  6659. this.transitionTo("attributeName" /* attributeName */);
  6660. this.delegate.beginAttribute();
  6661. this.consume();
  6662. this.delegate.appendToAttributeName(char);
  6663. }
  6664. },
  6665. beforeAttributeValue: function () {
  6666. var char = this.peek();
  6667. if (isSpace(char)) {
  6668. this.consume();
  6669. }
  6670. else if (char === '"') {
  6671. this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */);
  6672. this.delegate.beginAttributeValue(true);
  6673. this.consume();
  6674. }
  6675. else if (char === "'") {
  6676. this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */);
  6677. this.delegate.beginAttributeValue(true);
  6678. this.consume();
  6679. }
  6680. else if (char === '>') {
  6681. this.delegate.beginAttributeValue(false);
  6682. this.delegate.finishAttributeValue();
  6683. this.consume();
  6684. this.delegate.finishTag();
  6685. this.transitionTo("beforeData" /* beforeData */);
  6686. }
  6687. else {
  6688. this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
  6689. this.delegate.beginAttributeValue(false);
  6690. this.consume();
  6691. this.delegate.appendToAttributeValue(char);
  6692. }
  6693. },
  6694. attributeValueDoubleQuoted: function () {
  6695. var char = this.consume();
  6696. if (char === '"') {
  6697. this.delegate.finishAttributeValue();
  6698. this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
  6699. }
  6700. else if (char === '&') {
  6701. this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
  6702. }
  6703. else {
  6704. this.delegate.appendToAttributeValue(char);
  6705. }
  6706. },
  6707. attributeValueSingleQuoted: function () {
  6708. var char = this.consume();
  6709. if (char === "'") {
  6710. this.delegate.finishAttributeValue();
  6711. this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
  6712. }
  6713. else if (char === '&') {
  6714. this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
  6715. }
  6716. else {
  6717. this.delegate.appendToAttributeValue(char);
  6718. }
  6719. },
  6720. attributeValueUnquoted: function () {
  6721. var char = this.peek();
  6722. if (isSpace(char)) {
  6723. this.delegate.finishAttributeValue();
  6724. this.consume();
  6725. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  6726. }
  6727. else if (char === '/') {
  6728. this.delegate.finishAttributeValue();
  6729. this.consume();
  6730. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6731. }
  6732. else if (char === '&') {
  6733. this.consume();
  6734. this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
  6735. }
  6736. else if (char === '>') {
  6737. this.delegate.finishAttributeValue();
  6738. this.consume();
  6739. this.delegate.finishTag();
  6740. this.transitionTo("beforeData" /* beforeData */);
  6741. }
  6742. else {
  6743. this.consume();
  6744. this.delegate.appendToAttributeValue(char);
  6745. }
  6746. },
  6747. afterAttributeValueQuoted: function () {
  6748. var char = this.peek();
  6749. if (isSpace(char)) {
  6750. this.consume();
  6751. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  6752. }
  6753. else if (char === '/') {
  6754. this.consume();
  6755. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  6756. }
  6757. else if (char === '>') {
  6758. this.consume();
  6759. this.delegate.finishTag();
  6760. this.transitionTo("beforeData" /* beforeData */);
  6761. }
  6762. else {
  6763. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  6764. }
  6765. },
  6766. selfClosingStartTag: function () {
  6767. var char = this.peek();
  6768. if (char === '>') {
  6769. this.consume();
  6770. this.delegate.markTagAsSelfClosing();
  6771. this.delegate.finishTag();
  6772. this.transitionTo("beforeData" /* beforeData */);
  6773. }
  6774. else {
  6775. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  6776. }
  6777. },
  6778. endTagOpen: function () {
  6779. var char = this.consume();
  6780. if (char === '@' || char === ':' || isAlpha(char)) {
  6781. this.transitionTo("endTagName" /* endTagName */);
  6782. this.tagNameBuffer = '';
  6783. this.delegate.beginEndTag();
  6784. this.appendToTagName(char);
  6785. }
  6786. }
  6787. };
  6788. this.reset();
  6789. }
  6790. EventedTokenizer.prototype.reset = function () {
  6791. this.transitionTo("beforeData" /* beforeData */);
  6792. this.input = '';
  6793. this.tagNameBuffer = '';
  6794. this.index = 0;
  6795. this.line = 1;
  6796. this.column = 0;
  6797. this.delegate.reset();
  6798. };
  6799. EventedTokenizer.prototype.transitionTo = function (state) {
  6800. this.state = state;
  6801. };
  6802. EventedTokenizer.prototype.tokenize = function (input) {
  6803. this.reset();
  6804. this.tokenizePart(input);
  6805. this.tokenizeEOF();
  6806. };
  6807. EventedTokenizer.prototype.tokenizePart = function (input) {
  6808. this.input += preprocessInput(input);
  6809. while (this.index < this.input.length) {
  6810. var handler = this.states[this.state];
  6811. if (handler !== undefined) {
  6812. handler.call(this);
  6813. }
  6814. else {
  6815. throw new Error("unhandled state " + this.state);
  6816. }
  6817. }
  6818. };
  6819. EventedTokenizer.prototype.tokenizeEOF = function () {
  6820. this.flushData();
  6821. };
  6822. EventedTokenizer.prototype.flushData = function () {
  6823. if (this.state === 'data') {
  6824. this.delegate.finishData();
  6825. this.transitionTo("beforeData" /* beforeData */);
  6826. }
  6827. };
  6828. EventedTokenizer.prototype.peek = function () {
  6829. return this.input.charAt(this.index);
  6830. };
  6831. EventedTokenizer.prototype.consume = function () {
  6832. var char = this.peek();
  6833. this.index++;
  6834. if (char === '\n') {
  6835. this.line++;
  6836. this.column = 0;
  6837. }
  6838. else {
  6839. this.column++;
  6840. }
  6841. return char;
  6842. };
  6843. EventedTokenizer.prototype.consumeCharRef = function () {
  6844. var endIndex = this.input.indexOf(';', this.index);
  6845. if (endIndex === -1) {
  6846. return;
  6847. }
  6848. var entity = this.input.slice(this.index, endIndex);
  6849. var chars = this.entityParser.parse(entity);
  6850. if (chars) {
  6851. var count = entity.length;
  6852. // consume the entity chars
  6853. while (count) {
  6854. this.consume();
  6855. count--;
  6856. }
  6857. // consume the `;`
  6858. this.consume();
  6859. return chars;
  6860. }
  6861. };
  6862. EventedTokenizer.prototype.markTagStart = function () {
  6863. this.delegate.tagOpen();
  6864. };
  6865. EventedTokenizer.prototype.appendToTagName = function (char) {
  6866. this.tagNameBuffer += char;
  6867. this.delegate.appendToTagName(char);
  6868. };
  6869. EventedTokenizer.prototype.isIgnoredEndTag = function () {
  6870. var tag = this.tagNameBuffer.toLowerCase();
  6871. return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
  6872. (tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
  6873. (tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>');
  6874. };
  6875. return EventedTokenizer;
  6876. }());
  6877. var Tokenizer = /** @class */ (function () {
  6878. function Tokenizer(entityParser, options) {
  6879. if (options === void 0) { options = {}; }
  6880. this.options = options;
  6881. this.token = null;
  6882. this.startLine = 1;
  6883. this.startColumn = 0;
  6884. this.tokens = [];
  6885. this.tokenizer = new EventedTokenizer(this, entityParser);
  6886. this._currentAttribute = undefined;
  6887. }
  6888. Tokenizer.prototype.tokenize = function (input) {
  6889. this.tokens = [];
  6890. this.tokenizer.tokenize(input);
  6891. return this.tokens;
  6892. };
  6893. Tokenizer.prototype.tokenizePart = function (input) {
  6894. this.tokens = [];
  6895. this.tokenizer.tokenizePart(input);
  6896. return this.tokens;
  6897. };
  6898. Tokenizer.prototype.tokenizeEOF = function () {
  6899. this.tokens = [];
  6900. this.tokenizer.tokenizeEOF();
  6901. return this.tokens[0];
  6902. };
  6903. Tokenizer.prototype.reset = function () {
  6904. this.token = null;
  6905. this.startLine = 1;
  6906. this.startColumn = 0;
  6907. };
  6908. Tokenizer.prototype.current = function () {
  6909. var token = this.token;
  6910. if (token === null) {
  6911. throw new Error('token was unexpectedly null');
  6912. }
  6913. if (arguments.length === 0) {
  6914. return token;
  6915. }
  6916. for (var i = 0; i < arguments.length; i++) {
  6917. if (token.type === arguments[i]) {
  6918. return token;
  6919. }
  6920. }
  6921. throw new Error("token type was unexpectedly " + token.type);
  6922. };
  6923. Tokenizer.prototype.push = function (token) {
  6924. this.token = token;
  6925. this.tokens.push(token);
  6926. };
  6927. Tokenizer.prototype.currentAttribute = function () {
  6928. return this._currentAttribute;
  6929. };
  6930. Tokenizer.prototype.addLocInfo = function () {
  6931. if (this.options.loc) {
  6932. this.current().loc = {
  6933. start: {
  6934. line: this.startLine,
  6935. column: this.startColumn
  6936. },
  6937. end: {
  6938. line: this.tokenizer.line,
  6939. column: this.tokenizer.column
  6940. }
  6941. };
  6942. }
  6943. this.startLine = this.tokenizer.line;
  6944. this.startColumn = this.tokenizer.column;
  6945. };
  6946. // Data
  6947. Tokenizer.prototype.beginData = function () {
  6948. this.push({
  6949. type: "Chars" /* Chars */,
  6950. chars: ''
  6951. });
  6952. };
  6953. Tokenizer.prototype.appendToData = function (char) {
  6954. this.current("Chars" /* Chars */).chars += char;
  6955. };
  6956. Tokenizer.prototype.finishData = function () {
  6957. this.addLocInfo();
  6958. };
  6959. // Comment
  6960. Tokenizer.prototype.beginComment = function () {
  6961. this.push({
  6962. type: "Comment" /* Comment */,
  6963. chars: ''
  6964. });
  6965. };
  6966. Tokenizer.prototype.appendToCommentData = function (char) {
  6967. this.current("Comment" /* Comment */).chars += char;
  6968. };
  6969. Tokenizer.prototype.finishComment = function () {
  6970. this.addLocInfo();
  6971. };
  6972. // Tags - basic
  6973. Tokenizer.prototype.tagOpen = function () { };
  6974. Tokenizer.prototype.beginStartTag = function () {
  6975. this.push({
  6976. type: "StartTag" /* StartTag */,
  6977. tagName: '',
  6978. attributes: [],
  6979. selfClosing: false
  6980. });
  6981. };
  6982. Tokenizer.prototype.beginEndTag = function () {
  6983. this.push({
  6984. type: "EndTag" /* EndTag */,
  6985. tagName: ''
  6986. });
  6987. };
  6988. Tokenizer.prototype.finishTag = function () {
  6989. this.addLocInfo();
  6990. };
  6991. Tokenizer.prototype.markTagAsSelfClosing = function () {
  6992. this.current("StartTag" /* StartTag */).selfClosing = true;
  6993. };
  6994. // Tags - name
  6995. Tokenizer.prototype.appendToTagName = function (char) {
  6996. this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char;
  6997. };
  6998. // Tags - attributes
  6999. Tokenizer.prototype.beginAttribute = function () {
  7000. this._currentAttribute = ['', '', false];
  7001. };
  7002. Tokenizer.prototype.appendToAttributeName = function (char) {
  7003. this.currentAttribute()[0] += char;
  7004. };
  7005. Tokenizer.prototype.beginAttributeValue = function (isQuoted) {
  7006. this.currentAttribute()[2] = isQuoted;
  7007. };
  7008. Tokenizer.prototype.appendToAttributeValue = function (char) {
  7009. this.currentAttribute()[1] += char;
  7010. };
  7011. Tokenizer.prototype.finishAttributeValue = function () {
  7012. this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
  7013. };
  7014. Tokenizer.prototype.reportSyntaxError = function (message) {
  7015. this.current().syntaxError = message;
  7016. };
  7017. return Tokenizer;
  7018. }());
  7019. function tokenize(input, options) {
  7020. var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options);
  7021. return tokenizer.tokenize(input);
  7022. }
  7023. // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]}
  7024. var external_this_wp_htmlEntities_ = __webpack_require__(52);
  7025. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/logger.js
  7026. function createLogger() {
  7027. /**
  7028. * Creates a log handler with block validation prefix.
  7029. *
  7030. * @param {Function} logger Original logger function.
  7031. *
  7032. * @return {Function} Augmented logger function.
  7033. */
  7034. function createLogHandler(logger) {
  7035. var log = function log(message) {
  7036. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  7037. args[_key - 1] = arguments[_key];
  7038. }
  7039. return logger.apply(void 0, ['Block validation: ' + message].concat(args));
  7040. }; // In test environments, pre-process the sprintf message to improve
  7041. // readability of error messages. We'd prefer to avoid pulling in this
  7042. // dependency in runtime environments, and it can be dropped by a combo
  7043. // of Webpack env substitution + UglifyJS dead code elimination.
  7044. if (false) {}
  7045. return log;
  7046. }
  7047. return {
  7048. // eslint-disable-next-line no-console
  7049. error: createLogHandler(console.error),
  7050. // eslint-disable-next-line no-console
  7051. warning: createLogHandler(console.warn),
  7052. getItems: function getItems() {
  7053. return [];
  7054. }
  7055. };
  7056. }
  7057. function createQueuedLogger() {
  7058. /**
  7059. * The list of enqueued log actions to print.
  7060. *
  7061. * @type {Array}
  7062. */
  7063. var queue = [];
  7064. var logger = createLogger();
  7065. return {
  7066. error: function error() {
  7067. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  7068. args[_key2] = arguments[_key2];
  7069. }
  7070. queue.push({
  7071. log: logger.error,
  7072. args: args
  7073. });
  7074. },
  7075. warning: function warning() {
  7076. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  7077. args[_key3] = arguments[_key3];
  7078. }
  7079. queue.push({
  7080. log: logger.warning,
  7081. args: args
  7082. });
  7083. },
  7084. getItems: function getItems() {
  7085. return queue;
  7086. }
  7087. };
  7088. }
  7089. // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
  7090. var external_this_wp_isShallowEqual_ = __webpack_require__(41);
  7091. var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
  7092. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  7093. var esm_extends = __webpack_require__(18);
  7094. // EXTERNAL MODULE: external {"this":["wp","compose"]}
  7095. var external_this_wp_compose_ = __webpack_require__(8);
  7096. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/block-content-provider/index.js
  7097. /**
  7098. * WordPress dependencies
  7099. */
  7100. /**
  7101. * Internal dependencies
  7102. */
  7103. var _createContext = Object(external_this_wp_element_["createContext"])(function () {}),
  7104. Consumer = _createContext.Consumer,
  7105. Provider = _createContext.Provider;
  7106. /**
  7107. * An internal block component used in block content serialization to inject
  7108. * nested block content within the `save` implementation of the ancestor
  7109. * component in which it is nested. The component provides a pre-bound
  7110. * `BlockContent` component via context, which is used by the developer-facing
  7111. * `InnerBlocks.Content` component to render block content.
  7112. *
  7113. * @example
  7114. *
  7115. * ```jsx
  7116. * <BlockContentProvider innerBlocks={ innerBlocks }>
  7117. * { blockSaveElement }
  7118. * </BlockContentProvider>
  7119. * ```
  7120. *
  7121. * @return {WPElement} Element with BlockContent injected via context.
  7122. */
  7123. var block_content_provider_BlockContentProvider = function BlockContentProvider(_ref) {
  7124. var children = _ref.children,
  7125. innerBlocks = _ref.innerBlocks;
  7126. var BlockContent = function BlockContent() {
  7127. // Value is an array of blocks, so defer to block serializer
  7128. var html = serialize(innerBlocks, {
  7129. isInnerBlocks: true
  7130. }); // Use special-cased raw HTML tag to avoid default escaping
  7131. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, html);
  7132. };
  7133. return Object(external_this_wp_element_["createElement"])(Provider, {
  7134. value: BlockContent
  7135. }, children);
  7136. };
  7137. /**
  7138. * A Higher Order Component used to inject BlockContent using context to the
  7139. * wrapped component.
  7140. *
  7141. * @return {Component} Enhanced component with injected BlockContent as prop.
  7142. */
  7143. var withBlockContentContext = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) {
  7144. return function (props) {
  7145. return Object(external_this_wp_element_["createElement"])(Consumer, null, function (context) {
  7146. return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, {
  7147. BlockContent: context
  7148. }));
  7149. });
  7150. };
  7151. }, 'withBlockContentContext');
  7152. /* harmony default export */ var block_content_provider = (block_content_provider_BlockContentProvider);
  7153. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/serializer.js
  7154. /**
  7155. * External dependencies
  7156. */
  7157. /**
  7158. * WordPress dependencies
  7159. */
  7160. /**
  7161. * Internal dependencies
  7162. */
  7163. /**
  7164. * @typedef {Object} WPBlockSerializationOptions Serialization Options.
  7165. *
  7166. * @property {boolean} isInnerBlocks Whether we are serializing inner blocks.
  7167. */
  7168. /**
  7169. * Returns the block's default classname from its name.
  7170. *
  7171. * @param {string} blockName The block name.
  7172. *
  7173. * @return {string} The block's default class.
  7174. */
  7175. function getBlockDefaultClassName(blockName) {
  7176. // Generated HTML classes for blocks follow the `wp-block-{name}` nomenclature.
  7177. // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (used in 'core-embed/').
  7178. var className = 'wp-block-' + blockName.replace(/\//, '-').replace(/^core-/, '');
  7179. return Object(external_this_wp_hooks_["applyFilters"])('blocks.getBlockDefaultClassName', className, blockName);
  7180. }
  7181. /**
  7182. * Returns the block's default menu item classname from its name.
  7183. *
  7184. * @param {string} blockName The block name.
  7185. *
  7186. * @return {string} The block's default menu item class.
  7187. */
  7188. function getBlockMenuDefaultClassName(blockName) {
  7189. // Generated HTML classes for blocks follow the `editor-block-list-item-{name}` nomenclature.
  7190. // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (used in 'core-embed/').
  7191. var className = 'editor-block-list-item-' + blockName.replace(/\//, '-').replace(/^core-/, '');
  7192. return Object(external_this_wp_hooks_["applyFilters"])('blocks.getBlockMenuDefaultClassName', className, blockName);
  7193. }
  7194. /**
  7195. * Given a block type containing a save render implementation and attributes, returns the
  7196. * enhanced element to be saved or string when raw HTML expected.
  7197. *
  7198. * @param {string|Object} blockTypeOrName Block type or name.
  7199. * @param {Object} attributes Block attributes.
  7200. * @param {?Array} innerBlocks Nested blocks.
  7201. *
  7202. * @return {Object|string} Save element or raw HTML string.
  7203. */
  7204. function getSaveElement(blockTypeOrName, attributes) {
  7205. var innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  7206. var blockType = normalizeBlockType(blockTypeOrName);
  7207. var save = blockType.save; // Component classes are unsupported for save since serialization must
  7208. // occur synchronously. For improved interoperability with higher-order
  7209. // components which often return component class, emulate basic support.
  7210. if (save.prototype instanceof external_this_wp_element_["Component"]) {
  7211. var instance = new save({
  7212. attributes: attributes
  7213. });
  7214. save = instance.render.bind(instance);
  7215. }
  7216. var element = save({
  7217. attributes: attributes,
  7218. innerBlocks: innerBlocks
  7219. });
  7220. if (Object(external_lodash_["isObject"])(element) && Object(external_this_wp_hooks_["hasFilter"])('blocks.getSaveContent.extraProps')) {
  7221. /**
  7222. * Filters the props applied to the block save result element.
  7223. *
  7224. * @param {Object} props Props applied to save element.
  7225. * @param {WPBlockType} blockType Block type definition.
  7226. * @param {Object} attributes Block attributes.
  7227. */
  7228. var props = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', Object(objectSpread["a" /* default */])({}, element.props), blockType, attributes);
  7229. if (!external_this_wp_isShallowEqual_default()(props, element.props)) {
  7230. element = Object(external_this_wp_element_["cloneElement"])(element, props);
  7231. }
  7232. }
  7233. /**
  7234. * Filters the save result of a block during serialization.
  7235. *
  7236. * @param {WPElement} element Block save result.
  7237. * @param {WPBlockType} blockType Block type definition.
  7238. * @param {Object} attributes Block attributes.
  7239. */
  7240. element = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveElement', element, blockType, attributes);
  7241. return Object(external_this_wp_element_["createElement"])(block_content_provider, {
  7242. innerBlocks: innerBlocks
  7243. }, element);
  7244. }
  7245. /**
  7246. * Given a block type containing a save render implementation and attributes, returns the
  7247. * static markup to be saved.
  7248. *
  7249. * @param {string|Object} blockTypeOrName Block type or name.
  7250. * @param {Object} attributes Block attributes.
  7251. * @param {?Array} innerBlocks Nested blocks.
  7252. *
  7253. * @return {string} Save content.
  7254. */
  7255. function getSaveContent(blockTypeOrName, attributes, innerBlocks) {
  7256. var blockType = normalizeBlockType(blockTypeOrName);
  7257. return Object(external_this_wp_element_["renderToString"])(getSaveElement(blockType, attributes, innerBlocks));
  7258. }
  7259. /**
  7260. * Returns attributes which are to be saved and serialized into the block
  7261. * comment delimiter.
  7262. *
  7263. * When a block exists in memory it contains as its attributes both those
  7264. * parsed the block comment delimiter _and_ those which matched from the
  7265. * contents of the block.
  7266. *
  7267. * This function returns only those attributes which are needed to persist and
  7268. * which cannot be matched from the block content.
  7269. *
  7270. * @param {Object<string,*>} blockType Block type.
  7271. * @param {Object<string,*>} attributes Attributes from in-memory block data.
  7272. *
  7273. * @return {Object<string,*>} Subset of attributes for comment serialization.
  7274. */
  7275. function getCommentAttributes(blockType, attributes) {
  7276. return Object(external_lodash_["reduce"])(blockType.attributes, function (result, attributeSchema, key) {
  7277. var value = attributes[key]; // Ignore undefined values.
  7278. if (undefined === value) {
  7279. return result;
  7280. } // Ignore all attributes but the ones with an "undefined" source
  7281. // "undefined" source refers to attributes saved in the block comment.
  7282. if (attributeSchema.source !== undefined) {
  7283. return result;
  7284. } // Ignore default value.
  7285. if ('default' in attributeSchema && attributeSchema.default === value) {
  7286. return result;
  7287. } // Otherwise, include in comment set.
  7288. result[key] = value;
  7289. return result;
  7290. }, {});
  7291. }
  7292. /**
  7293. * Given an attributes object, returns a string in the serialized attributes
  7294. * format prepared for post content.
  7295. *
  7296. * @param {Object} attributes Attributes object.
  7297. *
  7298. * @return {string} Serialized attributes.
  7299. */
  7300. function serializeAttributes(attributes) {
  7301. return JSON.stringify(attributes) // Don't break HTML comments.
  7302. .replace(/--/g, "\\u002d\\u002d") // Don't break non-standard-compliant tools.
  7303. .replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026") // Bypass server stripslashes behavior which would unescape stringify's
  7304. // escaping of quotation mark.
  7305. //
  7306. // See: https://developer.wordpress.org/reference/functions/wp_kses_stripslashes/
  7307. .replace(/\\"/g, "\\u0022");
  7308. }
  7309. /**
  7310. * Given a block object, returns the Block's Inner HTML markup.
  7311. *
  7312. * @param {Object} block Block instance.
  7313. *
  7314. * @return {string} HTML.
  7315. */
  7316. function getBlockContent(block) {
  7317. // @todo why not getBlockInnerHtml?
  7318. // If block was parsed as invalid or encounters an error while generating
  7319. // save content, use original content instead to avoid content loss. If a
  7320. // block contains nested content, exempt it from this condition because we
  7321. // otherwise have no access to its original content and content loss would
  7322. // still occur.
  7323. var saveContent = block.originalContent;
  7324. if (block.isValid || block.innerBlocks.length) {
  7325. try {
  7326. saveContent = getSaveContent(block.name, block.attributes, block.innerBlocks);
  7327. } catch (error) {}
  7328. }
  7329. return saveContent;
  7330. }
  7331. /**
  7332. * Returns the content of a block, including comment delimiters.
  7333. *
  7334. * @param {string} rawBlockName Block name.
  7335. * @param {Object} attributes Block attributes.
  7336. * @param {string} content Block save content.
  7337. *
  7338. * @return {string} Comment-delimited block content.
  7339. */
  7340. function getCommentDelimitedContent(rawBlockName, attributes, content) {
  7341. var serializedAttributes = !Object(external_lodash_["isEmpty"])(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix.
  7342. var blockName = Object(external_lodash_["startsWith"])(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable.
  7343. if (!content) {
  7344. return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "/-->");
  7345. }
  7346. return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "-->\n") + content + "\n<!-- /wp:".concat(blockName, " -->");
  7347. }
  7348. /**
  7349. * Returns the content of a block, including comment delimiters, determining
  7350. * serialized attributes and content form from the current state of the block.
  7351. *
  7352. * @param {Object} block Block instance.
  7353. * @param {WPBlockSerializationOptions} options Serialization options.
  7354. *
  7355. * @return {string} Serialized block.
  7356. */
  7357. function serializeBlock(block) {
  7358. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  7359. _ref$isInnerBlocks = _ref.isInnerBlocks,
  7360. isInnerBlocks = _ref$isInnerBlocks === void 0 ? false : _ref$isInnerBlocks;
  7361. var blockName = block.name;
  7362. var saveContent = getBlockContent(block);
  7363. if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
  7364. return saveContent;
  7365. }
  7366. var blockType = registration_getBlockType(blockName);
  7367. var saveAttributes = getCommentAttributes(blockType, block.attributes);
  7368. return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
  7369. }
  7370. /**
  7371. * Takes a block or set of blocks and returns the serialized post content.
  7372. *
  7373. * @param {Array} blocks Block(s) to serialize.
  7374. * @param {WPBlockSerializationOptions} options Serialization options.
  7375. *
  7376. * @return {string} The post content.
  7377. */
  7378. function serialize(blocks, options) {
  7379. return Object(external_lodash_["castArray"])(blocks).map(function (block) {
  7380. return serializeBlock(block, options);
  7381. }).join('\n\n');
  7382. }
  7383. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/index.js
  7384. /**
  7385. * External dependencies
  7386. */
  7387. /**
  7388. * WordPress dependencies
  7389. */
  7390. /**
  7391. * Internal dependencies
  7392. */
  7393. /**
  7394. * Globally matches any consecutive whitespace
  7395. *
  7396. * @type {RegExp}
  7397. */
  7398. var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g;
  7399. /**
  7400. * Matches a string containing only whitespace
  7401. *
  7402. * @type {RegExp}
  7403. */
  7404. var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/;
  7405. /**
  7406. * Matches a CSS URL type value
  7407. *
  7408. * @type {RegExp}
  7409. */
  7410. var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/;
  7411. /**
  7412. * Boolean attributes are attributes whose presence as being assigned is
  7413. * meaningful, even if only empty.
  7414. *
  7415. * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
  7416. * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
  7417. *
  7418. * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]
  7419. * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )
  7420. * .reduce( ( result, tr ) => Object.assign( result, {
  7421. * [ tr.firstChild.textContent.trim() ]: true
  7422. * } ), {} ) ).sort();
  7423. *
  7424. * @type {Array}
  7425. */
  7426. var BOOLEAN_ATTRIBUTES = ['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch'];
  7427. /**
  7428. * Enumerated attributes are attributes which must be of a specific value form.
  7429. * Like boolean attributes, these are meaningful if specified, even if not of a
  7430. * valid enumerated value.
  7431. *
  7432. * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute
  7433. * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
  7434. *
  7435. * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]
  7436. * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) )
  7437. * .reduce( ( result, tr ) => Object.assign( result, {
  7438. * [ tr.firstChild.textContent.trim() ]: true
  7439. * } ), {} ) ).sort();
  7440. *
  7441. * @type {Array}
  7442. */
  7443. var ENUMERATED_ATTRIBUTES = ['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap'];
  7444. /**
  7445. * Meaningful attributes are those who cannot be safely ignored when omitted in
  7446. * one HTML markup string and not another.
  7447. *
  7448. * @type {Array}
  7449. */
  7450. var MEANINGFUL_ATTRIBUTES = [].concat(BOOLEAN_ATTRIBUTES, ENUMERATED_ATTRIBUTES);
  7451. /**
  7452. * Array of functions which receive a text string on which to apply normalizing
  7453. * behavior for consideration in text token equivalence, carefully ordered from
  7454. * least-to-most expensive operations.
  7455. *
  7456. * @type {Array}
  7457. */
  7458. var TEXT_NORMALIZATIONS = [external_lodash_["identity"], getTextWithCollapsedWhitespace];
  7459. /**
  7460. * Regular expression matching a named character reference. In lieu of bundling
  7461. * a full set of references, the pattern covers the minimal necessary to test
  7462. * positively against the full set.
  7463. *
  7464. * "The ampersand must be followed by one of the names given in the named
  7465. * character references section, using the same case."
  7466. *
  7467. * Tested aginst "12.5 Named character references":
  7468. *
  7469. * ```
  7470. * const references = [ ...document.querySelectorAll(
  7471. * '#named-character-references-table tr[id^=entity-] td:first-child'
  7472. * ) ].map( ( code ) => code.textContent )
  7473. * references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) )
  7474. * ```
  7475. *
  7476. * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
  7477. * @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
  7478. *
  7479. * @type {RegExp}
  7480. */
  7481. var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i;
  7482. /**
  7483. * Regular expression matching a decimal character reference.
  7484. *
  7485. * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#),
  7486. * followed by one or more ASCII digits, representing a base-ten integer"
  7487. *
  7488. * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
  7489. *
  7490. * @type {RegExp}
  7491. */
  7492. var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/;
  7493. /**
  7494. * Regular expression matching a hexadecimal character reference.
  7495. *
  7496. * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which
  7497. * must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a
  7498. * U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by
  7499. * one or more ASCII hex digits, representing a hexadecimal integer"
  7500. *
  7501. * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
  7502. *
  7503. * @type {RegExp}
  7504. */
  7505. var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i;
  7506. /**
  7507. * Returns true if the given string is a valid character reference segment, or
  7508. * false otherwise. The text should be stripped of `&` and `;` demarcations.
  7509. *
  7510. * @param {string} text Text to test.
  7511. *
  7512. * @return {boolean} Whether text is valid character reference.
  7513. */
  7514. function isValidCharacterReference(text) {
  7515. return REGEXP_NAMED_CHARACTER_REFERENCE.test(text) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text);
  7516. }
  7517. /**
  7518. * Subsitute EntityParser class for `simple-html-tokenizer` which uses the
  7519. * implementation of `decodeEntities` from `html-entities`, in order to avoid
  7520. * bundling a massive named character reference.
  7521. *
  7522. * @see https://github.com/tildeio/simple-html-tokenizer/tree/master/src/entity-parser.ts
  7523. */
  7524. var validation_DecodeEntityParser =
  7525. /*#__PURE__*/
  7526. function () {
  7527. function DecodeEntityParser() {
  7528. Object(classCallCheck["a" /* default */])(this, DecodeEntityParser);
  7529. }
  7530. Object(createClass["a" /* default */])(DecodeEntityParser, [{
  7531. key: "parse",
  7532. /**
  7533. * Returns a substitute string for an entity string sequence between `&`
  7534. * and `;`, or undefined if no substitution should occur.
  7535. *
  7536. * @param {string} entity Entity fragment discovered in HTML.
  7537. *
  7538. * @return {?string} Entity substitute value.
  7539. */
  7540. value: function parse(entity) {
  7541. if (isValidCharacterReference(entity)) {
  7542. return Object(external_this_wp_htmlEntities_["decodeEntities"])('&' + entity + ';');
  7543. }
  7544. }
  7545. }]);
  7546. return DecodeEntityParser;
  7547. }();
  7548. /**
  7549. * Given a specified string, returns an array of strings split by consecutive
  7550. * whitespace, ignoring leading or trailing whitespace.
  7551. *
  7552. * @param {string} text Original text.
  7553. *
  7554. * @return {string[]} Text pieces split on whitespace.
  7555. */
  7556. function getTextPiecesSplitOnWhitespace(text) {
  7557. return text.trim().split(REGEXP_WHITESPACE);
  7558. }
  7559. /**
  7560. * Given a specified string, returns a new trimmed string where all consecutive
  7561. * whitespace is collapsed to a single space.
  7562. *
  7563. * @param {string} text Original text.
  7564. *
  7565. * @return {string} Trimmed text with consecutive whitespace collapsed.
  7566. */
  7567. function getTextWithCollapsedWhitespace(text) {
  7568. // This is an overly simplified whitespace comparison. The specification is
  7569. // more prescriptive of whitespace behavior in inline and block contexts.
  7570. //
  7571. // See: https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33
  7572. return getTextPiecesSplitOnWhitespace(text).join(' ');
  7573. }
  7574. /**
  7575. * Returns attribute pairs of the given StartTag token, including only pairs
  7576. * where the value is non-empty or the attribute is a boolean attribute, an
  7577. * enumerated attribute, or a custom data- attribute.
  7578. *
  7579. * @see MEANINGFUL_ATTRIBUTES
  7580. *
  7581. * @param {Object} token StartTag token.
  7582. *
  7583. * @return {Array[]} Attribute pairs.
  7584. */
  7585. function getMeaningfulAttributePairs(token) {
  7586. return token.attributes.filter(function (pair) {
  7587. var _pair = Object(slicedToArray["a" /* default */])(pair, 2),
  7588. key = _pair[0],
  7589. value = _pair[1];
  7590. return value || key.indexOf('data-') === 0 || Object(external_lodash_["includes"])(MEANINGFUL_ATTRIBUTES, key);
  7591. });
  7592. }
  7593. /**
  7594. * Returns true if two text tokens (with `chars` property) are equivalent, or
  7595. * false otherwise.
  7596. *
  7597. * @param {Object} actual Actual token.
  7598. * @param {Object} expected Expected token.
  7599. * @param {Object} logger Validation logger object.
  7600. *
  7601. * @return {boolean} Whether two text tokens are equivalent.
  7602. */
  7603. function isEquivalentTextTokens(actual, expected) {
  7604. var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
  7605. // This function is intentionally written as syntactically "ugly" as a hot
  7606. // path optimization. Text is progressively normalized in order from least-
  7607. // to-most operationally expensive, until the earliest point at which text
  7608. // can be confidently inferred as being equal.
  7609. var actualChars = actual.chars;
  7610. var expectedChars = expected.chars;
  7611. for (var i = 0; i < TEXT_NORMALIZATIONS.length; i++) {
  7612. var normalize = TEXT_NORMALIZATIONS[i];
  7613. actualChars = normalize(actualChars);
  7614. expectedChars = normalize(expectedChars);
  7615. if (actualChars === expectedChars) {
  7616. return true;
  7617. }
  7618. }
  7619. logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars);
  7620. return false;
  7621. }
  7622. /**
  7623. * Given a style value, returns a normalized style value for strict equality
  7624. * comparison.
  7625. *
  7626. * @param {string} value Style value.
  7627. *
  7628. * @return {string} Normalized style value.
  7629. */
  7630. function getNormalizedStyleValue(value) {
  7631. return value // Normalize URL type to omit whitespace or quotes
  7632. .replace(REGEXP_STYLE_URL_TYPE, 'url($1)');
  7633. }
  7634. /**
  7635. * Given a style attribute string, returns an object of style properties.
  7636. *
  7637. * @param {string} text Style attribute.
  7638. *
  7639. * @return {Object} Style properties.
  7640. */
  7641. function getStyleProperties(text) {
  7642. var pairs = text // Trim ending semicolon (avoid including in split)
  7643. .replace(/;?\s*$/, '') // Split on property assignment
  7644. .split(';') // For each property assignment...
  7645. .map(function (style) {
  7646. // ...split further into key-value pairs
  7647. var _style$split = style.split(':'),
  7648. _style$split2 = _toArray(_style$split),
  7649. key = _style$split2[0],
  7650. valueParts = _style$split2.slice(1);
  7651. var value = valueParts.join(':');
  7652. return [key.trim(), getNormalizedStyleValue(value.trim())];
  7653. });
  7654. return Object(external_lodash_["fromPairs"])(pairs);
  7655. }
  7656. /**
  7657. * Attribute-specific equality handlers
  7658. *
  7659. * @type {Object}
  7660. */
  7661. var isEqualAttributesOfName = Object(objectSpread["a" /* default */])({
  7662. class: function _class(actual, expected) {
  7663. // Class matches if members are the same, even if out of order or
  7664. // superfluous whitespace between.
  7665. return !external_lodash_["xor"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getTextPiecesSplitOnWhitespace))).length;
  7666. },
  7667. style: function style(actual, expected) {
  7668. return external_lodash_["isEqual"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getStyleProperties)));
  7669. }
  7670. }, Object(external_lodash_["fromPairs"])(BOOLEAN_ATTRIBUTES.map(function (attribute) {
  7671. return [attribute, external_lodash_["stubTrue"]];
  7672. })));
  7673. /**
  7674. * Given two sets of attribute tuples, returns true if the attribute sets are
  7675. * equivalent.
  7676. *
  7677. * @param {Array[]} actual Actual attributes tuples.
  7678. * @param {Array[]} expected Expected attributes tuples.
  7679. * @param {Object} logger Validation logger object.
  7680. *
  7681. * @return {boolean} Whether attributes are equivalent.
  7682. */
  7683. function isEqualTagAttributePairs(actual, expected) {
  7684. var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
  7685. // Attributes is tokenized as tuples. Their lengths should match. This also
  7686. // avoids us needing to check both attributes sets, since if A has any keys
  7687. // which do not exist in B, we know the sets to be different.
  7688. if (actual.length !== expected.length) {
  7689. logger.warning('Expected attributes %o, instead saw %o.', expected, actual);
  7690. return false;
  7691. } // Convert tuples to object for ease of lookup
  7692. var _map = [actual, expected].map(external_lodash_["fromPairs"]),
  7693. _map2 = Object(slicedToArray["a" /* default */])(_map, 2),
  7694. actualAttributes = _map2[0],
  7695. expectedAttributes = _map2[1];
  7696. for (var name in actualAttributes) {
  7697. // As noted above, if missing member in B, assume different
  7698. if (!expectedAttributes.hasOwnProperty(name)) {
  7699. logger.warning('Encountered unexpected attribute `%s`.', name);
  7700. return false;
  7701. }
  7702. var actualValue = actualAttributes[name];
  7703. var expectedValue = expectedAttributes[name];
  7704. var isEqualAttributes = isEqualAttributesOfName[name];
  7705. if (isEqualAttributes) {
  7706. // Defer custom attribute equality handling
  7707. if (!isEqualAttributes(actualValue, expectedValue)) {
  7708. logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
  7709. return false;
  7710. }
  7711. } else if (actualValue !== expectedValue) {
  7712. // Otherwise strict inequality should bail
  7713. logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
  7714. return false;
  7715. }
  7716. }
  7717. return true;
  7718. }
  7719. /**
  7720. * Token-type-specific equality handlers
  7721. *
  7722. * @type {Object}
  7723. */
  7724. var isEqualTokensOfType = {
  7725. StartTag: function StartTag(actual, expected) {
  7726. var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
  7727. if (actual.tagName !== expected.tagName) {
  7728. logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName);
  7729. return false;
  7730. }
  7731. return isEqualTagAttributePairs.apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getMeaningfulAttributePairs)).concat([logger]));
  7732. },
  7733. Chars: isEquivalentTextTokens,
  7734. Comment: isEquivalentTextTokens
  7735. };
  7736. /**
  7737. * Given an array of tokens, returns the first token which is not purely
  7738. * whitespace.
  7739. *
  7740. * Mutates the tokens array.
  7741. *
  7742. * @param {Object[]} tokens Set of tokens to search.
  7743. *
  7744. * @return {Object} Next non-whitespace token.
  7745. */
  7746. function getNextNonWhitespaceToken(tokens) {
  7747. var token;
  7748. while (token = tokens.shift()) {
  7749. if (token.type !== 'Chars') {
  7750. return token;
  7751. }
  7752. if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) {
  7753. return token;
  7754. }
  7755. }
  7756. }
  7757. /**
  7758. * Tokenize an HTML string, gracefully handling any errors thrown during
  7759. * underlying tokenization.
  7760. *
  7761. * @param {string} html HTML string to tokenize.
  7762. * @param {Object} logger Validation logger object.
  7763. *
  7764. * @return {Object[]|null} Array of valid tokenized HTML elements, or null on error
  7765. */
  7766. function getHTMLTokens(html) {
  7767. var logger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createLogger();
  7768. try {
  7769. return new Tokenizer(new validation_DecodeEntityParser()).tokenize(html);
  7770. } catch (e) {
  7771. logger.warning('Malformed HTML detected: %s', html);
  7772. }
  7773. return null;
  7774. }
  7775. /**
  7776. * Returns true if the next HTML token closes the current token.
  7777. *
  7778. * @param {Object} currentToken Current token to compare with.
  7779. * @param {Object|undefined} nextToken Next token to compare against.
  7780. *
  7781. * @return {boolean} true if `nextToken` closes `currentToken`, false otherwise
  7782. */
  7783. function isClosedByToken(currentToken, nextToken) {
  7784. // Ensure this is a self closed token
  7785. if (!currentToken.selfClosing) {
  7786. return false;
  7787. } // Check token names and determine if nextToken is the closing tag for currentToken
  7788. if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === 'EndTag') {
  7789. return true;
  7790. }
  7791. return false;
  7792. }
  7793. /**
  7794. * Returns true if the given HTML strings are effectively equivalent, or
  7795. * false otherwise. Invalid HTML is not considered equivalent, even if the
  7796. * strings directly match.
  7797. *
  7798. * @param {string} actual Actual HTML string.
  7799. * @param {string} expected Expected HTML string.
  7800. * @param {Object} logger Validation logger object.
  7801. *
  7802. * @return {boolean} Whether HTML strings are equivalent.
  7803. */
  7804. function isEquivalentHTML(actual, expected) {
  7805. var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
  7806. // Tokenize input content and reserialized save content
  7807. var _map3 = [actual, expected].map(function (html) {
  7808. return getHTMLTokens(html, logger);
  7809. }),
  7810. _map4 = Object(slicedToArray["a" /* default */])(_map3, 2),
  7811. actualTokens = _map4[0],
  7812. expectedTokens = _map4[1]; // If either is malformed then stop comparing - the strings are not equivalent
  7813. if (!actualTokens || !expectedTokens) {
  7814. return false;
  7815. }
  7816. var actualToken, expectedToken;
  7817. while (actualToken = getNextNonWhitespaceToken(actualTokens)) {
  7818. expectedToken = getNextNonWhitespaceToken(expectedTokens); // Inequal if exhausted all expected tokens
  7819. if (!expectedToken) {
  7820. logger.warning('Expected end of content, instead saw %o.', actualToken);
  7821. return false;
  7822. } // Inequal if next non-whitespace token of each set are not same type
  7823. if (actualToken.type !== expectedToken.type) {
  7824. logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken);
  7825. return false;
  7826. } // Defer custom token type equality handling, otherwise continue and
  7827. // assume as equal
  7828. var isEqualTokens = isEqualTokensOfType[actualToken.type];
  7829. if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) {
  7830. return false;
  7831. } // Peek at the next tokens (actual and expected) to see if they close
  7832. // a self-closing tag
  7833. if (isClosedByToken(actualToken, expectedTokens[0])) {
  7834. // Consume the next expected token that closes the current actual
  7835. // self-closing token
  7836. getNextNonWhitespaceToken(expectedTokens);
  7837. } else if (isClosedByToken(expectedToken, actualTokens[0])) {
  7838. // Consume the next actual token that closes the current expected
  7839. // self-closing token
  7840. getNextNonWhitespaceToken(actualTokens);
  7841. }
  7842. }
  7843. if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) {
  7844. // If any non-whitespace tokens remain in expected token set, this
  7845. // indicates inequality
  7846. logger.warning('Expected %o, instead saw end of content.', expectedToken);
  7847. return false;
  7848. }
  7849. return true;
  7850. }
  7851. /**
  7852. * Returns an object with `isValid` property set to `true` if the parsed block
  7853. * is valid given the input content. A block is considered valid if, when serialized
  7854. * with assumed attributes, the content matches the original value. If block is
  7855. * invalid, this function returns all validations issues as well.
  7856. *
  7857. * @param {string|Object} blockTypeOrName Block type.
  7858. * @param {Object} attributes Parsed block attributes.
  7859. * @param {string} originalBlockContent Original block content.
  7860. * @param {Object} logger Validation logger object.
  7861. *
  7862. * @return {Object} Whether block is valid and contains validation messages.
  7863. */
  7864. function getBlockContentValidationResult(blockTypeOrName, attributes, originalBlockContent) {
  7865. var logger = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : createQueuedLogger();
  7866. var blockType = normalizeBlockType(blockTypeOrName);
  7867. var generatedBlockContent;
  7868. try {
  7869. generatedBlockContent = getSaveContent(blockType, attributes);
  7870. } catch (error) {
  7871. logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString());
  7872. return {
  7873. isValid: false,
  7874. validationIssues: logger.getItems()
  7875. };
  7876. }
  7877. var isValid = isEquivalentHTML(originalBlockContent, generatedBlockContent, logger);
  7878. if (!isValid) {
  7879. logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, originalBlockContent);
  7880. }
  7881. return {
  7882. isValid: isValid,
  7883. validationIssues: logger.getItems()
  7884. };
  7885. }
  7886. /**
  7887. * Returns true if the parsed block is valid given the input content. A block
  7888. * is considered valid if, when serialized with assumed attributes, the content
  7889. * matches the original value.
  7890. *
  7891. * Logs to console in development environments when invalid.
  7892. *
  7893. * @param {string|Object} blockTypeOrName Block type.
  7894. * @param {Object} attributes Parsed block attributes.
  7895. * @param {string} originalBlockContent Original block content.
  7896. *
  7897. * @return {boolean} Whether block is valid.
  7898. */
  7899. function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) {
  7900. var _getBlockContentValid = getBlockContentValidationResult(blockTypeOrName, attributes, originalBlockContent, createLogger()),
  7901. isValid = _getBlockContentValid.isValid;
  7902. return isValid;
  7903. }
  7904. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js
  7905. /**
  7906. * External dependencies
  7907. */
  7908. /**
  7909. * WordPress dependencies
  7910. */
  7911. /**
  7912. * Internal dependencies
  7913. */
  7914. /**
  7915. * A representation of a block's rich text value.
  7916. *
  7917. * @typedef {WPBlockNode[]} WPBlockChildren
  7918. */
  7919. /**
  7920. * Given block children, returns a serialize-capable WordPress element.
  7921. *
  7922. * @param {WPBlockChildren} children Block children object to convert.
  7923. *
  7924. * @return {WPElement} A serialize-capable element.
  7925. */
  7926. function getSerializeCapableElement(children) {
  7927. // The fact that block children are compatible with the element serializer is
  7928. // merely an implementation detail that currently serves to be true, but
  7929. // should not be mistaken as being a guarantee on the external API. The
  7930. // public API only offers guarantees to work with strings (toHTML) and DOM
  7931. // elements (fromDOM), and should provide utilities to manipulate the value
  7932. // rather than expect consumers to inspect or construct its shape (concat).
  7933. return children;
  7934. }
  7935. /**
  7936. * Given block children, returns an array of block nodes.
  7937. *
  7938. * @param {WPBlockChildren} children Block children object to convert.
  7939. *
  7940. * @return {Array<WPBlockNode>} An array of individual block nodes.
  7941. */
  7942. function getChildrenArray(children) {
  7943. // The fact that block children are compatible with the element serializer
  7944. // is merely an implementation detail that currently serves to be true, but
  7945. // should not be mistaken as being a guarantee on the external API.
  7946. return children;
  7947. }
  7948. /**
  7949. * Given two or more block nodes, returns a new block node representing a
  7950. * concatenation of its values.
  7951. *
  7952. * @param {...WPBlockChildren} blockNodes Block nodes to concatenate.
  7953. *
  7954. * @return {WPBlockChildren} Concatenated block node.
  7955. */
  7956. function concat() {
  7957. var result = [];
  7958. for (var i = 0; i < arguments.length; i++) {
  7959. var blockNode = Object(external_lodash_["castArray"])(i < 0 || arguments.length <= i ? undefined : arguments[i]);
  7960. for (var j = 0; j < blockNode.length; j++) {
  7961. var child = blockNode[j];
  7962. var canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string';
  7963. if (canConcatToPreviousString) {
  7964. result[result.length - 1] += child;
  7965. } else {
  7966. result.push(child);
  7967. }
  7968. }
  7969. }
  7970. return result;
  7971. }
  7972. /**
  7973. * Given an iterable set of DOM nodes, returns equivalent block children.
  7974. * Ignores any non-element/text nodes included in set.
  7975. *
  7976. * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert.
  7977. *
  7978. * @return {WPBlockChildren} Block children equivalent to DOM nodes.
  7979. */
  7980. function fromDOM(domNodes) {
  7981. var result = [];
  7982. for (var i = 0; i < domNodes.length; i++) {
  7983. try {
  7984. result.push(node_fromDOM(domNodes[i]));
  7985. } catch (error) {// Simply ignore if DOM node could not be converted.
  7986. }
  7987. }
  7988. return result;
  7989. }
  7990. /**
  7991. * Given a block node, returns its HTML string representation.
  7992. *
  7993. * @param {WPBlockChildren} children Block node(s) to convert to string.
  7994. *
  7995. * @return {string} String HTML representation of block node.
  7996. */
  7997. function toHTML(children) {
  7998. var element = getSerializeCapableElement(children);
  7999. return Object(external_this_wp_element_["renderToString"])(element);
  8000. }
  8001. /**
  8002. * Given a selector, returns an hpq matcher generating a WPBlockChildren value
  8003. * matching the selector result.
  8004. *
  8005. * @param {string} selector DOM selector.
  8006. *
  8007. * @return {Function} hpq matcher.
  8008. */
  8009. function children_matcher(selector) {
  8010. return function (domNode) {
  8011. var match = domNode;
  8012. if (selector) {
  8013. match = domNode.querySelector(selector);
  8014. }
  8015. if (match) {
  8016. return fromDOM(match.childNodes);
  8017. }
  8018. return [];
  8019. };
  8020. }
  8021. /**
  8022. * Object of utility functions used in managing block attribute values of
  8023. * source `children`.
  8024. *
  8025. * @see https://github.com/WordPress/gutenberg/pull/10439
  8026. *
  8027. * @deprecated since 4.0. The `children` source should not be used, and can be
  8028. * replaced by the `html` source.
  8029. *
  8030. * @private
  8031. */
  8032. /* harmony default export */ var api_children = ({
  8033. concat: concat,
  8034. getChildrenArray: getChildrenArray,
  8035. fromDOM: fromDOM,
  8036. toHTML: toHTML,
  8037. matcher: children_matcher
  8038. });
  8039. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js
  8040. /**
  8041. * Internal dependencies
  8042. */
  8043. /**
  8044. * Browser dependencies
  8045. */
  8046. var _window$Node = window.Node,
  8047. TEXT_NODE = _window$Node.TEXT_NODE,
  8048. ELEMENT_NODE = _window$Node.ELEMENT_NODE;
  8049. /**
  8050. * A representation of a single node within a block's rich text value. If
  8051. * representing a text node, the value is simply a string of the node value.
  8052. * As representing an element node, it is an object of:
  8053. *
  8054. * 1. `type` (string): Tag name.
  8055. * 2. `props` (object): Attributes and children array of WPBlockNode.
  8056. *
  8057. * @typedef {string|Object} WPBlockNode
  8058. */
  8059. /**
  8060. * Given a single node and a node type (e.g. `'br'`), returns true if the node
  8061. * corresponds to that type, false otherwise.
  8062. *
  8063. * @param {WPBlockNode} node Block node to test
  8064. * @param {string} type Node to type to test against.
  8065. *
  8066. * @return {boolean} Whether node is of intended type.
  8067. */
  8068. function isNodeOfType(node, type) {
  8069. return node && node.type === type;
  8070. }
  8071. /**
  8072. * Given an object implementing the NamedNodeMap interface, returns a plain
  8073. * object equivalent value of name, value key-value pairs.
  8074. *
  8075. * @see https://dom.spec.whatwg.org/#interface-namednodemap
  8076. *
  8077. * @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object.
  8078. *
  8079. * @return {Object} Object equivalent value of NamedNodeMap.
  8080. */
  8081. function getNamedNodeMapAsObject(nodeMap) {
  8082. var result = {};
  8083. for (var i = 0; i < nodeMap.length; i++) {
  8084. var _nodeMap$i = nodeMap[i],
  8085. name = _nodeMap$i.name,
  8086. value = _nodeMap$i.value;
  8087. result[name] = value;
  8088. }
  8089. return result;
  8090. }
  8091. /**
  8092. * Given a DOM Element or Text node, returns an equivalent block node. Throws
  8093. * if passed any node type other than element or text.
  8094. *
  8095. * @throws {TypeError} If non-element/text node is passed.
  8096. *
  8097. * @param {Node} domNode DOM node to convert.
  8098. *
  8099. * @return {WPBlockNode} Block node equivalent to DOM node.
  8100. */
  8101. function node_fromDOM(domNode) {
  8102. if (domNode.nodeType === TEXT_NODE) {
  8103. return domNode.nodeValue;
  8104. }
  8105. if (domNode.nodeType !== ELEMENT_NODE) {
  8106. throw new TypeError('A block node can only be created from a node of type text or ' + 'element.');
  8107. }
  8108. return {
  8109. type: domNode.nodeName.toLowerCase(),
  8110. props: Object(objectSpread["a" /* default */])({}, getNamedNodeMapAsObject(domNode.attributes), {
  8111. children: fromDOM(domNode.childNodes)
  8112. })
  8113. };
  8114. }
  8115. /**
  8116. * Given a block node, returns its HTML string representation.
  8117. *
  8118. * @param {WPBlockNode} node Block node to convert to string.
  8119. *
  8120. * @return {string} String HTML representation of block node.
  8121. */
  8122. function node_toHTML(node) {
  8123. return toHTML([node]);
  8124. }
  8125. /**
  8126. * Given a selector, returns an hpq matcher generating a WPBlockNode value
  8127. * matching the selector result.
  8128. *
  8129. * @param {string} selector DOM selector.
  8130. *
  8131. * @return {Function} hpq matcher.
  8132. */
  8133. function node_matcher(selector) {
  8134. return function (domNode) {
  8135. var match = domNode;
  8136. if (selector) {
  8137. match = domNode.querySelector(selector);
  8138. }
  8139. try {
  8140. return node_fromDOM(match);
  8141. } catch (error) {
  8142. return null;
  8143. }
  8144. };
  8145. }
  8146. /**
  8147. * Object of utility functions used in managing block attribute values of
  8148. * source `node`.
  8149. *
  8150. * @see https://github.com/WordPress/gutenberg/pull/10439
  8151. *
  8152. * @deprecated since 4.0. The `node` source should not be used, and can be
  8153. * replaced by the `html` source.
  8154. *
  8155. * @private
  8156. */
  8157. /* harmony default export */ var api_node = ({
  8158. isNodeOfType: isNodeOfType,
  8159. fromDOM: node_fromDOM,
  8160. toHTML: node_toHTML,
  8161. matcher: node_matcher
  8162. });
  8163. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js
  8164. /**
  8165. * External dependencies
  8166. */
  8167. /**
  8168. * Internal dependencies
  8169. */
  8170. function matchers_html(selector, multilineTag) {
  8171. return function (domNode) {
  8172. var match = domNode;
  8173. if (selector) {
  8174. match = domNode.querySelector(selector);
  8175. }
  8176. if (!match) {
  8177. return '';
  8178. }
  8179. if (multilineTag) {
  8180. var value = '';
  8181. var length = match.children.length;
  8182. for (var index = 0; index < length; index++) {
  8183. var child = match.children[index];
  8184. if (child.nodeName.toLowerCase() !== multilineTag) {
  8185. continue;
  8186. }
  8187. value += child.outerHTML;
  8188. }
  8189. return value;
  8190. }
  8191. return match.innerHTML;
  8192. };
  8193. }
  8194. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser.js
  8195. /**
  8196. * External dependencies
  8197. */
  8198. /**
  8199. * WordPress dependencies
  8200. */
  8201. /**
  8202. * Internal dependencies
  8203. */
  8204. /**
  8205. * Sources which are guaranteed to return a string value.
  8206. *
  8207. * @type {Set}
  8208. */
  8209. var STRING_SOURCES = new Set(['attribute', 'html', 'text', 'tag']);
  8210. /**
  8211. * Higher-order hpq matcher which enhances an attribute matcher to return true
  8212. * or false depending on whether the original matcher returns undefined. This
  8213. * is useful for boolean attributes (e.g. disabled) whose attribute values may
  8214. * be technically falsey (empty string), though their mere presence should be
  8215. * enough to infer as true.
  8216. *
  8217. * @param {Function} matcher Original hpq matcher.
  8218. *
  8219. * @return {Function} Enhanced hpq matcher.
  8220. */
  8221. var parser_toBooleanAttributeMatcher = function toBooleanAttributeMatcher(matcher) {
  8222. return Object(external_lodash_["flow"])([matcher, // Expected values from `attr( 'disabled' )`:
  8223. //
  8224. // <input>
  8225. // - Value: `undefined`
  8226. // - Transformed: `false`
  8227. //
  8228. // <input disabled>
  8229. // - Value: `''`
  8230. // - Transformed: `true`
  8231. //
  8232. // <input disabled="disabled">
  8233. // - Value: `'disabled'`
  8234. // - Transformed: `true`
  8235. function (value) {
  8236. return value !== undefined;
  8237. }]);
  8238. };
  8239. /**
  8240. * Returns true if value is of the given JSON schema type, or false otherwise.
  8241. *
  8242. * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
  8243. *
  8244. * @param {*} value Value to test.
  8245. * @param {string} type Type to test.
  8246. *
  8247. * @return {boolean} Whether value is of type.
  8248. */
  8249. function isOfType(value, type) {
  8250. switch (type) {
  8251. case 'string':
  8252. return typeof value === 'string';
  8253. case 'boolean':
  8254. return typeof value === 'boolean';
  8255. case 'object':
  8256. return !!value && value.constructor === Object;
  8257. case 'null':
  8258. return value === null;
  8259. case 'array':
  8260. return Array.isArray(value);
  8261. case 'integer':
  8262. case 'number':
  8263. return typeof value === 'number';
  8264. }
  8265. return true;
  8266. }
  8267. /**
  8268. * Returns true if value is of an array of given JSON schema types, or false
  8269. * otherwise.
  8270. *
  8271. * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
  8272. *
  8273. * @param {*} value Value to test.
  8274. * @param {string[]} types Types to test.
  8275. *
  8276. * @return {boolean} Whether value is of types.
  8277. */
  8278. function isOfTypes(value, types) {
  8279. return types.some(function (type) {
  8280. return isOfType(value, type);
  8281. });
  8282. }
  8283. /**
  8284. * Returns true if value is valid per the given block attribute schema type
  8285. * definition, or false otherwise.
  8286. *
  8287. * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
  8288. *
  8289. * @param {*} value Value to test.
  8290. * @param {?(Array<string>|string)} type Block attribute schema type.
  8291. *
  8292. * @return {boolean} Whether value is valid.
  8293. */
  8294. function isValidByType(value, type) {
  8295. return type === undefined || isOfTypes(value, Object(external_lodash_["castArray"])(type));
  8296. }
  8297. /**
  8298. * Returns true if value is valid per the given block attribute schema enum
  8299. * definition, or false otherwise.
  8300. *
  8301. * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2
  8302. *
  8303. * @param {*} value Value to test.
  8304. * @param {?Array} enumSet Block attribute schema enum.
  8305. *
  8306. * @return {boolean} Whether value is valid.
  8307. */
  8308. function isValidByEnum(value, enumSet) {
  8309. return !Array.isArray(enumSet) || enumSet.includes(value);
  8310. }
  8311. /**
  8312. * Returns true if the given attribute schema describes a value which may be
  8313. * an ambiguous string.
  8314. *
  8315. * Some sources are ambiguously serialized as strings, for which value casting
  8316. * is enabled. This is only possible when a singular type is assigned to the
  8317. * attribute schema, since the string ambiguity makes it impossible to know the
  8318. * correct type of multiple to which to cast.
  8319. *
  8320. * @param {Object} attributeSchema Attribute's schema.
  8321. *
  8322. * @return {boolean} Whether attribute schema defines an ambiguous string
  8323. * source.
  8324. */
  8325. function isAmbiguousStringSource(attributeSchema) {
  8326. var source = attributeSchema.source,
  8327. type = attributeSchema.type;
  8328. var isStringSource = STRING_SOURCES.has(source);
  8329. var isSingleType = typeof type === 'string';
  8330. return isStringSource && isSingleType;
  8331. }
  8332. /**
  8333. * Returns an hpq matcher given a source object.
  8334. *
  8335. * @param {Object} sourceConfig Attribute Source object.
  8336. *
  8337. * @return {Function} A hpq Matcher.
  8338. */
  8339. function matcherFromSource(sourceConfig) {
  8340. switch (sourceConfig.source) {
  8341. case 'attribute':
  8342. var matcher = attr(sourceConfig.selector, sourceConfig.attribute);
  8343. if (sourceConfig.type === 'boolean') {
  8344. matcher = parser_toBooleanAttributeMatcher(matcher);
  8345. }
  8346. return matcher;
  8347. case 'html':
  8348. return matchers_html(sourceConfig.selector, sourceConfig.multiline);
  8349. case 'text':
  8350. return es_text(sourceConfig.selector);
  8351. case 'children':
  8352. return children_matcher(sourceConfig.selector);
  8353. case 'node':
  8354. return node_matcher(sourceConfig.selector);
  8355. case 'query':
  8356. var subMatchers = Object(external_lodash_["mapValues"])(sourceConfig.query, matcherFromSource);
  8357. return query(sourceConfig.selector, subMatchers);
  8358. case 'tag':
  8359. return Object(external_lodash_["flow"])([prop(sourceConfig.selector, 'nodeName'), function (nodeName) {
  8360. return nodeName ? nodeName.toLowerCase() : undefined;
  8361. }]);
  8362. default:
  8363. // eslint-disable-next-line no-console
  8364. console.error("Unknown source type \"".concat(sourceConfig.source, "\""));
  8365. }
  8366. }
  8367. /**
  8368. * Given a block's raw content and an attribute's schema returns the attribute's
  8369. * value depending on its source.
  8370. *
  8371. * @param {string} innerHTML Block's raw content.
  8372. * @param {Object} attributeSchema Attribute's schema.
  8373. *
  8374. * @return {*} Attribute value.
  8375. */
  8376. function parseWithAttributeSchema(innerHTML, attributeSchema) {
  8377. return es_parse(innerHTML, matcherFromSource(attributeSchema));
  8378. }
  8379. /**
  8380. * Given an attribute key, an attribute's schema, a block's raw content and the
  8381. * commentAttributes returns the attribute value depending on its source
  8382. * definition of the given attribute key.
  8383. *
  8384. * @param {string} attributeKey Attribute key.
  8385. * @param {Object} attributeSchema Attribute's schema.
  8386. * @param {string} innerHTML Block's raw content.
  8387. * @param {Object} commentAttributes Block's comment attributes.
  8388. *
  8389. * @return {*} Attribute value.
  8390. */
  8391. function getBlockAttribute(attributeKey, attributeSchema, innerHTML, commentAttributes) {
  8392. var type = attributeSchema.type,
  8393. enumSet = attributeSchema.enum;
  8394. var value;
  8395. switch (attributeSchema.source) {
  8396. // undefined source means that it's an attribute serialized to the block's "comment"
  8397. case undefined:
  8398. value = commentAttributes ? commentAttributes[attributeKey] : undefined;
  8399. break;
  8400. case 'attribute':
  8401. case 'property':
  8402. case 'html':
  8403. case 'text':
  8404. case 'children':
  8405. case 'node':
  8406. case 'query':
  8407. case 'tag':
  8408. value = parseWithAttributeSchema(innerHTML, attributeSchema);
  8409. break;
  8410. }
  8411. if (!isValidByType(value, type) || !isValidByEnum(value, enumSet)) {
  8412. // Reject the value if it is not valid. Reverting to the undefined
  8413. // value ensures the default is respected, if applicable.
  8414. value = undefined;
  8415. }
  8416. if (value === undefined) {
  8417. return attributeSchema.default;
  8418. }
  8419. return value;
  8420. }
  8421. /**
  8422. * Returns the block attributes of a registered block node given its type.
  8423. *
  8424. * @param {string|Object} blockTypeOrName Block type or name.
  8425. * @param {string} innerHTML Raw block content.
  8426. * @param {?Object} attributes Known block attributes (from delimiters).
  8427. *
  8428. * @return {Object} All block attributes.
  8429. */
  8430. function getBlockAttributes(blockTypeOrName, innerHTML) {
  8431. var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  8432. var blockType = normalizeBlockType(blockTypeOrName);
  8433. var blockAttributes = Object(external_lodash_["mapValues"])(blockType.attributes, function (attributeSchema, attributeKey) {
  8434. return getBlockAttribute(attributeKey, attributeSchema, innerHTML, attributes);
  8435. });
  8436. return Object(external_this_wp_hooks_["applyFilters"])('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes);
  8437. }
  8438. /**
  8439. * Given a block object, returns a new copy of the block with any applicable
  8440. * deprecated migrations applied, or the original block if it was both valid
  8441. * and no eligible migrations exist.
  8442. *
  8443. * @param {WPBlock} block Original block object.
  8444. * @param {Object} parsedAttributes Attributes as parsed from the initial
  8445. * block markup.
  8446. *
  8447. * @return {WPBlock} Migrated block object.
  8448. */
  8449. function getMigratedBlock(block, parsedAttributes) {
  8450. var blockType = registration_getBlockType(block.name);
  8451. var deprecatedDefinitions = blockType.deprecated;
  8452. if (!deprecatedDefinitions || !deprecatedDefinitions.length) {
  8453. return block;
  8454. }
  8455. var _block = block,
  8456. originalContent = _block.originalContent,
  8457. innerBlocks = _block.innerBlocks;
  8458. for (var i = 0; i < deprecatedDefinitions.length; i++) {
  8459. // A block can opt into a migration even if the block is valid by
  8460. // defining isEligible on its deprecation. If the block is both valid
  8461. // and does not opt to migrate, skip.
  8462. var _deprecatedDefinition = deprecatedDefinitions[i].isEligible,
  8463. isEligible = _deprecatedDefinition === void 0 ? external_lodash_["stubFalse"] : _deprecatedDefinition;
  8464. if (block.isValid && !isEligible(parsedAttributes, innerBlocks)) {
  8465. continue;
  8466. } // Block type properties which could impact either serialization or
  8467. // parsing are not considered in the deprecated block type by default,
  8468. // and must be explicitly provided.
  8469. var deprecatedBlockType = Object.assign(Object(external_lodash_["omit"])(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]);
  8470. var migratedAttributes = getBlockAttributes(deprecatedBlockType, originalContent, parsedAttributes); // Ignore the deprecation if it produces a block which is not valid.
  8471. var _getBlockContentValid = getBlockContentValidationResult(deprecatedBlockType, migratedAttributes, originalContent),
  8472. isValid = _getBlockContentValid.isValid,
  8473. validationIssues = _getBlockContentValid.validationIssues;
  8474. if (!isValid) {
  8475. block = Object(objectSpread["a" /* default */])({}, block, {
  8476. validationIssues: [].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(block, 'validationIssues', [])), Object(toConsumableArray["a" /* default */])(validationIssues))
  8477. });
  8478. continue;
  8479. }
  8480. var migratedInnerBlocks = innerBlocks; // A block may provide custom behavior to assign new attributes and/or
  8481. // inner blocks.
  8482. var migrate = deprecatedBlockType.migrate;
  8483. if (migrate) {
  8484. var _castArray = Object(external_lodash_["castArray"])(migrate(migratedAttributes, innerBlocks));
  8485. var _castArray2 = Object(slicedToArray["a" /* default */])(_castArray, 2);
  8486. var _castArray2$ = _castArray2[0];
  8487. migratedAttributes = _castArray2$ === void 0 ? parsedAttributes : _castArray2$;
  8488. var _castArray2$2 = _castArray2[1];
  8489. migratedInnerBlocks = _castArray2$2 === void 0 ? innerBlocks : _castArray2$2;
  8490. }
  8491. block = Object(objectSpread["a" /* default */])({}, block, {
  8492. attributes: migratedAttributes,
  8493. innerBlocks: migratedInnerBlocks,
  8494. isValid: true
  8495. });
  8496. }
  8497. return block;
  8498. }
  8499. /**
  8500. * Creates a block with fallback to the unknown type handler.
  8501. *
  8502. * @param {Object} blockNode Parsed block node.
  8503. *
  8504. * @return {?Object} An initialized block object (if possible).
  8505. */
  8506. function createBlockWithFallback(blockNode) {
  8507. var originalName = blockNode.blockName;
  8508. var attributes = blockNode.attrs,
  8509. _blockNode$innerBlock = blockNode.innerBlocks,
  8510. innerBlocks = _blockNode$innerBlock === void 0 ? [] : _blockNode$innerBlock,
  8511. innerHTML = blockNode.innerHTML;
  8512. var innerContent = blockNode.innerContent;
  8513. var freeformContentFallbackBlock = getFreeformContentHandlerName();
  8514. var unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || freeformContentFallbackBlock;
  8515. attributes = attributes || {}; // Trim content to avoid creation of intermediary freeform segments.
  8516. innerHTML = innerHTML.trim(); // Use type from block content if available. Otherwise, default to the
  8517. // freeform content fallback.
  8518. var name = originalName || freeformContentFallbackBlock; // Convert 'core/cover-image' block in existing content to 'core/cover'.
  8519. if ('core/cover-image' === name) {
  8520. name = 'core/cover';
  8521. } // Convert 'core/text' blocks in existing content to 'core/paragraph'.
  8522. if ('core/text' === name || 'core/cover-text' === name) {
  8523. name = 'core/paragraph';
  8524. } // Fallback content may be upgraded from classic editor expecting implicit
  8525. // automatic paragraphs, so preserve them. Assumes wpautop is idempotent,
  8526. // meaning there are no negative consequences to repeated autop calls.
  8527. if (name === freeformContentFallbackBlock) {
  8528. innerHTML = Object(external_this_wp_autop_["autop"])(innerHTML).trim();
  8529. } // Try finding the type for known block name, else fall back again.
  8530. var blockType = registration_getBlockType(name);
  8531. if (!blockType) {
  8532. // Since the constituents of the block node are extracted at the start
  8533. // of the present function, construct a new object rather than reuse
  8534. // `blockNode`.
  8535. var reconstitutedBlockNode = {
  8536. attrs: attributes,
  8537. blockName: originalName,
  8538. innerBlocks: innerBlocks,
  8539. innerContent: innerContent
  8540. }; // Preserve undelimited content for use by the unregistered type
  8541. // handler. A block node's `innerHTML` isn't enough, as that field only
  8542. // carries the block's own HTML and not its nested blocks'.
  8543. var originalUndelimitedContent = serializeBlockNode(reconstitutedBlockNode, {
  8544. isCommentDelimited: false
  8545. }); // Preserve full block content for use by the unregistered type
  8546. // handler, block boundaries included.
  8547. var originalContent = serializeBlockNode(reconstitutedBlockNode, {
  8548. isCommentDelimited: true
  8549. }); // If detected as a block which is not registered, preserve comment
  8550. // delimiters in content of unregistered type handler.
  8551. if (name) {
  8552. innerHTML = originalContent;
  8553. }
  8554. name = unregisteredFallbackBlock;
  8555. attributes = {
  8556. originalName: originalName,
  8557. originalContent: originalContent,
  8558. originalUndelimitedContent: originalUndelimitedContent
  8559. };
  8560. blockType = registration_getBlockType(name);
  8561. } // Coerce inner blocks from parsed form to canonical form.
  8562. innerBlocks = innerBlocks.map(createBlockWithFallback); // Remove `undefined` innerBlocks.
  8563. //
  8564. // This is a temporary fix to prevent unrecoverable TypeErrors when handling unexpectedly
  8565. // empty freeform block nodes. See https://github.com/WordPress/gutenberg/pull/17164.
  8566. innerBlocks = innerBlocks.filter(function (innerBlock) {
  8567. return innerBlock;
  8568. });
  8569. var isFallbackBlock = name === freeformContentFallbackBlock || name === unregisteredFallbackBlock; // Include in set only if type was determined.
  8570. if (!blockType || !innerHTML && isFallbackBlock) {
  8571. return;
  8572. }
  8573. var block = createBlock(name, getBlockAttributes(blockType, innerHTML, attributes), innerBlocks); // Block validation assumes an idempotent operation from source block to serialized block
  8574. // provided there are no changes in attributes. The validation procedure thus compares the
  8575. // provided source value with the serialized output before there are any modifications to
  8576. // the block. When both match, the block is marked as valid.
  8577. if (!isFallbackBlock) {
  8578. var _getBlockContentValid2 = getBlockContentValidationResult(blockType, block.attributes, innerHTML),
  8579. isValid = _getBlockContentValid2.isValid,
  8580. validationIssues = _getBlockContentValid2.validationIssues;
  8581. block.isValid = isValid;
  8582. block.validationIssues = validationIssues;
  8583. } // Preserve original content for future use in case the block is parsed
  8584. // as invalid, or future serialization attempt results in an error.
  8585. block.originalContent = block.originalContent || innerHTML;
  8586. block = getMigratedBlock(block, attributes);
  8587. if (block.validationIssues && block.validationIssues.length > 0) {
  8588. if (block.isValid) {
  8589. // eslint-disable-next-line no-console
  8590. console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, block.attributes), block.originalContent);
  8591. } else {
  8592. block.validationIssues.forEach(function (_ref) {
  8593. var log = _ref.log,
  8594. args = _ref.args;
  8595. return log.apply(void 0, Object(toConsumableArray["a" /* default */])(args));
  8596. });
  8597. }
  8598. }
  8599. return block;
  8600. }
  8601. /**
  8602. * Serializes a block node into the native HTML-comment-powered block format.
  8603. * CAVEAT: This function is intended for reserializing blocks as parsed by
  8604. * valid parsers and skips any validation steps. This is NOT a generic
  8605. * serialization function for in-memory blocks. For most purposes, see the
  8606. * following functions available in the `@wordpress/blocks` package:
  8607. *
  8608. * @see serializeBlock
  8609. * @see serialize
  8610. *
  8611. * For more on the format of block nodes as returned by valid parsers:
  8612. *
  8613. * @see `@wordpress/block-serialization-default-parser` package
  8614. * @see `@wordpress/block-serialization-spec-parser` package
  8615. *
  8616. * @param {Object} blockNode A block node as returned by a valid parser.
  8617. * @param {?Object} options Serialization options.
  8618. * @param {?boolean} options.isCommentDelimited Whether to output HTML comments around blocks.
  8619. *
  8620. * @return {string} An HTML string representing a block.
  8621. */
  8622. function serializeBlockNode(blockNode) {
  8623. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  8624. var _options$isCommentDel = options.isCommentDelimited,
  8625. isCommentDelimited = _options$isCommentDel === void 0 ? true : _options$isCommentDel;
  8626. var blockName = blockNode.blockName,
  8627. _blockNode$attrs = blockNode.attrs,
  8628. attrs = _blockNode$attrs === void 0 ? {} : _blockNode$attrs,
  8629. _blockNode$innerBlock2 = blockNode.innerBlocks,
  8630. innerBlocks = _blockNode$innerBlock2 === void 0 ? [] : _blockNode$innerBlock2,
  8631. _blockNode$innerConte = blockNode.innerContent,
  8632. innerContent = _blockNode$innerConte === void 0 ? [] : _blockNode$innerConte;
  8633. var childIndex = 0;
  8634. var content = innerContent.map(function (item) {
  8635. return (// `null` denotes a nested block, otherwise we have an HTML fragment
  8636. item !== null ? item : serializeBlockNode(innerBlocks[childIndex++], options)
  8637. );
  8638. }).join('\n').replace(/\n+/g, '\n').trim();
  8639. return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content;
  8640. }
  8641. /**
  8642. * Creates a parse implementation for the post content which returns a list of blocks.
  8643. *
  8644. * @param {Function} parseImplementation Parse implementation.
  8645. *
  8646. * @return {Function} An implementation which parses the post content.
  8647. */
  8648. var createParse = function createParse(parseImplementation) {
  8649. return function (content) {
  8650. return parseImplementation(content).reduce(function (memo, blockNode) {
  8651. var block = createBlockWithFallback(blockNode);
  8652. if (block) {
  8653. memo.push(block);
  8654. }
  8655. return memo;
  8656. }, []);
  8657. };
  8658. };
  8659. /**
  8660. * Parses the post content with a PegJS grammar and returns a list of blocks.
  8661. *
  8662. * @param {string} content The post content.
  8663. *
  8664. * @return {Array} Block list.
  8665. */
  8666. var parseWithGrammar = createParse(external_this_wp_blockSerializationDefaultParser_["parse"]);
  8667. /* harmony default export */ var parser = (parseWithGrammar);
  8668. // EXTERNAL MODULE: external {"this":["wp","dom"]}
  8669. var external_this_wp_dom_ = __webpack_require__(25);
  8670. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content.js
  8671. /**
  8672. * External dependencies
  8673. */
  8674. var phrasing_content_phrasingContentSchema = {
  8675. strong: {},
  8676. em: {},
  8677. s: {},
  8678. del: {},
  8679. ins: {},
  8680. a: {
  8681. attributes: ['href', 'target', 'rel']
  8682. },
  8683. code: {},
  8684. abbr: {
  8685. attributes: ['title']
  8686. },
  8687. sub: {},
  8688. sup: {},
  8689. br: {},
  8690. '#text': {}
  8691. }; // Recursion is needed.
  8692. // Possible: strong > em > strong.
  8693. // Impossible: strong > strong.
  8694. ['strong', 'em', 's', 'del', 'ins', 'a', 'code', 'abbr', 'sub', 'sup'].forEach(function (tag) {
  8695. phrasing_content_phrasingContentSchema[tag].children = Object(external_lodash_["omit"])(phrasing_content_phrasingContentSchema, tag);
  8696. });
  8697. /**
  8698. * Get schema of possible paths for phrasing content.
  8699. *
  8700. * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
  8701. *
  8702. * @return {Object} Schema.
  8703. */
  8704. function getPhrasingContentSchema() {
  8705. return phrasing_content_phrasingContentSchema;
  8706. }
  8707. /**
  8708. * Find out whether or not the given node is phrasing content.
  8709. *
  8710. * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
  8711. *
  8712. * @param {Element} node The node to test.
  8713. *
  8714. * @return {boolean} True if phrasing content, false if not.
  8715. */
  8716. function isPhrasingContent(node) {
  8717. var tag = node.nodeName.toLowerCase();
  8718. return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span';
  8719. }
  8720. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js
  8721. /**
  8722. * External dependencies
  8723. */
  8724. /**
  8725. * WordPress dependencies
  8726. */
  8727. /**
  8728. * Internal dependencies
  8729. */
  8730. /**
  8731. * Browser dependencies
  8732. */
  8733. var utils_window$Node = window.Node,
  8734. utils_ELEMENT_NODE = utils_window$Node.ELEMENT_NODE,
  8735. utils_TEXT_NODE = utils_window$Node.TEXT_NODE;
  8736. /**
  8737. * Given raw transforms from blocks, merges all schemas into one.
  8738. *
  8739. * @param {Array} transforms Block transforms, of the `raw` type.
  8740. *
  8741. * @return {Object} A complete block content schema.
  8742. */
  8743. function getBlockContentSchema(transforms) {
  8744. var schemas = transforms.map(function (_ref) {
  8745. var isMatch = _ref.isMatch,
  8746. blockName = _ref.blockName,
  8747. schema = _ref.schema;
  8748. var hasAnchorSupport = registration_hasBlockSupport(blockName, 'anchor'); // If the block does not has anchor support and the transform does not
  8749. // provides an isMatch we can return the schema right away.
  8750. if (!hasAnchorSupport && !isMatch) {
  8751. return schema;
  8752. }
  8753. return Object(external_lodash_["mapValues"])(schema, function (value) {
  8754. var attributes = value.attributes || []; // If the block supports the "anchor" functionality, it needs to keep its ID attribute.
  8755. if (hasAnchorSupport) {
  8756. attributes = [].concat(Object(toConsumableArray["a" /* default */])(attributes), ['id']);
  8757. }
  8758. return Object(objectSpread["a" /* default */])({}, value, {
  8759. attributes: attributes,
  8760. isMatch: isMatch ? isMatch : undefined
  8761. });
  8762. });
  8763. });
  8764. return external_lodash_["mergeWith"].apply(void 0, [{}].concat(Object(toConsumableArray["a" /* default */])(schemas), [function (objValue, srcValue, key) {
  8765. switch (key) {
  8766. case 'children':
  8767. {
  8768. if (objValue === '*' || srcValue === '*') {
  8769. return '*';
  8770. }
  8771. return Object(objectSpread["a" /* default */])({}, objValue, srcValue);
  8772. }
  8773. case 'attributes':
  8774. case 'require':
  8775. {
  8776. return [].concat(Object(toConsumableArray["a" /* default */])(objValue || []), Object(toConsumableArray["a" /* default */])(srcValue || []));
  8777. }
  8778. case 'isMatch':
  8779. {
  8780. // If one of the values being merge is undefined (matches everything),
  8781. // the result of the merge will be undefined.
  8782. if (!objValue || !srcValue) {
  8783. return undefined;
  8784. } // When merging two isMatch functions, the result is a new function
  8785. // that returns if one of the source functions returns true.
  8786. return function () {
  8787. return objValue.apply(void 0, arguments) || srcValue.apply(void 0, arguments);
  8788. };
  8789. }
  8790. }
  8791. }]));
  8792. }
  8793. /**
  8794. * Recursively checks if an element is empty. An element is not empty if it
  8795. * contains text or contains elements with attributes such as images.
  8796. *
  8797. * @param {Element} element The element to check.
  8798. *
  8799. * @return {boolean} Wether or not the element is empty.
  8800. */
  8801. function isEmpty(element) {
  8802. if (!element.hasChildNodes()) {
  8803. return true;
  8804. }
  8805. return Array.from(element.childNodes).every(function (node) {
  8806. if (node.nodeType === utils_TEXT_NODE) {
  8807. return !node.nodeValue.trim();
  8808. }
  8809. if (node.nodeType === utils_ELEMENT_NODE) {
  8810. if (node.nodeName === 'BR') {
  8811. return true;
  8812. } else if (node.hasAttributes()) {
  8813. return false;
  8814. }
  8815. return isEmpty(node);
  8816. }
  8817. return true;
  8818. });
  8819. }
  8820. /**
  8821. * Checks wether HTML can be considered plain text. That is, it does not contain
  8822. * any elements that are not line breaks.
  8823. *
  8824. * @param {string} HTML The HTML to check.
  8825. *
  8826. * @return {boolean} Wether the HTML can be considered plain text.
  8827. */
  8828. function isPlain(HTML) {
  8829. return !/<(?!br[ />])/i.test(HTML);
  8830. }
  8831. /**
  8832. * Given node filters, deeply filters and mutates a NodeList.
  8833. *
  8834. * @param {NodeList} nodeList The nodeList to filter.
  8835. * @param {Array} filters An array of functions that can mutate with the provided node.
  8836. * @param {Document} doc The document of the nodeList.
  8837. * @param {Object} schema The schema to use.
  8838. */
  8839. function deepFilterNodeList(nodeList, filters, doc, schema) {
  8840. Array.from(nodeList).forEach(function (node) {
  8841. deepFilterNodeList(node.childNodes, filters, doc, schema);
  8842. filters.forEach(function (item) {
  8843. // Make sure the node is still attached to the document.
  8844. if (!doc.contains(node)) {
  8845. return;
  8846. }
  8847. item(node, doc, schema);
  8848. });
  8849. });
  8850. }
  8851. /**
  8852. * Given node filters, deeply filters HTML tags.
  8853. * Filters from the deepest nodes to the top.
  8854. *
  8855. * @param {string} HTML The HTML to filter.
  8856. * @param {Array} filters An array of functions that can mutate with the provided node.
  8857. * @param {Object} schema The schema to use.
  8858. *
  8859. * @return {string} The filtered HTML.
  8860. */
  8861. function deepFilterHTML(HTML) {
  8862. var filters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  8863. var schema = arguments.length > 2 ? arguments[2] : undefined;
  8864. var doc = document.implementation.createHTMLDocument('');
  8865. doc.body.innerHTML = HTML;
  8866. deepFilterNodeList(doc.body.childNodes, filters, doc, schema);
  8867. return doc.body.innerHTML;
  8868. }
  8869. /**
  8870. * Given a schema, unwraps or removes nodes, attributes and classes on a node
  8871. * list.
  8872. *
  8873. * @param {NodeList} nodeList The nodeList to filter.
  8874. * @param {Document} doc The document of the nodeList.
  8875. * @param {Object} schema An array of functions that can mutate with the provided node.
  8876. * @param {Object} inline Whether to clean for inline mode.
  8877. */
  8878. function cleanNodeList(nodeList, doc, schema, inline) {
  8879. Array.from(nodeList).forEach(function (node) {
  8880. var tag = node.nodeName.toLowerCase(); // It's a valid child, if the tag exists in the schema without an isMatch
  8881. // function, or with an isMatch function that matches the node.
  8882. if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || schema[tag].isMatch(node))) {
  8883. if (node.nodeType === utils_ELEMENT_NODE) {
  8884. var _schema$tag = schema[tag],
  8885. _schema$tag$attribute = _schema$tag.attributes,
  8886. attributes = _schema$tag$attribute === void 0 ? [] : _schema$tag$attribute,
  8887. _schema$tag$classes = _schema$tag.classes,
  8888. classes = _schema$tag$classes === void 0 ? [] : _schema$tag$classes,
  8889. children = _schema$tag.children,
  8890. _schema$tag$require = _schema$tag.require,
  8891. require = _schema$tag$require === void 0 ? [] : _schema$tag$require,
  8892. allowEmpty = _schema$tag.allowEmpty; // If the node is empty and it's supposed to have children,
  8893. // remove the node.
  8894. if (children && !allowEmpty && isEmpty(node)) {
  8895. Object(external_this_wp_dom_["remove"])(node);
  8896. return;
  8897. }
  8898. if (node.hasAttributes()) {
  8899. // Strip invalid attributes.
  8900. Array.from(node.attributes).forEach(function (_ref2) {
  8901. var name = _ref2.name;
  8902. if (name !== 'class' && !Object(external_lodash_["includes"])(attributes, name)) {
  8903. node.removeAttribute(name);
  8904. }
  8905. }); // Strip invalid classes.
  8906. // In jsdom-jscore, 'node.classList' can be undefined.
  8907. // TODO: Explore patching this in jsdom-jscore.
  8908. if (node.classList && node.classList.length) {
  8909. var mattchers = classes.map(function (item) {
  8910. if (typeof item === 'string') {
  8911. return function (className) {
  8912. return className === item;
  8913. };
  8914. } else if (item instanceof RegExp) {
  8915. return function (className) {
  8916. return item.test(className);
  8917. };
  8918. }
  8919. return external_lodash_["noop"];
  8920. });
  8921. Array.from(node.classList).forEach(function (name) {
  8922. if (!mattchers.some(function (isMatch) {
  8923. return isMatch(name);
  8924. })) {
  8925. node.classList.remove(name);
  8926. }
  8927. });
  8928. if (!node.classList.length) {
  8929. node.removeAttribute('class');
  8930. }
  8931. }
  8932. }
  8933. if (node.hasChildNodes()) {
  8934. // Do not filter any content.
  8935. if (children === '*') {
  8936. return;
  8937. } // Continue if the node is supposed to have children.
  8938. if (children) {
  8939. // If a parent requires certain children, but it does
  8940. // not have them, drop the parent and continue.
  8941. if (require.length && !node.querySelector(require.join(','))) {
  8942. cleanNodeList(node.childNodes, doc, schema, inline);
  8943. Object(external_this_wp_dom_["unwrap"])(node); // If the node is at the top, phrasing content, and
  8944. // contains children that are block content, unwrap
  8945. // the node because it is invalid.
  8946. } else if (node.parentNode.nodeName === 'BODY' && isPhrasingContent(node)) {
  8947. cleanNodeList(node.childNodes, doc, schema, inline);
  8948. if (Array.from(node.childNodes).some(function (child) {
  8949. return !isPhrasingContent(child);
  8950. })) {
  8951. Object(external_this_wp_dom_["unwrap"])(node);
  8952. }
  8953. } else {
  8954. cleanNodeList(node.childNodes, doc, children, inline);
  8955. } // Remove children if the node is not supposed to have any.
  8956. } else {
  8957. while (node.firstChild) {
  8958. Object(external_this_wp_dom_["remove"])(node.firstChild);
  8959. }
  8960. }
  8961. }
  8962. } // Invalid child. Continue with schema at the same place and unwrap.
  8963. } else {
  8964. cleanNodeList(node.childNodes, doc, schema, inline); // For inline mode, insert a line break when unwrapping nodes that
  8965. // are not phrasing content.
  8966. if (inline && !isPhrasingContent(node) && node.nextElementSibling) {
  8967. Object(external_this_wp_dom_["insertAfter"])(doc.createElement('br'), node);
  8968. }
  8969. Object(external_this_wp_dom_["unwrap"])(node);
  8970. }
  8971. });
  8972. }
  8973. /**
  8974. * Given a schema, unwraps or removes nodes, attributes and classes on HTML.
  8975. *
  8976. * @param {string} HTML The HTML to clean up.
  8977. * @param {Object} schema Schema for the HTML.
  8978. * @param {Object} inline Whether to clean for inline mode.
  8979. *
  8980. * @return {string} The cleaned up HTML.
  8981. */
  8982. function removeInvalidHTML(HTML, schema, inline) {
  8983. var doc = document.implementation.createHTMLDocument('');
  8984. doc.body.innerHTML = HTML;
  8985. cleanNodeList(doc.body.childNodes, doc, schema, inline);
  8986. return doc.body.innerHTML;
  8987. }
  8988. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js
  8989. /**
  8990. * Internal dependencies
  8991. */
  8992. /**
  8993. * Browser dependencies
  8994. */
  8995. var normalise_blocks_window$Node = window.Node,
  8996. normalise_blocks_ELEMENT_NODE = normalise_blocks_window$Node.ELEMENT_NODE,
  8997. normalise_blocks_TEXT_NODE = normalise_blocks_window$Node.TEXT_NODE;
  8998. /* harmony default export */ var normalise_blocks = (function (HTML) {
  8999. var decuDoc = document.implementation.createHTMLDocument('');
  9000. var accuDoc = document.implementation.createHTMLDocument('');
  9001. var decu = decuDoc.body;
  9002. var accu = accuDoc.body;
  9003. decu.innerHTML = HTML;
  9004. while (decu.firstChild) {
  9005. var node = decu.firstChild; // Text nodes: wrap in a paragraph, or append to previous.
  9006. if (node.nodeType === normalise_blocks_TEXT_NODE) {
  9007. if (!node.nodeValue.trim()) {
  9008. decu.removeChild(node);
  9009. } else {
  9010. if (!accu.lastChild || accu.lastChild.nodeName !== 'P') {
  9011. accu.appendChild(accuDoc.createElement('P'));
  9012. }
  9013. accu.lastChild.appendChild(node);
  9014. } // Element nodes.
  9015. } else if (node.nodeType === normalise_blocks_ELEMENT_NODE) {
  9016. // BR nodes: create a new paragraph on double, or append to previous.
  9017. if (node.nodeName === 'BR') {
  9018. if (node.nextSibling && node.nextSibling.nodeName === 'BR') {
  9019. accu.appendChild(accuDoc.createElement('P'));
  9020. decu.removeChild(node.nextSibling);
  9021. } // Don't append to an empty paragraph.
  9022. if (accu.lastChild && accu.lastChild.nodeName === 'P' && accu.lastChild.hasChildNodes()) {
  9023. accu.lastChild.appendChild(node);
  9024. } else {
  9025. decu.removeChild(node);
  9026. }
  9027. } else if (node.nodeName === 'P') {
  9028. // Only append non-empty paragraph nodes.
  9029. if (isEmpty(node)) {
  9030. decu.removeChild(node);
  9031. } else {
  9032. accu.appendChild(node);
  9033. }
  9034. } else if (isPhrasingContent(node)) {
  9035. if (!accu.lastChild || accu.lastChild.nodeName !== 'P') {
  9036. accu.appendChild(accuDoc.createElement('P'));
  9037. }
  9038. accu.lastChild.appendChild(node);
  9039. } else {
  9040. accu.appendChild(node);
  9041. }
  9042. } else {
  9043. decu.removeChild(node);
  9044. }
  9045. }
  9046. return accu.innerHTML;
  9047. });
  9048. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js
  9049. /**
  9050. * WordPress dependencies
  9051. */
  9052. /**
  9053. * Browser dependencies
  9054. */
  9055. var COMMENT_NODE = window.Node.COMMENT_NODE;
  9056. /**
  9057. * Looks for `<!--nextpage-->` and `<!--more-->` comments, as well as the
  9058. * `<!--more Some text-->` variant and its `<!--noteaser-->` companion,
  9059. * and replaces them with a custom element representing a future block.
  9060. *
  9061. * The custom element is a way to bypass the rest of the `raw-handling`
  9062. * transforms, which would eliminate other kinds of node with which to carry
  9063. * `<!--more-->`'s data: nodes with `data` attributes, empty paragraphs, etc.
  9064. *
  9065. * The custom element is then expected to be recognized by any registered
  9066. * block's `raw` transform.
  9067. *
  9068. * @param {Node} node The node to be processed.
  9069. * @param {Document} doc The document of the node.
  9070. * @return {void}
  9071. */
  9072. /* harmony default export */ var special_comment_converter = (function (node, doc) {
  9073. if (node.nodeType !== COMMENT_NODE) {
  9074. return;
  9075. }
  9076. if (node.nodeValue === 'nextpage') {
  9077. Object(external_this_wp_dom_["replace"])(node, createNextpage(doc));
  9078. return;
  9079. }
  9080. if (node.nodeValue.indexOf('more') === 0) {
  9081. // Grab any custom text in the comment.
  9082. var customText = node.nodeValue.slice(4).trim();
  9083. /*
  9084. * When a `<!--more-->` comment is found, we need to look for any
  9085. * `<!--noteaser-->` sibling, but it may not be a direct sibling
  9086. * (whitespace typically lies in between)
  9087. */
  9088. var sibling = node;
  9089. var noTeaser = false;
  9090. while (sibling = sibling.nextSibling) {
  9091. if (sibling.nodeType === COMMENT_NODE && sibling.nodeValue === 'noteaser') {
  9092. noTeaser = true;
  9093. Object(external_this_wp_dom_["remove"])(sibling);
  9094. break;
  9095. }
  9096. }
  9097. Object(external_this_wp_dom_["replace"])(node, createMore(customText, noTeaser, doc));
  9098. }
  9099. });
  9100. function createMore(customText, noTeaser, doc) {
  9101. var node = doc.createElement('wp-block');
  9102. node.dataset.block = 'core/more';
  9103. if (customText) {
  9104. node.dataset.customText = customText;
  9105. }
  9106. if (noTeaser) {
  9107. // "Boolean" data attribute
  9108. node.dataset.noTeaser = '';
  9109. }
  9110. return node;
  9111. }
  9112. function createNextpage(doc) {
  9113. var node = doc.createElement('wp-block');
  9114. node.dataset.block = 'core/nextpage';
  9115. return node;
  9116. }
  9117. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js
  9118. /**
  9119. * WordPress dependencies
  9120. */
  9121. function isList(node) {
  9122. return node.nodeName === 'OL' || node.nodeName === 'UL';
  9123. }
  9124. function shallowTextContent(element) {
  9125. return Object(toConsumableArray["a" /* default */])(element.childNodes).map(function (_ref) {
  9126. var _ref$nodeValue = _ref.nodeValue,
  9127. nodeValue = _ref$nodeValue === void 0 ? '' : _ref$nodeValue;
  9128. return nodeValue;
  9129. }).join('');
  9130. }
  9131. /* harmony default export */ var list_reducer = (function (node) {
  9132. if (!isList(node)) {
  9133. return;
  9134. }
  9135. var list = node;
  9136. var prevElement = node.previousElementSibling; // Merge with previous list if:
  9137. // * There is a previous list of the same type.
  9138. // * There is only one list item.
  9139. if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) {
  9140. // Move all child nodes, including any text nodes, if any.
  9141. while (list.firstChild) {
  9142. prevElement.appendChild(list.firstChild);
  9143. }
  9144. list.parentNode.removeChild(list);
  9145. }
  9146. var parentElement = node.parentNode; // Nested list with empty parent item.
  9147. if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) {
  9148. var parentListItem = parentElement;
  9149. var prevListItem = parentListItem.previousElementSibling;
  9150. var parentList = parentListItem.parentNode;
  9151. if (prevListItem) {
  9152. prevListItem.appendChild(list);
  9153. parentList.removeChild(parentListItem);
  9154. } else {
  9155. parentList.parentNode.insertBefore(list, parentList);
  9156. parentList.parentNode.removeChild(parentList);
  9157. }
  9158. } // Invalid: OL/UL > OL/UL.
  9159. if (parentElement && isList(parentElement)) {
  9160. var _prevListItem = node.previousElementSibling;
  9161. if (_prevListItem) {
  9162. _prevListItem.appendChild(node);
  9163. } else {
  9164. Object(external_this_wp_dom_["unwrap"])(node);
  9165. }
  9166. }
  9167. });
  9168. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js
  9169. /**
  9170. * Internal dependencies
  9171. */
  9172. /* harmony default export */ var blockquote_normaliser = (function (node) {
  9173. if (node.nodeName !== 'BLOCKQUOTE') {
  9174. return;
  9175. }
  9176. node.innerHTML = normalise_blocks(node.innerHTML);
  9177. });
  9178. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js
  9179. /**
  9180. * External dependencies
  9181. */
  9182. /**
  9183. * Internal dependencies
  9184. */
  9185. /**
  9186. * Whether or not the given node is figure content.
  9187. *
  9188. * @param {Node} node The node to check.
  9189. * @param {Object} schema The schema to use.
  9190. *
  9191. * @return {boolean} True if figure content, false if not.
  9192. */
  9193. function isFigureContent(node, schema) {
  9194. var tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding
  9195. // `figcaption` and any phrasing content.
  9196. if (tag === 'figcaption' || isPhrasingContent(node)) {
  9197. return false;
  9198. }
  9199. return Object(external_lodash_["has"])(schema, ['figure', 'children', tag]);
  9200. }
  9201. /**
  9202. * Whether or not the given node can have an anchor.
  9203. *
  9204. * @param {Node} node The node to check.
  9205. * @param {Object} schema The schema to use.
  9206. *
  9207. * @return {boolean} True if it can, false if not.
  9208. */
  9209. function canHaveAnchor(node, schema) {
  9210. var tag = node.nodeName.toLowerCase();
  9211. return Object(external_lodash_["has"])(schema, ['figure', 'children', 'a', 'children', tag]);
  9212. }
  9213. /**
  9214. * This filter takes figure content out of paragraphs, wraps it in a figure
  9215. * element, and moves any anchors with it if needed.
  9216. *
  9217. * @param {Node} node The node to filter.
  9218. * @param {Document} doc The document of the node.
  9219. * @param {Object} schema The schema to use.
  9220. *
  9221. * @return {void}
  9222. */
  9223. /* harmony default export */ var figure_content_reducer = (function (node, doc, schema) {
  9224. if (!isFigureContent(node, schema)) {
  9225. return;
  9226. }
  9227. var nodeToInsert = node;
  9228. var parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with
  9229. // only the figure content, take the anchor out instead of just the content.
  9230. if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) {
  9231. nodeToInsert = node.parentNode;
  9232. }
  9233. var wrapper = nodeToInsert;
  9234. while (wrapper && wrapper.nodeName !== 'P') {
  9235. wrapper = wrapper.parentElement;
  9236. }
  9237. var figure = doc.createElement('figure');
  9238. if (wrapper) {
  9239. wrapper.parentNode.insertBefore(figure, wrapper);
  9240. } else {
  9241. nodeToInsert.parentNode.insertBefore(figure, nodeToInsert);
  9242. }
  9243. figure.appendChild(nodeToInsert);
  9244. });
  9245. // EXTERNAL MODULE: external {"this":["wp","shortcode"]}
  9246. var external_this_wp_shortcode_ = __webpack_require__(144);
  9247. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js
  9248. /**
  9249. * External dependencies
  9250. */
  9251. /**
  9252. * WordPress dependencies
  9253. */
  9254. /**
  9255. * Internal dependencies
  9256. */
  9257. function segmentHTMLToShortcodeBlock(HTML) {
  9258. var lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  9259. // Get all matches.
  9260. var transformsFrom = getBlockTransforms('from');
  9261. var transformation = findTransform(transformsFrom, function (transform) {
  9262. return transform.type === 'shortcode' && Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(transform.tag), function (tag) {
  9263. return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML);
  9264. });
  9265. });
  9266. if (!transformation) {
  9267. return [HTML];
  9268. }
  9269. var transformTags = Object(external_lodash_["castArray"])(transformation.tag);
  9270. var transformTag = Object(external_lodash_["first"])(transformTags);
  9271. var match;
  9272. if (match = Object(external_this_wp_shortcode_["next"])(transformTag, HTML, lastIndex)) {
  9273. var beforeHTML = HTML.substr(0, match.index);
  9274. lastIndex = match.index + match.content.length; // If the shortcode content does not contain HTML and the shortcode is
  9275. // not on a new line (or in paragraph from Markdown converter),
  9276. // consider the shortcode as inline text, and thus skip conversion for
  9277. // this segment.
  9278. if (!Object(external_lodash_["includes"])(match.shortcode.content || '', '<') && !/(\n|<p>)\s*$/.test(beforeHTML)) {
  9279. return segmentHTMLToShortcodeBlock(HTML, lastIndex);
  9280. }
  9281. var attributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(transformation.attributes, function (schema) {
  9282. return schema.shortcode;
  9283. }), // Passing all of `match` as second argument is intentionally broad
  9284. // but shouldn't be too relied upon.
  9285. //
  9286. // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
  9287. function (schema) {
  9288. return schema.shortcode(match.shortcode.attrs, match);
  9289. });
  9290. var block = createBlock(transformation.blockName, getBlockAttributes(Object(objectSpread["a" /* default */])({}, registration_getBlockType(transformation.blockName), {
  9291. attributes: transformation.attributes
  9292. }), match.shortcode.content, attributes));
  9293. return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex))));
  9294. }
  9295. return [HTML];
  9296. }
  9297. /* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock);
  9298. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js
  9299. /**
  9300. * WordPress dependencies
  9301. */
  9302. /**
  9303. * Browser dependencies
  9304. */
  9305. var comment_remover_COMMENT_NODE = window.Node.COMMENT_NODE;
  9306. /**
  9307. * Looks for comments, and removes them.
  9308. *
  9309. * @param {Node} node The node to be processed.
  9310. * @return {void}
  9311. */
  9312. /* harmony default export */ var comment_remover = (function (node) {
  9313. if (node.nodeType === comment_remover_COMMENT_NODE) {
  9314. Object(external_this_wp_dom_["remove"])(node);
  9315. }
  9316. });
  9317. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js
  9318. /**
  9319. * External dependencies
  9320. */
  9321. /**
  9322. * Internal dependencies
  9323. */
  9324. /**
  9325. * Checks if the given node should be considered inline content, optionally
  9326. * depending on a context tag.
  9327. *
  9328. * @param {Node} node Node name.
  9329. * @param {string} contextTag Tag name.
  9330. *
  9331. * @return {boolean} True if the node is inline content, false if nohe.
  9332. */
  9333. function isInline(node, contextTag) {
  9334. if (isPhrasingContent(node)) {
  9335. return true;
  9336. }
  9337. if (!contextTag) {
  9338. return false;
  9339. }
  9340. var tag = node.nodeName.toLowerCase();
  9341. var inlineWhitelistTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']];
  9342. return inlineWhitelistTagGroups.some(function (tagGroup) {
  9343. return Object(external_lodash_["difference"])([tag, contextTag], tagGroup).length === 0;
  9344. });
  9345. }
  9346. function deepCheck(nodes, contextTag) {
  9347. return nodes.every(function (node) {
  9348. return isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag);
  9349. });
  9350. }
  9351. function isDoubleBR(node) {
  9352. return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR';
  9353. }
  9354. /* harmony default export */ var is_inline_content = (function (HTML, contextTag) {
  9355. var doc = document.implementation.createHTMLDocument('');
  9356. doc.body.innerHTML = HTML;
  9357. var nodes = Array.from(doc.body.children);
  9358. return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
  9359. });
  9360. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js
  9361. /**
  9362. * WordPress dependencies
  9363. */
  9364. /* harmony default export */ var phrasing_content_reducer = (function (node, doc) {
  9365. // In jsdom-jscore, 'node.style' can be null.
  9366. // TODO: Explore fixing this by patching jsdom-jscore.
  9367. if (node.nodeName === 'SPAN' && node.style) {
  9368. var _node$style = node.style,
  9369. fontWeight = _node$style.fontWeight,
  9370. fontStyle = _node$style.fontStyle,
  9371. textDecorationLine = _node$style.textDecorationLine,
  9372. verticalAlign = _node$style.verticalAlign;
  9373. if (fontWeight === 'bold' || fontWeight === '700') {
  9374. Object(external_this_wp_dom_["wrap"])(doc.createElement('strong'), node);
  9375. }
  9376. if (fontStyle === 'italic') {
  9377. Object(external_this_wp_dom_["wrap"])(doc.createElement('em'), node);
  9378. }
  9379. if (textDecorationLine === 'line-through') {
  9380. Object(external_this_wp_dom_["wrap"])(doc.createElement('s'), node);
  9381. }
  9382. if (verticalAlign === 'super') {
  9383. Object(external_this_wp_dom_["wrap"])(doc.createElement('sup'), node);
  9384. } else if (verticalAlign === 'sub') {
  9385. Object(external_this_wp_dom_["wrap"])(doc.createElement('sub'), node);
  9386. }
  9387. } else if (node.nodeName === 'B') {
  9388. node = Object(external_this_wp_dom_["replaceTag"])(node, 'strong');
  9389. } else if (node.nodeName === 'I') {
  9390. node = Object(external_this_wp_dom_["replaceTag"])(node, 'em');
  9391. } else if (node.nodeName === 'A') {
  9392. // In jsdom-jscore, 'node.target' can be null.
  9393. // TODO: Explore fixing this by patching jsdom-jscore.
  9394. if (node.target && node.target.toLowerCase() === '_blank') {
  9395. node.rel = 'noreferrer noopener';
  9396. } else {
  9397. node.removeAttribute('target');
  9398. node.removeAttribute('rel');
  9399. }
  9400. }
  9401. });
  9402. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js
  9403. /* harmony default export */ var head_remover = (function (node) {
  9404. if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') {
  9405. return;
  9406. }
  9407. node.parentNode.removeChild(node);
  9408. });
  9409. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js
  9410. /**
  9411. * Browser dependencies
  9412. */
  9413. var _window = window,
  9414. ms_list_converter_parseInt = _window.parseInt;
  9415. function ms_list_converter_isList(node) {
  9416. return node.nodeName === 'OL' || node.nodeName === 'UL';
  9417. }
  9418. /* harmony default export */ var ms_list_converter = (function (node, doc) {
  9419. if (node.nodeName !== 'P') {
  9420. return;
  9421. }
  9422. var style = node.getAttribute('style');
  9423. if (!style) {
  9424. return;
  9425. } // Quick check.
  9426. if (style.indexOf('mso-list') === -1) {
  9427. return;
  9428. }
  9429. var matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
  9430. if (!matches) {
  9431. return;
  9432. }
  9433. var level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0;
  9434. var prevNode = node.previousElementSibling; // Add new list if no previous.
  9435. if (!prevNode || !ms_list_converter_isList(prevNode)) {
  9436. // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type.
  9437. var type = node.textContent.trim().slice(0, 1);
  9438. var isNumeric = /[1iIaA]/.test(type);
  9439. var newListNode = doc.createElement(isNumeric ? 'ol' : 'ul');
  9440. if (isNumeric) {
  9441. newListNode.setAttribute('type', type);
  9442. }
  9443. node.parentNode.insertBefore(newListNode, node);
  9444. }
  9445. var listNode = node.previousElementSibling;
  9446. var listType = listNode.nodeName;
  9447. var listItem = doc.createElement('li');
  9448. var receivingNode = listNode; // Remove the first span with list info.
  9449. node.removeChild(node.firstElementChild); // Add content.
  9450. while (node.firstChild) {
  9451. listItem.appendChild(node.firstChild);
  9452. } // Change pointer depending on indentation level.
  9453. while (level--) {
  9454. receivingNode = receivingNode.lastElementChild || receivingNode; // If it's a list, move pointer to the last item.
  9455. if (ms_list_converter_isList(receivingNode)) {
  9456. receivingNode = receivingNode.lastElementChild || receivingNode;
  9457. }
  9458. } // Make sure we append to a list.
  9459. if (!ms_list_converter_isList(receivingNode)) {
  9460. receivingNode = receivingNode.appendChild(doc.createElement(listType));
  9461. } // Append the list item to the list.
  9462. receivingNode.appendChild(listItem); // Remove the wrapper paragraph.
  9463. node.parentNode.removeChild(node);
  9464. });
  9465. // EXTERNAL MODULE: external {"this":["wp","blob"]}
  9466. var external_this_wp_blob_ = __webpack_require__(35);
  9467. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js
  9468. /**
  9469. * WordPress dependencies
  9470. */
  9471. /**
  9472. * Browser dependencies
  9473. */
  9474. var image_corrector_window = window,
  9475. atob = image_corrector_window.atob,
  9476. File = image_corrector_window.File;
  9477. /* harmony default export */ var image_corrector = (function (node) {
  9478. if (node.nodeName !== 'IMG') {
  9479. return;
  9480. }
  9481. if (node.src.indexOf('file:') === 0) {
  9482. node.src = '';
  9483. } // This piece cannot be tested outside a browser env.
  9484. if (node.src.indexOf('data:') === 0) {
  9485. var _node$src$split = node.src.split(','),
  9486. _node$src$split2 = Object(slicedToArray["a" /* default */])(_node$src$split, 2),
  9487. properties = _node$src$split2[0],
  9488. data = _node$src$split2[1];
  9489. var _properties$slice$spl = properties.slice(5).split(';'),
  9490. _properties$slice$spl2 = Object(slicedToArray["a" /* default */])(_properties$slice$spl, 1),
  9491. type = _properties$slice$spl2[0];
  9492. if (!data || !type) {
  9493. node.src = '';
  9494. return;
  9495. }
  9496. var decoded; // Can throw DOMException!
  9497. try {
  9498. decoded = atob(data);
  9499. } catch (e) {
  9500. node.src = '';
  9501. return;
  9502. }
  9503. var uint8Array = new Uint8Array(decoded.length);
  9504. for (var i = 0; i < uint8Array.length; i++) {
  9505. uint8Array[i] = decoded.charCodeAt(i);
  9506. }
  9507. var name = type.replace('/', '.');
  9508. var file = new File([uint8Array], name, {
  9509. type: type
  9510. });
  9511. node.src = Object(external_this_wp_blob_["createBlobURL"])(file);
  9512. } // Remove trackers and hardly visible images.
  9513. if (node.height === 1 || node.width === 1) {
  9514. node.parentNode.removeChild(node);
  9515. }
  9516. });
  9517. // EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js
  9518. var showdown = __webpack_require__(223);
  9519. var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown);
  9520. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js
  9521. /**
  9522. * External dependencies
  9523. */
  9524. // Reuse the same showdown converter.
  9525. var converter = new showdown_default.a.Converter({
  9526. noHeaderId: true,
  9527. tables: true,
  9528. literalMidWordUnderscores: true,
  9529. omitExtraWLInCodeBlocks: true,
  9530. simpleLineBreaks: true,
  9531. strikethrough: true
  9532. });
  9533. /**
  9534. * Corrects the Slack Markdown variant of the code block.
  9535. * If uncorrected, it will be converted to inline code.
  9536. *
  9537. * @see https://get.slack.help/hc/en-us/articles/202288908-how-can-i-add-formatting-to-my-messages-#code-blocks
  9538. *
  9539. * @param {string} text The potential Markdown text to correct.
  9540. *
  9541. * @return {string} The corrected Markdown.
  9542. */
  9543. function slackMarkdownVariantCorrector(text) {
  9544. return text.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, function (match, p1, p2, p3) {
  9545. return "".concat(p1, "\n").concat(p2, "\n").concat(p3);
  9546. });
  9547. }
  9548. /**
  9549. * Converts a piece of text into HTML based on any Markdown present.
  9550. * Also decodes any encoded HTML.
  9551. *
  9552. * @param {string} text The plain text to convert.
  9553. *
  9554. * @return {string} HTML.
  9555. */
  9556. /* harmony default export */ var markdown_converter = (function (text) {
  9557. return converter.makeHtml(slackMarkdownVariantCorrector(text));
  9558. });
  9559. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js
  9560. /**
  9561. * WordPress dependencies
  9562. */
  9563. /**
  9564. * Removes iframes.
  9565. *
  9566. * @param {Node} node The node to check.
  9567. *
  9568. * @return {void}
  9569. */
  9570. /* harmony default export */ var iframe_remover = (function (node) {
  9571. if (node.nodeName === 'IFRAME') {
  9572. Object(external_this_wp_dom_["remove"])(node);
  9573. }
  9574. });
  9575. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js
  9576. /**
  9577. * WordPress dependencies
  9578. */
  9579. /* harmony default export */ var google_docs_uid_remover = (function (node) {
  9580. if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) {
  9581. return;
  9582. }
  9583. Object(external_this_wp_dom_["unwrap"])(node);
  9584. });
  9585. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js
  9586. /**
  9587. * External dependencies
  9588. */
  9589. /**
  9590. * Internal dependencies
  9591. */
  9592. /**
  9593. * Browser dependencies
  9594. */
  9595. var paste_handler_window = window,
  9596. paste_handler_console = paste_handler_window.console;
  9597. /**
  9598. * Filters HTML to only contain phrasing content.
  9599. *
  9600. * @param {string} HTML The HTML to filter.
  9601. *
  9602. * @return {string} HTML only containing phrasing content.
  9603. */
  9604. function filterInlineHTML(HTML) {
  9605. HTML = deepFilterHTML(HTML, [google_docs_uid_remover, phrasing_content_reducer, comment_remover]);
  9606. HTML = removeInvalidHTML(HTML, getPhrasingContentSchema(), {
  9607. inline: true
  9608. }); // Allows us to ask for this information when we get a report.
  9609. paste_handler_console.log('Processed inline HTML:\n\n', HTML);
  9610. return HTML;
  9611. }
  9612. function getRawTransformations() {
  9613. return Object(external_lodash_["filter"])(getBlockTransforms('from'), {
  9614. type: 'raw'
  9615. }).map(function (transform) {
  9616. return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, {
  9617. isMatch: function isMatch(node) {
  9618. return transform.selector && node.matches(transform.selector);
  9619. }
  9620. });
  9621. });
  9622. }
  9623. /**
  9624. * Converts HTML directly to blocks. Looks for a matching transform for each
  9625. * top-level tag. The HTML should be filtered to not have any text between
  9626. * top-level tags and formatted in a way that blocks can handle the HTML.
  9627. *
  9628. * @param {Object} $1 Named parameters.
  9629. * @param {string} $1.html HTML to convert.
  9630. * @param {Array} $1.rawTransforms Transforms that can be used.
  9631. *
  9632. * @return {Array} An array of blocks.
  9633. */
  9634. function htmlToBlocks(_ref) {
  9635. var html = _ref.html,
  9636. rawTransforms = _ref.rawTransforms;
  9637. var doc = document.implementation.createHTMLDocument('');
  9638. doc.body.innerHTML = html;
  9639. return Array.from(doc.body.children).map(function (node) {
  9640. var rawTransform = findTransform(rawTransforms, function (_ref2) {
  9641. var isMatch = _ref2.isMatch;
  9642. return isMatch(node);
  9643. });
  9644. if (!rawTransform) {
  9645. return createBlock( // Should not be hardcoded.
  9646. 'core/html', getBlockAttributes('core/html', node.outerHTML));
  9647. }
  9648. var transform = rawTransform.transform,
  9649. blockName = rawTransform.blockName;
  9650. if (transform) {
  9651. return transform(node);
  9652. }
  9653. return createBlock(blockName, getBlockAttributes(blockName, node.outerHTML));
  9654. });
  9655. }
  9656. /**
  9657. * Converts an HTML string to known blocks. Strips everything else.
  9658. *
  9659. * @param {Object} options
  9660. * @param {string} [options.HTML] The HTML to convert.
  9661. * @param {string} [options.plainText] Plain text version.
  9662. * @param {string} [options.mode] Handle content as blocks or inline content.
  9663. * * 'AUTO': Decide based on the content passed.
  9664. * * 'INLINE': Always handle as inline content, and return string.
  9665. * * 'BLOCKS': Always handle as blocks, and return array of blocks.
  9666. * @param {Array} [options.tagName] The tag into which content will be inserted.
  9667. * @param {boolean} [options.canUserUseUnfilteredHTML] Whether or not the user can use unfiltered HTML.
  9668. *
  9669. * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.
  9670. */
  9671. function pasteHandler(_ref3) {
  9672. var _ref3$HTML = _ref3.HTML,
  9673. HTML = _ref3$HTML === void 0 ? '' : _ref3$HTML,
  9674. _ref3$plainText = _ref3.plainText,
  9675. plainText = _ref3$plainText === void 0 ? '' : _ref3$plainText,
  9676. _ref3$mode = _ref3.mode,
  9677. mode = _ref3$mode === void 0 ? 'AUTO' : _ref3$mode,
  9678. tagName = _ref3.tagName,
  9679. _ref3$canUserUseUnfil = _ref3.canUserUseUnfilteredHTML,
  9680. canUserUseUnfilteredHTML = _ref3$canUserUseUnfil === void 0 ? false : _ref3$canUserUseUnfil;
  9681. // First of all, strip any meta tags.
  9682. HTML = HTML.replace(/<meta[^>]+>/, ''); // If we detect block delimiters in HTML, parse entirely as blocks.
  9683. if (mode !== 'INLINE') {
  9684. // Check plain text if there is no HTML.
  9685. var content = HTML ? HTML : plainText;
  9686. if (content.indexOf('<!-- wp:') !== -1) {
  9687. return parseWithGrammar(content);
  9688. }
  9689. } // Normalize unicode to use composed characters.
  9690. // This is unsupported in IE 11 but it's a nice-to-have feature, not mandatory.
  9691. // Not normalizing the content will only affect older browsers and won't
  9692. // entirely break the app.
  9693. // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
  9694. // See: https://core.trac.wordpress.org/ticket/30130
  9695. // See: https://github.com/WordPress/gutenberg/pull/6983#pullrequestreview-125151075
  9696. if (String.prototype.normalize) {
  9697. HTML = HTML.normalize();
  9698. } // Parse Markdown (and encoded HTML) if:
  9699. // * There is a plain text version.
  9700. // * There is no HTML version, or it has no formatting.
  9701. if (plainText && (!HTML || isPlain(HTML))) {
  9702. HTML = markdown_converter(plainText); // Switch to inline mode if:
  9703. // * The current mode is AUTO.
  9704. // * The original plain text had no line breaks.
  9705. // * The original plain text was not an HTML paragraph.
  9706. // * The converted text is just a paragraph.
  9707. if (mode === 'AUTO' && plainText.indexOf('\n') === -1 && plainText.indexOf('<p>') !== 0 && HTML.indexOf('<p>') === 0) {
  9708. mode = 'INLINE';
  9709. }
  9710. }
  9711. if (mode === 'INLINE') {
  9712. return filterInlineHTML(HTML);
  9713. } // An array of HTML strings and block objects. The blocks replace matched
  9714. // shortcodes.
  9715. var pieces = shortcode_converter(HTML); // The call to shortcodeConverter will always return more than one element
  9716. // if shortcodes are matched. The reason is when shortcodes are matched
  9717. // empty HTML strings are included.
  9718. var hasShortcodes = pieces.length > 1;
  9719. if (mode === 'AUTO' && !hasShortcodes && is_inline_content(HTML, tagName)) {
  9720. return filterInlineHTML(HTML);
  9721. }
  9722. var rawTransforms = getRawTransformations();
  9723. var phrasingContentSchema = getPhrasingContentSchema();
  9724. var blockContentSchema = getBlockContentSchema(rawTransforms);
  9725. var blocks = Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) {
  9726. // Already a block from shortcode.
  9727. if (typeof piece !== 'string') {
  9728. return piece;
  9729. }
  9730. var filters = [google_docs_uid_remover, ms_list_converter, head_remover, list_reducer, image_corrector, phrasing_content_reducer, special_comment_converter, comment_remover, figure_content_reducer, blockquote_normaliser];
  9731. if (!canUserUseUnfilteredHTML) {
  9732. // Should run before `figureContentReducer`.
  9733. filters.unshift(iframe_remover);
  9734. }
  9735. var schema = Object(objectSpread["a" /* default */])({}, blockContentSchema, phrasingContentSchema);
  9736. piece = deepFilterHTML(piece, filters, blockContentSchema);
  9737. piece = removeInvalidHTML(piece, schema);
  9738. piece = normalise_blocks(piece); // Allows us to ask for this information when we get a report.
  9739. paste_handler_console.log('Processed HTML piece:\n\n', piece);
  9740. return htmlToBlocks({
  9741. html: piece,
  9742. rawTransforms: rawTransforms
  9743. });
  9744. })); // If we're allowed to return inline content and there is only one block
  9745. // and the original plain text content does not have any line breaks, then
  9746. // treat it as inline paste.
  9747. if (mode === 'AUTO' && blocks.length === 1) {
  9748. var trimmedPlainText = plainText.trim();
  9749. if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) {
  9750. return removeInvalidHTML(getBlockContent(blocks[0]), phrasingContentSchema);
  9751. }
  9752. }
  9753. return blocks;
  9754. }
  9755. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js
  9756. /**
  9757. * External dependencies
  9758. */
  9759. /**
  9760. * Internal dependencies
  9761. */
  9762. function raw_handling_getRawTransformations() {
  9763. return Object(external_lodash_["filter"])(getBlockTransforms('from'), {
  9764. type: 'raw'
  9765. }).map(function (transform) {
  9766. return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, {
  9767. isMatch: function isMatch(node) {
  9768. return transform.selector && node.matches(transform.selector);
  9769. }
  9770. });
  9771. });
  9772. }
  9773. /**
  9774. * Converts HTML directly to blocks. Looks for a matching transform for each
  9775. * top-level tag. The HTML should be filtered to not have any text between
  9776. * top-level tags and formatted in a way that blocks can handle the HTML.
  9777. *
  9778. * @param {Object} $1 Named parameters.
  9779. * @param {string} $1.html HTML to convert.
  9780. * @param {Array} $1.rawTransforms Transforms that can be used.
  9781. *
  9782. * @return {Array} An array of blocks.
  9783. */
  9784. function raw_handling_htmlToBlocks(_ref) {
  9785. var html = _ref.html,
  9786. rawTransforms = _ref.rawTransforms;
  9787. var doc = document.implementation.createHTMLDocument('');
  9788. doc.body.innerHTML = html;
  9789. return Array.from(doc.body.children).map(function (node) {
  9790. var rawTransform = findTransform(rawTransforms, function (_ref2) {
  9791. var isMatch = _ref2.isMatch;
  9792. return isMatch(node);
  9793. });
  9794. if (!rawTransform) {
  9795. return createBlock( // Should not be hardcoded.
  9796. 'core/html', getBlockAttributes('core/html', node.outerHTML));
  9797. }
  9798. var transform = rawTransform.transform,
  9799. blockName = rawTransform.blockName;
  9800. if (transform) {
  9801. return transform(node);
  9802. }
  9803. return createBlock(blockName, getBlockAttributes(blockName, node.outerHTML));
  9804. });
  9805. }
  9806. /**
  9807. * Converts an HTML string to known blocks.
  9808. *
  9809. * @param {Object} $1
  9810. * @param {string} $1.HTML The HTML to convert.
  9811. *
  9812. * @return {Array} A list of blocks.
  9813. */
  9814. function rawHandler(_ref3) {
  9815. var _ref3$HTML = _ref3.HTML,
  9816. HTML = _ref3$HTML === void 0 ? '' : _ref3$HTML;
  9817. // If we detect block delimiters, parse entirely as blocks.
  9818. if (HTML.indexOf('<!-- wp:') !== -1) {
  9819. return parseWithGrammar(HTML);
  9820. } // An array of HTML strings and block objects. The blocks replace matched
  9821. // shortcodes.
  9822. var pieces = shortcode_converter(HTML);
  9823. var rawTransforms = raw_handling_getRawTransformations();
  9824. var blockContentSchema = getBlockContentSchema(rawTransforms);
  9825. return Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) {
  9826. // Already a block from shortcode.
  9827. if (typeof piece !== 'string') {
  9828. return piece;
  9829. } // These filters are essential for some blocks to be able to transform
  9830. // from raw HTML. These filters move around some content or add
  9831. // additional tags, they do not remove any content.
  9832. var filters = [// Needed to adjust invalid lists.
  9833. list_reducer, // Needed to create more and nextpage blocks.
  9834. special_comment_converter, // Needed to create media blocks.
  9835. figure_content_reducer, // Needed to create the quote block, which cannot handle text
  9836. // without wrapper paragraphs.
  9837. blockquote_normaliser];
  9838. piece = deepFilterHTML(piece, filters, blockContentSchema);
  9839. piece = normalise_blocks(piece);
  9840. return raw_handling_htmlToBlocks({
  9841. html: piece,
  9842. rawTransforms: rawTransforms
  9843. });
  9844. }));
  9845. }
  9846. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/categories.js
  9847. /**
  9848. * WordPress dependencies
  9849. */
  9850. /**
  9851. * Returns all the block categories.
  9852. *
  9853. * @return {Object[]} Block categories.
  9854. */
  9855. function categories_getCategories() {
  9856. return Object(external_this_wp_data_["select"])('core/blocks').getCategories();
  9857. }
  9858. /**
  9859. * Sets the block categories.
  9860. *
  9861. * @param {Object[]} categories Block categories.
  9862. */
  9863. function categories_setCategories(categories) {
  9864. Object(external_this_wp_data_["dispatch"])('core/blocks').setCategories(categories);
  9865. }
  9866. /**
  9867. * Updates a category.
  9868. *
  9869. * @param {string} slug Block category slug.
  9870. * @param {Object} category Object containing the category properties that should be updated.
  9871. */
  9872. function categories_updateCategory(slug, category) {
  9873. Object(external_this_wp_data_["dispatch"])('core/blocks').updateCategory(slug, category);
  9874. }
  9875. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/templates.js
  9876. /**
  9877. * External dependencies
  9878. */
  9879. /**
  9880. * WordPress dependencies
  9881. */
  9882. /**
  9883. * Internal dependencies
  9884. */
  9885. /**
  9886. * Checks whether a list of blocks matches a template by comparing the block names.
  9887. *
  9888. * @param {Array} blocks Block list.
  9889. * @param {Array} template Block template.
  9890. *
  9891. * @return {boolean} Whether the list of blocks matches a templates
  9892. */
  9893. function doBlocksMatchTemplate() {
  9894. var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  9895. var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  9896. return blocks.length === template.length && Object(external_lodash_["every"])(template, function (_ref, index) {
  9897. var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 3),
  9898. name = _ref2[0],
  9899. innerBlocksTemplate = _ref2[2];
  9900. var block = blocks[index];
  9901. return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate);
  9902. });
  9903. }
  9904. /**
  9905. * Synchronize a block list with a block template.
  9906. *
  9907. * Synchronizing a block list with a block template means that we loop over the blocks
  9908. * keep the block as is if it matches the block at the same position in the template
  9909. * (If it has the same name) and if doesn't match, we create a new block based on the template.
  9910. * Extra blocks not present in the template are removed.
  9911. *
  9912. * @param {Array} blocks Block list.
  9913. * @param {Array} template Block template.
  9914. *
  9915. * @return {Array} Updated Block list.
  9916. */
  9917. function synchronizeBlocksWithTemplate() {
  9918. var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  9919. var template = arguments.length > 1 ? arguments[1] : undefined;
  9920. // If no template is provided, return blocks unmodified.
  9921. if (!template) {
  9922. return blocks;
  9923. }
  9924. return Object(external_lodash_["map"])(template, function (_ref3, index) {
  9925. var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 3),
  9926. name = _ref4[0],
  9927. attributes = _ref4[1],
  9928. innerBlocksTemplate = _ref4[2];
  9929. var block = blocks[index];
  9930. if (block && block.name === name) {
  9931. var innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate);
  9932. return Object(objectSpread["a" /* default */])({}, block, {
  9933. innerBlocks: innerBlocks
  9934. });
  9935. } // To support old templates that were using the "children" format
  9936. // for the attributes using "html" strings now, we normalize the template attributes
  9937. // before creating the blocks.
  9938. var blockType = registration_getBlockType(name);
  9939. var isHTMLAttribute = function isHTMLAttribute(attributeDefinition) {
  9940. return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'html';
  9941. };
  9942. var isQueryAttribute = function isQueryAttribute(attributeDefinition) {
  9943. return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'query';
  9944. };
  9945. var normalizeAttributes = function normalizeAttributes(schema, values) {
  9946. return Object(external_lodash_["mapValues"])(values, function (value, key) {
  9947. return normalizeAttribute(schema[key], value);
  9948. });
  9949. };
  9950. var normalizeAttribute = function normalizeAttribute(definition, value) {
  9951. if (isHTMLAttribute(definition) && Object(external_lodash_["isArray"])(value)) {
  9952. // Introduce a deprecated call at this point
  9953. // When we're confident that "children" format should be removed from the templates.
  9954. return Object(external_this_wp_element_["renderToString"])(value);
  9955. }
  9956. if (isQueryAttribute(definition) && value) {
  9957. return value.map(function (subValues) {
  9958. return normalizeAttributes(definition.query, subValues);
  9959. });
  9960. }
  9961. return value;
  9962. };
  9963. var normalizedAttributes = normalizeAttributes(Object(external_lodash_["get"])(blockType, ['attributes'], {}), attributes);
  9964. return createBlock(name, normalizedAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate));
  9965. });
  9966. }
  9967. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/index.js
  9968. // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js
  9969. /* concated harmony reexport createBlock */__webpack_require__.d(__webpack_exports__, "createBlock", function() { return createBlock; });
  9970. /* concated harmony reexport cloneBlock */__webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return cloneBlock; });
  9971. /* concated harmony reexport getPossibleBlockTransformations */__webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return getPossibleBlockTransformations; });
  9972. /* concated harmony reexport switchToBlockType */__webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return switchToBlockType; });
  9973. /* concated harmony reexport getBlockTransforms */__webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return getBlockTransforms; });
  9974. /* concated harmony reexport findTransform */__webpack_require__.d(__webpack_exports__, "findTransform", function() { return findTransform; });
  9975. /* concated harmony reexport getBlockFromExample */__webpack_require__.d(__webpack_exports__, "getBlockFromExample", function() { return factory_getBlockFromExample; });
  9976. /* concated harmony reexport parse */__webpack_require__.d(__webpack_exports__, "parse", function() { return parser; });
  9977. /* concated harmony reexport getBlockAttributes */__webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return getBlockAttributes; });
  9978. /* concated harmony reexport parseWithAttributeSchema */__webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return parseWithAttributeSchema; });
  9979. /* concated harmony reexport pasteHandler */__webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return pasteHandler; });
  9980. /* concated harmony reexport rawHandler */__webpack_require__.d(__webpack_exports__, "rawHandler", function() { return rawHandler; });
  9981. /* concated harmony reexport getPhrasingContentSchema */__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return getPhrasingContentSchema; });
  9982. /* concated harmony reexport serialize */__webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; });
  9983. /* concated harmony reexport getBlockContent */__webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return getBlockContent; });
  9984. /* concated harmony reexport getBlockDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return getBlockDefaultClassName; });
  9985. /* concated harmony reexport getBlockMenuDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return getBlockMenuDefaultClassName; });
  9986. /* concated harmony reexport getSaveElement */__webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return getSaveElement; });
  9987. /* concated harmony reexport getSaveContent */__webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return getSaveContent; });
  9988. /* concated harmony reexport isValidBlockContent */__webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return isValidBlockContent; });
  9989. /* concated harmony reexport getCategories */__webpack_require__.d(__webpack_exports__, "getCategories", function() { return categories_getCategories; });
  9990. /* concated harmony reexport setCategories */__webpack_require__.d(__webpack_exports__, "setCategories", function() { return categories_setCategories; });
  9991. /* concated harmony reexport updateCategory */__webpack_require__.d(__webpack_exports__, "updateCategory", function() { return categories_updateCategory; });
  9992. /* concated harmony reexport registerBlockType */__webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return registerBlockType; });
  9993. /* concated harmony reexport unregisterBlockType */__webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return unregisterBlockType; });
  9994. /* concated harmony reexport setFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return setFreeformContentHandlerName; });
  9995. /* concated harmony reexport getFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return getFreeformContentHandlerName; });
  9996. /* concated harmony reexport setUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return setUnregisteredTypeHandlerName; });
  9997. /* concated harmony reexport getUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return getUnregisteredTypeHandlerName; });
  9998. /* concated harmony reexport setDefaultBlockName */__webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return registration_setDefaultBlockName; });
  9999. /* concated harmony reexport getDefaultBlockName */__webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return registration_getDefaultBlockName; });
  10000. /* concated harmony reexport setGroupingBlockName */__webpack_require__.d(__webpack_exports__, "setGroupingBlockName", function() { return registration_setGroupingBlockName; });
  10001. /* concated harmony reexport getGroupingBlockName */__webpack_require__.d(__webpack_exports__, "getGroupingBlockName", function() { return registration_getGroupingBlockName; });
  10002. /* concated harmony reexport getBlockType */__webpack_require__.d(__webpack_exports__, "getBlockType", function() { return registration_getBlockType; });
  10003. /* concated harmony reexport getBlockTypes */__webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return registration_getBlockTypes; });
  10004. /* concated harmony reexport getBlockSupport */__webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return registration_getBlockSupport; });
  10005. /* concated harmony reexport hasBlockSupport */__webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return registration_hasBlockSupport; });
  10006. /* concated harmony reexport isReusableBlock */__webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return isReusableBlock; });
  10007. /* concated harmony reexport getChildBlockNames */__webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return registration_getChildBlockNames; });
  10008. /* concated harmony reexport hasChildBlocks */__webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return registration_hasChildBlocks; });
  10009. /* concated harmony reexport hasChildBlocksWithInserterSupport */__webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return registration_hasChildBlocksWithInserterSupport; });
  10010. /* concated harmony reexport unstable__bootstrapServerSideBlockDefinitions */__webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return unstable__bootstrapServerSideBlockDefinitions; });
  10011. /* concated harmony reexport registerBlockStyle */__webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return registration_registerBlockStyle; });
  10012. /* concated harmony reexport unregisterBlockStyle */__webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return registration_unregisterBlockStyle; });
  10013. /* concated harmony reexport isUnmodifiedDefaultBlock */__webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return isUnmodifiedDefaultBlock; });
  10014. /* concated harmony reexport normalizeIconObject */__webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return normalizeIconObject; });
  10015. /* concated harmony reexport isValidIcon */__webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return isValidIcon; });
  10016. /* concated harmony reexport doBlocksMatchTemplate */__webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return doBlocksMatchTemplate; });
  10017. /* concated harmony reexport synchronizeBlocksWithTemplate */__webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return synchronizeBlocksWithTemplate; });
  10018. /* concated harmony reexport children */__webpack_require__.d(__webpack_exports__, "children", function() { return api_children; });
  10019. /* concated harmony reexport node */__webpack_require__.d(__webpack_exports__, "node", function() { return api_node; });
  10020. /* concated harmony reexport withBlockContentContext */__webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return withBlockContentContext; });
  10021. // A "block" is the abstract term used to describe units of markup that,
  10022. // when composed together, form the content or layout of a page.
  10023. // The API for blocks is exposed via `wp.blocks`.
  10024. //
  10025. // Supported blocks are registered by calling `registerBlockType`. Once registered,
  10026. // the block is made available as an option to the editor interface.
  10027. //
  10028. // Blocks are inferred from the HTML source of a post through a parsing mechanism
  10029. // and then stored as objects in state, from which it is then rendered for editing.
  10030. /**
  10031. * Internal dependencies
  10032. */
  10033. /***/ }),
  10034. /***/ 35:
  10035. /***/ (function(module, exports) {
  10036. (function() { module.exports = this["wp"]["blob"]; }());
  10037. /***/ }),
  10038. /***/ 36:
  10039. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10040. "use strict";
  10041. var LEAF_KEY, hasWeakMap;
  10042. /**
  10043. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  10044. *
  10045. * @type {Object}
  10046. */
  10047. LEAF_KEY = {};
  10048. /**
  10049. * Whether environment supports WeakMap.
  10050. *
  10051. * @type {boolean}
  10052. */
  10053. hasWeakMap = typeof WeakMap !== 'undefined';
  10054. /**
  10055. * Returns the first argument as the sole entry in an array.
  10056. *
  10057. * @param {*} value Value to return.
  10058. *
  10059. * @return {Array} Value returned as entry in array.
  10060. */
  10061. function arrayOf( value ) {
  10062. return [ value ];
  10063. }
  10064. /**
  10065. * Returns true if the value passed is object-like, or false otherwise. A value
  10066. * is object-like if it can support property assignment, e.g. object or array.
  10067. *
  10068. * @param {*} value Value to test.
  10069. *
  10070. * @return {boolean} Whether value is object-like.
  10071. */
  10072. function isObjectLike( value ) {
  10073. return !! value && 'object' === typeof value;
  10074. }
  10075. /**
  10076. * Creates and returns a new cache object.
  10077. *
  10078. * @return {Object} Cache object.
  10079. */
  10080. function createCache() {
  10081. var cache = {
  10082. clear: function() {
  10083. cache.head = null;
  10084. },
  10085. };
  10086. return cache;
  10087. }
  10088. /**
  10089. * Returns true if entries within the two arrays are strictly equal by
  10090. * reference from a starting index.
  10091. *
  10092. * @param {Array} a First array.
  10093. * @param {Array} b Second array.
  10094. * @param {number} fromIndex Index from which to start comparison.
  10095. *
  10096. * @return {boolean} Whether arrays are shallowly equal.
  10097. */
  10098. function isShallowEqual( a, b, fromIndex ) {
  10099. var i;
  10100. if ( a.length !== b.length ) {
  10101. return false;
  10102. }
  10103. for ( i = fromIndex; i < a.length; i++ ) {
  10104. if ( a[ i ] !== b[ i ] ) {
  10105. return false;
  10106. }
  10107. }
  10108. return true;
  10109. }
  10110. /**
  10111. * Returns a memoized selector function. The getDependants function argument is
  10112. * called before the memoized selector and is expected to return an immutable
  10113. * reference or array of references on which the selector depends for computing
  10114. * its own return value. The memoize cache is preserved only as long as those
  10115. * dependant references remain the same. If getDependants returns a different
  10116. * reference(s), the cache is cleared and the selector value regenerated.
  10117. *
  10118. * @param {Function} selector Selector function.
  10119. * @param {Function} getDependants Dependant getter returning an immutable
  10120. * reference or array of reference used in
  10121. * cache bust consideration.
  10122. *
  10123. * @return {Function} Memoized selector.
  10124. */
  10125. /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
  10126. var rootCache, getCache;
  10127. // Use object source as dependant if getter not provided
  10128. if ( ! getDependants ) {
  10129. getDependants = arrayOf;
  10130. }
  10131. /**
  10132. * Returns the root cache. If WeakMap is supported, this is assigned to the
  10133. * root WeakMap cache set, otherwise it is a shared instance of the default
  10134. * cache object.
  10135. *
  10136. * @return {(WeakMap|Object)} Root cache object.
  10137. */
  10138. function getRootCache() {
  10139. return rootCache;
  10140. }
  10141. /**
  10142. * Returns the cache for a given dependants array. When possible, a WeakMap
  10143. * will be used to create a unique cache for each set of dependants. This
  10144. * is feasible due to the nature of WeakMap in allowing garbage collection
  10145. * to occur on entries where the key object is no longer referenced. Since
  10146. * WeakMap requires the key to be an object, this is only possible when the
  10147. * dependant is object-like. The root cache is created as a hierarchy where
  10148. * each top-level key is the first entry in a dependants set, the value a
  10149. * WeakMap where each key is the next dependant, and so on. This continues
  10150. * so long as the dependants are object-like. If no dependants are object-
  10151. * like, then the cache is shared across all invocations.
  10152. *
  10153. * @see isObjectLike
  10154. *
  10155. * @param {Array} dependants Selector dependants.
  10156. *
  10157. * @return {Object} Cache object.
  10158. */
  10159. function getWeakMapCache( dependants ) {
  10160. var caches = rootCache,
  10161. isUniqueByDependants = true,
  10162. i, dependant, map, cache;
  10163. for ( i = 0; i < dependants.length; i++ ) {
  10164. dependant = dependants[ i ];
  10165. // Can only compose WeakMap from object-like key.
  10166. if ( ! isObjectLike( dependant ) ) {
  10167. isUniqueByDependants = false;
  10168. break;
  10169. }
  10170. // Does current segment of cache already have a WeakMap?
  10171. if ( caches.has( dependant ) ) {
  10172. // Traverse into nested WeakMap.
  10173. caches = caches.get( dependant );
  10174. } else {
  10175. // Create, set, and traverse into a new one.
  10176. map = new WeakMap();
  10177. caches.set( dependant, map );
  10178. caches = map;
  10179. }
  10180. }
  10181. // We use an arbitrary (but consistent) object as key for the last item
  10182. // in the WeakMap to serve as our running cache.
  10183. if ( ! caches.has( LEAF_KEY ) ) {
  10184. cache = createCache();
  10185. cache.isUniqueByDependants = isUniqueByDependants;
  10186. caches.set( LEAF_KEY, cache );
  10187. }
  10188. return caches.get( LEAF_KEY );
  10189. }
  10190. // Assign cache handler by availability of WeakMap
  10191. getCache = hasWeakMap ? getWeakMapCache : getRootCache;
  10192. /**
  10193. * Resets root memoization cache.
  10194. */
  10195. function clear() {
  10196. rootCache = hasWeakMap ? new WeakMap() : createCache();
  10197. }
  10198. // eslint-disable-next-line jsdoc/check-param-names
  10199. /**
  10200. * The augmented selector call, considering first whether dependants have
  10201. * changed before passing it to underlying memoize function.
  10202. *
  10203. * @param {Object} source Source object for derivation.
  10204. * @param {...*} extraArgs Additional arguments to pass to selector.
  10205. *
  10206. * @return {*} Selector result.
  10207. */
  10208. function callSelector( /* source, ...extraArgs */ ) {
  10209. var len = arguments.length,
  10210. cache, node, i, args, dependants;
  10211. // Create copy of arguments (avoid leaking deoptimization).
  10212. args = new Array( len );
  10213. for ( i = 0; i < len; i++ ) {
  10214. args[ i ] = arguments[ i ];
  10215. }
  10216. dependants = getDependants.apply( null, args );
  10217. cache = getCache( dependants );
  10218. // If not guaranteed uniqueness by dependants (primitive type or lack
  10219. // of WeakMap support), shallow compare against last dependants and, if
  10220. // references have changed, destroy cache to recalculate result.
  10221. if ( ! cache.isUniqueByDependants ) {
  10222. if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
  10223. cache.clear();
  10224. }
  10225. cache.lastDependants = dependants;
  10226. }
  10227. node = cache.head;
  10228. while ( node ) {
  10229. // Check whether node arguments match arguments
  10230. if ( ! isShallowEqual( node.args, args, 1 ) ) {
  10231. node = node.next;
  10232. continue;
  10233. }
  10234. // At this point we can assume we've found a match
  10235. // Surface matched node to head if not already
  10236. if ( node !== cache.head ) {
  10237. // Adjust siblings to point to each other.
  10238. node.prev.next = node.next;
  10239. if ( node.next ) {
  10240. node.next.prev = node.prev;
  10241. }
  10242. node.next = cache.head;
  10243. node.prev = null;
  10244. cache.head.prev = node;
  10245. cache.head = node;
  10246. }
  10247. // Return immediately
  10248. return node.val;
  10249. }
  10250. // No cached value found. Continue to insertion phase:
  10251. node = {
  10252. // Generate the result from original function
  10253. val: selector.apply( null, args ),
  10254. };
  10255. // Avoid including the source object in the cache.
  10256. args[ 0 ] = null;
  10257. node.args = args;
  10258. // Don't need to check whether node is already head, since it would
  10259. // have been returned above already if it was
  10260. // Shift existing head down list
  10261. if ( cache.head ) {
  10262. cache.head.prev = node;
  10263. node.next = cache.head;
  10264. }
  10265. cache.head = node;
  10266. return node.val;
  10267. }
  10268. callSelector.getDependants = getDependants;
  10269. callSelector.clear = clear;
  10270. clear();
  10271. return callSelector;
  10272. });
  10273. /***/ }),
  10274. /***/ 38:
  10275. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10276. "use strict";
  10277. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
  10278. function _arrayWithHoles(arr) {
  10279. if (Array.isArray(arr)) return arr;
  10280. }
  10281. /***/ }),
  10282. /***/ 39:
  10283. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10284. "use strict";
  10285. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
  10286. function _nonIterableRest() {
  10287. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  10288. }
  10289. /***/ }),
  10290. /***/ 4:
  10291. /***/ (function(module, exports) {
  10292. (function() { module.exports = this["wp"]["data"]; }());
  10293. /***/ }),
  10294. /***/ 41:
  10295. /***/ (function(module, exports) {
  10296. (function() { module.exports = this["wp"]["isShallowEqual"]; }());
  10297. /***/ }),
  10298. /***/ 48:
  10299. /***/ (function(module, exports, __webpack_require__) {
  10300. var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.1
  10301. // https://github.com/bgrins/TinyColor
  10302. // Brian Grinstead, MIT License
  10303. (function(Math) {
  10304. var trimLeft = /^\s+/,
  10305. trimRight = /\s+$/,
  10306. tinyCounter = 0,
  10307. mathRound = Math.round,
  10308. mathMin = Math.min,
  10309. mathMax = Math.max,
  10310. mathRandom = Math.random;
  10311. function tinycolor (color, opts) {
  10312. color = (color) ? color : '';
  10313. opts = opts || { };
  10314. // If input is already a tinycolor, return itself
  10315. if (color instanceof tinycolor) {
  10316. return color;
  10317. }
  10318. // If we are called as a function, call using new instead
  10319. if (!(this instanceof tinycolor)) {
  10320. return new tinycolor(color, opts);
  10321. }
  10322. var rgb = inputToRGB(color);
  10323. this._originalInput = color,
  10324. this._r = rgb.r,
  10325. this._g = rgb.g,
  10326. this._b = rgb.b,
  10327. this._a = rgb.a,
  10328. this._roundA = mathRound(100*this._a) / 100,
  10329. this._format = opts.format || rgb.format;
  10330. this._gradientType = opts.gradientType;
  10331. // Don't let the range of [0,255] come back in [0,1].
  10332. // Potentially lose a little bit of precision here, but will fix issues where
  10333. // .5 gets interpreted as half of the total, instead of half of 1
  10334. // If it was supposed to be 128, this was already taken care of by `inputToRgb`
  10335. if (this._r < 1) { this._r = mathRound(this._r); }
  10336. if (this._g < 1) { this._g = mathRound(this._g); }
  10337. if (this._b < 1) { this._b = mathRound(this._b); }
  10338. this._ok = rgb.ok;
  10339. this._tc_id = tinyCounter++;
  10340. }
  10341. tinycolor.prototype = {
  10342. isDark: function() {
  10343. return this.getBrightness() < 128;
  10344. },
  10345. isLight: function() {
  10346. return !this.isDark();
  10347. },
  10348. isValid: function() {
  10349. return this._ok;
  10350. },
  10351. getOriginalInput: function() {
  10352. return this._originalInput;
  10353. },
  10354. getFormat: function() {
  10355. return this._format;
  10356. },
  10357. getAlpha: function() {
  10358. return this._a;
  10359. },
  10360. getBrightness: function() {
  10361. //http://www.w3.org/TR/AERT#color-contrast
  10362. var rgb = this.toRgb();
  10363. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
  10364. },
  10365. getLuminance: function() {
  10366. //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
  10367. var rgb = this.toRgb();
  10368. var RsRGB, GsRGB, BsRGB, R, G, B;
  10369. RsRGB = rgb.r/255;
  10370. GsRGB = rgb.g/255;
  10371. BsRGB = rgb.b/255;
  10372. if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
  10373. if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
  10374. if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
  10375. return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
  10376. },
  10377. setAlpha: function(value) {
  10378. this._a = boundAlpha(value);
  10379. this._roundA = mathRound(100*this._a) / 100;
  10380. return this;
  10381. },
  10382. toHsv: function() {
  10383. var hsv = rgbToHsv(this._r, this._g, this._b);
  10384. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
  10385. },
  10386. toHsvString: function() {
  10387. var hsv = rgbToHsv(this._r, this._g, this._b);
  10388. var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
  10389. return (this._a == 1) ?
  10390. "hsv(" + h + ", " + s + "%, " + v + "%)" :
  10391. "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
  10392. },
  10393. toHsl: function() {
  10394. var hsl = rgbToHsl(this._r, this._g, this._b);
  10395. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
  10396. },
  10397. toHslString: function() {
  10398. var hsl = rgbToHsl(this._r, this._g, this._b);
  10399. var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
  10400. return (this._a == 1) ?
  10401. "hsl(" + h + ", " + s + "%, " + l + "%)" :
  10402. "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
  10403. },
  10404. toHex: function(allow3Char) {
  10405. return rgbToHex(this._r, this._g, this._b, allow3Char);
  10406. },
  10407. toHexString: function(allow3Char) {
  10408. return '#' + this.toHex(allow3Char);
  10409. },
  10410. toHex8: function(allow4Char) {
  10411. return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
  10412. },
  10413. toHex8String: function(allow4Char) {
  10414. return '#' + this.toHex8(allow4Char);
  10415. },
  10416. toRgb: function() {
  10417. return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
  10418. },
  10419. toRgbString: function() {
  10420. return (this._a == 1) ?
  10421. "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
  10422. "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
  10423. },
  10424. toPercentageRgb: function() {
  10425. return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
  10426. },
  10427. toPercentageRgbString: function() {
  10428. return (this._a == 1) ?
  10429. "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
  10430. "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
  10431. },
  10432. toName: function() {
  10433. if (this._a === 0) {
  10434. return "transparent";
  10435. }
  10436. if (this._a < 1) {
  10437. return false;
  10438. }
  10439. return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
  10440. },
  10441. toFilter: function(secondColor) {
  10442. var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
  10443. var secondHex8String = hex8String;
  10444. var gradientType = this._gradientType ? "GradientType = 1, " : "";
  10445. if (secondColor) {
  10446. var s = tinycolor(secondColor);
  10447. secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
  10448. }
  10449. return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
  10450. },
  10451. toString: function(format) {
  10452. var formatSet = !!format;
  10453. format = format || this._format;
  10454. var formattedString = false;
  10455. var hasAlpha = this._a < 1 && this._a >= 0;
  10456. var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
  10457. if (needsAlphaFormat) {
  10458. // Special case for "transparent", all other non-alpha formats
  10459. // will return rgba when there is transparency.
  10460. if (format === "name" && this._a === 0) {
  10461. return this.toName();
  10462. }
  10463. return this.toRgbString();
  10464. }
  10465. if (format === "rgb") {
  10466. formattedString = this.toRgbString();
  10467. }
  10468. if (format === "prgb") {
  10469. formattedString = this.toPercentageRgbString();
  10470. }
  10471. if (format === "hex" || format === "hex6") {
  10472. formattedString = this.toHexString();
  10473. }
  10474. if (format === "hex3") {
  10475. formattedString = this.toHexString(true);
  10476. }
  10477. if (format === "hex4") {
  10478. formattedString = this.toHex8String(true);
  10479. }
  10480. if (format === "hex8") {
  10481. formattedString = this.toHex8String();
  10482. }
  10483. if (format === "name") {
  10484. formattedString = this.toName();
  10485. }
  10486. if (format === "hsl") {
  10487. formattedString = this.toHslString();
  10488. }
  10489. if (format === "hsv") {
  10490. formattedString = this.toHsvString();
  10491. }
  10492. return formattedString || this.toHexString();
  10493. },
  10494. clone: function() {
  10495. return tinycolor(this.toString());
  10496. },
  10497. _applyModification: function(fn, args) {
  10498. var color = fn.apply(null, [this].concat([].slice.call(args)));
  10499. this._r = color._r;
  10500. this._g = color._g;
  10501. this._b = color._b;
  10502. this.setAlpha(color._a);
  10503. return this;
  10504. },
  10505. lighten: function() {
  10506. return this._applyModification(lighten, arguments);
  10507. },
  10508. brighten: function() {
  10509. return this._applyModification(brighten, arguments);
  10510. },
  10511. darken: function() {
  10512. return this._applyModification(darken, arguments);
  10513. },
  10514. desaturate: function() {
  10515. return this._applyModification(desaturate, arguments);
  10516. },
  10517. saturate: function() {
  10518. return this._applyModification(saturate, arguments);
  10519. },
  10520. greyscale: function() {
  10521. return this._applyModification(greyscale, arguments);
  10522. },
  10523. spin: function() {
  10524. return this._applyModification(spin, arguments);
  10525. },
  10526. _applyCombination: function(fn, args) {
  10527. return fn.apply(null, [this].concat([].slice.call(args)));
  10528. },
  10529. analogous: function() {
  10530. return this._applyCombination(analogous, arguments);
  10531. },
  10532. complement: function() {
  10533. return this._applyCombination(complement, arguments);
  10534. },
  10535. monochromatic: function() {
  10536. return this._applyCombination(monochromatic, arguments);
  10537. },
  10538. splitcomplement: function() {
  10539. return this._applyCombination(splitcomplement, arguments);
  10540. },
  10541. triad: function() {
  10542. return this._applyCombination(triad, arguments);
  10543. },
  10544. tetrad: function() {
  10545. return this._applyCombination(tetrad, arguments);
  10546. }
  10547. };
  10548. // If input is an object, force 1 into "1.0" to handle ratios properly
  10549. // String input requires "1.0" as input, so 1 will be treated as 1
  10550. tinycolor.fromRatio = function(color, opts) {
  10551. if (typeof color == "object") {
  10552. var newColor = {};
  10553. for (var i in color) {
  10554. if (color.hasOwnProperty(i)) {
  10555. if (i === "a") {
  10556. newColor[i] = color[i];
  10557. }
  10558. else {
  10559. newColor[i] = convertToPercentage(color[i]);
  10560. }
  10561. }
  10562. }
  10563. color = newColor;
  10564. }
  10565. return tinycolor(color, opts);
  10566. };
  10567. // Given a string or object, convert that input to RGB
  10568. // Possible string inputs:
  10569. //
  10570. // "red"
  10571. // "#f00" or "f00"
  10572. // "#ff0000" or "ff0000"
  10573. // "#ff000000" or "ff000000"
  10574. // "rgb 255 0 0" or "rgb (255, 0, 0)"
  10575. // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
  10576. // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
  10577. // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
  10578. // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
  10579. // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
  10580. // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
  10581. //
  10582. function inputToRGB(color) {
  10583. var rgb = { r: 0, g: 0, b: 0 };
  10584. var a = 1;
  10585. var s = null;
  10586. var v = null;
  10587. var l = null;
  10588. var ok = false;
  10589. var format = false;
  10590. if (typeof color == "string") {
  10591. color = stringInputToObject(color);
  10592. }
  10593. if (typeof color == "object") {
  10594. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  10595. rgb = rgbToRgb(color.r, color.g, color.b);
  10596. ok = true;
  10597. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  10598. }
  10599. else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  10600. s = convertToPercentage(color.s);
  10601. v = convertToPercentage(color.v);
  10602. rgb = hsvToRgb(color.h, s, v);
  10603. ok = true;
  10604. format = "hsv";
  10605. }
  10606. else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  10607. s = convertToPercentage(color.s);
  10608. l = convertToPercentage(color.l);
  10609. rgb = hslToRgb(color.h, s, l);
  10610. ok = true;
  10611. format = "hsl";
  10612. }
  10613. if (color.hasOwnProperty("a")) {
  10614. a = color.a;
  10615. }
  10616. }
  10617. a = boundAlpha(a);
  10618. return {
  10619. ok: ok,
  10620. format: color.format || format,
  10621. r: mathMin(255, mathMax(rgb.r, 0)),
  10622. g: mathMin(255, mathMax(rgb.g, 0)),
  10623. b: mathMin(255, mathMax(rgb.b, 0)),
  10624. a: a
  10625. };
  10626. }
  10627. // Conversion Functions
  10628. // --------------------
  10629. // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
  10630. // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
  10631. // `rgbToRgb`
  10632. // Handle bounds / percentage checking to conform to CSS color spec
  10633. // <http://www.w3.org/TR/css3-color/>
  10634. // *Assumes:* r, g, b in [0, 255] or [0, 1]
  10635. // *Returns:* { r, g, b } in [0, 255]
  10636. function rgbToRgb(r, g, b){
  10637. return {
  10638. r: bound01(r, 255) * 255,
  10639. g: bound01(g, 255) * 255,
  10640. b: bound01(b, 255) * 255
  10641. };
  10642. }
  10643. // `rgbToHsl`
  10644. // Converts an RGB color value to HSL.
  10645. // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
  10646. // *Returns:* { h, s, l } in [0,1]
  10647. function rgbToHsl(r, g, b) {
  10648. r = bound01(r, 255);
  10649. g = bound01(g, 255);
  10650. b = bound01(b, 255);
  10651. var max = mathMax(r, g, b), min = mathMin(r, g, b);
  10652. var h, s, l = (max + min) / 2;
  10653. if(max == min) {
  10654. h = s = 0; // achromatic
  10655. }
  10656. else {
  10657. var d = max - min;
  10658. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  10659. switch(max) {
  10660. case r: h = (g - b) / d + (g < b ? 6 : 0); break;
  10661. case g: h = (b - r) / d + 2; break;
  10662. case b: h = (r - g) / d + 4; break;
  10663. }
  10664. h /= 6;
  10665. }
  10666. return { h: h, s: s, l: l };
  10667. }
  10668. // `hslToRgb`
  10669. // Converts an HSL color value to RGB.
  10670. // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
  10671. // *Returns:* { r, g, b } in the set [0, 255]
  10672. function hslToRgb(h, s, l) {
  10673. var r, g, b;
  10674. h = bound01(h, 360);
  10675. s = bound01(s, 100);
  10676. l = bound01(l, 100);
  10677. function hue2rgb(p, q, t) {
  10678. if(t < 0) t += 1;
  10679. if(t > 1) t -= 1;
  10680. if(t < 1/6) return p + (q - p) * 6 * t;
  10681. if(t < 1/2) return q;
  10682. if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
  10683. return p;
  10684. }
  10685. if(s === 0) {
  10686. r = g = b = l; // achromatic
  10687. }
  10688. else {
  10689. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  10690. var p = 2 * l - q;
  10691. r = hue2rgb(p, q, h + 1/3);
  10692. g = hue2rgb(p, q, h);
  10693. b = hue2rgb(p, q, h - 1/3);
  10694. }
  10695. return { r: r * 255, g: g * 255, b: b * 255 };
  10696. }
  10697. // `rgbToHsv`
  10698. // Converts an RGB color value to HSV
  10699. // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
  10700. // *Returns:* { h, s, v } in [0,1]
  10701. function rgbToHsv(r, g, b) {
  10702. r = bound01(r, 255);
  10703. g = bound01(g, 255);
  10704. b = bound01(b, 255);
  10705. var max = mathMax(r, g, b), min = mathMin(r, g, b);
  10706. var h, s, v = max;
  10707. var d = max - min;
  10708. s = max === 0 ? 0 : d / max;
  10709. if(max == min) {
  10710. h = 0; // achromatic
  10711. }
  10712. else {
  10713. switch(max) {
  10714. case r: h = (g - b) / d + (g < b ? 6 : 0); break;
  10715. case g: h = (b - r) / d + 2; break;
  10716. case b: h = (r - g) / d + 4; break;
  10717. }
  10718. h /= 6;
  10719. }
  10720. return { h: h, s: s, v: v };
  10721. }
  10722. // `hsvToRgb`
  10723. // Converts an HSV color value to RGB.
  10724. // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
  10725. // *Returns:* { r, g, b } in the set [0, 255]
  10726. function hsvToRgb(h, s, v) {
  10727. h = bound01(h, 360) * 6;
  10728. s = bound01(s, 100);
  10729. v = bound01(v, 100);
  10730. var i = Math.floor(h),
  10731. f = h - i,
  10732. p = v * (1 - s),
  10733. q = v * (1 - f * s),
  10734. t = v * (1 - (1 - f) * s),
  10735. mod = i % 6,
  10736. r = [v, q, p, p, t, v][mod],
  10737. g = [t, v, v, q, p, p][mod],
  10738. b = [p, p, t, v, v, q][mod];
  10739. return { r: r * 255, g: g * 255, b: b * 255 };
  10740. }
  10741. // `rgbToHex`
  10742. // Converts an RGB color to hex
  10743. // Assumes r, g, and b are contained in the set [0, 255]
  10744. // Returns a 3 or 6 character hex
  10745. function rgbToHex(r, g, b, allow3Char) {
  10746. var hex = [
  10747. pad2(mathRound(r).toString(16)),
  10748. pad2(mathRound(g).toString(16)),
  10749. pad2(mathRound(b).toString(16))
  10750. ];
  10751. // Return a 3 character hex if possible
  10752. if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
  10753. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  10754. }
  10755. return hex.join("");
  10756. }
  10757. // `rgbaToHex`
  10758. // Converts an RGBA color plus alpha transparency to hex
  10759. // Assumes r, g, b are contained in the set [0, 255] and
  10760. // a in [0, 1]. Returns a 4 or 8 character rgba hex
  10761. function rgbaToHex(r, g, b, a, allow4Char) {
  10762. var hex = [
  10763. pad2(mathRound(r).toString(16)),
  10764. pad2(mathRound(g).toString(16)),
  10765. pad2(mathRound(b).toString(16)),
  10766. pad2(convertDecimalToHex(a))
  10767. ];
  10768. // Return a 4 character hex if possible
  10769. if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
  10770. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  10771. }
  10772. return hex.join("");
  10773. }
  10774. // `rgbaToArgbHex`
  10775. // Converts an RGBA color to an ARGB Hex8 string
  10776. // Rarely used, but required for "toFilter()"
  10777. function rgbaToArgbHex(r, g, b, a) {
  10778. var hex = [
  10779. pad2(convertDecimalToHex(a)),
  10780. pad2(mathRound(r).toString(16)),
  10781. pad2(mathRound(g).toString(16)),
  10782. pad2(mathRound(b).toString(16))
  10783. ];
  10784. return hex.join("");
  10785. }
  10786. // `equals`
  10787. // Can be called with any tinycolor input
  10788. tinycolor.equals = function (color1, color2) {
  10789. if (!color1 || !color2) { return false; }
  10790. return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
  10791. };
  10792. tinycolor.random = function() {
  10793. return tinycolor.fromRatio({
  10794. r: mathRandom(),
  10795. g: mathRandom(),
  10796. b: mathRandom()
  10797. });
  10798. };
  10799. // Modification Functions
  10800. // ----------------------
  10801. // Thanks to less.js for some of the basics here
  10802. // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
  10803. function desaturate(color, amount) {
  10804. amount = (amount === 0) ? 0 : (amount || 10);
  10805. var hsl = tinycolor(color).toHsl();
  10806. hsl.s -= amount / 100;
  10807. hsl.s = clamp01(hsl.s);
  10808. return tinycolor(hsl);
  10809. }
  10810. function saturate(color, amount) {
  10811. amount = (amount === 0) ? 0 : (amount || 10);
  10812. var hsl = tinycolor(color).toHsl();
  10813. hsl.s += amount / 100;
  10814. hsl.s = clamp01(hsl.s);
  10815. return tinycolor(hsl);
  10816. }
  10817. function greyscale(color) {
  10818. return tinycolor(color).desaturate(100);
  10819. }
  10820. function lighten (color, amount) {
  10821. amount = (amount === 0) ? 0 : (amount || 10);
  10822. var hsl = tinycolor(color).toHsl();
  10823. hsl.l += amount / 100;
  10824. hsl.l = clamp01(hsl.l);
  10825. return tinycolor(hsl);
  10826. }
  10827. function brighten(color, amount) {
  10828. amount = (amount === 0) ? 0 : (amount || 10);
  10829. var rgb = tinycolor(color).toRgb();
  10830. rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
  10831. rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
  10832. rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
  10833. return tinycolor(rgb);
  10834. }
  10835. function darken (color, amount) {
  10836. amount = (amount === 0) ? 0 : (amount || 10);
  10837. var hsl = tinycolor(color).toHsl();
  10838. hsl.l -= amount / 100;
  10839. hsl.l = clamp01(hsl.l);
  10840. return tinycolor(hsl);
  10841. }
  10842. // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
  10843. // Values outside of this range will be wrapped into this range.
  10844. function spin(color, amount) {
  10845. var hsl = tinycolor(color).toHsl();
  10846. var hue = (hsl.h + amount) % 360;
  10847. hsl.h = hue < 0 ? 360 + hue : hue;
  10848. return tinycolor(hsl);
  10849. }
  10850. // Combination Functions
  10851. // ---------------------
  10852. // Thanks to jQuery xColor for some of the ideas behind these
  10853. // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
  10854. function complement(color) {
  10855. var hsl = tinycolor(color).toHsl();
  10856. hsl.h = (hsl.h + 180) % 360;
  10857. return tinycolor(hsl);
  10858. }
  10859. function triad(color) {
  10860. var hsl = tinycolor(color).toHsl();
  10861. var h = hsl.h;
  10862. return [
  10863. tinycolor(color),
  10864. tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
  10865. tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
  10866. ];
  10867. }
  10868. function tetrad(color) {
  10869. var hsl = tinycolor(color).toHsl();
  10870. var h = hsl.h;
  10871. return [
  10872. tinycolor(color),
  10873. tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
  10874. tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
  10875. tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
  10876. ];
  10877. }
  10878. function splitcomplement(color) {
  10879. var hsl = tinycolor(color).toHsl();
  10880. var h = hsl.h;
  10881. return [
  10882. tinycolor(color),
  10883. tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
  10884. tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
  10885. ];
  10886. }
  10887. function analogous(color, results, slices) {
  10888. results = results || 6;
  10889. slices = slices || 30;
  10890. var hsl = tinycolor(color).toHsl();
  10891. var part = 360 / slices;
  10892. var ret = [tinycolor(color)];
  10893. for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
  10894. hsl.h = (hsl.h + part) % 360;
  10895. ret.push(tinycolor(hsl));
  10896. }
  10897. return ret;
  10898. }
  10899. function monochromatic(color, results) {
  10900. results = results || 6;
  10901. var hsv = tinycolor(color).toHsv();
  10902. var h = hsv.h, s = hsv.s, v = hsv.v;
  10903. var ret = [];
  10904. var modification = 1 / results;
  10905. while (results--) {
  10906. ret.push(tinycolor({ h: h, s: s, v: v}));
  10907. v = (v + modification) % 1;
  10908. }
  10909. return ret;
  10910. }
  10911. // Utility Functions
  10912. // ---------------------
  10913. tinycolor.mix = function(color1, color2, amount) {
  10914. amount = (amount === 0) ? 0 : (amount || 50);
  10915. var rgb1 = tinycolor(color1).toRgb();
  10916. var rgb2 = tinycolor(color2).toRgb();
  10917. var p = amount / 100;
  10918. var rgba = {
  10919. r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
  10920. g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
  10921. b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
  10922. a: ((rgb2.a - rgb1.a) * p) + rgb1.a
  10923. };
  10924. return tinycolor(rgba);
  10925. };
  10926. // Readability Functions
  10927. // ---------------------
  10928. // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
  10929. // `contrast`
  10930. // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
  10931. tinycolor.readability = function(color1, color2) {
  10932. var c1 = tinycolor(color1);
  10933. var c2 = tinycolor(color2);
  10934. return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
  10935. };
  10936. // `isReadable`
  10937. // Ensure that foreground and background color combinations meet WCAG2 guidelines.
  10938. // The third argument is an optional Object.
  10939. // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
  10940. // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
  10941. // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
  10942. // *Example*
  10943. // tinycolor.isReadable("#000", "#111") => false
  10944. // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
  10945. tinycolor.isReadable = function(color1, color2, wcag2) {
  10946. var readability = tinycolor.readability(color1, color2);
  10947. var wcag2Parms, out;
  10948. out = false;
  10949. wcag2Parms = validateWCAG2Parms(wcag2);
  10950. switch (wcag2Parms.level + wcag2Parms.size) {
  10951. case "AAsmall":
  10952. case "AAAlarge":
  10953. out = readability >= 4.5;
  10954. break;
  10955. case "AAlarge":
  10956. out = readability >= 3;
  10957. break;
  10958. case "AAAsmall":
  10959. out = readability >= 7;
  10960. break;
  10961. }
  10962. return out;
  10963. };
  10964. // `mostReadable`
  10965. // Given a base color and a list of possible foreground or background
  10966. // colors for that base, returns the most readable color.
  10967. // Optionally returns Black or White if the most readable color is unreadable.
  10968. // *Example*
  10969. // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
  10970. // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
  10971. // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
  10972. // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
  10973. tinycolor.mostReadable = function(baseColor, colorList, args) {
  10974. var bestColor = null;
  10975. var bestScore = 0;
  10976. var readability;
  10977. var includeFallbackColors, level, size ;
  10978. args = args || {};
  10979. includeFallbackColors = args.includeFallbackColors ;
  10980. level = args.level;
  10981. size = args.size;
  10982. for (var i= 0; i < colorList.length ; i++) {
  10983. readability = tinycolor.readability(baseColor, colorList[i]);
  10984. if (readability > bestScore) {
  10985. bestScore = readability;
  10986. bestColor = tinycolor(colorList[i]);
  10987. }
  10988. }
  10989. if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
  10990. return bestColor;
  10991. }
  10992. else {
  10993. args.includeFallbackColors=false;
  10994. return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
  10995. }
  10996. };
  10997. // Big List of Colors
  10998. // ------------------
  10999. // <http://www.w3.org/TR/css3-color/#svg-color>
  11000. var names = tinycolor.names = {
  11001. aliceblue: "f0f8ff",
  11002. antiquewhite: "faebd7",
  11003. aqua: "0ff",
  11004. aquamarine: "7fffd4",
  11005. azure: "f0ffff",
  11006. beige: "f5f5dc",
  11007. bisque: "ffe4c4",
  11008. black: "000",
  11009. blanchedalmond: "ffebcd",
  11010. blue: "00f",
  11011. blueviolet: "8a2be2",
  11012. brown: "a52a2a",
  11013. burlywood: "deb887",
  11014. burntsienna: "ea7e5d",
  11015. cadetblue: "5f9ea0",
  11016. chartreuse: "7fff00",
  11017. chocolate: "d2691e",
  11018. coral: "ff7f50",
  11019. cornflowerblue: "6495ed",
  11020. cornsilk: "fff8dc",
  11021. crimson: "dc143c",
  11022. cyan: "0ff",
  11023. darkblue: "00008b",
  11024. darkcyan: "008b8b",
  11025. darkgoldenrod: "b8860b",
  11026. darkgray: "a9a9a9",
  11027. darkgreen: "006400",
  11028. darkgrey: "a9a9a9",
  11029. darkkhaki: "bdb76b",
  11030. darkmagenta: "8b008b",
  11031. darkolivegreen: "556b2f",
  11032. darkorange: "ff8c00",
  11033. darkorchid: "9932cc",
  11034. darkred: "8b0000",
  11035. darksalmon: "e9967a",
  11036. darkseagreen: "8fbc8f",
  11037. darkslateblue: "483d8b",
  11038. darkslategray: "2f4f4f",
  11039. darkslategrey: "2f4f4f",
  11040. darkturquoise: "00ced1",
  11041. darkviolet: "9400d3",
  11042. deeppink: "ff1493",
  11043. deepskyblue: "00bfff",
  11044. dimgray: "696969",
  11045. dimgrey: "696969",
  11046. dodgerblue: "1e90ff",
  11047. firebrick: "b22222",
  11048. floralwhite: "fffaf0",
  11049. forestgreen: "228b22",
  11050. fuchsia: "f0f",
  11051. gainsboro: "dcdcdc",
  11052. ghostwhite: "f8f8ff",
  11053. gold: "ffd700",
  11054. goldenrod: "daa520",
  11055. gray: "808080",
  11056. green: "008000",
  11057. greenyellow: "adff2f",
  11058. grey: "808080",
  11059. honeydew: "f0fff0",
  11060. hotpink: "ff69b4",
  11061. indianred: "cd5c5c",
  11062. indigo: "4b0082",
  11063. ivory: "fffff0",
  11064. khaki: "f0e68c",
  11065. lavender: "e6e6fa",
  11066. lavenderblush: "fff0f5",
  11067. lawngreen: "7cfc00",
  11068. lemonchiffon: "fffacd",
  11069. lightblue: "add8e6",
  11070. lightcoral: "f08080",
  11071. lightcyan: "e0ffff",
  11072. lightgoldenrodyellow: "fafad2",
  11073. lightgray: "d3d3d3",
  11074. lightgreen: "90ee90",
  11075. lightgrey: "d3d3d3",
  11076. lightpink: "ffb6c1",
  11077. lightsalmon: "ffa07a",
  11078. lightseagreen: "20b2aa",
  11079. lightskyblue: "87cefa",
  11080. lightslategray: "789",
  11081. lightslategrey: "789",
  11082. lightsteelblue: "b0c4de",
  11083. lightyellow: "ffffe0",
  11084. lime: "0f0",
  11085. limegreen: "32cd32",
  11086. linen: "faf0e6",
  11087. magenta: "f0f",
  11088. maroon: "800000",
  11089. mediumaquamarine: "66cdaa",
  11090. mediumblue: "0000cd",
  11091. mediumorchid: "ba55d3",
  11092. mediumpurple: "9370db",
  11093. mediumseagreen: "3cb371",
  11094. mediumslateblue: "7b68ee",
  11095. mediumspringgreen: "00fa9a",
  11096. mediumturquoise: "48d1cc",
  11097. mediumvioletred: "c71585",
  11098. midnightblue: "191970",
  11099. mintcream: "f5fffa",
  11100. mistyrose: "ffe4e1",
  11101. moccasin: "ffe4b5",
  11102. navajowhite: "ffdead",
  11103. navy: "000080",
  11104. oldlace: "fdf5e6",
  11105. olive: "808000",
  11106. olivedrab: "6b8e23",
  11107. orange: "ffa500",
  11108. orangered: "ff4500",
  11109. orchid: "da70d6",
  11110. palegoldenrod: "eee8aa",
  11111. palegreen: "98fb98",
  11112. paleturquoise: "afeeee",
  11113. palevioletred: "db7093",
  11114. papayawhip: "ffefd5",
  11115. peachpuff: "ffdab9",
  11116. peru: "cd853f",
  11117. pink: "ffc0cb",
  11118. plum: "dda0dd",
  11119. powderblue: "b0e0e6",
  11120. purple: "800080",
  11121. rebeccapurple: "663399",
  11122. red: "f00",
  11123. rosybrown: "bc8f8f",
  11124. royalblue: "4169e1",
  11125. saddlebrown: "8b4513",
  11126. salmon: "fa8072",
  11127. sandybrown: "f4a460",
  11128. seagreen: "2e8b57",
  11129. seashell: "fff5ee",
  11130. sienna: "a0522d",
  11131. silver: "c0c0c0",
  11132. skyblue: "87ceeb",
  11133. slateblue: "6a5acd",
  11134. slategray: "708090",
  11135. slategrey: "708090",
  11136. snow: "fffafa",
  11137. springgreen: "00ff7f",
  11138. steelblue: "4682b4",
  11139. tan: "d2b48c",
  11140. teal: "008080",
  11141. thistle: "d8bfd8",
  11142. tomato: "ff6347",
  11143. turquoise: "40e0d0",
  11144. violet: "ee82ee",
  11145. wheat: "f5deb3",
  11146. white: "fff",
  11147. whitesmoke: "f5f5f5",
  11148. yellow: "ff0",
  11149. yellowgreen: "9acd32"
  11150. };
  11151. // Make it easy to access colors via `hexNames[hex]`
  11152. var hexNames = tinycolor.hexNames = flip(names);
  11153. // Utilities
  11154. // ---------
  11155. // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
  11156. function flip(o) {
  11157. var flipped = { };
  11158. for (var i in o) {
  11159. if (o.hasOwnProperty(i)) {
  11160. flipped[o[i]] = i;
  11161. }
  11162. }
  11163. return flipped;
  11164. }
  11165. // Return a valid alpha value [0,1] with all invalid values being set to 1
  11166. function boundAlpha(a) {
  11167. a = parseFloat(a);
  11168. if (isNaN(a) || a < 0 || a > 1) {
  11169. a = 1;
  11170. }
  11171. return a;
  11172. }
  11173. // Take input from [0, n] and return it as [0, 1]
  11174. function bound01(n, max) {
  11175. if (isOnePointZero(n)) { n = "100%"; }
  11176. var processPercent = isPercentage(n);
  11177. n = mathMin(max, mathMax(0, parseFloat(n)));
  11178. // Automatically convert percentage into number
  11179. if (processPercent) {
  11180. n = parseInt(n * max, 10) / 100;
  11181. }
  11182. // Handle floating point rounding errors
  11183. if ((Math.abs(n - max) < 0.000001)) {
  11184. return 1;
  11185. }
  11186. // Convert into [0, 1] range if it isn't already
  11187. return (n % max) / parseFloat(max);
  11188. }
  11189. // Force a number between 0 and 1
  11190. function clamp01(val) {
  11191. return mathMin(1, mathMax(0, val));
  11192. }
  11193. // Parse a base-16 hex value into a base-10 integer
  11194. function parseIntFromHex(val) {
  11195. return parseInt(val, 16);
  11196. }
  11197. // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
  11198. // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
  11199. function isOnePointZero(n) {
  11200. return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
  11201. }
  11202. // Check to see if string passed in is a percentage
  11203. function isPercentage(n) {
  11204. return typeof n === "string" && n.indexOf('%') != -1;
  11205. }
  11206. // Force a hex value to have 2 characters
  11207. function pad2(c) {
  11208. return c.length == 1 ? '0' + c : '' + c;
  11209. }
  11210. // Replace a decimal with it's percentage value
  11211. function convertToPercentage(n) {
  11212. if (n <= 1) {
  11213. n = (n * 100) + "%";
  11214. }
  11215. return n;
  11216. }
  11217. // Converts a decimal to a hex value
  11218. function convertDecimalToHex(d) {
  11219. return Math.round(parseFloat(d) * 255).toString(16);
  11220. }
  11221. // Converts a hex value to a decimal
  11222. function convertHexToDecimal(h) {
  11223. return (parseIntFromHex(h) / 255);
  11224. }
  11225. var matchers = (function() {
  11226. // <http://www.w3.org/TR/css3-values/#integers>
  11227. var CSS_INTEGER = "[-\\+]?\\d+%?";
  11228. // <http://www.w3.org/TR/css3-values/#number-value>
  11229. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  11230. // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
  11231. var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
  11232. // Actual matching.
  11233. // Parentheses and commas are optional, but not required.
  11234. // Whitespace can take the place of commas or opening paren
  11235. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  11236. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  11237. return {
  11238. CSS_UNIT: new RegExp(CSS_UNIT),
  11239. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  11240. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  11241. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  11242. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  11243. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  11244. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  11245. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  11246. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  11247. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  11248. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  11249. };
  11250. })();
  11251. // `isValidCSSUnit`
  11252. // Take in a single string / number and check to see if it looks like a CSS unit
  11253. // (see `matchers` above for definition).
  11254. function isValidCSSUnit(color) {
  11255. return !!matchers.CSS_UNIT.exec(color);
  11256. }
  11257. // `stringInputToObject`
  11258. // Permissive string parsing. Take in a number of formats, and output an object
  11259. // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
  11260. function stringInputToObject(color) {
  11261. color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
  11262. var named = false;
  11263. if (names[color]) {
  11264. color = names[color];
  11265. named = true;
  11266. }
  11267. else if (color == 'transparent') {
  11268. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  11269. }
  11270. // Try to match string input using regular expressions.
  11271. // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
  11272. // Just return an object and let the conversion functions handle that.
  11273. // This way the result will be the same whether the tinycolor is initialized with string or object.
  11274. var match;
  11275. if ((match = matchers.rgb.exec(color))) {
  11276. return { r: match[1], g: match[2], b: match[3] };
  11277. }
  11278. if ((match = matchers.rgba.exec(color))) {
  11279. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  11280. }
  11281. if ((match = matchers.hsl.exec(color))) {
  11282. return { h: match[1], s: match[2], l: match[3] };
  11283. }
  11284. if ((match = matchers.hsla.exec(color))) {
  11285. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  11286. }
  11287. if ((match = matchers.hsv.exec(color))) {
  11288. return { h: match[1], s: match[2], v: match[3] };
  11289. }
  11290. if ((match = matchers.hsva.exec(color))) {
  11291. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  11292. }
  11293. if ((match = matchers.hex8.exec(color))) {
  11294. return {
  11295. r: parseIntFromHex(match[1]),
  11296. g: parseIntFromHex(match[2]),
  11297. b: parseIntFromHex(match[3]),
  11298. a: convertHexToDecimal(match[4]),
  11299. format: named ? "name" : "hex8"
  11300. };
  11301. }
  11302. if ((match = matchers.hex6.exec(color))) {
  11303. return {
  11304. r: parseIntFromHex(match[1]),
  11305. g: parseIntFromHex(match[2]),
  11306. b: parseIntFromHex(match[3]),
  11307. format: named ? "name" : "hex"
  11308. };
  11309. }
  11310. if ((match = matchers.hex4.exec(color))) {
  11311. return {
  11312. r: parseIntFromHex(match[1] + '' + match[1]),
  11313. g: parseIntFromHex(match[2] + '' + match[2]),
  11314. b: parseIntFromHex(match[3] + '' + match[3]),
  11315. a: convertHexToDecimal(match[4] + '' + match[4]),
  11316. format: named ? "name" : "hex8"
  11317. };
  11318. }
  11319. if ((match = matchers.hex3.exec(color))) {
  11320. return {
  11321. r: parseIntFromHex(match[1] + '' + match[1]),
  11322. g: parseIntFromHex(match[2] + '' + match[2]),
  11323. b: parseIntFromHex(match[3] + '' + match[3]),
  11324. format: named ? "name" : "hex"
  11325. };
  11326. }
  11327. return false;
  11328. }
  11329. function validateWCAG2Parms(parms) {
  11330. // return valid WCAG2 parms for isReadable.
  11331. // If input parms are invalid, return {"level":"AA", "size":"small"}
  11332. var level, size;
  11333. parms = parms || {"level":"AA", "size":"small"};
  11334. level = (parms.level || "AA").toUpperCase();
  11335. size = (parms.size || "small").toLowerCase();
  11336. if (level !== "AA" && level !== "AAA") {
  11337. level = "AA";
  11338. }
  11339. if (size !== "small" && size !== "large") {
  11340. size = "small";
  11341. }
  11342. return {"level":level, "size":size};
  11343. }
  11344. // Node: Export function
  11345. if ( true && module.exports) {
  11346. module.exports = tinycolor;
  11347. }
  11348. // AMD/requirejs: Define the module
  11349. else if (true) {
  11350. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module),
  11351. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  11352. }
  11353. // Browser: Expose to window
  11354. else {}
  11355. })(Math);
  11356. /***/ }),
  11357. /***/ 52:
  11358. /***/ (function(module, exports) {
  11359. (function() { module.exports = this["wp"]["htmlEntities"]; }());
  11360. /***/ }),
  11361. /***/ 67:
  11362. /***/ (function(module, exports, __webpack_require__) {
  11363. var rng = __webpack_require__(85);
  11364. var bytesToUuid = __webpack_require__(86);
  11365. function v4(options, buf, offset) {
  11366. var i = buf && offset || 0;
  11367. if (typeof(options) == 'string') {
  11368. buf = options === 'binary' ? new Array(16) : null;
  11369. options = null;
  11370. }
  11371. options = options || {};
  11372. var rnds = options.random || (options.rng || rng)();
  11373. // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  11374. rnds[6] = (rnds[6] & 0x0f) | 0x40;
  11375. rnds[8] = (rnds[8] & 0x3f) | 0x80;
  11376. // Copy bytes to buffer, if provided
  11377. if (buf) {
  11378. for (var ii = 0; ii < 16; ++ii) {
  11379. buf[i + ii] = rnds[ii];
  11380. }
  11381. }
  11382. return buf || bytesToUuid(rnds);
  11383. }
  11384. module.exports = v4;
  11385. /***/ }),
  11386. /***/ 69:
  11387. /***/ (function(module, exports) {
  11388. (function() { module.exports = this["wp"]["autop"]; }());
  11389. /***/ }),
  11390. /***/ 7:
  11391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11392. "use strict";
  11393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
  11394. /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
  11395. function _objectSpread(target) {
  11396. for (var i = 1; i < arguments.length; i++) {
  11397. var source = arguments[i] != null ? arguments[i] : {};
  11398. var ownKeys = Object.keys(source);
  11399. if (typeof Object.getOwnPropertySymbols === 'function') {
  11400. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  11401. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  11402. }));
  11403. }
  11404. ownKeys.forEach(function (key) {
  11405. Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
  11406. });
  11407. }
  11408. return target;
  11409. }
  11410. /***/ }),
  11411. /***/ 8:
  11412. /***/ (function(module, exports) {
  11413. (function() { module.exports = this["wp"]["compose"]; }());
  11414. /***/ }),
  11415. /***/ 85:
  11416. /***/ (function(module, exports) {
  11417. // Unique ID creation requires a high quality random # generator. In the
  11418. // browser this is a little complicated due to unknown quality of Math.random()
  11419. // and inconsistent support for the `crypto` API. We do the best we can via
  11420. // feature-detection
  11421. // getRandomValues needs to be invoked in a context where "this" is a Crypto
  11422. // implementation. Also, find the complete implementation of crypto on IE11.
  11423. var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
  11424. (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
  11425. if (getRandomValues) {
  11426. // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
  11427. var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
  11428. module.exports = function whatwgRNG() {
  11429. getRandomValues(rnds8);
  11430. return rnds8;
  11431. };
  11432. } else {
  11433. // Math.random()-based (RNG)
  11434. //
  11435. // If all else fails, use Math.random(). It's fast, but is of unspecified
  11436. // quality.
  11437. var rnds = new Array(16);
  11438. module.exports = function mathRNG() {
  11439. for (var i = 0, r; i < 16; i++) {
  11440. if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
  11441. rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
  11442. }
  11443. return rnds;
  11444. };
  11445. }
  11446. /***/ }),
  11447. /***/ 86:
  11448. /***/ (function(module, exports) {
  11449. /**
  11450. * Convert array of 16 byte values to UUID string format of the form:
  11451. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  11452. */
  11453. var byteToHex = [];
  11454. for (var i = 0; i < 256; ++i) {
  11455. byteToHex[i] = (i + 0x100).toString(16).substr(1);
  11456. }
  11457. function bytesToUuid(buf, offset) {
  11458. var i = offset || 0;
  11459. var bth = byteToHex;
  11460. // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  11461. return ([bth[buf[i++]], bth[buf[i++]],
  11462. bth[buf[i++]], bth[buf[i++]], '-',
  11463. bth[buf[i++]], bth[buf[i++]], '-',
  11464. bth[buf[i++]], bth[buf[i++]], '-',
  11465. bth[buf[i++]], bth[buf[i++]], '-',
  11466. bth[buf[i++]], bth[buf[i++]],
  11467. bth[buf[i++]], bth[buf[i++]],
  11468. bth[buf[i++]], bth[buf[i++]]]).join('');
  11469. }
  11470. module.exports = bytesToUuid;
  11471. /***/ })
  11472. /******/ });