parser-postcss.js 892 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["postcss"] = factory();
  8. else
  9. root["prettierPlugins"] = root["prettierPlugins"] || {}, root["prettierPlugins"]["postcss"] = factory();
  10. })(typeof self !== 'undefined' ? self : this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, {
  50. /******/ configurable: false,
  51. /******/ enumerable: true,
  52. /******/ get: getter
  53. /******/ });
  54. /******/ }
  55. /******/ };
  56. /******/
  57. /******/ // getDefaultExport function for compatibility with non-harmony modules
  58. /******/ __webpack_require__.n = function(module) {
  59. /******/ var getter = module && module.__esModule ?
  60. /******/ function getDefault() { return module['default']; } :
  61. /******/ function getModuleExports() { return module; };
  62. /******/ __webpack_require__.d(getter, 'a', getter);
  63. /******/ return getter;
  64. /******/ };
  65. /******/
  66. /******/ // Object.prototype.hasOwnProperty.call
  67. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  68. /******/
  69. /******/ // __webpack_public_path__
  70. /******/ __webpack_require__.p = "";
  71. /******/
  72. /******/ // Load entry module and return exports
  73. /******/ return __webpack_require__(__webpack_require__.s = 87);
  74. /******/ })
  75. /************************************************************************/
  76. /******/ ([
  77. /* 0 */
  78. /***/ (function(module, exports, __webpack_require__) {
  79. "use strict";
  80. exports.__esModule = true;
  81. var TAG = exports.TAG = 'tag';
  82. var STRING = exports.STRING = 'string';
  83. var SELECTOR = exports.SELECTOR = 'selector';
  84. var ROOT = exports.ROOT = 'root';
  85. var PSEUDO = exports.PSEUDO = 'pseudo';
  86. var NESTING = exports.NESTING = 'nesting';
  87. var ID = exports.ID = 'id';
  88. var COMMENT = exports.COMMENT = 'comment';
  89. var COMBINATOR = exports.COMBINATOR = 'combinator';
  90. var CLASS = exports.CLASS = 'class';
  91. var ATTRIBUTE = exports.ATTRIBUTE = 'attribute';
  92. var UNIVERSAL = exports.UNIVERSAL = 'universal';
  93. /***/ }),
  94. /* 1 */
  95. /***/ (function(module, exports, __webpack_require__) {
  96. "use strict";
  97. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  98. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  99. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  100. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  101. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  102. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  103. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  104. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  105. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  106. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  107. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  108. var Node = __webpack_require__(3);
  109. var Container =
  110. /*#__PURE__*/
  111. function (_Node) {
  112. _inherits(Container, _Node);
  113. function Container(opts) {
  114. var _this;
  115. _classCallCheck(this, Container);
  116. _this = _possibleConstructorReturn(this, _getPrototypeOf(Container).call(this, opts));
  117. if (!_this.nodes) {
  118. _this.nodes = [];
  119. }
  120. return _this;
  121. }
  122. _createClass(Container, [{
  123. key: "push",
  124. value: function push(child) {
  125. child.parent = this;
  126. this.nodes.push(child);
  127. return this;
  128. }
  129. }, {
  130. key: "each",
  131. value: function each(callback) {
  132. if (!this.lastEach) this.lastEach = 0;
  133. if (!this.indexes) this.indexes = {};
  134. this.lastEach += 1;
  135. var id = this.lastEach,
  136. index,
  137. result;
  138. this.indexes[id] = 0;
  139. if (!this.nodes) return undefined;
  140. while (this.indexes[id] < this.nodes.length) {
  141. index = this.indexes[id];
  142. result = callback(this.nodes[index], index);
  143. if (result === false) break;
  144. this.indexes[id] += 1;
  145. }
  146. delete this.indexes[id];
  147. return result;
  148. }
  149. }, {
  150. key: "walk",
  151. value: function walk(callback) {
  152. return this.each(function (child, i) {
  153. var result = callback(child, i);
  154. if (result !== false && child.walk) {
  155. result = child.walk(callback);
  156. }
  157. return result;
  158. });
  159. }
  160. }, {
  161. key: "walkType",
  162. value: function walkType(type, callback) {
  163. var _this2 = this;
  164. if (!type || !callback) {
  165. throw new Error('Parameters {type} and {callback} are required.');
  166. } // allow users to pass a constructor, or node type string; eg. Word.
  167. type = type.name && type.prototype ? type.name : type;
  168. return this.walk(function (node, index) {
  169. if (node.type === type) {
  170. return callback.call(_this2, node, index);
  171. }
  172. });
  173. }
  174. }, {
  175. key: "append",
  176. value: function append(node) {
  177. node.parent = this;
  178. this.nodes.push(node);
  179. return this;
  180. }
  181. }, {
  182. key: "prepend",
  183. value: function prepend(node) {
  184. node.parent = this;
  185. this.nodes.unshift(node);
  186. return this;
  187. }
  188. }, {
  189. key: "cleanRaws",
  190. value: function cleanRaws(keepBetween) {
  191. _get(_getPrototypeOf(Container.prototype), "cleanRaws", this).call(this, keepBetween);
  192. if (this.nodes) {
  193. var _iteratorNormalCompletion = true;
  194. var _didIteratorError = false;
  195. var _iteratorError = undefined;
  196. try {
  197. for (var _iterator = this.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  198. var node = _step.value;
  199. node.cleanRaws(keepBetween);
  200. }
  201. } catch (err) {
  202. _didIteratorError = true;
  203. _iteratorError = err;
  204. } finally {
  205. try {
  206. if (!_iteratorNormalCompletion && _iterator.return != null) {
  207. _iterator.return();
  208. }
  209. } finally {
  210. if (_didIteratorError) {
  211. throw _iteratorError;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }, {
  218. key: "insertAfter",
  219. value: function insertAfter(oldNode, newNode) {
  220. var oldIndex = this.index(oldNode),
  221. index;
  222. this.nodes.splice(oldIndex + 1, 0, newNode);
  223. for (var id in this.indexes) {
  224. index = this.indexes[id];
  225. if (oldIndex <= index) {
  226. this.indexes[id] = index + this.nodes.length;
  227. }
  228. }
  229. return this;
  230. }
  231. }, {
  232. key: "insertBefore",
  233. value: function insertBefore(oldNode, newNode) {
  234. var oldIndex = this.index(oldNode),
  235. index;
  236. this.nodes.splice(oldIndex, 0, newNode);
  237. for (var id in this.indexes) {
  238. index = this.indexes[id];
  239. if (oldIndex <= index) {
  240. this.indexes[id] = index + this.nodes.length;
  241. }
  242. }
  243. return this;
  244. }
  245. }, {
  246. key: "removeChild",
  247. value: function removeChild(child) {
  248. child = this.index(child);
  249. this.nodes[child].parent = undefined;
  250. this.nodes.splice(child, 1);
  251. var index;
  252. for (var id in this.indexes) {
  253. index = this.indexes[id];
  254. if (index >= child) {
  255. this.indexes[id] = index - 1;
  256. }
  257. }
  258. return this;
  259. }
  260. }, {
  261. key: "removeAll",
  262. value: function removeAll() {
  263. var _iteratorNormalCompletion2 = true;
  264. var _didIteratorError2 = false;
  265. var _iteratorError2 = undefined;
  266. try {
  267. for (var _iterator2 = this.nodes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  268. var node = _step2.value;
  269. node.parent = undefined;
  270. }
  271. } catch (err) {
  272. _didIteratorError2 = true;
  273. _iteratorError2 = err;
  274. } finally {
  275. try {
  276. if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
  277. _iterator2.return();
  278. }
  279. } finally {
  280. if (_didIteratorError2) {
  281. throw _iteratorError2;
  282. }
  283. }
  284. }
  285. this.nodes = [];
  286. return this;
  287. }
  288. }, {
  289. key: "every",
  290. value: function every(condition) {
  291. return this.nodes.every(condition);
  292. }
  293. }, {
  294. key: "some",
  295. value: function some(condition) {
  296. return this.nodes.some(condition);
  297. }
  298. }, {
  299. key: "index",
  300. value: function index(child) {
  301. if (typeof child === 'number') {
  302. return child;
  303. } else {
  304. return this.nodes.indexOf(child);
  305. }
  306. }
  307. }, {
  308. key: "toString",
  309. value: function toString() {
  310. var result = this.nodes.map(String).join('');
  311. if (this.value) {
  312. result = this.value + result;
  313. }
  314. if (this.raws.before) {
  315. result = this.raws.before + result;
  316. }
  317. if (this.raws.after) {
  318. result += this.raws.after;
  319. }
  320. return result;
  321. }
  322. }, {
  323. key: "first",
  324. get: function get() {
  325. if (!this.nodes) return undefined;
  326. return this.nodes[0];
  327. }
  328. }, {
  329. key: "last",
  330. get: function get() {
  331. if (!this.nodes) return undefined;
  332. return this.nodes[this.nodes.length - 1];
  333. }
  334. }]);
  335. return Container;
  336. }(Node);
  337. Container.registerWalker = function (constructor) {
  338. var walkerName = 'walk' + constructor.name; // plural sugar
  339. if (walkerName.lastIndexOf('s') !== walkerName.length - 1) {
  340. walkerName += 's';
  341. }
  342. if (Container.prototype[walkerName]) {
  343. return;
  344. } // we need access to `this` so we can't use an arrow function
  345. Container.prototype[walkerName] = function (callback) {
  346. return this.walkType(constructor, callback);
  347. };
  348. };
  349. module.exports = Container;
  350. /***/ }),
  351. /* 2 */
  352. /***/ (function(module, exports, __webpack_require__) {
  353. "use strict";
  354. Object.defineProperty(exports, "__esModule", {
  355. value: true
  356. });
  357. var singleQuote = exports.singleQuote = '\''.charCodeAt(0);
  358. var doubleQuote = exports.doubleQuote = '"'.charCodeAt(0);
  359. var backslash = exports.backslash = '\\'.charCodeAt(0);
  360. var backTick = exports.backTick = '`'.charCodeAt(0);
  361. var slash = exports.slash = '/'.charCodeAt(0);
  362. var newline = exports.newline = '\n'.charCodeAt(0);
  363. var space = exports.space = ' '.charCodeAt(0);
  364. var feed = exports.feed = '\f'.charCodeAt(0);
  365. var tab = exports.tab = '\t'.charCodeAt(0);
  366. var carriageReturn = exports.carriageReturn = '\r'.charCodeAt(0);
  367. var openedParenthesis = exports.openedParenthesis = '('.charCodeAt(0);
  368. var closedParenthesis = exports.closedParenthesis = ')'.charCodeAt(0);
  369. var openedCurlyBracket = exports.openedCurlyBracket = '{'.charCodeAt(0);
  370. var closedCurlyBracket = exports.closedCurlyBracket = '}'.charCodeAt(0);
  371. var openSquareBracket = exports.openSquareBracket = '['.charCodeAt(0);
  372. var closeSquareBracket = exports.closeSquareBracket = ']'.charCodeAt(0);
  373. var semicolon = exports.semicolon = ';'.charCodeAt(0);
  374. var asterisk = exports.asterisk = '*'.charCodeAt(0);
  375. var colon = exports.colon = ':'.charCodeAt(0);
  376. var comma = exports.comma = ','.charCodeAt(0);
  377. var dot = exports.dot = '.'.charCodeAt(0);
  378. var atRule = exports.atRule = '@'.charCodeAt(0);
  379. var tilde = exports.tilde = '~'.charCodeAt(0);
  380. var hash = exports.hash = '#'.charCodeAt(0);
  381. var atEndPattern = exports.atEndPattern = /[ \n\t\r\f\{\(\)'"\\;/\[\]#]/g;
  382. var wordEndPattern = exports.wordEndPattern = /[ \n\t\r\f\(\)\{\}:,;@!'"\\\]\[#]|\/(?=\*)/g;
  383. var badBracketPattern = exports.badBracketPattern = /.[\\\/\("'\n]/;
  384. var variablePattern = exports.variablePattern = /^@[^:\(\{]+:/;
  385. var hashColorPattern = exports.hashColorPattern = /^#[0-9a-fA-F]{6}$|^#[0-9a-fA-F]{3}$/;
  386. /***/ }),
  387. /* 3 */
  388. /***/ (function(module, exports, __webpack_require__) {
  389. "use strict";
  390. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  391. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  392. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  393. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  394. var cloneNode = function cloneNode(obj, parent) {
  395. var cloned = new obj.constructor();
  396. for (var i in obj) {
  397. if (!obj.hasOwnProperty(i)) continue;
  398. var value = obj[i],
  399. type = _typeof(value);
  400. if (i === 'parent' && type === 'object') {
  401. if (parent) cloned[i] = parent;
  402. } else if (i === 'source') {
  403. cloned[i] = value;
  404. } else if (value instanceof Array) {
  405. cloned[i] = value.map(function (j) {
  406. return cloneNode(j, cloned);
  407. });
  408. } else if (i !== 'before' && i !== 'after' && i !== 'between' && i !== 'semicolon') {
  409. if (type === 'object' && value !== null) value = cloneNode(value);
  410. cloned[i] = value;
  411. }
  412. }
  413. return cloned;
  414. };
  415. module.exports =
  416. /*#__PURE__*/
  417. function () {
  418. function Node(defaults) {
  419. _classCallCheck(this, Node);
  420. defaults = defaults || {};
  421. this.raws = {
  422. before: '',
  423. after: ''
  424. };
  425. for (var name in defaults) {
  426. this[name] = defaults[name];
  427. }
  428. }
  429. _createClass(Node, [{
  430. key: "remove",
  431. value: function remove() {
  432. if (this.parent) {
  433. this.parent.removeChild(this);
  434. }
  435. this.parent = undefined;
  436. return this;
  437. }
  438. }, {
  439. key: "toString",
  440. value: function toString() {
  441. return [this.raws.before, String(this.value), this.raws.after].join('');
  442. }
  443. }, {
  444. key: "clone",
  445. value: function clone(overrides) {
  446. overrides = overrides || {};
  447. var cloned = cloneNode(this);
  448. for (var name in overrides) {
  449. cloned[name] = overrides[name];
  450. }
  451. return cloned;
  452. }
  453. }, {
  454. key: "cloneBefore",
  455. value: function cloneBefore(overrides) {
  456. overrides = overrides || {};
  457. var cloned = this.clone(overrides);
  458. this.parent.insertBefore(this, cloned);
  459. return cloned;
  460. }
  461. }, {
  462. key: "cloneAfter",
  463. value: function cloneAfter(overrides) {
  464. overrides = overrides || {};
  465. var cloned = this.clone(overrides);
  466. this.parent.insertAfter(this, cloned);
  467. return cloned;
  468. }
  469. }, {
  470. key: "replaceWith",
  471. value: function replaceWith() {
  472. var nodes = Array.prototype.slice.call(arguments);
  473. if (this.parent) {
  474. var _iteratorNormalCompletion = true;
  475. var _didIteratorError = false;
  476. var _iteratorError = undefined;
  477. try {
  478. for (var _iterator = nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  479. var node = _step.value;
  480. this.parent.insertBefore(this, node);
  481. }
  482. } catch (err) {
  483. _didIteratorError = true;
  484. _iteratorError = err;
  485. } finally {
  486. try {
  487. if (!_iteratorNormalCompletion && _iterator.return != null) {
  488. _iterator.return();
  489. }
  490. } finally {
  491. if (_didIteratorError) {
  492. throw _iteratorError;
  493. }
  494. }
  495. }
  496. this.remove();
  497. }
  498. return this;
  499. }
  500. }, {
  501. key: "moveTo",
  502. value: function moveTo(container) {
  503. this.cleanRaws(this.root() === container.root());
  504. this.remove();
  505. container.append(this);
  506. return this;
  507. }
  508. }, {
  509. key: "moveBefore",
  510. value: function moveBefore(node) {
  511. this.cleanRaws(this.root() === node.root());
  512. this.remove();
  513. node.parent.insertBefore(node, this);
  514. return this;
  515. }
  516. }, {
  517. key: "moveAfter",
  518. value: function moveAfter(node) {
  519. this.cleanRaws(this.root() === node.root());
  520. this.remove();
  521. node.parent.insertAfter(node, this);
  522. return this;
  523. }
  524. }, {
  525. key: "next",
  526. value: function next() {
  527. var index = this.parent.index(this);
  528. return this.parent.nodes[index + 1];
  529. }
  530. }, {
  531. key: "prev",
  532. value: function prev() {
  533. var index = this.parent.index(this);
  534. return this.parent.nodes[index - 1];
  535. }
  536. }, {
  537. key: "toJSON",
  538. value: function toJSON() {
  539. var fixed = {};
  540. for (var name in this) {
  541. if (!this.hasOwnProperty(name)) continue;
  542. if (name === 'parent') continue;
  543. var value = this[name];
  544. if (value instanceof Array) {
  545. fixed[name] = value.map(function (i) {
  546. if (_typeof(i) === 'object' && i.toJSON) {
  547. return i.toJSON();
  548. } else {
  549. return i;
  550. }
  551. });
  552. } else if (_typeof(value) === 'object' && value.toJSON) {
  553. fixed[name] = value.toJSON();
  554. } else {
  555. fixed[name] = value;
  556. }
  557. }
  558. return fixed;
  559. }
  560. }, {
  561. key: "root",
  562. value: function root() {
  563. var result = this;
  564. while (result.parent) {
  565. result = result.parent;
  566. }
  567. return result;
  568. }
  569. }, {
  570. key: "cleanRaws",
  571. value: function cleanRaws(keepBetween) {
  572. delete this.raws.before;
  573. delete this.raws.after;
  574. if (!keepBetween) delete this.raws.between;
  575. }
  576. }, {
  577. key: "positionInside",
  578. value: function positionInside(index) {
  579. var string = this.toString(),
  580. column = this.source.start.column,
  581. line = this.source.start.line;
  582. for (var i = 0; i < index; i++) {
  583. if (string[i] === '\n') {
  584. column = 1;
  585. line += 1;
  586. } else {
  587. column += 1;
  588. }
  589. }
  590. return {
  591. line: line,
  592. column: column
  593. };
  594. }
  595. }, {
  596. key: "positionBy",
  597. value: function positionBy(opts) {
  598. var pos = this.source.start;
  599. if (opts.index) {
  600. pos = this.positionInside(opts.index);
  601. } else if (opts.word) {
  602. var index = this.toString().indexOf(opts.word);
  603. if (index !== -1) pos = this.positionInside(index);
  604. }
  605. return pos;
  606. }
  607. }]);
  608. return Node;
  609. }();
  610. /***/ }),
  611. /* 4 */
  612. /***/ (function(module, exports, __webpack_require__) {
  613. "use strict";
  614. exports.__esModule = true;
  615. exports.default = warnOnce;
  616. var printed = {};
  617. function warnOnce(message) {
  618. if (printed[message]) return;
  619. printed[message] = true;
  620. if (typeof console !== 'undefined' && console.warn) console.warn(message);
  621. }
  622. module.exports = exports['default'];
  623. /***/ }),
  624. /* 5 */
  625. /***/ (function(module, exports, __webpack_require__) {
  626. "use strict";
  627. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  628. exports.__esModule = true;
  629. var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  630. return _typeof2(obj);
  631. } : function (obj) {
  632. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  633. };
  634. function _classCallCheck(instance, Constructor) {
  635. if (!(instance instanceof Constructor)) {
  636. throw new TypeError("Cannot call a class as a function");
  637. }
  638. }
  639. var cloneNode = function cloneNode(obj, parent) {
  640. if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') {
  641. return obj;
  642. }
  643. var cloned = new obj.constructor();
  644. for (var i in obj) {
  645. if (!obj.hasOwnProperty(i)) {
  646. continue;
  647. }
  648. var value = obj[i];
  649. var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
  650. if (i === 'parent' && type === 'object') {
  651. if (parent) {
  652. cloned[i] = parent;
  653. }
  654. } else if (value instanceof Array) {
  655. cloned[i] = value.map(function (j) {
  656. return cloneNode(j, cloned);
  657. });
  658. } else {
  659. cloned[i] = cloneNode(value, cloned);
  660. }
  661. }
  662. return cloned;
  663. };
  664. var _class = function () {
  665. function _class() {
  666. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  667. _classCallCheck(this, _class);
  668. for (var key in opts) {
  669. this[key] = opts[key];
  670. }
  671. var _opts$spaces = opts.spaces;
  672. _opts$spaces = _opts$spaces === undefined ? {} : _opts$spaces;
  673. var _opts$spaces$before = _opts$spaces.before,
  674. before = _opts$spaces$before === undefined ? '' : _opts$spaces$before,
  675. _opts$spaces$after = _opts$spaces.after,
  676. after = _opts$spaces$after === undefined ? '' : _opts$spaces$after;
  677. this.spaces = {
  678. before: before,
  679. after: after
  680. };
  681. }
  682. _class.prototype.remove = function remove() {
  683. if (this.parent) {
  684. this.parent.removeChild(this);
  685. }
  686. this.parent = undefined;
  687. return this;
  688. };
  689. _class.prototype.replaceWith = function replaceWith() {
  690. if (this.parent) {
  691. for (var index in arguments) {
  692. this.parent.insertBefore(this, arguments[index]);
  693. }
  694. this.remove();
  695. }
  696. return this;
  697. };
  698. _class.prototype.next = function next() {
  699. return this.parent.at(this.parent.index(this) + 1);
  700. };
  701. _class.prototype.prev = function prev() {
  702. return this.parent.at(this.parent.index(this) - 1);
  703. };
  704. _class.prototype.clone = function clone() {
  705. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  706. var cloned = cloneNode(this);
  707. for (var name in overrides) {
  708. cloned[name] = overrides[name];
  709. }
  710. return cloned;
  711. };
  712. _class.prototype.toString = function toString() {
  713. return [this.spaces.before, String(this.value), this.spaces.after].join('');
  714. };
  715. return _class;
  716. }();
  717. exports.default = _class;
  718. module.exports = exports['default'];
  719. /***/ }),
  720. /* 6 */
  721. /***/ (function(module, exports, __webpack_require__) {
  722. /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
  723. //
  724. // Permission is hereby granted, free of charge, to any person obtaining a
  725. // copy of this software and associated documentation files (the
  726. // "Software"), to deal in the Software without restriction, including
  727. // without limitation the rights to use, copy, modify, merge, publish,
  728. // distribute, sublicense, and/or sell copies of the Software, and to permit
  729. // persons to whom the Software is furnished to do so, subject to the
  730. // following conditions:
  731. //
  732. // The above copyright notice and this permission notice shall be included
  733. // in all copies or substantial portions of the Software.
  734. //
  735. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  736. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  737. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  738. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  739. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  740. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  741. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  742. // resolves . and .. elements in a path array with directory names there
  743. // must be no slashes, empty elements, or device names (c:\) in the array
  744. // (so also no leading and trailing slashes - it does not distinguish
  745. // relative and absolute paths)
  746. function normalizeArray(parts, allowAboveRoot) {
  747. // if the path tries to go above the root, `up` ends up > 0
  748. var up = 0;
  749. for (var i = parts.length - 1; i >= 0; i--) {
  750. var last = parts[i];
  751. if (last === '.') {
  752. parts.splice(i, 1);
  753. } else if (last === '..') {
  754. parts.splice(i, 1);
  755. up++;
  756. } else if (up) {
  757. parts.splice(i, 1);
  758. up--;
  759. }
  760. } // if the path is allowed to go above the root, restore leading ..s
  761. if (allowAboveRoot) {
  762. for (; up--; up) {
  763. parts.unshift('..');
  764. }
  765. }
  766. return parts;
  767. } // Split a filename into [root, dir, basename, ext], unix version
  768. // 'root' is just a slash, or nothing.
  769. var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  770. var splitPath = function splitPath(filename) {
  771. return splitPathRe.exec(filename).slice(1);
  772. }; // path.resolve([from ...], to)
  773. // posix version
  774. exports.resolve = function () {
  775. var resolvedPath = '',
  776. resolvedAbsolute = false;
  777. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  778. var path = i >= 0 ? arguments[i] : process.cwd(); // Skip empty and invalid entries
  779. if (typeof path !== 'string') {
  780. throw new TypeError('Arguments to path.resolve must be strings');
  781. } else if (!path) {
  782. continue;
  783. }
  784. resolvedPath = path + '/' + resolvedPath;
  785. resolvedAbsolute = path.charAt(0) === '/';
  786. } // At this point the path should be resolved to a full absolute path, but
  787. // handle relative paths to be safe (might happen when process.cwd() fails)
  788. // Normalize the path
  789. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
  790. return !!p;
  791. }), !resolvedAbsolute).join('/');
  792. return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
  793. }; // path.normalize(path)
  794. // posix version
  795. exports.normalize = function (path) {
  796. var isAbsolute = exports.isAbsolute(path),
  797. trailingSlash = substr(path, -1) === '/'; // Normalize the path
  798. path = normalizeArray(filter(path.split('/'), function (p) {
  799. return !!p;
  800. }), !isAbsolute).join('/');
  801. if (!path && !isAbsolute) {
  802. path = '.';
  803. }
  804. if (path && trailingSlash) {
  805. path += '/';
  806. }
  807. return (isAbsolute ? '/' : '') + path;
  808. }; // posix version
  809. exports.isAbsolute = function (path) {
  810. return path.charAt(0) === '/';
  811. }; // posix version
  812. exports.join = function () {
  813. var paths = Array.prototype.slice.call(arguments, 0);
  814. return exports.normalize(filter(paths, function (p, index) {
  815. if (typeof p !== 'string') {
  816. throw new TypeError('Arguments to path.join must be strings');
  817. }
  818. return p;
  819. }).join('/'));
  820. }; // path.relative(from, to)
  821. // posix version
  822. exports.relative = function (from, to) {
  823. from = exports.resolve(from).substr(1);
  824. to = exports.resolve(to).substr(1);
  825. function trim(arr) {
  826. var start = 0;
  827. for (; start < arr.length; start++) {
  828. if (arr[start] !== '') break;
  829. }
  830. var end = arr.length - 1;
  831. for (; end >= 0; end--) {
  832. if (arr[end] !== '') break;
  833. }
  834. if (start > end) return [];
  835. return arr.slice(start, end - start + 1);
  836. }
  837. var fromParts = trim(from.split('/'));
  838. var toParts = trim(to.split('/'));
  839. var length = Math.min(fromParts.length, toParts.length);
  840. var samePartsLength = length;
  841. for (var i = 0; i < length; i++) {
  842. if (fromParts[i] !== toParts[i]) {
  843. samePartsLength = i;
  844. break;
  845. }
  846. }
  847. var outputParts = [];
  848. for (var i = samePartsLength; i < fromParts.length; i++) {
  849. outputParts.push('..');
  850. }
  851. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  852. return outputParts.join('/');
  853. };
  854. exports.sep = '/';
  855. exports.delimiter = ':';
  856. exports.dirname = function (path) {
  857. var result = splitPath(path),
  858. root = result[0],
  859. dir = result[1];
  860. if (!root && !dir) {
  861. // No dirname whatsoever
  862. return '.';
  863. }
  864. if (dir) {
  865. // It has a dirname, strip trailing slash
  866. dir = dir.substr(0, dir.length - 1);
  867. }
  868. return root + dir;
  869. };
  870. exports.basename = function (path, ext) {
  871. var f = splitPath(path)[2]; // TODO: make this comparison case-insensitive on windows?
  872. if (ext && f.substr(-1 * ext.length) === ext) {
  873. f = f.substr(0, f.length - ext.length);
  874. }
  875. return f;
  876. };
  877. exports.extname = function (path) {
  878. return splitPath(path)[3];
  879. };
  880. function filter(xs, f) {
  881. if (xs.filter) return xs.filter(f);
  882. var res = [];
  883. for (var i = 0; i < xs.length; i++) {
  884. if (f(xs[i], i, xs)) res.push(xs[i]);
  885. }
  886. return res;
  887. } // String.prototype.substr - negative index don't work in IE8
  888. var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
  889. return str.substr(start, len);
  890. } : function (str, start, len) {
  891. if (start < 0) start = str.length + start;
  892. return str.substr(start, len);
  893. };
  894. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12)))
  895. /***/ }),
  896. /* 7 */
  897. /***/ (function(module, exports, __webpack_require__) {
  898. "use strict";
  899. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  900. exports.__esModule = true;
  901. var _createClass = function () {
  902. function defineProperties(target, props) {
  903. for (var i = 0; i < props.length; i++) {
  904. var descriptor = props[i];
  905. descriptor.enumerable = descriptor.enumerable || false;
  906. descriptor.configurable = true;
  907. if ("value" in descriptor) descriptor.writable = true;
  908. Object.defineProperty(target, descriptor.key, descriptor);
  909. }
  910. }
  911. return function (Constructor, protoProps, staticProps) {
  912. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  913. if (staticProps) defineProperties(Constructor, staticProps);
  914. return Constructor;
  915. };
  916. }();
  917. var _node = __webpack_require__(5);
  918. var _node2 = _interopRequireDefault(_node);
  919. function _interopRequireDefault(obj) {
  920. return obj && obj.__esModule ? obj : {
  921. default: obj
  922. };
  923. }
  924. function _classCallCheck(instance, Constructor) {
  925. if (!(instance instanceof Constructor)) {
  926. throw new TypeError("Cannot call a class as a function");
  927. }
  928. }
  929. function _possibleConstructorReturn(self, call) {
  930. if (!self) {
  931. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  932. }
  933. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  934. }
  935. function _inherits(subClass, superClass) {
  936. if (typeof superClass !== "function" && superClass !== null) {
  937. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  938. }
  939. subClass.prototype = Object.create(superClass && superClass.prototype, {
  940. constructor: {
  941. value: subClass,
  942. enumerable: false,
  943. writable: true,
  944. configurable: true
  945. }
  946. });
  947. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  948. }
  949. var Namespace = function (_Node) {
  950. _inherits(Namespace, _Node);
  951. function Namespace() {
  952. _classCallCheck(this, Namespace);
  953. return _possibleConstructorReturn(this, _Node.apply(this, arguments));
  954. }
  955. Namespace.prototype.toString = function toString() {
  956. return [this.spaces.before, this.ns, String(this.value), this.spaces.after].join('');
  957. };
  958. _createClass(Namespace, [{
  959. key: 'ns',
  960. get: function get() {
  961. var n = this.namespace;
  962. return n ? (typeof n === 'string' ? n : '') + '|' : '';
  963. }
  964. }]);
  965. return Namespace;
  966. }(_node2.default);
  967. exports.default = Namespace;
  968. ;
  969. module.exports = exports['default'];
  970. /***/ }),
  971. /* 8 */
  972. /***/ (function(module, exports) {
  973. /* -*- Mode: js; js-indent-level: 2; -*- */
  974. /*
  975. * Copyright 2011 Mozilla Foundation and contributors
  976. * Licensed under the New BSD license. See LICENSE or:
  977. * http://opensource.org/licenses/BSD-3-Clause
  978. */
  979. /**
  980. * This is a helper function for getting values from parameter/options
  981. * objects.
  982. *
  983. * @param args The object we are extracting values from
  984. * @param name The name of the property we are getting.
  985. * @param defaultValue An optional value to return if the property is missing
  986. * from the object. If this is not specified and the property is missing, an
  987. * error will be thrown.
  988. */
  989. function getArg(aArgs, aName, aDefaultValue) {
  990. if (aName in aArgs) {
  991. return aArgs[aName];
  992. } else if (arguments.length === 3) {
  993. return aDefaultValue;
  994. } else {
  995. throw new Error('"' + aName + '" is a required argument.');
  996. }
  997. }
  998. exports.getArg = getArg;
  999. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  1000. var dataUrlRegexp = /^data:.+\,.+$/;
  1001. function urlParse(aUrl) {
  1002. var match = aUrl.match(urlRegexp);
  1003. if (!match) {
  1004. return null;
  1005. }
  1006. return {
  1007. scheme: match[1],
  1008. auth: match[2],
  1009. host: match[3],
  1010. port: match[4],
  1011. path: match[5]
  1012. };
  1013. }
  1014. exports.urlParse = urlParse;
  1015. function urlGenerate(aParsedUrl) {
  1016. var url = '';
  1017. if (aParsedUrl.scheme) {
  1018. url += aParsedUrl.scheme + ':';
  1019. }
  1020. url += '//';
  1021. if (aParsedUrl.auth) {
  1022. url += aParsedUrl.auth + '@';
  1023. }
  1024. if (aParsedUrl.host) {
  1025. url += aParsedUrl.host;
  1026. }
  1027. if (aParsedUrl.port) {
  1028. url += ":" + aParsedUrl.port;
  1029. }
  1030. if (aParsedUrl.path) {
  1031. url += aParsedUrl.path;
  1032. }
  1033. return url;
  1034. }
  1035. exports.urlGenerate = urlGenerate;
  1036. /**
  1037. * Normalizes a path, or the path portion of a URL:
  1038. *
  1039. * - Replaces consecutive slashes with one slash.
  1040. * - Removes unnecessary '.' parts.
  1041. * - Removes unnecessary '<dir>/..' parts.
  1042. *
  1043. * Based on code in the Node.js 'path' core module.
  1044. *
  1045. * @param aPath The path or url to normalize.
  1046. */
  1047. function normalize(aPath) {
  1048. var path = aPath;
  1049. var url = urlParse(aPath);
  1050. if (url) {
  1051. if (!url.path) {
  1052. return aPath;
  1053. }
  1054. path = url.path;
  1055. }
  1056. var isAbsolute = exports.isAbsolute(path);
  1057. var parts = path.split(/\/+/);
  1058. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  1059. part = parts[i];
  1060. if (part === '.') {
  1061. parts.splice(i, 1);
  1062. } else if (part === '..') {
  1063. up++;
  1064. } else if (up > 0) {
  1065. if (part === '') {
  1066. // The first part is blank if the path is absolute. Trying to go
  1067. // above the root is a no-op. Therefore we can remove all '..' parts
  1068. // directly after the root.
  1069. parts.splice(i + 1, up);
  1070. up = 0;
  1071. } else {
  1072. parts.splice(i, 2);
  1073. up--;
  1074. }
  1075. }
  1076. }
  1077. path = parts.join('/');
  1078. if (path === '') {
  1079. path = isAbsolute ? '/' : '.';
  1080. }
  1081. if (url) {
  1082. url.path = path;
  1083. return urlGenerate(url);
  1084. }
  1085. return path;
  1086. }
  1087. exports.normalize = normalize;
  1088. /**
  1089. * Joins two paths/URLs.
  1090. *
  1091. * @param aRoot The root path or URL.
  1092. * @param aPath The path or URL to be joined with the root.
  1093. *
  1094. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  1095. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  1096. * first.
  1097. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  1098. * is updated with the result and aRoot is returned. Otherwise the result
  1099. * is returned.
  1100. * - If aPath is absolute, the result is aPath.
  1101. * - Otherwise the two paths are joined with a slash.
  1102. * - Joining for example 'http://' and 'www.example.com' is also supported.
  1103. */
  1104. function join(aRoot, aPath) {
  1105. if (aRoot === "") {
  1106. aRoot = ".";
  1107. }
  1108. if (aPath === "") {
  1109. aPath = ".";
  1110. }
  1111. var aPathUrl = urlParse(aPath);
  1112. var aRootUrl = urlParse(aRoot);
  1113. if (aRootUrl) {
  1114. aRoot = aRootUrl.path || '/';
  1115. } // `join(foo, '//www.example.org')`
  1116. if (aPathUrl && !aPathUrl.scheme) {
  1117. if (aRootUrl) {
  1118. aPathUrl.scheme = aRootUrl.scheme;
  1119. }
  1120. return urlGenerate(aPathUrl);
  1121. }
  1122. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  1123. return aPath;
  1124. } // `join('http://', 'www.example.com')`
  1125. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  1126. aRootUrl.host = aPath;
  1127. return urlGenerate(aRootUrl);
  1128. }
  1129. var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  1130. if (aRootUrl) {
  1131. aRootUrl.path = joined;
  1132. return urlGenerate(aRootUrl);
  1133. }
  1134. return joined;
  1135. }
  1136. exports.join = join;
  1137. exports.isAbsolute = function (aPath) {
  1138. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  1139. };
  1140. /**
  1141. * Make a path relative to a URL or another path.
  1142. *
  1143. * @param aRoot The root path or URL.
  1144. * @param aPath The path or URL to be made relative to aRoot.
  1145. */
  1146. function relative(aRoot, aPath) {
  1147. if (aRoot === "") {
  1148. aRoot = ".";
  1149. }
  1150. aRoot = aRoot.replace(/\/$/, ''); // It is possible for the path to be above the root. In this case, simply
  1151. // checking whether the root is a prefix of the path won't work. Instead, we
  1152. // need to remove components from the root one by one, until either we find
  1153. // a prefix that fits, or we run out of components to remove.
  1154. var level = 0;
  1155. while (aPath.indexOf(aRoot + '/') !== 0) {
  1156. var index = aRoot.lastIndexOf("/");
  1157. if (index < 0) {
  1158. return aPath;
  1159. } // If the only part of the root that is left is the scheme (i.e. http://,
  1160. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  1161. // have exhausted all components, so the path is not relative to the root.
  1162. aRoot = aRoot.slice(0, index);
  1163. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  1164. return aPath;
  1165. }
  1166. ++level;
  1167. } // Make sure we add a "../" for each component we removed from the root.
  1168. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  1169. }
  1170. exports.relative = relative;
  1171. var supportsNullProto = function () {
  1172. var obj = Object.create(null);
  1173. return !('__proto__' in obj);
  1174. }();
  1175. function identity(s) {
  1176. return s;
  1177. }
  1178. /**
  1179. * Because behavior goes wacky when you set `__proto__` on objects, we
  1180. * have to prefix all the strings in our set with an arbitrary character.
  1181. *
  1182. * See https://github.com/mozilla/source-map/pull/31 and
  1183. * https://github.com/mozilla/source-map/issues/30
  1184. *
  1185. * @param String aStr
  1186. */
  1187. function toSetString(aStr) {
  1188. if (isProtoString(aStr)) {
  1189. return '$' + aStr;
  1190. }
  1191. return aStr;
  1192. }
  1193. exports.toSetString = supportsNullProto ? identity : toSetString;
  1194. function fromSetString(aStr) {
  1195. if (isProtoString(aStr)) {
  1196. return aStr.slice(1);
  1197. }
  1198. return aStr;
  1199. }
  1200. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  1201. function isProtoString(s) {
  1202. if (!s) {
  1203. return false;
  1204. }
  1205. var length = s.length;
  1206. if (length < 9
  1207. /* "__proto__".length */
  1208. ) {
  1209. return false;
  1210. }
  1211. if (s.charCodeAt(length - 1) !== 95
  1212. /* '_' */
  1213. || s.charCodeAt(length - 2) !== 95
  1214. /* '_' */
  1215. || s.charCodeAt(length - 3) !== 111
  1216. /* 'o' */
  1217. || s.charCodeAt(length - 4) !== 116
  1218. /* 't' */
  1219. || s.charCodeAt(length - 5) !== 111
  1220. /* 'o' */
  1221. || s.charCodeAt(length - 6) !== 114
  1222. /* 'r' */
  1223. || s.charCodeAt(length - 7) !== 112
  1224. /* 'p' */
  1225. || s.charCodeAt(length - 8) !== 95
  1226. /* '_' */
  1227. || s.charCodeAt(length - 9) !== 95
  1228. /* '_' */
  1229. ) {
  1230. return false;
  1231. }
  1232. for (var i = length - 10; i >= 0; i--) {
  1233. if (s.charCodeAt(i) !== 36
  1234. /* '$' */
  1235. ) {
  1236. return false;
  1237. }
  1238. }
  1239. return true;
  1240. }
  1241. /**
  1242. * Comparator between two mappings where the original positions are compared.
  1243. *
  1244. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  1245. * mappings with the same original source/line/column, but different generated
  1246. * line and column the same. Useful when searching for a mapping with a
  1247. * stubbed out mapping.
  1248. */
  1249. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  1250. var cmp = strcmp(mappingA.source, mappingB.source);
  1251. if (cmp !== 0) {
  1252. return cmp;
  1253. }
  1254. cmp = mappingA.originalLine - mappingB.originalLine;
  1255. if (cmp !== 0) {
  1256. return cmp;
  1257. }
  1258. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1259. if (cmp !== 0 || onlyCompareOriginal) {
  1260. return cmp;
  1261. }
  1262. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  1263. if (cmp !== 0) {
  1264. return cmp;
  1265. }
  1266. cmp = mappingA.generatedLine - mappingB.generatedLine;
  1267. if (cmp !== 0) {
  1268. return cmp;
  1269. }
  1270. return strcmp(mappingA.name, mappingB.name);
  1271. }
  1272. exports.compareByOriginalPositions = compareByOriginalPositions;
  1273. /**
  1274. * Comparator between two mappings with deflated source and name indices where
  1275. * the generated positions are compared.
  1276. *
  1277. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  1278. * mappings with the same generated line and column, but different
  1279. * source/name/original line and column the same. Useful when searching for a
  1280. * mapping with a stubbed out mapping.
  1281. */
  1282. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  1283. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  1284. if (cmp !== 0) {
  1285. return cmp;
  1286. }
  1287. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  1288. if (cmp !== 0 || onlyCompareGenerated) {
  1289. return cmp;
  1290. }
  1291. cmp = strcmp(mappingA.source, mappingB.source);
  1292. if (cmp !== 0) {
  1293. return cmp;
  1294. }
  1295. cmp = mappingA.originalLine - mappingB.originalLine;
  1296. if (cmp !== 0) {
  1297. return cmp;
  1298. }
  1299. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1300. if (cmp !== 0) {
  1301. return cmp;
  1302. }
  1303. return strcmp(mappingA.name, mappingB.name);
  1304. }
  1305. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  1306. function strcmp(aStr1, aStr2) {
  1307. if (aStr1 === aStr2) {
  1308. return 0;
  1309. }
  1310. if (aStr1 === null) {
  1311. return 1; // aStr2 !== null
  1312. }
  1313. if (aStr2 === null) {
  1314. return -1; // aStr1 !== null
  1315. }
  1316. if (aStr1 > aStr2) {
  1317. return 1;
  1318. }
  1319. return -1;
  1320. }
  1321. /**
  1322. * Comparator between two mappings with inflated source and name strings where
  1323. * the generated positions are compared.
  1324. */
  1325. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  1326. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  1327. if (cmp !== 0) {
  1328. return cmp;
  1329. }
  1330. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  1331. if (cmp !== 0) {
  1332. return cmp;
  1333. }
  1334. cmp = strcmp(mappingA.source, mappingB.source);
  1335. if (cmp !== 0) {
  1336. return cmp;
  1337. }
  1338. cmp = mappingA.originalLine - mappingB.originalLine;
  1339. if (cmp !== 0) {
  1340. return cmp;
  1341. }
  1342. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1343. if (cmp !== 0) {
  1344. return cmp;
  1345. }
  1346. return strcmp(mappingA.name, mappingB.name);
  1347. }
  1348. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  1349. /**
  1350. * Strip any JSON XSSI avoidance prefix from the string (as documented
  1351. * in the source maps specification), and then parse the string as
  1352. * JSON.
  1353. */
  1354. function parseSourceMapInput(str) {
  1355. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  1356. }
  1357. exports.parseSourceMapInput = parseSourceMapInput;
  1358. /**
  1359. * Compute the URL of a source given the the source root, the source's
  1360. * URL, and the source map's URL.
  1361. */
  1362. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  1363. sourceURL = sourceURL || '';
  1364. if (sourceRoot) {
  1365. // This follows what Chrome does.
  1366. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  1367. sourceRoot += '/';
  1368. } // The spec says:
  1369. // Line 4: An optional source root, useful for relocating source
  1370. // files on a server or removing repeated values in the
  1371. // “sources” entry. This value is prepended to the individual
  1372. // entries in the “source” field.
  1373. sourceURL = sourceRoot + sourceURL;
  1374. } // Historically, SourceMapConsumer did not take the sourceMapURL as
  1375. // a parameter. This mode is still somewhat supported, which is why
  1376. // this code block is conditional. However, it's preferable to pass
  1377. // the source map URL to SourceMapConsumer, so that this function
  1378. // can implement the source URL resolution algorithm as outlined in
  1379. // the spec. This block is basically the equivalent of:
  1380. // new URL(sourceURL, sourceMapURL).toString()
  1381. // ... except it avoids using URL, which wasn't available in the
  1382. // older releases of node still supported by this library.
  1383. //
  1384. // The spec says:
  1385. // If the sources are not absolute URLs after prepending of the
  1386. // “sourceRoot”, the sources are resolved relative to the
  1387. // SourceMap (like resolving script src in a html document).
  1388. if (sourceMapURL) {
  1389. var parsed = urlParse(sourceMapURL);
  1390. if (!parsed) {
  1391. throw new Error("sourceMapURL could not be parsed");
  1392. }
  1393. if (parsed.path) {
  1394. // Strip the last path component, but keep the "/".
  1395. var index = parsed.path.lastIndexOf('/');
  1396. if (index >= 0) {
  1397. parsed.path = parsed.path.substring(0, index + 1);
  1398. }
  1399. }
  1400. sourceURL = join(urlGenerate(parsed), sourceURL);
  1401. }
  1402. return normalize(sourceURL);
  1403. }
  1404. exports.computeSourceURL = computeSourceURL;
  1405. /***/ }),
  1406. /* 9 */
  1407. /***/ (function(module, exports) {
  1408. /* -*- Mode: js; js-indent-level: 2; -*- */
  1409. /*
  1410. * Copyright 2011 Mozilla Foundation and contributors
  1411. * Licensed under the New BSD license. See LICENSE or:
  1412. * http://opensource.org/licenses/BSD-3-Clause
  1413. */
  1414. /**
  1415. * This is a helper function for getting values from parameter/options
  1416. * objects.
  1417. *
  1418. * @param args The object we are extracting values from
  1419. * @param name The name of the property we are getting.
  1420. * @param defaultValue An optional value to return if the property is missing
  1421. * from the object. If this is not specified and the property is missing, an
  1422. * error will be thrown.
  1423. */
  1424. function getArg(aArgs, aName, aDefaultValue) {
  1425. if (aName in aArgs) {
  1426. return aArgs[aName];
  1427. } else if (arguments.length === 3) {
  1428. return aDefaultValue;
  1429. } else {
  1430. throw new Error('"' + aName + '" is a required argument.');
  1431. }
  1432. }
  1433. exports.getArg = getArg;
  1434. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
  1435. var dataUrlRegexp = /^data:.+\,.+$/;
  1436. function urlParse(aUrl) {
  1437. var match = aUrl.match(urlRegexp);
  1438. if (!match) {
  1439. return null;
  1440. }
  1441. return {
  1442. scheme: match[1],
  1443. auth: match[2],
  1444. host: match[3],
  1445. port: match[4],
  1446. path: match[5]
  1447. };
  1448. }
  1449. exports.urlParse = urlParse;
  1450. function urlGenerate(aParsedUrl) {
  1451. var url = '';
  1452. if (aParsedUrl.scheme) {
  1453. url += aParsedUrl.scheme + ':';
  1454. }
  1455. url += '//';
  1456. if (aParsedUrl.auth) {
  1457. url += aParsedUrl.auth + '@';
  1458. }
  1459. if (aParsedUrl.host) {
  1460. url += aParsedUrl.host;
  1461. }
  1462. if (aParsedUrl.port) {
  1463. url += ":" + aParsedUrl.port;
  1464. }
  1465. if (aParsedUrl.path) {
  1466. url += aParsedUrl.path;
  1467. }
  1468. return url;
  1469. }
  1470. exports.urlGenerate = urlGenerate;
  1471. /**
  1472. * Normalizes a path, or the path portion of a URL:
  1473. *
  1474. * - Replaces consecutive slashes with one slash.
  1475. * - Removes unnecessary '.' parts.
  1476. * - Removes unnecessary '<dir>/..' parts.
  1477. *
  1478. * Based on code in the Node.js 'path' core module.
  1479. *
  1480. * @param aPath The path or url to normalize.
  1481. */
  1482. function normalize(aPath) {
  1483. var path = aPath;
  1484. var url = urlParse(aPath);
  1485. if (url) {
  1486. if (!url.path) {
  1487. return aPath;
  1488. }
  1489. path = url.path;
  1490. }
  1491. var isAbsolute = exports.isAbsolute(path);
  1492. var parts = path.split(/\/+/);
  1493. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  1494. part = parts[i];
  1495. if (part === '.') {
  1496. parts.splice(i, 1);
  1497. } else if (part === '..') {
  1498. up++;
  1499. } else if (up > 0) {
  1500. if (part === '') {
  1501. // The first part is blank if the path is absolute. Trying to go
  1502. // above the root is a no-op. Therefore we can remove all '..' parts
  1503. // directly after the root.
  1504. parts.splice(i + 1, up);
  1505. up = 0;
  1506. } else {
  1507. parts.splice(i, 2);
  1508. up--;
  1509. }
  1510. }
  1511. }
  1512. path = parts.join('/');
  1513. if (path === '') {
  1514. path = isAbsolute ? '/' : '.';
  1515. }
  1516. if (url) {
  1517. url.path = path;
  1518. return urlGenerate(url);
  1519. }
  1520. return path;
  1521. }
  1522. exports.normalize = normalize;
  1523. /**
  1524. * Joins two paths/URLs.
  1525. *
  1526. * @param aRoot The root path or URL.
  1527. * @param aPath The path or URL to be joined with the root.
  1528. *
  1529. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  1530. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  1531. * first.
  1532. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  1533. * is updated with the result and aRoot is returned. Otherwise the result
  1534. * is returned.
  1535. * - If aPath is absolute, the result is aPath.
  1536. * - Otherwise the two paths are joined with a slash.
  1537. * - Joining for example 'http://' and 'www.example.com' is also supported.
  1538. */
  1539. function join(aRoot, aPath) {
  1540. if (aRoot === "") {
  1541. aRoot = ".";
  1542. }
  1543. if (aPath === "") {
  1544. aPath = ".";
  1545. }
  1546. var aPathUrl = urlParse(aPath);
  1547. var aRootUrl = urlParse(aRoot);
  1548. if (aRootUrl) {
  1549. aRoot = aRootUrl.path || '/';
  1550. } // `join(foo, '//www.example.org')`
  1551. if (aPathUrl && !aPathUrl.scheme) {
  1552. if (aRootUrl) {
  1553. aPathUrl.scheme = aRootUrl.scheme;
  1554. }
  1555. return urlGenerate(aPathUrl);
  1556. }
  1557. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  1558. return aPath;
  1559. } // `join('http://', 'www.example.com')`
  1560. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  1561. aRootUrl.host = aPath;
  1562. return urlGenerate(aRootUrl);
  1563. }
  1564. var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  1565. if (aRootUrl) {
  1566. aRootUrl.path = joined;
  1567. return urlGenerate(aRootUrl);
  1568. }
  1569. return joined;
  1570. }
  1571. exports.join = join;
  1572. exports.isAbsolute = function (aPath) {
  1573. return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
  1574. };
  1575. /**
  1576. * Make a path relative to a URL or another path.
  1577. *
  1578. * @param aRoot The root path or URL.
  1579. * @param aPath The path or URL to be made relative to aRoot.
  1580. */
  1581. function relative(aRoot, aPath) {
  1582. if (aRoot === "") {
  1583. aRoot = ".";
  1584. }
  1585. aRoot = aRoot.replace(/\/$/, ''); // It is possible for the path to be above the root. In this case, simply
  1586. // checking whether the root is a prefix of the path won't work. Instead, we
  1587. // need to remove components from the root one by one, until either we find
  1588. // a prefix that fits, or we run out of components to remove.
  1589. var level = 0;
  1590. while (aPath.indexOf(aRoot + '/') !== 0) {
  1591. var index = aRoot.lastIndexOf("/");
  1592. if (index < 0) {
  1593. return aPath;
  1594. } // If the only part of the root that is left is the scheme (i.e. http://,
  1595. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  1596. // have exhausted all components, so the path is not relative to the root.
  1597. aRoot = aRoot.slice(0, index);
  1598. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  1599. return aPath;
  1600. }
  1601. ++level;
  1602. } // Make sure we add a "../" for each component we removed from the root.
  1603. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  1604. }
  1605. exports.relative = relative;
  1606. var supportsNullProto = function () {
  1607. var obj = Object.create(null);
  1608. return !('__proto__' in obj);
  1609. }();
  1610. function identity(s) {
  1611. return s;
  1612. }
  1613. /**
  1614. * Because behavior goes wacky when you set `__proto__` on objects, we
  1615. * have to prefix all the strings in our set with an arbitrary character.
  1616. *
  1617. * See https://github.com/mozilla/source-map/pull/31 and
  1618. * https://github.com/mozilla/source-map/issues/30
  1619. *
  1620. * @param String aStr
  1621. */
  1622. function toSetString(aStr) {
  1623. if (isProtoString(aStr)) {
  1624. return '$' + aStr;
  1625. }
  1626. return aStr;
  1627. }
  1628. exports.toSetString = supportsNullProto ? identity : toSetString;
  1629. function fromSetString(aStr) {
  1630. if (isProtoString(aStr)) {
  1631. return aStr.slice(1);
  1632. }
  1633. return aStr;
  1634. }
  1635. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  1636. function isProtoString(s) {
  1637. if (!s) {
  1638. return false;
  1639. }
  1640. var length = s.length;
  1641. if (length < 9
  1642. /* "__proto__".length */
  1643. ) {
  1644. return false;
  1645. }
  1646. if (s.charCodeAt(length - 1) !== 95
  1647. /* '_' */
  1648. || s.charCodeAt(length - 2) !== 95
  1649. /* '_' */
  1650. || s.charCodeAt(length - 3) !== 111
  1651. /* 'o' */
  1652. || s.charCodeAt(length - 4) !== 116
  1653. /* 't' */
  1654. || s.charCodeAt(length - 5) !== 111
  1655. /* 'o' */
  1656. || s.charCodeAt(length - 6) !== 114
  1657. /* 'r' */
  1658. || s.charCodeAt(length - 7) !== 112
  1659. /* 'p' */
  1660. || s.charCodeAt(length - 8) !== 95
  1661. /* '_' */
  1662. || s.charCodeAt(length - 9) !== 95
  1663. /* '_' */
  1664. ) {
  1665. return false;
  1666. }
  1667. for (var i = length - 10; i >= 0; i--) {
  1668. if (s.charCodeAt(i) !== 36
  1669. /* '$' */
  1670. ) {
  1671. return false;
  1672. }
  1673. }
  1674. return true;
  1675. }
  1676. /**
  1677. * Comparator between two mappings where the original positions are compared.
  1678. *
  1679. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  1680. * mappings with the same original source/line/column, but different generated
  1681. * line and column the same. Useful when searching for a mapping with a
  1682. * stubbed out mapping.
  1683. */
  1684. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  1685. var cmp = mappingA.source - mappingB.source;
  1686. if (cmp !== 0) {
  1687. return cmp;
  1688. }
  1689. cmp = mappingA.originalLine - mappingB.originalLine;
  1690. if (cmp !== 0) {
  1691. return cmp;
  1692. }
  1693. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1694. if (cmp !== 0 || onlyCompareOriginal) {
  1695. return cmp;
  1696. }
  1697. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  1698. if (cmp !== 0) {
  1699. return cmp;
  1700. }
  1701. cmp = mappingA.generatedLine - mappingB.generatedLine;
  1702. if (cmp !== 0) {
  1703. return cmp;
  1704. }
  1705. return mappingA.name - mappingB.name;
  1706. }
  1707. exports.compareByOriginalPositions = compareByOriginalPositions;
  1708. /**
  1709. * Comparator between two mappings with deflated source and name indices where
  1710. * the generated positions are compared.
  1711. *
  1712. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  1713. * mappings with the same generated line and column, but different
  1714. * source/name/original line and column the same. Useful when searching for a
  1715. * mapping with a stubbed out mapping.
  1716. */
  1717. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  1718. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  1719. if (cmp !== 0) {
  1720. return cmp;
  1721. }
  1722. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  1723. if (cmp !== 0 || onlyCompareGenerated) {
  1724. return cmp;
  1725. }
  1726. cmp = mappingA.source - mappingB.source;
  1727. if (cmp !== 0) {
  1728. return cmp;
  1729. }
  1730. cmp = mappingA.originalLine - mappingB.originalLine;
  1731. if (cmp !== 0) {
  1732. return cmp;
  1733. }
  1734. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1735. if (cmp !== 0) {
  1736. return cmp;
  1737. }
  1738. return mappingA.name - mappingB.name;
  1739. }
  1740. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  1741. function strcmp(aStr1, aStr2) {
  1742. if (aStr1 === aStr2) {
  1743. return 0;
  1744. }
  1745. if (aStr1 > aStr2) {
  1746. return 1;
  1747. }
  1748. return -1;
  1749. }
  1750. /**
  1751. * Comparator between two mappings with inflated source and name strings where
  1752. * the generated positions are compared.
  1753. */
  1754. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  1755. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  1756. if (cmp !== 0) {
  1757. return cmp;
  1758. }
  1759. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  1760. if (cmp !== 0) {
  1761. return cmp;
  1762. }
  1763. cmp = strcmp(mappingA.source, mappingB.source);
  1764. if (cmp !== 0) {
  1765. return cmp;
  1766. }
  1767. cmp = mappingA.originalLine - mappingB.originalLine;
  1768. if (cmp !== 0) {
  1769. return cmp;
  1770. }
  1771. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1772. if (cmp !== 0) {
  1773. return cmp;
  1774. }
  1775. return strcmp(mappingA.name, mappingB.name);
  1776. }
  1777. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  1778. /***/ }),
  1779. /* 10 */
  1780. /***/ (function(module, exports, __webpack_require__) {
  1781. "use strict";
  1782. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1783. exports.__esModule = true;
  1784. var _createClass = function () {
  1785. function defineProperties(target, props) {
  1786. for (var i = 0; i < props.length; i++) {
  1787. var descriptor = props[i];
  1788. descriptor.enumerable = descriptor.enumerable || false;
  1789. descriptor.configurable = true;
  1790. if ("value" in descriptor) descriptor.writable = true;
  1791. Object.defineProperty(target, descriptor.key, descriptor);
  1792. }
  1793. }
  1794. return function (Constructor, protoProps, staticProps) {
  1795. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  1796. if (staticProps) defineProperties(Constructor, staticProps);
  1797. return Constructor;
  1798. };
  1799. }();
  1800. var _container = __webpack_require__(25);
  1801. var _container2 = _interopRequireDefault(_container);
  1802. var _warnOnce = __webpack_require__(4);
  1803. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  1804. var _list = __webpack_require__(162);
  1805. var _list2 = _interopRequireDefault(_list);
  1806. function _interopRequireDefault(obj) {
  1807. return obj && obj.__esModule ? obj : {
  1808. default: obj
  1809. };
  1810. }
  1811. function _classCallCheck(instance, Constructor) {
  1812. if (!(instance instanceof Constructor)) {
  1813. throw new TypeError("Cannot call a class as a function");
  1814. }
  1815. }
  1816. function _possibleConstructorReturn(self, call) {
  1817. if (!self) {
  1818. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1819. }
  1820. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  1821. }
  1822. function _inherits(subClass, superClass) {
  1823. if (typeof superClass !== "function" && superClass !== null) {
  1824. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  1825. }
  1826. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1827. constructor: {
  1828. value: subClass,
  1829. enumerable: false,
  1830. writable: true,
  1831. configurable: true
  1832. }
  1833. });
  1834. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  1835. }
  1836. /**
  1837. * Represents a CSS rule: a selector followed by a declaration block.
  1838. *
  1839. * @extends Container
  1840. *
  1841. * @example
  1842. * const root = postcss.parse('a{}');
  1843. * const rule = root.first;
  1844. * rule.type //=> 'rule'
  1845. * rule.toString() //=> 'a{}'
  1846. */
  1847. var Rule = function (_Container) {
  1848. _inherits(Rule, _Container);
  1849. function Rule(defaults) {
  1850. _classCallCheck(this, Rule);
  1851. var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
  1852. _this.type = 'rule';
  1853. if (!_this.nodes) _this.nodes = [];
  1854. return _this;
  1855. }
  1856. /**
  1857. * An array containing the rule’s individual selectors.
  1858. * Groups of selectors are split at commas.
  1859. *
  1860. * @type {string[]}
  1861. *
  1862. * @example
  1863. * const root = postcss.parse('a, b { }');
  1864. * const rule = root.first;
  1865. *
  1866. * rule.selector //=> 'a, b'
  1867. * rule.selectors //=> ['a', 'b']
  1868. *
  1869. * rule.selectors = ['a', 'strong'];
  1870. * rule.selector //=> 'a, strong'
  1871. */
  1872. _createClass(Rule, [{
  1873. key: 'selectors',
  1874. get: function get() {
  1875. return _list2.default.comma(this.selector);
  1876. },
  1877. set: function set(values) {
  1878. var match = this.selector ? this.selector.match(/,\s*/) : null;
  1879. var sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
  1880. this.selector = values.join(sep);
  1881. }
  1882. }, {
  1883. key: '_selector',
  1884. get: function get() {
  1885. (0, _warnOnce2.default)('Rule#_selector is deprecated. Use Rule#raws.selector');
  1886. return this.raws.selector;
  1887. },
  1888. set: function set(val) {
  1889. (0, _warnOnce2.default)('Rule#_selector is deprecated. Use Rule#raws.selector');
  1890. this.raws.selector = val;
  1891. }
  1892. /**
  1893. * @memberof Rule#
  1894. * @member {string} selector - the rule’s full selector represented
  1895. * as a string
  1896. *
  1897. * @example
  1898. * const root = postcss.parse('a, b { }');
  1899. * const rule = root.first;
  1900. * rule.selector //=> 'a, b'
  1901. */
  1902. /**
  1903. * @memberof Rule#
  1904. * @member {object} raws - Information to generate byte-to-byte equal
  1905. * node string as it was in the origin input.
  1906. *
  1907. * Every parser saves its own properties,
  1908. * but the default CSS parser uses:
  1909. *
  1910. * * `before`: the space symbols before the node. It also stores `*`
  1911. * and `_` symbols before the declaration (IE hack).
  1912. * * `after`: the space symbols after the last child of the node
  1913. * to the end of the node.
  1914. * * `between`: the symbols between the property and value
  1915. * for declarations, selector and `{` for rules, or last parameter
  1916. * and `{` for at-rules.
  1917. * * `semicolon`: contains true if the last child has
  1918. * an (optional) semicolon.
  1919. *
  1920. * PostCSS cleans selectors from comments and extra spaces,
  1921. * but it stores origin content in raws properties.
  1922. * As such, if you don’t change a declaration’s value,
  1923. * PostCSS will use the raw value with comments.
  1924. *
  1925. * @example
  1926. * const root = postcss.parse('a {\n color:black\n}')
  1927. * root.first.first.raws //=> { before: '', between: ' ', after: '\n' }
  1928. */
  1929. }]);
  1930. return Rule;
  1931. }(_container2.default);
  1932. exports.default = Rule;
  1933. module.exports = exports['default'];
  1934. /***/ }),
  1935. /* 11 */
  1936. /***/ (function(module, exports, __webpack_require__) {
  1937. "use strict";
  1938. Object.defineProperty(exports, "__esModule", {
  1939. value: true
  1940. });
  1941. exports.default = unclosed;
  1942. function unclosed(state, what) {
  1943. throw state.input.error("Unclosed " + what, state.line, state.pos - state.offset);
  1944. }
  1945. module.exports = exports["default"];
  1946. /***/ }),
  1947. /* 12 */
  1948. /***/ (function(module, exports) {
  1949. // shim for using process in browser
  1950. var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
  1951. // don't break things. But we need to wrap it in a try catch in case it is
  1952. // wrapped in strict mode code which doesn't define any globals. It's inside a
  1953. // function because try/catches deoptimize in certain engines.
  1954. var cachedSetTimeout;
  1955. var cachedClearTimeout;
  1956. function defaultSetTimout() {
  1957. throw new Error('setTimeout has not been defined');
  1958. }
  1959. function defaultClearTimeout() {
  1960. throw new Error('clearTimeout has not been defined');
  1961. }
  1962. (function () {
  1963. try {
  1964. if (typeof setTimeout === 'function') {
  1965. cachedSetTimeout = setTimeout;
  1966. } else {
  1967. cachedSetTimeout = defaultSetTimout;
  1968. }
  1969. } catch (e) {
  1970. cachedSetTimeout = defaultSetTimout;
  1971. }
  1972. try {
  1973. if (typeof clearTimeout === 'function') {
  1974. cachedClearTimeout = clearTimeout;
  1975. } else {
  1976. cachedClearTimeout = defaultClearTimeout;
  1977. }
  1978. } catch (e) {
  1979. cachedClearTimeout = defaultClearTimeout;
  1980. }
  1981. })();
  1982. function runTimeout(fun) {
  1983. if (cachedSetTimeout === setTimeout) {
  1984. //normal enviroments in sane situations
  1985. return setTimeout(fun, 0);
  1986. } // if setTimeout wasn't available but was latter defined
  1987. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  1988. cachedSetTimeout = setTimeout;
  1989. return setTimeout(fun, 0);
  1990. }
  1991. try {
  1992. // when when somebody has screwed with setTimeout but no I.E. maddness
  1993. return cachedSetTimeout(fun, 0);
  1994. } catch (e) {
  1995. try {
  1996. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1997. return cachedSetTimeout.call(null, fun, 0);
  1998. } catch (e) {
  1999. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  2000. return cachedSetTimeout.call(this, fun, 0);
  2001. }
  2002. }
  2003. }
  2004. function runClearTimeout(marker) {
  2005. if (cachedClearTimeout === clearTimeout) {
  2006. //normal enviroments in sane situations
  2007. return clearTimeout(marker);
  2008. } // if clearTimeout wasn't available but was latter defined
  2009. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  2010. cachedClearTimeout = clearTimeout;
  2011. return clearTimeout(marker);
  2012. }
  2013. try {
  2014. // when when somebody has screwed with setTimeout but no I.E. maddness
  2015. return cachedClearTimeout(marker);
  2016. } catch (e) {
  2017. try {
  2018. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  2019. return cachedClearTimeout.call(null, marker);
  2020. } catch (e) {
  2021. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  2022. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  2023. return cachedClearTimeout.call(this, marker);
  2024. }
  2025. }
  2026. }
  2027. var queue = [];
  2028. var draining = false;
  2029. var currentQueue;
  2030. var queueIndex = -1;
  2031. function cleanUpNextTick() {
  2032. if (!draining || !currentQueue) {
  2033. return;
  2034. }
  2035. draining = false;
  2036. if (currentQueue.length) {
  2037. queue = currentQueue.concat(queue);
  2038. } else {
  2039. queueIndex = -1;
  2040. }
  2041. if (queue.length) {
  2042. drainQueue();
  2043. }
  2044. }
  2045. function drainQueue() {
  2046. if (draining) {
  2047. return;
  2048. }
  2049. var timeout = runTimeout(cleanUpNextTick);
  2050. draining = true;
  2051. var len = queue.length;
  2052. while (len) {
  2053. currentQueue = queue;
  2054. queue = [];
  2055. while (++queueIndex < len) {
  2056. if (currentQueue) {
  2057. currentQueue[queueIndex].run();
  2058. }
  2059. }
  2060. queueIndex = -1;
  2061. len = queue.length;
  2062. }
  2063. currentQueue = null;
  2064. draining = false;
  2065. runClearTimeout(timeout);
  2066. }
  2067. process.nextTick = function (fun) {
  2068. var args = new Array(arguments.length - 1);
  2069. if (arguments.length > 1) {
  2070. for (var i = 1; i < arguments.length; i++) {
  2071. args[i - 1] = arguments[i];
  2072. }
  2073. }
  2074. queue.push(new Item(fun, args));
  2075. if (queue.length === 1 && !draining) {
  2076. runTimeout(drainQueue);
  2077. }
  2078. }; // v8 likes predictible objects
  2079. function Item(fun, array) {
  2080. this.fun = fun;
  2081. this.array = array;
  2082. }
  2083. Item.prototype.run = function () {
  2084. this.fun.apply(null, this.array);
  2085. };
  2086. process.title = 'browser';
  2087. process.browser = true;
  2088. process.env = {};
  2089. process.argv = [];
  2090. process.version = ''; // empty string to avoid regexp issues
  2091. process.versions = {};
  2092. function noop() {}
  2093. process.on = noop;
  2094. process.addListener = noop;
  2095. process.once = noop;
  2096. process.off = noop;
  2097. process.removeListener = noop;
  2098. process.removeAllListeners = noop;
  2099. process.emit = noop;
  2100. process.prependListener = noop;
  2101. process.prependOnceListener = noop;
  2102. process.listeners = function (name) {
  2103. return [];
  2104. };
  2105. process.binding = function (name) {
  2106. throw new Error('process.binding is not supported');
  2107. };
  2108. process.cwd = function () {
  2109. return '/';
  2110. };
  2111. process.chdir = function (dir) {
  2112. throw new Error('process.chdir is not supported');
  2113. };
  2114. process.umask = function () {
  2115. return 0;
  2116. };
  2117. /***/ }),
  2118. /* 13 */
  2119. /***/ (function(module, exports, __webpack_require__) {
  2120. "use strict";
  2121. exports.__esModule = true;
  2122. exports.default = void 0;
  2123. var _declaration = _interopRequireDefault(__webpack_require__(67));
  2124. var _comment = _interopRequireDefault(__webpack_require__(19));
  2125. var _node = _interopRequireDefault(__webpack_require__(20));
  2126. function _interopRequireDefault(obj) {
  2127. return obj && obj.__esModule ? obj : {
  2128. default: obj
  2129. };
  2130. }
  2131. function _defineProperties(target, props) {
  2132. for (var i = 0; i < props.length; i++) {
  2133. var descriptor = props[i];
  2134. descriptor.enumerable = descriptor.enumerable || false;
  2135. descriptor.configurable = true;
  2136. if ("value" in descriptor) descriptor.writable = true;
  2137. Object.defineProperty(target, descriptor.key, descriptor);
  2138. }
  2139. }
  2140. function _createClass(Constructor, protoProps, staticProps) {
  2141. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2142. if (staticProps) _defineProperties(Constructor, staticProps);
  2143. return Constructor;
  2144. }
  2145. function _inheritsLoose(subClass, superClass) {
  2146. subClass.prototype = Object.create(superClass.prototype);
  2147. subClass.prototype.constructor = subClass;
  2148. subClass.__proto__ = superClass;
  2149. }
  2150. function cleanSource(nodes) {
  2151. return nodes.map(function (i) {
  2152. if (i.nodes) i.nodes = cleanSource(i.nodes);
  2153. delete i.source;
  2154. return i;
  2155. });
  2156. }
  2157. /**
  2158. * The {@link Root}, {@link AtRule}, and {@link Rule} container nodes
  2159. * inherit some common methods to help work with their children.
  2160. *
  2161. * Note that all containers can store any content. If you write a rule inside
  2162. * a rule, PostCSS will parse it.
  2163. *
  2164. * @extends Node
  2165. * @abstract
  2166. */
  2167. var Container =
  2168. /*#__PURE__*/
  2169. function (_Node) {
  2170. _inheritsLoose(Container, _Node);
  2171. function Container() {
  2172. return _Node.apply(this, arguments) || this;
  2173. }
  2174. var _proto = Container.prototype;
  2175. _proto.push = function push(child) {
  2176. child.parent = this;
  2177. this.nodes.push(child);
  2178. return this;
  2179. };
  2180. /**
  2181. * Iterates through the container’s immediate children,
  2182. * calling `callback` for each child.
  2183. *
  2184. * Returning `false` in the callback will break iteration.
  2185. *
  2186. * This method only iterates through the container’s immediate children.
  2187. * If you need to recursively iterate through all the container’s descendant
  2188. * nodes, use {@link Container#walk}.
  2189. *
  2190. * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe
  2191. * if you are mutating the array of child nodes during iteration.
  2192. * PostCSS will adjust the current index to match the mutations.
  2193. *
  2194. * @param {childIterator} callback Iterator receives each node and index.
  2195. *
  2196. * @return {false|undefined} Returns `false` if iteration was broke.
  2197. *
  2198. * @example
  2199. * const root = postcss.parse('a { color: black; z-index: 1 }')
  2200. * const rule = root.first
  2201. *
  2202. * for (const decl of rule.nodes) {
  2203. * decl.cloneBefore({ prop: '-webkit-' + decl.prop })
  2204. * // Cycle will be infinite, because cloneBefore moves the current node
  2205. * // to the next index
  2206. * }
  2207. *
  2208. * rule.each(decl => {
  2209. * decl.cloneBefore({ prop: '-webkit-' + decl.prop })
  2210. * // Will be executed only for color and z-index
  2211. * })
  2212. */
  2213. _proto.each = function each(callback) {
  2214. if (!this.lastEach) this.lastEach = 0;
  2215. if (!this.indexes) this.indexes = {};
  2216. this.lastEach += 1;
  2217. var id = this.lastEach;
  2218. this.indexes[id] = 0;
  2219. if (!this.nodes) return undefined;
  2220. var index, result;
  2221. while (this.indexes[id] < this.nodes.length) {
  2222. index = this.indexes[id];
  2223. result = callback(this.nodes[index], index);
  2224. if (result === false) break;
  2225. this.indexes[id] += 1;
  2226. }
  2227. delete this.indexes[id];
  2228. return result;
  2229. };
  2230. /**
  2231. * Traverses the container’s descendant nodes, calling callback
  2232. * for each node.
  2233. *
  2234. * Like container.each(), this method is safe to use
  2235. * if you are mutating arrays during iteration.
  2236. *
  2237. * If you only need to iterate through the container’s immediate children,
  2238. * use {@link Container#each}.
  2239. *
  2240. * @param {childIterator} callback Iterator receives each node and index.
  2241. *
  2242. * @return {false|undefined} Returns `false` if iteration was broke.
  2243. *
  2244. * @example
  2245. * root.walk(node => {
  2246. * // Traverses all descendant nodes.
  2247. * })
  2248. */
  2249. _proto.walk = function walk(callback) {
  2250. return this.each(function (child, i) {
  2251. var result;
  2252. try {
  2253. result = callback(child, i);
  2254. } catch (e) {
  2255. e.postcssNode = child;
  2256. if (e.stack && child.source && /\n\s{4}at /.test(e.stack)) {
  2257. var s = child.source;
  2258. e.stack = e.stack.replace(/\n\s{4}at /, "$&" + s.input.from + ":" + s.start.line + ":" + s.start.column + "$&");
  2259. }
  2260. throw e;
  2261. }
  2262. if (result !== false && child.walk) {
  2263. result = child.walk(callback);
  2264. }
  2265. return result;
  2266. });
  2267. };
  2268. /**
  2269. * Traverses the container’s descendant nodes, calling callback
  2270. * for each declaration node.
  2271. *
  2272. * If you pass a filter, iteration will only happen over declarations
  2273. * with matching properties.
  2274. *
  2275. * Like {@link Container#each}, this method is safe
  2276. * to use if you are mutating arrays during iteration.
  2277. *
  2278. * @param {string|RegExp} [prop] String or regular expression
  2279. * to filter declarations by property name.
  2280. * @param {childIterator} callback Iterator receives each node and index.
  2281. *
  2282. * @return {false|undefined} Returns `false` if iteration was broke.
  2283. *
  2284. * @example
  2285. * root.walkDecls(decl => {
  2286. * checkPropertySupport(decl.prop)
  2287. * })
  2288. *
  2289. * root.walkDecls('border-radius', decl => {
  2290. * decl.remove()
  2291. * })
  2292. *
  2293. * root.walkDecls(/^background/, decl => {
  2294. * decl.value = takeFirstColorFromGradient(decl.value)
  2295. * })
  2296. */
  2297. _proto.walkDecls = function walkDecls(prop, callback) {
  2298. if (!callback) {
  2299. callback = prop;
  2300. return this.walk(function (child, i) {
  2301. if (child.type === 'decl') {
  2302. return callback(child, i);
  2303. }
  2304. });
  2305. }
  2306. if (prop instanceof RegExp) {
  2307. return this.walk(function (child, i) {
  2308. if (child.type === 'decl' && prop.test(child.prop)) {
  2309. return callback(child, i);
  2310. }
  2311. });
  2312. }
  2313. return this.walk(function (child, i) {
  2314. if (child.type === 'decl' && child.prop === prop) {
  2315. return callback(child, i);
  2316. }
  2317. });
  2318. };
  2319. /**
  2320. * Traverses the container’s descendant nodes, calling callback
  2321. * for each rule node.
  2322. *
  2323. * If you pass a filter, iteration will only happen over rules
  2324. * with matching selectors.
  2325. *
  2326. * Like {@link Container#each}, this method is safe
  2327. * to use if you are mutating arrays during iteration.
  2328. *
  2329. * @param {string|RegExp} [selector] String or regular expression
  2330. * to filter rules by selector.
  2331. * @param {childIterator} callback Iterator receives each node and index.
  2332. *
  2333. * @return {false|undefined} returns `false` if iteration was broke.
  2334. *
  2335. * @example
  2336. * const selectors = []
  2337. * root.walkRules(rule => {
  2338. * selectors.push(rule.selector)
  2339. * })
  2340. * console.log(`Your CSS uses ${ selectors.length } selectors`)
  2341. */
  2342. _proto.walkRules = function walkRules(selector, callback) {
  2343. if (!callback) {
  2344. callback = selector;
  2345. return this.walk(function (child, i) {
  2346. if (child.type === 'rule') {
  2347. return callback(child, i);
  2348. }
  2349. });
  2350. }
  2351. if (selector instanceof RegExp) {
  2352. return this.walk(function (child, i) {
  2353. if (child.type === 'rule' && selector.test(child.selector)) {
  2354. return callback(child, i);
  2355. }
  2356. });
  2357. }
  2358. return this.walk(function (child, i) {
  2359. if (child.type === 'rule' && child.selector === selector) {
  2360. return callback(child, i);
  2361. }
  2362. });
  2363. };
  2364. /**
  2365. * Traverses the container’s descendant nodes, calling callback
  2366. * for each at-rule node.
  2367. *
  2368. * If you pass a filter, iteration will only happen over at-rules
  2369. * that have matching names.
  2370. *
  2371. * Like {@link Container#each}, this method is safe
  2372. * to use if you are mutating arrays during iteration.
  2373. *
  2374. * @param {string|RegExp} [name] String or regular expression
  2375. * to filter at-rules by name.
  2376. * @param {childIterator} callback Iterator receives each node and index.
  2377. *
  2378. * @return {false|undefined} Returns `false` if iteration was broke.
  2379. *
  2380. * @example
  2381. * root.walkAtRules(rule => {
  2382. * if (isOld(rule.name)) rule.remove()
  2383. * })
  2384. *
  2385. * let first = false
  2386. * root.walkAtRules('charset', rule => {
  2387. * if (!first) {
  2388. * first = true
  2389. * } else {
  2390. * rule.remove()
  2391. * }
  2392. * })
  2393. */
  2394. _proto.walkAtRules = function walkAtRules(name, callback) {
  2395. if (!callback) {
  2396. callback = name;
  2397. return this.walk(function (child, i) {
  2398. if (child.type === 'atrule') {
  2399. return callback(child, i);
  2400. }
  2401. });
  2402. }
  2403. if (name instanceof RegExp) {
  2404. return this.walk(function (child, i) {
  2405. if (child.type === 'atrule' && name.test(child.name)) {
  2406. return callback(child, i);
  2407. }
  2408. });
  2409. }
  2410. return this.walk(function (child, i) {
  2411. if (child.type === 'atrule' && child.name === name) {
  2412. return callback(child, i);
  2413. }
  2414. });
  2415. };
  2416. /**
  2417. * Traverses the container’s descendant nodes, calling callback
  2418. * for each comment node.
  2419. *
  2420. * Like {@link Container#each}, this method is safe
  2421. * to use if you are mutating arrays during iteration.
  2422. *
  2423. * @param {childIterator} callback Iterator receives each node and index.
  2424. *
  2425. * @return {false|undefined} Returns `false` if iteration was broke.
  2426. *
  2427. * @example
  2428. * root.walkComments(comment => {
  2429. * comment.remove()
  2430. * })
  2431. */
  2432. _proto.walkComments = function walkComments(callback) {
  2433. return this.walk(function (child, i) {
  2434. if (child.type === 'comment') {
  2435. return callback(child, i);
  2436. }
  2437. });
  2438. };
  2439. /**
  2440. * Inserts new nodes to the end of the container.
  2441. *
  2442. * @param {...(Node|object|string|Node[])} children New nodes.
  2443. *
  2444. * @return {Node} This node for methods chain.
  2445. *
  2446. * @example
  2447. * const decl1 = postcss.decl({ prop: 'color', value: 'black' })
  2448. * const decl2 = postcss.decl({ prop: 'background-color', value: 'white' })
  2449. * rule.append(decl1, decl2)
  2450. *
  2451. * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
  2452. * root.append({ selector: 'a' }) // rule
  2453. * rule.append({ prop: 'color', value: 'black' }) // declaration
  2454. * rule.append({ text: 'Comment' }) // comment
  2455. *
  2456. * root.append('a {}')
  2457. * root.first.append('color: black; z-index: 1')
  2458. */
  2459. _proto.append = function append() {
  2460. for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
  2461. children[_key] = arguments[_key];
  2462. }
  2463. for (var _i = 0; _i < children.length; _i++) {
  2464. var child = children[_i];
  2465. var nodes = this.normalize(child, this.last);
  2466. for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  2467. var _ref;
  2468. if (_isArray) {
  2469. if (_i2 >= _iterator.length) break;
  2470. _ref = _iterator[_i2++];
  2471. } else {
  2472. _i2 = _iterator.next();
  2473. if (_i2.done) break;
  2474. _ref = _i2.value;
  2475. }
  2476. var node = _ref;
  2477. this.nodes.push(node);
  2478. }
  2479. }
  2480. return this;
  2481. };
  2482. /**
  2483. * Inserts new nodes to the start of the container.
  2484. *
  2485. * @param {...(Node|object|string|Node[])} children New nodes.
  2486. *
  2487. * @return {Node} This node for methods chain.
  2488. *
  2489. * @example
  2490. * const decl1 = postcss.decl({ prop: 'color', value: 'black' })
  2491. * const decl2 = postcss.decl({ prop: 'background-color', value: 'white' })
  2492. * rule.prepend(decl1, decl2)
  2493. *
  2494. * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
  2495. * root.append({ selector: 'a' }) // rule
  2496. * rule.append({ prop: 'color', value: 'black' }) // declaration
  2497. * rule.append({ text: 'Comment' }) // comment
  2498. *
  2499. * root.append('a {}')
  2500. * root.first.append('color: black; z-index: 1')
  2501. */
  2502. _proto.prepend = function prepend() {
  2503. for (var _len2 = arguments.length, children = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  2504. children[_key2] = arguments[_key2];
  2505. }
  2506. children = children.reverse();
  2507. for (var _iterator2 = children, _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  2508. var _ref2;
  2509. if (_isArray2) {
  2510. if (_i3 >= _iterator2.length) break;
  2511. _ref2 = _iterator2[_i3++];
  2512. } else {
  2513. _i3 = _iterator2.next();
  2514. if (_i3.done) break;
  2515. _ref2 = _i3.value;
  2516. }
  2517. var child = _ref2;
  2518. var nodes = this.normalize(child, this.first, 'prepend').reverse();
  2519. for (var _iterator3 = nodes, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  2520. var _ref3;
  2521. if (_isArray3) {
  2522. if (_i4 >= _iterator3.length) break;
  2523. _ref3 = _iterator3[_i4++];
  2524. } else {
  2525. _i4 = _iterator3.next();
  2526. if (_i4.done) break;
  2527. _ref3 = _i4.value;
  2528. }
  2529. var node = _ref3;
  2530. this.nodes.unshift(node);
  2531. }
  2532. for (var id in this.indexes) {
  2533. this.indexes[id] = this.indexes[id] + nodes.length;
  2534. }
  2535. }
  2536. return this;
  2537. };
  2538. _proto.cleanRaws = function cleanRaws(keepBetween) {
  2539. _Node.prototype.cleanRaws.call(this, keepBetween);
  2540. if (this.nodes) {
  2541. for (var _iterator4 = this.nodes, _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
  2542. var _ref4;
  2543. if (_isArray4) {
  2544. if (_i5 >= _iterator4.length) break;
  2545. _ref4 = _iterator4[_i5++];
  2546. } else {
  2547. _i5 = _iterator4.next();
  2548. if (_i5.done) break;
  2549. _ref4 = _i5.value;
  2550. }
  2551. var node = _ref4;
  2552. node.cleanRaws(keepBetween);
  2553. }
  2554. }
  2555. };
  2556. /**
  2557. * Insert new node before old node within the container.
  2558. *
  2559. * @param {Node|number} exist Child or child’s index.
  2560. * @param {Node|object|string|Node[]} add New node.
  2561. *
  2562. * @return {Node} This node for methods chain.
  2563. *
  2564. * @example
  2565. * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
  2566. */
  2567. _proto.insertBefore = function insertBefore(exist, add) {
  2568. exist = this.index(exist);
  2569. var type = exist === 0 ? 'prepend' : false;
  2570. var nodes = this.normalize(add, this.nodes[exist], type).reverse();
  2571. for (var _iterator5 = nodes, _isArray5 = Array.isArray(_iterator5), _i6 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
  2572. var _ref5;
  2573. if (_isArray5) {
  2574. if (_i6 >= _iterator5.length) break;
  2575. _ref5 = _iterator5[_i6++];
  2576. } else {
  2577. _i6 = _iterator5.next();
  2578. if (_i6.done) break;
  2579. _ref5 = _i6.value;
  2580. }
  2581. var node = _ref5;
  2582. this.nodes.splice(exist, 0, node);
  2583. }
  2584. var index;
  2585. for (var id in this.indexes) {
  2586. index = this.indexes[id];
  2587. if (exist <= index) {
  2588. this.indexes[id] = index + nodes.length;
  2589. }
  2590. }
  2591. return this;
  2592. };
  2593. /**
  2594. * Insert new node after old node within the container.
  2595. *
  2596. * @param {Node|number} exist Child or child’s index.
  2597. * @param {Node|object|string|Node[]} add New node.
  2598. *
  2599. * @return {Node} This node for methods chain.
  2600. */
  2601. _proto.insertAfter = function insertAfter(exist, add) {
  2602. exist = this.index(exist);
  2603. var nodes = this.normalize(add, this.nodes[exist]).reverse();
  2604. for (var _iterator6 = nodes, _isArray6 = Array.isArray(_iterator6), _i7 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
  2605. var _ref6;
  2606. if (_isArray6) {
  2607. if (_i7 >= _iterator6.length) break;
  2608. _ref6 = _iterator6[_i7++];
  2609. } else {
  2610. _i7 = _iterator6.next();
  2611. if (_i7.done) break;
  2612. _ref6 = _i7.value;
  2613. }
  2614. var node = _ref6;
  2615. this.nodes.splice(exist + 1, 0, node);
  2616. }
  2617. var index;
  2618. for (var id in this.indexes) {
  2619. index = this.indexes[id];
  2620. if (exist < index) {
  2621. this.indexes[id] = index + nodes.length;
  2622. }
  2623. }
  2624. return this;
  2625. };
  2626. /**
  2627. * Removes node from the container and cleans the parent properties
  2628. * from the node and its children.
  2629. *
  2630. * @param {Node|number} child Child or child’s index.
  2631. *
  2632. * @return {Node} This node for methods chain
  2633. *
  2634. * @example
  2635. * rule.nodes.length //=> 5
  2636. * rule.removeChild(decl)
  2637. * rule.nodes.length //=> 4
  2638. * decl.parent //=> undefined
  2639. */
  2640. _proto.removeChild = function removeChild(child) {
  2641. child = this.index(child);
  2642. this.nodes[child].parent = undefined;
  2643. this.nodes.splice(child, 1);
  2644. var index;
  2645. for (var id in this.indexes) {
  2646. index = this.indexes[id];
  2647. if (index >= child) {
  2648. this.indexes[id] = index - 1;
  2649. }
  2650. }
  2651. return this;
  2652. };
  2653. /**
  2654. * Removes all children from the container
  2655. * and cleans their parent properties.
  2656. *
  2657. * @return {Node} This node for methods chain.
  2658. *
  2659. * @example
  2660. * rule.removeAll()
  2661. * rule.nodes.length //=> 0
  2662. */
  2663. _proto.removeAll = function removeAll() {
  2664. for (var _iterator7 = this.nodes, _isArray7 = Array.isArray(_iterator7), _i8 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
  2665. var _ref7;
  2666. if (_isArray7) {
  2667. if (_i8 >= _iterator7.length) break;
  2668. _ref7 = _iterator7[_i8++];
  2669. } else {
  2670. _i8 = _iterator7.next();
  2671. if (_i8.done) break;
  2672. _ref7 = _i8.value;
  2673. }
  2674. var node = _ref7;
  2675. node.parent = undefined;
  2676. }
  2677. this.nodes = [];
  2678. return this;
  2679. };
  2680. /**
  2681. * Passes all declaration values within the container that match pattern
  2682. * through callback, replacing those values with the returned result
  2683. * of callback.
  2684. *
  2685. * This method is useful if you are using a custom unit or function
  2686. * and need to iterate through all values.
  2687. *
  2688. * @param {string|RegExp} pattern Replace pattern.
  2689. * @param {object} opts Options to speed up the search.
  2690. * @param {string|string[]} opts.props An array of property names.
  2691. * @param {string} opts.fast String that’s used to narrow down
  2692. * values and speed up the regexp search.
  2693. * @param {function|string} callback String to replace pattern or callback
  2694. * that returns a new value. The callback
  2695. * will receive the same arguments
  2696. * as those passed to a function parameter
  2697. * of `String#replace`.
  2698. *
  2699. * @return {Node} This node for methods chain.
  2700. *
  2701. * @example
  2702. * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
  2703. * return 15 * parseInt(string) + 'px'
  2704. * })
  2705. */
  2706. _proto.replaceValues = function replaceValues(pattern, opts, callback) {
  2707. if (!callback) {
  2708. callback = opts;
  2709. opts = {};
  2710. }
  2711. this.walkDecls(function (decl) {
  2712. if (opts.props && opts.props.indexOf(decl.prop) === -1) return;
  2713. if (opts.fast && decl.value.indexOf(opts.fast) === -1) return;
  2714. decl.value = decl.value.replace(pattern, callback);
  2715. });
  2716. return this;
  2717. };
  2718. /**
  2719. * Returns `true` if callback returns `true`
  2720. * for all of the container’s children.
  2721. *
  2722. * @param {childCondition} condition Iterator returns true or false.
  2723. *
  2724. * @return {boolean} Is every child pass condition.
  2725. *
  2726. * @example
  2727. * const noPrefixes = rule.every(i => i.prop[0] !== '-')
  2728. */
  2729. _proto.every = function every(condition) {
  2730. return this.nodes.every(condition);
  2731. };
  2732. /**
  2733. * Returns `true` if callback returns `true` for (at least) one
  2734. * of the container’s children.
  2735. *
  2736. * @param {childCondition} condition Iterator returns true or false.
  2737. *
  2738. * @return {boolean} Is some child pass condition.
  2739. *
  2740. * @example
  2741. * const hasPrefix = rule.some(i => i.prop[0] === '-')
  2742. */
  2743. _proto.some = function some(condition) {
  2744. return this.nodes.some(condition);
  2745. };
  2746. /**
  2747. * Returns a `child`’s index within the {@link Container#nodes} array.
  2748. *
  2749. * @param {Node} child Child of the current container.
  2750. *
  2751. * @return {number} Child index.
  2752. *
  2753. * @example
  2754. * rule.index( rule.nodes[2] ) //=> 2
  2755. */
  2756. _proto.index = function index(child) {
  2757. if (typeof child === 'number') {
  2758. return child;
  2759. }
  2760. return this.nodes.indexOf(child);
  2761. };
  2762. /**
  2763. * The container’s first child.
  2764. *
  2765. * @type {Node}
  2766. *
  2767. * @example
  2768. * rule.first === rules.nodes[0]
  2769. */
  2770. _proto.normalize = function normalize(nodes, sample) {
  2771. var _this = this;
  2772. if (typeof nodes === 'string') {
  2773. var parse = __webpack_require__(69);
  2774. nodes = cleanSource(parse(nodes).nodes);
  2775. } else if (Array.isArray(nodes)) {
  2776. nodes = nodes.slice(0);
  2777. for (var _iterator8 = nodes, _isArray8 = Array.isArray(_iterator8), _i9 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
  2778. var _ref8;
  2779. if (_isArray8) {
  2780. if (_i9 >= _iterator8.length) break;
  2781. _ref8 = _iterator8[_i9++];
  2782. } else {
  2783. _i9 = _iterator8.next();
  2784. if (_i9.done) break;
  2785. _ref8 = _i9.value;
  2786. }
  2787. var i = _ref8;
  2788. if (i.parent) i.parent.removeChild(i, 'ignore');
  2789. }
  2790. } else if (nodes.type === 'root') {
  2791. nodes = nodes.nodes.slice(0);
  2792. for (var _iterator9 = nodes, _isArray9 = Array.isArray(_iterator9), _i10 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
  2793. var _ref9;
  2794. if (_isArray9) {
  2795. if (_i10 >= _iterator9.length) break;
  2796. _ref9 = _iterator9[_i10++];
  2797. } else {
  2798. _i10 = _iterator9.next();
  2799. if (_i10.done) break;
  2800. _ref9 = _i10.value;
  2801. }
  2802. var _i11 = _ref9;
  2803. if (_i11.parent) _i11.parent.removeChild(_i11, 'ignore');
  2804. }
  2805. } else if (nodes.type) {
  2806. nodes = [nodes];
  2807. } else if (nodes.prop) {
  2808. if (typeof nodes.value === 'undefined') {
  2809. throw new Error('Value field is missed in node creation');
  2810. } else if (typeof nodes.value !== 'string') {
  2811. nodes.value = String(nodes.value);
  2812. }
  2813. nodes = [new _declaration.default(nodes)];
  2814. } else if (nodes.selector) {
  2815. var Rule = __webpack_require__(70);
  2816. nodes = [new Rule(nodes)];
  2817. } else if (nodes.name) {
  2818. var AtRule = __webpack_require__(68);
  2819. nodes = [new AtRule(nodes)];
  2820. } else if (nodes.text) {
  2821. nodes = [new _comment.default(nodes)];
  2822. } else {
  2823. throw new Error('Unknown node type in node creation');
  2824. }
  2825. var processed = nodes.map(function (i) {
  2826. if (i.parent) i.parent.removeChild(i);
  2827. if (typeof i.raws.before === 'undefined') {
  2828. if (sample && typeof sample.raws.before !== 'undefined') {
  2829. i.raws.before = sample.raws.before.replace(/[^\s]/g, '');
  2830. }
  2831. }
  2832. i.parent = _this;
  2833. return i;
  2834. });
  2835. return processed;
  2836. };
  2837. /**
  2838. * @memberof Container#
  2839. * @member {Node[]} nodes An array containing the container’s children.
  2840. *
  2841. * @example
  2842. * const root = postcss.parse('a { color: black }')
  2843. * root.nodes.length //=> 1
  2844. * root.nodes[0].selector //=> 'a'
  2845. * root.nodes[0].nodes[0].prop //=> 'color'
  2846. */
  2847. _createClass(Container, [{
  2848. key: "first",
  2849. get: function get() {
  2850. if (!this.nodes) return undefined;
  2851. return this.nodes[0];
  2852. }
  2853. /**
  2854. * The container’s last child.
  2855. *
  2856. * @type {Node}
  2857. *
  2858. * @example
  2859. * rule.last === rule.nodes[rule.nodes.length - 1]
  2860. */
  2861. }, {
  2862. key: "last",
  2863. get: function get() {
  2864. if (!this.nodes) return undefined;
  2865. return this.nodes[this.nodes.length - 1];
  2866. }
  2867. }]);
  2868. return Container;
  2869. }(_node.default);
  2870. var _default = Container;
  2871. /**
  2872. * @callback childCondition
  2873. * @param {Node} node Container child.
  2874. * @param {number} index Child index.
  2875. * @param {Node[]} nodes All container children.
  2876. * @return {boolean}
  2877. */
  2878. /**
  2879. * @callback childIterator
  2880. * @param {Node} node Container child.
  2881. * @param {number} index Child index.
  2882. * @return {false|undefined} Returning `false` will break iteration.
  2883. */
  2884. exports.default = _default;
  2885. module.exports = exports.default;
  2886. /***/ }),
  2887. /* 14 */
  2888. /***/ (function(module, exports, __webpack_require__) {
  2889. "use strict";
  2890. Object.defineProperty(exports, "__esModule", {
  2891. value: true
  2892. });
  2893. exports.default = lessStringify;
  2894. var _lessStringifier = __webpack_require__(163);
  2895. var _lessStringifier2 = _interopRequireDefault(_lessStringifier);
  2896. function _interopRequireDefault(obj) {
  2897. return obj && obj.__esModule ? obj : {
  2898. default: obj
  2899. };
  2900. }
  2901. function lessStringify(node, builder) {
  2902. var str = new _lessStringifier2.default(builder);
  2903. str.stringify(node);
  2904. }
  2905. module.exports = exports['default'];
  2906. /***/ }),
  2907. /* 15 */
  2908. /***/ (function(module, exports) {
  2909. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2910. var g; // This works in non-strict mode
  2911. g = function () {
  2912. return this;
  2913. }();
  2914. try {
  2915. // This works if eval is allowed (see CSP)
  2916. g = g || Function("return this")() || (1, eval)("this");
  2917. } catch (e) {
  2918. // This works if the window reference is available
  2919. if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
  2920. } // g can still be undefined, but nothing to do about it...
  2921. // We return undefined, instead of nothing here, so it's
  2922. // easier to handle this case. if(!global) { ...}
  2923. module.exports = g;
  2924. /***/ }),
  2925. /* 16 */
  2926. /***/ (function(module, exports, __webpack_require__) {
  2927. "use strict";
  2928. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2929. exports.__esModule = true;
  2930. var _createClass = function () {
  2931. function defineProperties(target, props) {
  2932. for (var i = 0; i < props.length; i++) {
  2933. var descriptor = props[i];
  2934. descriptor.enumerable = descriptor.enumerable || false;
  2935. descriptor.configurable = true;
  2936. if ("value" in descriptor) descriptor.writable = true;
  2937. Object.defineProperty(target, descriptor.key, descriptor);
  2938. }
  2939. }
  2940. return function (Constructor, protoProps, staticProps) {
  2941. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  2942. if (staticProps) defineProperties(Constructor, staticProps);
  2943. return Constructor;
  2944. };
  2945. }();
  2946. var _node = __webpack_require__(5);
  2947. var _node2 = _interopRequireDefault(_node);
  2948. var _types = __webpack_require__(0);
  2949. var types = _interopRequireWildcard(_types);
  2950. function _interopRequireWildcard(obj) {
  2951. if (obj && obj.__esModule) {
  2952. return obj;
  2953. } else {
  2954. var newObj = {};
  2955. if (obj != null) {
  2956. for (var key in obj) {
  2957. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  2958. }
  2959. }
  2960. newObj.default = obj;
  2961. return newObj;
  2962. }
  2963. }
  2964. function _interopRequireDefault(obj) {
  2965. return obj && obj.__esModule ? obj : {
  2966. default: obj
  2967. };
  2968. }
  2969. function _classCallCheck(instance, Constructor) {
  2970. if (!(instance instanceof Constructor)) {
  2971. throw new TypeError("Cannot call a class as a function");
  2972. }
  2973. }
  2974. function _possibleConstructorReturn(self, call) {
  2975. if (!self) {
  2976. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  2977. }
  2978. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  2979. }
  2980. function _inherits(subClass, superClass) {
  2981. if (typeof superClass !== "function" && superClass !== null) {
  2982. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  2983. }
  2984. subClass.prototype = Object.create(superClass && superClass.prototype, {
  2985. constructor: {
  2986. value: subClass,
  2987. enumerable: false,
  2988. writable: true,
  2989. configurable: true
  2990. }
  2991. });
  2992. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  2993. }
  2994. var Container = function (_Node) {
  2995. _inherits(Container, _Node);
  2996. function Container(opts) {
  2997. _classCallCheck(this, Container);
  2998. var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
  2999. if (!_this.nodes) {
  3000. _this.nodes = [];
  3001. }
  3002. return _this;
  3003. }
  3004. Container.prototype.append = function append(selector) {
  3005. selector.parent = this;
  3006. this.nodes.push(selector);
  3007. return this;
  3008. };
  3009. Container.prototype.prepend = function prepend(selector) {
  3010. selector.parent = this;
  3011. this.nodes.unshift(selector);
  3012. return this;
  3013. };
  3014. Container.prototype.at = function at(index) {
  3015. return this.nodes[index];
  3016. };
  3017. Container.prototype.index = function index(child) {
  3018. if (typeof child === 'number') {
  3019. return child;
  3020. }
  3021. return this.nodes.indexOf(child);
  3022. };
  3023. Container.prototype.removeChild = function removeChild(child) {
  3024. child = this.index(child);
  3025. this.at(child).parent = undefined;
  3026. this.nodes.splice(child, 1);
  3027. var index = void 0;
  3028. for (var id in this.indexes) {
  3029. index = this.indexes[id];
  3030. if (index >= child) {
  3031. this.indexes[id] = index - 1;
  3032. }
  3033. }
  3034. return this;
  3035. };
  3036. Container.prototype.removeAll = function removeAll() {
  3037. for (var _iterator = this.nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  3038. var _ref;
  3039. if (_isArray) {
  3040. if (_i >= _iterator.length) break;
  3041. _ref = _iterator[_i++];
  3042. } else {
  3043. _i = _iterator.next();
  3044. if (_i.done) break;
  3045. _ref = _i.value;
  3046. }
  3047. var node = _ref;
  3048. node.parent = undefined;
  3049. }
  3050. this.nodes = [];
  3051. return this;
  3052. };
  3053. Container.prototype.empty = function empty() {
  3054. return this.removeAll();
  3055. };
  3056. Container.prototype.insertAfter = function insertAfter(oldNode, newNode) {
  3057. var oldIndex = this.index(oldNode);
  3058. this.nodes.splice(oldIndex + 1, 0, newNode);
  3059. var index = void 0;
  3060. for (var id in this.indexes) {
  3061. index = this.indexes[id];
  3062. if (oldIndex <= index) {
  3063. this.indexes[id] = index + this.nodes.length;
  3064. }
  3065. }
  3066. return this;
  3067. };
  3068. Container.prototype.insertBefore = function insertBefore(oldNode, newNode) {
  3069. var oldIndex = this.index(oldNode);
  3070. this.nodes.splice(oldIndex, 0, newNode);
  3071. var index = void 0;
  3072. for (var id in this.indexes) {
  3073. index = this.indexes[id];
  3074. if (oldIndex <= index) {
  3075. this.indexes[id] = index + this.nodes.length;
  3076. }
  3077. }
  3078. return this;
  3079. };
  3080. Container.prototype.each = function each(callback) {
  3081. if (!this.lastEach) {
  3082. this.lastEach = 0;
  3083. }
  3084. if (!this.indexes) {
  3085. this.indexes = {};
  3086. }
  3087. this.lastEach++;
  3088. var id = this.lastEach;
  3089. this.indexes[id] = 0;
  3090. if (!this.length) {
  3091. return undefined;
  3092. }
  3093. var index = void 0,
  3094. result = void 0;
  3095. while (this.indexes[id] < this.length) {
  3096. index = this.indexes[id];
  3097. result = callback(this.at(index), index);
  3098. if (result === false) {
  3099. break;
  3100. }
  3101. this.indexes[id] += 1;
  3102. }
  3103. delete this.indexes[id];
  3104. if (result === false) {
  3105. return false;
  3106. }
  3107. };
  3108. Container.prototype.walk = function walk(callback) {
  3109. return this.each(function (node, i) {
  3110. var result = callback(node, i);
  3111. if (result !== false && node.length) {
  3112. result = node.walk(callback);
  3113. }
  3114. if (result === false) {
  3115. return false;
  3116. }
  3117. });
  3118. };
  3119. Container.prototype.walkAttributes = function walkAttributes(callback) {
  3120. var _this2 = this;
  3121. return this.walk(function (selector) {
  3122. if (selector.type === types.ATTRIBUTE) {
  3123. return callback.call(_this2, selector);
  3124. }
  3125. });
  3126. };
  3127. Container.prototype.walkClasses = function walkClasses(callback) {
  3128. var _this3 = this;
  3129. return this.walk(function (selector) {
  3130. if (selector.type === types.CLASS) {
  3131. return callback.call(_this3, selector);
  3132. }
  3133. });
  3134. };
  3135. Container.prototype.walkCombinators = function walkCombinators(callback) {
  3136. var _this4 = this;
  3137. return this.walk(function (selector) {
  3138. if (selector.type === types.COMBINATOR) {
  3139. return callback.call(_this4, selector);
  3140. }
  3141. });
  3142. };
  3143. Container.prototype.walkComments = function walkComments(callback) {
  3144. var _this5 = this;
  3145. return this.walk(function (selector) {
  3146. if (selector.type === types.COMMENT) {
  3147. return callback.call(_this5, selector);
  3148. }
  3149. });
  3150. };
  3151. Container.prototype.walkIds = function walkIds(callback) {
  3152. var _this6 = this;
  3153. return this.walk(function (selector) {
  3154. if (selector.type === types.ID) {
  3155. return callback.call(_this6, selector);
  3156. }
  3157. });
  3158. };
  3159. Container.prototype.walkNesting = function walkNesting(callback) {
  3160. var _this7 = this;
  3161. return this.walk(function (selector) {
  3162. if (selector.type === types.NESTING) {
  3163. return callback.call(_this7, selector);
  3164. }
  3165. });
  3166. };
  3167. Container.prototype.walkPseudos = function walkPseudos(callback) {
  3168. var _this8 = this;
  3169. return this.walk(function (selector) {
  3170. if (selector.type === types.PSEUDO) {
  3171. return callback.call(_this8, selector);
  3172. }
  3173. });
  3174. };
  3175. Container.prototype.walkTags = function walkTags(callback) {
  3176. var _this9 = this;
  3177. return this.walk(function (selector) {
  3178. if (selector.type === types.TAG) {
  3179. return callback.call(_this9, selector);
  3180. }
  3181. });
  3182. };
  3183. Container.prototype.walkUniversals = function walkUniversals(callback) {
  3184. var _this10 = this;
  3185. return this.walk(function (selector) {
  3186. if (selector.type === types.UNIVERSAL) {
  3187. return callback.call(_this10, selector);
  3188. }
  3189. });
  3190. };
  3191. Container.prototype.split = function split(callback) {
  3192. var _this11 = this;
  3193. var current = [];
  3194. return this.reduce(function (memo, node, index) {
  3195. var split = callback.call(_this11, node);
  3196. current.push(node);
  3197. if (split) {
  3198. memo.push(current);
  3199. current = [];
  3200. } else if (index === _this11.length - 1) {
  3201. memo.push(current);
  3202. }
  3203. return memo;
  3204. }, []);
  3205. };
  3206. Container.prototype.map = function map(callback) {
  3207. return this.nodes.map(callback);
  3208. };
  3209. Container.prototype.reduce = function reduce(callback, memo) {
  3210. return this.nodes.reduce(callback, memo);
  3211. };
  3212. Container.prototype.every = function every(callback) {
  3213. return this.nodes.every(callback);
  3214. };
  3215. Container.prototype.some = function some(callback) {
  3216. return this.nodes.some(callback);
  3217. };
  3218. Container.prototype.filter = function filter(callback) {
  3219. return this.nodes.filter(callback);
  3220. };
  3221. Container.prototype.sort = function sort(callback) {
  3222. return this.nodes.sort(callback);
  3223. };
  3224. Container.prototype.toString = function toString() {
  3225. return this.map(String).join('');
  3226. };
  3227. _createClass(Container, [{
  3228. key: 'first',
  3229. get: function get() {
  3230. return this.at(0);
  3231. }
  3232. }, {
  3233. key: 'last',
  3234. get: function get() {
  3235. return this.at(this.length - 1);
  3236. }
  3237. }, {
  3238. key: 'length',
  3239. get: function get() {
  3240. return this.nodes.length;
  3241. }
  3242. }]);
  3243. return Container;
  3244. }(_node2.default);
  3245. exports.default = Container;
  3246. module.exports = exports['default'];
  3247. /***/ }),
  3248. /* 17 */
  3249. /***/ (function(module, exports, __webpack_require__) {
  3250. "use strict";
  3251. exports.__esModule = true;
  3252. exports.default = void 0;
  3253. var DEFAULT_RAW = {
  3254. colon: ': ',
  3255. indent: ' ',
  3256. beforeDecl: '\n',
  3257. beforeRule: '\n',
  3258. beforeOpen: ' ',
  3259. beforeClose: '\n',
  3260. beforeComment: '\n',
  3261. after: '\n',
  3262. emptyBody: '',
  3263. commentLeft: ' ',
  3264. commentRight: ' '
  3265. };
  3266. function capitalize(str) {
  3267. return str[0].toUpperCase() + str.slice(1);
  3268. }
  3269. var Stringifier =
  3270. /*#__PURE__*/
  3271. function () {
  3272. function Stringifier(builder) {
  3273. this.builder = builder;
  3274. }
  3275. var _proto = Stringifier.prototype;
  3276. _proto.stringify = function stringify(node, semicolon) {
  3277. this[node.type](node, semicolon);
  3278. };
  3279. _proto.root = function root(node) {
  3280. this.body(node);
  3281. if (node.raws.after) this.builder(node.raws.after);
  3282. };
  3283. _proto.comment = function comment(node) {
  3284. var left = this.raw(node, 'left', 'commentLeft');
  3285. var right = this.raw(node, 'right', 'commentRight');
  3286. this.builder('/*' + left + node.text + right + '*/', node);
  3287. };
  3288. _proto.decl = function decl(node, semicolon) {
  3289. var between = this.raw(node, 'between', 'colon');
  3290. var string = node.prop + between + this.rawValue(node, 'value');
  3291. if (node.important) {
  3292. string += node.raws.important || ' !important';
  3293. }
  3294. if (semicolon) string += ';';
  3295. this.builder(string, node);
  3296. };
  3297. _proto.rule = function rule(node) {
  3298. this.block(node, this.rawValue(node, 'selector'));
  3299. if (node.raws.ownSemicolon) {
  3300. this.builder(node.raws.ownSemicolon, node, 'end');
  3301. }
  3302. };
  3303. _proto.atrule = function atrule(node, semicolon) {
  3304. var name = '@' + node.name;
  3305. var params = node.params ? this.rawValue(node, 'params') : '';
  3306. if (typeof node.raws.afterName !== 'undefined') {
  3307. name += node.raws.afterName;
  3308. } else if (params) {
  3309. name += ' ';
  3310. }
  3311. if (node.nodes) {
  3312. this.block(node, name + params);
  3313. } else {
  3314. var end = (node.raws.between || '') + (semicolon ? ';' : '');
  3315. this.builder(name + params + end, node);
  3316. }
  3317. };
  3318. _proto.body = function body(node) {
  3319. var last = node.nodes.length - 1;
  3320. while (last > 0) {
  3321. if (node.nodes[last].type !== 'comment') break;
  3322. last -= 1;
  3323. }
  3324. var semicolon = this.raw(node, 'semicolon');
  3325. for (var i = 0; i < node.nodes.length; i++) {
  3326. var child = node.nodes[i];
  3327. var before = this.raw(child, 'before');
  3328. if (before) this.builder(before);
  3329. this.stringify(child, last !== i || semicolon);
  3330. }
  3331. };
  3332. _proto.block = function block(node, start) {
  3333. var between = this.raw(node, 'between', 'beforeOpen');
  3334. this.builder(start + between + '{', node, 'start');
  3335. var after;
  3336. if (node.nodes && node.nodes.length) {
  3337. this.body(node);
  3338. after = this.raw(node, 'after');
  3339. } else {
  3340. after = this.raw(node, 'after', 'emptyBody');
  3341. }
  3342. if (after) this.builder(after);
  3343. this.builder('}', node, 'end');
  3344. };
  3345. _proto.raw = function raw(node, own, detect) {
  3346. var value;
  3347. if (!detect) detect = own; // Already had
  3348. if (own) {
  3349. value = node.raws[own];
  3350. if (typeof value !== 'undefined') return value;
  3351. }
  3352. var parent = node.parent; // Hack for first rule in CSS
  3353. if (detect === 'before') {
  3354. if (!parent || parent.type === 'root' && parent.first === node) {
  3355. return '';
  3356. }
  3357. } // Floating child without parent
  3358. if (!parent) return DEFAULT_RAW[detect]; // Detect style by other nodes
  3359. var root = node.root();
  3360. if (!root.rawCache) root.rawCache = {};
  3361. if (typeof root.rawCache[detect] !== 'undefined') {
  3362. return root.rawCache[detect];
  3363. }
  3364. if (detect === 'before' || detect === 'after') {
  3365. return this.beforeAfter(node, detect);
  3366. } else {
  3367. var method = 'raw' + capitalize(detect);
  3368. if (this[method]) {
  3369. value = this[method](root, node);
  3370. } else {
  3371. root.walk(function (i) {
  3372. value = i.raws[own];
  3373. if (typeof value !== 'undefined') return false;
  3374. });
  3375. }
  3376. }
  3377. if (typeof value === 'undefined') value = DEFAULT_RAW[detect];
  3378. root.rawCache[detect] = value;
  3379. return value;
  3380. };
  3381. _proto.rawSemicolon = function rawSemicolon(root) {
  3382. var value;
  3383. root.walk(function (i) {
  3384. if (i.nodes && i.nodes.length && i.last.type === 'decl') {
  3385. value = i.raws.semicolon;
  3386. if (typeof value !== 'undefined') return false;
  3387. }
  3388. });
  3389. return value;
  3390. };
  3391. _proto.rawEmptyBody = function rawEmptyBody(root) {
  3392. var value;
  3393. root.walk(function (i) {
  3394. if (i.nodes && i.nodes.length === 0) {
  3395. value = i.raws.after;
  3396. if (typeof value !== 'undefined') return false;
  3397. }
  3398. });
  3399. return value;
  3400. };
  3401. _proto.rawIndent = function rawIndent(root) {
  3402. if (root.raws.indent) return root.raws.indent;
  3403. var value;
  3404. root.walk(function (i) {
  3405. var p = i.parent;
  3406. if (p && p !== root && p.parent && p.parent === root) {
  3407. if (typeof i.raws.before !== 'undefined') {
  3408. var parts = i.raws.before.split('\n');
  3409. value = parts[parts.length - 1];
  3410. value = value.replace(/[^\s]/g, '');
  3411. return false;
  3412. }
  3413. }
  3414. });
  3415. return value;
  3416. };
  3417. _proto.rawBeforeComment = function rawBeforeComment(root, node) {
  3418. var value;
  3419. root.walkComments(function (i) {
  3420. if (typeof i.raws.before !== 'undefined') {
  3421. value = i.raws.before;
  3422. if (value.indexOf('\n') !== -1) {
  3423. value = value.replace(/[^\n]+$/, '');
  3424. }
  3425. return false;
  3426. }
  3427. });
  3428. if (typeof value === 'undefined') {
  3429. value = this.raw(node, null, 'beforeDecl');
  3430. } else if (value) {
  3431. value = value.replace(/[^\s]/g, '');
  3432. }
  3433. return value;
  3434. };
  3435. _proto.rawBeforeDecl = function rawBeforeDecl(root, node) {
  3436. var value;
  3437. root.walkDecls(function (i) {
  3438. if (typeof i.raws.before !== 'undefined') {
  3439. value = i.raws.before;
  3440. if (value.indexOf('\n') !== -1) {
  3441. value = value.replace(/[^\n]+$/, '');
  3442. }
  3443. return false;
  3444. }
  3445. });
  3446. if (typeof value === 'undefined') {
  3447. value = this.raw(node, null, 'beforeRule');
  3448. } else if (value) {
  3449. value = value.replace(/[^\s]/g, '');
  3450. }
  3451. return value;
  3452. };
  3453. _proto.rawBeforeRule = function rawBeforeRule(root) {
  3454. var value;
  3455. root.walk(function (i) {
  3456. if (i.nodes && (i.parent !== root || root.first !== i)) {
  3457. if (typeof i.raws.before !== 'undefined') {
  3458. value = i.raws.before;
  3459. if (value.indexOf('\n') !== -1) {
  3460. value = value.replace(/[^\n]+$/, '');
  3461. }
  3462. return false;
  3463. }
  3464. }
  3465. });
  3466. if (value) value = value.replace(/[^\s]/g, '');
  3467. return value;
  3468. };
  3469. _proto.rawBeforeClose = function rawBeforeClose(root) {
  3470. var value;
  3471. root.walk(function (i) {
  3472. if (i.nodes && i.nodes.length > 0) {
  3473. if (typeof i.raws.after !== 'undefined') {
  3474. value = i.raws.after;
  3475. if (value.indexOf('\n') !== -1) {
  3476. value = value.replace(/[^\n]+$/, '');
  3477. }
  3478. return false;
  3479. }
  3480. }
  3481. });
  3482. if (value) value = value.replace(/[^\s]/g, '');
  3483. return value;
  3484. };
  3485. _proto.rawBeforeOpen = function rawBeforeOpen(root) {
  3486. var value;
  3487. root.walk(function (i) {
  3488. if (i.type !== 'decl') {
  3489. value = i.raws.between;
  3490. if (typeof value !== 'undefined') return false;
  3491. }
  3492. });
  3493. return value;
  3494. };
  3495. _proto.rawColon = function rawColon(root) {
  3496. var value;
  3497. root.walkDecls(function (i) {
  3498. if (typeof i.raws.between !== 'undefined') {
  3499. value = i.raws.between.replace(/[^\s:]/g, '');
  3500. return false;
  3501. }
  3502. });
  3503. return value;
  3504. };
  3505. _proto.beforeAfter = function beforeAfter(node, detect) {
  3506. var value;
  3507. if (node.type === 'decl') {
  3508. value = this.raw(node, null, 'beforeDecl');
  3509. } else if (node.type === 'comment') {
  3510. value = this.raw(node, null, 'beforeComment');
  3511. } else if (detect === 'before') {
  3512. value = this.raw(node, null, 'beforeRule');
  3513. } else {
  3514. value = this.raw(node, null, 'beforeClose');
  3515. }
  3516. var buf = node.parent;
  3517. var depth = 0;
  3518. while (buf && buf.type !== 'root') {
  3519. depth += 1;
  3520. buf = buf.parent;
  3521. }
  3522. if (value.indexOf('\n') !== -1) {
  3523. var indent = this.raw(node, null, 'indent');
  3524. if (indent.length) {
  3525. for (var step = 0; step < depth; step++) {
  3526. value += indent;
  3527. }
  3528. }
  3529. }
  3530. return value;
  3531. };
  3532. _proto.rawValue = function rawValue(node, prop) {
  3533. var value = node[prop];
  3534. var raw = node.raws[prop];
  3535. if (raw && raw.value === value) {
  3536. return raw.raw;
  3537. }
  3538. return value;
  3539. };
  3540. return Stringifier;
  3541. }();
  3542. var _default = Stringifier;
  3543. exports.default = _default;
  3544. module.exports = exports.default;
  3545. /***/ }),
  3546. /* 18 */
  3547. /***/ (function(module, exports, __webpack_require__) {
  3548. "use strict";
  3549. /* WEBPACK VAR INJECTION */(function(global) {/*!
  3550. * The buffer module from node.js, for the browser.
  3551. *
  3552. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  3553. * @license MIT
  3554. */
  3555. /* eslint-disable no-proto */
  3556. var base64 = __webpack_require__(121);
  3557. var ieee754 = __webpack_require__(122);
  3558. var isArray = __webpack_require__(123);
  3559. exports.Buffer = Buffer;
  3560. exports.SlowBuffer = SlowBuffer;
  3561. exports.INSPECT_MAX_BYTES = 50;
  3562. /**
  3563. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  3564. * === true Use Uint8Array implementation (fastest)
  3565. * === false Use Object implementation (most compatible, even IE6)
  3566. *
  3567. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  3568. * Opera 11.6+, iOS 4.2+.
  3569. *
  3570. * Due to various browser bugs, sometimes the Object implementation will be used even
  3571. * when the browser supports typed arrays.
  3572. *
  3573. * Note:
  3574. *
  3575. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  3576. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  3577. *
  3578. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  3579. *
  3580. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  3581. * incorrect length in some situations.
  3582. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  3583. * get the Object implementation, which is slower but behaves correctly.
  3584. */
  3585. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport();
  3586. /*
  3587. * Export kMaxLength after typed array support is determined.
  3588. */
  3589. exports.kMaxLength = kMaxLength();
  3590. function typedArraySupport() {
  3591. try {
  3592. var arr = new Uint8Array(1);
  3593. arr.__proto__ = {
  3594. __proto__: Uint8Array.prototype,
  3595. foo: function foo() {
  3596. return 42;
  3597. }
  3598. };
  3599. return arr.foo() === 42 && // typed array instances can be augmented
  3600. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  3601. arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray`
  3602. } catch (e) {
  3603. return false;
  3604. }
  3605. }
  3606. function kMaxLength() {
  3607. return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
  3608. }
  3609. function createBuffer(that, length) {
  3610. if (kMaxLength() < length) {
  3611. throw new RangeError('Invalid typed array length');
  3612. }
  3613. if (Buffer.TYPED_ARRAY_SUPPORT) {
  3614. // Return an augmented `Uint8Array` instance, for best performance
  3615. that = new Uint8Array(length);
  3616. that.__proto__ = Buffer.prototype;
  3617. } else {
  3618. // Fallback: Return an object instance of the Buffer class
  3619. if (that === null) {
  3620. that = new Buffer(length);
  3621. }
  3622. that.length = length;
  3623. }
  3624. return that;
  3625. }
  3626. /**
  3627. * The Buffer constructor returns instances of `Uint8Array` that have their
  3628. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  3629. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  3630. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  3631. * returns a single octet.
  3632. *
  3633. * The `Uint8Array` prototype remains unmodified.
  3634. */
  3635. function Buffer(arg, encodingOrOffset, length) {
  3636. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  3637. return new Buffer(arg, encodingOrOffset, length);
  3638. } // Common case.
  3639. if (typeof arg === 'number') {
  3640. if (typeof encodingOrOffset === 'string') {
  3641. throw new Error('If encoding is specified then the first argument must be a string');
  3642. }
  3643. return allocUnsafe(this, arg);
  3644. }
  3645. return from(this, arg, encodingOrOffset, length);
  3646. }
  3647. Buffer.poolSize = 8192; // not used by this implementation
  3648. // TODO: Legacy, not needed anymore. Remove in next major version.
  3649. Buffer._augment = function (arr) {
  3650. arr.__proto__ = Buffer.prototype;
  3651. return arr;
  3652. };
  3653. function from(that, value, encodingOrOffset, length) {
  3654. if (typeof value === 'number') {
  3655. throw new TypeError('"value" argument must not be a number');
  3656. }
  3657. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  3658. return fromArrayBuffer(that, value, encodingOrOffset, length);
  3659. }
  3660. if (typeof value === 'string') {
  3661. return fromString(that, value, encodingOrOffset);
  3662. }
  3663. return fromObject(that, value);
  3664. }
  3665. /**
  3666. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  3667. * if value is a number.
  3668. * Buffer.from(str[, encoding])
  3669. * Buffer.from(array)
  3670. * Buffer.from(buffer)
  3671. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  3672. **/
  3673. Buffer.from = function (value, encodingOrOffset, length) {
  3674. return from(null, value, encodingOrOffset, length);
  3675. };
  3676. if (Buffer.TYPED_ARRAY_SUPPORT) {
  3677. Buffer.prototype.__proto__ = Uint8Array.prototype;
  3678. Buffer.__proto__ = Uint8Array;
  3679. if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) {
  3680. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  3681. Object.defineProperty(Buffer, Symbol.species, {
  3682. value: null,
  3683. configurable: true
  3684. });
  3685. }
  3686. }
  3687. function assertSize(size) {
  3688. if (typeof size !== 'number') {
  3689. throw new TypeError('"size" argument must be a number');
  3690. } else if (size < 0) {
  3691. throw new RangeError('"size" argument must not be negative');
  3692. }
  3693. }
  3694. function alloc(that, size, fill, encoding) {
  3695. assertSize(size);
  3696. if (size <= 0) {
  3697. return createBuffer(that, size);
  3698. }
  3699. if (fill !== undefined) {
  3700. // Only pay attention to encoding if it's a string. This
  3701. // prevents accidentally sending in a number that would
  3702. // be interpretted as a start offset.
  3703. return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
  3704. }
  3705. return createBuffer(that, size);
  3706. }
  3707. /**
  3708. * Creates a new filled Buffer instance.
  3709. * alloc(size[, fill[, encoding]])
  3710. **/
  3711. Buffer.alloc = function (size, fill, encoding) {
  3712. return alloc(null, size, fill, encoding);
  3713. };
  3714. function allocUnsafe(that, size) {
  3715. assertSize(size);
  3716. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
  3717. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  3718. for (var i = 0; i < size; ++i) {
  3719. that[i] = 0;
  3720. }
  3721. }
  3722. return that;
  3723. }
  3724. /**
  3725. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  3726. * */
  3727. Buffer.allocUnsafe = function (size) {
  3728. return allocUnsafe(null, size);
  3729. };
  3730. /**
  3731. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  3732. */
  3733. Buffer.allocUnsafeSlow = function (size) {
  3734. return allocUnsafe(null, size);
  3735. };
  3736. function fromString(that, string, encoding) {
  3737. if (typeof encoding !== 'string' || encoding === '') {
  3738. encoding = 'utf8';
  3739. }
  3740. if (!Buffer.isEncoding(encoding)) {
  3741. throw new TypeError('"encoding" must be a valid string encoding');
  3742. }
  3743. var length = byteLength(string, encoding) | 0;
  3744. that = createBuffer(that, length);
  3745. var actual = that.write(string, encoding);
  3746. if (actual !== length) {
  3747. // Writing a hex string, for example, that contains invalid characters will
  3748. // cause everything after the first invalid character to be ignored. (e.g.
  3749. // 'abxxcd' will be treated as 'ab')
  3750. that = that.slice(0, actual);
  3751. }
  3752. return that;
  3753. }
  3754. function fromArrayLike(that, array) {
  3755. var length = array.length < 0 ? 0 : checked(array.length) | 0;
  3756. that = createBuffer(that, length);
  3757. for (var i = 0; i < length; i += 1) {
  3758. that[i] = array[i] & 255;
  3759. }
  3760. return that;
  3761. }
  3762. function fromArrayBuffer(that, array, byteOffset, length) {
  3763. array.byteLength; // this throws if `array` is not a valid ArrayBuffer
  3764. if (byteOffset < 0 || array.byteLength < byteOffset) {
  3765. throw new RangeError('\'offset\' is out of bounds');
  3766. }
  3767. if (array.byteLength < byteOffset + (length || 0)) {
  3768. throw new RangeError('\'length\' is out of bounds');
  3769. }
  3770. if (byteOffset === undefined && length === undefined) {
  3771. array = new Uint8Array(array);
  3772. } else if (length === undefined) {
  3773. array = new Uint8Array(array, byteOffset);
  3774. } else {
  3775. array = new Uint8Array(array, byteOffset, length);
  3776. }
  3777. if (Buffer.TYPED_ARRAY_SUPPORT) {
  3778. // Return an augmented `Uint8Array` instance, for best performance
  3779. that = array;
  3780. that.__proto__ = Buffer.prototype;
  3781. } else {
  3782. // Fallback: Return an object instance of the Buffer class
  3783. that = fromArrayLike(that, array);
  3784. }
  3785. return that;
  3786. }
  3787. function fromObject(that, obj) {
  3788. if (Buffer.isBuffer(obj)) {
  3789. var len = checked(obj.length) | 0;
  3790. that = createBuffer(that, len);
  3791. if (that.length === 0) {
  3792. return that;
  3793. }
  3794. obj.copy(that, 0, 0, len);
  3795. return that;
  3796. }
  3797. if (obj) {
  3798. if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
  3799. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  3800. return createBuffer(that, 0);
  3801. }
  3802. return fromArrayLike(that, obj);
  3803. }
  3804. if (obj.type === 'Buffer' && isArray(obj.data)) {
  3805. return fromArrayLike(that, obj.data);
  3806. }
  3807. }
  3808. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
  3809. }
  3810. function checked(length) {
  3811. // Note: cannot use `length < kMaxLength()` here because that fails when
  3812. // length is NaN (which is otherwise coerced to zero.)
  3813. if (length >= kMaxLength()) {
  3814. throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
  3815. }
  3816. return length | 0;
  3817. }
  3818. function SlowBuffer(length) {
  3819. if (+length != length) {
  3820. // eslint-disable-line eqeqeq
  3821. length = 0;
  3822. }
  3823. return Buffer.alloc(+length);
  3824. }
  3825. Buffer.isBuffer = function isBuffer(b) {
  3826. return !!(b != null && b._isBuffer);
  3827. };
  3828. Buffer.compare = function compare(a, b) {
  3829. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  3830. throw new TypeError('Arguments must be Buffers');
  3831. }
  3832. if (a === b) return 0;
  3833. var x = a.length;
  3834. var y = b.length;
  3835. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  3836. if (a[i] !== b[i]) {
  3837. x = a[i];
  3838. y = b[i];
  3839. break;
  3840. }
  3841. }
  3842. if (x < y) return -1;
  3843. if (y < x) return 1;
  3844. return 0;
  3845. };
  3846. Buffer.isEncoding = function isEncoding(encoding) {
  3847. switch (String(encoding).toLowerCase()) {
  3848. case 'hex':
  3849. case 'utf8':
  3850. case 'utf-8':
  3851. case 'ascii':
  3852. case 'latin1':
  3853. case 'binary':
  3854. case 'base64':
  3855. case 'ucs2':
  3856. case 'ucs-2':
  3857. case 'utf16le':
  3858. case 'utf-16le':
  3859. return true;
  3860. default:
  3861. return false;
  3862. }
  3863. };
  3864. Buffer.concat = function concat(list, length) {
  3865. if (!isArray(list)) {
  3866. throw new TypeError('"list" argument must be an Array of Buffers');
  3867. }
  3868. if (list.length === 0) {
  3869. return Buffer.alloc(0);
  3870. }
  3871. var i;
  3872. if (length === undefined) {
  3873. length = 0;
  3874. for (i = 0; i < list.length; ++i) {
  3875. length += list[i].length;
  3876. }
  3877. }
  3878. var buffer = Buffer.allocUnsafe(length);
  3879. var pos = 0;
  3880. for (i = 0; i < list.length; ++i) {
  3881. var buf = list[i];
  3882. if (!Buffer.isBuffer(buf)) {
  3883. throw new TypeError('"list" argument must be an Array of Buffers');
  3884. }
  3885. buf.copy(buffer, pos);
  3886. pos += buf.length;
  3887. }
  3888. return buffer;
  3889. };
  3890. function byteLength(string, encoding) {
  3891. if (Buffer.isBuffer(string)) {
  3892. return string.length;
  3893. }
  3894. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  3895. return string.byteLength;
  3896. }
  3897. if (typeof string !== 'string') {
  3898. string = '' + string;
  3899. }
  3900. var len = string.length;
  3901. if (len === 0) return 0; // Use a for loop to avoid recursion
  3902. var loweredCase = false;
  3903. for (;;) {
  3904. switch (encoding) {
  3905. case 'ascii':
  3906. case 'latin1':
  3907. case 'binary':
  3908. return len;
  3909. case 'utf8':
  3910. case 'utf-8':
  3911. case undefined:
  3912. return utf8ToBytes(string).length;
  3913. case 'ucs2':
  3914. case 'ucs-2':
  3915. case 'utf16le':
  3916. case 'utf-16le':
  3917. return len * 2;
  3918. case 'hex':
  3919. return len >>> 1;
  3920. case 'base64':
  3921. return base64ToBytes(string).length;
  3922. default:
  3923. if (loweredCase) return utf8ToBytes(string).length; // assume utf8
  3924. encoding = ('' + encoding).toLowerCase();
  3925. loweredCase = true;
  3926. }
  3927. }
  3928. }
  3929. Buffer.byteLength = byteLength;
  3930. function slowToString(encoding, start, end) {
  3931. var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  3932. // property of a typed array.
  3933. // This behaves neither like String nor Uint8Array in that we set start/end
  3934. // to their upper/lower bounds if the value passed is out of range.
  3935. // undefined is handled specially as per ECMA-262 6th Edition,
  3936. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  3937. if (start === undefined || start < 0) {
  3938. start = 0;
  3939. } // Return early if start > this.length. Done here to prevent potential uint32
  3940. // coercion fail below.
  3941. if (start > this.length) {
  3942. return '';
  3943. }
  3944. if (end === undefined || end > this.length) {
  3945. end = this.length;
  3946. }
  3947. if (end <= 0) {
  3948. return '';
  3949. } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  3950. end >>>= 0;
  3951. start >>>= 0;
  3952. if (end <= start) {
  3953. return '';
  3954. }
  3955. if (!encoding) encoding = 'utf8';
  3956. while (true) {
  3957. switch (encoding) {
  3958. case 'hex':
  3959. return hexSlice(this, start, end);
  3960. case 'utf8':
  3961. case 'utf-8':
  3962. return utf8Slice(this, start, end);
  3963. case 'ascii':
  3964. return asciiSlice(this, start, end);
  3965. case 'latin1':
  3966. case 'binary':
  3967. return latin1Slice(this, start, end);
  3968. case 'base64':
  3969. return base64Slice(this, start, end);
  3970. case 'ucs2':
  3971. case 'ucs-2':
  3972. case 'utf16le':
  3973. case 'utf-16le':
  3974. return utf16leSlice(this, start, end);
  3975. default:
  3976. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
  3977. encoding = (encoding + '').toLowerCase();
  3978. loweredCase = true;
  3979. }
  3980. }
  3981. } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  3982. // Buffer instances.
  3983. Buffer.prototype._isBuffer = true;
  3984. function swap(b, n, m) {
  3985. var i = b[n];
  3986. b[n] = b[m];
  3987. b[m] = i;
  3988. }
  3989. Buffer.prototype.swap16 = function swap16() {
  3990. var len = this.length;
  3991. if (len % 2 !== 0) {
  3992. throw new RangeError('Buffer size must be a multiple of 16-bits');
  3993. }
  3994. for (var i = 0; i < len; i += 2) {
  3995. swap(this, i, i + 1);
  3996. }
  3997. return this;
  3998. };
  3999. Buffer.prototype.swap32 = function swap32() {
  4000. var len = this.length;
  4001. if (len % 4 !== 0) {
  4002. throw new RangeError('Buffer size must be a multiple of 32-bits');
  4003. }
  4004. for (var i = 0; i < len; i += 4) {
  4005. swap(this, i, i + 3);
  4006. swap(this, i + 1, i + 2);
  4007. }
  4008. return this;
  4009. };
  4010. Buffer.prototype.swap64 = function swap64() {
  4011. var len = this.length;
  4012. if (len % 8 !== 0) {
  4013. throw new RangeError('Buffer size must be a multiple of 64-bits');
  4014. }
  4015. for (var i = 0; i < len; i += 8) {
  4016. swap(this, i, i + 7);
  4017. swap(this, i + 1, i + 6);
  4018. swap(this, i + 2, i + 5);
  4019. swap(this, i + 3, i + 4);
  4020. }
  4021. return this;
  4022. };
  4023. Buffer.prototype.toString = function toString() {
  4024. var length = this.length | 0;
  4025. if (length === 0) return '';
  4026. if (arguments.length === 0) return utf8Slice(this, 0, length);
  4027. return slowToString.apply(this, arguments);
  4028. };
  4029. Buffer.prototype.equals = function equals(b) {
  4030. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');
  4031. if (this === b) return true;
  4032. return Buffer.compare(this, b) === 0;
  4033. };
  4034. Buffer.prototype.inspect = function inspect() {
  4035. var str = '';
  4036. var max = exports.INSPECT_MAX_BYTES;
  4037. if (this.length > 0) {
  4038. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
  4039. if (this.length > max) str += ' ... ';
  4040. }
  4041. return '<Buffer ' + str + '>';
  4042. };
  4043. Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
  4044. if (!Buffer.isBuffer(target)) {
  4045. throw new TypeError('Argument must be a Buffer');
  4046. }
  4047. if (start === undefined) {
  4048. start = 0;
  4049. }
  4050. if (end === undefined) {
  4051. end = target ? target.length : 0;
  4052. }
  4053. if (thisStart === undefined) {
  4054. thisStart = 0;
  4055. }
  4056. if (thisEnd === undefined) {
  4057. thisEnd = this.length;
  4058. }
  4059. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  4060. throw new RangeError('out of range index');
  4061. }
  4062. if (thisStart >= thisEnd && start >= end) {
  4063. return 0;
  4064. }
  4065. if (thisStart >= thisEnd) {
  4066. return -1;
  4067. }
  4068. if (start >= end) {
  4069. return 1;
  4070. }
  4071. start >>>= 0;
  4072. end >>>= 0;
  4073. thisStart >>>= 0;
  4074. thisEnd >>>= 0;
  4075. if (this === target) return 0;
  4076. var x = thisEnd - thisStart;
  4077. var y = end - start;
  4078. var len = Math.min(x, y);
  4079. var thisCopy = this.slice(thisStart, thisEnd);
  4080. var targetCopy = target.slice(start, end);
  4081. for (var i = 0; i < len; ++i) {
  4082. if (thisCopy[i] !== targetCopy[i]) {
  4083. x = thisCopy[i];
  4084. y = targetCopy[i];
  4085. break;
  4086. }
  4087. }
  4088. if (x < y) return -1;
  4089. if (y < x) return 1;
  4090. return 0;
  4091. }; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  4092. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  4093. //
  4094. // Arguments:
  4095. // - buffer - a Buffer to search
  4096. // - val - a string, Buffer, or number
  4097. // - byteOffset - an index into `buffer`; will be clamped to an int32
  4098. // - encoding - an optional encoding, relevant is val is a string
  4099. // - dir - true for indexOf, false for lastIndexOf
  4100. function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
  4101. // Empty buffer means no match
  4102. if (buffer.length === 0) return -1; // Normalize byteOffset
  4103. if (typeof byteOffset === 'string') {
  4104. encoding = byteOffset;
  4105. byteOffset = 0;
  4106. } else if (byteOffset > 0x7fffffff) {
  4107. byteOffset = 0x7fffffff;
  4108. } else if (byteOffset < -0x80000000) {
  4109. byteOffset = -0x80000000;
  4110. }
  4111. byteOffset = +byteOffset; // Coerce to Number.
  4112. if (isNaN(byteOffset)) {
  4113. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  4114. byteOffset = dir ? 0 : buffer.length - 1;
  4115. } // Normalize byteOffset: negative offsets start from the end of the buffer
  4116. if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
  4117. if (byteOffset >= buffer.length) {
  4118. if (dir) return -1;else byteOffset = buffer.length - 1;
  4119. } else if (byteOffset < 0) {
  4120. if (dir) byteOffset = 0;else return -1;
  4121. } // Normalize val
  4122. if (typeof val === 'string') {
  4123. val = Buffer.from(val, encoding);
  4124. } // Finally, search either indexOf (if dir is true) or lastIndexOf
  4125. if (Buffer.isBuffer(val)) {
  4126. // Special case: looking for empty string/buffer always fails
  4127. if (val.length === 0) {
  4128. return -1;
  4129. }
  4130. return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
  4131. } else if (typeof val === 'number') {
  4132. val = val & 0xFF; // Search for a byte value [0-255]
  4133. if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
  4134. if (dir) {
  4135. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
  4136. } else {
  4137. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
  4138. }
  4139. }
  4140. return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
  4141. }
  4142. throw new TypeError('val must be string, number or Buffer');
  4143. }
  4144. function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
  4145. var indexSize = 1;
  4146. var arrLength = arr.length;
  4147. var valLength = val.length;
  4148. if (encoding !== undefined) {
  4149. encoding = String(encoding).toLowerCase();
  4150. if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
  4151. if (arr.length < 2 || val.length < 2) {
  4152. return -1;
  4153. }
  4154. indexSize = 2;
  4155. arrLength /= 2;
  4156. valLength /= 2;
  4157. byteOffset /= 2;
  4158. }
  4159. }
  4160. function read(buf, i) {
  4161. if (indexSize === 1) {
  4162. return buf[i];
  4163. } else {
  4164. return buf.readUInt16BE(i * indexSize);
  4165. }
  4166. }
  4167. var i;
  4168. if (dir) {
  4169. var foundIndex = -1;
  4170. for (i = byteOffset; i < arrLength; i++) {
  4171. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  4172. if (foundIndex === -1) foundIndex = i;
  4173. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
  4174. } else {
  4175. if (foundIndex !== -1) i -= i - foundIndex;
  4176. foundIndex = -1;
  4177. }
  4178. }
  4179. } else {
  4180. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
  4181. for (i = byteOffset; i >= 0; i--) {
  4182. var found = true;
  4183. for (var j = 0; j < valLength; j++) {
  4184. if (read(arr, i + j) !== read(val, j)) {
  4185. found = false;
  4186. break;
  4187. }
  4188. }
  4189. if (found) return i;
  4190. }
  4191. }
  4192. return -1;
  4193. }
  4194. Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
  4195. return this.indexOf(val, byteOffset, encoding) !== -1;
  4196. };
  4197. Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
  4198. return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
  4199. };
  4200. Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
  4201. return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
  4202. };
  4203. function hexWrite(buf, string, offset, length) {
  4204. offset = Number(offset) || 0;
  4205. var remaining = buf.length - offset;
  4206. if (!length) {
  4207. length = remaining;
  4208. } else {
  4209. length = Number(length);
  4210. if (length > remaining) {
  4211. length = remaining;
  4212. }
  4213. } // must be an even number of digits
  4214. var strLen = string.length;
  4215. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
  4216. if (length > strLen / 2) {
  4217. length = strLen / 2;
  4218. }
  4219. for (var i = 0; i < length; ++i) {
  4220. var parsed = parseInt(string.substr(i * 2, 2), 16);
  4221. if (isNaN(parsed)) return i;
  4222. buf[offset + i] = parsed;
  4223. }
  4224. return i;
  4225. }
  4226. function utf8Write(buf, string, offset, length) {
  4227. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
  4228. }
  4229. function asciiWrite(buf, string, offset, length) {
  4230. return blitBuffer(asciiToBytes(string), buf, offset, length);
  4231. }
  4232. function latin1Write(buf, string, offset, length) {
  4233. return asciiWrite(buf, string, offset, length);
  4234. }
  4235. function base64Write(buf, string, offset, length) {
  4236. return blitBuffer(base64ToBytes(string), buf, offset, length);
  4237. }
  4238. function ucs2Write(buf, string, offset, length) {
  4239. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
  4240. }
  4241. Buffer.prototype.write = function write(string, offset, length, encoding) {
  4242. // Buffer#write(string)
  4243. if (offset === undefined) {
  4244. encoding = 'utf8';
  4245. length = this.length;
  4246. offset = 0; // Buffer#write(string, encoding)
  4247. } else if (length === undefined && typeof offset === 'string') {
  4248. encoding = offset;
  4249. length = this.length;
  4250. offset = 0; // Buffer#write(string, offset[, length][, encoding])
  4251. } else if (isFinite(offset)) {
  4252. offset = offset | 0;
  4253. if (isFinite(length)) {
  4254. length = length | 0;
  4255. if (encoding === undefined) encoding = 'utf8';
  4256. } else {
  4257. encoding = length;
  4258. length = undefined;
  4259. } // legacy write(string, encoding, offset, length) - remove in v0.13
  4260. } else {
  4261. throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
  4262. }
  4263. var remaining = this.length - offset;
  4264. if (length === undefined || length > remaining) length = remaining;
  4265. if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
  4266. throw new RangeError('Attempt to write outside buffer bounds');
  4267. }
  4268. if (!encoding) encoding = 'utf8';
  4269. var loweredCase = false;
  4270. for (;;) {
  4271. switch (encoding) {
  4272. case 'hex':
  4273. return hexWrite(this, string, offset, length);
  4274. case 'utf8':
  4275. case 'utf-8':
  4276. return utf8Write(this, string, offset, length);
  4277. case 'ascii':
  4278. return asciiWrite(this, string, offset, length);
  4279. case 'latin1':
  4280. case 'binary':
  4281. return latin1Write(this, string, offset, length);
  4282. case 'base64':
  4283. // Warning: maxLength not taken into account in base64Write
  4284. return base64Write(this, string, offset, length);
  4285. case 'ucs2':
  4286. case 'ucs-2':
  4287. case 'utf16le':
  4288. case 'utf-16le':
  4289. return ucs2Write(this, string, offset, length);
  4290. default:
  4291. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
  4292. encoding = ('' + encoding).toLowerCase();
  4293. loweredCase = true;
  4294. }
  4295. }
  4296. };
  4297. Buffer.prototype.toJSON = function toJSON() {
  4298. return {
  4299. type: 'Buffer',
  4300. data: Array.prototype.slice.call(this._arr || this, 0)
  4301. };
  4302. };
  4303. function base64Slice(buf, start, end) {
  4304. if (start === 0 && end === buf.length) {
  4305. return base64.fromByteArray(buf);
  4306. } else {
  4307. return base64.fromByteArray(buf.slice(start, end));
  4308. }
  4309. }
  4310. function utf8Slice(buf, start, end) {
  4311. end = Math.min(buf.length, end);
  4312. var res = [];
  4313. var i = start;
  4314. while (i < end) {
  4315. var firstByte = buf[i];
  4316. var codePoint = null;
  4317. var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
  4318. if (i + bytesPerSequence <= end) {
  4319. var secondByte, thirdByte, fourthByte, tempCodePoint;
  4320. switch (bytesPerSequence) {
  4321. case 1:
  4322. if (firstByte < 0x80) {
  4323. codePoint = firstByte;
  4324. }
  4325. break;
  4326. case 2:
  4327. secondByte = buf[i + 1];
  4328. if ((secondByte & 0xC0) === 0x80) {
  4329. tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
  4330. if (tempCodePoint > 0x7F) {
  4331. codePoint = tempCodePoint;
  4332. }
  4333. }
  4334. break;
  4335. case 3:
  4336. secondByte = buf[i + 1];
  4337. thirdByte = buf[i + 2];
  4338. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  4339. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
  4340. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  4341. codePoint = tempCodePoint;
  4342. }
  4343. }
  4344. break;
  4345. case 4:
  4346. secondByte = buf[i + 1];
  4347. thirdByte = buf[i + 2];
  4348. fourthByte = buf[i + 3];
  4349. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  4350. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
  4351. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  4352. codePoint = tempCodePoint;
  4353. }
  4354. }
  4355. }
  4356. }
  4357. if (codePoint === null) {
  4358. // we did not generate a valid codePoint so insert a
  4359. // replacement char (U+FFFD) and advance only 1 byte
  4360. codePoint = 0xFFFD;
  4361. bytesPerSequence = 1;
  4362. } else if (codePoint > 0xFFFF) {
  4363. // encode to utf16 (surrogate pair dance)
  4364. codePoint -= 0x10000;
  4365. res.push(codePoint >>> 10 & 0x3FF | 0xD800);
  4366. codePoint = 0xDC00 | codePoint & 0x3FF;
  4367. }
  4368. res.push(codePoint);
  4369. i += bytesPerSequence;
  4370. }
  4371. return decodeCodePointsArray(res);
  4372. } // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  4373. // the lowest limit is Chrome, with 0x10000 args.
  4374. // We go 1 magnitude less, for safety
  4375. var MAX_ARGUMENTS_LENGTH = 0x1000;
  4376. function decodeCodePointsArray(codePoints) {
  4377. var len = codePoints.length;
  4378. if (len <= MAX_ARGUMENTS_LENGTH) {
  4379. return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
  4380. } // Decode in chunks to avoid "call stack size exceeded".
  4381. var res = '';
  4382. var i = 0;
  4383. while (i < len) {
  4384. res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
  4385. }
  4386. return res;
  4387. }
  4388. function asciiSlice(buf, start, end) {
  4389. var ret = '';
  4390. end = Math.min(buf.length, end);
  4391. for (var i = start; i < end; ++i) {
  4392. ret += String.fromCharCode(buf[i] & 0x7F);
  4393. }
  4394. return ret;
  4395. }
  4396. function latin1Slice(buf, start, end) {
  4397. var ret = '';
  4398. end = Math.min(buf.length, end);
  4399. for (var i = start; i < end; ++i) {
  4400. ret += String.fromCharCode(buf[i]);
  4401. }
  4402. return ret;
  4403. }
  4404. function hexSlice(buf, start, end) {
  4405. var len = buf.length;
  4406. if (!start || start < 0) start = 0;
  4407. if (!end || end < 0 || end > len) end = len;
  4408. var out = '';
  4409. for (var i = start; i < end; ++i) {
  4410. out += toHex(buf[i]);
  4411. }
  4412. return out;
  4413. }
  4414. function utf16leSlice(buf, start, end) {
  4415. var bytes = buf.slice(start, end);
  4416. var res = '';
  4417. for (var i = 0; i < bytes.length; i += 2) {
  4418. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
  4419. }
  4420. return res;
  4421. }
  4422. Buffer.prototype.slice = function slice(start, end) {
  4423. var len = this.length;
  4424. start = ~~start;
  4425. end = end === undefined ? len : ~~end;
  4426. if (start < 0) {
  4427. start += len;
  4428. if (start < 0) start = 0;
  4429. } else if (start > len) {
  4430. start = len;
  4431. }
  4432. if (end < 0) {
  4433. end += len;
  4434. if (end < 0) end = 0;
  4435. } else if (end > len) {
  4436. end = len;
  4437. }
  4438. if (end < start) end = start;
  4439. var newBuf;
  4440. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4441. newBuf = this.subarray(start, end);
  4442. newBuf.__proto__ = Buffer.prototype;
  4443. } else {
  4444. var sliceLen = end - start;
  4445. newBuf = new Buffer(sliceLen, undefined);
  4446. for (var i = 0; i < sliceLen; ++i) {
  4447. newBuf[i] = this[i + start];
  4448. }
  4449. }
  4450. return newBuf;
  4451. };
  4452. /*
  4453. * Need to make sure that buffer isn't trying to write out of bounds.
  4454. */
  4455. function checkOffset(offset, ext, length) {
  4456. if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
  4457. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
  4458. }
  4459. Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
  4460. offset = offset | 0;
  4461. byteLength = byteLength | 0;
  4462. if (!noAssert) checkOffset(offset, byteLength, this.length);
  4463. var val = this[offset];
  4464. var mul = 1;
  4465. var i = 0;
  4466. while (++i < byteLength && (mul *= 0x100)) {
  4467. val += this[offset + i] * mul;
  4468. }
  4469. return val;
  4470. };
  4471. Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
  4472. offset = offset | 0;
  4473. byteLength = byteLength | 0;
  4474. if (!noAssert) {
  4475. checkOffset(offset, byteLength, this.length);
  4476. }
  4477. var val = this[offset + --byteLength];
  4478. var mul = 1;
  4479. while (byteLength > 0 && (mul *= 0x100)) {
  4480. val += this[offset + --byteLength] * mul;
  4481. }
  4482. return val;
  4483. };
  4484. Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
  4485. if (!noAssert) checkOffset(offset, 1, this.length);
  4486. return this[offset];
  4487. };
  4488. Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
  4489. if (!noAssert) checkOffset(offset, 2, this.length);
  4490. return this[offset] | this[offset + 1] << 8;
  4491. };
  4492. Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
  4493. if (!noAssert) checkOffset(offset, 2, this.length);
  4494. return this[offset] << 8 | this[offset + 1];
  4495. };
  4496. Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
  4497. if (!noAssert) checkOffset(offset, 4, this.length);
  4498. return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
  4499. };
  4500. Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
  4501. if (!noAssert) checkOffset(offset, 4, this.length);
  4502. return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
  4503. };
  4504. Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
  4505. offset = offset | 0;
  4506. byteLength = byteLength | 0;
  4507. if (!noAssert) checkOffset(offset, byteLength, this.length);
  4508. var val = this[offset];
  4509. var mul = 1;
  4510. var i = 0;
  4511. while (++i < byteLength && (mul *= 0x100)) {
  4512. val += this[offset + i] * mul;
  4513. }
  4514. mul *= 0x80;
  4515. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  4516. return val;
  4517. };
  4518. Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
  4519. offset = offset | 0;
  4520. byteLength = byteLength | 0;
  4521. if (!noAssert) checkOffset(offset, byteLength, this.length);
  4522. var i = byteLength;
  4523. var mul = 1;
  4524. var val = this[offset + --i];
  4525. while (i > 0 && (mul *= 0x100)) {
  4526. val += this[offset + --i] * mul;
  4527. }
  4528. mul *= 0x80;
  4529. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  4530. return val;
  4531. };
  4532. Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
  4533. if (!noAssert) checkOffset(offset, 1, this.length);
  4534. if (!(this[offset] & 0x80)) return this[offset];
  4535. return (0xff - this[offset] + 1) * -1;
  4536. };
  4537. Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
  4538. if (!noAssert) checkOffset(offset, 2, this.length);
  4539. var val = this[offset] | this[offset + 1] << 8;
  4540. return val & 0x8000 ? val | 0xFFFF0000 : val;
  4541. };
  4542. Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
  4543. if (!noAssert) checkOffset(offset, 2, this.length);
  4544. var val = this[offset + 1] | this[offset] << 8;
  4545. return val & 0x8000 ? val | 0xFFFF0000 : val;
  4546. };
  4547. Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
  4548. if (!noAssert) checkOffset(offset, 4, this.length);
  4549. return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
  4550. };
  4551. Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
  4552. if (!noAssert) checkOffset(offset, 4, this.length);
  4553. return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
  4554. };
  4555. Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
  4556. if (!noAssert) checkOffset(offset, 4, this.length);
  4557. return ieee754.read(this, offset, true, 23, 4);
  4558. };
  4559. Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
  4560. if (!noAssert) checkOffset(offset, 4, this.length);
  4561. return ieee754.read(this, offset, false, 23, 4);
  4562. };
  4563. Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
  4564. if (!noAssert) checkOffset(offset, 8, this.length);
  4565. return ieee754.read(this, offset, true, 52, 8);
  4566. };
  4567. Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
  4568. if (!noAssert) checkOffset(offset, 8, this.length);
  4569. return ieee754.read(this, offset, false, 52, 8);
  4570. };
  4571. function checkInt(buf, value, offset, ext, max, min) {
  4572. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
  4573. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
  4574. if (offset + ext > buf.length) throw new RangeError('Index out of range');
  4575. }
  4576. Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
  4577. value = +value;
  4578. offset = offset | 0;
  4579. byteLength = byteLength | 0;
  4580. if (!noAssert) {
  4581. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  4582. checkInt(this, value, offset, byteLength, maxBytes, 0);
  4583. }
  4584. var mul = 1;
  4585. var i = 0;
  4586. this[offset] = value & 0xFF;
  4587. while (++i < byteLength && (mul *= 0x100)) {
  4588. this[offset + i] = value / mul & 0xFF;
  4589. }
  4590. return offset + byteLength;
  4591. };
  4592. Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
  4593. value = +value;
  4594. offset = offset | 0;
  4595. byteLength = byteLength | 0;
  4596. if (!noAssert) {
  4597. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  4598. checkInt(this, value, offset, byteLength, maxBytes, 0);
  4599. }
  4600. var i = byteLength - 1;
  4601. var mul = 1;
  4602. this[offset + i] = value & 0xFF;
  4603. while (--i >= 0 && (mul *= 0x100)) {
  4604. this[offset + i] = value / mul & 0xFF;
  4605. }
  4606. return offset + byteLength;
  4607. };
  4608. Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
  4609. value = +value;
  4610. offset = offset | 0;
  4611. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
  4612. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
  4613. this[offset] = value & 0xff;
  4614. return offset + 1;
  4615. };
  4616. function objectWriteUInt16(buf, value, offset, littleEndian) {
  4617. if (value < 0) value = 0xffff + value + 1;
  4618. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  4619. buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
  4620. }
  4621. }
  4622. Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
  4623. value = +value;
  4624. offset = offset | 0;
  4625. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  4626. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4627. this[offset] = value & 0xff;
  4628. this[offset + 1] = value >>> 8;
  4629. } else {
  4630. objectWriteUInt16(this, value, offset, true);
  4631. }
  4632. return offset + 2;
  4633. };
  4634. Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
  4635. value = +value;
  4636. offset = offset | 0;
  4637. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  4638. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4639. this[offset] = value >>> 8;
  4640. this[offset + 1] = value & 0xff;
  4641. } else {
  4642. objectWriteUInt16(this, value, offset, false);
  4643. }
  4644. return offset + 2;
  4645. };
  4646. function objectWriteUInt32(buf, value, offset, littleEndian) {
  4647. if (value < 0) value = 0xffffffff + value + 1;
  4648. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  4649. buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
  4650. }
  4651. }
  4652. Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
  4653. value = +value;
  4654. offset = offset | 0;
  4655. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  4656. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4657. this[offset + 3] = value >>> 24;
  4658. this[offset + 2] = value >>> 16;
  4659. this[offset + 1] = value >>> 8;
  4660. this[offset] = value & 0xff;
  4661. } else {
  4662. objectWriteUInt32(this, value, offset, true);
  4663. }
  4664. return offset + 4;
  4665. };
  4666. Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
  4667. value = +value;
  4668. offset = offset | 0;
  4669. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  4670. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4671. this[offset] = value >>> 24;
  4672. this[offset + 1] = value >>> 16;
  4673. this[offset + 2] = value >>> 8;
  4674. this[offset + 3] = value & 0xff;
  4675. } else {
  4676. objectWriteUInt32(this, value, offset, false);
  4677. }
  4678. return offset + 4;
  4679. };
  4680. Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
  4681. value = +value;
  4682. offset = offset | 0;
  4683. if (!noAssert) {
  4684. var limit = Math.pow(2, 8 * byteLength - 1);
  4685. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  4686. }
  4687. var i = 0;
  4688. var mul = 1;
  4689. var sub = 0;
  4690. this[offset] = value & 0xFF;
  4691. while (++i < byteLength && (mul *= 0x100)) {
  4692. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  4693. sub = 1;
  4694. }
  4695. this[offset + i] = (value / mul >> 0) - sub & 0xFF;
  4696. }
  4697. return offset + byteLength;
  4698. };
  4699. Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
  4700. value = +value;
  4701. offset = offset | 0;
  4702. if (!noAssert) {
  4703. var limit = Math.pow(2, 8 * byteLength - 1);
  4704. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  4705. }
  4706. var i = byteLength - 1;
  4707. var mul = 1;
  4708. var sub = 0;
  4709. this[offset + i] = value & 0xFF;
  4710. while (--i >= 0 && (mul *= 0x100)) {
  4711. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  4712. sub = 1;
  4713. }
  4714. this[offset + i] = (value / mul >> 0) - sub & 0xFF;
  4715. }
  4716. return offset + byteLength;
  4717. };
  4718. Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
  4719. value = +value;
  4720. offset = offset | 0;
  4721. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
  4722. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
  4723. if (value < 0) value = 0xff + value + 1;
  4724. this[offset] = value & 0xff;
  4725. return offset + 1;
  4726. };
  4727. Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
  4728. value = +value;
  4729. offset = offset | 0;
  4730. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  4731. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4732. this[offset] = value & 0xff;
  4733. this[offset + 1] = value >>> 8;
  4734. } else {
  4735. objectWriteUInt16(this, value, offset, true);
  4736. }
  4737. return offset + 2;
  4738. };
  4739. Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
  4740. value = +value;
  4741. offset = offset | 0;
  4742. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  4743. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4744. this[offset] = value >>> 8;
  4745. this[offset + 1] = value & 0xff;
  4746. } else {
  4747. objectWriteUInt16(this, value, offset, false);
  4748. }
  4749. return offset + 2;
  4750. };
  4751. Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
  4752. value = +value;
  4753. offset = offset | 0;
  4754. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  4755. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4756. this[offset] = value & 0xff;
  4757. this[offset + 1] = value >>> 8;
  4758. this[offset + 2] = value >>> 16;
  4759. this[offset + 3] = value >>> 24;
  4760. } else {
  4761. objectWriteUInt32(this, value, offset, true);
  4762. }
  4763. return offset + 4;
  4764. };
  4765. Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
  4766. value = +value;
  4767. offset = offset | 0;
  4768. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  4769. if (value < 0) value = 0xffffffff + value + 1;
  4770. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4771. this[offset] = value >>> 24;
  4772. this[offset + 1] = value >>> 16;
  4773. this[offset + 2] = value >>> 8;
  4774. this[offset + 3] = value & 0xff;
  4775. } else {
  4776. objectWriteUInt32(this, value, offset, false);
  4777. }
  4778. return offset + 4;
  4779. };
  4780. function checkIEEE754(buf, value, offset, ext, max, min) {
  4781. if (offset + ext > buf.length) throw new RangeError('Index out of range');
  4782. if (offset < 0) throw new RangeError('Index out of range');
  4783. }
  4784. function writeFloat(buf, value, offset, littleEndian, noAssert) {
  4785. if (!noAssert) {
  4786. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);
  4787. }
  4788. ieee754.write(buf, value, offset, littleEndian, 23, 4);
  4789. return offset + 4;
  4790. }
  4791. Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
  4792. return writeFloat(this, value, offset, true, noAssert);
  4793. };
  4794. Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
  4795. return writeFloat(this, value, offset, false, noAssert);
  4796. };
  4797. function writeDouble(buf, value, offset, littleEndian, noAssert) {
  4798. if (!noAssert) {
  4799. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);
  4800. }
  4801. ieee754.write(buf, value, offset, littleEndian, 52, 8);
  4802. return offset + 8;
  4803. }
  4804. Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
  4805. return writeDouble(this, value, offset, true, noAssert);
  4806. };
  4807. Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
  4808. return writeDouble(this, value, offset, false, noAssert);
  4809. }; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  4810. Buffer.prototype.copy = function copy(target, targetStart, start, end) {
  4811. if (!start) start = 0;
  4812. if (!end && end !== 0) end = this.length;
  4813. if (targetStart >= target.length) targetStart = target.length;
  4814. if (!targetStart) targetStart = 0;
  4815. if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done
  4816. if (end === start) return 0;
  4817. if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions
  4818. if (targetStart < 0) {
  4819. throw new RangeError('targetStart out of bounds');
  4820. }
  4821. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
  4822. if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?
  4823. if (end > this.length) end = this.length;
  4824. if (target.length - targetStart < end - start) {
  4825. end = target.length - targetStart + start;
  4826. }
  4827. var len = end - start;
  4828. var i;
  4829. if (this === target && start < targetStart && targetStart < end) {
  4830. // descending copy from end
  4831. for (i = len - 1; i >= 0; --i) {
  4832. target[i + targetStart] = this[i + start];
  4833. }
  4834. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  4835. // ascending copy from start
  4836. for (i = 0; i < len; ++i) {
  4837. target[i + targetStart] = this[i + start];
  4838. }
  4839. } else {
  4840. Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
  4841. }
  4842. return len;
  4843. }; // Usage:
  4844. // buffer.fill(number[, offset[, end]])
  4845. // buffer.fill(buffer[, offset[, end]])
  4846. // buffer.fill(string[, offset[, end]][, encoding])
  4847. Buffer.prototype.fill = function fill(val, start, end, encoding) {
  4848. // Handle string cases:
  4849. if (typeof val === 'string') {
  4850. if (typeof start === 'string') {
  4851. encoding = start;
  4852. start = 0;
  4853. end = this.length;
  4854. } else if (typeof end === 'string') {
  4855. encoding = end;
  4856. end = this.length;
  4857. }
  4858. if (val.length === 1) {
  4859. var code = val.charCodeAt(0);
  4860. if (code < 256) {
  4861. val = code;
  4862. }
  4863. }
  4864. if (encoding !== undefined && typeof encoding !== 'string') {
  4865. throw new TypeError('encoding must be a string');
  4866. }
  4867. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  4868. throw new TypeError('Unknown encoding: ' + encoding);
  4869. }
  4870. } else if (typeof val === 'number') {
  4871. val = val & 255;
  4872. } // Invalid ranges are not set to a default, so can range check early.
  4873. if (start < 0 || this.length < start || this.length < end) {
  4874. throw new RangeError('Out of range index');
  4875. }
  4876. if (end <= start) {
  4877. return this;
  4878. }
  4879. start = start >>> 0;
  4880. end = end === undefined ? this.length : end >>> 0;
  4881. if (!val) val = 0;
  4882. var i;
  4883. if (typeof val === 'number') {
  4884. for (i = start; i < end; ++i) {
  4885. this[i] = val;
  4886. }
  4887. } else {
  4888. var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());
  4889. var len = bytes.length;
  4890. for (i = 0; i < end - start; ++i) {
  4891. this[i + start] = bytes[i % len];
  4892. }
  4893. }
  4894. return this;
  4895. }; // HELPER FUNCTIONS
  4896. // ================
  4897. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
  4898. function base64clean(str) {
  4899. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  4900. str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''
  4901. if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  4902. while (str.length % 4 !== 0) {
  4903. str = str + '=';
  4904. }
  4905. return str;
  4906. }
  4907. function stringtrim(str) {
  4908. if (str.trim) return str.trim();
  4909. return str.replace(/^\s+|\s+$/g, '');
  4910. }
  4911. function toHex(n) {
  4912. if (n < 16) return '0' + n.toString(16);
  4913. return n.toString(16);
  4914. }
  4915. function utf8ToBytes(string, units) {
  4916. units = units || Infinity;
  4917. var codePoint;
  4918. var length = string.length;
  4919. var leadSurrogate = null;
  4920. var bytes = [];
  4921. for (var i = 0; i < length; ++i) {
  4922. codePoint = string.charCodeAt(i); // is surrogate component
  4923. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  4924. // last char was a lead
  4925. if (!leadSurrogate) {
  4926. // no lead yet
  4927. if (codePoint > 0xDBFF) {
  4928. // unexpected trail
  4929. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  4930. continue;
  4931. } else if (i + 1 === length) {
  4932. // unpaired lead
  4933. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  4934. continue;
  4935. } // valid lead
  4936. leadSurrogate = codePoint;
  4937. continue;
  4938. } // 2 leads in a row
  4939. if (codePoint < 0xDC00) {
  4940. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  4941. leadSurrogate = codePoint;
  4942. continue;
  4943. } // valid surrogate pair
  4944. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
  4945. } else if (leadSurrogate) {
  4946. // valid bmp char, but last char was a lead
  4947. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  4948. }
  4949. leadSurrogate = null; // encode utf8
  4950. if (codePoint < 0x80) {
  4951. if ((units -= 1) < 0) break;
  4952. bytes.push(codePoint);
  4953. } else if (codePoint < 0x800) {
  4954. if ((units -= 2) < 0) break;
  4955. bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
  4956. } else if (codePoint < 0x10000) {
  4957. if ((units -= 3) < 0) break;
  4958. bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
  4959. } else if (codePoint < 0x110000) {
  4960. if ((units -= 4) < 0) break;
  4961. bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
  4962. } else {
  4963. throw new Error('Invalid code point');
  4964. }
  4965. }
  4966. return bytes;
  4967. }
  4968. function asciiToBytes(str) {
  4969. var byteArray = [];
  4970. for (var i = 0; i < str.length; ++i) {
  4971. // Node's code seems to be doing this and not & 0x7F..
  4972. byteArray.push(str.charCodeAt(i) & 0xFF);
  4973. }
  4974. return byteArray;
  4975. }
  4976. function utf16leToBytes(str, units) {
  4977. var c, hi, lo;
  4978. var byteArray = [];
  4979. for (var i = 0; i < str.length; ++i) {
  4980. if ((units -= 2) < 0) break;
  4981. c = str.charCodeAt(i);
  4982. hi = c >> 8;
  4983. lo = c % 256;
  4984. byteArray.push(lo);
  4985. byteArray.push(hi);
  4986. }
  4987. return byteArray;
  4988. }
  4989. function base64ToBytes(str) {
  4990. return base64.toByteArray(base64clean(str));
  4991. }
  4992. function blitBuffer(src, dst, offset, length) {
  4993. for (var i = 0; i < length; ++i) {
  4994. if (i + offset >= dst.length || i >= src.length) break;
  4995. dst[i + offset] = src[i];
  4996. }
  4997. return i;
  4998. }
  4999. function isnan(val) {
  5000. return val !== val; // eslint-disable-line no-self-compare
  5001. }
  5002. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)))
  5003. /***/ }),
  5004. /* 19 */
  5005. /***/ (function(module, exports, __webpack_require__) {
  5006. "use strict";
  5007. exports.__esModule = true;
  5008. exports.default = void 0;
  5009. var _node = _interopRequireDefault(__webpack_require__(20));
  5010. function _interopRequireDefault(obj) {
  5011. return obj && obj.__esModule ? obj : {
  5012. default: obj
  5013. };
  5014. }
  5015. function _inheritsLoose(subClass, superClass) {
  5016. subClass.prototype = Object.create(superClass.prototype);
  5017. subClass.prototype.constructor = subClass;
  5018. subClass.__proto__ = superClass;
  5019. }
  5020. /**
  5021. * Represents a comment between declarations or statements (rule and at-rules).
  5022. *
  5023. * Comments inside selectors, at-rule parameters, or declaration values
  5024. * will be stored in the `raws` properties explained above.
  5025. *
  5026. * @extends Node
  5027. */
  5028. var Comment =
  5029. /*#__PURE__*/
  5030. function (_Node) {
  5031. _inheritsLoose(Comment, _Node);
  5032. function Comment(defaults) {
  5033. var _this;
  5034. _this = _Node.call(this, defaults) || this;
  5035. _this.type = 'comment';
  5036. return _this;
  5037. }
  5038. /**
  5039. * @memberof Comment#
  5040. * @member {string} text The comment’s text.
  5041. */
  5042. /**
  5043. * @memberof Comment#
  5044. * @member {object} raws Information to generate byte-to-byte equal
  5045. * node string as it was in the origin input.
  5046. *
  5047. * Every parser saves its own properties,
  5048. * but the default CSS parser uses:
  5049. *
  5050. * * `before`: the space symbols before the node.
  5051. * * `left`: the space symbols between `/*` and the comment’s text.
  5052. * * `right`: the space symbols between the comment’s text.
  5053. */
  5054. return Comment;
  5055. }(_node.default);
  5056. var _default = Comment;
  5057. exports.default = _default;
  5058. module.exports = exports.default;
  5059. /***/ }),
  5060. /* 20 */
  5061. /***/ (function(module, exports, __webpack_require__) {
  5062. "use strict";
  5063. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  5064. exports.__esModule = true;
  5065. exports.default = void 0;
  5066. var _cssSyntaxError = _interopRequireDefault(__webpack_require__(60));
  5067. var _stringifier = _interopRequireDefault(__webpack_require__(17));
  5068. var _stringify = _interopRequireDefault(__webpack_require__(65));
  5069. function _interopRequireDefault(obj) {
  5070. return obj && obj.__esModule ? obj : {
  5071. default: obj
  5072. };
  5073. }
  5074. function cloneNode(obj, parent) {
  5075. var cloned = new obj.constructor();
  5076. for (var i in obj) {
  5077. if (!obj.hasOwnProperty(i)) continue;
  5078. var value = obj[i];
  5079. var type = _typeof(value);
  5080. if (i === 'parent' && type === 'object') {
  5081. if (parent) cloned[i] = parent;
  5082. } else if (i === 'source') {
  5083. cloned[i] = value;
  5084. } else if (value instanceof Array) {
  5085. cloned[i] = value.map(function (j) {
  5086. return cloneNode(j, cloned);
  5087. });
  5088. } else {
  5089. if (type === 'object' && value !== null) value = cloneNode(value);
  5090. cloned[i] = value;
  5091. }
  5092. }
  5093. return cloned;
  5094. }
  5095. /**
  5096. * All node classes inherit the following common methods.
  5097. *
  5098. * @abstract
  5099. */
  5100. var Node =
  5101. /*#__PURE__*/
  5102. function () {
  5103. /**
  5104. * @param {object} [defaults] Value for node properties.
  5105. */
  5106. function Node(defaults) {
  5107. if (defaults === void 0) {
  5108. defaults = {};
  5109. }
  5110. this.raws = {};
  5111. if (false) {
  5112. if (_typeof(defaults) !== 'object' && typeof defaults !== 'undefined') {
  5113. throw new Error('PostCSS nodes constructor accepts object, not ' + JSON.stringify(defaults));
  5114. }
  5115. }
  5116. for (var name in defaults) {
  5117. this[name] = defaults[name];
  5118. }
  5119. }
  5120. /**
  5121. * Returns a `CssSyntaxError` instance containing the original position
  5122. * of the node in the source, showing line and column numbers and also
  5123. * a small excerpt to facilitate debugging.
  5124. *
  5125. * If present, an input source map will be used to get the original position
  5126. * of the source, even from a previous compilation step
  5127. * (e.g., from Sass compilation).
  5128. *
  5129. * This method produces very useful error messages.
  5130. *
  5131. * @param {string} message Error description.
  5132. * @param {object} [opts] Options.
  5133. * @param {string} opts.plugin Plugin name that created this error.
  5134. * PostCSS will set it automatically.
  5135. * @param {string} opts.word A word inside a node’s string that should
  5136. * be highlighted as the source of the error.
  5137. * @param {number} opts.index An index inside a node’s string that should
  5138. * be highlighted as the source of the error.
  5139. *
  5140. * @return {CssSyntaxError} Error object to throw it.
  5141. *
  5142. * @example
  5143. * if (!variables[name]) {
  5144. * throw decl.error('Unknown variable ' + name, { word: name })
  5145. * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
  5146. * // color: $black
  5147. * // a
  5148. * // ^
  5149. * // background: white
  5150. * }
  5151. */
  5152. var _proto = Node.prototype;
  5153. _proto.error = function error(message, opts) {
  5154. if (opts === void 0) {
  5155. opts = {};
  5156. }
  5157. if (this.source) {
  5158. var pos = this.positionBy(opts);
  5159. return this.source.input.error(message, pos.line, pos.column, opts);
  5160. }
  5161. return new _cssSyntaxError.default(message);
  5162. };
  5163. /**
  5164. * This method is provided as a convenience wrapper for {@link Result#warn}.
  5165. *
  5166. * @param {Result} result The {@link Result} instance
  5167. * that will receive the warning.
  5168. * @param {string} text Warning message.
  5169. * @param {object} [opts] Options
  5170. * @param {string} opts.plugin Plugin name that created this warning.
  5171. * PostCSS will set it automatically.
  5172. * @param {string} opts.word A word inside a node’s string that should
  5173. * be highlighted as the source of the warning.
  5174. * @param {number} opts.index An index inside a node’s string that should
  5175. * be highlighted as the source of the warning.
  5176. *
  5177. * @return {Warning} Created warning object.
  5178. *
  5179. * @example
  5180. * const plugin = postcss.plugin('postcss-deprecated', () => {
  5181. * return (root, result) => {
  5182. * root.walkDecls('bad', decl => {
  5183. * decl.warn(result, 'Deprecated property bad')
  5184. * })
  5185. * }
  5186. * })
  5187. */
  5188. _proto.warn = function warn(result, text, opts) {
  5189. var data = {
  5190. node: this
  5191. };
  5192. for (var i in opts) {
  5193. data[i] = opts[i];
  5194. }
  5195. return result.warn(text, data);
  5196. };
  5197. /**
  5198. * Removes the node from its parent and cleans the parent properties
  5199. * from the node and its children.
  5200. *
  5201. * @example
  5202. * if (decl.prop.match(/^-webkit-/)) {
  5203. * decl.remove()
  5204. * }
  5205. *
  5206. * @return {Node} Node to make calls chain.
  5207. */
  5208. _proto.remove = function remove() {
  5209. if (this.parent) {
  5210. this.parent.removeChild(this);
  5211. }
  5212. this.parent = undefined;
  5213. return this;
  5214. };
  5215. /**
  5216. * Returns a CSS string representing the node.
  5217. *
  5218. * @param {stringifier|syntax} [stringifier] A syntax to use
  5219. * in string generation.
  5220. *
  5221. * @return {string} CSS string of this node.
  5222. *
  5223. * @example
  5224. * postcss.rule({ selector: 'a' }).toString() //=> "a {}"
  5225. */
  5226. _proto.toString = function toString(stringifier) {
  5227. if (stringifier === void 0) {
  5228. stringifier = _stringify.default;
  5229. }
  5230. if (stringifier.stringify) stringifier = stringifier.stringify;
  5231. var result = '';
  5232. stringifier(this, function (i) {
  5233. result += i;
  5234. });
  5235. return result;
  5236. };
  5237. /**
  5238. * Returns an exact clone of the node.
  5239. *
  5240. * The resulting cloned node and its (cloned) children will retain
  5241. * code style properties.
  5242. *
  5243. * @param {object} [overrides] New properties to override in the clone.
  5244. *
  5245. * @example
  5246. * decl.raws.before //=> "\n "
  5247. * const cloned = decl.clone({ prop: '-moz-' + decl.prop })
  5248. * cloned.raws.before //=> "\n "
  5249. * cloned.toString() //=> -moz-transform: scale(0)
  5250. *
  5251. * @return {Node} Clone of the node.
  5252. */
  5253. _proto.clone = function clone(overrides) {
  5254. if (overrides === void 0) {
  5255. overrides = {};
  5256. }
  5257. var cloned = cloneNode(this);
  5258. for (var name in overrides) {
  5259. cloned[name] = overrides[name];
  5260. }
  5261. return cloned;
  5262. };
  5263. /**
  5264. * Shortcut to clone the node and insert the resulting cloned node
  5265. * before the current node.
  5266. *
  5267. * @param {object} [overrides] Mew properties to override in the clone.
  5268. *
  5269. * @example
  5270. * decl.cloneBefore({ prop: '-moz-' + decl.prop })
  5271. *
  5272. * @return {Node} New node
  5273. */
  5274. _proto.cloneBefore = function cloneBefore(overrides) {
  5275. if (overrides === void 0) {
  5276. overrides = {};
  5277. }
  5278. var cloned = this.clone(overrides);
  5279. this.parent.insertBefore(this, cloned);
  5280. return cloned;
  5281. };
  5282. /**
  5283. * Shortcut to clone the node and insert the resulting cloned node
  5284. * after the current node.
  5285. *
  5286. * @param {object} [overrides] New properties to override in the clone.
  5287. *
  5288. * @return {Node} New node.
  5289. */
  5290. _proto.cloneAfter = function cloneAfter(overrides) {
  5291. if (overrides === void 0) {
  5292. overrides = {};
  5293. }
  5294. var cloned = this.clone(overrides);
  5295. this.parent.insertAfter(this, cloned);
  5296. return cloned;
  5297. };
  5298. /**
  5299. * Inserts node(s) before the current node and removes the current node.
  5300. *
  5301. * @param {...Node} nodes Mode(s) to replace current one.
  5302. *
  5303. * @example
  5304. * if (atrule.name === 'mixin') {
  5305. * atrule.replaceWith(mixinRules[atrule.params])
  5306. * }
  5307. *
  5308. * @return {Node} Current node to methods chain.
  5309. */
  5310. _proto.replaceWith = function replaceWith() {
  5311. if (this.parent) {
  5312. for (var _len = arguments.length, nodes = new Array(_len), _key = 0; _key < _len; _key++) {
  5313. nodes[_key] = arguments[_key];
  5314. }
  5315. for (var _i = 0; _i < nodes.length; _i++) {
  5316. var node = nodes[_i];
  5317. this.parent.insertBefore(this, node);
  5318. }
  5319. this.remove();
  5320. }
  5321. return this;
  5322. };
  5323. /**
  5324. * Returns the next child of the node’s parent.
  5325. * Returns `undefined` if the current node is the last child.
  5326. *
  5327. * @return {Node|undefined} Next node.
  5328. *
  5329. * @example
  5330. * if (comment.text === 'delete next') {
  5331. * const next = comment.next()
  5332. * if (next) {
  5333. * next.remove()
  5334. * }
  5335. * }
  5336. */
  5337. _proto.next = function next() {
  5338. if (!this.parent) return undefined;
  5339. var index = this.parent.index(this);
  5340. return this.parent.nodes[index + 1];
  5341. };
  5342. /**
  5343. * Returns the previous child of the node’s parent.
  5344. * Returns `undefined` if the current node is the first child.
  5345. *
  5346. * @return {Node|undefined} Previous node.
  5347. *
  5348. * @example
  5349. * const annotation = decl.prev()
  5350. * if (annotation.type === 'comment') {
  5351. * readAnnotation(annotation.text)
  5352. * }
  5353. */
  5354. _proto.prev = function prev() {
  5355. if (!this.parent) return undefined;
  5356. var index = this.parent.index(this);
  5357. return this.parent.nodes[index - 1];
  5358. };
  5359. /**
  5360. * Insert new node before current node to current node’s parent.
  5361. *
  5362. * Just alias for `node.parent.insertBefore(node, add)`.
  5363. *
  5364. * @param {Node|object|string|Node[]} add New node.
  5365. *
  5366. * @return {Node} This node for methods chain.
  5367. *
  5368. * @example
  5369. * decl.before('content: ""')
  5370. */
  5371. _proto.before = function before(add) {
  5372. this.parent.insertBefore(this, add);
  5373. return this;
  5374. };
  5375. /**
  5376. * Insert new node after current node to current node’s parent.
  5377. *
  5378. * Just alias for `node.parent.insertAfter(node, add)`.
  5379. *
  5380. * @param {Node|object|string|Node[]} add New node.
  5381. *
  5382. * @return {Node} This node for methods chain.
  5383. *
  5384. * @example
  5385. * decl.after('color: black')
  5386. */
  5387. _proto.after = function after(add) {
  5388. this.parent.insertAfter(this, add);
  5389. return this;
  5390. };
  5391. _proto.toJSON = function toJSON() {
  5392. var fixed = {};
  5393. for (var name in this) {
  5394. if (!this.hasOwnProperty(name)) continue;
  5395. if (name === 'parent') continue;
  5396. var value = this[name];
  5397. if (value instanceof Array) {
  5398. fixed[name] = value.map(function (i) {
  5399. if (_typeof(i) === 'object' && i.toJSON) {
  5400. return i.toJSON();
  5401. } else {
  5402. return i;
  5403. }
  5404. });
  5405. } else if (_typeof(value) === 'object' && value.toJSON) {
  5406. fixed[name] = value.toJSON();
  5407. } else {
  5408. fixed[name] = value;
  5409. }
  5410. }
  5411. return fixed;
  5412. };
  5413. /**
  5414. * Returns a {@link Node#raws} value. If the node is missing
  5415. * the code style property (because the node was manually built or cloned),
  5416. * PostCSS will try to autodetect the code style property by looking
  5417. * at other nodes in the tree.
  5418. *
  5419. * @param {string} prop Name of code style property.
  5420. * @param {string} [defaultType] Name of default value, it can be missed
  5421. * if the value is the same as prop.
  5422. *
  5423. * @example
  5424. * const root = postcss.parse('a { background: white }')
  5425. * root.nodes[0].append({ prop: 'color', value: 'black' })
  5426. * root.nodes[0].nodes[1].raws.before //=> undefined
  5427. * root.nodes[0].nodes[1].raw('before') //=> ' '
  5428. *
  5429. * @return {string} Code style value.
  5430. */
  5431. _proto.raw = function raw(prop, defaultType) {
  5432. var str = new _stringifier.default();
  5433. return str.raw(this, prop, defaultType);
  5434. };
  5435. /**
  5436. * Finds the Root instance of the node’s tree.
  5437. *
  5438. * @example
  5439. * root.nodes[0].nodes[0].root() === root
  5440. *
  5441. * @return {Root} Root parent.
  5442. */
  5443. _proto.root = function root() {
  5444. var result = this;
  5445. while (result.parent) {
  5446. result = result.parent;
  5447. }
  5448. return result;
  5449. };
  5450. /**
  5451. * Clear the code style properties for the node and its children.
  5452. *
  5453. * @param {boolean} [keepBetween] Keep the raws.between symbols.
  5454. *
  5455. * @return {undefined}
  5456. *
  5457. * @example
  5458. * node.raws.before //=> ' '
  5459. * node.cleanRaws()
  5460. * node.raws.before //=> undefined
  5461. */
  5462. _proto.cleanRaws = function cleanRaws(keepBetween) {
  5463. delete this.raws.before;
  5464. delete this.raws.after;
  5465. if (!keepBetween) delete this.raws.between;
  5466. };
  5467. _proto.positionInside = function positionInside(index) {
  5468. var string = this.toString();
  5469. var column = this.source.start.column;
  5470. var line = this.source.start.line;
  5471. for (var i = 0; i < index; i++) {
  5472. if (string[i] === '\n') {
  5473. column = 1;
  5474. line += 1;
  5475. } else {
  5476. column += 1;
  5477. }
  5478. }
  5479. return {
  5480. line: line,
  5481. column: column
  5482. };
  5483. };
  5484. _proto.positionBy = function positionBy(opts) {
  5485. var pos = this.source.start;
  5486. if (opts.index) {
  5487. pos = this.positionInside(opts.index);
  5488. } else if (opts.word) {
  5489. var index = this.toString().indexOf(opts.word);
  5490. if (index !== -1) pos = this.positionInside(index);
  5491. }
  5492. return pos;
  5493. };
  5494. /**
  5495. * @memberof Node#
  5496. * @member {string} type String representing the node’s type.
  5497. * Possible values are `root`, `atrule`, `rule`,
  5498. * `decl`, or `comment`.
  5499. *
  5500. * @example
  5501. * postcss.decl({ prop: 'color', value: 'black' }).type //=> 'decl'
  5502. */
  5503. /**
  5504. * @memberof Node#
  5505. * @member {Container} parent The node’s parent node.
  5506. *
  5507. * @example
  5508. * root.nodes[0].parent === root
  5509. */
  5510. /**
  5511. * @memberof Node#
  5512. * @member {source} source The input source of the node.
  5513. *
  5514. * The property is used in source map generation.
  5515. *
  5516. * If you create a node manually (e.g., with `postcss.decl()`),
  5517. * that node will not have a `source` property and will be absent
  5518. * from the source map. For this reason, the plugin developer should
  5519. * consider cloning nodes to create new ones (in which case the new node’s
  5520. * source will reference the original, cloned node) or setting
  5521. * the `source` property manually.
  5522. *
  5523. * ```js
  5524. * // Bad
  5525. * const prefixed = postcss.decl({
  5526. * prop: '-moz-' + decl.prop,
  5527. * value: decl.value
  5528. * })
  5529. *
  5530. * // Good
  5531. * const prefixed = decl.clone({ prop: '-moz-' + decl.prop })
  5532. * ```
  5533. *
  5534. * ```js
  5535. * if (atrule.name === 'add-link') {
  5536. * const rule = postcss.rule({ selector: 'a', source: atrule.source })
  5537. * atrule.parent.insertBefore(atrule, rule)
  5538. * }
  5539. * ```
  5540. *
  5541. * @example
  5542. * decl.source.input.from //=> '/home/ai/a.sass'
  5543. * decl.source.start //=> { line: 10, column: 2 }
  5544. * decl.source.end //=> { line: 10, column: 12 }
  5545. */
  5546. /**
  5547. * @memberof Node#
  5548. * @member {object} raws Information to generate byte-to-byte equal
  5549. * node string as it was in the origin input.
  5550. *
  5551. * Every parser saves its own properties,
  5552. * but the default CSS parser uses:
  5553. *
  5554. * * `before`: the space symbols before the node. It also stores `*`
  5555. * and `_` symbols before the declaration (IE hack).
  5556. * * `after`: the space symbols after the last child of the node
  5557. * to the end of the node.
  5558. * * `between`: the symbols between the property and value
  5559. * for declarations, selector and `{` for rules, or last parameter
  5560. * and `{` for at-rules.
  5561. * * `semicolon`: contains true if the last child has
  5562. * an (optional) semicolon.
  5563. * * `afterName`: the space between the at-rule name and its parameters.
  5564. * * `left`: the space symbols between `/*` and the comment’s text.
  5565. * * `right`: the space symbols between the comment’s text
  5566. * and <code>*&#47;</code>.
  5567. * * `important`: the content of the important statement,
  5568. * if it is not just `!important`.
  5569. *
  5570. * PostCSS cleans selectors, declaration values and at-rule parameters
  5571. * from comments and extra spaces, but it stores origin content in raws
  5572. * properties. As such, if you don’t change a declaration’s value,
  5573. * PostCSS will use the raw value with comments.
  5574. *
  5575. * @example
  5576. * const root = postcss.parse('a {\n color:black\n}')
  5577. * root.first.first.raws //=> { before: '\n ', between: ':' }
  5578. */
  5579. return Node;
  5580. }();
  5581. var _default = Node;
  5582. /**
  5583. * @typedef {object} position
  5584. * @property {number} line Source line in file.
  5585. * @property {number} column Source column in file.
  5586. */
  5587. /**
  5588. * @typedef {object} source
  5589. * @property {Input} input {@link Input} with input file
  5590. * @property {position} start The starting position of the node’s source.
  5591. * @property {position} end The ending position of the node’s source.
  5592. */
  5593. exports.default = _default;
  5594. module.exports = exports.default;
  5595. /***/ }),
  5596. /* 21 */
  5597. /***/ (function(module, exports, __webpack_require__) {
  5598. "use strict";
  5599. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  5600. exports.__esModule = true;
  5601. var _createClass = function () {
  5602. function defineProperties(target, props) {
  5603. for (var i = 0; i < props.length; i++) {
  5604. var descriptor = props[i];
  5605. descriptor.enumerable = descriptor.enumerable || false;
  5606. descriptor.configurable = true;
  5607. if ("value" in descriptor) descriptor.writable = true;
  5608. Object.defineProperty(target, descriptor.key, descriptor);
  5609. }
  5610. }
  5611. return function (Constructor, protoProps, staticProps) {
  5612. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  5613. if (staticProps) defineProperties(Constructor, staticProps);
  5614. return Constructor;
  5615. };
  5616. }();
  5617. var _warnOnce = __webpack_require__(4);
  5618. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  5619. var _node = __webpack_require__(22);
  5620. var _node2 = _interopRequireDefault(_node);
  5621. function _interopRequireDefault(obj) {
  5622. return obj && obj.__esModule ? obj : {
  5623. default: obj
  5624. };
  5625. }
  5626. function _classCallCheck(instance, Constructor) {
  5627. if (!(instance instanceof Constructor)) {
  5628. throw new TypeError("Cannot call a class as a function");
  5629. }
  5630. }
  5631. function _possibleConstructorReturn(self, call) {
  5632. if (!self) {
  5633. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  5634. }
  5635. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  5636. }
  5637. function _inherits(subClass, superClass) {
  5638. if (typeof superClass !== "function" && superClass !== null) {
  5639. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  5640. }
  5641. subClass.prototype = Object.create(superClass && superClass.prototype, {
  5642. constructor: {
  5643. value: subClass,
  5644. enumerable: false,
  5645. writable: true,
  5646. configurable: true
  5647. }
  5648. });
  5649. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  5650. }
  5651. /**
  5652. * Represents a comment between declarations or statements (rule and at-rules).
  5653. *
  5654. * Comments inside selectors, at-rule parameters, or declaration values
  5655. * will be stored in the `raws` properties explained above.
  5656. *
  5657. * @extends Node
  5658. */
  5659. var Comment = function (_Node) {
  5660. _inherits(Comment, _Node);
  5661. function Comment(defaults) {
  5662. _classCallCheck(this, Comment);
  5663. var _this = _possibleConstructorReturn(this, _Node.call(this, defaults));
  5664. _this.type = 'comment';
  5665. return _this;
  5666. }
  5667. _createClass(Comment, [{
  5668. key: 'left',
  5669. get: function get() {
  5670. (0, _warnOnce2.default)('Comment#left was deprecated. Use Comment#raws.left');
  5671. return this.raws.left;
  5672. },
  5673. set: function set(val) {
  5674. (0, _warnOnce2.default)('Comment#left was deprecated. Use Comment#raws.left');
  5675. this.raws.left = val;
  5676. }
  5677. }, {
  5678. key: 'right',
  5679. get: function get() {
  5680. (0, _warnOnce2.default)('Comment#right was deprecated. Use Comment#raws.right');
  5681. return this.raws.right;
  5682. },
  5683. set: function set(val) {
  5684. (0, _warnOnce2.default)('Comment#right was deprecated. Use Comment#raws.right');
  5685. this.raws.right = val;
  5686. }
  5687. /**
  5688. * @memberof Comment#
  5689. * @member {string} text - the comment’s text
  5690. */
  5691. /**
  5692. * @memberof Comment#
  5693. * @member {object} raws - Information to generate byte-to-byte equal
  5694. * node string as it was in the origin input.
  5695. *
  5696. * Every parser saves its own properties,
  5697. * but the default CSS parser uses:
  5698. *
  5699. * * `before`: the space symbols before the node.
  5700. * * `left`: the space symbols between `/*` and the comment’s text.
  5701. * * `right`: the space symbols between the comment’s text.
  5702. */
  5703. }]);
  5704. return Comment;
  5705. }(_node2.default);
  5706. exports.default = Comment;
  5707. module.exports = exports['default'];
  5708. /***/ }),
  5709. /* 22 */
  5710. /***/ (function(module, exports, __webpack_require__) {
  5711. "use strict";
  5712. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  5713. exports.__esModule = true;
  5714. var _createClass = function () {
  5715. function defineProperties(target, props) {
  5716. for (var i = 0; i < props.length; i++) {
  5717. var descriptor = props[i];
  5718. descriptor.enumerable = descriptor.enumerable || false;
  5719. descriptor.configurable = true;
  5720. if ("value" in descriptor) descriptor.writable = true;
  5721. Object.defineProperty(target, descriptor.key, descriptor);
  5722. }
  5723. }
  5724. return function (Constructor, protoProps, staticProps) {
  5725. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  5726. if (staticProps) defineProperties(Constructor, staticProps);
  5727. return Constructor;
  5728. };
  5729. }();
  5730. var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  5731. return _typeof2(obj);
  5732. } : function (obj) {
  5733. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  5734. };
  5735. var _cssSyntaxError = __webpack_require__(73);
  5736. var _cssSyntaxError2 = _interopRequireDefault(_cssSyntaxError);
  5737. var _stringifier = __webpack_require__(24);
  5738. var _stringifier2 = _interopRequireDefault(_stringifier);
  5739. var _stringify = __webpack_require__(82);
  5740. var _stringify2 = _interopRequireDefault(_stringify);
  5741. var _warnOnce = __webpack_require__(4);
  5742. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  5743. function _interopRequireDefault(obj) {
  5744. return obj && obj.__esModule ? obj : {
  5745. default: obj
  5746. };
  5747. }
  5748. function _classCallCheck(instance, Constructor) {
  5749. if (!(instance instanceof Constructor)) {
  5750. throw new TypeError("Cannot call a class as a function");
  5751. }
  5752. }
  5753. var cloneNode = function cloneNode(obj, parent) {
  5754. var cloned = new obj.constructor();
  5755. for (var i in obj) {
  5756. if (!obj.hasOwnProperty(i)) continue;
  5757. var value = obj[i];
  5758. var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
  5759. if (i === 'parent' && type === 'object') {
  5760. if (parent) cloned[i] = parent;
  5761. } else if (i === 'source') {
  5762. cloned[i] = value;
  5763. } else if (value instanceof Array) {
  5764. cloned[i] = value.map(function (j) {
  5765. return cloneNode(j, cloned);
  5766. });
  5767. } else if (i !== 'before' && i !== 'after' && i !== 'between' && i !== 'semicolon') {
  5768. if (type === 'object' && value !== null) value = cloneNode(value);
  5769. cloned[i] = value;
  5770. }
  5771. }
  5772. return cloned;
  5773. };
  5774. /**
  5775. * All node classes inherit the following common methods.
  5776. *
  5777. * @abstract
  5778. */
  5779. var Node = function () {
  5780. /**
  5781. * @param {object} [defaults] - value for node properties
  5782. */
  5783. function Node() {
  5784. var defaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  5785. _classCallCheck(this, Node);
  5786. this.raws = {};
  5787. if ((typeof defaults === 'undefined' ? 'undefined' : _typeof(defaults)) !== 'object' && typeof defaults !== 'undefined') {
  5788. throw new Error('PostCSS nodes constructor accepts object, not ' + JSON.stringify(defaults));
  5789. }
  5790. for (var name in defaults) {
  5791. this[name] = defaults[name];
  5792. }
  5793. }
  5794. /**
  5795. * Returns a CssSyntaxError instance containing the original position
  5796. * of the node in the source, showing line and column numbers and also
  5797. * a small excerpt to facilitate debugging.
  5798. *
  5799. * If present, an input source map will be used to get the original position
  5800. * of the source, even from a previous compilation step
  5801. * (e.g., from Sass compilation).
  5802. *
  5803. * This method produces very useful error messages.
  5804. *
  5805. * @param {string} message - error description
  5806. * @param {object} [opts] - options
  5807. * @param {string} opts.plugin - plugin name that created this error.
  5808. * PostCSS will set it automatically.
  5809. * @param {string} opts.word - a word inside a node’s string that should
  5810. * be highlighted as the source of the error
  5811. * @param {number} opts.index - an index inside a node’s string that should
  5812. * be highlighted as the source of the error
  5813. *
  5814. * @return {CssSyntaxError} error object to throw it
  5815. *
  5816. * @example
  5817. * if ( !variables[name] ) {
  5818. * throw decl.error('Unknown variable ' + name, { word: name });
  5819. * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
  5820. * // color: $black
  5821. * // a
  5822. * // ^
  5823. * // background: white
  5824. * }
  5825. */
  5826. Node.prototype.error = function error(message) {
  5827. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5828. if (this.source) {
  5829. var pos = this.positionBy(opts);
  5830. return this.source.input.error(message, pos.line, pos.column, opts);
  5831. } else {
  5832. return new _cssSyntaxError2.default(message);
  5833. }
  5834. };
  5835. /**
  5836. * This method is provided as a convenience wrapper for {@link Result#warn}.
  5837. *
  5838. * @param {Result} result - the {@link Result} instance
  5839. * that will receive the warning
  5840. * @param {string} text - warning message
  5841. * @param {object} [opts] - options
  5842. * @param {string} opts.plugin - plugin name that created this warning.
  5843. * PostCSS will set it automatically.
  5844. * @param {string} opts.word - a word inside a node’s string that should
  5845. * be highlighted as the source of the warning
  5846. * @param {number} opts.index - an index inside a node’s string that should
  5847. * be highlighted as the source of the warning
  5848. *
  5849. * @return {Warning} created warning object
  5850. *
  5851. * @example
  5852. * const plugin = postcss.plugin('postcss-deprecated', () => {
  5853. * return (root, result) => {
  5854. * root.walkDecls('bad', decl => {
  5855. * decl.warn(result, 'Deprecated property bad');
  5856. * });
  5857. * };
  5858. * });
  5859. */
  5860. Node.prototype.warn = function warn(result, text, opts) {
  5861. var data = {
  5862. node: this
  5863. };
  5864. for (var i in opts) {
  5865. data[i] = opts[i];
  5866. }
  5867. return result.warn(text, data);
  5868. };
  5869. /**
  5870. * Removes the node from its parent and cleans the parent properties
  5871. * from the node and its children.
  5872. *
  5873. * @example
  5874. * if ( decl.prop.match(/^-webkit-/) ) {
  5875. * decl.remove();
  5876. * }
  5877. *
  5878. * @return {Node} node to make calls chain
  5879. */
  5880. Node.prototype.remove = function remove() {
  5881. if (this.parent) {
  5882. this.parent.removeChild(this);
  5883. }
  5884. this.parent = undefined;
  5885. return this;
  5886. };
  5887. /**
  5888. * Returns a CSS string representing the node.
  5889. *
  5890. * @param {stringifier|syntax} [stringifier] - a syntax to use
  5891. * in string generation
  5892. *
  5893. * @return {string} CSS string of this node
  5894. *
  5895. * @example
  5896. * postcss.rule({ selector: 'a' }).toString() //=> "a {}"
  5897. */
  5898. Node.prototype.toString = function toString() {
  5899. var stringifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _stringify2.default;
  5900. if (stringifier.stringify) stringifier = stringifier.stringify;
  5901. var result = '';
  5902. stringifier(this, function (i) {
  5903. result += i;
  5904. });
  5905. return result;
  5906. };
  5907. /**
  5908. * Returns a clone of the node.
  5909. *
  5910. * The resulting cloned node and its (cloned) children will have
  5911. * a clean parent and code style properties.
  5912. *
  5913. * @param {object} [overrides] - new properties to override in the clone.
  5914. *
  5915. * @example
  5916. * const cloned = decl.clone({ prop: '-moz-' + decl.prop });
  5917. * cloned.raws.before //=> undefined
  5918. * cloned.parent //=> undefined
  5919. * cloned.toString() //=> -moz-transform: scale(0)
  5920. *
  5921. * @return {Node} clone of the node
  5922. */
  5923. Node.prototype.clone = function clone() {
  5924. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  5925. var cloned = cloneNode(this);
  5926. for (var name in overrides) {
  5927. cloned[name] = overrides[name];
  5928. }
  5929. return cloned;
  5930. };
  5931. /**
  5932. * Shortcut to clone the node and insert the resulting cloned node
  5933. * before the current node.
  5934. *
  5935. * @param {object} [overrides] - new properties to override in the clone.
  5936. *
  5937. * @example
  5938. * decl.cloneBefore({ prop: '-moz-' + decl.prop });
  5939. *
  5940. * @return {Node} - new node
  5941. */
  5942. Node.prototype.cloneBefore = function cloneBefore() {
  5943. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  5944. var cloned = this.clone(overrides);
  5945. this.parent.insertBefore(this, cloned);
  5946. return cloned;
  5947. };
  5948. /**
  5949. * Shortcut to clone the node and insert the resulting cloned node
  5950. * after the current node.
  5951. *
  5952. * @param {object} [overrides] - new properties to override in the clone.
  5953. *
  5954. * @return {Node} - new node
  5955. */
  5956. Node.prototype.cloneAfter = function cloneAfter() {
  5957. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  5958. var cloned = this.clone(overrides);
  5959. this.parent.insertAfter(this, cloned);
  5960. return cloned;
  5961. };
  5962. /**
  5963. * Inserts node(s) before the current node and removes the current node.
  5964. *
  5965. * @param {...Node} nodes - node(s) to replace current one
  5966. *
  5967. * @example
  5968. * if ( atrule.name == 'mixin' ) {
  5969. * atrule.replaceWith(mixinRules[atrule.params]);
  5970. * }
  5971. *
  5972. * @return {Node} current node to methods chain
  5973. */
  5974. Node.prototype.replaceWith = function replaceWith() {
  5975. if (this.parent) {
  5976. for (var _len = arguments.length, nodes = Array(_len), _key = 0; _key < _len; _key++) {
  5977. nodes[_key] = arguments[_key];
  5978. }
  5979. for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  5980. var _ref;
  5981. if (_isArray) {
  5982. if (_i >= _iterator.length) break;
  5983. _ref = _iterator[_i++];
  5984. } else {
  5985. _i = _iterator.next();
  5986. if (_i.done) break;
  5987. _ref = _i.value;
  5988. }
  5989. var node = _ref;
  5990. this.parent.insertBefore(this, node);
  5991. }
  5992. this.remove();
  5993. }
  5994. return this;
  5995. };
  5996. /**
  5997. * Removes the node from its current parent and inserts it
  5998. * at the end of `newParent`.
  5999. *
  6000. * This will clean the `before` and `after` code {@link Node#raws} data
  6001. * from the node and replace them with the indentation style of `newParent`.
  6002. * It will also clean the `between` property
  6003. * if `newParent` is in another {@link Root}.
  6004. *
  6005. * @param {Container} newParent - container node where the current node
  6006. * will be moved
  6007. *
  6008. * @example
  6009. * atrule.moveTo(atrule.root());
  6010. *
  6011. * @return {Node} current node to methods chain
  6012. */
  6013. Node.prototype.moveTo = function moveTo(newParent) {
  6014. this.cleanRaws(this.root() === newParent.root());
  6015. this.remove();
  6016. newParent.append(this);
  6017. return this;
  6018. };
  6019. /**
  6020. * Removes the node from its current parent and inserts it into
  6021. * a new parent before `otherNode`.
  6022. *
  6023. * This will also clean the node’s code style properties just as it would
  6024. * in {@link Node#moveTo}.
  6025. *
  6026. * @param {Node} otherNode - node that will be before current node
  6027. *
  6028. * @return {Node} current node to methods chain
  6029. */
  6030. Node.prototype.moveBefore = function moveBefore(otherNode) {
  6031. this.cleanRaws(this.root() === otherNode.root());
  6032. this.remove();
  6033. otherNode.parent.insertBefore(otherNode, this);
  6034. return this;
  6035. };
  6036. /**
  6037. * Removes the node from its current parent and inserts it into
  6038. * a new parent after `otherNode`.
  6039. *
  6040. * This will also clean the node’s code style properties just as it would
  6041. * in {@link Node#moveTo}.
  6042. *
  6043. * @param {Node} otherNode - node that will be after current node
  6044. *
  6045. * @return {Node} current node to methods chain
  6046. */
  6047. Node.prototype.moveAfter = function moveAfter(otherNode) {
  6048. this.cleanRaws(this.root() === otherNode.root());
  6049. this.remove();
  6050. otherNode.parent.insertAfter(otherNode, this);
  6051. return this;
  6052. };
  6053. /**
  6054. * Returns the next child of the node’s parent.
  6055. * Returns `undefined` if the current node is the last child.
  6056. *
  6057. * @return {Node|undefined} next node
  6058. *
  6059. * @example
  6060. * if ( comment.text === 'delete next' ) {
  6061. * const next = comment.next();
  6062. * if ( next ) {
  6063. * next.remove();
  6064. * }
  6065. * }
  6066. */
  6067. Node.prototype.next = function next() {
  6068. var index = this.parent.index(this);
  6069. return this.parent.nodes[index + 1];
  6070. };
  6071. /**
  6072. * Returns the previous child of the node’s parent.
  6073. * Returns `undefined` if the current node is the first child.
  6074. *
  6075. * @return {Node|undefined} previous node
  6076. *
  6077. * @example
  6078. * const annotation = decl.prev();
  6079. * if ( annotation.type == 'comment' ) {
  6080. * readAnnotation(annotation.text);
  6081. * }
  6082. */
  6083. Node.prototype.prev = function prev() {
  6084. var index = this.parent.index(this);
  6085. return this.parent.nodes[index - 1];
  6086. };
  6087. Node.prototype.toJSON = function toJSON() {
  6088. var fixed = {};
  6089. for (var name in this) {
  6090. if (!this.hasOwnProperty(name)) continue;
  6091. if (name === 'parent') continue;
  6092. var value = this[name];
  6093. if (value instanceof Array) {
  6094. fixed[name] = value.map(function (i) {
  6095. if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object' && i.toJSON) {
  6096. return i.toJSON();
  6097. } else {
  6098. return i;
  6099. }
  6100. });
  6101. } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.toJSON) {
  6102. fixed[name] = value.toJSON();
  6103. } else {
  6104. fixed[name] = value;
  6105. }
  6106. }
  6107. return fixed;
  6108. };
  6109. /**
  6110. * Returns a {@link Node#raws} value. If the node is missing
  6111. * the code style property (because the node was manually built or cloned),
  6112. * PostCSS will try to autodetect the code style property by looking
  6113. * at other nodes in the tree.
  6114. *
  6115. * @param {string} prop - name of code style property
  6116. * @param {string} [defaultType] - name of default value, it can be missed
  6117. * if the value is the same as prop
  6118. *
  6119. * @example
  6120. * const root = postcss.parse('a { background: white }');
  6121. * root.nodes[0].append({ prop: 'color', value: 'black' });
  6122. * root.nodes[0].nodes[1].raws.before //=> undefined
  6123. * root.nodes[0].nodes[1].raw('before') //=> ' '
  6124. *
  6125. * @return {string} code style value
  6126. */
  6127. Node.prototype.raw = function raw(prop, defaultType) {
  6128. var str = new _stringifier2.default();
  6129. return str.raw(this, prop, defaultType);
  6130. };
  6131. /**
  6132. * Finds the Root instance of the node’s tree.
  6133. *
  6134. * @example
  6135. * root.nodes[0].nodes[0].root() === root
  6136. *
  6137. * @return {Root} root parent
  6138. */
  6139. Node.prototype.root = function root() {
  6140. var result = this;
  6141. while (result.parent) {
  6142. result = result.parent;
  6143. }
  6144. return result;
  6145. };
  6146. Node.prototype.cleanRaws = function cleanRaws(keepBetween) {
  6147. delete this.raws.before;
  6148. delete this.raws.after;
  6149. if (!keepBetween) delete this.raws.between;
  6150. };
  6151. Node.prototype.positionInside = function positionInside(index) {
  6152. var string = this.toString();
  6153. var column = this.source.start.column;
  6154. var line = this.source.start.line;
  6155. for (var i = 0; i < index; i++) {
  6156. if (string[i] === '\n') {
  6157. column = 1;
  6158. line += 1;
  6159. } else {
  6160. column += 1;
  6161. }
  6162. }
  6163. return {
  6164. line: line,
  6165. column: column
  6166. };
  6167. };
  6168. Node.prototype.positionBy = function positionBy(opts) {
  6169. var pos = this.source.start;
  6170. if (opts.index) {
  6171. pos = this.positionInside(opts.index);
  6172. } else if (opts.word) {
  6173. var index = this.toString().indexOf(opts.word);
  6174. if (index !== -1) pos = this.positionInside(index);
  6175. }
  6176. return pos;
  6177. };
  6178. Node.prototype.removeSelf = function removeSelf() {
  6179. (0, _warnOnce2.default)('Node#removeSelf is deprecated. Use Node#remove.');
  6180. return this.remove();
  6181. };
  6182. Node.prototype.replace = function replace(nodes) {
  6183. (0, _warnOnce2.default)('Node#replace is deprecated. Use Node#replaceWith');
  6184. return this.replaceWith(nodes);
  6185. };
  6186. Node.prototype.style = function style(own, detect) {
  6187. (0, _warnOnce2.default)('Node#style() is deprecated. Use Node#raw()');
  6188. return this.raw(own, detect);
  6189. };
  6190. Node.prototype.cleanStyles = function cleanStyles(keepBetween) {
  6191. (0, _warnOnce2.default)('Node#cleanStyles() is deprecated. Use Node#cleanRaws()');
  6192. return this.cleanRaws(keepBetween);
  6193. };
  6194. _createClass(Node, [{
  6195. key: 'before',
  6196. get: function get() {
  6197. (0, _warnOnce2.default)('Node#before is deprecated. Use Node#raws.before');
  6198. return this.raws.before;
  6199. },
  6200. set: function set(val) {
  6201. (0, _warnOnce2.default)('Node#before is deprecated. Use Node#raws.before');
  6202. this.raws.before = val;
  6203. }
  6204. }, {
  6205. key: 'between',
  6206. get: function get() {
  6207. (0, _warnOnce2.default)('Node#between is deprecated. Use Node#raws.between');
  6208. return this.raws.between;
  6209. },
  6210. set: function set(val) {
  6211. (0, _warnOnce2.default)('Node#between is deprecated. Use Node#raws.between');
  6212. this.raws.between = val;
  6213. }
  6214. /**
  6215. * @memberof Node#
  6216. * @member {string} type - String representing the node’s type.
  6217. * Possible values are `root`, `atrule`, `rule`,
  6218. * `decl`, or `comment`.
  6219. *
  6220. * @example
  6221. * postcss.decl({ prop: 'color', value: 'black' }).type //=> 'decl'
  6222. */
  6223. /**
  6224. * @memberof Node#
  6225. * @member {Container} parent - the node’s parent node.
  6226. *
  6227. * @example
  6228. * root.nodes[0].parent == root;
  6229. */
  6230. /**
  6231. * @memberof Node#
  6232. * @member {source} source - the input source of the node
  6233. *
  6234. * The property is used in source map generation.
  6235. *
  6236. * If you create a node manually (e.g., with `postcss.decl()`),
  6237. * that node will not have a `source` property and will be absent
  6238. * from the source map. For this reason, the plugin developer should
  6239. * consider cloning nodes to create new ones (in which case the new node’s
  6240. * source will reference the original, cloned node) or setting
  6241. * the `source` property manually.
  6242. *
  6243. * ```js
  6244. * // Bad
  6245. * const prefixed = postcss.decl({
  6246. * prop: '-moz-' + decl.prop,
  6247. * value: decl.value
  6248. * });
  6249. *
  6250. * // Good
  6251. * const prefixed = decl.clone({ prop: '-moz-' + decl.prop });
  6252. * ```
  6253. *
  6254. * ```js
  6255. * if ( atrule.name == 'add-link' ) {
  6256. * const rule = postcss.rule({ selector: 'a', source: atrule.source });
  6257. * atrule.parent.insertBefore(atrule, rule);
  6258. * }
  6259. * ```
  6260. *
  6261. * @example
  6262. * decl.source.input.from //=> '/home/ai/a.sass'
  6263. * decl.source.start //=> { line: 10, column: 2 }
  6264. * decl.source.end //=> { line: 10, column: 12 }
  6265. */
  6266. /**
  6267. * @memberof Node#
  6268. * @member {object} raws - Information to generate byte-to-byte equal
  6269. * node string as it was in the origin input.
  6270. *
  6271. * Every parser saves its own properties,
  6272. * but the default CSS parser uses:
  6273. *
  6274. * * `before`: the space symbols before the node. It also stores `*`
  6275. * and `_` symbols before the declaration (IE hack).
  6276. * * `after`: the space symbols after the last child of the node
  6277. * to the end of the node.
  6278. * * `between`: the symbols between the property and value
  6279. * for declarations, selector and `{` for rules, or last parameter
  6280. * and `{` for at-rules.
  6281. * * `semicolon`: contains true if the last child has
  6282. * an (optional) semicolon.
  6283. * * `afterName`: the space between the at-rule name and its parameters.
  6284. * * `left`: the space symbols between `/*` and the comment’s text.
  6285. * * `right`: the space symbols between the comment’s text
  6286. * and <code>*&#47;</code>.
  6287. * * `important`: the content of the important statement,
  6288. * if it is not just `!important`.
  6289. *
  6290. * PostCSS cleans selectors, declaration values and at-rule parameters
  6291. * from comments and extra spaces, but it stores origin content in raws
  6292. * properties. As such, if you don’t change a declaration’s value,
  6293. * PostCSS will use the raw value with comments.
  6294. *
  6295. * @example
  6296. * const root = postcss.parse('a {\n color:black\n}')
  6297. * root.first.first.raws //=> { before: '\n ', between: ':' }
  6298. */
  6299. }]);
  6300. return Node;
  6301. }();
  6302. exports.default = Node;
  6303. /**
  6304. * @typedef {object} position
  6305. * @property {number} line - source line in file
  6306. * @property {number} column - source column in file
  6307. */
  6308. /**
  6309. * @typedef {object} source
  6310. * @property {Input} input - {@link Input} with input file
  6311. * @property {position} start - The starting position of the node’s source
  6312. * @property {position} end - The ending position of the node’s source
  6313. */
  6314. module.exports = exports['default'];
  6315. /***/ }),
  6316. /* 23 */
  6317. /***/ (function(module, exports, __webpack_require__) {
  6318. "use strict";
  6319. exports.__esModule = true;
  6320. var _createClass = function () {
  6321. function defineProperties(target, props) {
  6322. for (var i = 0; i < props.length; i++) {
  6323. var descriptor = props[i];
  6324. descriptor.enumerable = descriptor.enumerable || false;
  6325. descriptor.configurable = true;
  6326. if ("value" in descriptor) descriptor.writable = true;
  6327. Object.defineProperty(target, descriptor.key, descriptor);
  6328. }
  6329. }
  6330. return function (Constructor, protoProps, staticProps) {
  6331. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  6332. if (staticProps) defineProperties(Constructor, staticProps);
  6333. return Constructor;
  6334. };
  6335. }();
  6336. var _cssSyntaxError = __webpack_require__(73);
  6337. var _cssSyntaxError2 = _interopRequireDefault(_cssSyntaxError);
  6338. var _previousMap = __webpack_require__(149);
  6339. var _previousMap2 = _interopRequireDefault(_previousMap);
  6340. var _path = __webpack_require__(6);
  6341. var _path2 = _interopRequireDefault(_path);
  6342. function _interopRequireDefault(obj) {
  6343. return obj && obj.__esModule ? obj : {
  6344. default: obj
  6345. };
  6346. }
  6347. function _classCallCheck(instance, Constructor) {
  6348. if (!(instance instanceof Constructor)) {
  6349. throw new TypeError("Cannot call a class as a function");
  6350. }
  6351. }
  6352. var sequence = 0;
  6353. /**
  6354. * Represents the source CSS.
  6355. *
  6356. * @example
  6357. * const root = postcss.parse(css, { from: file });
  6358. * const input = root.source.input;
  6359. */
  6360. var Input = function () {
  6361. /**
  6362. * @param {string} css - input CSS source
  6363. * @param {object} [opts] - {@link Processor#process} options
  6364. */
  6365. function Input(css) {
  6366. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6367. _classCallCheck(this, Input);
  6368. /**
  6369. * @member {string} - input CSS source
  6370. *
  6371. * @example
  6372. * const input = postcss.parse('a{}', { from: file }).input;
  6373. * input.css //=> "a{}";
  6374. */
  6375. this.css = css.toString();
  6376. if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
  6377. this.css = this.css.slice(1);
  6378. }
  6379. if (opts.from) {
  6380. if (/^\w+:\/\//.test(opts.from)) {
  6381. /**
  6382. * @member {string} - The absolute path to the CSS source file
  6383. * defined with the `from` option.
  6384. *
  6385. * @example
  6386. * const root = postcss.parse(css, { from: 'a.css' });
  6387. * root.source.input.file //=> '/home/ai/a.css'
  6388. */
  6389. this.file = opts.from;
  6390. } else {
  6391. this.file = _path2.default.resolve(opts.from);
  6392. }
  6393. }
  6394. var map = new _previousMap2.default(this.css, opts);
  6395. if (map.text) {
  6396. /**
  6397. * @member {PreviousMap} - The input source map passed from
  6398. * a compilation step before PostCSS
  6399. * (for example, from Sass compiler).
  6400. *
  6401. * @example
  6402. * root.source.input.map.consumer().sources //=> ['a.sass']
  6403. */
  6404. this.map = map;
  6405. var file = map.consumer().file;
  6406. if (!this.file && file) this.file = this.mapResolve(file);
  6407. }
  6408. if (!this.file) {
  6409. sequence += 1;
  6410. /**
  6411. * @member {string} - The unique ID of the CSS source. It will be
  6412. * created if `from` option is not provided
  6413. * (because PostCSS does not know the file path).
  6414. *
  6415. * @example
  6416. * const root = postcss.parse(css);
  6417. * root.source.input.file //=> undefined
  6418. * root.source.input.id //=> "<input css 1>"
  6419. */
  6420. this.id = '<input css ' + sequence + '>';
  6421. }
  6422. if (this.map) this.map.file = this.from;
  6423. }
  6424. Input.prototype.error = function error(message, line, column) {
  6425. var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  6426. var result = void 0;
  6427. var origin = this.origin(line, column);
  6428. if (origin) {
  6429. result = new _cssSyntaxError2.default(message, origin.line, origin.column, origin.source, origin.file, opts.plugin);
  6430. } else {
  6431. result = new _cssSyntaxError2.default(message, line, column, this.css, this.file, opts.plugin);
  6432. }
  6433. result.input = {
  6434. line: line,
  6435. column: column,
  6436. source: this.css
  6437. };
  6438. if (this.file) result.input.file = this.file;
  6439. return result;
  6440. };
  6441. /**
  6442. * Reads the input source map and returns a symbol position
  6443. * in the input source (e.g., in a Sass file that was compiled
  6444. * to CSS before being passed to PostCSS).
  6445. *
  6446. * @param {number} line - line in input CSS
  6447. * @param {number} column - column in input CSS
  6448. *
  6449. * @return {filePosition} position in input source
  6450. *
  6451. * @example
  6452. * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }
  6453. */
  6454. Input.prototype.origin = function origin(line, column) {
  6455. if (!this.map) return false;
  6456. var consumer = this.map.consumer();
  6457. var from = consumer.originalPositionFor({
  6458. line: line,
  6459. column: column
  6460. });
  6461. if (!from.source) return false;
  6462. var result = {
  6463. file: this.mapResolve(from.source),
  6464. line: from.line,
  6465. column: from.column
  6466. };
  6467. var source = consumer.sourceContentFor(from.source);
  6468. if (source) result.source = source;
  6469. return result;
  6470. };
  6471. Input.prototype.mapResolve = function mapResolve(file) {
  6472. if (/^\w+:\/\//.test(file)) {
  6473. return file;
  6474. } else {
  6475. return _path2.default.resolve(this.map.consumer().sourceRoot || '.', file);
  6476. }
  6477. };
  6478. /**
  6479. * The CSS source identifier. Contains {@link Input#file} if the user
  6480. * set the `from` option, or {@link Input#id} if they did not.
  6481. * @type {string}
  6482. *
  6483. * @example
  6484. * const root = postcss.parse(css, { from: 'a.css' });
  6485. * root.source.input.from //=> "/home/ai/a.css"
  6486. *
  6487. * const root = postcss.parse(css);
  6488. * root.source.input.from //=> "<input css 1>"
  6489. */
  6490. _createClass(Input, [{
  6491. key: 'from',
  6492. get: function get() {
  6493. return this.file || this.id;
  6494. }
  6495. }]);
  6496. return Input;
  6497. }();
  6498. exports.default = Input;
  6499. /**
  6500. * @typedef {object} filePosition
  6501. * @property {string} file - path to file
  6502. * @property {number} line - source line in file
  6503. * @property {number} column - source column in file
  6504. */
  6505. module.exports = exports['default'];
  6506. /***/ }),
  6507. /* 24 */
  6508. /***/ (function(module, exports, __webpack_require__) {
  6509. "use strict";
  6510. exports.__esModule = true;
  6511. function _classCallCheck(instance, Constructor) {
  6512. if (!(instance instanceof Constructor)) {
  6513. throw new TypeError("Cannot call a class as a function");
  6514. }
  6515. }
  6516. var defaultRaw = {
  6517. colon: ': ',
  6518. indent: ' ',
  6519. beforeDecl: '\n',
  6520. beforeRule: '\n',
  6521. beforeOpen: ' ',
  6522. beforeClose: '\n',
  6523. beforeComment: '\n',
  6524. after: '\n',
  6525. emptyBody: '',
  6526. commentLeft: ' ',
  6527. commentRight: ' '
  6528. };
  6529. function capitalize(str) {
  6530. return str[0].toUpperCase() + str.slice(1);
  6531. }
  6532. var Stringifier = function () {
  6533. function Stringifier(builder) {
  6534. _classCallCheck(this, Stringifier);
  6535. this.builder = builder;
  6536. }
  6537. Stringifier.prototype.stringify = function stringify(node, semicolon) {
  6538. this[node.type](node, semicolon);
  6539. };
  6540. Stringifier.prototype.root = function root(node) {
  6541. this.body(node);
  6542. if (node.raws.after) this.builder(node.raws.after);
  6543. };
  6544. Stringifier.prototype.comment = function comment(node) {
  6545. var left = this.raw(node, 'left', 'commentLeft');
  6546. var right = this.raw(node, 'right', 'commentRight');
  6547. this.builder('/*' + left + node.text + right + '*/', node);
  6548. };
  6549. Stringifier.prototype.decl = function decl(node, semicolon) {
  6550. var between = this.raw(node, 'between', 'colon');
  6551. var string = node.prop + between + this.rawValue(node, 'value');
  6552. if (node.important) {
  6553. string += node.raws.important || ' !important';
  6554. }
  6555. if (semicolon) string += ';';
  6556. this.builder(string, node);
  6557. };
  6558. Stringifier.prototype.rule = function rule(node) {
  6559. this.block(node, this.rawValue(node, 'selector'));
  6560. };
  6561. Stringifier.prototype.atrule = function atrule(node, semicolon) {
  6562. var name = '@' + node.name;
  6563. var params = node.params ? this.rawValue(node, 'params') : '';
  6564. if (typeof node.raws.afterName !== 'undefined') {
  6565. name += node.raws.afterName;
  6566. } else if (params) {
  6567. name += ' ';
  6568. }
  6569. if (node.nodes) {
  6570. this.block(node, name + params);
  6571. } else {
  6572. var end = (node.raws.between || '') + (semicolon ? ';' : '');
  6573. this.builder(name + params + end, node);
  6574. }
  6575. };
  6576. Stringifier.prototype.body = function body(node) {
  6577. var last = node.nodes.length - 1;
  6578. while (last > 0) {
  6579. if (node.nodes[last].type !== 'comment') break;
  6580. last -= 1;
  6581. }
  6582. var semicolon = this.raw(node, 'semicolon');
  6583. for (var i = 0; i < node.nodes.length; i++) {
  6584. var child = node.nodes[i];
  6585. var before = this.raw(child, 'before');
  6586. if (before) this.builder(before);
  6587. this.stringify(child, last !== i || semicolon);
  6588. }
  6589. };
  6590. Stringifier.prototype.block = function block(node, start) {
  6591. var between = this.raw(node, 'between', 'beforeOpen');
  6592. this.builder(start + between + '{', node, 'start');
  6593. var after = void 0;
  6594. if (node.nodes && node.nodes.length) {
  6595. this.body(node);
  6596. after = this.raw(node, 'after');
  6597. } else {
  6598. after = this.raw(node, 'after', 'emptyBody');
  6599. }
  6600. if (after) this.builder(after);
  6601. this.builder('}', node, 'end');
  6602. };
  6603. Stringifier.prototype.raw = function raw(node, own, detect) {
  6604. var value = void 0;
  6605. if (!detect) detect = own; // Already had
  6606. if (own) {
  6607. value = node.raws[own];
  6608. if (typeof value !== 'undefined') return value;
  6609. }
  6610. var parent = node.parent; // Hack for first rule in CSS
  6611. if (detect === 'before') {
  6612. if (!parent || parent.type === 'root' && parent.first === node) {
  6613. return '';
  6614. }
  6615. } // Floating child without parent
  6616. if (!parent) return defaultRaw[detect]; // Detect style by other nodes
  6617. var root = node.root();
  6618. if (!root.rawCache) root.rawCache = {};
  6619. if (typeof root.rawCache[detect] !== 'undefined') {
  6620. return root.rawCache[detect];
  6621. }
  6622. if (detect === 'before' || detect === 'after') {
  6623. return this.beforeAfter(node, detect);
  6624. } else {
  6625. var method = 'raw' + capitalize(detect);
  6626. if (this[method]) {
  6627. value = this[method](root, node);
  6628. } else {
  6629. root.walk(function (i) {
  6630. value = i.raws[own];
  6631. if (typeof value !== 'undefined') return false;
  6632. });
  6633. }
  6634. }
  6635. if (typeof value === 'undefined') value = defaultRaw[detect];
  6636. root.rawCache[detect] = value;
  6637. return value;
  6638. };
  6639. Stringifier.prototype.rawSemicolon = function rawSemicolon(root) {
  6640. var value = void 0;
  6641. root.walk(function (i) {
  6642. if (i.nodes && i.nodes.length && i.last.type === 'decl') {
  6643. value = i.raws.semicolon;
  6644. if (typeof value !== 'undefined') return false;
  6645. }
  6646. });
  6647. return value;
  6648. };
  6649. Stringifier.prototype.rawEmptyBody = function rawEmptyBody(root) {
  6650. var value = void 0;
  6651. root.walk(function (i) {
  6652. if (i.nodes && i.nodes.length === 0) {
  6653. value = i.raws.after;
  6654. if (typeof value !== 'undefined') return false;
  6655. }
  6656. });
  6657. return value;
  6658. };
  6659. Stringifier.prototype.rawIndent = function rawIndent(root) {
  6660. if (root.raws.indent) return root.raws.indent;
  6661. var value = void 0;
  6662. root.walk(function (i) {
  6663. var p = i.parent;
  6664. if (p && p !== root && p.parent && p.parent === root) {
  6665. if (typeof i.raws.before !== 'undefined') {
  6666. var parts = i.raws.before.split('\n');
  6667. value = parts[parts.length - 1];
  6668. value = value.replace(/[^\s]/g, '');
  6669. return false;
  6670. }
  6671. }
  6672. });
  6673. return value;
  6674. };
  6675. Stringifier.prototype.rawBeforeComment = function rawBeforeComment(root, node) {
  6676. var value = void 0;
  6677. root.walkComments(function (i) {
  6678. if (typeof i.raws.before !== 'undefined') {
  6679. value = i.raws.before;
  6680. if (value.indexOf('\n') !== -1) {
  6681. value = value.replace(/[^\n]+$/, '');
  6682. }
  6683. return false;
  6684. }
  6685. });
  6686. if (typeof value === 'undefined') {
  6687. value = this.raw(node, null, 'beforeDecl');
  6688. }
  6689. return value;
  6690. };
  6691. Stringifier.prototype.rawBeforeDecl = function rawBeforeDecl(root, node) {
  6692. var value = void 0;
  6693. root.walkDecls(function (i) {
  6694. if (typeof i.raws.before !== 'undefined') {
  6695. value = i.raws.before;
  6696. if (value.indexOf('\n') !== -1) {
  6697. value = value.replace(/[^\n]+$/, '');
  6698. }
  6699. return false;
  6700. }
  6701. });
  6702. if (typeof value === 'undefined') {
  6703. value = this.raw(node, null, 'beforeRule');
  6704. }
  6705. return value;
  6706. };
  6707. Stringifier.prototype.rawBeforeRule = function rawBeforeRule(root) {
  6708. var value = void 0;
  6709. root.walk(function (i) {
  6710. if (i.nodes && (i.parent !== root || root.first !== i)) {
  6711. if (typeof i.raws.before !== 'undefined') {
  6712. value = i.raws.before;
  6713. if (value.indexOf('\n') !== -1) {
  6714. value = value.replace(/[^\n]+$/, '');
  6715. }
  6716. return false;
  6717. }
  6718. }
  6719. });
  6720. return value;
  6721. };
  6722. Stringifier.prototype.rawBeforeClose = function rawBeforeClose(root) {
  6723. var value = void 0;
  6724. root.walk(function (i) {
  6725. if (i.nodes && i.nodes.length > 0) {
  6726. if (typeof i.raws.after !== 'undefined') {
  6727. value = i.raws.after;
  6728. if (value.indexOf('\n') !== -1) {
  6729. value = value.replace(/[^\n]+$/, '');
  6730. }
  6731. return false;
  6732. }
  6733. }
  6734. });
  6735. return value;
  6736. };
  6737. Stringifier.prototype.rawBeforeOpen = function rawBeforeOpen(root) {
  6738. var value = void 0;
  6739. root.walk(function (i) {
  6740. if (i.type !== 'decl') {
  6741. value = i.raws.between;
  6742. if (typeof value !== 'undefined') return false;
  6743. }
  6744. });
  6745. return value;
  6746. };
  6747. Stringifier.prototype.rawColon = function rawColon(root) {
  6748. var value = void 0;
  6749. root.walkDecls(function (i) {
  6750. if (typeof i.raws.between !== 'undefined') {
  6751. value = i.raws.between.replace(/[^\s:]/g, '');
  6752. return false;
  6753. }
  6754. });
  6755. return value;
  6756. };
  6757. Stringifier.prototype.beforeAfter = function beforeAfter(node, detect) {
  6758. var value = void 0;
  6759. if (node.type === 'decl') {
  6760. value = this.raw(node, null, 'beforeDecl');
  6761. } else if (node.type === 'comment') {
  6762. value = this.raw(node, null, 'beforeComment');
  6763. } else if (detect === 'before') {
  6764. value = this.raw(node, null, 'beforeRule');
  6765. } else {
  6766. value = this.raw(node, null, 'beforeClose');
  6767. }
  6768. var buf = node.parent;
  6769. var depth = 0;
  6770. while (buf && buf.type !== 'root') {
  6771. depth += 1;
  6772. buf = buf.parent;
  6773. }
  6774. if (value.indexOf('\n') !== -1) {
  6775. var indent = this.raw(node, null, 'indent');
  6776. if (indent.length) {
  6777. for (var step = 0; step < depth; step++) {
  6778. value += indent;
  6779. }
  6780. }
  6781. }
  6782. return value;
  6783. };
  6784. Stringifier.prototype.rawValue = function rawValue(node, prop) {
  6785. var value = node[prop];
  6786. var raw = node.raws[prop];
  6787. if (raw && raw.value === value) {
  6788. return raw.raw;
  6789. } else {
  6790. return value;
  6791. }
  6792. };
  6793. return Stringifier;
  6794. }();
  6795. exports.default = Stringifier;
  6796. module.exports = exports['default'];
  6797. /***/ }),
  6798. /* 25 */
  6799. /***/ (function(module, exports, __webpack_require__) {
  6800. "use strict";
  6801. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  6802. exports.__esModule = true;
  6803. var _createClass = function () {
  6804. function defineProperties(target, props) {
  6805. for (var i = 0; i < props.length; i++) {
  6806. var descriptor = props[i];
  6807. descriptor.enumerable = descriptor.enumerable || false;
  6808. descriptor.configurable = true;
  6809. if ("value" in descriptor) descriptor.writable = true;
  6810. Object.defineProperty(target, descriptor.key, descriptor);
  6811. }
  6812. }
  6813. return function (Constructor, protoProps, staticProps) {
  6814. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  6815. if (staticProps) defineProperties(Constructor, staticProps);
  6816. return Constructor;
  6817. };
  6818. }();
  6819. var _declaration = __webpack_require__(83);
  6820. var _declaration2 = _interopRequireDefault(_declaration);
  6821. var _warnOnce = __webpack_require__(4);
  6822. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  6823. var _comment = __webpack_require__(21);
  6824. var _comment2 = _interopRequireDefault(_comment);
  6825. var _node = __webpack_require__(22);
  6826. var _node2 = _interopRequireDefault(_node);
  6827. function _interopRequireDefault(obj) {
  6828. return obj && obj.__esModule ? obj : {
  6829. default: obj
  6830. };
  6831. }
  6832. function _classCallCheck(instance, Constructor) {
  6833. if (!(instance instanceof Constructor)) {
  6834. throw new TypeError("Cannot call a class as a function");
  6835. }
  6836. }
  6837. function _possibleConstructorReturn(self, call) {
  6838. if (!self) {
  6839. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  6840. }
  6841. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  6842. }
  6843. function _inherits(subClass, superClass) {
  6844. if (typeof superClass !== "function" && superClass !== null) {
  6845. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  6846. }
  6847. subClass.prototype = Object.create(superClass && superClass.prototype, {
  6848. constructor: {
  6849. value: subClass,
  6850. enumerable: false,
  6851. writable: true,
  6852. configurable: true
  6853. }
  6854. });
  6855. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  6856. }
  6857. function cleanSource(nodes) {
  6858. return nodes.map(function (i) {
  6859. if (i.nodes) i.nodes = cleanSource(i.nodes);
  6860. delete i.source;
  6861. return i;
  6862. });
  6863. }
  6864. /**
  6865. * The {@link Root}, {@link AtRule}, and {@link Rule} container nodes
  6866. * inherit some common methods to help work with their children.
  6867. *
  6868. * Note that all containers can store any content. If you write a rule inside
  6869. * a rule, PostCSS will parse it.
  6870. *
  6871. * @extends Node
  6872. * @abstract
  6873. */
  6874. var Container = function (_Node) {
  6875. _inherits(Container, _Node);
  6876. function Container() {
  6877. _classCallCheck(this, Container);
  6878. return _possibleConstructorReturn(this, _Node.apply(this, arguments));
  6879. }
  6880. Container.prototype.push = function push(child) {
  6881. child.parent = this;
  6882. this.nodes.push(child);
  6883. return this;
  6884. };
  6885. /**
  6886. * Iterates through the container’s immediate children,
  6887. * calling `callback` for each child.
  6888. *
  6889. * Returning `false` in the callback will break iteration.
  6890. *
  6891. * This method only iterates through the container’s immediate children.
  6892. * If you need to recursively iterate through all the container’s descendant
  6893. * nodes, use {@link Container#walk}.
  6894. *
  6895. * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe
  6896. * if you are mutating the array of child nodes during iteration.
  6897. * PostCSS will adjust the current index to match the mutations.
  6898. *
  6899. * @param {childIterator} callback - iterator receives each node and index
  6900. *
  6901. * @return {false|undefined} returns `false` if iteration was broke
  6902. *
  6903. * @example
  6904. * const root = postcss.parse('a { color: black; z-index: 1 }');
  6905. * const rule = root.first;
  6906. *
  6907. * for ( let decl of rule.nodes ) {
  6908. * decl.cloneBefore({ prop: '-webkit-' + decl.prop });
  6909. * // Cycle will be infinite, because cloneBefore moves the current node
  6910. * // to the next index
  6911. * }
  6912. *
  6913. * rule.each(decl => {
  6914. * decl.cloneBefore({ prop: '-webkit-' + decl.prop });
  6915. * // Will be executed only for color and z-index
  6916. * });
  6917. */
  6918. Container.prototype.each = function each(callback) {
  6919. if (!this.lastEach) this.lastEach = 0;
  6920. if (!this.indexes) this.indexes = {};
  6921. this.lastEach += 1;
  6922. var id = this.lastEach;
  6923. this.indexes[id] = 0;
  6924. if (!this.nodes) return undefined;
  6925. var index = void 0,
  6926. result = void 0;
  6927. while (this.indexes[id] < this.nodes.length) {
  6928. index = this.indexes[id];
  6929. result = callback(this.nodes[index], index);
  6930. if (result === false) break;
  6931. this.indexes[id] += 1;
  6932. }
  6933. delete this.indexes[id];
  6934. return result;
  6935. };
  6936. /**
  6937. * Traverses the container’s descendant nodes, calling callback
  6938. * for each node.
  6939. *
  6940. * Like container.each(), this method is safe to use
  6941. * if you are mutating arrays during iteration.
  6942. *
  6943. * If you only need to iterate through the container’s immediate children,
  6944. * use {@link Container#each}.
  6945. *
  6946. * @param {childIterator} callback - iterator receives each node and index
  6947. *
  6948. * @return {false|undefined} returns `false` if iteration was broke
  6949. *
  6950. * @example
  6951. * root.walk(node => {
  6952. * // Traverses all descendant nodes.
  6953. * });
  6954. */
  6955. Container.prototype.walk = function walk(callback) {
  6956. return this.each(function (child, i) {
  6957. var result = callback(child, i);
  6958. if (result !== false && child.walk) {
  6959. result = child.walk(callback);
  6960. }
  6961. return result;
  6962. });
  6963. };
  6964. /**
  6965. * Traverses the container’s descendant nodes, calling callback
  6966. * for each declaration node.
  6967. *
  6968. * If you pass a filter, iteration will only happen over declarations
  6969. * with matching properties.
  6970. *
  6971. * Like {@link Container#each}, this method is safe
  6972. * to use if you are mutating arrays during iteration.
  6973. *
  6974. * @param {string|RegExp} [prop] - string or regular expression
  6975. * to filter declarations by property name
  6976. * @param {childIterator} callback - iterator receives each node and index
  6977. *
  6978. * @return {false|undefined} returns `false` if iteration was broke
  6979. *
  6980. * @example
  6981. * root.walkDecls(decl => {
  6982. * checkPropertySupport(decl.prop);
  6983. * });
  6984. *
  6985. * root.walkDecls('border-radius', decl => {
  6986. * decl.remove();
  6987. * });
  6988. *
  6989. * root.walkDecls(/^background/, decl => {
  6990. * decl.value = takeFirstColorFromGradient(decl.value);
  6991. * });
  6992. */
  6993. Container.prototype.walkDecls = function walkDecls(prop, callback) {
  6994. if (!callback) {
  6995. callback = prop;
  6996. return this.walk(function (child, i) {
  6997. if (child.type === 'decl') {
  6998. return callback(child, i);
  6999. }
  7000. });
  7001. } else if (prop instanceof RegExp) {
  7002. return this.walk(function (child, i) {
  7003. if (child.type === 'decl' && prop.test(child.prop)) {
  7004. return callback(child, i);
  7005. }
  7006. });
  7007. } else {
  7008. return this.walk(function (child, i) {
  7009. if (child.type === 'decl' && child.prop === prop) {
  7010. return callback(child, i);
  7011. }
  7012. });
  7013. }
  7014. };
  7015. /**
  7016. * Traverses the container’s descendant nodes, calling callback
  7017. * for each rule node.
  7018. *
  7019. * If you pass a filter, iteration will only happen over rules
  7020. * with matching selectors.
  7021. *
  7022. * Like {@link Container#each}, this method is safe
  7023. * to use if you are mutating arrays during iteration.
  7024. *
  7025. * @param {string|RegExp} [selector] - string or regular expression
  7026. * to filter rules by selector
  7027. * @param {childIterator} callback - iterator receives each node and index
  7028. *
  7029. * @return {false|undefined} returns `false` if iteration was broke
  7030. *
  7031. * @example
  7032. * const selectors = [];
  7033. * root.walkRules(rule => {
  7034. * selectors.push(rule.selector);
  7035. * });
  7036. * console.log(`Your CSS uses ${selectors.length} selectors`);
  7037. */
  7038. Container.prototype.walkRules = function walkRules(selector, callback) {
  7039. if (!callback) {
  7040. callback = selector;
  7041. return this.walk(function (child, i) {
  7042. if (child.type === 'rule') {
  7043. return callback(child, i);
  7044. }
  7045. });
  7046. } else if (selector instanceof RegExp) {
  7047. return this.walk(function (child, i) {
  7048. if (child.type === 'rule' && selector.test(child.selector)) {
  7049. return callback(child, i);
  7050. }
  7051. });
  7052. } else {
  7053. return this.walk(function (child, i) {
  7054. if (child.type === 'rule' && child.selector === selector) {
  7055. return callback(child, i);
  7056. }
  7057. });
  7058. }
  7059. };
  7060. /**
  7061. * Traverses the container’s descendant nodes, calling callback
  7062. * for each at-rule node.
  7063. *
  7064. * If you pass a filter, iteration will only happen over at-rules
  7065. * that have matching names.
  7066. *
  7067. * Like {@link Container#each}, this method is safe
  7068. * to use if you are mutating arrays during iteration.
  7069. *
  7070. * @param {string|RegExp} [name] - string or regular expression
  7071. * to filter at-rules by name
  7072. * @param {childIterator} callback - iterator receives each node and index
  7073. *
  7074. * @return {false|undefined} returns `false` if iteration was broke
  7075. *
  7076. * @example
  7077. * root.walkAtRules(rule => {
  7078. * if ( isOld(rule.name) ) rule.remove();
  7079. * });
  7080. *
  7081. * let first = false;
  7082. * root.walkAtRules('charset', rule => {
  7083. * if ( !first ) {
  7084. * first = true;
  7085. * } else {
  7086. * rule.remove();
  7087. * }
  7088. * });
  7089. */
  7090. Container.prototype.walkAtRules = function walkAtRules(name, callback) {
  7091. if (!callback) {
  7092. callback = name;
  7093. return this.walk(function (child, i) {
  7094. if (child.type === 'atrule') {
  7095. return callback(child, i);
  7096. }
  7097. });
  7098. } else if (name instanceof RegExp) {
  7099. return this.walk(function (child, i) {
  7100. if (child.type === 'atrule' && name.test(child.name)) {
  7101. return callback(child, i);
  7102. }
  7103. });
  7104. } else {
  7105. return this.walk(function (child, i) {
  7106. if (child.type === 'atrule' && child.name === name) {
  7107. return callback(child, i);
  7108. }
  7109. });
  7110. }
  7111. };
  7112. /**
  7113. * Traverses the container’s descendant nodes, calling callback
  7114. * for each comment node.
  7115. *
  7116. * Like {@link Container#each}, this method is safe
  7117. * to use if you are mutating arrays during iteration.
  7118. *
  7119. * @param {childIterator} callback - iterator receives each node and index
  7120. *
  7121. * @return {false|undefined} returns `false` if iteration was broke
  7122. *
  7123. * @example
  7124. * root.walkComments(comment => {
  7125. * comment.remove();
  7126. * });
  7127. */
  7128. Container.prototype.walkComments = function walkComments(callback) {
  7129. return this.walk(function (child, i) {
  7130. if (child.type === 'comment') {
  7131. return callback(child, i);
  7132. }
  7133. });
  7134. };
  7135. /**
  7136. * Inserts new nodes to the end of the container.
  7137. *
  7138. * @param {...(Node|object|string|Node[])} children - new nodes
  7139. *
  7140. * @return {Node} this node for methods chain
  7141. *
  7142. * @example
  7143. * const decl1 = postcss.decl({ prop: 'color', value: 'black' });
  7144. * const decl2 = postcss.decl({ prop: 'background-color', value: 'white' });
  7145. * rule.append(decl1, decl2);
  7146. *
  7147. * root.append({ name: 'charset', params: '"UTF-8"' }); // at-rule
  7148. * root.append({ selector: 'a' }); // rule
  7149. * rule.append({ prop: 'color', value: 'black' }); // declaration
  7150. * rule.append({ text: 'Comment' }) // comment
  7151. *
  7152. * root.append('a {}');
  7153. * root.first.append('color: black; z-index: 1');
  7154. */
  7155. Container.prototype.append = function append() {
  7156. for (var _len = arguments.length, children = Array(_len), _key = 0; _key < _len; _key++) {
  7157. children[_key] = arguments[_key];
  7158. }
  7159. for (var _iterator = children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  7160. var _ref;
  7161. if (_isArray) {
  7162. if (_i >= _iterator.length) break;
  7163. _ref = _iterator[_i++];
  7164. } else {
  7165. _i = _iterator.next();
  7166. if (_i.done) break;
  7167. _ref = _i.value;
  7168. }
  7169. var child = _ref;
  7170. var nodes = this.normalize(child, this.last);
  7171. for (var _iterator2 = nodes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  7172. var _ref2;
  7173. if (_isArray2) {
  7174. if (_i2 >= _iterator2.length) break;
  7175. _ref2 = _iterator2[_i2++];
  7176. } else {
  7177. _i2 = _iterator2.next();
  7178. if (_i2.done) break;
  7179. _ref2 = _i2.value;
  7180. }
  7181. var node = _ref2;
  7182. this.nodes.push(node);
  7183. }
  7184. }
  7185. return this;
  7186. };
  7187. /**
  7188. * Inserts new nodes to the start of the container.
  7189. *
  7190. * @param {...(Node|object|string|Node[])} children - new nodes
  7191. *
  7192. * @return {Node} this node for methods chain
  7193. *
  7194. * @example
  7195. * const decl1 = postcss.decl({ prop: 'color', value: 'black' });
  7196. * const decl2 = postcss.decl({ prop: 'background-color', value: 'white' });
  7197. * rule.prepend(decl1, decl2);
  7198. *
  7199. * root.append({ name: 'charset', params: '"UTF-8"' }); // at-rule
  7200. * root.append({ selector: 'a' }); // rule
  7201. * rule.append({ prop: 'color', value: 'black' }); // declaration
  7202. * rule.append({ text: 'Comment' }) // comment
  7203. *
  7204. * root.append('a {}');
  7205. * root.first.append('color: black; z-index: 1');
  7206. */
  7207. Container.prototype.prepend = function prepend() {
  7208. for (var _len2 = arguments.length, children = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  7209. children[_key2] = arguments[_key2];
  7210. }
  7211. children = children.reverse();
  7212. for (var _iterator3 = children, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  7213. var _ref3;
  7214. if (_isArray3) {
  7215. if (_i3 >= _iterator3.length) break;
  7216. _ref3 = _iterator3[_i3++];
  7217. } else {
  7218. _i3 = _iterator3.next();
  7219. if (_i3.done) break;
  7220. _ref3 = _i3.value;
  7221. }
  7222. var child = _ref3;
  7223. var nodes = this.normalize(child, this.first, 'prepend').reverse();
  7224. for (var _iterator4 = nodes, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
  7225. var _ref4;
  7226. if (_isArray4) {
  7227. if (_i4 >= _iterator4.length) break;
  7228. _ref4 = _iterator4[_i4++];
  7229. } else {
  7230. _i4 = _iterator4.next();
  7231. if (_i4.done) break;
  7232. _ref4 = _i4.value;
  7233. }
  7234. var node = _ref4;
  7235. this.nodes.unshift(node);
  7236. }
  7237. for (var id in this.indexes) {
  7238. this.indexes[id] = this.indexes[id] + nodes.length;
  7239. }
  7240. }
  7241. return this;
  7242. };
  7243. Container.prototype.cleanRaws = function cleanRaws(keepBetween) {
  7244. _Node.prototype.cleanRaws.call(this, keepBetween);
  7245. if (this.nodes) {
  7246. for (var _iterator5 = this.nodes, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
  7247. var _ref5;
  7248. if (_isArray5) {
  7249. if (_i5 >= _iterator5.length) break;
  7250. _ref5 = _iterator5[_i5++];
  7251. } else {
  7252. _i5 = _iterator5.next();
  7253. if (_i5.done) break;
  7254. _ref5 = _i5.value;
  7255. }
  7256. var node = _ref5;
  7257. node.cleanRaws(keepBetween);
  7258. }
  7259. }
  7260. };
  7261. /**
  7262. * Insert new node before old node within the container.
  7263. *
  7264. * @param {Node|number} exist - child or child’s index.
  7265. * @param {Node|object|string|Node[]} add - new node
  7266. *
  7267. * @return {Node} this node for methods chain
  7268. *
  7269. * @example
  7270. * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }));
  7271. */
  7272. Container.prototype.insertBefore = function insertBefore(exist, add) {
  7273. exist = this.index(exist);
  7274. var type = exist === 0 ? 'prepend' : false;
  7275. var nodes = this.normalize(add, this.nodes[exist], type).reverse();
  7276. for (var _iterator6 = nodes, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
  7277. var _ref6;
  7278. if (_isArray6) {
  7279. if (_i6 >= _iterator6.length) break;
  7280. _ref6 = _iterator6[_i6++];
  7281. } else {
  7282. _i6 = _iterator6.next();
  7283. if (_i6.done) break;
  7284. _ref6 = _i6.value;
  7285. }
  7286. var node = _ref6;
  7287. this.nodes.splice(exist, 0, node);
  7288. }
  7289. var index = void 0;
  7290. for (var id in this.indexes) {
  7291. index = this.indexes[id];
  7292. if (exist <= index) {
  7293. this.indexes[id] = index + nodes.length;
  7294. }
  7295. }
  7296. return this;
  7297. };
  7298. /**
  7299. * Insert new node after old node within the container.
  7300. *
  7301. * @param {Node|number} exist - child or child’s index
  7302. * @param {Node|object|string|Node[]} add - new node
  7303. *
  7304. * @return {Node} this node for methods chain
  7305. */
  7306. Container.prototype.insertAfter = function insertAfter(exist, add) {
  7307. exist = this.index(exist);
  7308. var nodes = this.normalize(add, this.nodes[exist]).reverse();
  7309. for (var _iterator7 = nodes, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
  7310. var _ref7;
  7311. if (_isArray7) {
  7312. if (_i7 >= _iterator7.length) break;
  7313. _ref7 = _iterator7[_i7++];
  7314. } else {
  7315. _i7 = _iterator7.next();
  7316. if (_i7.done) break;
  7317. _ref7 = _i7.value;
  7318. }
  7319. var node = _ref7;
  7320. this.nodes.splice(exist + 1, 0, node);
  7321. }
  7322. var index = void 0;
  7323. for (var id in this.indexes) {
  7324. index = this.indexes[id];
  7325. if (exist < index) {
  7326. this.indexes[id] = index + nodes.length;
  7327. }
  7328. }
  7329. return this;
  7330. };
  7331. Container.prototype.remove = function remove(child) {
  7332. if (typeof child !== 'undefined') {
  7333. (0, _warnOnce2.default)('Container#remove is deprecated. ' + 'Use Container#removeChild');
  7334. this.removeChild(child);
  7335. } else {
  7336. _Node.prototype.remove.call(this);
  7337. }
  7338. return this;
  7339. };
  7340. /**
  7341. * Removes node from the container and cleans the parent properties
  7342. * from the node and its children.
  7343. *
  7344. * @param {Node|number} child - child or child’s index
  7345. *
  7346. * @return {Node} this node for methods chain
  7347. *
  7348. * @example
  7349. * rule.nodes.length //=> 5
  7350. * rule.removeChild(decl);
  7351. * rule.nodes.length //=> 4
  7352. * decl.parent //=> undefined
  7353. */
  7354. Container.prototype.removeChild = function removeChild(child) {
  7355. child = this.index(child);
  7356. this.nodes[child].parent = undefined;
  7357. this.nodes.splice(child, 1);
  7358. var index = void 0;
  7359. for (var id in this.indexes) {
  7360. index = this.indexes[id];
  7361. if (index >= child) {
  7362. this.indexes[id] = index - 1;
  7363. }
  7364. }
  7365. return this;
  7366. };
  7367. /**
  7368. * Removes all children from the container
  7369. * and cleans their parent properties.
  7370. *
  7371. * @return {Node} this node for methods chain
  7372. *
  7373. * @example
  7374. * rule.removeAll();
  7375. * rule.nodes.length //=> 0
  7376. */
  7377. Container.prototype.removeAll = function removeAll() {
  7378. for (var _iterator8 = this.nodes, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
  7379. var _ref8;
  7380. if (_isArray8) {
  7381. if (_i8 >= _iterator8.length) break;
  7382. _ref8 = _iterator8[_i8++];
  7383. } else {
  7384. _i8 = _iterator8.next();
  7385. if (_i8.done) break;
  7386. _ref8 = _i8.value;
  7387. }
  7388. var node = _ref8;
  7389. node.parent = undefined;
  7390. }
  7391. this.nodes = [];
  7392. return this;
  7393. };
  7394. /**
  7395. * Passes all declaration values within the container that match pattern
  7396. * through callback, replacing those values with the returned result
  7397. * of callback.
  7398. *
  7399. * This method is useful if you are using a custom unit or function
  7400. * and need to iterate through all values.
  7401. *
  7402. * @param {string|RegExp} pattern - replace pattern
  7403. * @param {object} opts - options to speed up the search
  7404. * @param {string|string[]} opts.props - an array of property names
  7405. * @param {string} opts.fast - string that’s used
  7406. * to narrow down values and speed up
  7407. the regexp search
  7408. * @param {function|string} callback - string to replace pattern
  7409. * or callback that returns a new
  7410. * value.
  7411. * The callback will receive
  7412. * the same arguments as those
  7413. * passed to a function parameter
  7414. * of `String#replace`.
  7415. *
  7416. * @return {Node} this node for methods chain
  7417. *
  7418. * @example
  7419. * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
  7420. * return 15 * parseInt(string) + 'px';
  7421. * });
  7422. */
  7423. Container.prototype.replaceValues = function replaceValues(pattern, opts, callback) {
  7424. if (!callback) {
  7425. callback = opts;
  7426. opts = {};
  7427. }
  7428. this.walkDecls(function (decl) {
  7429. if (opts.props && opts.props.indexOf(decl.prop) === -1) return;
  7430. if (opts.fast && decl.value.indexOf(opts.fast) === -1) return;
  7431. decl.value = decl.value.replace(pattern, callback);
  7432. });
  7433. return this;
  7434. };
  7435. /**
  7436. * Returns `true` if callback returns `true`
  7437. * for all of the container’s children.
  7438. *
  7439. * @param {childCondition} condition - iterator returns true or false.
  7440. *
  7441. * @return {boolean} is every child pass condition
  7442. *
  7443. * @example
  7444. * const noPrefixes = rule.every(i => i.prop[0] !== '-');
  7445. */
  7446. Container.prototype.every = function every(condition) {
  7447. return this.nodes.every(condition);
  7448. };
  7449. /**
  7450. * Returns `true` if callback returns `true` for (at least) one
  7451. * of the container’s children.
  7452. *
  7453. * @param {childCondition} condition - iterator returns true or false.
  7454. *
  7455. * @return {boolean} is some child pass condition
  7456. *
  7457. * @example
  7458. * const hasPrefix = rule.some(i => i.prop[0] === '-');
  7459. */
  7460. Container.prototype.some = function some(condition) {
  7461. return this.nodes.some(condition);
  7462. };
  7463. /**
  7464. * Returns a `child`’s index within the {@link Container#nodes} array.
  7465. *
  7466. * @param {Node} child - child of the current container.
  7467. *
  7468. * @return {number} child index
  7469. *
  7470. * @example
  7471. * rule.index( rule.nodes[2] ) //=> 2
  7472. */
  7473. Container.prototype.index = function index(child) {
  7474. if (typeof child === 'number') {
  7475. return child;
  7476. } else {
  7477. return this.nodes.indexOf(child);
  7478. }
  7479. };
  7480. /**
  7481. * The container’s first child.
  7482. *
  7483. * @type {Node}
  7484. *
  7485. * @example
  7486. * rule.first == rules.nodes[0];
  7487. */
  7488. Container.prototype.normalize = function normalize(nodes, sample) {
  7489. var _this2 = this;
  7490. if (typeof nodes === 'string') {
  7491. var parse = __webpack_require__(84);
  7492. nodes = cleanSource(parse(nodes).nodes);
  7493. } else if (!Array.isArray(nodes)) {
  7494. if (nodes.type === 'root') {
  7495. nodes = nodes.nodes;
  7496. } else if (nodes.type) {
  7497. nodes = [nodes];
  7498. } else if (nodes.prop) {
  7499. if (typeof nodes.value === 'undefined') {
  7500. throw new Error('Value field is missed in node creation');
  7501. } else if (typeof nodes.value !== 'string') {
  7502. nodes.value = String(nodes.value);
  7503. }
  7504. nodes = [new _declaration2.default(nodes)];
  7505. } else if (nodes.selector) {
  7506. var Rule = __webpack_require__(10);
  7507. nodes = [new Rule(nodes)];
  7508. } else if (nodes.name) {
  7509. var AtRule = __webpack_require__(26);
  7510. nodes = [new AtRule(nodes)];
  7511. } else if (nodes.text) {
  7512. nodes = [new _comment2.default(nodes)];
  7513. } else {
  7514. throw new Error('Unknown node type in node creation');
  7515. }
  7516. }
  7517. var processed = nodes.map(function (i) {
  7518. if (typeof i.raws === 'undefined') i = _this2.rebuild(i);
  7519. if (i.parent) i = i.clone();
  7520. if (typeof i.raws.before === 'undefined') {
  7521. if (sample && typeof sample.raws.before !== 'undefined') {
  7522. i.raws.before = sample.raws.before.replace(/[^\s]/g, '');
  7523. }
  7524. }
  7525. i.parent = _this2;
  7526. return i;
  7527. });
  7528. return processed;
  7529. };
  7530. Container.prototype.rebuild = function rebuild(node, parent) {
  7531. var _this3 = this;
  7532. var fix = void 0;
  7533. if (node.type === 'root') {
  7534. var Root = __webpack_require__(27);
  7535. fix = new Root();
  7536. } else if (node.type === 'atrule') {
  7537. var AtRule = __webpack_require__(26);
  7538. fix = new AtRule();
  7539. } else if (node.type === 'rule') {
  7540. var Rule = __webpack_require__(10);
  7541. fix = new Rule();
  7542. } else if (node.type === 'decl') {
  7543. fix = new _declaration2.default();
  7544. } else if (node.type === 'comment') {
  7545. fix = new _comment2.default();
  7546. }
  7547. for (var i in node) {
  7548. if (i === 'nodes') {
  7549. fix.nodes = node.nodes.map(function (j) {
  7550. return _this3.rebuild(j, fix);
  7551. });
  7552. } else if (i === 'parent' && parent) {
  7553. fix.parent = parent;
  7554. } else if (node.hasOwnProperty(i)) {
  7555. fix[i] = node[i];
  7556. }
  7557. }
  7558. return fix;
  7559. };
  7560. Container.prototype.eachInside = function eachInside(callback) {
  7561. (0, _warnOnce2.default)('Container#eachInside is deprecated. ' + 'Use Container#walk instead.');
  7562. return this.walk(callback);
  7563. };
  7564. Container.prototype.eachDecl = function eachDecl(prop, callback) {
  7565. (0, _warnOnce2.default)('Container#eachDecl is deprecated. ' + 'Use Container#walkDecls instead.');
  7566. return this.walkDecls(prop, callback);
  7567. };
  7568. Container.prototype.eachRule = function eachRule(selector, callback) {
  7569. (0, _warnOnce2.default)('Container#eachRule is deprecated. ' + 'Use Container#walkRules instead.');
  7570. return this.walkRules(selector, callback);
  7571. };
  7572. Container.prototype.eachAtRule = function eachAtRule(name, callback) {
  7573. (0, _warnOnce2.default)('Container#eachAtRule is deprecated. ' + 'Use Container#walkAtRules instead.');
  7574. return this.walkAtRules(name, callback);
  7575. };
  7576. Container.prototype.eachComment = function eachComment(callback) {
  7577. (0, _warnOnce2.default)('Container#eachComment is deprecated. ' + 'Use Container#walkComments instead.');
  7578. return this.walkComments(callback);
  7579. };
  7580. _createClass(Container, [{
  7581. key: 'first',
  7582. get: function get() {
  7583. if (!this.nodes) return undefined;
  7584. return this.nodes[0];
  7585. }
  7586. /**
  7587. * The container’s last child.
  7588. *
  7589. * @type {Node}
  7590. *
  7591. * @example
  7592. * rule.last == rule.nodes[rule.nodes.length - 1];
  7593. */
  7594. }, {
  7595. key: 'last',
  7596. get: function get() {
  7597. if (!this.nodes) return undefined;
  7598. return this.nodes[this.nodes.length - 1];
  7599. }
  7600. }, {
  7601. key: 'semicolon',
  7602. get: function get() {
  7603. (0, _warnOnce2.default)('Node#semicolon is deprecated. Use Node#raws.semicolon');
  7604. return this.raws.semicolon;
  7605. },
  7606. set: function set(val) {
  7607. (0, _warnOnce2.default)('Node#semicolon is deprecated. Use Node#raws.semicolon');
  7608. this.raws.semicolon = val;
  7609. }
  7610. }, {
  7611. key: 'after',
  7612. get: function get() {
  7613. (0, _warnOnce2.default)('Node#after is deprecated. Use Node#raws.after');
  7614. return this.raws.after;
  7615. },
  7616. set: function set(val) {
  7617. (0, _warnOnce2.default)('Node#after is deprecated. Use Node#raws.after');
  7618. this.raws.after = val;
  7619. }
  7620. /**
  7621. * @memberof Container#
  7622. * @member {Node[]} nodes - an array containing the container’s children
  7623. *
  7624. * @example
  7625. * const root = postcss.parse('a { color: black }');
  7626. * root.nodes.length //=> 1
  7627. * root.nodes[0].selector //=> 'a'
  7628. * root.nodes[0].nodes[0].prop //=> 'color'
  7629. */
  7630. }]);
  7631. return Container;
  7632. }(_node2.default);
  7633. exports.default = Container;
  7634. /**
  7635. * @callback childCondition
  7636. * @param {Node} node - container child
  7637. * @param {number} index - child index
  7638. * @param {Node[]} nodes - all container children
  7639. * @return {boolean}
  7640. */
  7641. /**
  7642. * @callback childIterator
  7643. * @param {Node} node - container child
  7644. * @param {number} index - child index
  7645. * @return {false|undefined} returning `false` will break iteration
  7646. */
  7647. module.exports = exports['default'];
  7648. /***/ }),
  7649. /* 26 */
  7650. /***/ (function(module, exports, __webpack_require__) {
  7651. "use strict";
  7652. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7653. exports.__esModule = true;
  7654. var _createClass = function () {
  7655. function defineProperties(target, props) {
  7656. for (var i = 0; i < props.length; i++) {
  7657. var descriptor = props[i];
  7658. descriptor.enumerable = descriptor.enumerable || false;
  7659. descriptor.configurable = true;
  7660. if ("value" in descriptor) descriptor.writable = true;
  7661. Object.defineProperty(target, descriptor.key, descriptor);
  7662. }
  7663. }
  7664. return function (Constructor, protoProps, staticProps) {
  7665. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  7666. if (staticProps) defineProperties(Constructor, staticProps);
  7667. return Constructor;
  7668. };
  7669. }();
  7670. var _container = __webpack_require__(25);
  7671. var _container2 = _interopRequireDefault(_container);
  7672. var _warnOnce = __webpack_require__(4);
  7673. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  7674. function _interopRequireDefault(obj) {
  7675. return obj && obj.__esModule ? obj : {
  7676. default: obj
  7677. };
  7678. }
  7679. function _classCallCheck(instance, Constructor) {
  7680. if (!(instance instanceof Constructor)) {
  7681. throw new TypeError("Cannot call a class as a function");
  7682. }
  7683. }
  7684. function _possibleConstructorReturn(self, call) {
  7685. if (!self) {
  7686. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  7687. }
  7688. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  7689. }
  7690. function _inherits(subClass, superClass) {
  7691. if (typeof superClass !== "function" && superClass !== null) {
  7692. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  7693. }
  7694. subClass.prototype = Object.create(superClass && superClass.prototype, {
  7695. constructor: {
  7696. value: subClass,
  7697. enumerable: false,
  7698. writable: true,
  7699. configurable: true
  7700. }
  7701. });
  7702. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  7703. }
  7704. /**
  7705. * Represents an at-rule.
  7706. *
  7707. * If it’s followed in the CSS by a {} block, this node will have
  7708. * a nodes property representing its children.
  7709. *
  7710. * @extends Container
  7711. *
  7712. * @example
  7713. * const root = postcss.parse('@charset "UTF-8"; @media print {}');
  7714. *
  7715. * const charset = root.first;
  7716. * charset.type //=> 'atrule'
  7717. * charset.nodes //=> undefined
  7718. *
  7719. * const media = root.last;
  7720. * media.nodes //=> []
  7721. */
  7722. var AtRule = function (_Container) {
  7723. _inherits(AtRule, _Container);
  7724. function AtRule(defaults) {
  7725. _classCallCheck(this, AtRule);
  7726. var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
  7727. _this.type = 'atrule';
  7728. return _this;
  7729. }
  7730. AtRule.prototype.append = function append() {
  7731. var _Container$prototype$;
  7732. if (!this.nodes) this.nodes = [];
  7733. for (var _len = arguments.length, children = Array(_len), _key = 0; _key < _len; _key++) {
  7734. children[_key] = arguments[_key];
  7735. }
  7736. return (_Container$prototype$ = _Container.prototype.append).call.apply(_Container$prototype$, [this].concat(children));
  7737. };
  7738. AtRule.prototype.prepend = function prepend() {
  7739. var _Container$prototype$2;
  7740. if (!this.nodes) this.nodes = [];
  7741. for (var _len2 = arguments.length, children = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  7742. children[_key2] = arguments[_key2];
  7743. }
  7744. return (_Container$prototype$2 = _Container.prototype.prepend).call.apply(_Container$prototype$2, [this].concat(children));
  7745. };
  7746. _createClass(AtRule, [{
  7747. key: 'afterName',
  7748. get: function get() {
  7749. (0, _warnOnce2.default)('AtRule#afterName was deprecated. Use AtRule#raws.afterName');
  7750. return this.raws.afterName;
  7751. },
  7752. set: function set(val) {
  7753. (0, _warnOnce2.default)('AtRule#afterName was deprecated. Use AtRule#raws.afterName');
  7754. this.raws.afterName = val;
  7755. }
  7756. }, {
  7757. key: '_params',
  7758. get: function get() {
  7759. (0, _warnOnce2.default)('AtRule#_params was deprecated. Use AtRule#raws.params');
  7760. return this.raws.params;
  7761. },
  7762. set: function set(val) {
  7763. (0, _warnOnce2.default)('AtRule#_params was deprecated. Use AtRule#raws.params');
  7764. this.raws.params = val;
  7765. }
  7766. /**
  7767. * @memberof AtRule#
  7768. * @member {string} name - the at-rule’s name immediately follows the `@`
  7769. *
  7770. * @example
  7771. * const root = postcss.parse('@media print {}');
  7772. * media.name //=> 'media'
  7773. * const media = root.first;
  7774. */
  7775. /**
  7776. * @memberof AtRule#
  7777. * @member {string} params - the at-rule’s parameters, the values
  7778. * that follow the at-rule’s name but precede
  7779. * any {} block
  7780. *
  7781. * @example
  7782. * const root = postcss.parse('@media print, screen {}');
  7783. * const media = root.first;
  7784. * media.params //=> 'print, screen'
  7785. */
  7786. /**
  7787. * @memberof AtRule#
  7788. * @member {object} raws - Information to generate byte-to-byte equal
  7789. * node string as it was in the origin input.
  7790. *
  7791. * Every parser saves its own properties,
  7792. * but the default CSS parser uses:
  7793. *
  7794. * * `before`: the space symbols before the node. It also stores `*`
  7795. * and `_` symbols before the declaration (IE hack).
  7796. * * `after`: the space symbols after the last child of the node
  7797. * to the end of the node.
  7798. * * `between`: the symbols between the property and value
  7799. * for declarations, selector and `{` for rules, or last parameter
  7800. * and `{` for at-rules.
  7801. * * `semicolon`: contains true if the last child has
  7802. * an (optional) semicolon.
  7803. * * `afterName`: the space between the at-rule name and its parameters.
  7804. *
  7805. * PostCSS cleans at-rule parameters from comments and extra spaces,
  7806. * but it stores origin content in raws properties.
  7807. * As such, if you don’t change a declaration’s value,
  7808. * PostCSS will use the raw value with comments.
  7809. *
  7810. * @example
  7811. * const root = postcss.parse(' @media\nprint {\n}')
  7812. * root.first.first.raws //=> { before: ' ',
  7813. * // between: ' ',
  7814. * // afterName: '\n',
  7815. * // after: '\n' }
  7816. */
  7817. }]);
  7818. return AtRule;
  7819. }(_container2.default);
  7820. exports.default = AtRule;
  7821. module.exports = exports['default'];
  7822. /***/ }),
  7823. /* 27 */
  7824. /***/ (function(module, exports, __webpack_require__) {
  7825. "use strict";
  7826. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7827. exports.__esModule = true;
  7828. var _container = __webpack_require__(25);
  7829. var _container2 = _interopRequireDefault(_container);
  7830. var _warnOnce = __webpack_require__(4);
  7831. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  7832. function _interopRequireDefault(obj) {
  7833. return obj && obj.__esModule ? obj : {
  7834. default: obj
  7835. };
  7836. }
  7837. function _classCallCheck(instance, Constructor) {
  7838. if (!(instance instanceof Constructor)) {
  7839. throw new TypeError("Cannot call a class as a function");
  7840. }
  7841. }
  7842. function _possibleConstructorReturn(self, call) {
  7843. if (!self) {
  7844. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  7845. }
  7846. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  7847. }
  7848. function _inherits(subClass, superClass) {
  7849. if (typeof superClass !== "function" && superClass !== null) {
  7850. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  7851. }
  7852. subClass.prototype = Object.create(superClass && superClass.prototype, {
  7853. constructor: {
  7854. value: subClass,
  7855. enumerable: false,
  7856. writable: true,
  7857. configurable: true
  7858. }
  7859. });
  7860. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  7861. }
  7862. /**
  7863. * Represents a CSS file and contains all its parsed nodes.
  7864. *
  7865. * @extends Container
  7866. *
  7867. * @example
  7868. * const root = postcss.parse('a{color:black} b{z-index:2}');
  7869. * root.type //=> 'root'
  7870. * root.nodes.length //=> 2
  7871. */
  7872. var Root = function (_Container) {
  7873. _inherits(Root, _Container);
  7874. function Root(defaults) {
  7875. _classCallCheck(this, Root);
  7876. var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
  7877. _this.type = 'root';
  7878. if (!_this.nodes) _this.nodes = [];
  7879. return _this;
  7880. }
  7881. Root.prototype.removeChild = function removeChild(child) {
  7882. child = this.index(child);
  7883. if (child === 0 && this.nodes.length > 1) {
  7884. this.nodes[1].raws.before = this.nodes[child].raws.before;
  7885. }
  7886. return _Container.prototype.removeChild.call(this, child);
  7887. };
  7888. Root.prototype.normalize = function normalize(child, sample, type) {
  7889. var nodes = _Container.prototype.normalize.call(this, child);
  7890. if (sample) {
  7891. if (type === 'prepend') {
  7892. if (this.nodes.length > 1) {
  7893. sample.raws.before = this.nodes[1].raws.before;
  7894. } else {
  7895. delete sample.raws.before;
  7896. }
  7897. } else if (this.first !== sample) {
  7898. for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  7899. var _ref;
  7900. if (_isArray) {
  7901. if (_i >= _iterator.length) break;
  7902. _ref = _iterator[_i++];
  7903. } else {
  7904. _i = _iterator.next();
  7905. if (_i.done) break;
  7906. _ref = _i.value;
  7907. }
  7908. var node = _ref;
  7909. node.raws.before = sample.raws.before;
  7910. }
  7911. }
  7912. }
  7913. return nodes;
  7914. };
  7915. /**
  7916. * Returns a {@link Result} instance representing the root’s CSS.
  7917. *
  7918. * @param {processOptions} [opts] - options with only `to` and `map` keys
  7919. *
  7920. * @return {Result} result with current root’s CSS
  7921. *
  7922. * @example
  7923. * const root1 = postcss.parse(css1, { from: 'a.css' });
  7924. * const root2 = postcss.parse(css2, { from: 'b.css' });
  7925. * root1.append(root2);
  7926. * const result = root1.toResult({ to: 'all.css', map: true });
  7927. */
  7928. Root.prototype.toResult = function toResult() {
  7929. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7930. var LazyResult = __webpack_require__(86);
  7931. var Processor = __webpack_require__(161);
  7932. var lazy = new LazyResult(new Processor(), this, opts);
  7933. return lazy.stringify();
  7934. };
  7935. Root.prototype.remove = function remove(child) {
  7936. (0, _warnOnce2.default)('Root#remove is deprecated. Use Root#removeChild');
  7937. this.removeChild(child);
  7938. };
  7939. Root.prototype.prevMap = function prevMap() {
  7940. (0, _warnOnce2.default)('Root#prevMap is deprecated. Use Root#source.input.map');
  7941. return this.source.input.map;
  7942. };
  7943. /**
  7944. * @memberof Root#
  7945. * @member {object} raws - Information to generate byte-to-byte equal
  7946. * node string as it was in the origin input.
  7947. *
  7948. * Every parser saves its own properties,
  7949. * but the default CSS parser uses:
  7950. *
  7951. * * `after`: the space symbols after the last child to the end of file.
  7952. * * `semicolon`: is the last child has an (optional) semicolon.
  7953. *
  7954. * @example
  7955. * postcss.parse('a {}\n').raws //=> { after: '\n' }
  7956. * postcss.parse('a {}').raws //=> { after: '' }
  7957. */
  7958. return Root;
  7959. }(_container2.default);
  7960. exports.default = Root;
  7961. module.exports = exports['default'];
  7962. /***/ }),
  7963. /* 28 */
  7964. /***/ (function(module, exports, __webpack_require__) {
  7965. "use strict";
  7966. var escape = __webpack_require__(29);
  7967. var DELIMITER_MAP = {
  7968. "---": "yaml",
  7969. "+++": "toml"
  7970. };
  7971. function parse(text) {
  7972. var delimiterRegex = Object.keys(DELIMITER_MAP).map(escape).join("|");
  7973. var match = text.match( // trailing spaces after delimiters are allowed
  7974. new RegExp("^(".concat(delimiterRegex, ")[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)")));
  7975. if (match === null) {
  7976. return {
  7977. frontMatter: null,
  7978. content: text
  7979. };
  7980. }
  7981. var raw = match[0].replace(/\n$/, "");
  7982. var delimiter = match[1];
  7983. var value = match[2];
  7984. return {
  7985. frontMatter: {
  7986. type: DELIMITER_MAP[delimiter],
  7987. value: value,
  7988. raw: raw
  7989. },
  7990. content: match[0].replace(/[^\n]/g, " ") + text.slice(match[0].length)
  7991. };
  7992. }
  7993. module.exports = parse;
  7994. /***/ }),
  7995. /* 29 */
  7996. /***/ (function(module, exports, __webpack_require__) {
  7997. "use strict";
  7998. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  7999. module.exports = function (str) {
  8000. if (typeof str !== 'string') {
  8001. throw new TypeError('Expected a string');
  8002. }
  8003. return str.replace(matchOperatorsRe, '\\$&');
  8004. };
  8005. /***/ }),
  8006. /* 30 */
  8007. /***/ (function(module, exports, __webpack_require__) {
  8008. "use strict";
  8009. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8010. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8011. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8012. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8013. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8014. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8015. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8016. var Container = __webpack_require__(1);
  8017. module.exports =
  8018. /*#__PURE__*/
  8019. function (_Container) {
  8020. _inherits(Value, _Container);
  8021. function Value(opts) {
  8022. var _this;
  8023. _classCallCheck(this, Value);
  8024. _this = _possibleConstructorReturn(this, _getPrototypeOf(Value).call(this, opts));
  8025. _this.type = 'value';
  8026. _this.unbalanced = 0;
  8027. return _this;
  8028. }
  8029. return Value;
  8030. }(Container);
  8031. /***/ }),
  8032. /* 31 */
  8033. /***/ (function(module, exports, __webpack_require__) {
  8034. "use strict";
  8035. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8036. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8037. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8038. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8039. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8040. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8041. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8042. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8043. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8044. var Container = __webpack_require__(1);
  8045. var AtWord =
  8046. /*#__PURE__*/
  8047. function (_Container) {
  8048. _inherits(AtWord, _Container);
  8049. function AtWord(opts) {
  8050. var _this;
  8051. _classCallCheck(this, AtWord);
  8052. _this = _possibleConstructorReturn(this, _getPrototypeOf(AtWord).call(this, opts));
  8053. _this.type = 'atword';
  8054. return _this;
  8055. }
  8056. _createClass(AtWord, [{
  8057. key: "toString",
  8058. value: function toString() {
  8059. var quote = this.quoted ? this.raws.quote : '';
  8060. return [this.raws.before, '@', // we can't use String() here because it'll try using itself
  8061. // as the constructor
  8062. String.prototype.toString.call(this.value), this.raws.after].join('');
  8063. }
  8064. }]);
  8065. return AtWord;
  8066. }(Container);
  8067. Container.registerWalker(AtWord);
  8068. module.exports = AtWord;
  8069. /***/ }),
  8070. /* 32 */
  8071. /***/ (function(module, exports, __webpack_require__) {
  8072. "use strict";
  8073. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8074. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8075. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8076. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8077. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8078. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8079. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8080. var Container = __webpack_require__(1);
  8081. var Node = __webpack_require__(3);
  8082. var Colon =
  8083. /*#__PURE__*/
  8084. function (_Node) {
  8085. _inherits(Colon, _Node);
  8086. function Colon(opts) {
  8087. var _this;
  8088. _classCallCheck(this, Colon);
  8089. _this = _possibleConstructorReturn(this, _getPrototypeOf(Colon).call(this, opts));
  8090. _this.type = 'colon';
  8091. return _this;
  8092. }
  8093. return Colon;
  8094. }(Node);
  8095. Container.registerWalker(Colon);
  8096. module.exports = Colon;
  8097. /***/ }),
  8098. /* 33 */
  8099. /***/ (function(module, exports, __webpack_require__) {
  8100. "use strict";
  8101. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8103. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8104. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8105. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8106. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8107. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8108. var Container = __webpack_require__(1);
  8109. var Node = __webpack_require__(3);
  8110. var Comma =
  8111. /*#__PURE__*/
  8112. function (_Node) {
  8113. _inherits(Comma, _Node);
  8114. function Comma(opts) {
  8115. var _this;
  8116. _classCallCheck(this, Comma);
  8117. _this = _possibleConstructorReturn(this, _getPrototypeOf(Comma).call(this, opts));
  8118. _this.type = 'comma';
  8119. return _this;
  8120. }
  8121. return Comma;
  8122. }(Node);
  8123. Container.registerWalker(Comma);
  8124. module.exports = Comma;
  8125. /***/ }),
  8126. /* 34 */
  8127. /***/ (function(module, exports, __webpack_require__) {
  8128. "use strict";
  8129. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8130. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8131. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8132. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8133. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8134. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8135. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8136. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8137. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8138. var Container = __webpack_require__(1);
  8139. var Node = __webpack_require__(3);
  8140. var Comment =
  8141. /*#__PURE__*/
  8142. function (_Node) {
  8143. _inherits(Comment, _Node);
  8144. function Comment(opts) {
  8145. var _this;
  8146. _classCallCheck(this, Comment);
  8147. _this = _possibleConstructorReturn(this, _getPrototypeOf(Comment).call(this, opts));
  8148. _this.type = 'comment';
  8149. _this.inline = opts.inline || false;
  8150. return _this;
  8151. }
  8152. _createClass(Comment, [{
  8153. key: "toString",
  8154. value: function toString() {
  8155. return [this.raws.before, this.inline ? '//' : '/*', String(this.value), this.inline ? '' : '*/', this.raws.after].join('');
  8156. }
  8157. }]);
  8158. return Comment;
  8159. }(Node);
  8160. ;
  8161. Container.registerWalker(Comment);
  8162. module.exports = Comment;
  8163. /***/ }),
  8164. /* 35 */
  8165. /***/ (function(module, exports, __webpack_require__) {
  8166. "use strict";
  8167. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8168. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8169. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8170. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8171. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8172. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8173. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8174. var Container = __webpack_require__(1);
  8175. var FunctionNode =
  8176. /*#__PURE__*/
  8177. function (_Container) {
  8178. _inherits(FunctionNode, _Container);
  8179. function FunctionNode(opts) {
  8180. var _this;
  8181. _classCallCheck(this, FunctionNode);
  8182. _this = _possibleConstructorReturn(this, _getPrototypeOf(FunctionNode).call(this, opts));
  8183. _this.type = 'func'; // start off at -1 so we know there haven't been any parens added
  8184. _this.unbalanced = -1;
  8185. return _this;
  8186. }
  8187. return FunctionNode;
  8188. }(Container);
  8189. ;
  8190. Container.registerWalker(FunctionNode);
  8191. module.exports = FunctionNode;
  8192. /***/ }),
  8193. /* 36 */
  8194. /***/ (function(module, exports, __webpack_require__) {
  8195. "use strict";
  8196. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8197. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8198. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8199. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8200. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8201. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8202. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8203. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8204. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8205. var Container = __webpack_require__(1);
  8206. var Node = __webpack_require__(3);
  8207. var NumberNode =
  8208. /*#__PURE__*/
  8209. function (_Node) {
  8210. _inherits(NumberNode, _Node);
  8211. function NumberNode(opts) {
  8212. var _this;
  8213. _classCallCheck(this, NumberNode);
  8214. _this = _possibleConstructorReturn(this, _getPrototypeOf(NumberNode).call(this, opts));
  8215. _this.type = 'number';
  8216. _this.unit = opts.unit || '';
  8217. return _this;
  8218. }
  8219. _createClass(NumberNode, [{
  8220. key: "toString",
  8221. value: function toString() {
  8222. return [this.raws.before, String(this.value), this.unit, this.raws.after].join('');
  8223. }
  8224. }]);
  8225. return NumberNode;
  8226. }(Node);
  8227. ;
  8228. Container.registerWalker(NumberNode);
  8229. module.exports = NumberNode;
  8230. /***/ }),
  8231. /* 37 */
  8232. /***/ (function(module, exports, __webpack_require__) {
  8233. "use strict";
  8234. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8235. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8236. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8237. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8238. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8239. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8240. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8241. var Container = __webpack_require__(1);
  8242. var Node = __webpack_require__(3);
  8243. var Operator =
  8244. /*#__PURE__*/
  8245. function (_Node) {
  8246. _inherits(Operator, _Node);
  8247. function Operator(opts) {
  8248. var _this;
  8249. _classCallCheck(this, Operator);
  8250. _this = _possibleConstructorReturn(this, _getPrototypeOf(Operator).call(this, opts));
  8251. _this.type = 'operator';
  8252. return _this;
  8253. }
  8254. return Operator;
  8255. }(Node);
  8256. Container.registerWalker(Operator);
  8257. module.exports = Operator;
  8258. /***/ }),
  8259. /* 38 */
  8260. /***/ (function(module, exports, __webpack_require__) {
  8261. "use strict";
  8262. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8263. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8264. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8265. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8266. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8267. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8268. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8269. var Container = __webpack_require__(1);
  8270. var Node = __webpack_require__(3);
  8271. var Parenthesis =
  8272. /*#__PURE__*/
  8273. function (_Node) {
  8274. _inherits(Parenthesis, _Node);
  8275. function Parenthesis(opts) {
  8276. var _this;
  8277. _classCallCheck(this, Parenthesis);
  8278. _this = _possibleConstructorReturn(this, _getPrototypeOf(Parenthesis).call(this, opts));
  8279. _this.type = 'paren';
  8280. _this.parenType = '';
  8281. return _this;
  8282. }
  8283. return Parenthesis;
  8284. }(Node);
  8285. Container.registerWalker(Parenthesis);
  8286. module.exports = Parenthesis;
  8287. /***/ }),
  8288. /* 39 */
  8289. /***/ (function(module, exports, __webpack_require__) {
  8290. "use strict";
  8291. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8292. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8293. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8294. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8295. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8296. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8297. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8298. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8299. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8300. var Container = __webpack_require__(1);
  8301. var Node = __webpack_require__(3);
  8302. var StringNode =
  8303. /*#__PURE__*/
  8304. function (_Node) {
  8305. _inherits(StringNode, _Node);
  8306. function StringNode(opts) {
  8307. var _this;
  8308. _classCallCheck(this, StringNode);
  8309. _this = _possibleConstructorReturn(this, _getPrototypeOf(StringNode).call(this, opts));
  8310. _this.type = 'string';
  8311. return _this;
  8312. }
  8313. _createClass(StringNode, [{
  8314. key: "toString",
  8315. value: function toString() {
  8316. var quote = this.quoted ? this.raws.quote : '';
  8317. return [this.raws.before, quote, // we can't use String() here because it'll try using itself
  8318. // as the constructor
  8319. this.value + '', quote, this.raws.after].join('');
  8320. }
  8321. }]);
  8322. return StringNode;
  8323. }(Node);
  8324. Container.registerWalker(StringNode);
  8325. module.exports = StringNode;
  8326. /***/ }),
  8327. /* 40 */
  8328. /***/ (function(module, exports, __webpack_require__) {
  8329. "use strict";
  8330. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8331. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8332. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8333. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8334. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8335. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8336. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8337. var Container = __webpack_require__(1);
  8338. var Node = __webpack_require__(3);
  8339. var Word =
  8340. /*#__PURE__*/
  8341. function (_Node) {
  8342. _inherits(Word, _Node);
  8343. function Word(opts) {
  8344. var _this;
  8345. _classCallCheck(this, Word);
  8346. _this = _possibleConstructorReturn(this, _getPrototypeOf(Word).call(this, opts));
  8347. _this.type = 'word';
  8348. return _this;
  8349. }
  8350. return Word;
  8351. }(Node);
  8352. Container.registerWalker(Word);
  8353. module.exports = Word;
  8354. /***/ }),
  8355. /* 41 */
  8356. /***/ (function(module, exports, __webpack_require__) {
  8357. "use strict";
  8358. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8359. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8360. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  8361. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8362. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8363. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8364. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8365. var Container = __webpack_require__(1);
  8366. var Node = __webpack_require__(3);
  8367. var UnicodeRange =
  8368. /*#__PURE__*/
  8369. function (_Node) {
  8370. _inherits(UnicodeRange, _Node);
  8371. function UnicodeRange(opts) {
  8372. var _this;
  8373. _classCallCheck(this, UnicodeRange);
  8374. _this = _possibleConstructorReturn(this, _getPrototypeOf(UnicodeRange).call(this, opts));
  8375. _this.type = 'unicode-range';
  8376. return _this;
  8377. }
  8378. return UnicodeRange;
  8379. }(Node);
  8380. Container.registerWalker(UnicodeRange);
  8381. module.exports = UnicodeRange;
  8382. /***/ }),
  8383. /* 42 */
  8384. /***/ (function(module, exports) {
  8385. module.exports = function flatten(list, depth) {
  8386. depth = typeof depth == 'number' ? depth : Infinity;
  8387. if (!depth) {
  8388. if (Array.isArray(list)) {
  8389. return list.map(function (i) {
  8390. return i;
  8391. });
  8392. }
  8393. return list;
  8394. }
  8395. return _flatten(list, 1);
  8396. function _flatten(list, d) {
  8397. return list.reduce(function (acc, item) {
  8398. if (Array.isArray(item) && d < depth) {
  8399. return acc.concat(_flatten(item, d + 1));
  8400. } else {
  8401. return acc.concat(item);
  8402. }
  8403. }, []);
  8404. }
  8405. };
  8406. /***/ }),
  8407. /* 43 */
  8408. /***/ (function(module, exports) {
  8409. module.exports = function (ary, item) {
  8410. var i = -1,
  8411. indexes = [];
  8412. while ((i = ary.indexOf(item, i + 1)) !== -1) {
  8413. indexes.push(i);
  8414. }
  8415. return indexes;
  8416. };
  8417. /***/ }),
  8418. /* 44 */
  8419. /***/ (function(module, exports, __webpack_require__) {
  8420. "use strict";
  8421. function unique_pred(list, compare) {
  8422. var ptr = 1,
  8423. len = list.length,
  8424. a = list[0],
  8425. b = list[0];
  8426. for (var i = 1; i < len; ++i) {
  8427. b = a;
  8428. a = list[i];
  8429. if (compare(a, b)) {
  8430. if (i === ptr) {
  8431. ptr++;
  8432. continue;
  8433. }
  8434. list[ptr++] = a;
  8435. }
  8436. }
  8437. list.length = ptr;
  8438. return list;
  8439. }
  8440. function unique_eq(list) {
  8441. var ptr = 1,
  8442. len = list.length,
  8443. a = list[0],
  8444. b = list[0];
  8445. for (var i = 1; i < len; ++i, b = a) {
  8446. b = a;
  8447. a = list[i];
  8448. if (a !== b) {
  8449. if (i === ptr) {
  8450. ptr++;
  8451. continue;
  8452. }
  8453. list[ptr++] = a;
  8454. }
  8455. }
  8456. list.length = ptr;
  8457. return list;
  8458. }
  8459. function unique(list, compare, sorted) {
  8460. if (list.length === 0) {
  8461. return list;
  8462. }
  8463. if (compare) {
  8464. if (!sorted) {
  8465. list.sort(compare);
  8466. }
  8467. return unique_pred(list, compare);
  8468. }
  8469. if (!sorted) {
  8470. list.sort();
  8471. }
  8472. return unique_eq(list);
  8473. }
  8474. module.exports = unique;
  8475. /***/ }),
  8476. /* 45 */
  8477. /***/ (function(module, exports, __webpack_require__) {
  8478. "use strict";
  8479. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8480. exports.__esModule = true;
  8481. var _container = __webpack_require__(16);
  8482. var _container2 = _interopRequireDefault(_container);
  8483. var _types = __webpack_require__(0);
  8484. function _interopRequireDefault(obj) {
  8485. return obj && obj.__esModule ? obj : {
  8486. default: obj
  8487. };
  8488. }
  8489. function _classCallCheck(instance, Constructor) {
  8490. if (!(instance instanceof Constructor)) {
  8491. throw new TypeError("Cannot call a class as a function");
  8492. }
  8493. }
  8494. function _possibleConstructorReturn(self, call) {
  8495. if (!self) {
  8496. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8497. }
  8498. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8499. }
  8500. function _inherits(subClass, superClass) {
  8501. if (typeof superClass !== "function" && superClass !== null) {
  8502. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8503. }
  8504. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8505. constructor: {
  8506. value: subClass,
  8507. enumerable: false,
  8508. writable: true,
  8509. configurable: true
  8510. }
  8511. });
  8512. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8513. }
  8514. var Root = function (_Container) {
  8515. _inherits(Root, _Container);
  8516. function Root(opts) {
  8517. _classCallCheck(this, Root);
  8518. var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
  8519. _this.type = _types.ROOT;
  8520. return _this;
  8521. }
  8522. Root.prototype.toString = function toString() {
  8523. var str = this.reduce(function (memo, selector) {
  8524. var sel = String(selector);
  8525. return sel ? memo + sel + ',' : '';
  8526. }, '').slice(0, -1);
  8527. return this.trailingComma ? str + ',' : str;
  8528. };
  8529. return Root;
  8530. }(_container2.default);
  8531. exports.default = Root;
  8532. module.exports = exports['default'];
  8533. /***/ }),
  8534. /* 46 */
  8535. /***/ (function(module, exports, __webpack_require__) {
  8536. "use strict";
  8537. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8538. exports.__esModule = true;
  8539. var _container = __webpack_require__(16);
  8540. var _container2 = _interopRequireDefault(_container);
  8541. var _types = __webpack_require__(0);
  8542. function _interopRequireDefault(obj) {
  8543. return obj && obj.__esModule ? obj : {
  8544. default: obj
  8545. };
  8546. }
  8547. function _classCallCheck(instance, Constructor) {
  8548. if (!(instance instanceof Constructor)) {
  8549. throw new TypeError("Cannot call a class as a function");
  8550. }
  8551. }
  8552. function _possibleConstructorReturn(self, call) {
  8553. if (!self) {
  8554. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8555. }
  8556. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8557. }
  8558. function _inherits(subClass, superClass) {
  8559. if (typeof superClass !== "function" && superClass !== null) {
  8560. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8561. }
  8562. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8563. constructor: {
  8564. value: subClass,
  8565. enumerable: false,
  8566. writable: true,
  8567. configurable: true
  8568. }
  8569. });
  8570. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8571. }
  8572. var Selector = function (_Container) {
  8573. _inherits(Selector, _Container);
  8574. function Selector(opts) {
  8575. _classCallCheck(this, Selector);
  8576. var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
  8577. _this.type = _types.SELECTOR;
  8578. return _this;
  8579. }
  8580. return Selector;
  8581. }(_container2.default);
  8582. exports.default = Selector;
  8583. module.exports = exports['default'];
  8584. /***/ }),
  8585. /* 47 */
  8586. /***/ (function(module, exports, __webpack_require__) {
  8587. "use strict";
  8588. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8589. exports.__esModule = true;
  8590. var _namespace = __webpack_require__(7);
  8591. var _namespace2 = _interopRequireDefault(_namespace);
  8592. var _types = __webpack_require__(0);
  8593. function _interopRequireDefault(obj) {
  8594. return obj && obj.__esModule ? obj : {
  8595. default: obj
  8596. };
  8597. }
  8598. function _classCallCheck(instance, Constructor) {
  8599. if (!(instance instanceof Constructor)) {
  8600. throw new TypeError("Cannot call a class as a function");
  8601. }
  8602. }
  8603. function _possibleConstructorReturn(self, call) {
  8604. if (!self) {
  8605. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8606. }
  8607. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8608. }
  8609. function _inherits(subClass, superClass) {
  8610. if (typeof superClass !== "function" && superClass !== null) {
  8611. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8612. }
  8613. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8614. constructor: {
  8615. value: subClass,
  8616. enumerable: false,
  8617. writable: true,
  8618. configurable: true
  8619. }
  8620. });
  8621. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8622. }
  8623. var ClassName = function (_Namespace) {
  8624. _inherits(ClassName, _Namespace);
  8625. function ClassName(opts) {
  8626. _classCallCheck(this, ClassName);
  8627. var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
  8628. _this.type = _types.CLASS;
  8629. return _this;
  8630. }
  8631. ClassName.prototype.toString = function toString() {
  8632. return [this.spaces.before, this.ns, String('.' + this.value), this.spaces.after].join('');
  8633. };
  8634. return ClassName;
  8635. }(_namespace2.default);
  8636. exports.default = ClassName;
  8637. module.exports = exports['default'];
  8638. /***/ }),
  8639. /* 48 */
  8640. /***/ (function(module, exports, __webpack_require__) {
  8641. "use strict";
  8642. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8643. exports.__esModule = true;
  8644. var _node = __webpack_require__(5);
  8645. var _node2 = _interopRequireDefault(_node);
  8646. var _types = __webpack_require__(0);
  8647. function _interopRequireDefault(obj) {
  8648. return obj && obj.__esModule ? obj : {
  8649. default: obj
  8650. };
  8651. }
  8652. function _classCallCheck(instance, Constructor) {
  8653. if (!(instance instanceof Constructor)) {
  8654. throw new TypeError("Cannot call a class as a function");
  8655. }
  8656. }
  8657. function _possibleConstructorReturn(self, call) {
  8658. if (!self) {
  8659. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8660. }
  8661. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8662. }
  8663. function _inherits(subClass, superClass) {
  8664. if (typeof superClass !== "function" && superClass !== null) {
  8665. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8666. }
  8667. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8668. constructor: {
  8669. value: subClass,
  8670. enumerable: false,
  8671. writable: true,
  8672. configurable: true
  8673. }
  8674. });
  8675. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8676. }
  8677. var Comment = function (_Node) {
  8678. _inherits(Comment, _Node);
  8679. function Comment(opts) {
  8680. _classCallCheck(this, Comment);
  8681. var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
  8682. _this.type = _types.COMMENT;
  8683. return _this;
  8684. }
  8685. return Comment;
  8686. }(_node2.default);
  8687. exports.default = Comment;
  8688. module.exports = exports['default'];
  8689. /***/ }),
  8690. /* 49 */
  8691. /***/ (function(module, exports, __webpack_require__) {
  8692. "use strict";
  8693. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8694. exports.__esModule = true;
  8695. var _namespace = __webpack_require__(7);
  8696. var _namespace2 = _interopRequireDefault(_namespace);
  8697. var _types = __webpack_require__(0);
  8698. function _interopRequireDefault(obj) {
  8699. return obj && obj.__esModule ? obj : {
  8700. default: obj
  8701. };
  8702. }
  8703. function _classCallCheck(instance, Constructor) {
  8704. if (!(instance instanceof Constructor)) {
  8705. throw new TypeError("Cannot call a class as a function");
  8706. }
  8707. }
  8708. function _possibleConstructorReturn(self, call) {
  8709. if (!self) {
  8710. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8711. }
  8712. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8713. }
  8714. function _inherits(subClass, superClass) {
  8715. if (typeof superClass !== "function" && superClass !== null) {
  8716. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8717. }
  8718. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8719. constructor: {
  8720. value: subClass,
  8721. enumerable: false,
  8722. writable: true,
  8723. configurable: true
  8724. }
  8725. });
  8726. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8727. }
  8728. var ID = function (_Namespace) {
  8729. _inherits(ID, _Namespace);
  8730. function ID(opts) {
  8731. _classCallCheck(this, ID);
  8732. var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
  8733. _this.type = _types.ID;
  8734. return _this;
  8735. }
  8736. ID.prototype.toString = function toString() {
  8737. return [this.spaces.before, this.ns, String('#' + this.value), this.spaces.after].join('');
  8738. };
  8739. return ID;
  8740. }(_namespace2.default);
  8741. exports.default = ID;
  8742. module.exports = exports['default'];
  8743. /***/ }),
  8744. /* 50 */
  8745. /***/ (function(module, exports, __webpack_require__) {
  8746. "use strict";
  8747. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8748. exports.__esModule = true;
  8749. var _namespace = __webpack_require__(7);
  8750. var _namespace2 = _interopRequireDefault(_namespace);
  8751. var _types = __webpack_require__(0);
  8752. function _interopRequireDefault(obj) {
  8753. return obj && obj.__esModule ? obj : {
  8754. default: obj
  8755. };
  8756. }
  8757. function _classCallCheck(instance, Constructor) {
  8758. if (!(instance instanceof Constructor)) {
  8759. throw new TypeError("Cannot call a class as a function");
  8760. }
  8761. }
  8762. function _possibleConstructorReturn(self, call) {
  8763. if (!self) {
  8764. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8765. }
  8766. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8767. }
  8768. function _inherits(subClass, superClass) {
  8769. if (typeof superClass !== "function" && superClass !== null) {
  8770. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8771. }
  8772. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8773. constructor: {
  8774. value: subClass,
  8775. enumerable: false,
  8776. writable: true,
  8777. configurable: true
  8778. }
  8779. });
  8780. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8781. }
  8782. var Tag = function (_Namespace) {
  8783. _inherits(Tag, _Namespace);
  8784. function Tag(opts) {
  8785. _classCallCheck(this, Tag);
  8786. var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
  8787. _this.type = _types.TAG;
  8788. return _this;
  8789. }
  8790. return Tag;
  8791. }(_namespace2.default);
  8792. exports.default = Tag;
  8793. module.exports = exports['default'];
  8794. /***/ }),
  8795. /* 51 */
  8796. /***/ (function(module, exports, __webpack_require__) {
  8797. "use strict";
  8798. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8799. exports.__esModule = true;
  8800. var _node = __webpack_require__(5);
  8801. var _node2 = _interopRequireDefault(_node);
  8802. var _types = __webpack_require__(0);
  8803. function _interopRequireDefault(obj) {
  8804. return obj && obj.__esModule ? obj : {
  8805. default: obj
  8806. };
  8807. }
  8808. function _classCallCheck(instance, Constructor) {
  8809. if (!(instance instanceof Constructor)) {
  8810. throw new TypeError("Cannot call a class as a function");
  8811. }
  8812. }
  8813. function _possibleConstructorReturn(self, call) {
  8814. if (!self) {
  8815. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8816. }
  8817. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8818. }
  8819. function _inherits(subClass, superClass) {
  8820. if (typeof superClass !== "function" && superClass !== null) {
  8821. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8822. }
  8823. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8824. constructor: {
  8825. value: subClass,
  8826. enumerable: false,
  8827. writable: true,
  8828. configurable: true
  8829. }
  8830. });
  8831. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8832. }
  8833. var String = function (_Node) {
  8834. _inherits(String, _Node);
  8835. function String(opts) {
  8836. _classCallCheck(this, String);
  8837. var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
  8838. _this.type = _types.STRING;
  8839. return _this;
  8840. }
  8841. return String;
  8842. }(_node2.default);
  8843. exports.default = String;
  8844. module.exports = exports['default'];
  8845. /***/ }),
  8846. /* 52 */
  8847. /***/ (function(module, exports, __webpack_require__) {
  8848. "use strict";
  8849. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8850. exports.__esModule = true;
  8851. var _container = __webpack_require__(16);
  8852. var _container2 = _interopRequireDefault(_container);
  8853. var _types = __webpack_require__(0);
  8854. function _interopRequireDefault(obj) {
  8855. return obj && obj.__esModule ? obj : {
  8856. default: obj
  8857. };
  8858. }
  8859. function _classCallCheck(instance, Constructor) {
  8860. if (!(instance instanceof Constructor)) {
  8861. throw new TypeError("Cannot call a class as a function");
  8862. }
  8863. }
  8864. function _possibleConstructorReturn(self, call) {
  8865. if (!self) {
  8866. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8867. }
  8868. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8869. }
  8870. function _inherits(subClass, superClass) {
  8871. if (typeof superClass !== "function" && superClass !== null) {
  8872. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8873. }
  8874. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8875. constructor: {
  8876. value: subClass,
  8877. enumerable: false,
  8878. writable: true,
  8879. configurable: true
  8880. }
  8881. });
  8882. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8883. }
  8884. var Pseudo = function (_Container) {
  8885. _inherits(Pseudo, _Container);
  8886. function Pseudo(opts) {
  8887. _classCallCheck(this, Pseudo);
  8888. var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
  8889. _this.type = _types.PSEUDO;
  8890. return _this;
  8891. }
  8892. Pseudo.prototype.toString = function toString() {
  8893. var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
  8894. return [this.spaces.before, String(this.value), params, this.spaces.after].join('');
  8895. };
  8896. return Pseudo;
  8897. }(_container2.default);
  8898. exports.default = Pseudo;
  8899. module.exports = exports['default'];
  8900. /***/ }),
  8901. /* 53 */
  8902. /***/ (function(module, exports, __webpack_require__) {
  8903. "use strict";
  8904. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8905. exports.__esModule = true;
  8906. var _namespace = __webpack_require__(7);
  8907. var _namespace2 = _interopRequireDefault(_namespace);
  8908. var _types = __webpack_require__(0);
  8909. function _interopRequireDefault(obj) {
  8910. return obj && obj.__esModule ? obj : {
  8911. default: obj
  8912. };
  8913. }
  8914. function _classCallCheck(instance, Constructor) {
  8915. if (!(instance instanceof Constructor)) {
  8916. throw new TypeError("Cannot call a class as a function");
  8917. }
  8918. }
  8919. function _possibleConstructorReturn(self, call) {
  8920. if (!self) {
  8921. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8922. }
  8923. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8924. }
  8925. function _inherits(subClass, superClass) {
  8926. if (typeof superClass !== "function" && superClass !== null) {
  8927. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8928. }
  8929. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8930. constructor: {
  8931. value: subClass,
  8932. enumerable: false,
  8933. writable: true,
  8934. configurable: true
  8935. }
  8936. });
  8937. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  8938. }
  8939. var Attribute = function (_Namespace) {
  8940. _inherits(Attribute, _Namespace);
  8941. function Attribute(opts) {
  8942. _classCallCheck(this, Attribute);
  8943. var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
  8944. _this.type = _types.ATTRIBUTE;
  8945. _this.raws = {};
  8946. return _this;
  8947. }
  8948. Attribute.prototype.toString = function toString() {
  8949. var selector = [this.spaces.before, '[', this.ns, this.attribute];
  8950. if (this.operator) {
  8951. selector.push(this.operator);
  8952. }
  8953. if (this.value) {
  8954. selector.push(this.value);
  8955. }
  8956. if (this.raws.insensitive) {
  8957. selector.push(this.raws.insensitive);
  8958. } else if (this.insensitive) {
  8959. selector.push(' i');
  8960. }
  8961. selector.push(']');
  8962. return selector.concat(this.spaces.after).join('');
  8963. };
  8964. return Attribute;
  8965. }(_namespace2.default);
  8966. exports.default = Attribute;
  8967. module.exports = exports['default'];
  8968. /***/ }),
  8969. /* 54 */
  8970. /***/ (function(module, exports, __webpack_require__) {
  8971. "use strict";
  8972. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8973. exports.__esModule = true;
  8974. var _namespace = __webpack_require__(7);
  8975. var _namespace2 = _interopRequireDefault(_namespace);
  8976. var _types = __webpack_require__(0);
  8977. function _interopRequireDefault(obj) {
  8978. return obj && obj.__esModule ? obj : {
  8979. default: obj
  8980. };
  8981. }
  8982. function _classCallCheck(instance, Constructor) {
  8983. if (!(instance instanceof Constructor)) {
  8984. throw new TypeError("Cannot call a class as a function");
  8985. }
  8986. }
  8987. function _possibleConstructorReturn(self, call) {
  8988. if (!self) {
  8989. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8990. }
  8991. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  8992. }
  8993. function _inherits(subClass, superClass) {
  8994. if (typeof superClass !== "function" && superClass !== null) {
  8995. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  8996. }
  8997. subClass.prototype = Object.create(superClass && superClass.prototype, {
  8998. constructor: {
  8999. value: subClass,
  9000. enumerable: false,
  9001. writable: true,
  9002. configurable: true
  9003. }
  9004. });
  9005. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  9006. }
  9007. var Universal = function (_Namespace) {
  9008. _inherits(Universal, _Namespace);
  9009. function Universal(opts) {
  9010. _classCallCheck(this, Universal);
  9011. var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
  9012. _this.type = _types.UNIVERSAL;
  9013. _this.value = '*';
  9014. return _this;
  9015. }
  9016. return Universal;
  9017. }(_namespace2.default);
  9018. exports.default = Universal;
  9019. module.exports = exports['default'];
  9020. /***/ }),
  9021. /* 55 */
  9022. /***/ (function(module, exports, __webpack_require__) {
  9023. "use strict";
  9024. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9025. exports.__esModule = true;
  9026. var _node = __webpack_require__(5);
  9027. var _node2 = _interopRequireDefault(_node);
  9028. var _types = __webpack_require__(0);
  9029. function _interopRequireDefault(obj) {
  9030. return obj && obj.__esModule ? obj : {
  9031. default: obj
  9032. };
  9033. }
  9034. function _classCallCheck(instance, Constructor) {
  9035. if (!(instance instanceof Constructor)) {
  9036. throw new TypeError("Cannot call a class as a function");
  9037. }
  9038. }
  9039. function _possibleConstructorReturn(self, call) {
  9040. if (!self) {
  9041. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  9042. }
  9043. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  9044. }
  9045. function _inherits(subClass, superClass) {
  9046. if (typeof superClass !== "function" && superClass !== null) {
  9047. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  9048. }
  9049. subClass.prototype = Object.create(superClass && superClass.prototype, {
  9050. constructor: {
  9051. value: subClass,
  9052. enumerable: false,
  9053. writable: true,
  9054. configurable: true
  9055. }
  9056. });
  9057. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  9058. }
  9059. var Combinator = function (_Node) {
  9060. _inherits(Combinator, _Node);
  9061. function Combinator(opts) {
  9062. _classCallCheck(this, Combinator);
  9063. var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
  9064. _this.type = _types.COMBINATOR;
  9065. return _this;
  9066. }
  9067. return Combinator;
  9068. }(_node2.default);
  9069. exports.default = Combinator;
  9070. module.exports = exports['default'];
  9071. /***/ }),
  9072. /* 56 */
  9073. /***/ (function(module, exports, __webpack_require__) {
  9074. "use strict";
  9075. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9076. exports.__esModule = true;
  9077. var _node = __webpack_require__(5);
  9078. var _node2 = _interopRequireDefault(_node);
  9079. var _types = __webpack_require__(0);
  9080. function _interopRequireDefault(obj) {
  9081. return obj && obj.__esModule ? obj : {
  9082. default: obj
  9083. };
  9084. }
  9085. function _classCallCheck(instance, Constructor) {
  9086. if (!(instance instanceof Constructor)) {
  9087. throw new TypeError("Cannot call a class as a function");
  9088. }
  9089. }
  9090. function _possibleConstructorReturn(self, call) {
  9091. if (!self) {
  9092. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  9093. }
  9094. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  9095. }
  9096. function _inherits(subClass, superClass) {
  9097. if (typeof superClass !== "function" && superClass !== null) {
  9098. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  9099. }
  9100. subClass.prototype = Object.create(superClass && superClass.prototype, {
  9101. constructor: {
  9102. value: subClass,
  9103. enumerable: false,
  9104. writable: true,
  9105. configurable: true
  9106. }
  9107. });
  9108. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  9109. }
  9110. var Nesting = function (_Node) {
  9111. _inherits(Nesting, _Node);
  9112. function Nesting(opts) {
  9113. _classCallCheck(this, Nesting);
  9114. var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
  9115. _this.type = _types.NESTING;
  9116. _this.value = '&';
  9117. return _this;
  9118. }
  9119. return Nesting;
  9120. }(_node2.default);
  9121. exports.default = Nesting;
  9122. module.exports = exports['default'];
  9123. /***/ }),
  9124. /* 57 */
  9125. /***/ (function(module, exports, __webpack_require__) {
  9126. "use strict";
  9127. Object.defineProperty(exports, "__esModule", {
  9128. value: true
  9129. });
  9130. var _Node = __webpack_require__(58);
  9131. var _Node2 = _interopRequireDefault(_Node);
  9132. function _interopRequireDefault(obj) {
  9133. return obj && obj.__esModule ? obj : {
  9134. default: obj
  9135. };
  9136. }
  9137. function Container(opts) {
  9138. var _this = this;
  9139. this.constructor(opts);
  9140. this.nodes = opts.nodes;
  9141. if (this.after === undefined) {
  9142. this.after = this.nodes.length > 0 ? this.nodes[this.nodes.length - 1].after : '';
  9143. }
  9144. if (this.before === undefined) {
  9145. this.before = this.nodes.length > 0 ? this.nodes[0].before : '';
  9146. }
  9147. if (this.sourceIndex === undefined) {
  9148. this.sourceIndex = this.before.length;
  9149. }
  9150. this.nodes.forEach(function (node) {
  9151. node.parent = _this; // eslint-disable-line no-param-reassign
  9152. });
  9153. }
  9154. /**
  9155. * A node that contains other nodes and support traversing over them
  9156. */
  9157. Container.prototype = Object.create(_Node2.default.prototype);
  9158. Container.constructor = _Node2.default;
  9159. /**
  9160. * Iterate over descendant nodes of the node
  9161. *
  9162. * @param {RegExp|string} filter - Optional. Only nodes with node.type that
  9163. * satisfies the filter will be traversed over
  9164. * @param {function} cb - callback to call on each node. Takes theese params:
  9165. * node - the node being processed, i - it's index, nodes - the array
  9166. * of all nodes
  9167. * If false is returned, the iteration breaks
  9168. *
  9169. * @return (boolean) false, if the iteration was broken
  9170. */
  9171. Container.prototype.walk = function walk(filter, cb) {
  9172. var hasFilter = typeof filter === 'string' || filter instanceof RegExp;
  9173. var callback = hasFilter ? cb : filter;
  9174. var filterReg = typeof filter === 'string' ? new RegExp(filter) : filter;
  9175. for (var i = 0; i < this.nodes.length; i++) {
  9176. var node = this.nodes[i];
  9177. var filtered = hasFilter ? filterReg.test(node.type) : true;
  9178. if (filtered && callback && callback(node, i, this.nodes) === false) {
  9179. return false;
  9180. }
  9181. if (node.nodes && node.walk(filter, cb) === false) {
  9182. return false;
  9183. }
  9184. }
  9185. return true;
  9186. };
  9187. /**
  9188. * Iterate over immediate children of the node
  9189. *
  9190. * @param {function} cb - callback to call on each node. Takes theese params:
  9191. * node - the node being processed, i - it's index, nodes - the array
  9192. * of all nodes
  9193. * If false is returned, the iteration breaks
  9194. *
  9195. * @return (boolean) false, if the iteration was broken
  9196. */
  9197. Container.prototype.each = function each() {
  9198. var cb = arguments.length <= 0 || arguments[0] === undefined ? function () {} : arguments[0];
  9199. for (var i = 0; i < this.nodes.length; i++) {
  9200. var node = this.nodes[i];
  9201. if (cb(node, i, this.nodes) === false) {
  9202. return false;
  9203. }
  9204. }
  9205. return true;
  9206. };
  9207. exports.default = Container;
  9208. /***/ }),
  9209. /* 58 */
  9210. /***/ (function(module, exports, __webpack_require__) {
  9211. "use strict";
  9212. Object.defineProperty(exports, "__esModule", {
  9213. value: true
  9214. });
  9215. /**
  9216. * A very generic node. Pretty much any element of a media query
  9217. */
  9218. function Node(opts) {
  9219. this.after = opts.after;
  9220. this.before = opts.before;
  9221. this.type = opts.type;
  9222. this.value = opts.value;
  9223. this.sourceIndex = opts.sourceIndex;
  9224. }
  9225. exports.default = Node;
  9226. /***/ }),
  9227. /* 59 */
  9228. /***/ (function(module, exports, __webpack_require__) {
  9229. "use strict";
  9230. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9231. exports.__esModule = true;
  9232. exports.default = void 0;
  9233. var _cssSyntaxError = _interopRequireDefault(__webpack_require__(60));
  9234. var _previousMap = _interopRequireDefault(__webpack_require__(120));
  9235. var _path = _interopRequireDefault(__webpack_require__(6));
  9236. function _interopRequireDefault(obj) {
  9237. return obj && obj.__esModule ? obj : {
  9238. default: obj
  9239. };
  9240. }
  9241. function _defineProperties(target, props) {
  9242. for (var i = 0; i < props.length; i++) {
  9243. var descriptor = props[i];
  9244. descriptor.enumerable = descriptor.enumerable || false;
  9245. descriptor.configurable = true;
  9246. if ("value" in descriptor) descriptor.writable = true;
  9247. Object.defineProperty(target, descriptor.key, descriptor);
  9248. }
  9249. }
  9250. function _createClass(Constructor, protoProps, staticProps) {
  9251. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  9252. if (staticProps) _defineProperties(Constructor, staticProps);
  9253. return Constructor;
  9254. }
  9255. var sequence = 0;
  9256. /**
  9257. * Represents the source CSS.
  9258. *
  9259. * @example
  9260. * const root = postcss.parse(css, { from: file })
  9261. * const input = root.source.input
  9262. */
  9263. var Input =
  9264. /*#__PURE__*/
  9265. function () {
  9266. /**
  9267. * @param {string} css Input CSS source.
  9268. * @param {object} [opts] {@link Processor#process} options.
  9269. */
  9270. function Input(css, opts) {
  9271. if (opts === void 0) {
  9272. opts = {};
  9273. }
  9274. if (css === null || _typeof(css) === 'object' && !css.toString) {
  9275. throw new Error("PostCSS received " + css + " instead of CSS string");
  9276. }
  9277. /**
  9278. * Input CSS source
  9279. *
  9280. * @type {string}
  9281. *
  9282. * @example
  9283. * const input = postcss.parse('a{}', { from: file }).input
  9284. * input.css //=> "a{}"
  9285. */
  9286. this.css = css.toString();
  9287. if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
  9288. this.css = this.css.slice(1);
  9289. }
  9290. if (opts.from) {
  9291. if (/^\w+:\/\//.test(opts.from)) {
  9292. /**
  9293. * The absolute path to the CSS source file defined
  9294. * with the `from` option.
  9295. *
  9296. * @type {string}
  9297. *
  9298. * @example
  9299. * const root = postcss.parse(css, { from: 'a.css' })
  9300. * root.source.input.file //=> '/home/ai/a.css'
  9301. */
  9302. this.file = opts.from;
  9303. } else {
  9304. this.file = _path.default.resolve(opts.from);
  9305. }
  9306. }
  9307. var map = new _previousMap.default(this.css, opts);
  9308. if (map.text) {
  9309. /**
  9310. * The input source map passed from a compilation step before PostCSS
  9311. * (for example, from Sass compiler).
  9312. *
  9313. * @type {PreviousMap}
  9314. *
  9315. * @example
  9316. * root.source.input.map.consumer().sources //=> ['a.sass']
  9317. */
  9318. this.map = map;
  9319. var file = map.consumer().file;
  9320. if (!this.file && file) this.file = this.mapResolve(file);
  9321. }
  9322. if (!this.file) {
  9323. sequence += 1;
  9324. /**
  9325. * The unique ID of the CSS source. It will be created if `from` option
  9326. * is not provided (because PostCSS does not know the file path).
  9327. *
  9328. * @type {string}
  9329. *
  9330. * @example
  9331. * const root = postcss.parse(css)
  9332. * root.source.input.file //=> undefined
  9333. * root.source.input.id //=> "<input css 1>"
  9334. */
  9335. this.id = '<input css ' + sequence + '>';
  9336. }
  9337. if (this.map) this.map.file = this.from;
  9338. }
  9339. var _proto = Input.prototype;
  9340. _proto.error = function error(message, line, column, opts) {
  9341. if (opts === void 0) {
  9342. opts = {};
  9343. }
  9344. var result;
  9345. var origin = this.origin(line, column);
  9346. if (origin) {
  9347. result = new _cssSyntaxError.default(message, origin.line, origin.column, origin.source, origin.file, opts.plugin);
  9348. } else {
  9349. result = new _cssSyntaxError.default(message, line, column, this.css, this.file, opts.plugin);
  9350. }
  9351. result.input = {
  9352. line: line,
  9353. column: column,
  9354. source: this.css
  9355. };
  9356. if (this.file) result.input.file = this.file;
  9357. return result;
  9358. };
  9359. /**
  9360. * Reads the input source map and returns a symbol position
  9361. * in the input source (e.g., in a Sass file that was compiled
  9362. * to CSS before being passed to PostCSS).
  9363. *
  9364. * @param {number} line Line in input CSS.
  9365. * @param {number} column Column in input CSS.
  9366. *
  9367. * @return {filePosition} Position in input source.
  9368. *
  9369. * @example
  9370. * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }
  9371. */
  9372. _proto.origin = function origin(line, column) {
  9373. if (!this.map) return false;
  9374. var consumer = this.map.consumer();
  9375. var from = consumer.originalPositionFor({
  9376. line: line,
  9377. column: column
  9378. });
  9379. if (!from.source) return false;
  9380. var result = {
  9381. file: this.mapResolve(from.source),
  9382. line: from.line,
  9383. column: from.column
  9384. };
  9385. var source = consumer.sourceContentFor(from.source);
  9386. if (source) result.source = source;
  9387. return result;
  9388. };
  9389. _proto.mapResolve = function mapResolve(file) {
  9390. if (/^\w+:\/\//.test(file)) {
  9391. return file;
  9392. }
  9393. return _path.default.resolve(this.map.consumer().sourceRoot || '.', file);
  9394. };
  9395. /**
  9396. * The CSS source identifier. Contains {@link Input#file} if the user
  9397. * set the `from` option, or {@link Input#id} if they did not.
  9398. *
  9399. * @type {string}
  9400. *
  9401. * @example
  9402. * const root = postcss.parse(css, { from: 'a.css' })
  9403. * root.source.input.from //=> "/home/ai/a.css"
  9404. *
  9405. * const root = postcss.parse(css)
  9406. * root.source.input.from //=> "<input css 1>"
  9407. */
  9408. _createClass(Input, [{
  9409. key: "from",
  9410. get: function get() {
  9411. return this.file || this.id;
  9412. }
  9413. }]);
  9414. return Input;
  9415. }();
  9416. var _default = Input;
  9417. /**
  9418. * @typedef {object} filePosition
  9419. * @property {string} file Path to file.
  9420. * @property {number} line Source line in file.
  9421. * @property {number} column Source column in file.
  9422. */
  9423. exports.default = _default;
  9424. module.exports = exports.default;
  9425. /***/ }),
  9426. /* 60 */
  9427. /***/ (function(module, exports, __webpack_require__) {
  9428. "use strict";
  9429. exports.__esModule = true;
  9430. exports.default = void 0;
  9431. var _supportsColor = _interopRequireDefault(__webpack_require__(117));
  9432. var _chalk = _interopRequireDefault(__webpack_require__(118));
  9433. var _terminalHighlight = _interopRequireDefault(__webpack_require__(119));
  9434. function _interopRequireDefault(obj) {
  9435. return obj && obj.__esModule ? obj : {
  9436. default: obj
  9437. };
  9438. }
  9439. /**
  9440. * The CSS parser throws this error for broken CSS.
  9441. *
  9442. * Custom parsers can throw this error for broken custom syntax using
  9443. * the {@link Node#error} method.
  9444. *
  9445. * PostCSS will use the input source map to detect the original error location.
  9446. * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
  9447. * PostCSS will show the original position in the Sass file.
  9448. *
  9449. * If you need the position in the PostCSS input
  9450. * (e.g., to debug the previous compiler), use `error.input.file`.
  9451. *
  9452. * @example
  9453. * // Catching and checking syntax error
  9454. * try {
  9455. * postcss.parse('a{')
  9456. * } catch (error) {
  9457. * if (error.name === 'CssSyntaxError') {
  9458. * error //=> CssSyntaxError
  9459. * }
  9460. * }
  9461. *
  9462. * @example
  9463. * // Raising error from plugin
  9464. * throw node.error('Unknown variable', { plugin: 'postcss-vars' })
  9465. */
  9466. var CssSyntaxError =
  9467. /*#__PURE__*/
  9468. function () {
  9469. /**
  9470. * @param {string} message Error message.
  9471. * @param {number} [line] Source line of the error.
  9472. * @param {number} [column] Source column of the error.
  9473. * @param {string} [source] Source code of the broken file.
  9474. * @param {string} [file] Absolute path to the broken file.
  9475. * @param {string} [plugin] PostCSS plugin name, if error came from plugin.
  9476. */
  9477. function CssSyntaxError(message, line, column, source, file, plugin) {
  9478. /**
  9479. * Always equal to `'CssSyntaxError'`. You should always check error type
  9480. * by `error.name === 'CssSyntaxError'`
  9481. * instead of `error instanceof CssSyntaxError`,
  9482. * because npm could have several PostCSS versions.
  9483. *
  9484. * @type {string}
  9485. *
  9486. * @example
  9487. * if (error.name === 'CssSyntaxError') {
  9488. * error //=> CssSyntaxError
  9489. * }
  9490. */
  9491. this.name = 'CssSyntaxError';
  9492. /**
  9493. * Error message.
  9494. *
  9495. * @type {string}
  9496. *
  9497. * @example
  9498. * error.message //=> 'Unclosed block'
  9499. */
  9500. this.reason = message;
  9501. if (file) {
  9502. /**
  9503. * Absolute path to the broken file.
  9504. *
  9505. * @type {string}
  9506. *
  9507. * @example
  9508. * error.file //=> 'a.sass'
  9509. * error.input.file //=> 'a.css'
  9510. */
  9511. this.file = file;
  9512. }
  9513. if (source) {
  9514. /**
  9515. * Source code of the broken file.
  9516. *
  9517. * @type {string}
  9518. *
  9519. * @example
  9520. * error.source //=> 'a { b {} }'
  9521. * error.input.column //=> 'a b { }'
  9522. */
  9523. this.source = source;
  9524. }
  9525. if (plugin) {
  9526. /**
  9527. * Plugin name, if error came from plugin.
  9528. *
  9529. * @type {string}
  9530. *
  9531. * @example
  9532. * error.plugin //=> 'postcss-vars'
  9533. */
  9534. this.plugin = plugin;
  9535. }
  9536. if (typeof line !== 'undefined' && typeof column !== 'undefined') {
  9537. /**
  9538. * Source line of the error.
  9539. *
  9540. * @type {number}
  9541. *
  9542. * @example
  9543. * error.line //=> 2
  9544. * error.input.line //=> 4
  9545. */
  9546. this.line = line;
  9547. /**
  9548. * Source column of the error.
  9549. *
  9550. * @type {number}
  9551. *
  9552. * @example
  9553. * error.column //=> 1
  9554. * error.input.column //=> 4
  9555. */
  9556. this.column = column;
  9557. }
  9558. this.setMessage();
  9559. if (Error.captureStackTrace) {
  9560. Error.captureStackTrace(this, CssSyntaxError);
  9561. }
  9562. }
  9563. var _proto = CssSyntaxError.prototype;
  9564. _proto.setMessage = function setMessage() {
  9565. /**
  9566. * Full error text in the GNU error format
  9567. * with plugin, file, line and column.
  9568. *
  9569. * @type {string}
  9570. *
  9571. * @example
  9572. * error.message //=> 'a.css:1:1: Unclosed block'
  9573. */
  9574. this.message = this.plugin ? this.plugin + ': ' : '';
  9575. this.message += this.file ? this.file : '<css input>';
  9576. if (typeof this.line !== 'undefined') {
  9577. this.message += ':' + this.line + ':' + this.column;
  9578. }
  9579. this.message += ': ' + this.reason;
  9580. };
  9581. /**
  9582. * Returns a few lines of CSS source that caused the error.
  9583. *
  9584. * If the CSS has an input source map without `sourceContent`,
  9585. * this method will return an empty string.
  9586. *
  9587. * @param {boolean} [color] Whether arrow will be colored red by terminal
  9588. * color codes. By default, PostCSS will detect
  9589. * color support by `process.stdout.isTTY`
  9590. * and `process.env.NODE_DISABLE_COLORS`.
  9591. *
  9592. * @example
  9593. * error.showSourceCode() //=> " 4 | }
  9594. * // 5 | a {
  9595. * // > 6 | bad
  9596. * // | ^
  9597. * // 7 | }
  9598. * // 8 | b {"
  9599. *
  9600. * @return {string} Few lines of CSS source that caused the error.
  9601. */
  9602. _proto.showSourceCode = function showSourceCode(color) {
  9603. var _this = this;
  9604. if (!this.source) return '';
  9605. var css = this.source;
  9606. if (_terminalHighlight.default) {
  9607. if (typeof color === 'undefined') color = _supportsColor.default.stdout;
  9608. if (color) css = (0, _terminalHighlight.default)(css);
  9609. }
  9610. var lines = css.split(/\r?\n/);
  9611. var start = Math.max(this.line - 3, 0);
  9612. var end = Math.min(this.line + 2, lines.length);
  9613. var maxWidth = String(end).length;
  9614. function mark(text) {
  9615. if (color && _chalk.default.red) {
  9616. return _chalk.default.red.bold(text);
  9617. }
  9618. return text;
  9619. }
  9620. function aside(text) {
  9621. if (color && _chalk.default.gray) {
  9622. return _chalk.default.gray(text);
  9623. }
  9624. return text;
  9625. }
  9626. return lines.slice(start, end).map(function (line, index) {
  9627. var number = start + 1 + index;
  9628. var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
  9629. if (number === _this.line) {
  9630. var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this.column - 1).replace(/[^\t]/g, ' ');
  9631. return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^');
  9632. }
  9633. return ' ' + aside(gutter) + line;
  9634. }).join('\n');
  9635. };
  9636. /**
  9637. * Returns error position, message and source code of the broken part.
  9638. *
  9639. * @example
  9640. * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
  9641. * // > 1 | a {
  9642. * // | ^"
  9643. *
  9644. * @return {string} Error position, message and source code.
  9645. */
  9646. _proto.toString = function toString() {
  9647. var code = this.showSourceCode();
  9648. if (code) {
  9649. code = '\n\n' + code + '\n';
  9650. }
  9651. return this.name + ': ' + this.message + code;
  9652. };
  9653. /**
  9654. * @memberof CssSyntaxError#
  9655. * @member {Input} input Input object with PostCSS internal information
  9656. * about input file. If input has source map
  9657. * from previous tool, PostCSS will use origin
  9658. * (for example, Sass) source. You can use this
  9659. * object to get PostCSS input source.
  9660. *
  9661. * @example
  9662. * error.input.file //=> 'a.css'
  9663. * error.file //=> 'a.sass'
  9664. */
  9665. return CssSyntaxError;
  9666. }();
  9667. var _default = CssSyntaxError;
  9668. exports.default = _default;
  9669. module.exports = exports.default;
  9670. /***/ }),
  9671. /* 61 */
  9672. /***/ (function(module, exports, __webpack_require__) {
  9673. /*
  9674. * Copyright 2009-2011 Mozilla Foundation and contributors
  9675. * Licensed under the New BSD license. See LICENSE.txt or:
  9676. * http://opensource.org/licenses/BSD-3-Clause
  9677. */
  9678. exports.SourceMapGenerator = __webpack_require__(62).SourceMapGenerator;
  9679. exports.SourceMapConsumer = __webpack_require__(126).SourceMapConsumer;
  9680. exports.SourceNode = __webpack_require__(129).SourceNode;
  9681. /***/ }),
  9682. /* 62 */
  9683. /***/ (function(module, exports, __webpack_require__) {
  9684. /* -*- Mode: js; js-indent-level: 2; -*- */
  9685. /*
  9686. * Copyright 2011 Mozilla Foundation and contributors
  9687. * Licensed under the New BSD license. See LICENSE or:
  9688. * http://opensource.org/licenses/BSD-3-Clause
  9689. */
  9690. var base64VLQ = __webpack_require__(63);
  9691. var util = __webpack_require__(8);
  9692. var ArraySet = __webpack_require__(64).ArraySet;
  9693. var MappingList = __webpack_require__(125).MappingList;
  9694. /**
  9695. * An instance of the SourceMapGenerator represents a source map which is
  9696. * being built incrementally. You may pass an object with the following
  9697. * properties:
  9698. *
  9699. * - file: The filename of the generated source.
  9700. * - sourceRoot: A root for all relative URLs in this source map.
  9701. */
  9702. function SourceMapGenerator(aArgs) {
  9703. if (!aArgs) {
  9704. aArgs = {};
  9705. }
  9706. this._file = util.getArg(aArgs, 'file', null);
  9707. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  9708. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  9709. this._sources = new ArraySet();
  9710. this._names = new ArraySet();
  9711. this._mappings = new MappingList();
  9712. this._sourcesContents = null;
  9713. }
  9714. SourceMapGenerator.prototype._version = 3;
  9715. /**
  9716. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  9717. *
  9718. * @param aSourceMapConsumer The SourceMap.
  9719. */
  9720. SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  9721. var sourceRoot = aSourceMapConsumer.sourceRoot;
  9722. var generator = new SourceMapGenerator({
  9723. file: aSourceMapConsumer.file,
  9724. sourceRoot: sourceRoot
  9725. });
  9726. aSourceMapConsumer.eachMapping(function (mapping) {
  9727. var newMapping = {
  9728. generated: {
  9729. line: mapping.generatedLine,
  9730. column: mapping.generatedColumn
  9731. }
  9732. };
  9733. if (mapping.source != null) {
  9734. newMapping.source = mapping.source;
  9735. if (sourceRoot != null) {
  9736. newMapping.source = util.relative(sourceRoot, newMapping.source);
  9737. }
  9738. newMapping.original = {
  9739. line: mapping.originalLine,
  9740. column: mapping.originalColumn
  9741. };
  9742. if (mapping.name != null) {
  9743. newMapping.name = mapping.name;
  9744. }
  9745. }
  9746. generator.addMapping(newMapping);
  9747. });
  9748. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  9749. var sourceRelative = sourceFile;
  9750. if (sourceRoot !== null) {
  9751. sourceRelative = util.relative(sourceRoot, sourceFile);
  9752. }
  9753. if (!generator._sources.has(sourceRelative)) {
  9754. generator._sources.add(sourceRelative);
  9755. }
  9756. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  9757. if (content != null) {
  9758. generator.setSourceContent(sourceFile, content);
  9759. }
  9760. });
  9761. return generator;
  9762. };
  9763. /**
  9764. * Add a single mapping from original source line and column to the generated
  9765. * source's line and column for this source map being created. The mapping
  9766. * object should have the following properties:
  9767. *
  9768. * - generated: An object with the generated line and column positions.
  9769. * - original: An object with the original line and column positions.
  9770. * - source: The original source file (relative to the sourceRoot).
  9771. * - name: An optional original token name for this mapping.
  9772. */
  9773. SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
  9774. var generated = util.getArg(aArgs, 'generated');
  9775. var original = util.getArg(aArgs, 'original', null);
  9776. var source = util.getArg(aArgs, 'source', null);
  9777. var name = util.getArg(aArgs, 'name', null);
  9778. if (!this._skipValidation) {
  9779. this._validateMapping(generated, original, source, name);
  9780. }
  9781. if (source != null) {
  9782. source = String(source);
  9783. if (!this._sources.has(source)) {
  9784. this._sources.add(source);
  9785. }
  9786. }
  9787. if (name != null) {
  9788. name = String(name);
  9789. if (!this._names.has(name)) {
  9790. this._names.add(name);
  9791. }
  9792. }
  9793. this._mappings.add({
  9794. generatedLine: generated.line,
  9795. generatedColumn: generated.column,
  9796. originalLine: original != null && original.line,
  9797. originalColumn: original != null && original.column,
  9798. source: source,
  9799. name: name
  9800. });
  9801. };
  9802. /**
  9803. * Set the source content for a source file.
  9804. */
  9805. SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  9806. var source = aSourceFile;
  9807. if (this._sourceRoot != null) {
  9808. source = util.relative(this._sourceRoot, source);
  9809. }
  9810. if (aSourceContent != null) {
  9811. // Add the source content to the _sourcesContents map.
  9812. // Create a new _sourcesContents map if the property is null.
  9813. if (!this._sourcesContents) {
  9814. this._sourcesContents = Object.create(null);
  9815. }
  9816. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  9817. } else if (this._sourcesContents) {
  9818. // Remove the source file from the _sourcesContents map.
  9819. // If the _sourcesContents map is empty, set the property to null.
  9820. delete this._sourcesContents[util.toSetString(source)];
  9821. if (Object.keys(this._sourcesContents).length === 0) {
  9822. this._sourcesContents = null;
  9823. }
  9824. }
  9825. };
  9826. /**
  9827. * Applies the mappings of a sub-source-map for a specific source file to the
  9828. * source map being generated. Each mapping to the supplied source file is
  9829. * rewritten using the supplied source map. Note: The resolution for the
  9830. * resulting mappings is the minimium of this map and the supplied map.
  9831. *
  9832. * @param aSourceMapConsumer The source map to be applied.
  9833. * @param aSourceFile Optional. The filename of the source file.
  9834. * If omitted, SourceMapConsumer's file property will be used.
  9835. * @param aSourceMapPath Optional. The dirname of the path to the source map
  9836. * to be applied. If relative, it is relative to the SourceMapConsumer.
  9837. * This parameter is needed when the two source maps aren't in the same
  9838. * directory, and the source map to be applied contains relative source
  9839. * paths. If so, those relative source paths need to be rewritten
  9840. * relative to the SourceMapGenerator.
  9841. */
  9842. SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  9843. var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap
  9844. if (aSourceFile == null) {
  9845. if (aSourceMapConsumer.file == null) {
  9846. throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
  9847. }
  9848. sourceFile = aSourceMapConsumer.file;
  9849. }
  9850. var sourceRoot = this._sourceRoot; // Make "sourceFile" relative if an absolute Url is passed.
  9851. if (sourceRoot != null) {
  9852. sourceFile = util.relative(sourceRoot, sourceFile);
  9853. } // Applying the SourceMap can add and remove items from the sources and
  9854. // the names array.
  9855. var newSources = new ArraySet();
  9856. var newNames = new ArraySet(); // Find mappings for the "sourceFile"
  9857. this._mappings.unsortedForEach(function (mapping) {
  9858. if (mapping.source === sourceFile && mapping.originalLine != null) {
  9859. // Check if it can be mapped by the source map, then update the mapping.
  9860. var original = aSourceMapConsumer.originalPositionFor({
  9861. line: mapping.originalLine,
  9862. column: mapping.originalColumn
  9863. });
  9864. if (original.source != null) {
  9865. // Copy mapping
  9866. mapping.source = original.source;
  9867. if (aSourceMapPath != null) {
  9868. mapping.source = util.join(aSourceMapPath, mapping.source);
  9869. }
  9870. if (sourceRoot != null) {
  9871. mapping.source = util.relative(sourceRoot, mapping.source);
  9872. }
  9873. mapping.originalLine = original.line;
  9874. mapping.originalColumn = original.column;
  9875. if (original.name != null) {
  9876. mapping.name = original.name;
  9877. }
  9878. }
  9879. }
  9880. var source = mapping.source;
  9881. if (source != null && !newSources.has(source)) {
  9882. newSources.add(source);
  9883. }
  9884. var name = mapping.name;
  9885. if (name != null && !newNames.has(name)) {
  9886. newNames.add(name);
  9887. }
  9888. }, this);
  9889. this._sources = newSources;
  9890. this._names = newNames; // Copy sourcesContents of applied map.
  9891. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  9892. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  9893. if (content != null) {
  9894. if (aSourceMapPath != null) {
  9895. sourceFile = util.join(aSourceMapPath, sourceFile);
  9896. }
  9897. if (sourceRoot != null) {
  9898. sourceFile = util.relative(sourceRoot, sourceFile);
  9899. }
  9900. this.setSourceContent(sourceFile, content);
  9901. }
  9902. }, this);
  9903. };
  9904. /**
  9905. * A mapping can have one of the three levels of data:
  9906. *
  9907. * 1. Just the generated position.
  9908. * 2. The Generated position, original position, and original source.
  9909. * 3. Generated and original position, original source, as well as a name
  9910. * token.
  9911. *
  9912. * To maintain consistency, we validate that any new mapping being added falls
  9913. * in to one of these categories.
  9914. */
  9915. SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
  9916. // When aOriginal is truthy but has empty values for .line and .column,
  9917. // it is most likely a programmer error. In this case we throw a very
  9918. // specific error message to try to guide them the right way.
  9919. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  9920. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  9921. throw new Error('original.line and original.column are not numbers -- you probably meant to omit ' + 'the original mapping entirely and only map the generated position. If so, pass ' + 'null for the original mapping instead of an object with empty or null values.');
  9922. }
  9923. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
  9924. // Case 1.
  9925. return;
  9926. } else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
  9927. // Cases 2 and 3.
  9928. return;
  9929. } else {
  9930. throw new Error('Invalid mapping: ' + JSON.stringify({
  9931. generated: aGenerated,
  9932. source: aSource,
  9933. original: aOriginal,
  9934. name: aName
  9935. }));
  9936. }
  9937. };
  9938. /**
  9939. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  9940. * specified by the source map format.
  9941. */
  9942. SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
  9943. var previousGeneratedColumn = 0;
  9944. var previousGeneratedLine = 1;
  9945. var previousOriginalColumn = 0;
  9946. var previousOriginalLine = 0;
  9947. var previousName = 0;
  9948. var previousSource = 0;
  9949. var result = '';
  9950. var next;
  9951. var mapping;
  9952. var nameIdx;
  9953. var sourceIdx;
  9954. var mappings = this._mappings.toArray();
  9955. for (var i = 0, len = mappings.length; i < len; i++) {
  9956. mapping = mappings[i];
  9957. next = '';
  9958. if (mapping.generatedLine !== previousGeneratedLine) {
  9959. previousGeneratedColumn = 0;
  9960. while (mapping.generatedLine !== previousGeneratedLine) {
  9961. next += ';';
  9962. previousGeneratedLine++;
  9963. }
  9964. } else {
  9965. if (i > 0) {
  9966. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  9967. continue;
  9968. }
  9969. next += ',';
  9970. }
  9971. }
  9972. next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
  9973. previousGeneratedColumn = mapping.generatedColumn;
  9974. if (mapping.source != null) {
  9975. sourceIdx = this._sources.indexOf(mapping.source);
  9976. next += base64VLQ.encode(sourceIdx - previousSource);
  9977. previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3
  9978. next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
  9979. previousOriginalLine = mapping.originalLine - 1;
  9980. next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
  9981. previousOriginalColumn = mapping.originalColumn;
  9982. if (mapping.name != null) {
  9983. nameIdx = this._names.indexOf(mapping.name);
  9984. next += base64VLQ.encode(nameIdx - previousName);
  9985. previousName = nameIdx;
  9986. }
  9987. }
  9988. result += next;
  9989. }
  9990. return result;
  9991. };
  9992. SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  9993. return aSources.map(function (source) {
  9994. if (!this._sourcesContents) {
  9995. return null;
  9996. }
  9997. if (aSourceRoot != null) {
  9998. source = util.relative(aSourceRoot, source);
  9999. }
  10000. var key = util.toSetString(source);
  10001. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
  10002. }, this);
  10003. };
  10004. /**
  10005. * Externalize the source map.
  10006. */
  10007. SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
  10008. var map = {
  10009. version: this._version,
  10010. sources: this._sources.toArray(),
  10011. names: this._names.toArray(),
  10012. mappings: this._serializeMappings()
  10013. };
  10014. if (this._file != null) {
  10015. map.file = this._file;
  10016. }
  10017. if (this._sourceRoot != null) {
  10018. map.sourceRoot = this._sourceRoot;
  10019. }
  10020. if (this._sourcesContents) {
  10021. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  10022. }
  10023. return map;
  10024. };
  10025. /**
  10026. * Render the source map being generated to a string.
  10027. */
  10028. SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
  10029. return JSON.stringify(this.toJSON());
  10030. };
  10031. exports.SourceMapGenerator = SourceMapGenerator;
  10032. /***/ }),
  10033. /* 63 */
  10034. /***/ (function(module, exports, __webpack_require__) {
  10035. /* -*- Mode: js; js-indent-level: 2; -*- */
  10036. /*
  10037. * Copyright 2011 Mozilla Foundation and contributors
  10038. * Licensed under the New BSD license. See LICENSE or:
  10039. * http://opensource.org/licenses/BSD-3-Clause
  10040. *
  10041. * Based on the Base 64 VLQ implementation in Closure Compiler:
  10042. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  10043. *
  10044. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  10045. * Redistribution and use in source and binary forms, with or without
  10046. * modification, are permitted provided that the following conditions are
  10047. * met:
  10048. *
  10049. * * Redistributions of source code must retain the above copyright
  10050. * notice, this list of conditions and the following disclaimer.
  10051. * * Redistributions in binary form must reproduce the above
  10052. * copyright notice, this list of conditions and the following
  10053. * disclaimer in the documentation and/or other materials provided
  10054. * with the distribution.
  10055. * * Neither the name of Google Inc. nor the names of its
  10056. * contributors may be used to endorse or promote products derived
  10057. * from this software without specific prior written permission.
  10058. *
  10059. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  10060. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  10061. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  10062. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  10063. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10064. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  10065. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10066. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  10067. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  10068. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  10069. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10070. */
  10071. var base64 = __webpack_require__(124); // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  10072. // length quantities we use in the source map spec, the first bit is the sign,
  10073. // the next four bits are the actual value, and the 6th bit is the
  10074. // continuation bit. The continuation bit tells us whether there are more
  10075. // digits in this value following this digit.
  10076. //
  10077. // Continuation
  10078. // | Sign
  10079. // | |
  10080. // V V
  10081. // 101011
  10082. var VLQ_BASE_SHIFT = 5; // binary: 100000
  10083. var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111
  10084. var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000
  10085. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  10086. /**
  10087. * Converts from a two-complement value to a value where the sign bit is
  10088. * placed in the least significant bit. For example, as decimals:
  10089. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  10090. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  10091. */
  10092. function toVLQSigned(aValue) {
  10093. return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
  10094. }
  10095. /**
  10096. * Converts to a two-complement value from a value where the sign bit is
  10097. * placed in the least significant bit. For example, as decimals:
  10098. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  10099. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  10100. */
  10101. function fromVLQSigned(aValue) {
  10102. var isNegative = (aValue & 1) === 1;
  10103. var shifted = aValue >> 1;
  10104. return isNegative ? -shifted : shifted;
  10105. }
  10106. /**
  10107. * Returns the base 64 VLQ encoded value.
  10108. */
  10109. exports.encode = function base64VLQ_encode(aValue) {
  10110. var encoded = "";
  10111. var digit;
  10112. var vlq = toVLQSigned(aValue);
  10113. do {
  10114. digit = vlq & VLQ_BASE_MASK;
  10115. vlq >>>= VLQ_BASE_SHIFT;
  10116. if (vlq > 0) {
  10117. // There are still more digits in this value, so we must make sure the
  10118. // continuation bit is marked.
  10119. digit |= VLQ_CONTINUATION_BIT;
  10120. }
  10121. encoded += base64.encode(digit);
  10122. } while (vlq > 0);
  10123. return encoded;
  10124. };
  10125. /**
  10126. * Decodes the next base 64 VLQ value from the given string and returns the
  10127. * value and the rest of the string via the out parameter.
  10128. */
  10129. exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  10130. var strLen = aStr.length;
  10131. var result = 0;
  10132. var shift = 0;
  10133. var continuation, digit;
  10134. do {
  10135. if (aIndex >= strLen) {
  10136. throw new Error("Expected more digits in base 64 VLQ value.");
  10137. }
  10138. digit = base64.decode(aStr.charCodeAt(aIndex++));
  10139. if (digit === -1) {
  10140. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  10141. }
  10142. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  10143. digit &= VLQ_BASE_MASK;
  10144. result = result + (digit << shift);
  10145. shift += VLQ_BASE_SHIFT;
  10146. } while (continuation);
  10147. aOutParam.value = fromVLQSigned(result);
  10148. aOutParam.rest = aIndex;
  10149. };
  10150. /***/ }),
  10151. /* 64 */
  10152. /***/ (function(module, exports, __webpack_require__) {
  10153. /* -*- Mode: js; js-indent-level: 2; -*- */
  10154. /*
  10155. * Copyright 2011 Mozilla Foundation and contributors
  10156. * Licensed under the New BSD license. See LICENSE or:
  10157. * http://opensource.org/licenses/BSD-3-Clause
  10158. */
  10159. var util = __webpack_require__(8);
  10160. var has = Object.prototype.hasOwnProperty;
  10161. var hasNativeMap = typeof Map !== "undefined";
  10162. /**
  10163. * A data structure which is a combination of an array and a set. Adding a new
  10164. * member is O(1), testing for membership is O(1), and finding the index of an
  10165. * element is O(1). Removing elements from the set is not supported. Only
  10166. * strings are supported for membership.
  10167. */
  10168. function ArraySet() {
  10169. this._array = [];
  10170. this._set = hasNativeMap ? new Map() : Object.create(null);
  10171. }
  10172. /**
  10173. * Static method for creating ArraySet instances from an existing array.
  10174. */
  10175. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  10176. var set = new ArraySet();
  10177. for (var i = 0, len = aArray.length; i < len; i++) {
  10178. set.add(aArray[i], aAllowDuplicates);
  10179. }
  10180. return set;
  10181. };
  10182. /**
  10183. * Return how many unique items are in this ArraySet. If duplicates have been
  10184. * added, than those do not count towards the size.
  10185. *
  10186. * @returns Number
  10187. */
  10188. ArraySet.prototype.size = function ArraySet_size() {
  10189. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  10190. };
  10191. /**
  10192. * Add the given string to this set.
  10193. *
  10194. * @param String aStr
  10195. */
  10196. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  10197. var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
  10198. var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
  10199. var idx = this._array.length;
  10200. if (!isDuplicate || aAllowDuplicates) {
  10201. this._array.push(aStr);
  10202. }
  10203. if (!isDuplicate) {
  10204. if (hasNativeMap) {
  10205. this._set.set(aStr, idx);
  10206. } else {
  10207. this._set[sStr] = idx;
  10208. }
  10209. }
  10210. };
  10211. /**
  10212. * Is the given string a member of this set?
  10213. *
  10214. * @param String aStr
  10215. */
  10216. ArraySet.prototype.has = function ArraySet_has(aStr) {
  10217. if (hasNativeMap) {
  10218. return this._set.has(aStr);
  10219. } else {
  10220. var sStr = util.toSetString(aStr);
  10221. return has.call(this._set, sStr);
  10222. }
  10223. };
  10224. /**
  10225. * What is the index of the given string in the array?
  10226. *
  10227. * @param String aStr
  10228. */
  10229. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  10230. if (hasNativeMap) {
  10231. var idx = this._set.get(aStr);
  10232. if (idx >= 0) {
  10233. return idx;
  10234. }
  10235. } else {
  10236. var sStr = util.toSetString(aStr);
  10237. if (has.call(this._set, sStr)) {
  10238. return this._set[sStr];
  10239. }
  10240. }
  10241. throw new Error('"' + aStr + '" is not in the set.');
  10242. };
  10243. /**
  10244. * What is the element at the given index?
  10245. *
  10246. * @param Number aIdx
  10247. */
  10248. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  10249. if (aIdx >= 0 && aIdx < this._array.length) {
  10250. return this._array[aIdx];
  10251. }
  10252. throw new Error('No element indexed by ' + aIdx);
  10253. };
  10254. /**
  10255. * Returns the array representation of this set (which has the proper indices
  10256. * indicated by indexOf). Note that this is a copy of the internal array used
  10257. * for storing the members so that no one can mess with internal state.
  10258. */
  10259. ArraySet.prototype.toArray = function ArraySet_toArray() {
  10260. return this._array.slice();
  10261. };
  10262. exports.ArraySet = ArraySet;
  10263. /***/ }),
  10264. /* 65 */
  10265. /***/ (function(module, exports, __webpack_require__) {
  10266. "use strict";
  10267. exports.__esModule = true;
  10268. exports.default = void 0;
  10269. var _stringifier = _interopRequireDefault(__webpack_require__(17));
  10270. function _interopRequireDefault(obj) {
  10271. return obj && obj.__esModule ? obj : {
  10272. default: obj
  10273. };
  10274. }
  10275. function stringify(node, builder) {
  10276. var str = new _stringifier.default(builder);
  10277. str.stringify(node);
  10278. }
  10279. var _default = stringify;
  10280. exports.default = _default;
  10281. module.exports = exports.default;
  10282. /***/ }),
  10283. /* 66 */
  10284. /***/ (function(module, exports, __webpack_require__) {
  10285. "use strict";
  10286. exports.__esModule = true;
  10287. exports.default = void 0;
  10288. var _declaration = _interopRequireDefault(__webpack_require__(67));
  10289. var _tokenize = _interopRequireDefault(__webpack_require__(132));
  10290. var _comment = _interopRequireDefault(__webpack_require__(19));
  10291. var _atRule = _interopRequireDefault(__webpack_require__(68));
  10292. var _root = _interopRequireDefault(__webpack_require__(134));
  10293. var _rule = _interopRequireDefault(__webpack_require__(70));
  10294. function _interopRequireDefault(obj) {
  10295. return obj && obj.__esModule ? obj : {
  10296. default: obj
  10297. };
  10298. }
  10299. var Parser =
  10300. /*#__PURE__*/
  10301. function () {
  10302. function Parser(input) {
  10303. this.input = input;
  10304. this.root = new _root.default();
  10305. this.current = this.root;
  10306. this.spaces = '';
  10307. this.semicolon = false;
  10308. this.createTokenizer();
  10309. this.root.source = {
  10310. input: input,
  10311. start: {
  10312. line: 1,
  10313. column: 1
  10314. }
  10315. };
  10316. }
  10317. var _proto = Parser.prototype;
  10318. _proto.createTokenizer = function createTokenizer() {
  10319. this.tokenizer = (0, _tokenize.default)(this.input);
  10320. };
  10321. _proto.parse = function parse() {
  10322. var token;
  10323. while (!this.tokenizer.endOfFile()) {
  10324. token = this.tokenizer.nextToken();
  10325. switch (token[0]) {
  10326. case 'space':
  10327. this.spaces += token[1];
  10328. break;
  10329. case ';':
  10330. this.freeSemicolon(token);
  10331. break;
  10332. case '}':
  10333. this.end(token);
  10334. break;
  10335. case 'comment':
  10336. this.comment(token);
  10337. break;
  10338. case 'at-word':
  10339. this.atrule(token);
  10340. break;
  10341. case '{':
  10342. this.emptyRule(token);
  10343. break;
  10344. default:
  10345. this.other(token);
  10346. break;
  10347. }
  10348. }
  10349. this.endFile();
  10350. };
  10351. _proto.comment = function comment(token) {
  10352. var node = new _comment.default();
  10353. this.init(node, token[2], token[3]);
  10354. node.source.end = {
  10355. line: token[4],
  10356. column: token[5]
  10357. };
  10358. var text = token[1].slice(2, -2);
  10359. if (/^\s*$/.test(text)) {
  10360. node.text = '';
  10361. node.raws.left = text;
  10362. node.raws.right = '';
  10363. } else {
  10364. var match = text.match(/^(\s*)([^]*[^\s])(\s*)$/);
  10365. node.text = match[2];
  10366. node.raws.left = match[1];
  10367. node.raws.right = match[3];
  10368. }
  10369. };
  10370. _proto.emptyRule = function emptyRule(token) {
  10371. var node = new _rule.default();
  10372. this.init(node, token[2], token[3]);
  10373. node.selector = '';
  10374. node.raws.between = '';
  10375. this.current = node;
  10376. };
  10377. _proto.other = function other(start) {
  10378. var end = false;
  10379. var type = null;
  10380. var colon = false;
  10381. var bracket = null;
  10382. var brackets = [];
  10383. var tokens = [];
  10384. var token = start;
  10385. while (token) {
  10386. type = token[0];
  10387. tokens.push(token);
  10388. if (type === '(' || type === '[') {
  10389. if (!bracket) bracket = token;
  10390. brackets.push(type === '(' ? ')' : ']');
  10391. } else if (brackets.length === 0) {
  10392. if (type === ';') {
  10393. if (colon) {
  10394. this.decl(tokens);
  10395. return;
  10396. } else {
  10397. break;
  10398. }
  10399. } else if (type === '{') {
  10400. this.rule(tokens);
  10401. return;
  10402. } else if (type === '}') {
  10403. this.tokenizer.back(tokens.pop());
  10404. end = true;
  10405. break;
  10406. } else if (type === ':') {
  10407. colon = true;
  10408. }
  10409. } else if (type === brackets[brackets.length - 1]) {
  10410. brackets.pop();
  10411. if (brackets.length === 0) bracket = null;
  10412. }
  10413. token = this.tokenizer.nextToken();
  10414. }
  10415. if (this.tokenizer.endOfFile()) end = true;
  10416. if (brackets.length > 0) this.unclosedBracket(bracket);
  10417. if (end && colon) {
  10418. while (tokens.length) {
  10419. token = tokens[tokens.length - 1][0];
  10420. if (token !== 'space' && token !== 'comment') break;
  10421. this.tokenizer.back(tokens.pop());
  10422. }
  10423. this.decl(tokens);
  10424. } else {
  10425. this.unknownWord(tokens);
  10426. }
  10427. };
  10428. _proto.rule = function rule(tokens) {
  10429. tokens.pop();
  10430. var node = new _rule.default();
  10431. this.init(node, tokens[0][2], tokens[0][3]);
  10432. node.raws.between = this.spacesAndCommentsFromEnd(tokens);
  10433. this.raw(node, 'selector', tokens);
  10434. this.current = node;
  10435. };
  10436. _proto.decl = function decl(tokens) {
  10437. var node = new _declaration.default();
  10438. this.init(node);
  10439. var last = tokens[tokens.length - 1];
  10440. if (last[0] === ';') {
  10441. this.semicolon = true;
  10442. tokens.pop();
  10443. }
  10444. if (last[4]) {
  10445. node.source.end = {
  10446. line: last[4],
  10447. column: last[5]
  10448. };
  10449. } else {
  10450. node.source.end = {
  10451. line: last[2],
  10452. column: last[3]
  10453. };
  10454. }
  10455. while (tokens[0][0] !== 'word') {
  10456. if (tokens.length === 1) this.unknownWord(tokens);
  10457. node.raws.before += tokens.shift()[1];
  10458. }
  10459. node.source.start = {
  10460. line: tokens[0][2],
  10461. column: tokens[0][3]
  10462. };
  10463. node.prop = '';
  10464. while (tokens.length) {
  10465. var type = tokens[0][0];
  10466. if (type === ':' || type === 'space' || type === 'comment') {
  10467. break;
  10468. }
  10469. node.prop += tokens.shift()[1];
  10470. }
  10471. node.raws.between = '';
  10472. var token;
  10473. while (tokens.length) {
  10474. token = tokens.shift();
  10475. if (token[0] === ':') {
  10476. node.raws.between += token[1];
  10477. break;
  10478. } else {
  10479. node.raws.between += token[1];
  10480. }
  10481. }
  10482. if (node.prop[0] === '_' || node.prop[0] === '*') {
  10483. node.raws.before += node.prop[0];
  10484. node.prop = node.prop.slice(1);
  10485. }
  10486. node.raws.between += this.spacesAndCommentsFromStart(tokens);
  10487. this.precheckMissedSemicolon(tokens);
  10488. for (var i = tokens.length - 1; i > 0; i--) {
  10489. token = tokens[i];
  10490. if (token[1].toLowerCase() === '!important') {
  10491. node.important = true;
  10492. var string = this.stringFrom(tokens, i);
  10493. string = this.spacesFromEnd(tokens) + string;
  10494. if (string !== ' !important') node.raws.important = string;
  10495. break;
  10496. } else if (token[1].toLowerCase() === 'important') {
  10497. var cache = tokens.slice(0);
  10498. var str = '';
  10499. for (var j = i; j > 0; j--) {
  10500. var _type = cache[j][0];
  10501. if (str.trim().indexOf('!') === 0 && _type !== 'space') {
  10502. break;
  10503. }
  10504. str = cache.pop()[1] + str;
  10505. }
  10506. if (str.trim().indexOf('!') === 0) {
  10507. node.important = true;
  10508. node.raws.important = str;
  10509. tokens = cache;
  10510. }
  10511. }
  10512. if (token[0] !== 'space' && token[0] !== 'comment') {
  10513. break;
  10514. }
  10515. }
  10516. this.raw(node, 'value', tokens);
  10517. if (node.value.indexOf(':') !== -1) this.checkMissedSemicolon(tokens);
  10518. };
  10519. _proto.atrule = function atrule(token) {
  10520. var node = new _atRule.default();
  10521. node.name = token[1].slice(1);
  10522. if (node.name === '') {
  10523. this.unnamedAtrule(node, token);
  10524. }
  10525. this.init(node, token[2], token[3]);
  10526. var prev;
  10527. var shift;
  10528. var last = false;
  10529. var open = false;
  10530. var params = [];
  10531. while (!this.tokenizer.endOfFile()) {
  10532. token = this.tokenizer.nextToken();
  10533. if (token[0] === ';') {
  10534. node.source.end = {
  10535. line: token[2],
  10536. column: token[3]
  10537. };
  10538. this.semicolon = true;
  10539. break;
  10540. } else if (token[0] === '{') {
  10541. open = true;
  10542. break;
  10543. } else if (token[0] === '}') {
  10544. if (params.length > 0) {
  10545. shift = params.length - 1;
  10546. prev = params[shift];
  10547. while (prev && prev[0] === 'space') {
  10548. prev = params[--shift];
  10549. }
  10550. if (prev) {
  10551. node.source.end = {
  10552. line: prev[4],
  10553. column: prev[5]
  10554. };
  10555. }
  10556. }
  10557. this.end(token);
  10558. break;
  10559. } else {
  10560. params.push(token);
  10561. }
  10562. if (this.tokenizer.endOfFile()) {
  10563. last = true;
  10564. break;
  10565. }
  10566. }
  10567. node.raws.between = this.spacesAndCommentsFromEnd(params);
  10568. if (params.length) {
  10569. node.raws.afterName = this.spacesAndCommentsFromStart(params);
  10570. this.raw(node, 'params', params);
  10571. if (last) {
  10572. token = params[params.length - 1];
  10573. node.source.end = {
  10574. line: token[4],
  10575. column: token[5]
  10576. };
  10577. this.spaces = node.raws.between;
  10578. node.raws.between = '';
  10579. }
  10580. } else {
  10581. node.raws.afterName = '';
  10582. node.params = '';
  10583. }
  10584. if (open) {
  10585. node.nodes = [];
  10586. this.current = node;
  10587. }
  10588. };
  10589. _proto.end = function end(token) {
  10590. if (this.current.nodes && this.current.nodes.length) {
  10591. this.current.raws.semicolon = this.semicolon;
  10592. }
  10593. this.semicolon = false;
  10594. this.current.raws.after = (this.current.raws.after || '') + this.spaces;
  10595. this.spaces = '';
  10596. if (this.current.parent) {
  10597. this.current.source.end = {
  10598. line: token[2],
  10599. column: token[3]
  10600. };
  10601. this.current = this.current.parent;
  10602. } else {
  10603. this.unexpectedClose(token);
  10604. }
  10605. };
  10606. _proto.endFile = function endFile() {
  10607. if (this.current.parent) this.unclosedBlock();
  10608. if (this.current.nodes && this.current.nodes.length) {
  10609. this.current.raws.semicolon = this.semicolon;
  10610. }
  10611. this.current.raws.after = (this.current.raws.after || '') + this.spaces;
  10612. };
  10613. _proto.freeSemicolon = function freeSemicolon(token) {
  10614. this.spaces += token[1];
  10615. if (this.current.nodes) {
  10616. var prev = this.current.nodes[this.current.nodes.length - 1];
  10617. if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
  10618. prev.raws.ownSemicolon = this.spaces;
  10619. this.spaces = '';
  10620. }
  10621. }
  10622. }; // Helpers
  10623. _proto.init = function init(node, line, column) {
  10624. this.current.push(node);
  10625. node.source = {
  10626. start: {
  10627. line: line,
  10628. column: column
  10629. },
  10630. input: this.input
  10631. };
  10632. node.raws.before = this.spaces;
  10633. this.spaces = '';
  10634. if (node.type !== 'comment') this.semicolon = false;
  10635. };
  10636. _proto.raw = function raw(node, prop, tokens) {
  10637. var token, type;
  10638. var length = tokens.length;
  10639. var value = '';
  10640. var clean = true;
  10641. var next, prev;
  10642. var pattern = /^([.|#])?([\w])+/i;
  10643. for (var i = 0; i < length; i += 1) {
  10644. token = tokens[i];
  10645. type = token[0];
  10646. if (type === 'comment' && node.type === 'rule') {
  10647. prev = tokens[i - 1];
  10648. next = tokens[i + 1];
  10649. if (prev[0] !== 'space' && next[0] !== 'space' && pattern.test(prev[1]) && pattern.test(next[1])) {
  10650. value += token[1];
  10651. } else {
  10652. clean = false;
  10653. }
  10654. continue;
  10655. }
  10656. if (type === 'comment' || type === 'space' && i === length - 1) {
  10657. clean = false;
  10658. } else {
  10659. value += token[1];
  10660. }
  10661. }
  10662. if (!clean) {
  10663. var raw = tokens.reduce(function (all, i) {
  10664. return all + i[1];
  10665. }, '');
  10666. node.raws[prop] = {
  10667. value: value,
  10668. raw: raw
  10669. };
  10670. }
  10671. node[prop] = value;
  10672. };
  10673. _proto.spacesAndCommentsFromEnd = function spacesAndCommentsFromEnd(tokens) {
  10674. var lastTokenType;
  10675. var spaces = '';
  10676. while (tokens.length) {
  10677. lastTokenType = tokens[tokens.length - 1][0];
  10678. if (lastTokenType !== 'space' && lastTokenType !== 'comment') break;
  10679. spaces = tokens.pop()[1] + spaces;
  10680. }
  10681. return spaces;
  10682. };
  10683. _proto.spacesAndCommentsFromStart = function spacesAndCommentsFromStart(tokens) {
  10684. var next;
  10685. var spaces = '';
  10686. while (tokens.length) {
  10687. next = tokens[0][0];
  10688. if (next !== 'space' && next !== 'comment') break;
  10689. spaces += tokens.shift()[1];
  10690. }
  10691. return spaces;
  10692. };
  10693. _proto.spacesFromEnd = function spacesFromEnd(tokens) {
  10694. var lastTokenType;
  10695. var spaces = '';
  10696. while (tokens.length) {
  10697. lastTokenType = tokens[tokens.length - 1][0];
  10698. if (lastTokenType !== 'space') break;
  10699. spaces = tokens.pop()[1] + spaces;
  10700. }
  10701. return spaces;
  10702. };
  10703. _proto.stringFrom = function stringFrom(tokens, from) {
  10704. var result = '';
  10705. for (var i = from; i < tokens.length; i++) {
  10706. result += tokens[i][1];
  10707. }
  10708. tokens.splice(from, tokens.length - from);
  10709. return result;
  10710. };
  10711. _proto.colon = function colon(tokens) {
  10712. var brackets = 0;
  10713. var token, type, prev;
  10714. for (var i = 0; i < tokens.length; i++) {
  10715. token = tokens[i];
  10716. type = token[0];
  10717. if (type === '(') {
  10718. brackets += 1;
  10719. }
  10720. if (type === ')') {
  10721. brackets -= 1;
  10722. }
  10723. if (brackets === 0 && type === ':') {
  10724. if (!prev) {
  10725. this.doubleColon(token);
  10726. } else if (prev[0] === 'word' && prev[1] === 'progid') {
  10727. continue;
  10728. } else {
  10729. return i;
  10730. }
  10731. }
  10732. prev = token;
  10733. }
  10734. return false;
  10735. }; // Errors
  10736. _proto.unclosedBracket = function unclosedBracket(bracket) {
  10737. throw this.input.error('Unclosed bracket', bracket[2], bracket[3]);
  10738. };
  10739. _proto.unknownWord = function unknownWord(tokens) {
  10740. throw this.input.error('Unknown word', tokens[0][2], tokens[0][3]);
  10741. };
  10742. _proto.unexpectedClose = function unexpectedClose(token) {
  10743. throw this.input.error('Unexpected }', token[2], token[3]);
  10744. };
  10745. _proto.unclosedBlock = function unclosedBlock() {
  10746. var pos = this.current.source.start;
  10747. throw this.input.error('Unclosed block', pos.line, pos.column);
  10748. };
  10749. _proto.doubleColon = function doubleColon(token) {
  10750. throw this.input.error('Double colon', token[2], token[3]);
  10751. };
  10752. _proto.unnamedAtrule = function unnamedAtrule(node, token) {
  10753. throw this.input.error('At-rule without name', token[2], token[3]);
  10754. };
  10755. _proto.precheckMissedSemicolon = function precheckMissedSemicolon()
  10756. /* tokens */
  10757. {// Hook for Safe Parser
  10758. };
  10759. _proto.checkMissedSemicolon = function checkMissedSemicolon(tokens) {
  10760. var colon = this.colon(tokens);
  10761. if (colon === false) return;
  10762. var founded = 0;
  10763. var token;
  10764. for (var j = colon - 1; j >= 0; j--) {
  10765. token = tokens[j];
  10766. if (token[0] !== 'space') {
  10767. founded += 1;
  10768. if (founded === 2) break;
  10769. }
  10770. }
  10771. throw this.input.error('Missed semicolon', token[2], token[3]);
  10772. };
  10773. return Parser;
  10774. }();
  10775. exports.default = Parser;
  10776. module.exports = exports.default;
  10777. /***/ }),
  10778. /* 67 */
  10779. /***/ (function(module, exports, __webpack_require__) {
  10780. "use strict";
  10781. exports.__esModule = true;
  10782. exports.default = void 0;
  10783. var _node = _interopRequireDefault(__webpack_require__(20));
  10784. function _interopRequireDefault(obj) {
  10785. return obj && obj.__esModule ? obj : {
  10786. default: obj
  10787. };
  10788. }
  10789. function _inheritsLoose(subClass, superClass) {
  10790. subClass.prototype = Object.create(superClass.prototype);
  10791. subClass.prototype.constructor = subClass;
  10792. subClass.__proto__ = superClass;
  10793. }
  10794. /**
  10795. * Represents a CSS declaration.
  10796. *
  10797. * @extends Node
  10798. *
  10799. * @example
  10800. * const root = postcss.parse('a { color: black }')
  10801. * const decl = root.first.first
  10802. * decl.type //=> 'decl'
  10803. * decl.toString() //=> ' color: black'
  10804. */
  10805. var Declaration =
  10806. /*#__PURE__*/
  10807. function (_Node) {
  10808. _inheritsLoose(Declaration, _Node);
  10809. function Declaration(defaults) {
  10810. var _this;
  10811. _this = _Node.call(this, defaults) || this;
  10812. _this.type = 'decl';
  10813. return _this;
  10814. }
  10815. /**
  10816. * @memberof Declaration#
  10817. * @member {string} prop The declaration’s property name.
  10818. *
  10819. * @example
  10820. * const root = postcss.parse('a { color: black }')
  10821. * const decl = root.first.first
  10822. * decl.prop //=> 'color'
  10823. */
  10824. /**
  10825. * @memberof Declaration#
  10826. * @member {string} value The declaration’s value.
  10827. *
  10828. * @example
  10829. * const root = postcss.parse('a { color: black }')
  10830. * const decl = root.first.first
  10831. * decl.value //=> 'black'
  10832. */
  10833. /**
  10834. * @memberof Declaration#
  10835. * @member {boolean} important `true` if the declaration
  10836. * has an !important annotation.
  10837. *
  10838. * @example
  10839. * const root = postcss.parse('a { color: black !important; color: red }')
  10840. * root.first.first.important //=> true
  10841. * root.first.last.important //=> undefined
  10842. */
  10843. /**
  10844. * @memberof Declaration#
  10845. * @member {object} raws Information to generate byte-to-byte equal
  10846. * node string as it was in the origin input.
  10847. *
  10848. * Every parser saves its own properties,
  10849. * but the default CSS parser uses:
  10850. *
  10851. * * `before`: the space symbols before the node. It also stores `*`
  10852. * and `_` symbols before the declaration (IE hack).
  10853. * * `between`: the symbols between the property and value
  10854. * for declarations.
  10855. * * `important`: the content of the important statement,
  10856. * if it is not just `!important`.
  10857. *
  10858. * PostCSS cleans declaration from comments and extra spaces,
  10859. * but it stores origin content in raws properties.
  10860. * As such, if you don’t change a declaration’s value,
  10861. * PostCSS will use the raw value with comments.
  10862. *
  10863. * @example
  10864. * const root = postcss.parse('a {\n color:black\n}')
  10865. * root.first.first.raws //=> { before: '\n ', between: ':' }
  10866. */
  10867. return Declaration;
  10868. }(_node.default);
  10869. var _default = Declaration;
  10870. exports.default = _default;
  10871. module.exports = exports.default;
  10872. /***/ }),
  10873. /* 68 */
  10874. /***/ (function(module, exports, __webpack_require__) {
  10875. "use strict";
  10876. exports.__esModule = true;
  10877. exports.default = void 0;
  10878. var _container = _interopRequireDefault(__webpack_require__(13));
  10879. function _interopRequireDefault(obj) {
  10880. return obj && obj.__esModule ? obj : {
  10881. default: obj
  10882. };
  10883. }
  10884. function _inheritsLoose(subClass, superClass) {
  10885. subClass.prototype = Object.create(superClass.prototype);
  10886. subClass.prototype.constructor = subClass;
  10887. subClass.__proto__ = superClass;
  10888. }
  10889. /**
  10890. * Represents an at-rule.
  10891. *
  10892. * If it’s followed in the CSS by a {} block, this node will have
  10893. * a nodes property representing its children.
  10894. *
  10895. * @extends Container
  10896. *
  10897. * @example
  10898. * const root = postcss.parse('@charset "UTF-8"; @media print {}')
  10899. *
  10900. * const charset = root.first
  10901. * charset.type //=> 'atrule'
  10902. * charset.nodes //=> undefined
  10903. *
  10904. * const media = root.last
  10905. * media.nodes //=> []
  10906. */
  10907. var AtRule =
  10908. /*#__PURE__*/
  10909. function (_Container) {
  10910. _inheritsLoose(AtRule, _Container);
  10911. function AtRule(defaults) {
  10912. var _this;
  10913. _this = _Container.call(this, defaults) || this;
  10914. _this.type = 'atrule';
  10915. return _this;
  10916. }
  10917. var _proto = AtRule.prototype;
  10918. _proto.append = function append() {
  10919. var _Container$prototype$;
  10920. if (!this.nodes) this.nodes = [];
  10921. for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
  10922. children[_key] = arguments[_key];
  10923. }
  10924. return (_Container$prototype$ = _Container.prototype.append).call.apply(_Container$prototype$, [this].concat(children));
  10925. };
  10926. _proto.prepend = function prepend() {
  10927. var _Container$prototype$2;
  10928. if (!this.nodes) this.nodes = [];
  10929. for (var _len2 = arguments.length, children = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  10930. children[_key2] = arguments[_key2];
  10931. }
  10932. return (_Container$prototype$2 = _Container.prototype.prepend).call.apply(_Container$prototype$2, [this].concat(children));
  10933. };
  10934. /**
  10935. * @memberof AtRule#
  10936. * @member {string} name The at-rule’s name immediately follows the `@`.
  10937. *
  10938. * @example
  10939. * const root = postcss.parse('@media print {}')
  10940. * media.name //=> 'media'
  10941. * const media = root.first
  10942. */
  10943. /**
  10944. * @memberof AtRule#
  10945. * @member {string} params The at-rule’s parameters, the values
  10946. * that follow the at-rule’s name but precede
  10947. * any {} block.
  10948. *
  10949. * @example
  10950. * const root = postcss.parse('@media print, screen {}')
  10951. * const media = root.first
  10952. * media.params //=> 'print, screen'
  10953. */
  10954. /**
  10955. * @memberof AtRule#
  10956. * @member {object} raws Information to generate byte-to-byte equal
  10957. * node string as it was in the origin input.
  10958. *
  10959. * Every parser saves its own properties,
  10960. * but the default CSS parser uses:
  10961. *
  10962. * * `before`: the space symbols before the node. It also stores `*`
  10963. * and `_` symbols before the declaration (IE hack).
  10964. * * `after`: the space symbols after the last child of the node
  10965. * to the end of the node.
  10966. * * `between`: the symbols between the property and value
  10967. * for declarations, selector and `{` for rules, or last parameter
  10968. * and `{` for at-rules.
  10969. * * `semicolon`: contains true if the last child has
  10970. * an (optional) semicolon.
  10971. * * `afterName`: the space between the at-rule name and its parameters.
  10972. *
  10973. * PostCSS cleans at-rule parameters from comments and extra spaces,
  10974. * but it stores origin content in raws properties.
  10975. * As such, if you don’t change a declaration’s value,
  10976. * PostCSS will use the raw value with comments.
  10977. *
  10978. * @example
  10979. * const root = postcss.parse(' @media\nprint {\n}')
  10980. * root.first.first.raws //=> { before: ' ',
  10981. * // between: ' ',
  10982. * // afterName: '\n',
  10983. * // after: '\n' }
  10984. */
  10985. return AtRule;
  10986. }(_container.default);
  10987. var _default = AtRule;
  10988. exports.default = _default;
  10989. module.exports = exports.default;
  10990. /***/ }),
  10991. /* 69 */
  10992. /***/ (function(module, exports, __webpack_require__) {
  10993. "use strict";
  10994. exports.__esModule = true;
  10995. exports.default = void 0;
  10996. var _parser = _interopRequireDefault(__webpack_require__(66));
  10997. var _input = _interopRequireDefault(__webpack_require__(59));
  10998. function _interopRequireDefault(obj) {
  10999. return obj && obj.__esModule ? obj : {
  11000. default: obj
  11001. };
  11002. }
  11003. function parse(css, opts) {
  11004. var input = new _input.default(css, opts);
  11005. var parser = new _parser.default(input);
  11006. try {
  11007. parser.parse();
  11008. } catch (e) {
  11009. if (false) {
  11010. if (e.name === 'CssSyntaxError' && opts && opts.from) {
  11011. if (/\.scss$/i.test(opts.from)) {
  11012. e.message += '\nYou tried to parse SCSS with ' + 'the standard CSS parser; ' + 'try again with the postcss-scss parser';
  11013. } else if (/\.sass/i.test(opts.from)) {
  11014. e.message += '\nYou tried to parse Sass with ' + 'the standard CSS parser; ' + 'try again with the postcss-sass parser';
  11015. } else if (/\.less$/i.test(opts.from)) {
  11016. e.message += '\nYou tried to parse Less with ' + 'the standard CSS parser; ' + 'try again with the postcss-less parser';
  11017. }
  11018. }
  11019. }
  11020. throw e;
  11021. }
  11022. return parser.root;
  11023. }
  11024. var _default = parse;
  11025. exports.default = _default;
  11026. module.exports = exports.default;
  11027. /***/ }),
  11028. /* 70 */
  11029. /***/ (function(module, exports, __webpack_require__) {
  11030. "use strict";
  11031. exports.__esModule = true;
  11032. exports.default = void 0;
  11033. var _container = _interopRequireDefault(__webpack_require__(13));
  11034. var _list = _interopRequireDefault(__webpack_require__(133));
  11035. function _interopRequireDefault(obj) {
  11036. return obj && obj.__esModule ? obj : {
  11037. default: obj
  11038. };
  11039. }
  11040. function _defineProperties(target, props) {
  11041. for (var i = 0; i < props.length; i++) {
  11042. var descriptor = props[i];
  11043. descriptor.enumerable = descriptor.enumerable || false;
  11044. descriptor.configurable = true;
  11045. if ("value" in descriptor) descriptor.writable = true;
  11046. Object.defineProperty(target, descriptor.key, descriptor);
  11047. }
  11048. }
  11049. function _createClass(Constructor, protoProps, staticProps) {
  11050. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  11051. if (staticProps) _defineProperties(Constructor, staticProps);
  11052. return Constructor;
  11053. }
  11054. function _inheritsLoose(subClass, superClass) {
  11055. subClass.prototype = Object.create(superClass.prototype);
  11056. subClass.prototype.constructor = subClass;
  11057. subClass.__proto__ = superClass;
  11058. }
  11059. /**
  11060. * Represents a CSS rule: a selector followed by a declaration block.
  11061. *
  11062. * @extends Container
  11063. *
  11064. * @example
  11065. * const root = postcss.parse('a{}')
  11066. * const rule = root.first
  11067. * rule.type //=> 'rule'
  11068. * rule.toString() //=> 'a{}'
  11069. */
  11070. var Rule =
  11071. /*#__PURE__*/
  11072. function (_Container) {
  11073. _inheritsLoose(Rule, _Container);
  11074. function Rule(defaults) {
  11075. var _this;
  11076. _this = _Container.call(this, defaults) || this;
  11077. _this.type = 'rule';
  11078. if (!_this.nodes) _this.nodes = [];
  11079. return _this;
  11080. }
  11081. /**
  11082. * An array containing the rule’s individual selectors.
  11083. * Groups of selectors are split at commas.
  11084. *
  11085. * @type {string[]}
  11086. *
  11087. * @example
  11088. * const root = postcss.parse('a, b { }')
  11089. * const rule = root.first
  11090. *
  11091. * rule.selector //=> 'a, b'
  11092. * rule.selectors //=> ['a', 'b']
  11093. *
  11094. * rule.selectors = ['a', 'strong']
  11095. * rule.selector //=> 'a, strong'
  11096. */
  11097. _createClass(Rule, [{
  11098. key: "selectors",
  11099. get: function get() {
  11100. return _list.default.comma(this.selector);
  11101. },
  11102. set: function set(values) {
  11103. var match = this.selector ? this.selector.match(/,\s*/) : null;
  11104. var sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
  11105. this.selector = values.join(sep);
  11106. }
  11107. /**
  11108. * @memberof Rule#
  11109. * @member {string} selector The rule’s full selector represented
  11110. * as a string.
  11111. *
  11112. * @example
  11113. * const root = postcss.parse('a, b { }')
  11114. * const rule = root.first
  11115. * rule.selector //=> 'a, b'
  11116. */
  11117. /**
  11118. * @memberof Rule#
  11119. * @member {object} raws Information to generate byte-to-byte equal
  11120. * node string as it was in the origin input.
  11121. *
  11122. * Every parser saves its own properties,
  11123. * but the default CSS parser uses:
  11124. *
  11125. * * `before`: the space symbols before the node. It also stores `*`
  11126. * and `_` symbols before the declaration (IE hack).
  11127. * * `after`: the space symbols after the last child of the node
  11128. * to the end of the node.
  11129. * * `between`: the symbols between the property and value
  11130. * for declarations, selector and `{` for rules, or last parameter
  11131. * and `{` for at-rules.
  11132. * * `semicolon`: contains `true` if the last child has
  11133. * an (optional) semicolon.
  11134. * * `ownSemicolon`: contains `true` if there is semicolon after rule.
  11135. *
  11136. * PostCSS cleans selectors from comments and extra spaces,
  11137. * but it stores origin content in raws properties.
  11138. * As such, if you don’t change a declaration’s value,
  11139. * PostCSS will use the raw value with comments.
  11140. *
  11141. * @example
  11142. * const root = postcss.parse('a {\n color:black\n}')
  11143. * root.first.first.raws //=> { before: '', between: ' ', after: '\n' }
  11144. */
  11145. }]);
  11146. return Rule;
  11147. }(_container.default);
  11148. var _default = Rule;
  11149. exports.default = _default;
  11150. module.exports = exports.default;
  11151. /***/ }),
  11152. /* 71 */
  11153. /***/ (function(module, exports, __webpack_require__) {
  11154. "use strict";
  11155. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  11156. exports.__esModule = true;
  11157. exports.default = void 0;
  11158. var _mapGenerator = _interopRequireDefault(__webpack_require__(135));
  11159. var _stringify2 = _interopRequireDefault(__webpack_require__(65));
  11160. var _warnOnce = _interopRequireDefault(__webpack_require__(136));
  11161. var _result = _interopRequireDefault(__webpack_require__(137));
  11162. var _parse = _interopRequireDefault(__webpack_require__(69));
  11163. function _interopRequireDefault(obj) {
  11164. return obj && obj.__esModule ? obj : {
  11165. default: obj
  11166. };
  11167. }
  11168. function _defineProperties(target, props) {
  11169. for (var i = 0; i < props.length; i++) {
  11170. var descriptor = props[i];
  11171. descriptor.enumerable = descriptor.enumerable || false;
  11172. descriptor.configurable = true;
  11173. if ("value" in descriptor) descriptor.writable = true;
  11174. Object.defineProperty(target, descriptor.key, descriptor);
  11175. }
  11176. }
  11177. function _createClass(Constructor, protoProps, staticProps) {
  11178. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  11179. if (staticProps) _defineProperties(Constructor, staticProps);
  11180. return Constructor;
  11181. }
  11182. function isPromise(obj) {
  11183. return _typeof(obj) === 'object' && typeof obj.then === 'function';
  11184. }
  11185. /**
  11186. * A Promise proxy for the result of PostCSS transformations.
  11187. *
  11188. * A `LazyResult` instance is returned by {@link Processor#process}.
  11189. *
  11190. * @example
  11191. * const lazy = postcss([autoprefixer]).process(css)
  11192. */
  11193. var LazyResult =
  11194. /*#__PURE__*/
  11195. function () {
  11196. function LazyResult(processor, css, opts) {
  11197. this.stringified = false;
  11198. this.processed = false;
  11199. var root;
  11200. if (_typeof(css) === 'object' && css !== null && css.type === 'root') {
  11201. root = css;
  11202. } else if (css instanceof LazyResult || css instanceof _result.default) {
  11203. root = css.root;
  11204. if (css.map) {
  11205. if (typeof opts.map === 'undefined') opts.map = {};
  11206. if (!opts.map.inline) opts.map.inline = false;
  11207. opts.map.prev = css.map;
  11208. }
  11209. } else {
  11210. var parser = _parse.default;
  11211. if (opts.syntax) parser = opts.syntax.parse;
  11212. if (opts.parser) parser = opts.parser;
  11213. if (parser.parse) parser = parser.parse;
  11214. try {
  11215. root = parser(css, opts);
  11216. } catch (error) {
  11217. this.error = error;
  11218. }
  11219. }
  11220. this.result = new _result.default(processor, root, opts);
  11221. }
  11222. /**
  11223. * Returns a {@link Processor} instance, which will be used
  11224. * for CSS transformations.
  11225. *
  11226. * @type {Processor}
  11227. */
  11228. var _proto = LazyResult.prototype;
  11229. /**
  11230. * Processes input CSS through synchronous plugins
  11231. * and calls {@link Result#warnings()}.
  11232. *
  11233. * @return {Warning[]} Warnings from plugins.
  11234. */
  11235. _proto.warnings = function warnings() {
  11236. return this.sync().warnings();
  11237. };
  11238. /**
  11239. * Alias for the {@link LazyResult#css} property.
  11240. *
  11241. * @example
  11242. * lazy + '' === lazy.css
  11243. *
  11244. * @return {string} Output CSS.
  11245. */
  11246. _proto.toString = function toString() {
  11247. return this.css;
  11248. };
  11249. /**
  11250. * Processes input CSS through synchronous and asynchronous plugins
  11251. * and calls `onFulfilled` with a Result instance. If a plugin throws
  11252. * an error, the `onRejected` callback will be executed.
  11253. *
  11254. * It implements standard Promise API.
  11255. *
  11256. * @param {onFulfilled} onFulfilled Callback will be executed
  11257. * when all plugins will finish work.
  11258. * @param {onRejected} onRejected Callback will be executed on any error.
  11259. *
  11260. * @return {Promise} Promise API to make queue.
  11261. *
  11262. * @example
  11263. * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
  11264. * console.log(result.css)
  11265. * })
  11266. */
  11267. _proto.then = function then(onFulfilled, onRejected) {
  11268. if (false) {
  11269. if (!('from' in this.opts)) {
  11270. (0, _warnOnce.default)('Without `from` option PostCSS could generate wrong source map ' + 'and will not find Browserslist config. Set it to CSS file path ' + 'or to `undefined` to prevent this warning.');
  11271. }
  11272. }
  11273. return this.async().then(onFulfilled, onRejected);
  11274. };
  11275. /**
  11276. * Processes input CSS through synchronous and asynchronous plugins
  11277. * and calls onRejected for each error thrown in any plugin.
  11278. *
  11279. * It implements standard Promise API.
  11280. *
  11281. * @param {onRejected} onRejected Callback will be executed on any error.
  11282. *
  11283. * @return {Promise} Promise API to make queue.
  11284. *
  11285. * @example
  11286. * postcss([autoprefixer]).process(css).then(result => {
  11287. * console.log(result.css)
  11288. * }).catch(error => {
  11289. * console.error(error)
  11290. * })
  11291. */
  11292. _proto.catch = function _catch(onRejected) {
  11293. return this.async().catch(onRejected);
  11294. };
  11295. /**
  11296. * Processes input CSS through synchronous and asynchronous plugins
  11297. * and calls onFinally on any error or when all plugins will finish work.
  11298. *
  11299. * It implements standard Promise API.
  11300. *
  11301. * @param {onFinally} onFinally Callback will be executed on any error or
  11302. * when all plugins will finish work.
  11303. *
  11304. * @return {Promise} Promise API to make queue.
  11305. *
  11306. * @example
  11307. * postcss([autoprefixer]).process(css).finally(() => {
  11308. * console.log('processing ended')
  11309. * })
  11310. */
  11311. _proto.finally = function _finally(onFinally) {
  11312. return this.async().then(onFinally, onFinally);
  11313. };
  11314. _proto.handleError = function handleError(error, plugin) {
  11315. try {
  11316. this.error = error;
  11317. if (error.name === 'CssSyntaxError' && !error.plugin) {
  11318. error.plugin = plugin.postcssPlugin;
  11319. error.setMessage();
  11320. } else if (plugin.postcssVersion) {
  11321. if (false) {
  11322. var pluginName = plugin.postcssPlugin;
  11323. var pluginVer = plugin.postcssVersion;
  11324. var runtimeVer = this.result.processor.version;
  11325. var a = pluginVer.split('.');
  11326. var b = runtimeVer.split('.');
  11327. if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
  11328. console.error('Unknown error from PostCSS plugin. Your current PostCSS ' + 'version is ' + runtimeVer + ', but ' + pluginName + ' uses ' + pluginVer + '. Perhaps this is the source of the error below.');
  11329. }
  11330. }
  11331. }
  11332. } catch (err) {
  11333. if (console && console.error) console.error(err);
  11334. }
  11335. };
  11336. _proto.asyncTick = function asyncTick(resolve, reject) {
  11337. var _this = this;
  11338. if (this.plugin >= this.processor.plugins.length) {
  11339. this.processed = true;
  11340. return resolve();
  11341. }
  11342. try {
  11343. var plugin = this.processor.plugins[this.plugin];
  11344. var promise = this.run(plugin);
  11345. this.plugin += 1;
  11346. if (isPromise(promise)) {
  11347. promise.then(function () {
  11348. _this.asyncTick(resolve, reject);
  11349. }).catch(function (error) {
  11350. _this.handleError(error, plugin);
  11351. _this.processed = true;
  11352. reject(error);
  11353. });
  11354. } else {
  11355. this.asyncTick(resolve, reject);
  11356. }
  11357. } catch (error) {
  11358. this.processed = true;
  11359. reject(error);
  11360. }
  11361. };
  11362. _proto.async = function async() {
  11363. var _this2 = this;
  11364. if (this.processed) {
  11365. return new Promise(function (resolve, reject) {
  11366. if (_this2.error) {
  11367. reject(_this2.error);
  11368. } else {
  11369. resolve(_this2.stringify());
  11370. }
  11371. });
  11372. }
  11373. if (this.processing) {
  11374. return this.processing;
  11375. }
  11376. this.processing = new Promise(function (resolve, reject) {
  11377. if (_this2.error) return reject(_this2.error);
  11378. _this2.plugin = 0;
  11379. _this2.asyncTick(resolve, reject);
  11380. }).then(function () {
  11381. _this2.processed = true;
  11382. return _this2.stringify();
  11383. });
  11384. return this.processing;
  11385. };
  11386. _proto.sync = function sync() {
  11387. if (this.processed) return this.result;
  11388. this.processed = true;
  11389. if (this.processing) {
  11390. throw new Error('Use process(css).then(cb) to work with async plugins');
  11391. }
  11392. if (this.error) throw this.error;
  11393. for (var _iterator = this.result.processor.plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  11394. var _ref;
  11395. if (_isArray) {
  11396. if (_i >= _iterator.length) break;
  11397. _ref = _iterator[_i++];
  11398. } else {
  11399. _i = _iterator.next();
  11400. if (_i.done) break;
  11401. _ref = _i.value;
  11402. }
  11403. var plugin = _ref;
  11404. var promise = this.run(plugin);
  11405. if (isPromise(promise)) {
  11406. throw new Error('Use process(css).then(cb) to work with async plugins');
  11407. }
  11408. }
  11409. return this.result;
  11410. };
  11411. _proto.run = function run(plugin) {
  11412. this.result.lastPlugin = plugin;
  11413. try {
  11414. return plugin(this.result.root, this.result);
  11415. } catch (error) {
  11416. this.handleError(error, plugin);
  11417. throw error;
  11418. }
  11419. };
  11420. _proto.stringify = function stringify() {
  11421. if (this.stringified) return this.result;
  11422. this.stringified = true;
  11423. this.sync();
  11424. var opts = this.result.opts;
  11425. var str = _stringify2.default;
  11426. if (opts.syntax) str = opts.syntax.stringify;
  11427. if (opts.stringifier) str = opts.stringifier;
  11428. if (str.stringify) str = str.stringify;
  11429. var map = new _mapGenerator.default(str, this.result.root, this.result.opts);
  11430. var data = map.generate();
  11431. this.result.css = data[0];
  11432. this.result.map = data[1];
  11433. return this.result;
  11434. };
  11435. _createClass(LazyResult, [{
  11436. key: "processor",
  11437. get: function get() {
  11438. return this.result.processor;
  11439. }
  11440. /**
  11441. * Options from the {@link Processor#process} call.
  11442. *
  11443. * @type {processOptions}
  11444. */
  11445. }, {
  11446. key: "opts",
  11447. get: function get() {
  11448. return this.result.opts;
  11449. }
  11450. /**
  11451. * Processes input CSS through synchronous plugins, converts `Root`
  11452. * to a CSS string and returns {@link Result#css}.
  11453. *
  11454. * This property will only work with synchronous plugins.
  11455. * If the processor contains any asynchronous plugins
  11456. * it will throw an error. This is why this method is only
  11457. * for debug purpose, you should always use {@link LazyResult#then}.
  11458. *
  11459. * @type {string}
  11460. * @see Result#css
  11461. */
  11462. }, {
  11463. key: "css",
  11464. get: function get() {
  11465. return this.stringify().css;
  11466. }
  11467. /**
  11468. * An alias for the `css` property. Use it with syntaxes
  11469. * that generate non-CSS output.
  11470. *
  11471. * This property will only work with synchronous plugins.
  11472. * If the processor contains any asynchronous plugins
  11473. * it will throw an error. This is why this method is only
  11474. * for debug purpose, you should always use {@link LazyResult#then}.
  11475. *
  11476. * @type {string}
  11477. * @see Result#content
  11478. */
  11479. }, {
  11480. key: "content",
  11481. get: function get() {
  11482. return this.stringify().content;
  11483. }
  11484. /**
  11485. * Processes input CSS through synchronous plugins
  11486. * and returns {@link Result#map}.
  11487. *
  11488. * This property will only work with synchronous plugins.
  11489. * If the processor contains any asynchronous plugins
  11490. * it will throw an error. This is why this method is only
  11491. * for debug purpose, you should always use {@link LazyResult#then}.
  11492. *
  11493. * @type {SourceMapGenerator}
  11494. * @see Result#map
  11495. */
  11496. }, {
  11497. key: "map",
  11498. get: function get() {
  11499. return this.stringify().map;
  11500. }
  11501. /**
  11502. * Processes input CSS through synchronous plugins
  11503. * and returns {@link Result#root}.
  11504. *
  11505. * This property will only work with synchronous plugins. If the processor
  11506. * contains any asynchronous plugins it will throw an error.
  11507. *
  11508. * This is why this method is only for debug purpose,
  11509. * you should always use {@link LazyResult#then}.
  11510. *
  11511. * @type {Root}
  11512. * @see Result#root
  11513. */
  11514. }, {
  11515. key: "root",
  11516. get: function get() {
  11517. return this.sync().root;
  11518. }
  11519. /**
  11520. * Processes input CSS through synchronous plugins
  11521. * and returns {@link Result#messages}.
  11522. *
  11523. * This property will only work with synchronous plugins. If the processor
  11524. * contains any asynchronous plugins it will throw an error.
  11525. *
  11526. * This is why this method is only for debug purpose,
  11527. * you should always use {@link LazyResult#then}.
  11528. *
  11529. * @type {Message[]}
  11530. * @see Result#messages
  11531. */
  11532. }, {
  11533. key: "messages",
  11534. get: function get() {
  11535. return this.sync().messages;
  11536. }
  11537. }]);
  11538. return LazyResult;
  11539. }();
  11540. var _default = LazyResult;
  11541. /**
  11542. * @callback onFulfilled
  11543. * @param {Result} result
  11544. */
  11545. /**
  11546. * @callback onRejected
  11547. * @param {Error} error
  11548. */
  11549. exports.default = _default;
  11550. module.exports = exports.default;
  11551. /***/ }),
  11552. /* 72 */
  11553. /***/ (function(module, exports, __webpack_require__) {
  11554. "use strict";
  11555. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  11556. Object.defineProperty(exports, "__esModule", {
  11557. value: true
  11558. });
  11559. var _createClass = function () {
  11560. function defineProperties(target, props) {
  11561. for (var i = 0; i < props.length; i++) {
  11562. var descriptor = props[i];
  11563. descriptor.enumerable = descriptor.enumerable || false;
  11564. descriptor.configurable = true;
  11565. if ("value" in descriptor) descriptor.writable = true;
  11566. Object.defineProperty(target, descriptor.key, descriptor);
  11567. }
  11568. }
  11569. return function (Constructor, protoProps, staticProps) {
  11570. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  11571. if (staticProps) defineProperties(Constructor, staticProps);
  11572. return Constructor;
  11573. };
  11574. }();
  11575. var _get = function get(object, property, receiver) {
  11576. if (object === null) object = Function.prototype;
  11577. var desc = Object.getOwnPropertyDescriptor(object, property);
  11578. if (desc === undefined) {
  11579. var parent = Object.getPrototypeOf(object);
  11580. if (parent === null) {
  11581. return undefined;
  11582. } else {
  11583. return get(parent, property, receiver);
  11584. }
  11585. } else if ("value" in desc) {
  11586. return desc.value;
  11587. } else {
  11588. var getter = desc.get;
  11589. if (getter === undefined) {
  11590. return undefined;
  11591. }
  11592. return getter.call(receiver);
  11593. }
  11594. };
  11595. var _comment = __webpack_require__(21);
  11596. var _comment2 = _interopRequireDefault(_comment);
  11597. var _import2 = __webpack_require__(157);
  11598. var _import3 = _interopRequireDefault(_import2);
  11599. var _parser = __webpack_require__(85);
  11600. var _parser2 = _interopRequireDefault(_parser);
  11601. var _rule = __webpack_require__(164);
  11602. var _rule2 = _interopRequireDefault(_rule);
  11603. var _root = __webpack_require__(165);
  11604. var _root2 = _interopRequireDefault(_root);
  11605. var _findExtendRule = __webpack_require__(166);
  11606. var _findExtendRule2 = _interopRequireDefault(_findExtendRule);
  11607. var _isMixinToken = __webpack_require__(167);
  11608. var _isMixinToken2 = _interopRequireDefault(_isMixinToken);
  11609. var _lessTokenize = __webpack_require__(168);
  11610. var _lessTokenize2 = _interopRequireDefault(_lessTokenize);
  11611. function _interopRequireDefault(obj) {
  11612. return obj && obj.__esModule ? obj : {
  11613. default: obj
  11614. };
  11615. }
  11616. function _classCallCheck(instance, Constructor) {
  11617. if (!(instance instanceof Constructor)) {
  11618. throw new TypeError("Cannot call a class as a function");
  11619. }
  11620. }
  11621. function _possibleConstructorReturn(self, call) {
  11622. if (!self) {
  11623. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  11624. }
  11625. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  11626. }
  11627. function _inherits(subClass, superClass) {
  11628. if (typeof superClass !== "function" && superClass !== null) {
  11629. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  11630. }
  11631. subClass.prototype = Object.create(superClass && superClass.prototype, {
  11632. constructor: {
  11633. value: subClass,
  11634. enumerable: false,
  11635. writable: true,
  11636. configurable: true
  11637. }
  11638. });
  11639. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  11640. }
  11641. var blockCommentEndPattern = /\*\/$/;
  11642. var LessParser = function (_Parser) {
  11643. _inherits(LessParser, _Parser);
  11644. function LessParser(input) {
  11645. _classCallCheck(this, LessParser);
  11646. var _this = _possibleConstructorReturn(this, (LessParser.__proto__ || Object.getPrototypeOf(LessParser)).call(this, input));
  11647. _this.root = new _root2.default();
  11648. _this.current = _this.root;
  11649. _this.root.source = {
  11650. input: input,
  11651. start: {
  11652. line: 1,
  11653. column: 1
  11654. }
  11655. };
  11656. return _this;
  11657. }
  11658. _createClass(LessParser, [{
  11659. key: 'atrule',
  11660. value: function atrule(token) {
  11661. if (token[1] === '@import') {
  11662. this.import(token);
  11663. } else {
  11664. _get(LessParser.prototype.__proto__ || Object.getPrototypeOf(LessParser.prototype), 'atrule', this).call(this, token);
  11665. }
  11666. }
  11667. }, {
  11668. key: 'comment',
  11669. value: function comment(token) {
  11670. var node = new _comment2.default();
  11671. var content = token[1];
  11672. var text = content.slice(2).replace(blockCommentEndPattern, '');
  11673. this.init(node, token[2], token[3]);
  11674. node.source.end = {
  11675. line: token[4],
  11676. column: token[5]
  11677. };
  11678. node.raws.content = content;
  11679. node.raws.begin = content[0] + content[1];
  11680. node.inline = token[6] === 'inline';
  11681. node.block = !node.inline;
  11682. if (/^\s*$/.test(text)) {
  11683. node.text = '';
  11684. node.raws.left = text;
  11685. node.raws.right = '';
  11686. } else {
  11687. var match = text.match(/^(\s*)([^]*[^\s])(\s*)$/);
  11688. node.text = match[2]; // Add extra spaces to generate a comment in a common style /*[space][text][space]*/
  11689. node.raws.left = match[1] || ' ';
  11690. node.raws.right = match[3] || ' ';
  11691. }
  11692. }
  11693. /**
  11694. * @description Create a Declaration
  11695. * @param options {{start: number}}
  11696. */
  11697. }, {
  11698. key: 'createDeclaration',
  11699. value: function createDeclaration(options) {
  11700. this.decl(this.tokens.slice(options.start, this.pos + 1));
  11701. }
  11702. /**
  11703. * @description Create a Rule node
  11704. * @param options {{start: number, params: Array}}
  11705. */
  11706. }, {
  11707. key: 'createRule',
  11708. value: function createRule(options) {
  11709. var semi = this.tokens[this.pos][0] === ';';
  11710. var end = this.pos + (options.empty && semi ? 2 : 1);
  11711. var tokens = this.tokens.slice(options.start, end);
  11712. var node = this.rule(tokens);
  11713. /**
  11714. * By default in PostCSS `Rule.params` is `undefined`.
  11715. * To preserve compability with PostCSS:
  11716. * - Don't set empty params for a Rule.
  11717. * - Set params for a Rule only if it can be a mixin or &:extend rule.
  11718. */
  11719. if (options.params[0] && (options.mixin || options.extend)) {
  11720. this.raw(node, 'params', options.params);
  11721. }
  11722. if (options.empty) {
  11723. // if it's an empty mixin or extend, it must have a semicolon
  11724. // (that's the only way we get to this point)
  11725. if (semi) {
  11726. node.raws.semicolon = this.semicolon = true;
  11727. node.selector = node.selector.replace(/;$/, '');
  11728. }
  11729. if (options.extend) {
  11730. node.extend = true;
  11731. }
  11732. if (options.mixin) {
  11733. node.mixin = true;
  11734. }
  11735. /**
  11736. * @description Mark mixin without declarations.
  11737. * @type {boolean}
  11738. */
  11739. node.empty = true; // eslint-disable-next-line
  11740. delete this.current.nodes;
  11741. if (/!\s*important/i.test(node.selector)) {
  11742. node.important = true;
  11743. if (/\s*!\s*important/i.test(node.selector)) {
  11744. node.raws.important = node.selector.match(/(\s*!\s*important)/i)[1];
  11745. }
  11746. node.selector = node.selector.replace(/\s*!\s*important/i, '');
  11747. } // rules don't have trailing semicolons in vanilla css, so they get
  11748. // added to this.spaces by the parser loop, so don't step back.
  11749. if (!semi) {
  11750. this.pos--;
  11751. }
  11752. this.end(this.tokens[this.pos]);
  11753. }
  11754. }
  11755. }, {
  11756. key: 'end',
  11757. value: function end(token) {
  11758. var node = this.current; // if a Rule contains other Rules (mixins, extends) and those have
  11759. // semicolons, assert that the parent Rule has a semicolon
  11760. if (node.nodes && node.nodes.length && node.last.raws.semicolon && !node.last.nodes) {
  11761. this.semicolon = true;
  11762. }
  11763. _get(LessParser.prototype.__proto__ || Object.getPrototypeOf(LessParser.prototype), 'end', this).call(this, token);
  11764. }
  11765. }, {
  11766. key: 'import',
  11767. value: function _import(token) {
  11768. /* eslint complexity: 0 */
  11769. var last = false,
  11770. open = false,
  11771. end = {
  11772. line: 0,
  11773. column: 0
  11774. };
  11775. var directives = [];
  11776. var node = new _import3.default();
  11777. node.name = token[1].slice(1);
  11778. this.init(node, token[2], token[3]);
  11779. this.pos += 1;
  11780. while (this.pos < this.tokens.length) {
  11781. var tokn = this.tokens[this.pos];
  11782. if (tokn[0] === ';') {
  11783. end = {
  11784. line: tokn[2],
  11785. column: tokn[3]
  11786. };
  11787. node.raws.semicolon = true;
  11788. break;
  11789. } else if (tokn[0] === '{') {
  11790. open = true;
  11791. break;
  11792. } else if (tokn[0] === '}') {
  11793. this.end(tokn);
  11794. break;
  11795. } else if (tokn[0] === 'brackets') {
  11796. if (node.urlFunc) {
  11797. node.importPath = tokn[1].replace(/[()]/g, '');
  11798. } else {
  11799. directives.push(tokn);
  11800. }
  11801. } else if (tokn[0] === 'space') {
  11802. if (directives.length) {
  11803. node.raws.between = tokn[1];
  11804. } else if (node.urlFunc) {
  11805. node.raws.beforeUrl = tokn[1];
  11806. } else if (node.importPath) {
  11807. if (node.urlFunc) {
  11808. node.raws.afterUrl = tokn[1];
  11809. } else {
  11810. node.raws.after = tokn[1];
  11811. }
  11812. } else {
  11813. node.raws.afterName = tokn[1];
  11814. }
  11815. } else if (tokn[0] === 'word' && tokn[1] === 'url') {
  11816. node.urlFunc = true;
  11817. } else {
  11818. if (tokn[0] !== '(' && tokn[0] !== ')') {
  11819. node.importPath = tokn[1];
  11820. }
  11821. }
  11822. if (this.pos === this.tokens.length) {
  11823. last = true;
  11824. break;
  11825. }
  11826. this.pos += 1;
  11827. }
  11828. if (node.raws.between && !node.raws.afterName) {
  11829. node.raws.afterName = node.raws.between;
  11830. node.raws.between = '';
  11831. }
  11832. node.source.end = end;
  11833. if (directives.length) {
  11834. this.raw(node, 'directives', directives);
  11835. if (last) {
  11836. token = directives[directives.length - 1];
  11837. node.source.end = {
  11838. line: token[4],
  11839. column: token[5]
  11840. };
  11841. this.spaces = node.raws.between;
  11842. node.raws.between = '';
  11843. }
  11844. } else {
  11845. node.directives = '';
  11846. }
  11847. if (open) {
  11848. node.nodes = [];
  11849. this.current = node;
  11850. }
  11851. }
  11852. /* eslint-disable max-statements, complexity */
  11853. }, {
  11854. key: 'other',
  11855. value: function other() {
  11856. var brackets = [];
  11857. var params = [];
  11858. var start = this.pos;
  11859. var end = false,
  11860. colon = false,
  11861. bracket = null; // we need pass "()" as spaces
  11862. // However we can override method Parser.loop, but it seems less maintainable
  11863. if (this.tokens[start][0] === 'brackets') {
  11864. this.spaces += this.tokens[start][1];
  11865. return;
  11866. }
  11867. var mixin = (0, _isMixinToken2.default)(this.tokens[start]);
  11868. var extend = Boolean((0, _findExtendRule2.default)(this.tokens, start));
  11869. while (this.pos < this.tokens.length) {
  11870. var token = this.tokens[this.pos];
  11871. var type = token[0];
  11872. if (type === '(' || type === '[') {
  11873. if (!bracket) {
  11874. bracket = token;
  11875. }
  11876. brackets.push(type === '(' ? ')' : ']');
  11877. } else if (brackets.length === 0) {
  11878. if (type === ';') {
  11879. var foundEndOfRule = this.ruleEnd({
  11880. start: start,
  11881. params: params,
  11882. colon: colon,
  11883. mixin: mixin,
  11884. extend: extend
  11885. });
  11886. if (foundEndOfRule) {
  11887. return;
  11888. }
  11889. break;
  11890. } else if (type === '{') {
  11891. this.createRule({
  11892. start: start,
  11893. params: params,
  11894. mixin: mixin
  11895. });
  11896. return;
  11897. } else if (type === '}') {
  11898. this.pos -= 1;
  11899. end = true;
  11900. break;
  11901. } else if (type === ':') {
  11902. colon = true;
  11903. }
  11904. } else if (type === brackets[brackets.length - 1]) {
  11905. brackets.pop();
  11906. if (brackets.length === 0) {
  11907. bracket = null;
  11908. }
  11909. } // we don't want to add params for pseudo-selectors that utilize parens (#56)
  11910. // if ((extend || !colon) && (brackets.length > 0 || type === 'brackets' || params[0])) {
  11911. // params.push(token);
  11912. // }
  11913. // we don't want to add params for pseudo-selectors that utilize parens (#56) or bracket selectors (#96)
  11914. if ((extend || !colon) && (brackets.length > 0 || type === 'brackets' || params[0]) && brackets[0] !== ']') {
  11915. params.push(token);
  11916. }
  11917. this.pos += 1;
  11918. }
  11919. if (this.pos === this.tokens.length) {
  11920. this.pos -= 1;
  11921. end = true;
  11922. }
  11923. if (brackets.length > 0) {
  11924. this.unclosedBracket(bracket);
  11925. } // dont process an end of rule if there's only one token and it's unknown (#64)
  11926. if (end && this.tokens.length > 1) {
  11927. // Handle the case where the there is only a single token in the end rule.
  11928. if (start === this.pos) {
  11929. this.pos += 1;
  11930. }
  11931. var _foundEndOfRule = this.ruleEnd({
  11932. start: start,
  11933. params: params,
  11934. colon: colon,
  11935. mixin: mixin,
  11936. extend: extend,
  11937. isEndOfBlock: true
  11938. });
  11939. if (_foundEndOfRule) {
  11940. return;
  11941. }
  11942. }
  11943. this.unknownWord(start);
  11944. }
  11945. }, {
  11946. key: 'rule',
  11947. value: function rule(tokens) {
  11948. tokens.pop();
  11949. var node = new _rule2.default();
  11950. this.init(node, tokens[0][2], tokens[0][3]); //node.raws.between = this.spacesFromEnd(tokens);
  11951. node.raws.between = this.spacesAndCommentsFromEnd(tokens);
  11952. this.raw(node, 'selector', tokens);
  11953. this.current = node;
  11954. return node;
  11955. }
  11956. }, {
  11957. key: 'ruleEnd',
  11958. value: function ruleEnd(options) {
  11959. var start = options.start;
  11960. if (options.extend || options.mixin) {
  11961. this.createRule(Object.assign(options, {
  11962. empty: true
  11963. }));
  11964. return true;
  11965. }
  11966. if (options.colon) {
  11967. if (options.isEndOfBlock) {
  11968. while (this.pos > start) {
  11969. var token = this.tokens[this.pos][0];
  11970. if (token !== 'space' && token !== 'comment') {
  11971. break;
  11972. }
  11973. this.pos -= 1;
  11974. }
  11975. }
  11976. this.createDeclaration({
  11977. start: start
  11978. });
  11979. return true;
  11980. }
  11981. return false;
  11982. }
  11983. }, {
  11984. key: 'tokenize',
  11985. value: function tokenize() {
  11986. this.tokens = (0, _lessTokenize2.default)(this.input);
  11987. }
  11988. /* eslint-enable max-statements, complexity */
  11989. }]);
  11990. return LessParser;
  11991. }(_parser2.default);
  11992. exports.default = LessParser;
  11993. module.exports = exports['default'];
  11994. /***/ }),
  11995. /* 73 */
  11996. /***/ (function(module, exports, __webpack_require__) {
  11997. "use strict";
  11998. exports.__esModule = true;
  11999. var _createClass = function () {
  12000. function defineProperties(target, props) {
  12001. for (var i = 0; i < props.length; i++) {
  12002. var descriptor = props[i];
  12003. descriptor.enumerable = descriptor.enumerable || false;
  12004. descriptor.configurable = true;
  12005. if ("value" in descriptor) descriptor.writable = true;
  12006. Object.defineProperty(target, descriptor.key, descriptor);
  12007. }
  12008. }
  12009. return function (Constructor, protoProps, staticProps) {
  12010. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  12011. if (staticProps) defineProperties(Constructor, staticProps);
  12012. return Constructor;
  12013. };
  12014. }();
  12015. var _supportsColor = __webpack_require__(142);
  12016. var _supportsColor2 = _interopRequireDefault(_supportsColor);
  12017. var _chalk = __webpack_require__(74);
  12018. var _chalk2 = _interopRequireDefault(_chalk);
  12019. var _terminalHighlight = __webpack_require__(148);
  12020. var _terminalHighlight2 = _interopRequireDefault(_terminalHighlight);
  12021. var _warnOnce = __webpack_require__(4);
  12022. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  12023. function _interopRequireDefault(obj) {
  12024. return obj && obj.__esModule ? obj : {
  12025. default: obj
  12026. };
  12027. }
  12028. function _classCallCheck(instance, Constructor) {
  12029. if (!(instance instanceof Constructor)) {
  12030. throw new TypeError("Cannot call a class as a function");
  12031. }
  12032. }
  12033. /**
  12034. * The CSS parser throws this error for broken CSS.
  12035. *
  12036. * Custom parsers can throw this error for broken custom syntax using
  12037. * the {@link Node#error} method.
  12038. *
  12039. * PostCSS will use the input source map to detect the original error location.
  12040. * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
  12041. * PostCSS will show the original position in the Sass file.
  12042. *
  12043. * If you need the position in the PostCSS input
  12044. * (e.g., to debug the previous compiler), use `error.input.file`.
  12045. *
  12046. * @example
  12047. * // Catching and checking syntax error
  12048. * try {
  12049. * postcss.parse('a{')
  12050. * } catch (error) {
  12051. * if ( error.name === 'CssSyntaxError' ) {
  12052. * error //=> CssSyntaxError
  12053. * }
  12054. * }
  12055. *
  12056. * @example
  12057. * // Raising error from plugin
  12058. * throw node.error('Unknown variable', { plugin: 'postcss-vars' });
  12059. */
  12060. var CssSyntaxError = function () {
  12061. /**
  12062. * @param {string} message - error message
  12063. * @param {number} [line] - source line of the error
  12064. * @param {number} [column] - source column of the error
  12065. * @param {string} [source] - source code of the broken file
  12066. * @param {string} [file] - absolute path to the broken file
  12067. * @param {string} [plugin] - PostCSS plugin name, if error came from plugin
  12068. */
  12069. function CssSyntaxError(message, line, column, source, file, plugin) {
  12070. _classCallCheck(this, CssSyntaxError);
  12071. /**
  12072. * @member {string} - Always equal to `'CssSyntaxError'`. You should
  12073. * always check error type
  12074. * by `error.name === 'CssSyntaxError'` instead of
  12075. * `error instanceof CssSyntaxError`, because
  12076. * npm could have several PostCSS versions.
  12077. *
  12078. * @example
  12079. * if ( error.name === 'CssSyntaxError' ) {
  12080. * error //=> CssSyntaxError
  12081. * }
  12082. */
  12083. this.name = 'CssSyntaxError';
  12084. /**
  12085. * @member {string} - Error message.
  12086. *
  12087. * @example
  12088. * error.message //=> 'Unclosed block'
  12089. */
  12090. this.reason = message;
  12091. if (file) {
  12092. /**
  12093. * @member {string} - Absolute path to the broken file.
  12094. *
  12095. * @example
  12096. * error.file //=> 'a.sass'
  12097. * error.input.file //=> 'a.css'
  12098. */
  12099. this.file = file;
  12100. }
  12101. if (source) {
  12102. /**
  12103. * @member {string} - Source code of the broken file.
  12104. *
  12105. * @example
  12106. * error.source //=> 'a { b {} }'
  12107. * error.input.column //=> 'a b { }'
  12108. */
  12109. this.source = source;
  12110. }
  12111. if (plugin) {
  12112. /**
  12113. * @member {string} - Plugin name, if error came from plugin.
  12114. *
  12115. * @example
  12116. * error.plugin //=> 'postcss-vars'
  12117. */
  12118. this.plugin = plugin;
  12119. }
  12120. if (typeof line !== 'undefined' && typeof column !== 'undefined') {
  12121. /**
  12122. * @member {number} - Source line of the error.
  12123. *
  12124. * @example
  12125. * error.line //=> 2
  12126. * error.input.line //=> 4
  12127. */
  12128. this.line = line;
  12129. /**
  12130. * @member {number} - Source column of the error.
  12131. *
  12132. * @example
  12133. * error.column //=> 1
  12134. * error.input.column //=> 4
  12135. */
  12136. this.column = column;
  12137. }
  12138. this.setMessage();
  12139. if (Error.captureStackTrace) {
  12140. Error.captureStackTrace(this, CssSyntaxError);
  12141. }
  12142. }
  12143. CssSyntaxError.prototype.setMessage = function setMessage() {
  12144. /**
  12145. * @member {string} - Full error text in the GNU error format
  12146. * with plugin, file, line and column.
  12147. *
  12148. * @example
  12149. * error.message //=> 'a.css:1:1: Unclosed block'
  12150. */
  12151. this.message = this.plugin ? this.plugin + ': ' : '';
  12152. this.message += this.file ? this.file : '<css input>';
  12153. if (typeof this.line !== 'undefined') {
  12154. this.message += ':' + this.line + ':' + this.column;
  12155. }
  12156. this.message += ': ' + this.reason;
  12157. };
  12158. /**
  12159. * Returns a few lines of CSS source that caused the error.
  12160. *
  12161. * If the CSS has an input source map without `sourceContent`,
  12162. * this method will return an empty string.
  12163. *
  12164. * @param {boolean} [color] whether arrow will be colored red by terminal
  12165. * color codes. By default, PostCSS will detect
  12166. * color support by `process.stdout.isTTY`
  12167. * and `process.env.NODE_DISABLE_COLORS`.
  12168. *
  12169. * @example
  12170. * error.showSourceCode() //=> " 4 | }
  12171. * // 5 | a {
  12172. * // > 6 | bad
  12173. * // | ^
  12174. * // 7 | }
  12175. * // 8 | b {"
  12176. *
  12177. * @return {string} few lines of CSS source that caused the error
  12178. */
  12179. CssSyntaxError.prototype.showSourceCode = function showSourceCode(color) {
  12180. var _this = this;
  12181. if (!this.source) return '';
  12182. var css = this.source;
  12183. if (typeof color === 'undefined') color = _supportsColor2.default;
  12184. if (color) css = (0, _terminalHighlight2.default)(css);
  12185. var lines = css.split(/\r?\n/);
  12186. var start = Math.max(this.line - 3, 0);
  12187. var end = Math.min(this.line + 2, lines.length);
  12188. var maxWidth = String(end).length;
  12189. var colors = new _chalk2.default.constructor({
  12190. enabled: true
  12191. });
  12192. function mark(text) {
  12193. if (color) {
  12194. return colors.red.bold(text);
  12195. } else {
  12196. return text;
  12197. }
  12198. }
  12199. function aside(text) {
  12200. if (color) {
  12201. return colors.gray(text);
  12202. } else {
  12203. return text;
  12204. }
  12205. }
  12206. return lines.slice(start, end).map(function (line, index) {
  12207. var number = start + 1 + index;
  12208. var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
  12209. if (number === _this.line) {
  12210. var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this.column - 1).replace(/[^\t]/g, ' ');
  12211. return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^');
  12212. } else {
  12213. return ' ' + aside(gutter) + line;
  12214. }
  12215. }).join('\n');
  12216. };
  12217. /**
  12218. * Returns error position, message and source code of the broken part.
  12219. *
  12220. * @example
  12221. * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
  12222. * // > 1 | a {
  12223. * // | ^"
  12224. *
  12225. * @return {string} error position, message and source code
  12226. */
  12227. CssSyntaxError.prototype.toString = function toString() {
  12228. var code = this.showSourceCode();
  12229. if (code) {
  12230. code = '\n\n' + code + '\n';
  12231. }
  12232. return this.name + ': ' + this.message + code;
  12233. };
  12234. _createClass(CssSyntaxError, [{
  12235. key: 'generated',
  12236. get: function get() {
  12237. (0, _warnOnce2.default)('CssSyntaxError#generated is deprecated. Use input instead.');
  12238. return this.input;
  12239. }
  12240. /**
  12241. * @memberof CssSyntaxError#
  12242. * @member {Input} input - Input object with PostCSS internal information
  12243. * about input file. If input has source map
  12244. * from previous tool, PostCSS will use origin
  12245. * (for example, Sass) source. You can use this
  12246. * object to get PostCSS input source.
  12247. *
  12248. * @example
  12249. * error.input.file //=> 'a.css'
  12250. * error.file //=> 'a.sass'
  12251. */
  12252. }]);
  12253. return CssSyntaxError;
  12254. }();
  12255. exports.default = CssSyntaxError;
  12256. module.exports = exports['default'];
  12257. /***/ }),
  12258. /* 74 */
  12259. /***/ (function(module, exports, __webpack_require__) {
  12260. "use strict";
  12261. /* WEBPACK VAR INJECTION */(function(process) {
  12262. var escapeStringRegexp = __webpack_require__(29);
  12263. var ansiStyles = __webpack_require__(143);
  12264. var stripAnsi = __webpack_require__(145);
  12265. var hasAnsi = __webpack_require__(146);
  12266. var supportsColor = __webpack_require__(147);
  12267. var defineProps = Object.defineProperties;
  12268. var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
  12269. function Chalk(options) {
  12270. // detect mode if not set manually
  12271. this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
  12272. } // use bright blue on Windows as the normal blue color is illegible
  12273. if (isSimpleWindowsTerm) {
  12274. ansiStyles.blue.open = "\x1B[94m";
  12275. }
  12276. var styles = function () {
  12277. var ret = {};
  12278. Object.keys(ansiStyles).forEach(function (key) {
  12279. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
  12280. ret[key] = {
  12281. get: function get() {
  12282. return build.call(this, this._styles.concat(key));
  12283. }
  12284. };
  12285. });
  12286. return ret;
  12287. }();
  12288. var proto = defineProps(function chalk() {}, styles);
  12289. function build(_styles) {
  12290. var builder = function builder() {
  12291. return applyStyle.apply(builder, arguments);
  12292. };
  12293. builder._styles = _styles;
  12294. builder.enabled = this.enabled; // __proto__ is used because we must return a function, but there is
  12295. // no way to create a function with a different prototype.
  12296. /* eslint-disable no-proto */
  12297. builder.__proto__ = proto;
  12298. return builder;
  12299. }
  12300. function applyStyle() {
  12301. // support varags, but simply cast to string in case there's only one arg
  12302. var args = arguments;
  12303. var argsLen = args.length;
  12304. var str = argsLen !== 0 && String(arguments[0]);
  12305. if (argsLen > 1) {
  12306. // don't slice `arguments`, it prevents v8 optimizations
  12307. for (var a = 1; a < argsLen; a++) {
  12308. str += ' ' + args[a];
  12309. }
  12310. }
  12311. if (!this.enabled || !str) {
  12312. return str;
  12313. }
  12314. var nestedStyles = this._styles;
  12315. var i = nestedStyles.length; // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
  12316. // see https://github.com/chalk/chalk/issues/58
  12317. // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
  12318. var originalDim = ansiStyles.dim.open;
  12319. if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
  12320. ansiStyles.dim.open = '';
  12321. }
  12322. while (i--) {
  12323. var code = ansiStyles[nestedStyles[i]]; // Replace any instances already present with a re-opening code
  12324. // otherwise only the part of the string until said closing code
  12325. // will be colored, and the rest will simply be 'plain'.
  12326. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  12327. } // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
  12328. ansiStyles.dim.open = originalDim;
  12329. return str;
  12330. }
  12331. function init() {
  12332. var ret = {};
  12333. Object.keys(styles).forEach(function (name) {
  12334. ret[name] = {
  12335. get: function get() {
  12336. return build.call(this, [name]);
  12337. }
  12338. };
  12339. });
  12340. return ret;
  12341. }
  12342. defineProps(Chalk.prototype, init());
  12343. module.exports = new Chalk();
  12344. module.exports.styles = ansiStyles;
  12345. module.exports.hasColor = hasAnsi;
  12346. module.exports.stripColor = stripAnsi;
  12347. module.exports.supportsColor = supportsColor;
  12348. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12)))
  12349. /***/ }),
  12350. /* 75 */
  12351. /***/ (function(module, exports, __webpack_require__) {
  12352. "use strict";
  12353. module.exports = function () {
  12354. return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
  12355. };
  12356. /***/ }),
  12357. /* 76 */
  12358. /***/ (function(module, exports, __webpack_require__) {
  12359. "use strict";
  12360. exports.__esModule = true;
  12361. exports.default = tokenize;
  12362. var SINGLE_QUOTE = 39;
  12363. var DOUBLE_QUOTE = 34;
  12364. var BACKSLASH = 92;
  12365. var SLASH = 47;
  12366. var NEWLINE = 10;
  12367. var SPACE = 32;
  12368. var FEED = 12;
  12369. var TAB = 9;
  12370. var CR = 13;
  12371. var OPEN_SQUARE = 91;
  12372. var CLOSE_SQUARE = 93;
  12373. var OPEN_PARENTHESES = 40;
  12374. var CLOSE_PARENTHESES = 41;
  12375. var OPEN_CURLY = 123;
  12376. var CLOSE_CURLY = 125;
  12377. var SEMICOLON = 59;
  12378. var ASTERISK = 42;
  12379. var COLON = 58;
  12380. var AT = 64;
  12381. var RE_AT_END = /[ \n\t\r\f\{\(\)'"\\;/\[\]#]/g;
  12382. var RE_WORD_END = /[ \n\t\r\f\(\)\{\}:;@!'"\\\]\[#]|\/(?=\*)/g;
  12383. var RE_BAD_BRACKET = /.[\\\/\("'\n]/;
  12384. function tokenize(input) {
  12385. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  12386. var tokens = [];
  12387. var css = input.css.valueOf();
  12388. var ignore = options.ignoreErrors;
  12389. var code = void 0,
  12390. next = void 0,
  12391. quote = void 0,
  12392. lines = void 0,
  12393. last = void 0,
  12394. content = void 0,
  12395. escape = void 0,
  12396. nextLine = void 0,
  12397. nextOffset = void 0,
  12398. escaped = void 0,
  12399. escapePos = void 0,
  12400. prev = void 0,
  12401. n = void 0;
  12402. var length = css.length;
  12403. var offset = -1;
  12404. var line = 1;
  12405. var pos = 0;
  12406. function unclosed(what) {
  12407. throw input.error('Unclosed ' + what, line, pos - offset);
  12408. }
  12409. while (pos < length) {
  12410. code = css.charCodeAt(pos);
  12411. if (code === NEWLINE || code === FEED || code === CR && css.charCodeAt(pos + 1) !== NEWLINE) {
  12412. offset = pos;
  12413. line += 1;
  12414. }
  12415. switch (code) {
  12416. case NEWLINE:
  12417. case SPACE:
  12418. case TAB:
  12419. case CR:
  12420. case FEED:
  12421. next = pos;
  12422. do {
  12423. next += 1;
  12424. code = css.charCodeAt(next);
  12425. if (code === NEWLINE) {
  12426. offset = next;
  12427. line += 1;
  12428. }
  12429. } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
  12430. tokens.push(['space', css.slice(pos, next)]);
  12431. pos = next - 1;
  12432. break;
  12433. case OPEN_SQUARE:
  12434. tokens.push(['[', '[', line, pos - offset]);
  12435. break;
  12436. case CLOSE_SQUARE:
  12437. tokens.push([']', ']', line, pos - offset]);
  12438. break;
  12439. case OPEN_CURLY:
  12440. tokens.push(['{', '{', line, pos - offset]);
  12441. break;
  12442. case CLOSE_CURLY:
  12443. tokens.push(['}', '}', line, pos - offset]);
  12444. break;
  12445. case COLON:
  12446. tokens.push([':', ':', line, pos - offset]);
  12447. break;
  12448. case SEMICOLON:
  12449. tokens.push([';', ';', line, pos - offset]);
  12450. break;
  12451. case OPEN_PARENTHESES:
  12452. prev = tokens.length ? tokens[tokens.length - 1][1] : '';
  12453. n = css.charCodeAt(pos + 1);
  12454. if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {
  12455. next = pos;
  12456. do {
  12457. escaped = false;
  12458. next = css.indexOf(')', next + 1);
  12459. if (next === -1) {
  12460. if (ignore) {
  12461. next = pos;
  12462. break;
  12463. } else {
  12464. unclosed('bracket');
  12465. }
  12466. }
  12467. escapePos = next;
  12468. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  12469. escapePos -= 1;
  12470. escaped = !escaped;
  12471. }
  12472. } while (escaped);
  12473. tokens.push(['brackets', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);
  12474. pos = next;
  12475. } else {
  12476. next = css.indexOf(')', pos + 1);
  12477. content = css.slice(pos, next + 1);
  12478. if (next === -1 || RE_BAD_BRACKET.test(content)) {
  12479. tokens.push(['(', '(', line, pos - offset]);
  12480. } else {
  12481. tokens.push(['brackets', content, line, pos - offset, line, next - offset]);
  12482. pos = next;
  12483. }
  12484. }
  12485. break;
  12486. case CLOSE_PARENTHESES:
  12487. tokens.push([')', ')', line, pos - offset]);
  12488. break;
  12489. case SINGLE_QUOTE:
  12490. case DOUBLE_QUOTE:
  12491. quote = code === SINGLE_QUOTE ? '\'' : '"';
  12492. next = pos;
  12493. do {
  12494. escaped = false;
  12495. next = css.indexOf(quote, next + 1);
  12496. if (next === -1) {
  12497. if (ignore) {
  12498. next = pos + 1;
  12499. break;
  12500. } else {
  12501. unclosed('string');
  12502. }
  12503. }
  12504. escapePos = next;
  12505. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  12506. escapePos -= 1;
  12507. escaped = !escaped;
  12508. }
  12509. } while (escaped);
  12510. content = css.slice(pos, next + 1);
  12511. lines = content.split('\n');
  12512. last = lines.length - 1;
  12513. if (last > 0) {
  12514. nextLine = line + last;
  12515. nextOffset = next - lines[last].length;
  12516. } else {
  12517. nextLine = line;
  12518. nextOffset = offset;
  12519. }
  12520. tokens.push(['string', css.slice(pos, next + 1), line, pos - offset, nextLine, next - nextOffset]);
  12521. offset = nextOffset;
  12522. line = nextLine;
  12523. pos = next;
  12524. break;
  12525. case AT:
  12526. RE_AT_END.lastIndex = pos + 1;
  12527. RE_AT_END.test(css);
  12528. if (RE_AT_END.lastIndex === 0) {
  12529. next = css.length - 1;
  12530. } else {
  12531. next = RE_AT_END.lastIndex - 2;
  12532. }
  12533. tokens.push(['at-word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);
  12534. pos = next;
  12535. break;
  12536. case BACKSLASH:
  12537. next = pos;
  12538. escape = true;
  12539. while (css.charCodeAt(next + 1) === BACKSLASH) {
  12540. next += 1;
  12541. escape = !escape;
  12542. }
  12543. code = css.charCodeAt(next + 1);
  12544. if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
  12545. next += 1;
  12546. }
  12547. tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);
  12548. pos = next;
  12549. break;
  12550. default:
  12551. if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
  12552. next = css.indexOf('*/', pos + 2) + 1;
  12553. if (next === 0) {
  12554. if (ignore) {
  12555. next = css.length;
  12556. } else {
  12557. unclosed('comment');
  12558. }
  12559. }
  12560. content = css.slice(pos, next + 1);
  12561. lines = content.split('\n');
  12562. last = lines.length - 1;
  12563. if (last > 0) {
  12564. nextLine = line + last;
  12565. nextOffset = next - lines[last].length;
  12566. } else {
  12567. nextLine = line;
  12568. nextOffset = offset;
  12569. }
  12570. tokens.push(['comment', content, line, pos - offset, nextLine, next - nextOffset]);
  12571. offset = nextOffset;
  12572. line = nextLine;
  12573. pos = next;
  12574. } else {
  12575. RE_WORD_END.lastIndex = pos + 1;
  12576. RE_WORD_END.test(css);
  12577. if (RE_WORD_END.lastIndex === 0) {
  12578. next = css.length - 1;
  12579. } else {
  12580. next = RE_WORD_END.lastIndex - 2;
  12581. }
  12582. tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);
  12583. pos = next;
  12584. }
  12585. break;
  12586. }
  12587. pos++;
  12588. }
  12589. return tokens;
  12590. }
  12591. module.exports = exports['default'];
  12592. /***/ }),
  12593. /* 77 */
  12594. /***/ (function(module, exports, __webpack_require__) {
  12595. /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
  12596. * $Id: base64.js,v 2.15 2014/04/05 12:58:57 dankogai Exp dankogai $
  12597. *
  12598. * Licensed under the BSD 3-Clause License.
  12599. * http://opensource.org/licenses/BSD-3-Clause
  12600. *
  12601. * References:
  12602. * http://en.wikipedia.org/wiki/Base64
  12603. */
  12604. (function (global) {
  12605. 'use strict'; // existing version for noConflict()
  12606. var _Base64 = global.Base64;
  12607. var version = "2.3.2"; // if node.js, we use Buffer
  12608. var buffer;
  12609. if (typeof module !== 'undefined' && module.exports) {
  12610. try {
  12611. buffer = __webpack_require__(18).Buffer;
  12612. } catch (err) {}
  12613. } // constants
  12614. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  12615. var b64tab = function (bin) {
  12616. var t = {};
  12617. for (var i = 0, l = bin.length; i < l; i++) {
  12618. t[bin.charAt(i)] = i;
  12619. }
  12620. return t;
  12621. }(b64chars);
  12622. var fromCharCode = String.fromCharCode; // encoder stuff
  12623. var cb_utob = function cb_utob(c) {
  12624. if (c.length < 2) {
  12625. var cc = c.charCodeAt(0);
  12626. return cc < 0x80 ? c : cc < 0x800 ? fromCharCode(0xc0 | cc >>> 6) + fromCharCode(0x80 | cc & 0x3f) : fromCharCode(0xe0 | cc >>> 12 & 0x0f) + fromCharCode(0x80 | cc >>> 6 & 0x3f) + fromCharCode(0x80 | cc & 0x3f);
  12627. } else {
  12628. var cc = 0x10000 + (c.charCodeAt(0) - 0xD800) * 0x400 + (c.charCodeAt(1) - 0xDC00);
  12629. return fromCharCode(0xf0 | cc >>> 18 & 0x07) + fromCharCode(0x80 | cc >>> 12 & 0x3f) + fromCharCode(0x80 | cc >>> 6 & 0x3f) + fromCharCode(0x80 | cc & 0x3f);
  12630. }
  12631. };
  12632. var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
  12633. var utob = function utob(u) {
  12634. return u.replace(re_utob, cb_utob);
  12635. };
  12636. var cb_encode = function cb_encode(ccc) {
  12637. var padlen = [0, 2, 1][ccc.length % 3],
  12638. ord = ccc.charCodeAt(0) << 16 | (ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8 | (ccc.length > 2 ? ccc.charCodeAt(2) : 0),
  12639. chars = [b64chars.charAt(ord >>> 18), b64chars.charAt(ord >>> 12 & 63), padlen >= 2 ? '=' : b64chars.charAt(ord >>> 6 & 63), padlen >= 1 ? '=' : b64chars.charAt(ord & 63)];
  12640. return chars.join('');
  12641. };
  12642. var btoa = global.btoa ? function (b) {
  12643. return global.btoa(b);
  12644. } : function (b) {
  12645. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  12646. };
  12647. var _encode = buffer ? buffer.from && buffer.from !== Uint8Array.from ? function (u) {
  12648. return (u.constructor === buffer.constructor ? u : buffer.from(u)).toString('base64');
  12649. } : function (u) {
  12650. return (u.constructor === buffer.constructor ? u : new buffer(u)).toString('base64');
  12651. } : function (u) {
  12652. return btoa(utob(u));
  12653. };
  12654. var encode = function encode(u, urisafe) {
  12655. return !urisafe ? _encode(String(u)) : _encode(String(u)).replace(/[+\/]/g, function (m0) {
  12656. return m0 == '+' ? '-' : '_';
  12657. }).replace(/=/g, '');
  12658. };
  12659. var encodeURI = function encodeURI(u) {
  12660. return encode(u, true);
  12661. }; // decoder stuff
  12662. var re_btou = new RegExp(['[\xC0-\xDF][\x80-\xBF]', '[\xE0-\xEF][\x80-\xBF]{2}', '[\xF0-\xF7][\x80-\xBF]{3}'].join('|'), 'g');
  12663. var cb_btou = function cb_btou(cccc) {
  12664. switch (cccc.length) {
  12665. case 4:
  12666. var cp = (0x07 & cccc.charCodeAt(0)) << 18 | (0x3f & cccc.charCodeAt(1)) << 12 | (0x3f & cccc.charCodeAt(2)) << 6 | 0x3f & cccc.charCodeAt(3),
  12667. offset = cp - 0x10000;
  12668. return fromCharCode((offset >>> 10) + 0xD800) + fromCharCode((offset & 0x3FF) + 0xDC00);
  12669. case 3:
  12670. return fromCharCode((0x0f & cccc.charCodeAt(0)) << 12 | (0x3f & cccc.charCodeAt(1)) << 6 | 0x3f & cccc.charCodeAt(2));
  12671. default:
  12672. return fromCharCode((0x1f & cccc.charCodeAt(0)) << 6 | 0x3f & cccc.charCodeAt(1));
  12673. }
  12674. };
  12675. var btou = function btou(b) {
  12676. return b.replace(re_btou, cb_btou);
  12677. };
  12678. var cb_decode = function cb_decode(cccc) {
  12679. var len = cccc.length,
  12680. padlen = len % 4,
  12681. n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0) | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0) | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0) | (len > 3 ? b64tab[cccc.charAt(3)] : 0),
  12682. chars = [fromCharCode(n >>> 16), fromCharCode(n >>> 8 & 0xff), fromCharCode(n & 0xff)];
  12683. chars.length -= [0, 0, 2, 1][padlen];
  12684. return chars.join('');
  12685. };
  12686. var atob = global.atob ? function (a) {
  12687. return global.atob(a);
  12688. } : function (a) {
  12689. return a.replace(/[\s\S]{1,4}/g, cb_decode);
  12690. };
  12691. var _decode = buffer ? buffer.from && buffer.from !== Uint8Array.from ? function (a) {
  12692. return (a.constructor === buffer.constructor ? a : buffer.from(a, 'base64')).toString();
  12693. } : function (a) {
  12694. return (a.constructor === buffer.constructor ? a : new buffer(a, 'base64')).toString();
  12695. } : function (a) {
  12696. return btou(atob(a));
  12697. };
  12698. var decode = function decode(a) {
  12699. return _decode(String(a).replace(/[-_]/g, function (m0) {
  12700. return m0 == '-' ? '+' : '/';
  12701. }).replace(/[^A-Za-z0-9\+\/]/g, ''));
  12702. };
  12703. var noConflict = function noConflict() {
  12704. var Base64 = global.Base64;
  12705. global.Base64 = _Base64;
  12706. return Base64;
  12707. }; // export Base64
  12708. global.Base64 = {
  12709. VERSION: version,
  12710. atob: atob,
  12711. btoa: btoa,
  12712. fromBase64: decode,
  12713. toBase64: encode,
  12714. utob: utob,
  12715. encode: encode,
  12716. encodeURI: encodeURI,
  12717. btou: btou,
  12718. decode: decode,
  12719. noConflict: noConflict
  12720. }; // if ES5 is available, make Base64.extendString() available
  12721. if (typeof Object.defineProperty === 'function') {
  12722. var noEnum = function noEnum(v) {
  12723. return {
  12724. value: v,
  12725. enumerable: false,
  12726. writable: true,
  12727. configurable: true
  12728. };
  12729. };
  12730. global.Base64.extendString = function () {
  12731. Object.defineProperty(String.prototype, 'fromBase64', noEnum(function () {
  12732. return decode(this);
  12733. }));
  12734. Object.defineProperty(String.prototype, 'toBase64', noEnum(function (urisafe) {
  12735. return encode(this, urisafe);
  12736. }));
  12737. Object.defineProperty(String.prototype, 'toBase64URI', noEnum(function () {
  12738. return encode(this, true);
  12739. }));
  12740. };
  12741. } //
  12742. // export Base64 to the namespace
  12743. //
  12744. if (global['Meteor']) {
  12745. // Meteor.js
  12746. Base64 = global.Base64;
  12747. } // module.exports and AMD are mutually exclusive.
  12748. // module.exports has precedence.
  12749. if (typeof module !== 'undefined' && module.exports) {
  12750. module.exports.Base64 = global.Base64;
  12751. } else if (true) {
  12752. // AMD. Register as an anonymous module.
  12753. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  12754. return global.Base64;
  12755. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  12756. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12757. } // that's it!
  12758. })(typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this);
  12759. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)))
  12760. /***/ }),
  12761. /* 78 */
  12762. /***/ (function(module, exports, __webpack_require__) {
  12763. /*
  12764. * Copyright 2009-2011 Mozilla Foundation and contributors
  12765. * Licensed under the New BSD license. See LICENSE.txt or:
  12766. * http://opensource.org/licenses/BSD-3-Clause
  12767. */
  12768. exports.SourceMapGenerator = __webpack_require__(79).SourceMapGenerator;
  12769. exports.SourceMapConsumer = __webpack_require__(152).SourceMapConsumer;
  12770. exports.SourceNode = __webpack_require__(155).SourceNode;
  12771. /***/ }),
  12772. /* 79 */
  12773. /***/ (function(module, exports, __webpack_require__) {
  12774. /* -*- Mode: js; js-indent-level: 2; -*- */
  12775. /*
  12776. * Copyright 2011 Mozilla Foundation and contributors
  12777. * Licensed under the New BSD license. See LICENSE or:
  12778. * http://opensource.org/licenses/BSD-3-Clause
  12779. */
  12780. var base64VLQ = __webpack_require__(80);
  12781. var util = __webpack_require__(9);
  12782. var ArraySet = __webpack_require__(81).ArraySet;
  12783. var MappingList = __webpack_require__(151).MappingList;
  12784. /**
  12785. * An instance of the SourceMapGenerator represents a source map which is
  12786. * being built incrementally. You may pass an object with the following
  12787. * properties:
  12788. *
  12789. * - file: The filename of the generated source.
  12790. * - sourceRoot: A root for all relative URLs in this source map.
  12791. */
  12792. function SourceMapGenerator(aArgs) {
  12793. if (!aArgs) {
  12794. aArgs = {};
  12795. }
  12796. this._file = util.getArg(aArgs, 'file', null);
  12797. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  12798. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  12799. this._sources = new ArraySet();
  12800. this._names = new ArraySet();
  12801. this._mappings = new MappingList();
  12802. this._sourcesContents = null;
  12803. }
  12804. SourceMapGenerator.prototype._version = 3;
  12805. /**
  12806. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  12807. *
  12808. * @param aSourceMapConsumer The SourceMap.
  12809. */
  12810. SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  12811. var sourceRoot = aSourceMapConsumer.sourceRoot;
  12812. var generator = new SourceMapGenerator({
  12813. file: aSourceMapConsumer.file,
  12814. sourceRoot: sourceRoot
  12815. });
  12816. aSourceMapConsumer.eachMapping(function (mapping) {
  12817. var newMapping = {
  12818. generated: {
  12819. line: mapping.generatedLine,
  12820. column: mapping.generatedColumn
  12821. }
  12822. };
  12823. if (mapping.source != null) {
  12824. newMapping.source = mapping.source;
  12825. if (sourceRoot != null) {
  12826. newMapping.source = util.relative(sourceRoot, newMapping.source);
  12827. }
  12828. newMapping.original = {
  12829. line: mapping.originalLine,
  12830. column: mapping.originalColumn
  12831. };
  12832. if (mapping.name != null) {
  12833. newMapping.name = mapping.name;
  12834. }
  12835. }
  12836. generator.addMapping(newMapping);
  12837. });
  12838. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  12839. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  12840. if (content != null) {
  12841. generator.setSourceContent(sourceFile, content);
  12842. }
  12843. });
  12844. return generator;
  12845. };
  12846. /**
  12847. * Add a single mapping from original source line and column to the generated
  12848. * source's line and column for this source map being created. The mapping
  12849. * object should have the following properties:
  12850. *
  12851. * - generated: An object with the generated line and column positions.
  12852. * - original: An object with the original line and column positions.
  12853. * - source: The original source file (relative to the sourceRoot).
  12854. * - name: An optional original token name for this mapping.
  12855. */
  12856. SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
  12857. var generated = util.getArg(aArgs, 'generated');
  12858. var original = util.getArg(aArgs, 'original', null);
  12859. var source = util.getArg(aArgs, 'source', null);
  12860. var name = util.getArg(aArgs, 'name', null);
  12861. if (!this._skipValidation) {
  12862. this._validateMapping(generated, original, source, name);
  12863. }
  12864. if (source != null) {
  12865. source = String(source);
  12866. if (!this._sources.has(source)) {
  12867. this._sources.add(source);
  12868. }
  12869. }
  12870. if (name != null) {
  12871. name = String(name);
  12872. if (!this._names.has(name)) {
  12873. this._names.add(name);
  12874. }
  12875. }
  12876. this._mappings.add({
  12877. generatedLine: generated.line,
  12878. generatedColumn: generated.column,
  12879. originalLine: original != null && original.line,
  12880. originalColumn: original != null && original.column,
  12881. source: source,
  12882. name: name
  12883. });
  12884. };
  12885. /**
  12886. * Set the source content for a source file.
  12887. */
  12888. SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  12889. var source = aSourceFile;
  12890. if (this._sourceRoot != null) {
  12891. source = util.relative(this._sourceRoot, source);
  12892. }
  12893. if (aSourceContent != null) {
  12894. // Add the source content to the _sourcesContents map.
  12895. // Create a new _sourcesContents map if the property is null.
  12896. if (!this._sourcesContents) {
  12897. this._sourcesContents = Object.create(null);
  12898. }
  12899. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  12900. } else if (this._sourcesContents) {
  12901. // Remove the source file from the _sourcesContents map.
  12902. // If the _sourcesContents map is empty, set the property to null.
  12903. delete this._sourcesContents[util.toSetString(source)];
  12904. if (Object.keys(this._sourcesContents).length === 0) {
  12905. this._sourcesContents = null;
  12906. }
  12907. }
  12908. };
  12909. /**
  12910. * Applies the mappings of a sub-source-map for a specific source file to the
  12911. * source map being generated. Each mapping to the supplied source file is
  12912. * rewritten using the supplied source map. Note: The resolution for the
  12913. * resulting mappings is the minimium of this map and the supplied map.
  12914. *
  12915. * @param aSourceMapConsumer The source map to be applied.
  12916. * @param aSourceFile Optional. The filename of the source file.
  12917. * If omitted, SourceMapConsumer's file property will be used.
  12918. * @param aSourceMapPath Optional. The dirname of the path to the source map
  12919. * to be applied. If relative, it is relative to the SourceMapConsumer.
  12920. * This parameter is needed when the two source maps aren't in the same
  12921. * directory, and the source map to be applied contains relative source
  12922. * paths. If so, those relative source paths need to be rewritten
  12923. * relative to the SourceMapGenerator.
  12924. */
  12925. SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  12926. var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap
  12927. if (aSourceFile == null) {
  12928. if (aSourceMapConsumer.file == null) {
  12929. throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
  12930. }
  12931. sourceFile = aSourceMapConsumer.file;
  12932. }
  12933. var sourceRoot = this._sourceRoot; // Make "sourceFile" relative if an absolute Url is passed.
  12934. if (sourceRoot != null) {
  12935. sourceFile = util.relative(sourceRoot, sourceFile);
  12936. } // Applying the SourceMap can add and remove items from the sources and
  12937. // the names array.
  12938. var newSources = new ArraySet();
  12939. var newNames = new ArraySet(); // Find mappings for the "sourceFile"
  12940. this._mappings.unsortedForEach(function (mapping) {
  12941. if (mapping.source === sourceFile && mapping.originalLine != null) {
  12942. // Check if it can be mapped by the source map, then update the mapping.
  12943. var original = aSourceMapConsumer.originalPositionFor({
  12944. line: mapping.originalLine,
  12945. column: mapping.originalColumn
  12946. });
  12947. if (original.source != null) {
  12948. // Copy mapping
  12949. mapping.source = original.source;
  12950. if (aSourceMapPath != null) {
  12951. mapping.source = util.join(aSourceMapPath, mapping.source);
  12952. }
  12953. if (sourceRoot != null) {
  12954. mapping.source = util.relative(sourceRoot, mapping.source);
  12955. }
  12956. mapping.originalLine = original.line;
  12957. mapping.originalColumn = original.column;
  12958. if (original.name != null) {
  12959. mapping.name = original.name;
  12960. }
  12961. }
  12962. }
  12963. var source = mapping.source;
  12964. if (source != null && !newSources.has(source)) {
  12965. newSources.add(source);
  12966. }
  12967. var name = mapping.name;
  12968. if (name != null && !newNames.has(name)) {
  12969. newNames.add(name);
  12970. }
  12971. }, this);
  12972. this._sources = newSources;
  12973. this._names = newNames; // Copy sourcesContents of applied map.
  12974. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  12975. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  12976. if (content != null) {
  12977. if (aSourceMapPath != null) {
  12978. sourceFile = util.join(aSourceMapPath, sourceFile);
  12979. }
  12980. if (sourceRoot != null) {
  12981. sourceFile = util.relative(sourceRoot, sourceFile);
  12982. }
  12983. this.setSourceContent(sourceFile, content);
  12984. }
  12985. }, this);
  12986. };
  12987. /**
  12988. * A mapping can have one of the three levels of data:
  12989. *
  12990. * 1. Just the generated position.
  12991. * 2. The Generated position, original position, and original source.
  12992. * 3. Generated and original position, original source, as well as a name
  12993. * token.
  12994. *
  12995. * To maintain consistency, we validate that any new mapping being added falls
  12996. * in to one of these categories.
  12997. */
  12998. SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
  12999. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
  13000. // Case 1.
  13001. return;
  13002. } else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
  13003. // Cases 2 and 3.
  13004. return;
  13005. } else {
  13006. throw new Error('Invalid mapping: ' + JSON.stringify({
  13007. generated: aGenerated,
  13008. source: aSource,
  13009. original: aOriginal,
  13010. name: aName
  13011. }));
  13012. }
  13013. };
  13014. /**
  13015. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  13016. * specified by the source map format.
  13017. */
  13018. SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
  13019. var previousGeneratedColumn = 0;
  13020. var previousGeneratedLine = 1;
  13021. var previousOriginalColumn = 0;
  13022. var previousOriginalLine = 0;
  13023. var previousName = 0;
  13024. var previousSource = 0;
  13025. var result = '';
  13026. var next;
  13027. var mapping;
  13028. var nameIdx;
  13029. var sourceIdx;
  13030. var mappings = this._mappings.toArray();
  13031. for (var i = 0, len = mappings.length; i < len; i++) {
  13032. mapping = mappings[i];
  13033. next = '';
  13034. if (mapping.generatedLine !== previousGeneratedLine) {
  13035. previousGeneratedColumn = 0;
  13036. while (mapping.generatedLine !== previousGeneratedLine) {
  13037. next += ';';
  13038. previousGeneratedLine++;
  13039. }
  13040. } else {
  13041. if (i > 0) {
  13042. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  13043. continue;
  13044. }
  13045. next += ',';
  13046. }
  13047. }
  13048. next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
  13049. previousGeneratedColumn = mapping.generatedColumn;
  13050. if (mapping.source != null) {
  13051. sourceIdx = this._sources.indexOf(mapping.source);
  13052. next += base64VLQ.encode(sourceIdx - previousSource);
  13053. previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3
  13054. next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
  13055. previousOriginalLine = mapping.originalLine - 1;
  13056. next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
  13057. previousOriginalColumn = mapping.originalColumn;
  13058. if (mapping.name != null) {
  13059. nameIdx = this._names.indexOf(mapping.name);
  13060. next += base64VLQ.encode(nameIdx - previousName);
  13061. previousName = nameIdx;
  13062. }
  13063. }
  13064. result += next;
  13065. }
  13066. return result;
  13067. };
  13068. SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  13069. return aSources.map(function (source) {
  13070. if (!this._sourcesContents) {
  13071. return null;
  13072. }
  13073. if (aSourceRoot != null) {
  13074. source = util.relative(aSourceRoot, source);
  13075. }
  13076. var key = util.toSetString(source);
  13077. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
  13078. }, this);
  13079. };
  13080. /**
  13081. * Externalize the source map.
  13082. */
  13083. SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
  13084. var map = {
  13085. version: this._version,
  13086. sources: this._sources.toArray(),
  13087. names: this._names.toArray(),
  13088. mappings: this._serializeMappings()
  13089. };
  13090. if (this._file != null) {
  13091. map.file = this._file;
  13092. }
  13093. if (this._sourceRoot != null) {
  13094. map.sourceRoot = this._sourceRoot;
  13095. }
  13096. if (this._sourcesContents) {
  13097. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  13098. }
  13099. return map;
  13100. };
  13101. /**
  13102. * Render the source map being generated to a string.
  13103. */
  13104. SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
  13105. return JSON.stringify(this.toJSON());
  13106. };
  13107. exports.SourceMapGenerator = SourceMapGenerator;
  13108. /***/ }),
  13109. /* 80 */
  13110. /***/ (function(module, exports, __webpack_require__) {
  13111. /* -*- Mode: js; js-indent-level: 2; -*- */
  13112. /*
  13113. * Copyright 2011 Mozilla Foundation and contributors
  13114. * Licensed under the New BSD license. See LICENSE or:
  13115. * http://opensource.org/licenses/BSD-3-Clause
  13116. *
  13117. * Based on the Base 64 VLQ implementation in Closure Compiler:
  13118. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  13119. *
  13120. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  13121. * Redistribution and use in source and binary forms, with or without
  13122. * modification, are permitted provided that the following conditions are
  13123. * met:
  13124. *
  13125. * * Redistributions of source code must retain the above copyright
  13126. * notice, this list of conditions and the following disclaimer.
  13127. * * Redistributions in binary form must reproduce the above
  13128. * copyright notice, this list of conditions and the following
  13129. * disclaimer in the documentation and/or other materials provided
  13130. * with the distribution.
  13131. * * Neither the name of Google Inc. nor the names of its
  13132. * contributors may be used to endorse or promote products derived
  13133. * from this software without specific prior written permission.
  13134. *
  13135. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  13136. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  13137. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  13138. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  13139. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  13140. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  13141. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  13142. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13143. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  13144. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13145. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13146. */
  13147. var base64 = __webpack_require__(150); // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  13148. // length quantities we use in the source map spec, the first bit is the sign,
  13149. // the next four bits are the actual value, and the 6th bit is the
  13150. // continuation bit. The continuation bit tells us whether there are more
  13151. // digits in this value following this digit.
  13152. //
  13153. // Continuation
  13154. // | Sign
  13155. // | |
  13156. // V V
  13157. // 101011
  13158. var VLQ_BASE_SHIFT = 5; // binary: 100000
  13159. var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111
  13160. var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000
  13161. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  13162. /**
  13163. * Converts from a two-complement value to a value where the sign bit is
  13164. * placed in the least significant bit. For example, as decimals:
  13165. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  13166. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  13167. */
  13168. function toVLQSigned(aValue) {
  13169. return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
  13170. }
  13171. /**
  13172. * Converts to a two-complement value from a value where the sign bit is
  13173. * placed in the least significant bit. For example, as decimals:
  13174. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  13175. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  13176. */
  13177. function fromVLQSigned(aValue) {
  13178. var isNegative = (aValue & 1) === 1;
  13179. var shifted = aValue >> 1;
  13180. return isNegative ? -shifted : shifted;
  13181. }
  13182. /**
  13183. * Returns the base 64 VLQ encoded value.
  13184. */
  13185. exports.encode = function base64VLQ_encode(aValue) {
  13186. var encoded = "";
  13187. var digit;
  13188. var vlq = toVLQSigned(aValue);
  13189. do {
  13190. digit = vlq & VLQ_BASE_MASK;
  13191. vlq >>>= VLQ_BASE_SHIFT;
  13192. if (vlq > 0) {
  13193. // There are still more digits in this value, so we must make sure the
  13194. // continuation bit is marked.
  13195. digit |= VLQ_CONTINUATION_BIT;
  13196. }
  13197. encoded += base64.encode(digit);
  13198. } while (vlq > 0);
  13199. return encoded;
  13200. };
  13201. /**
  13202. * Decodes the next base 64 VLQ value from the given string and returns the
  13203. * value and the rest of the string via the out parameter.
  13204. */
  13205. exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  13206. var strLen = aStr.length;
  13207. var result = 0;
  13208. var shift = 0;
  13209. var continuation, digit;
  13210. do {
  13211. if (aIndex >= strLen) {
  13212. throw new Error("Expected more digits in base 64 VLQ value.");
  13213. }
  13214. digit = base64.decode(aStr.charCodeAt(aIndex++));
  13215. if (digit === -1) {
  13216. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  13217. }
  13218. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  13219. digit &= VLQ_BASE_MASK;
  13220. result = result + (digit << shift);
  13221. shift += VLQ_BASE_SHIFT;
  13222. } while (continuation);
  13223. aOutParam.value = fromVLQSigned(result);
  13224. aOutParam.rest = aIndex;
  13225. };
  13226. /***/ }),
  13227. /* 81 */
  13228. /***/ (function(module, exports, __webpack_require__) {
  13229. /* -*- Mode: js; js-indent-level: 2; -*- */
  13230. /*
  13231. * Copyright 2011 Mozilla Foundation and contributors
  13232. * Licensed under the New BSD license. See LICENSE or:
  13233. * http://opensource.org/licenses/BSD-3-Clause
  13234. */
  13235. var util = __webpack_require__(9);
  13236. var has = Object.prototype.hasOwnProperty;
  13237. /**
  13238. * A data structure which is a combination of an array and a set. Adding a new
  13239. * member is O(1), testing for membership is O(1), and finding the index of an
  13240. * element is O(1). Removing elements from the set is not supported. Only
  13241. * strings are supported for membership.
  13242. */
  13243. function ArraySet() {
  13244. this._array = [];
  13245. this._set = Object.create(null);
  13246. }
  13247. /**
  13248. * Static method for creating ArraySet instances from an existing array.
  13249. */
  13250. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  13251. var set = new ArraySet();
  13252. for (var i = 0, len = aArray.length; i < len; i++) {
  13253. set.add(aArray[i], aAllowDuplicates);
  13254. }
  13255. return set;
  13256. };
  13257. /**
  13258. * Return how many unique items are in this ArraySet. If duplicates have been
  13259. * added, than those do not count towards the size.
  13260. *
  13261. * @returns Number
  13262. */
  13263. ArraySet.prototype.size = function ArraySet_size() {
  13264. return Object.getOwnPropertyNames(this._set).length;
  13265. };
  13266. /**
  13267. * Add the given string to this set.
  13268. *
  13269. * @param String aStr
  13270. */
  13271. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  13272. var sStr = util.toSetString(aStr);
  13273. var isDuplicate = has.call(this._set, sStr);
  13274. var idx = this._array.length;
  13275. if (!isDuplicate || aAllowDuplicates) {
  13276. this._array.push(aStr);
  13277. }
  13278. if (!isDuplicate) {
  13279. this._set[sStr] = idx;
  13280. }
  13281. };
  13282. /**
  13283. * Is the given string a member of this set?
  13284. *
  13285. * @param String aStr
  13286. */
  13287. ArraySet.prototype.has = function ArraySet_has(aStr) {
  13288. var sStr = util.toSetString(aStr);
  13289. return has.call(this._set, sStr);
  13290. };
  13291. /**
  13292. * What is the index of the given string in the array?
  13293. *
  13294. * @param String aStr
  13295. */
  13296. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  13297. var sStr = util.toSetString(aStr);
  13298. if (has.call(this._set, sStr)) {
  13299. return this._set[sStr];
  13300. }
  13301. throw new Error('"' + aStr + '" is not in the set.');
  13302. };
  13303. /**
  13304. * What is the element at the given index?
  13305. *
  13306. * @param Number aIdx
  13307. */
  13308. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  13309. if (aIdx >= 0 && aIdx < this._array.length) {
  13310. return this._array[aIdx];
  13311. }
  13312. throw new Error('No element indexed by ' + aIdx);
  13313. };
  13314. /**
  13315. * Returns the array representation of this set (which has the proper indices
  13316. * indicated by indexOf). Note that this is a copy of the internal array used
  13317. * for storing the members so that no one can mess with internal state.
  13318. */
  13319. ArraySet.prototype.toArray = function ArraySet_toArray() {
  13320. return this._array.slice();
  13321. };
  13322. exports.ArraySet = ArraySet;
  13323. /***/ }),
  13324. /* 82 */
  13325. /***/ (function(module, exports, __webpack_require__) {
  13326. "use strict";
  13327. exports.__esModule = true;
  13328. exports.default = stringify;
  13329. var _stringifier = __webpack_require__(24);
  13330. var _stringifier2 = _interopRequireDefault(_stringifier);
  13331. function _interopRequireDefault(obj) {
  13332. return obj && obj.__esModule ? obj : {
  13333. default: obj
  13334. };
  13335. }
  13336. function stringify(node, builder) {
  13337. var str = new _stringifier2.default(builder);
  13338. str.stringify(node);
  13339. }
  13340. module.exports = exports['default'];
  13341. /***/ }),
  13342. /* 83 */
  13343. /***/ (function(module, exports, __webpack_require__) {
  13344. "use strict";
  13345. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  13346. exports.__esModule = true;
  13347. var _createClass = function () {
  13348. function defineProperties(target, props) {
  13349. for (var i = 0; i < props.length; i++) {
  13350. var descriptor = props[i];
  13351. descriptor.enumerable = descriptor.enumerable || false;
  13352. descriptor.configurable = true;
  13353. if ("value" in descriptor) descriptor.writable = true;
  13354. Object.defineProperty(target, descriptor.key, descriptor);
  13355. }
  13356. }
  13357. return function (Constructor, protoProps, staticProps) {
  13358. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  13359. if (staticProps) defineProperties(Constructor, staticProps);
  13360. return Constructor;
  13361. };
  13362. }();
  13363. var _warnOnce = __webpack_require__(4);
  13364. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  13365. var _node = __webpack_require__(22);
  13366. var _node2 = _interopRequireDefault(_node);
  13367. function _interopRequireDefault(obj) {
  13368. return obj && obj.__esModule ? obj : {
  13369. default: obj
  13370. };
  13371. }
  13372. function _classCallCheck(instance, Constructor) {
  13373. if (!(instance instanceof Constructor)) {
  13374. throw new TypeError("Cannot call a class as a function");
  13375. }
  13376. }
  13377. function _possibleConstructorReturn(self, call) {
  13378. if (!self) {
  13379. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  13380. }
  13381. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  13382. }
  13383. function _inherits(subClass, superClass) {
  13384. if (typeof superClass !== "function" && superClass !== null) {
  13385. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  13386. }
  13387. subClass.prototype = Object.create(superClass && superClass.prototype, {
  13388. constructor: {
  13389. value: subClass,
  13390. enumerable: false,
  13391. writable: true,
  13392. configurable: true
  13393. }
  13394. });
  13395. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  13396. }
  13397. /**
  13398. * Represents a CSS declaration.
  13399. *
  13400. * @extends Node
  13401. *
  13402. * @example
  13403. * const root = postcss.parse('a { color: black }');
  13404. * const decl = root.first.first;
  13405. * decl.type //=> 'decl'
  13406. * decl.toString() //=> ' color: black'
  13407. */
  13408. var Declaration = function (_Node) {
  13409. _inherits(Declaration, _Node);
  13410. function Declaration(defaults) {
  13411. _classCallCheck(this, Declaration);
  13412. var _this = _possibleConstructorReturn(this, _Node.call(this, defaults));
  13413. _this.type = 'decl';
  13414. return _this;
  13415. }
  13416. _createClass(Declaration, [{
  13417. key: '_value',
  13418. get: function get() {
  13419. (0, _warnOnce2.default)('Node#_value was deprecated. Use Node#raws.value');
  13420. return this.raws.value;
  13421. },
  13422. set: function set(val) {
  13423. (0, _warnOnce2.default)('Node#_value was deprecated. Use Node#raws.value');
  13424. this.raws.value = val;
  13425. }
  13426. }, {
  13427. key: '_important',
  13428. get: function get() {
  13429. (0, _warnOnce2.default)('Node#_important was deprecated. Use Node#raws.important');
  13430. return this.raws.important;
  13431. },
  13432. set: function set(val) {
  13433. (0, _warnOnce2.default)('Node#_important was deprecated. Use Node#raws.important');
  13434. this.raws.important = val;
  13435. }
  13436. /**
  13437. * @memberof Declaration#
  13438. * @member {string} prop - the declaration’s property name
  13439. *
  13440. * @example
  13441. * const root = postcss.parse('a { color: black }');
  13442. * const decl = root.first.first;
  13443. * decl.prop //=> 'color'
  13444. */
  13445. /**
  13446. * @memberof Declaration#
  13447. * @member {string} value - the declaration’s value
  13448. *
  13449. * @example
  13450. * const root = postcss.parse('a { color: black }');
  13451. * const decl = root.first.first;
  13452. * decl.value //=> 'black'
  13453. */
  13454. /**
  13455. * @memberof Declaration#
  13456. * @member {boolean} important - `true` if the declaration
  13457. * has an !important annotation.
  13458. *
  13459. * @example
  13460. * const root = postcss.parse('a { color: black !important; color: red }');
  13461. * root.first.first.important //=> true
  13462. * root.first.last.important //=> undefined
  13463. */
  13464. /**
  13465. * @memberof Declaration#
  13466. * @member {object} raws - Information to generate byte-to-byte equal
  13467. * node string as it was in the origin input.
  13468. *
  13469. * Every parser saves its own properties,
  13470. * but the default CSS parser uses:
  13471. *
  13472. * * `before`: the space symbols before the node. It also stores `*`
  13473. * and `_` symbols before the declaration (IE hack).
  13474. * * `between`: the symbols between the property and value
  13475. * for declarations.
  13476. * * `important`: the content of the important statement,
  13477. * if it is not just `!important`.
  13478. *
  13479. * PostCSS cleans declaration from comments and extra spaces,
  13480. * but it stores origin content in raws properties.
  13481. * As such, if you don’t change a declaration’s value,
  13482. * PostCSS will use the raw value with comments.
  13483. *
  13484. * @example
  13485. * const root = postcss.parse('a {\n color:black\n}')
  13486. * root.first.first.raws //=> { before: '\n ', between: ':' }
  13487. */
  13488. }]);
  13489. return Declaration;
  13490. }(_node2.default);
  13491. exports.default = Declaration;
  13492. module.exports = exports['default'];
  13493. /***/ }),
  13494. /* 84 */
  13495. /***/ (function(module, exports, __webpack_require__) {
  13496. "use strict";
  13497. exports.__esModule = true;
  13498. exports.default = parse;
  13499. var _parser = __webpack_require__(85);
  13500. var _parser2 = _interopRequireDefault(_parser);
  13501. var _input = __webpack_require__(23);
  13502. var _input2 = _interopRequireDefault(_input);
  13503. function _interopRequireDefault(obj) {
  13504. return obj && obj.__esModule ? obj : {
  13505. default: obj
  13506. };
  13507. }
  13508. function parse(css, opts) {
  13509. if (opts && opts.safe) {
  13510. throw new Error('Option safe was removed. ' + 'Use parser: require("postcss-safe-parser")');
  13511. }
  13512. var input = new _input2.default(css, opts);
  13513. var parser = new _parser2.default(input);
  13514. try {
  13515. parser.tokenize();
  13516. parser.loop();
  13517. } catch (e) {
  13518. if (e.name === 'CssSyntaxError' && opts && opts.from) {
  13519. if (/\.scss$/i.test(opts.from)) {
  13520. e.message += '\nYou tried to parse SCSS with ' + 'the standard CSS parser; ' + 'try again with the postcss-scss parser';
  13521. } else if (/\.sass/i.test(opts.from)) {
  13522. e.message += '\nYou tried to parse Sass with ' + 'the standard CSS parser; ' + 'try again with the postcss-sass parser';
  13523. } else if (/\.less$/i.test(opts.from)) {
  13524. e.message += '\nYou tried to parse Less with ' + 'the standard CSS parser; ' + 'try again with the postcss-less parser';
  13525. }
  13526. }
  13527. throw e;
  13528. }
  13529. return parser.root;
  13530. }
  13531. module.exports = exports['default'];
  13532. /***/ }),
  13533. /* 85 */
  13534. /***/ (function(module, exports, __webpack_require__) {
  13535. "use strict";
  13536. exports.__esModule = true;
  13537. var _declaration = __webpack_require__(83);
  13538. var _declaration2 = _interopRequireDefault(_declaration);
  13539. var _tokenize = __webpack_require__(76);
  13540. var _tokenize2 = _interopRequireDefault(_tokenize);
  13541. var _comment = __webpack_require__(21);
  13542. var _comment2 = _interopRequireDefault(_comment);
  13543. var _atRule = __webpack_require__(26);
  13544. var _atRule2 = _interopRequireDefault(_atRule);
  13545. var _root = __webpack_require__(27);
  13546. var _root2 = _interopRequireDefault(_root);
  13547. var _rule = __webpack_require__(10);
  13548. var _rule2 = _interopRequireDefault(_rule);
  13549. function _interopRequireDefault(obj) {
  13550. return obj && obj.__esModule ? obj : {
  13551. default: obj
  13552. };
  13553. }
  13554. function _classCallCheck(instance, Constructor) {
  13555. if (!(instance instanceof Constructor)) {
  13556. throw new TypeError("Cannot call a class as a function");
  13557. }
  13558. }
  13559. var Parser = function () {
  13560. function Parser(input) {
  13561. _classCallCheck(this, Parser);
  13562. this.input = input;
  13563. this.pos = 0;
  13564. this.root = new _root2.default();
  13565. this.current = this.root;
  13566. this.spaces = '';
  13567. this.semicolon = false;
  13568. this.root.source = {
  13569. input: input,
  13570. start: {
  13571. line: 1,
  13572. column: 1
  13573. }
  13574. };
  13575. }
  13576. Parser.prototype.tokenize = function tokenize() {
  13577. this.tokens = (0, _tokenize2.default)(this.input);
  13578. };
  13579. Parser.prototype.loop = function loop() {
  13580. var token = void 0;
  13581. while (this.pos < this.tokens.length) {
  13582. token = this.tokens[this.pos];
  13583. switch (token[0]) {
  13584. case 'space':
  13585. case ';':
  13586. this.spaces += token[1];
  13587. break;
  13588. case '}':
  13589. this.end(token);
  13590. break;
  13591. case 'comment':
  13592. this.comment(token);
  13593. break;
  13594. case 'at-word':
  13595. this.atrule(token);
  13596. break;
  13597. case '{':
  13598. this.emptyRule(token);
  13599. break;
  13600. default:
  13601. this.other();
  13602. break;
  13603. }
  13604. this.pos += 1;
  13605. }
  13606. this.endFile();
  13607. };
  13608. Parser.prototype.comment = function comment(token) {
  13609. var node = new _comment2.default();
  13610. this.init(node, token[2], token[3]);
  13611. node.source.end = {
  13612. line: token[4],
  13613. column: token[5]
  13614. };
  13615. var text = token[1].slice(2, -2);
  13616. if (/^\s*$/.test(text)) {
  13617. node.text = '';
  13618. node.raws.left = text;
  13619. node.raws.right = '';
  13620. } else {
  13621. var match = text.match(/^(\s*)([^]*[^\s])(\s*)$/);
  13622. node.text = match[2];
  13623. node.raws.left = match[1];
  13624. node.raws.right = match[3];
  13625. }
  13626. };
  13627. Parser.prototype.emptyRule = function emptyRule(token) {
  13628. var node = new _rule2.default();
  13629. this.init(node, token[2], token[3]);
  13630. node.selector = '';
  13631. node.raws.between = '';
  13632. this.current = node;
  13633. };
  13634. Parser.prototype.other = function other() {
  13635. var token = void 0;
  13636. var end = false;
  13637. var type = null;
  13638. var colon = false;
  13639. var bracket = null;
  13640. var brackets = [];
  13641. var start = this.pos;
  13642. while (this.pos < this.tokens.length) {
  13643. token = this.tokens[this.pos];
  13644. type = token[0];
  13645. if (type === '(' || type === '[') {
  13646. if (!bracket) bracket = token;
  13647. brackets.push(type === '(' ? ')' : ']');
  13648. } else if (brackets.length === 0) {
  13649. if (type === ';') {
  13650. if (colon) {
  13651. this.decl(this.tokens.slice(start, this.pos + 1));
  13652. return;
  13653. } else {
  13654. break;
  13655. }
  13656. } else if (type === '{') {
  13657. this.rule(this.tokens.slice(start, this.pos + 1));
  13658. return;
  13659. } else if (type === '}') {
  13660. this.pos -= 1;
  13661. end = true;
  13662. break;
  13663. } else if (type === ':') {
  13664. colon = true;
  13665. }
  13666. } else if (type === brackets[brackets.length - 1]) {
  13667. brackets.pop();
  13668. if (brackets.length === 0) bracket = null;
  13669. }
  13670. this.pos += 1;
  13671. }
  13672. if (this.pos === this.tokens.length) {
  13673. this.pos -= 1;
  13674. end = true;
  13675. }
  13676. if (brackets.length > 0) this.unclosedBracket(bracket);
  13677. if (end && colon) {
  13678. while (this.pos > start) {
  13679. token = this.tokens[this.pos][0];
  13680. if (token !== 'space' && token !== 'comment') break;
  13681. this.pos -= 1;
  13682. }
  13683. this.decl(this.tokens.slice(start, this.pos + 1));
  13684. return;
  13685. }
  13686. this.unknownWord(start);
  13687. };
  13688. Parser.prototype.rule = function rule(tokens) {
  13689. tokens.pop();
  13690. var node = new _rule2.default();
  13691. this.init(node, tokens[0][2], tokens[0][3]);
  13692. node.raws.between = this.spacesAndCommentsFromEnd(tokens);
  13693. this.raw(node, 'selector', tokens);
  13694. this.current = node;
  13695. };
  13696. Parser.prototype.decl = function decl(tokens) {
  13697. var node = new _declaration2.default();
  13698. this.init(node);
  13699. var last = tokens[tokens.length - 1];
  13700. if (last[0] === ';') {
  13701. this.semicolon = true;
  13702. tokens.pop();
  13703. }
  13704. if (last[4]) {
  13705. node.source.end = {
  13706. line: last[4],
  13707. column: last[5]
  13708. };
  13709. } else {
  13710. node.source.end = {
  13711. line: last[2],
  13712. column: last[3]
  13713. };
  13714. }
  13715. while (tokens[0][0] !== 'word') {
  13716. node.raws.before += tokens.shift()[1];
  13717. }
  13718. node.source.start = {
  13719. line: tokens[0][2],
  13720. column: tokens[0][3]
  13721. };
  13722. node.prop = '';
  13723. while (tokens.length) {
  13724. var type = tokens[0][0];
  13725. if (type === ':' || type === 'space' || type === 'comment') {
  13726. break;
  13727. }
  13728. node.prop += tokens.shift()[1];
  13729. }
  13730. node.raws.between = '';
  13731. var token = void 0;
  13732. while (tokens.length) {
  13733. token = tokens.shift();
  13734. if (token[0] === ':') {
  13735. node.raws.between += token[1];
  13736. break;
  13737. } else {
  13738. node.raws.between += token[1];
  13739. }
  13740. }
  13741. if (node.prop[0] === '_' || node.prop[0] === '*') {
  13742. node.raws.before += node.prop[0];
  13743. node.prop = node.prop.slice(1);
  13744. }
  13745. node.raws.between += this.spacesAndCommentsFromStart(tokens);
  13746. this.precheckMissedSemicolon(tokens);
  13747. for (var i = tokens.length - 1; i > 0; i--) {
  13748. token = tokens[i];
  13749. if (token[1] === '!important') {
  13750. node.important = true;
  13751. var string = this.stringFrom(tokens, i);
  13752. string = this.spacesFromEnd(tokens) + string;
  13753. if (string !== ' !important') node.raws.important = string;
  13754. break;
  13755. } else if (token[1] === 'important') {
  13756. var cache = tokens.slice(0);
  13757. var str = '';
  13758. for (var j = i; j > 0; j--) {
  13759. var _type = cache[j][0];
  13760. if (str.trim().indexOf('!') === 0 && _type !== 'space') {
  13761. break;
  13762. }
  13763. str = cache.pop()[1] + str;
  13764. }
  13765. if (str.trim().indexOf('!') === 0) {
  13766. node.important = true;
  13767. node.raws.important = str;
  13768. tokens = cache;
  13769. }
  13770. }
  13771. if (token[0] !== 'space' && token[0] !== 'comment') {
  13772. break;
  13773. }
  13774. }
  13775. this.raw(node, 'value', tokens);
  13776. if (node.value.indexOf(':') !== -1) this.checkMissedSemicolon(tokens);
  13777. };
  13778. Parser.prototype.atrule = function atrule(token) {
  13779. var node = new _atRule2.default();
  13780. node.name = token[1].slice(1);
  13781. if (node.name === '') {
  13782. this.unnamedAtrule(node, token);
  13783. }
  13784. this.init(node, token[2], token[3]);
  13785. var last = false;
  13786. var open = false;
  13787. var params = [];
  13788. this.pos += 1;
  13789. while (this.pos < this.tokens.length) {
  13790. token = this.tokens[this.pos];
  13791. if (token[0] === ';') {
  13792. node.source.end = {
  13793. line: token[2],
  13794. column: token[3]
  13795. };
  13796. this.semicolon = true;
  13797. break;
  13798. } else if (token[0] === '{') {
  13799. open = true;
  13800. break;
  13801. } else if (token[0] === '}') {
  13802. this.end(token);
  13803. break;
  13804. } else {
  13805. params.push(token);
  13806. }
  13807. this.pos += 1;
  13808. }
  13809. if (this.pos === this.tokens.length) {
  13810. last = true;
  13811. }
  13812. node.raws.between = this.spacesAndCommentsFromEnd(params);
  13813. if (params.length) {
  13814. node.raws.afterName = this.spacesAndCommentsFromStart(params);
  13815. this.raw(node, 'params', params);
  13816. if (last) {
  13817. token = params[params.length - 1];
  13818. node.source.end = {
  13819. line: token[4],
  13820. column: token[5]
  13821. };
  13822. this.spaces = node.raws.between;
  13823. node.raws.between = '';
  13824. }
  13825. } else {
  13826. node.raws.afterName = '';
  13827. node.params = '';
  13828. }
  13829. if (open) {
  13830. node.nodes = [];
  13831. this.current = node;
  13832. }
  13833. };
  13834. Parser.prototype.end = function end(token) {
  13835. if (this.current.nodes && this.current.nodes.length) {
  13836. this.current.raws.semicolon = this.semicolon;
  13837. }
  13838. this.semicolon = false;
  13839. this.current.raws.after = (this.current.raws.after || '') + this.spaces;
  13840. this.spaces = '';
  13841. if (this.current.parent) {
  13842. this.current.source.end = {
  13843. line: token[2],
  13844. column: token[3]
  13845. };
  13846. this.current = this.current.parent;
  13847. } else {
  13848. this.unexpectedClose(token);
  13849. }
  13850. };
  13851. Parser.prototype.endFile = function endFile() {
  13852. if (this.current.parent) this.unclosedBlock();
  13853. if (this.current.nodes && this.current.nodes.length) {
  13854. this.current.raws.semicolon = this.semicolon;
  13855. }
  13856. this.current.raws.after = (this.current.raws.after || '') + this.spaces;
  13857. }; // Helpers
  13858. Parser.prototype.init = function init(node, line, column) {
  13859. this.current.push(node);
  13860. node.source = {
  13861. start: {
  13862. line: line,
  13863. column: column
  13864. },
  13865. input: this.input
  13866. };
  13867. node.raws.before = this.spaces;
  13868. this.spaces = '';
  13869. if (node.type !== 'comment') this.semicolon = false;
  13870. };
  13871. Parser.prototype.raw = function raw(node, prop, tokens) {
  13872. var token = void 0,
  13873. type = void 0;
  13874. var length = tokens.length;
  13875. var value = '';
  13876. var clean = true;
  13877. for (var i = 0; i < length; i += 1) {
  13878. token = tokens[i];
  13879. type = token[0];
  13880. if (type === 'comment' || type === 'space' && i === length - 1) {
  13881. clean = false;
  13882. } else {
  13883. value += token[1];
  13884. }
  13885. }
  13886. if (!clean) {
  13887. var raw = tokens.reduce(function (all, i) {
  13888. return all + i[1];
  13889. }, '');
  13890. node.raws[prop] = {
  13891. value: value,
  13892. raw: raw
  13893. };
  13894. }
  13895. node[prop] = value;
  13896. };
  13897. Parser.prototype.spacesAndCommentsFromEnd = function spacesAndCommentsFromEnd(tokens) {
  13898. var lastTokenType = void 0;
  13899. var spaces = '';
  13900. while (tokens.length) {
  13901. lastTokenType = tokens[tokens.length - 1][0];
  13902. if (lastTokenType !== 'space' && lastTokenType !== 'comment') break;
  13903. spaces = tokens.pop()[1] + spaces;
  13904. }
  13905. return spaces;
  13906. };
  13907. Parser.prototype.spacesAndCommentsFromStart = function spacesAndCommentsFromStart(tokens) {
  13908. var next = void 0;
  13909. var spaces = '';
  13910. while (tokens.length) {
  13911. next = tokens[0][0];
  13912. if (next !== 'space' && next !== 'comment') break;
  13913. spaces += tokens.shift()[1];
  13914. }
  13915. return spaces;
  13916. };
  13917. Parser.prototype.spacesFromEnd = function spacesFromEnd(tokens) {
  13918. var lastTokenType = void 0;
  13919. var spaces = '';
  13920. while (tokens.length) {
  13921. lastTokenType = tokens[tokens.length - 1][0];
  13922. if (lastTokenType !== 'space') break;
  13923. spaces = tokens.pop()[1] + spaces;
  13924. }
  13925. return spaces;
  13926. };
  13927. Parser.prototype.stringFrom = function stringFrom(tokens, from) {
  13928. var result = '';
  13929. for (var i = from; i < tokens.length; i++) {
  13930. result += tokens[i][1];
  13931. }
  13932. tokens.splice(from, tokens.length - from);
  13933. return result;
  13934. };
  13935. Parser.prototype.colon = function colon(tokens) {
  13936. var brackets = 0;
  13937. var token = void 0,
  13938. type = void 0,
  13939. prev = void 0;
  13940. for (var i = 0; i < tokens.length; i++) {
  13941. token = tokens[i];
  13942. type = token[0];
  13943. if (type === '(') {
  13944. brackets += 1;
  13945. } else if (type === ')') {
  13946. brackets -= 1;
  13947. } else if (brackets === 0 && type === ':') {
  13948. if (!prev) {
  13949. this.doubleColon(token);
  13950. } else if (prev[0] === 'word' && prev[1] === 'progid') {
  13951. continue;
  13952. } else {
  13953. return i;
  13954. }
  13955. }
  13956. prev = token;
  13957. }
  13958. return false;
  13959. }; // Errors
  13960. Parser.prototype.unclosedBracket = function unclosedBracket(bracket) {
  13961. throw this.input.error('Unclosed bracket', bracket[2], bracket[3]);
  13962. };
  13963. Parser.prototype.unknownWord = function unknownWord(start) {
  13964. var token = this.tokens[start];
  13965. throw this.input.error('Unknown word', token[2], token[3]);
  13966. };
  13967. Parser.prototype.unexpectedClose = function unexpectedClose(token) {
  13968. throw this.input.error('Unexpected }', token[2], token[3]);
  13969. };
  13970. Parser.prototype.unclosedBlock = function unclosedBlock() {
  13971. var pos = this.current.source.start;
  13972. throw this.input.error('Unclosed block', pos.line, pos.column);
  13973. };
  13974. Parser.prototype.doubleColon = function doubleColon(token) {
  13975. throw this.input.error('Double colon', token[2], token[3]);
  13976. };
  13977. Parser.prototype.unnamedAtrule = function unnamedAtrule(node, token) {
  13978. throw this.input.error('At-rule without name', token[2], token[3]);
  13979. };
  13980. Parser.prototype.precheckMissedSemicolon = function precheckMissedSemicolon(tokens) {
  13981. // Hook for Safe Parser
  13982. tokens;
  13983. };
  13984. Parser.prototype.checkMissedSemicolon = function checkMissedSemicolon(tokens) {
  13985. var colon = this.colon(tokens);
  13986. if (colon === false) return;
  13987. var founded = 0;
  13988. var token = void 0;
  13989. for (var j = colon - 1; j >= 0; j--) {
  13990. token = tokens[j];
  13991. if (token[0] !== 'space') {
  13992. founded += 1;
  13993. if (founded === 2) break;
  13994. }
  13995. }
  13996. throw this.input.error('Missed semicolon', token[2], token[3]);
  13997. };
  13998. return Parser;
  13999. }();
  14000. exports.default = Parser;
  14001. module.exports = exports['default'];
  14002. /***/ }),
  14003. /* 86 */
  14004. /***/ (function(module, exports, __webpack_require__) {
  14005. "use strict";
  14006. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  14007. exports.__esModule = true;
  14008. var _createClass = function () {
  14009. function defineProperties(target, props) {
  14010. for (var i = 0; i < props.length; i++) {
  14011. var descriptor = props[i];
  14012. descriptor.enumerable = descriptor.enumerable || false;
  14013. descriptor.configurable = true;
  14014. if ("value" in descriptor) descriptor.writable = true;
  14015. Object.defineProperty(target, descriptor.key, descriptor);
  14016. }
  14017. }
  14018. return function (Constructor, protoProps, staticProps) {
  14019. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  14020. if (staticProps) defineProperties(Constructor, staticProps);
  14021. return Constructor;
  14022. };
  14023. }();
  14024. var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  14025. return _typeof2(obj);
  14026. } : function (obj) {
  14027. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  14028. };
  14029. var _mapGenerator = __webpack_require__(158);
  14030. var _mapGenerator2 = _interopRequireDefault(_mapGenerator);
  14031. var _stringify2 = __webpack_require__(82);
  14032. var _stringify3 = _interopRequireDefault(_stringify2);
  14033. var _warnOnce = __webpack_require__(4);
  14034. var _warnOnce2 = _interopRequireDefault(_warnOnce);
  14035. var _result = __webpack_require__(159);
  14036. var _result2 = _interopRequireDefault(_result);
  14037. var _parse = __webpack_require__(84);
  14038. var _parse2 = _interopRequireDefault(_parse);
  14039. function _interopRequireDefault(obj) {
  14040. return obj && obj.__esModule ? obj : {
  14041. default: obj
  14042. };
  14043. }
  14044. function _classCallCheck(instance, Constructor) {
  14045. if (!(instance instanceof Constructor)) {
  14046. throw new TypeError("Cannot call a class as a function");
  14047. }
  14048. }
  14049. function isPromise(obj) {
  14050. return (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.then === 'function';
  14051. }
  14052. /**
  14053. * A Promise proxy for the result of PostCSS transformations.
  14054. *
  14055. * A `LazyResult` instance is returned by {@link Processor#process}.
  14056. *
  14057. * @example
  14058. * const lazy = postcss([cssnext]).process(css);
  14059. */
  14060. var LazyResult = function () {
  14061. function LazyResult(processor, css, opts) {
  14062. _classCallCheck(this, LazyResult);
  14063. this.stringified = false;
  14064. this.processed = false;
  14065. var root = void 0;
  14066. if ((typeof css === 'undefined' ? 'undefined' : _typeof(css)) === 'object' && css.type === 'root') {
  14067. root = css;
  14068. } else if (css instanceof LazyResult || css instanceof _result2.default) {
  14069. root = css.root;
  14070. if (css.map) {
  14071. if (typeof opts.map === 'undefined') opts.map = {};
  14072. if (!opts.map.inline) opts.map.inline = false;
  14073. opts.map.prev = css.map;
  14074. }
  14075. } else {
  14076. var parser = _parse2.default;
  14077. if (opts.syntax) parser = opts.syntax.parse;
  14078. if (opts.parser) parser = opts.parser;
  14079. if (parser.parse) parser = parser.parse;
  14080. try {
  14081. root = parser(css, opts);
  14082. } catch (error) {
  14083. this.error = error;
  14084. }
  14085. }
  14086. this.result = new _result2.default(processor, root, opts);
  14087. }
  14088. /**
  14089. * Returns a {@link Processor} instance, which will be used
  14090. * for CSS transformations.
  14091. * @type {Processor}
  14092. */
  14093. /**
  14094. * Processes input CSS through synchronous plugins
  14095. * and calls {@link Result#warnings()}.
  14096. *
  14097. * @return {Warning[]} warnings from plugins
  14098. */
  14099. LazyResult.prototype.warnings = function warnings() {
  14100. return this.sync().warnings();
  14101. };
  14102. /**
  14103. * Alias for the {@link LazyResult#css} property.
  14104. *
  14105. * @example
  14106. * lazy + '' === lazy.css;
  14107. *
  14108. * @return {string} output CSS
  14109. */
  14110. LazyResult.prototype.toString = function toString() {
  14111. return this.css;
  14112. };
  14113. /**
  14114. * Processes input CSS through synchronous and asynchronous plugins
  14115. * and calls `onFulfilled` with a Result instance. If a plugin throws
  14116. * an error, the `onRejected` callback will be executed.
  14117. *
  14118. * It implements standard Promise API.
  14119. *
  14120. * @param {onFulfilled} onFulfilled - callback will be executed
  14121. * when all plugins will finish work
  14122. * @param {onRejected} onRejected - callback will be executed on any error
  14123. *
  14124. * @return {Promise} Promise API to make queue
  14125. *
  14126. * @example
  14127. * postcss([cssnext]).process(css).then(result => {
  14128. * console.log(result.css);
  14129. * });
  14130. */
  14131. LazyResult.prototype.then = function then(onFulfilled, onRejected) {
  14132. return this.async().then(onFulfilled, onRejected);
  14133. };
  14134. /**
  14135. * Processes input CSS through synchronous and asynchronous plugins
  14136. * and calls onRejected for each error thrown in any plugin.
  14137. *
  14138. * It implements standard Promise API.
  14139. *
  14140. * @param {onRejected} onRejected - callback will be executed on any error
  14141. *
  14142. * @return {Promise} Promise API to make queue
  14143. *
  14144. * @example
  14145. * postcss([cssnext]).process(css).then(result => {
  14146. * console.log(result.css);
  14147. * }).catch(error => {
  14148. * console.error(error);
  14149. * });
  14150. */
  14151. LazyResult.prototype.catch = function _catch(onRejected) {
  14152. return this.async().catch(onRejected);
  14153. };
  14154. LazyResult.prototype.handleError = function handleError(error, plugin) {
  14155. try {
  14156. this.error = error;
  14157. if (error.name === 'CssSyntaxError' && !error.plugin) {
  14158. error.plugin = plugin.postcssPlugin;
  14159. error.setMessage();
  14160. } else if (plugin.postcssVersion) {
  14161. var pluginName = plugin.postcssPlugin;
  14162. var pluginVer = plugin.postcssVersion;
  14163. var runtimeVer = this.result.processor.version;
  14164. var a = pluginVer.split('.');
  14165. var b = runtimeVer.split('.');
  14166. if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
  14167. (0, _warnOnce2.default)('Your current PostCSS version ' + 'is ' + runtimeVer + ', but ' + pluginName + ' ' + 'uses ' + pluginVer + '. Perhaps this is ' + 'the source of the error below.');
  14168. }
  14169. }
  14170. } catch (err) {
  14171. if (console && console.error) console.error(err);
  14172. }
  14173. };
  14174. LazyResult.prototype.asyncTick = function asyncTick(resolve, reject) {
  14175. var _this = this;
  14176. if (this.plugin >= this.processor.plugins.length) {
  14177. this.processed = true;
  14178. return resolve();
  14179. }
  14180. try {
  14181. var plugin = this.processor.plugins[this.plugin];
  14182. var promise = this.run(plugin);
  14183. this.plugin += 1;
  14184. if (isPromise(promise)) {
  14185. promise.then(function () {
  14186. _this.asyncTick(resolve, reject);
  14187. }).catch(function (error) {
  14188. _this.handleError(error, plugin);
  14189. _this.processed = true;
  14190. reject(error);
  14191. });
  14192. } else {
  14193. this.asyncTick(resolve, reject);
  14194. }
  14195. } catch (error) {
  14196. this.processed = true;
  14197. reject(error);
  14198. }
  14199. };
  14200. LazyResult.prototype.async = function async() {
  14201. var _this2 = this;
  14202. if (this.processed) {
  14203. return new Promise(function (resolve, reject) {
  14204. if (_this2.error) {
  14205. reject(_this2.error);
  14206. } else {
  14207. resolve(_this2.stringify());
  14208. }
  14209. });
  14210. }
  14211. if (this.processing) {
  14212. return this.processing;
  14213. }
  14214. this.processing = new Promise(function (resolve, reject) {
  14215. if (_this2.error) return reject(_this2.error);
  14216. _this2.plugin = 0;
  14217. _this2.asyncTick(resolve, reject);
  14218. }).then(function () {
  14219. _this2.processed = true;
  14220. return _this2.stringify();
  14221. });
  14222. return this.processing;
  14223. };
  14224. LazyResult.prototype.sync = function sync() {
  14225. if (this.processed) return this.result;
  14226. this.processed = true;
  14227. if (this.processing) {
  14228. throw new Error('Use process(css).then(cb) to work with async plugins');
  14229. }
  14230. if (this.error) throw this.error;
  14231. for (var _iterator = this.result.processor.plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  14232. var _ref;
  14233. if (_isArray) {
  14234. if (_i >= _iterator.length) break;
  14235. _ref = _iterator[_i++];
  14236. } else {
  14237. _i = _iterator.next();
  14238. if (_i.done) break;
  14239. _ref = _i.value;
  14240. }
  14241. var plugin = _ref;
  14242. var promise = this.run(plugin);
  14243. if (isPromise(promise)) {
  14244. throw new Error('Use process(css).then(cb) to work with async plugins');
  14245. }
  14246. }
  14247. return this.result;
  14248. };
  14249. LazyResult.prototype.run = function run(plugin) {
  14250. this.result.lastPlugin = plugin;
  14251. try {
  14252. return plugin(this.result.root, this.result);
  14253. } catch (error) {
  14254. this.handleError(error, plugin);
  14255. throw error;
  14256. }
  14257. };
  14258. LazyResult.prototype.stringify = function stringify() {
  14259. if (this.stringified) return this.result;
  14260. this.stringified = true;
  14261. this.sync();
  14262. var opts = this.result.opts;
  14263. var str = _stringify3.default;
  14264. if (opts.syntax) str = opts.syntax.stringify;
  14265. if (opts.stringifier) str = opts.stringifier;
  14266. if (str.stringify) str = str.stringify;
  14267. var map = new _mapGenerator2.default(str, this.result.root, this.result.opts);
  14268. var data = map.generate();
  14269. this.result.css = data[0];
  14270. this.result.map = data[1];
  14271. return this.result;
  14272. };
  14273. _createClass(LazyResult, [{
  14274. key: 'processor',
  14275. get: function get() {
  14276. return this.result.processor;
  14277. }
  14278. /**
  14279. * Options from the {@link Processor#process} call.
  14280. * @type {processOptions}
  14281. */
  14282. }, {
  14283. key: 'opts',
  14284. get: function get() {
  14285. return this.result.opts;
  14286. }
  14287. /**
  14288. * Processes input CSS through synchronous plugins, converts `Root`
  14289. * to a CSS string and returns {@link Result#css}.
  14290. *
  14291. * This property will only work with synchronous plugins.
  14292. * If the processor contains any asynchronous plugins
  14293. * it will throw an error. This is why this method is only
  14294. * for debug purpose, you should always use {@link LazyResult#then}.
  14295. *
  14296. * @type {string}
  14297. * @see Result#css
  14298. */
  14299. }, {
  14300. key: 'css',
  14301. get: function get() {
  14302. return this.stringify().css;
  14303. }
  14304. /**
  14305. * An alias for the `css` property. Use it with syntaxes
  14306. * that generate non-CSS output.
  14307. *
  14308. * This property will only work with synchronous plugins.
  14309. * If the processor contains any asynchronous plugins
  14310. * it will throw an error. This is why this method is only
  14311. * for debug purpose, you should always use {@link LazyResult#then}.
  14312. *
  14313. * @type {string}
  14314. * @see Result#content
  14315. */
  14316. }, {
  14317. key: 'content',
  14318. get: function get() {
  14319. return this.stringify().content;
  14320. }
  14321. /**
  14322. * Processes input CSS through synchronous plugins
  14323. * and returns {@link Result#map}.
  14324. *
  14325. * This property will only work with synchronous plugins.
  14326. * If the processor contains any asynchronous plugins
  14327. * it will throw an error. This is why this method is only
  14328. * for debug purpose, you should always use {@link LazyResult#then}.
  14329. *
  14330. * @type {SourceMapGenerator}
  14331. * @see Result#map
  14332. */
  14333. }, {
  14334. key: 'map',
  14335. get: function get() {
  14336. return this.stringify().map;
  14337. }
  14338. /**
  14339. * Processes input CSS through synchronous plugins
  14340. * and returns {@link Result#root}.
  14341. *
  14342. * This property will only work with synchronous plugins. If the processor
  14343. * contains any asynchronous plugins it will throw an error.
  14344. *
  14345. * This is why this method is only for debug purpose,
  14346. * you should always use {@link LazyResult#then}.
  14347. *
  14348. * @type {Root}
  14349. * @see Result#root
  14350. */
  14351. }, {
  14352. key: 'root',
  14353. get: function get() {
  14354. return this.sync().root;
  14355. }
  14356. /**
  14357. * Processes input CSS through synchronous plugins
  14358. * and returns {@link Result#messages}.
  14359. *
  14360. * This property will only work with synchronous plugins. If the processor
  14361. * contains any asynchronous plugins it will throw an error.
  14362. *
  14363. * This is why this method is only for debug purpose,
  14364. * you should always use {@link LazyResult#then}.
  14365. *
  14366. * @type {Message[]}
  14367. * @see Result#messages
  14368. */
  14369. }, {
  14370. key: 'messages',
  14371. get: function get() {
  14372. return this.sync().messages;
  14373. }
  14374. }]);
  14375. return LazyResult;
  14376. }();
  14377. exports.default = LazyResult;
  14378. /**
  14379. * @callback onFulfilled
  14380. * @param {Result} result
  14381. */
  14382. /**
  14383. * @callback onRejected
  14384. * @param {Error} error
  14385. */
  14386. module.exports = exports['default'];
  14387. /***/ }),
  14388. /* 87 */
  14389. /***/ (function(module, exports, __webpack_require__) {
  14390. "use strict";
  14391. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  14392. var createError = __webpack_require__(88);
  14393. var parseFrontMatter = __webpack_require__(28);
  14394. var lineColumnToIndex = __webpack_require__(89);
  14395. var _require = __webpack_require__(90),
  14396. hasPragma = _require.hasPragma; // utils
  14397. var utils = __webpack_require__(95);
  14398. var isSCSS = utils.isSCSS;
  14399. var isSCSSNestedPropertyNode = utils.isSCSSNestedPropertyNode;
  14400. function parseValueNodes(nodes) {
  14401. var parenGroup = {
  14402. open: null,
  14403. close: null,
  14404. groups: [],
  14405. type: "paren_group"
  14406. };
  14407. var parenGroupStack = [parenGroup];
  14408. var rootParenGroup = parenGroup;
  14409. var commaGroup = {
  14410. groups: [],
  14411. type: "comma_group"
  14412. };
  14413. var commaGroupStack = [commaGroup];
  14414. for (var i = 0; i < nodes.length; ++i) {
  14415. var node = nodes[i];
  14416. var isUnquotedDataURLCall = node.type === "func" && node.value === "url" && node.group && node.group.groups && node.group.groups[0] && node.group.groups[0].groups && node.group.groups[0].groups.length > 2 && node.group.groups[0].groups[0].type === "word" && node.group.groups[0].groups[0].value === "data" && node.group.groups[0].groups[1].type === "colon" && node.group.groups[0].groups[1].value === ":";
  14417. if (isUnquotedDataURLCall) {
  14418. node.group.groups = [stringifyGroup(node)];
  14419. }
  14420. if (node.type === "paren" && node.value === "(") {
  14421. parenGroup = {
  14422. open: node,
  14423. close: null,
  14424. groups: [],
  14425. type: "paren_group"
  14426. };
  14427. parenGroupStack.push(parenGroup);
  14428. commaGroup = {
  14429. groups: [],
  14430. type: "comma_group"
  14431. };
  14432. commaGroupStack.push(commaGroup);
  14433. } else if (node.type === "paren" && node.value === ")") {
  14434. if (commaGroup.groups.length) {
  14435. parenGroup.groups.push(commaGroup);
  14436. }
  14437. parenGroup.close = node;
  14438. if (commaGroupStack.length === 1) {
  14439. throw new Error("Unbalanced parenthesis");
  14440. }
  14441. commaGroupStack.pop();
  14442. commaGroup = commaGroupStack[commaGroupStack.length - 1];
  14443. commaGroup.groups.push(parenGroup);
  14444. parenGroupStack.pop();
  14445. parenGroup = parenGroupStack[parenGroupStack.length - 1];
  14446. } else if (node.type === "comma") {
  14447. parenGroup.groups.push(commaGroup);
  14448. commaGroup = {
  14449. groups: [],
  14450. type: "comma_group"
  14451. };
  14452. commaGroupStack[commaGroupStack.length - 1] = commaGroup;
  14453. } else {
  14454. commaGroup.groups.push(node);
  14455. }
  14456. }
  14457. if (commaGroup.groups.length > 0) {
  14458. parenGroup.groups.push(commaGroup);
  14459. }
  14460. return rootParenGroup;
  14461. }
  14462. function stringifyGroup(node) {
  14463. if (node.group) {
  14464. return stringifyGroup(node.group);
  14465. }
  14466. if (node.groups) {
  14467. return node.groups.reduce(function (previousValue, currentValue, index) {
  14468. return previousValue + stringifyGroup(currentValue) + (currentValue.type === "comma_group" && index !== node.groups.length - 1 ? "," : "");
  14469. }, "");
  14470. }
  14471. var before = node.raws && node.raws.before ? node.raws.before : "";
  14472. var value = node.value ? node.value : "";
  14473. var unit = node.unit ? node.unit : "";
  14474. var after = node.raws && node.raws.after ? node.raws.after : "";
  14475. return before + value + unit + after;
  14476. }
  14477. function flattenGroups(node) {
  14478. if (node.type === "paren_group" && !node.open && !node.close && node.groups.length === 1) {
  14479. return flattenGroups(node.groups[0]);
  14480. }
  14481. if (node.type === "comma_group" && node.groups.length === 1) {
  14482. return flattenGroups(node.groups[0]);
  14483. }
  14484. if (node.type === "paren_group" || node.type === "comma_group") {
  14485. return Object.assign({}, node, {
  14486. groups: node.groups.map(flattenGroups)
  14487. });
  14488. }
  14489. return node;
  14490. }
  14491. function addTypePrefix(node, prefix) {
  14492. if (node && _typeof(node) === "object") {
  14493. delete node.parent;
  14494. for (var key in node) {
  14495. addTypePrefix(node[key], prefix);
  14496. if (key === "type" && typeof node[key] === "string") {
  14497. if (!node[key].startsWith(prefix)) {
  14498. node[key] = prefix + node[key];
  14499. }
  14500. }
  14501. }
  14502. }
  14503. return node;
  14504. }
  14505. function addMissingType(node) {
  14506. if (node && _typeof(node) === "object") {
  14507. delete node.parent;
  14508. for (var key in node) {
  14509. addMissingType(node[key]);
  14510. }
  14511. if (!Array.isArray(node) && node.value && !node.type) {
  14512. node.type = "unknown";
  14513. }
  14514. }
  14515. return node;
  14516. }
  14517. function parseNestedValue(node) {
  14518. if (node && _typeof(node) === "object") {
  14519. delete node.parent;
  14520. for (var key in node) {
  14521. parseNestedValue(node[key]);
  14522. if (key === "nodes") {
  14523. node.group = flattenGroups(parseValueNodes(node[key]));
  14524. delete node[key];
  14525. }
  14526. }
  14527. }
  14528. return node;
  14529. }
  14530. function parseValue(value) {
  14531. var valueParser = __webpack_require__(97);
  14532. var result = null;
  14533. try {
  14534. result = valueParser(value, {
  14535. loose: true
  14536. }).parse();
  14537. } catch (e) {
  14538. return {
  14539. type: "value-unknown",
  14540. value: value
  14541. };
  14542. }
  14543. var parsedResult = parseNestedValue(result);
  14544. return addTypePrefix(parsedResult, "value-");
  14545. }
  14546. function parseSelector(selector) {
  14547. // If there's a comment inside of a selector, the parser tries to parse
  14548. // the content of the comment as selectors which turns it into complete
  14549. // garbage. Better to print the whole selector as-is and not try to parse
  14550. // and reformat it.
  14551. if (selector.match(/\/\/|\/\*/)) {
  14552. return {
  14553. type: "selector-unknown",
  14554. value: selector.replace(/^ +/, "").replace(/ +$/, "")
  14555. };
  14556. }
  14557. var selectorParser = __webpack_require__(106);
  14558. var result = null;
  14559. try {
  14560. selectorParser(function (result_) {
  14561. result = result_;
  14562. }).process(selector);
  14563. } catch (e) {
  14564. // Fail silently. It's better to print it as is than to try and parse it
  14565. // Note: A common failure is for SCSS nested properties. `background:
  14566. // none { color: red; }` is parsed as a NestedDeclaration by
  14567. // postcss-scss, while `background: { color: red; }` is parsed as a Rule
  14568. // with a selector ending with a colon. See:
  14569. // https://github.com/postcss/postcss-scss/issues/39
  14570. return {
  14571. type: "selector-unknown",
  14572. value: selector
  14573. };
  14574. }
  14575. return addTypePrefix(result, "selector-");
  14576. }
  14577. function parseMediaQuery(params) {
  14578. var mediaParser = __webpack_require__(111).default;
  14579. var result = null;
  14580. try {
  14581. result = mediaParser(params);
  14582. } catch (e) {
  14583. // Ignore bad media queries
  14584. return {
  14585. type: "selector-unknown",
  14586. value: params
  14587. };
  14588. }
  14589. return addTypePrefix(addMissingType(result), "media-");
  14590. }
  14591. var DEFAULT_SCSS_DIRECTIVE = /(\s*?)(!default).*$/;
  14592. var GLOBAL_SCSS_DIRECTIVE = /(\s*?)(!global).*$/;
  14593. function parseNestedCSS(node) {
  14594. if (node && _typeof(node) === "object") {
  14595. delete node.parent;
  14596. for (var key in node) {
  14597. parseNestedCSS(node[key]);
  14598. }
  14599. if (!node.type) {
  14600. return node;
  14601. }
  14602. if (!node.raws) {
  14603. node.raws = {};
  14604. }
  14605. var selector = "";
  14606. if (typeof node.selector === "string") {
  14607. selector = node.raws.selector ? node.raws.selector.scss ? node.raws.selector.scss : node.raws.selector.raw : node.selector;
  14608. if (node.raws.between && node.raws.between.trim().length > 0) {
  14609. selector += node.raws.between;
  14610. }
  14611. node.raws.selector = selector;
  14612. }
  14613. var value = "";
  14614. if (typeof node.value === "string") {
  14615. value = node.raws.value ? node.raws.value.scss ? node.raws.value.scss : node.raws.value.raw : node.value;
  14616. value = value.trim();
  14617. node.raws.value = selector;
  14618. }
  14619. var params = "";
  14620. if (typeof node.params === "string") {
  14621. params = node.raws.params ? node.raws.params.scss ? node.raws.params.scss : node.raws.params.raw : node.params;
  14622. if (node.raws.afterName && node.raws.afterName.trim().length > 0) {
  14623. params = node.raws.afterName + params;
  14624. }
  14625. if (node.raws.between && node.raws.between.trim().length > 0) {
  14626. params = params + node.raws.between;
  14627. }
  14628. params = params.trim();
  14629. node.raws.params = params;
  14630. } // Ignore LESS mixin declaration
  14631. if (selector.trim().length > 0) {
  14632. if (selector.startsWith("@") && selector.endsWith(":")) {
  14633. return node;
  14634. } // Ignore LESS mixins
  14635. if (node.mixin) {
  14636. node.selector = parseValue(selector);
  14637. return node;
  14638. } // Check on SCSS nested property
  14639. if (isSCSSNestedPropertyNode(node)) {
  14640. node.isSCSSNesterProperty = true;
  14641. }
  14642. node.selector = parseSelector(selector);
  14643. return node;
  14644. }
  14645. if (value.length > 0) {
  14646. var defaultSCSSDirectiveIndex = value.match(DEFAULT_SCSS_DIRECTIVE);
  14647. if (defaultSCSSDirectiveIndex) {
  14648. value = value.substring(0, defaultSCSSDirectiveIndex.index);
  14649. node.scssDefault = true;
  14650. if (defaultSCSSDirectiveIndex[0].trim() !== "!default") {
  14651. node.raws.scssDefault = defaultSCSSDirectiveIndex[0];
  14652. }
  14653. }
  14654. var globalSCSSDirectiveIndex = value.match(GLOBAL_SCSS_DIRECTIVE);
  14655. if (globalSCSSDirectiveIndex) {
  14656. value = value.substring(0, globalSCSSDirectiveIndex.index);
  14657. node.scssGlobal = true;
  14658. if (globalSCSSDirectiveIndex[0].trim() !== "!global") {
  14659. node.raws.scssGlobal = globalSCSSDirectiveIndex[0];
  14660. }
  14661. }
  14662. if (value.startsWith("progid:")) {
  14663. return {
  14664. type: "value-unknown",
  14665. value: value
  14666. };
  14667. }
  14668. node.value = parseValue(value);
  14669. }
  14670. if (node.type === "css-atrule" && params.length > 0) {
  14671. var name = node.name;
  14672. var lowercasedName = node.name.toLowerCase();
  14673. if (name === "warn" || name === "error") {
  14674. node.params = {
  14675. type: "media-unknown",
  14676. value: params
  14677. };
  14678. return node;
  14679. }
  14680. if (name === "extend" || name === "nest") {
  14681. node.selector = parseSelector(params);
  14682. delete node.params;
  14683. return node;
  14684. }
  14685. if (name === "at-root") {
  14686. if (/^\(\s*(without|with)\s*:[\s\S]+\)$/.test(params)) {
  14687. node.params = parseValue(params);
  14688. } else {
  14689. node.selector = parseSelector(params);
  14690. delete node.params;
  14691. }
  14692. return node;
  14693. }
  14694. if (lowercasedName === "import") {
  14695. node.params = parseValue(params);
  14696. return node;
  14697. }
  14698. if (["namespace", "supports", "if", "else", "for", "each", "while", "debug", "mixin", "include", "function", "return", "define-mixin", "add-mixin"].indexOf(name) !== -1) {
  14699. // Remove unnecessary spaces in SCSS variable arguments
  14700. params = params.replace(/(\$\S+?)\s+?\.\.\./, "$1..."); // Remove unnecessary spaces before SCSS control, mixin and function directives
  14701. params = params.replace(/^(?!if)(\S+)\s+\(/, "$1(");
  14702. node.value = parseValue(params);
  14703. delete node.params;
  14704. return node;
  14705. }
  14706. if (name === "custom-selector") {
  14707. var customSelector = params.match(/:--\S+?\s+/)[0].trim();
  14708. node.customSelector = customSelector;
  14709. node.selector = parseSelector(params.substring(customSelector.length));
  14710. delete node.params;
  14711. return node;
  14712. }
  14713. if (["media", "custom-media"].indexOf(lowercasedName) !== -1) {
  14714. if (params.includes("#{")) {
  14715. // Workaround for media at rule with scss interpolation
  14716. return {
  14717. type: "media-unknown",
  14718. value: params
  14719. };
  14720. }
  14721. node.params = parseMediaQuery(params);
  14722. return node;
  14723. }
  14724. node.params = params;
  14725. return node;
  14726. }
  14727. }
  14728. return node;
  14729. }
  14730. function parseWithParser(parser, text) {
  14731. var parsed = parseFrontMatter(text);
  14732. var frontMatter = parsed.frontMatter;
  14733. text = parsed.content;
  14734. var result;
  14735. try {
  14736. result = parser.parse(text);
  14737. } catch (e) {
  14738. if (typeof e.line !== "number") {
  14739. throw e;
  14740. }
  14741. throw createError("(postcss) " + e.name + " " + e.reason, {
  14742. start: e
  14743. });
  14744. }
  14745. result = parseNestedCSS(addTypePrefix(result, "css-"));
  14746. if (frontMatter) {
  14747. result.nodes.unshift(frontMatter);
  14748. }
  14749. return result;
  14750. }
  14751. function requireParser(isSCSSParser) {
  14752. if (isSCSSParser) {
  14753. return __webpack_require__(113);
  14754. } // TODO: Remove this hack when this issue is fixed:
  14755. // https://github.com/shellscape/postcss-less/issues/88
  14756. var LessParser = __webpack_require__(72);
  14757. LessParser.prototype.atrule = function () {
  14758. return Object.getPrototypeOf(LessParser.prototype).atrule.apply(this, arguments);
  14759. };
  14760. return __webpack_require__(182);
  14761. }
  14762. function parse(text, parsers, opts) {
  14763. var hasExplicitParserChoice = opts.parser === "less" || opts.parser === "scss";
  14764. var isSCSSParser = isSCSS(opts.parser, text);
  14765. try {
  14766. return parseWithParser(requireParser(isSCSSParser), text);
  14767. } catch (originalError) {
  14768. if (hasExplicitParserChoice) {
  14769. throw originalError;
  14770. }
  14771. try {
  14772. return parseWithParser(requireParser(!isSCSSParser), text);
  14773. } catch (_secondError) {
  14774. throw originalError;
  14775. }
  14776. }
  14777. }
  14778. var parser = {
  14779. parse: parse,
  14780. astFormat: "postcss",
  14781. hasPragma: hasPragma,
  14782. locStart: function locStart(node) {
  14783. if (node.source) {
  14784. return lineColumnToIndex(node.source.start, node.source.input.css) - 1;
  14785. }
  14786. return null;
  14787. },
  14788. locEnd: function locEnd(node) {
  14789. var endNode = node.nodes && node.nodes[node.nodes.length - 1];
  14790. if (endNode && node.source && !node.source.end) {
  14791. node = endNode;
  14792. }
  14793. if (node.source && node.source.end) {
  14794. return lineColumnToIndex(node.source.end, node.source.input.css);
  14795. }
  14796. return null;
  14797. }
  14798. }; // Export as a plugin so we can reuse the same bundle for UMD loading
  14799. module.exports = {
  14800. parsers: {
  14801. css: parser,
  14802. less: parser,
  14803. scss: parser
  14804. }
  14805. };
  14806. /***/ }),
  14807. /* 88 */
  14808. /***/ (function(module, exports, __webpack_require__) {
  14809. "use strict";
  14810. function createError(message, loc) {
  14811. // Construct an error similar to the ones thrown by Babel.
  14812. var error = new SyntaxError(message + " (" + loc.start.line + ":" + loc.start.column + ")");
  14813. error.loc = loc;
  14814. return error;
  14815. }
  14816. module.exports = createError;
  14817. /***/ }),
  14818. /* 89 */
  14819. /***/ (function(module, exports, __webpack_require__) {
  14820. "use strict";
  14821. // Super inefficient, needs to be cached.
  14822. module.exports = function (lineColumn, text) {
  14823. var index = 0;
  14824. for (var i = 0; i < lineColumn.line - 1; ++i) {
  14825. index = text.indexOf("\n", index) + 1;
  14826. if (index === -1) {
  14827. return -1;
  14828. }
  14829. }
  14830. return index + lineColumn.column;
  14831. };
  14832. /***/ }),
  14833. /* 90 */
  14834. /***/ (function(module, exports, __webpack_require__) {
  14835. "use strict";
  14836. var jsPragma = __webpack_require__(91);
  14837. var parseFrontMatter = __webpack_require__(28);
  14838. function hasPragma(text) {
  14839. return jsPragma.hasPragma(parseFrontMatter(text).content);
  14840. }
  14841. function insertPragma(text) {
  14842. var _parseFrontMatter = parseFrontMatter(text),
  14843. frontMatter = _parseFrontMatter.frontMatter,
  14844. content = _parseFrontMatter.content;
  14845. return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content);
  14846. }
  14847. module.exports = {
  14848. hasPragma: hasPragma,
  14849. insertPragma: insertPragma
  14850. };
  14851. /***/ }),
  14852. /* 91 */
  14853. /***/ (function(module, exports, __webpack_require__) {
  14854. "use strict";
  14855. var docblock = __webpack_require__(92);
  14856. function hasPragma(text) {
  14857. var pragmas = Object.keys(docblock.parse(docblock.extract(text)));
  14858. return pragmas.indexOf("prettier") !== -1 || pragmas.indexOf("format") !== -1;
  14859. }
  14860. function insertPragma(text) {
  14861. var parsedDocblock = docblock.parseWithComments(docblock.extract(text));
  14862. var pragmas = Object.assign({
  14863. format: ""
  14864. }, parsedDocblock.pragmas);
  14865. var newDocblock = docblock.print({
  14866. pragmas: pragmas,
  14867. comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines
  14868. }).replace(/(\r\n|\r)/g, "\n"); // normalise newlines (mitigate use of os.EOL by jest-docblock)
  14869. var strippedText = docblock.strip(text);
  14870. var separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
  14871. return newDocblock + separatingNewlines + strippedText;
  14872. }
  14873. module.exports = {
  14874. hasPragma: hasPragma,
  14875. insertPragma: insertPragma
  14876. };
  14877. /***/ }),
  14878. /* 92 */
  14879. /***/ (function(module, exports, __webpack_require__) {
  14880. "use strict";
  14881. Object.defineProperty(exports, '__esModule', {
  14882. value: true
  14883. });
  14884. exports.extract = extract;
  14885. exports.strip = strip;
  14886. exports.parse = parse;
  14887. exports.parseWithComments = parseWithComments;
  14888. exports.print = print;
  14889. var _detectNewline;
  14890. function _load_detectNewline() {
  14891. return _detectNewline = _interopRequireDefault(__webpack_require__(93));
  14892. }
  14893. var _os;
  14894. function _load_os() {
  14895. return _os = __webpack_require__(94);
  14896. }
  14897. function _interopRequireDefault(obj) {
  14898. return obj && obj.__esModule ? obj : {
  14899. default: obj
  14900. };
  14901. }
  14902. /**
  14903. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  14904. *
  14905. * This source code is licensed under the MIT license found in the
  14906. * LICENSE file in the root directory of this source tree.
  14907. *
  14908. *
  14909. */
  14910. var commentEndRe = /\*\/$/;
  14911. var commentStartRe = /^\/\*\*/;
  14912. var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
  14913. var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
  14914. var ltrimNewlineRe = /^(\r?\n)+/;
  14915. var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
  14916. var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
  14917. var stringStartRe = /(\r?\n|^) *\* ?/g;
  14918. function extract(contents) {
  14919. var match = contents.match(docblockRe);
  14920. return match ? match[0].trimLeft() : '';
  14921. }
  14922. function strip(contents) {
  14923. var match = contents.match(docblockRe);
  14924. return match && match[0] ? contents.substring(match[0].length) : contents;
  14925. }
  14926. function parse(docblock) {
  14927. return parseWithComments(docblock).pragmas;
  14928. }
  14929. function parseWithComments(docblock) {
  14930. var line = (0, (_detectNewline || _load_detectNewline()).default)(docblock) || (_os || _load_os()).EOL;
  14931. docblock = docblock.replace(commentStartRe, '').replace(commentEndRe, '').replace(stringStartRe, '$1'); // Normalize multi-line directives
  14932. var prev = '';
  14933. while (prev !== docblock) {
  14934. prev = docblock;
  14935. docblock = docblock.replace(multilineRe, "".concat(line, "$1 $2").concat(line));
  14936. }
  14937. docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
  14938. var result = Object.create(null);
  14939. var comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
  14940. var match;
  14941. while (match = propertyRe.exec(docblock)) {
  14942. // strip linecomments from pragmas
  14943. var nextPragma = match[2].replace(lineCommentRe, '');
  14944. if (typeof result[match[1]] === 'string' || Array.isArray(result[match[1]])) {
  14945. result[match[1]] = [].concat(result[match[1]], nextPragma);
  14946. } else {
  14947. result[match[1]] = nextPragma;
  14948. }
  14949. }
  14950. return {
  14951. comments: comments,
  14952. pragmas: result
  14953. };
  14954. }
  14955. function print(_ref) {
  14956. var _ref$comments = _ref.comments;
  14957. var comments = _ref$comments === undefined ? '' : _ref$comments;
  14958. var _ref$pragmas = _ref.pragmas;
  14959. var pragmas = _ref$pragmas === undefined ? {} : _ref$pragmas;
  14960. var line = (0, (_detectNewline || _load_detectNewline()).default)(comments) || (_os || _load_os()).EOL;
  14961. var head = '/**';
  14962. var start = ' *';
  14963. var tail = ' */';
  14964. var keys = Object.keys(pragmas);
  14965. var printedObject = keys.map(function (key) {
  14966. return printKeyValues(key, pragmas[key]);
  14967. }).reduce(function (arr, next) {
  14968. return arr.concat(next);
  14969. }, []).map(function (keyValue) {
  14970. return start + ' ' + keyValue + line;
  14971. }).join('');
  14972. if (!comments) {
  14973. if (keys.length === 0) {
  14974. return '';
  14975. }
  14976. if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
  14977. var value = pragmas[keys[0]];
  14978. return "".concat(head, " ").concat(printKeyValues(keys[0], value)[0]).concat(tail);
  14979. }
  14980. }
  14981. var printedComments = comments.split(line).map(function (textLine) {
  14982. return "".concat(start, " ").concat(textLine);
  14983. }).join(line) + line;
  14984. return head + line + (comments ? printedComments : '') + (comments && keys.length ? start + line : '') + printedObject + tail;
  14985. }
  14986. function printKeyValues(key, valueOrArray) {
  14987. return [].concat(valueOrArray).map(function (value) {
  14988. return "@".concat(key, " ").concat(value).trim();
  14989. });
  14990. }
  14991. /***/ }),
  14992. /* 93 */
  14993. /***/ (function(module, exports, __webpack_require__) {
  14994. "use strict";
  14995. module.exports = function (str) {
  14996. if (typeof str !== 'string') {
  14997. throw new TypeError('Expected a string');
  14998. }
  14999. var newlines = str.match(/(?:\r?\n)/g) || [];
  15000. if (newlines.length === 0) {
  15001. return null;
  15002. }
  15003. var crlf = newlines.filter(function (el) {
  15004. return el === '\r\n';
  15005. }).length;
  15006. var lf = newlines.length - crlf;
  15007. return crlf > lf ? '\r\n' : '\n';
  15008. };
  15009. module.exports.graceful = function (str) {
  15010. return module.exports(str) || '\n';
  15011. };
  15012. /***/ }),
  15013. /* 94 */
  15014. /***/ (function(module, exports) {
  15015. exports.endianness = function () {
  15016. return 'LE';
  15017. };
  15018. exports.hostname = function () {
  15019. if (typeof location !== 'undefined') {
  15020. return location.hostname;
  15021. } else return '';
  15022. };
  15023. exports.loadavg = function () {
  15024. return [];
  15025. };
  15026. exports.uptime = function () {
  15027. return 0;
  15028. };
  15029. exports.freemem = function () {
  15030. return Number.MAX_VALUE;
  15031. };
  15032. exports.totalmem = function () {
  15033. return Number.MAX_VALUE;
  15034. };
  15035. exports.cpus = function () {
  15036. return [];
  15037. };
  15038. exports.type = function () {
  15039. return 'Browser';
  15040. };
  15041. exports.release = function () {
  15042. if (typeof navigator !== 'undefined') {
  15043. return navigator.appVersion;
  15044. }
  15045. return '';
  15046. };
  15047. exports.networkInterfaces = exports.getNetworkInterfaces = function () {
  15048. return {};
  15049. };
  15050. exports.arch = function () {
  15051. return 'javascript';
  15052. };
  15053. exports.platform = function () {
  15054. return 'browser';
  15055. };
  15056. exports.tmpdir = exports.tmpDir = function () {
  15057. return '/tmp';
  15058. };
  15059. exports.EOL = '\n';
  15060. /***/ }),
  15061. /* 95 */
  15062. /***/ (function(module, exports, __webpack_require__) {
  15063. "use strict";
  15064. var htmlTagNames = __webpack_require__(96);
  15065. var colorAdjusterFunctions = ["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"];
  15066. function getAncestorCounter(path, typeOrTypes) {
  15067. var types = [].concat(typeOrTypes);
  15068. var counter = -1;
  15069. var ancestorNode;
  15070. while (ancestorNode = path.getParentNode(++counter)) {
  15071. if (types.indexOf(ancestorNode.type) !== -1) {
  15072. return counter;
  15073. }
  15074. }
  15075. return -1;
  15076. }
  15077. function getAncestorNode(path, typeOrTypes) {
  15078. var counter = getAncestorCounter(path, typeOrTypes);
  15079. return counter === -1 ? null : path.getParentNode(counter);
  15080. }
  15081. function getPropOfDeclNode(path) {
  15082. var declAncestorNode = getAncestorNode(path, "css-decl");
  15083. return declAncestorNode && declAncestorNode.prop && declAncestorNode.prop.toLowerCase();
  15084. }
  15085. function isSCSS(parser, text) {
  15086. var hasExplicitParserChoice = parser === "less" || parser === "scss";
  15087. var IS_POSSIBLY_SCSS = /(\w\s*: [^}:]+|#){|@import[^\n]+(url|,)/;
  15088. return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
  15089. }
  15090. function isWideKeywords(value) {
  15091. return ["initial", "inherit", "unset", "revert"].indexOf(value.toLowerCase()) !== -1;
  15092. }
  15093. function isKeyframeAtRuleKeywords(path, value) {
  15094. var atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  15095. return atRuleAncestorNode && atRuleAncestorNode.name && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].indexOf(value.toLowerCase()) !== -1;
  15096. }
  15097. function maybeToLowerCase(value) {
  15098. return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
  15099. }
  15100. function insideValueFunctionNode(path, functionName) {
  15101. var funcAncestorNode = getAncestorNode(path, "value-func");
  15102. return funcAncestorNode && funcAncestorNode.value && funcAncestorNode.value.toLowerCase() === functionName;
  15103. }
  15104. function insideICSSRuleNode(path) {
  15105. var ruleAncestorNode = getAncestorNode(path, "css-rule");
  15106. return ruleAncestorNode && ruleAncestorNode.raws && ruleAncestorNode.raws.selector && (ruleAncestorNode.raws.selector.startsWith(":import") || ruleAncestorNode.raws.selector.startsWith(":export"));
  15107. }
  15108. function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
  15109. var atRuleNames = [].concat(atRuleNameOrAtRuleNames);
  15110. var atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  15111. return atRuleAncestorNode && atRuleNames.indexOf(atRuleAncestorNode.name.toLowerCase()) !== -1;
  15112. }
  15113. function insideURLFunctionInImportAtRuleNode(path) {
  15114. var node = path.getValue();
  15115. var atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  15116. return atRuleAncestorNode && atRuleAncestorNode.name === "import" && node.groups[0].value === "url" && node.groups.length === 2;
  15117. }
  15118. function isURLFunctionNode(node) {
  15119. return node.type === "value-func" && node.value.toLowerCase() === "url";
  15120. }
  15121. function isLastNode(path, node) {
  15122. var parentNode = path.getParentNode();
  15123. if (!parentNode) {
  15124. return false;
  15125. }
  15126. var nodes = parentNode.nodes;
  15127. return nodes && nodes.indexOf(node) === nodes.length - 1;
  15128. }
  15129. function isHTMLTag(value) {
  15130. return htmlTagNames.indexOf(value.toLowerCase()) !== -1;
  15131. }
  15132. function isDetachedRulesetDeclarationNode(node) {
  15133. // If a Less file ends up being parsed with the SCSS parser, Less
  15134. // variable declarations will be parsed as atrules with names ending
  15135. // with a colon, so keep the original case then.
  15136. if (!node.selector) {
  15137. return false;
  15138. }
  15139. return typeof node.selector === "string" && /^@.+:.*$/.test(node.selector) || node.selector.value && /^@.+:.*$/.test(node.selector.value);
  15140. }
  15141. function isForKeywordNode(node) {
  15142. return node.type === "value-word" && ["from", "through", "end"].indexOf(node.value) !== -1;
  15143. }
  15144. function isIfElseKeywordNode(node) {
  15145. return node.type === "value-word" && ["and", "or", "not"].indexOf(node.value) !== -1;
  15146. }
  15147. function isEachKeywordNode(node) {
  15148. return node.type === "value-word" && node.value === "in";
  15149. }
  15150. function isMultiplicationNode(node) {
  15151. return node.type === "value-operator" && node.value === "*";
  15152. }
  15153. function isDivisionNode(node) {
  15154. return node.type === "value-operator" && node.value === "/";
  15155. }
  15156. function isAdditionNode(node) {
  15157. return node.type === "value-operator" && node.value === "+";
  15158. }
  15159. function isSubtractionNode(node) {
  15160. return node.type === "value-operator" && node.value === "-";
  15161. }
  15162. function isModuloNode(node) {
  15163. return node.type === "value-operator" && node.value === "%";
  15164. }
  15165. function isMathOperatorNode(node) {
  15166. return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
  15167. }
  15168. function isEqualityOperatorNode(node) {
  15169. return node.type === "value-word" && ["==", "!="].indexOf(node.value) !== -1;
  15170. }
  15171. function isRelationalOperatorNode(node) {
  15172. return node.type === "value-word" && ["<", ">", "<=", ">="].indexOf(node.value) !== -1;
  15173. }
  15174. function isSCSSControlDirectiveNode(node) {
  15175. return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].indexOf(node.name) !== -1;
  15176. }
  15177. function isSCSSNestedPropertyNode(node) {
  15178. if (!node.selector) {
  15179. return false;
  15180. }
  15181. return node.selector.replace(/\/\*.*?\*\//, "").replace(/\/\/.*?\n/, "").trim().endsWith(":");
  15182. }
  15183. function isDetachedRulesetCallNode(node) {
  15184. return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params);
  15185. }
  15186. function isTemplatePlaceholderNode(node) {
  15187. return node.name.startsWith("prettier-placeholder");
  15188. }
  15189. function isTemplatePropNode(node) {
  15190. return node.prop.startsWith("@prettier-placeholder");
  15191. }
  15192. function isPostcssSimpleVarNode(currentNode, nextNode) {
  15193. return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before;
  15194. }
  15195. function hasComposesNode(node) {
  15196. return node.value && node.value.type === "value-root" && node.value.group && node.value.group.type === "value-value" && node.prop.toLowerCase() === "composes";
  15197. }
  15198. function hasParensAroundNode(node) {
  15199. return node.value && node.value.group && node.value.group.group && node.value.group.group.type === "value-paren_group" && node.value.group.group.open !== null && node.value.group.group.close !== null;
  15200. }
  15201. function hasEmptyRawBefore(node) {
  15202. return node.raws && node.raws.before === "";
  15203. }
  15204. function isKeyValuePairNode(node) {
  15205. return node.type === "value-comma_group" && node.groups && node.groups[1] && node.groups[1].type === "value-colon";
  15206. }
  15207. function isKeyValuePairInParenGroupNode(node) {
  15208. return node.type === "value-paren_group" && node.groups && node.groups[0] && isKeyValuePairNode(node.groups[0]);
  15209. }
  15210. function isSCSSMapItemNode(path) {
  15211. var node = path.getValue(); // Ignore empty item (i.e. `$key: ()`)
  15212. if (node.groups.length === 0) {
  15213. return false;
  15214. }
  15215. var parentParentNode = path.getParentNode(1); // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`)
  15216. if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
  15217. return false;
  15218. }
  15219. var declNode = getAncestorNode(path, "css-decl"); // SCSS map declaration (i.e. `$map: (key: value, other-key: other-value)`)
  15220. if (declNode && declNode.prop && declNode.prop.startsWith("$")) {
  15221. return true;
  15222. } // List as value of key inside SCSS map (i.e. `$map: (key: (value other-value other-other-value))`)
  15223. if (isKeyValuePairInParenGroupNode(parentParentNode)) {
  15224. return true;
  15225. } // SCSS Map is argument of function (i.e. `func((key: value, other-key: other-value))`)
  15226. if (parentParentNode.type === "value-func") {
  15227. return true;
  15228. }
  15229. return false;
  15230. }
  15231. function isInlineValueCommentNode(node) {
  15232. return node.type === "value-comment" && node.inline;
  15233. }
  15234. function isHashNode(node) {
  15235. return node.type === "value-word" && node.value === "#";
  15236. }
  15237. function isLeftCurlyBraceNode(node) {
  15238. return node.type === "value-word" && node.value === "{";
  15239. }
  15240. function isRightCurlyBraceNode(node) {
  15241. return node.type === "value-word" && node.value === "}";
  15242. }
  15243. function isWordNode(node) {
  15244. return ["value-word", "value-atword"].indexOf(node.type) !== -1;
  15245. }
  15246. function isColonNode(node) {
  15247. return node.type === "value-colon";
  15248. }
  15249. function isMediaAndSupportsKeywords(node) {
  15250. return node.value && ["not", "and", "or"].indexOf(node.value.toLowerCase()) !== -1;
  15251. }
  15252. function isColorAdjusterFuncNode(node) {
  15253. if (node.type !== "value-func") {
  15254. return false;
  15255. }
  15256. return colorAdjusterFunctions.indexOf(node.value.toLowerCase()) !== -1;
  15257. }
  15258. module.exports = {
  15259. getAncestorCounter: getAncestorCounter,
  15260. getAncestorNode: getAncestorNode,
  15261. getPropOfDeclNode: getPropOfDeclNode,
  15262. maybeToLowerCase: maybeToLowerCase,
  15263. insideValueFunctionNode: insideValueFunctionNode,
  15264. insideICSSRuleNode: insideICSSRuleNode,
  15265. insideAtRuleNode: insideAtRuleNode,
  15266. insideURLFunctionInImportAtRuleNode: insideURLFunctionInImportAtRuleNode,
  15267. isKeyframeAtRuleKeywords: isKeyframeAtRuleKeywords,
  15268. isHTMLTag: isHTMLTag,
  15269. isWideKeywords: isWideKeywords,
  15270. isSCSS: isSCSS,
  15271. isLastNode: isLastNode,
  15272. isSCSSControlDirectiveNode: isSCSSControlDirectiveNode,
  15273. isDetachedRulesetDeclarationNode: isDetachedRulesetDeclarationNode,
  15274. isRelationalOperatorNode: isRelationalOperatorNode,
  15275. isEqualityOperatorNode: isEqualityOperatorNode,
  15276. isMultiplicationNode: isMultiplicationNode,
  15277. isDivisionNode: isDivisionNode,
  15278. isAdditionNode: isAdditionNode,
  15279. isSubtractionNode: isSubtractionNode,
  15280. isModuloNode: isModuloNode,
  15281. isMathOperatorNode: isMathOperatorNode,
  15282. isEachKeywordNode: isEachKeywordNode,
  15283. isForKeywordNode: isForKeywordNode,
  15284. isURLFunctionNode: isURLFunctionNode,
  15285. isIfElseKeywordNode: isIfElseKeywordNode,
  15286. hasComposesNode: hasComposesNode,
  15287. hasParensAroundNode: hasParensAroundNode,
  15288. hasEmptyRawBefore: hasEmptyRawBefore,
  15289. isSCSSNestedPropertyNode: isSCSSNestedPropertyNode,
  15290. isDetachedRulesetCallNode: isDetachedRulesetCallNode,
  15291. isTemplatePlaceholderNode: isTemplatePlaceholderNode,
  15292. isTemplatePropNode: isTemplatePropNode,
  15293. isPostcssSimpleVarNode: isPostcssSimpleVarNode,
  15294. isKeyValuePairNode: isKeyValuePairNode,
  15295. isKeyValuePairInParenGroupNode: isKeyValuePairInParenGroupNode,
  15296. isSCSSMapItemNode: isSCSSMapItemNode,
  15297. isInlineValueCommentNode: isInlineValueCommentNode,
  15298. isHashNode: isHashNode,
  15299. isLeftCurlyBraceNode: isLeftCurlyBraceNode,
  15300. isRightCurlyBraceNode: isRightCurlyBraceNode,
  15301. isWordNode: isWordNode,
  15302. isColonNode: isColonNode,
  15303. isMediaAndSupportsKeywords: isMediaAndSupportsKeywords,
  15304. isColorAdjusterFuncNode: isColorAdjusterFuncNode
  15305. };
  15306. /***/ }),
  15307. /* 96 */
  15308. /***/ (function(module, exports) {
  15309. module.exports = [
  15310. "a",
  15311. "abbr",
  15312. "acronym",
  15313. "address",
  15314. "applet",
  15315. "area",
  15316. "article",
  15317. "aside",
  15318. "audio",
  15319. "b",
  15320. "base",
  15321. "basefont",
  15322. "bdi",
  15323. "bdo",
  15324. "bgsound",
  15325. "big",
  15326. "blink",
  15327. "blockquote",
  15328. "body",
  15329. "br",
  15330. "button",
  15331. "canvas",
  15332. "caption",
  15333. "center",
  15334. "cite",
  15335. "code",
  15336. "col",
  15337. "colgroup",
  15338. "command",
  15339. "content",
  15340. "data",
  15341. "datalist",
  15342. "dd",
  15343. "del",
  15344. "details",
  15345. "dfn",
  15346. "dialog",
  15347. "dir",
  15348. "div",
  15349. "dl",
  15350. "dt",
  15351. "element",
  15352. "em",
  15353. "embed",
  15354. "fieldset",
  15355. "figcaption",
  15356. "figure",
  15357. "font",
  15358. "footer",
  15359. "form",
  15360. "frame",
  15361. "frameset",
  15362. "h1",
  15363. "h2",
  15364. "h3",
  15365. "h4",
  15366. "h5",
  15367. "h6",
  15368. "head",
  15369. "header",
  15370. "hgroup",
  15371. "hr",
  15372. "html",
  15373. "i",
  15374. "iframe",
  15375. "image",
  15376. "img",
  15377. "input",
  15378. "ins",
  15379. "isindex",
  15380. "kbd",
  15381. "keygen",
  15382. "label",
  15383. "legend",
  15384. "li",
  15385. "link",
  15386. "listing",
  15387. "main",
  15388. "map",
  15389. "mark",
  15390. "marquee",
  15391. "math",
  15392. "menu",
  15393. "menuitem",
  15394. "meta",
  15395. "meter",
  15396. "multicol",
  15397. "nav",
  15398. "nextid",
  15399. "nobr",
  15400. "noembed",
  15401. "noframes",
  15402. "noscript",
  15403. "object",
  15404. "ol",
  15405. "optgroup",
  15406. "option",
  15407. "output",
  15408. "p",
  15409. "param",
  15410. "picture",
  15411. "plaintext",
  15412. "pre",
  15413. "progress",
  15414. "q",
  15415. "rb",
  15416. "rbc",
  15417. "rp",
  15418. "rt",
  15419. "rtc",
  15420. "ruby",
  15421. "s",
  15422. "samp",
  15423. "script",
  15424. "section",
  15425. "select",
  15426. "shadow",
  15427. "slot",
  15428. "small",
  15429. "source",
  15430. "spacer",
  15431. "span",
  15432. "strike",
  15433. "strong",
  15434. "style",
  15435. "sub",
  15436. "summary",
  15437. "sup",
  15438. "svg",
  15439. "table",
  15440. "tbody",
  15441. "td",
  15442. "template",
  15443. "textarea",
  15444. "tfoot",
  15445. "th",
  15446. "thead",
  15447. "time",
  15448. "title",
  15449. "tr",
  15450. "track",
  15451. "tt",
  15452. "u",
  15453. "ul",
  15454. "var",
  15455. "video",
  15456. "wbr",
  15457. "xmp"
  15458. ];
  15459. /***/ }),
  15460. /* 97 */
  15461. /***/ (function(module, exports, __webpack_require__) {
  15462. "use strict";
  15463. var Parser = __webpack_require__(98);
  15464. var AtWord = __webpack_require__(31);
  15465. var Colon = __webpack_require__(32);
  15466. var Comma = __webpack_require__(33);
  15467. var Comment = __webpack_require__(34);
  15468. var Func = __webpack_require__(35);
  15469. var Num = __webpack_require__(36);
  15470. var Operator = __webpack_require__(37);
  15471. var Paren = __webpack_require__(38);
  15472. var Str = __webpack_require__(39);
  15473. var UnicodeRange = __webpack_require__(41);
  15474. var Value = __webpack_require__(30);
  15475. var Word = __webpack_require__(40);
  15476. var parser = function parser(source, options) {
  15477. return new Parser(source, options);
  15478. };
  15479. parser.atword = function (opts) {
  15480. return new AtWord(opts);
  15481. };
  15482. parser.colon = function (opts) {
  15483. opts.value = opts.value || ':';
  15484. return new Colon(opts);
  15485. };
  15486. parser.comma = function (opts) {
  15487. opts.value = opts.value || ',';
  15488. return new Comma(opts);
  15489. };
  15490. parser.comment = function (opts) {
  15491. return new Comment(opts);
  15492. };
  15493. parser.func = function (opts) {
  15494. return new Func(opts);
  15495. };
  15496. parser.number = function (opts) {
  15497. return new Num(opts);
  15498. };
  15499. parser.operator = function (opts) {
  15500. return new Operator(opts);
  15501. };
  15502. parser.paren = function (opts) {
  15503. opts.value = opts.value || '(';
  15504. return new Paren(opts);
  15505. };
  15506. parser.string = function (opts) {
  15507. opts.quote = opts.quote || '\'';
  15508. return new Str(opts);
  15509. };
  15510. parser.value = function (opts) {
  15511. return new Value(opts);
  15512. };
  15513. parser.word = function (opts) {
  15514. return new Word(opts);
  15515. };
  15516. parser.unicodeRange = function (opts) {
  15517. return new UnicodeRange(opts);
  15518. };
  15519. module.exports = parser;
  15520. /***/ }),
  15521. /* 98 */
  15522. /***/ (function(module, exports, __webpack_require__) {
  15523. "use strict";
  15524. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15525. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15526. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  15527. var Root = __webpack_require__(99);
  15528. var Value = __webpack_require__(30);
  15529. var AtWord = __webpack_require__(31);
  15530. var Colon = __webpack_require__(32);
  15531. var Comma = __webpack_require__(33);
  15532. var Comment = __webpack_require__(34);
  15533. var Func = __webpack_require__(35);
  15534. var Numbr = __webpack_require__(36);
  15535. var Operator = __webpack_require__(37);
  15536. var Paren = __webpack_require__(38);
  15537. var Str = __webpack_require__(39);
  15538. var Word = __webpack_require__(40);
  15539. var UnicodeRange = __webpack_require__(41);
  15540. var tokenize = __webpack_require__(100);
  15541. var flatten = __webpack_require__(42);
  15542. var indexesOf = __webpack_require__(43);
  15543. var uniq = __webpack_require__(44);
  15544. var ParserError = __webpack_require__(105);
  15545. function sortAscending(list) {
  15546. return list.sort(function (a, b) {
  15547. return a - b;
  15548. });
  15549. }
  15550. module.exports =
  15551. /*#__PURE__*/
  15552. function () {
  15553. function Parser(input, options) {
  15554. _classCallCheck(this, Parser);
  15555. var defaults = {
  15556. loose: false
  15557. }; // cache needs to be an array for values with more than 1 level of function nesting
  15558. this.cache = [];
  15559. this.input = input;
  15560. this.options = Object.assign({}, defaults, options);
  15561. this.position = 0; // we'll use this to keep track of the paren balance
  15562. this.unbalanced = 0;
  15563. this.root = new Root();
  15564. var value = new Value();
  15565. this.root.append(value);
  15566. this.current = value;
  15567. this.tokens = tokenize(input, this.options);
  15568. }
  15569. _createClass(Parser, [{
  15570. key: "parse",
  15571. value: function parse() {
  15572. return this.loop();
  15573. }
  15574. }, {
  15575. key: "colon",
  15576. value: function colon() {
  15577. var token = this.currToken;
  15578. this.newNode(new Colon({
  15579. value: token[1],
  15580. source: {
  15581. start: {
  15582. line: token[2],
  15583. column: token[3]
  15584. },
  15585. end: {
  15586. line: token[4],
  15587. column: token[5]
  15588. }
  15589. },
  15590. sourceIndex: token[6]
  15591. }));
  15592. this.position++;
  15593. }
  15594. }, {
  15595. key: "comma",
  15596. value: function comma() {
  15597. var token = this.currToken;
  15598. this.newNode(new Comma({
  15599. value: token[1],
  15600. source: {
  15601. start: {
  15602. line: token[2],
  15603. column: token[3]
  15604. },
  15605. end: {
  15606. line: token[4],
  15607. column: token[5]
  15608. }
  15609. },
  15610. sourceIndex: token[6]
  15611. }));
  15612. this.position++;
  15613. }
  15614. }, {
  15615. key: "comment",
  15616. value: function comment() {
  15617. var inline = false,
  15618. value = this.currToken[1].replace(/\/\*|\*\//g, ''),
  15619. node;
  15620. if (this.options.loose && value.startsWith("//")) {
  15621. value = value.substring(2);
  15622. inline = true;
  15623. }
  15624. node = new Comment({
  15625. value: value,
  15626. inline: inline,
  15627. source: {
  15628. start: {
  15629. line: this.currToken[2],
  15630. column: this.currToken[3]
  15631. },
  15632. end: {
  15633. line: this.currToken[4],
  15634. column: this.currToken[5]
  15635. }
  15636. },
  15637. sourceIndex: this.currToken[6]
  15638. });
  15639. this.newNode(node);
  15640. this.position++;
  15641. }
  15642. }, {
  15643. key: "error",
  15644. value: function error(message, token) {
  15645. throw new ParserError(message + " at line: ".concat(token[2], ", column ").concat(token[3]));
  15646. }
  15647. }, {
  15648. key: "loop",
  15649. value: function loop() {
  15650. while (this.position < this.tokens.length) {
  15651. this.parseTokens();
  15652. }
  15653. if (!this.current.last && this.spaces) {
  15654. this.current.raws.before += this.spaces;
  15655. } else if (this.spaces) {
  15656. this.current.last.raws.after += this.spaces;
  15657. }
  15658. this.spaces = '';
  15659. return this.root;
  15660. }
  15661. }, {
  15662. key: "operator",
  15663. value: function operator() {
  15664. // if a +|- operator is followed by a non-word character (. is allowed) and
  15665. // is preceded by a non-word character. (5+5)
  15666. var char = this.currToken[1],
  15667. node;
  15668. if (char === '+' || char === '-') {
  15669. // only inspect if the operator is not the first token, and we're only
  15670. // within a calc() function: the only spec-valid place for math expressions
  15671. if (!this.options.loose) {
  15672. if (this.position > 0) {
  15673. if (this.current.type === 'func' && this.current.value === 'calc') {
  15674. // allow operators to be proceeded by spaces and opening parens
  15675. if (this.prevToken[0] !== 'space' && this.prevToken[0] !== '(') {
  15676. this.error('Syntax Error', this.currToken);
  15677. } // valid: calc(1 - +2)
  15678. // invalid: calc(1 -+2)
  15679. else if (this.nextToken[0] !== 'space' && this.nextToken[0] !== 'word') {
  15680. this.error('Syntax Error', this.currToken);
  15681. } // valid: calc(1 - +2)
  15682. // valid: calc(-0.5 + 2)
  15683. // invalid: calc(1 -2)
  15684. else if (this.nextToken[0] === 'word' && this.current.last.type !== 'operator' && this.current.last.value !== '(') {
  15685. this.error('Syntax Error', this.currToken);
  15686. }
  15687. } // if we're not in a function and someone has doubled up on operators,
  15688. // or they're trying to perform a calc outside of a calc
  15689. // eg. +-4px or 5+ 5, throw an error
  15690. else if (this.nextToken[0] === 'space' || this.nextToken[0] === 'operator' || this.prevToken[0] === 'operator') {
  15691. this.error('Syntax Error', this.currToken);
  15692. }
  15693. }
  15694. }
  15695. if (!this.options.loose) {
  15696. if (this.nextToken[0] === 'word') {
  15697. return this.word();
  15698. }
  15699. } else {
  15700. if ((!this.current.nodes.length || this.current.last && this.current.last.type === 'operator') && this.nextToken[0] === 'word') {
  15701. return this.word();
  15702. }
  15703. }
  15704. }
  15705. node = new Operator({
  15706. value: this.currToken[1],
  15707. source: {
  15708. start: {
  15709. line: this.currToken[2],
  15710. column: this.currToken[3]
  15711. },
  15712. end: {
  15713. line: this.currToken[2],
  15714. column: this.currToken[3]
  15715. }
  15716. },
  15717. sourceIndex: this.currToken[4]
  15718. });
  15719. this.position++;
  15720. return this.newNode(node);
  15721. }
  15722. }, {
  15723. key: "parseTokens",
  15724. value: function parseTokens() {
  15725. switch (this.currToken[0]) {
  15726. case 'space':
  15727. this.space();
  15728. break;
  15729. case 'colon':
  15730. this.colon();
  15731. break;
  15732. case 'comma':
  15733. this.comma();
  15734. break;
  15735. case 'comment':
  15736. this.comment();
  15737. break;
  15738. case '(':
  15739. this.parenOpen();
  15740. break;
  15741. case ')':
  15742. this.parenClose();
  15743. break;
  15744. case 'atword':
  15745. case 'word':
  15746. this.word();
  15747. break;
  15748. case 'operator':
  15749. this.operator();
  15750. break;
  15751. case 'string':
  15752. this.string();
  15753. break;
  15754. case 'unicoderange':
  15755. this.unicodeRange();
  15756. break;
  15757. default:
  15758. this.word();
  15759. break;
  15760. }
  15761. }
  15762. }, {
  15763. key: "parenOpen",
  15764. value: function parenOpen() {
  15765. var unbalanced = 1,
  15766. pos = this.position + 1,
  15767. token = this.currToken,
  15768. last; // check for balanced parens
  15769. while (pos < this.tokens.length && unbalanced) {
  15770. var tkn = this.tokens[pos];
  15771. if (tkn[0] === '(') {
  15772. unbalanced++;
  15773. }
  15774. if (tkn[0] === ')') {
  15775. unbalanced--;
  15776. }
  15777. pos++;
  15778. }
  15779. if (unbalanced) {
  15780. this.error('Expected closing parenthesis', token);
  15781. } // ok, all parens are balanced. continue on
  15782. last = this.current.last;
  15783. if (last && last.type === 'func' && last.unbalanced < 0) {
  15784. last.unbalanced = 0; // ok we're ready to add parens now
  15785. this.current = last;
  15786. }
  15787. this.current.unbalanced++;
  15788. this.newNode(new Paren({
  15789. value: token[1],
  15790. source: {
  15791. start: {
  15792. line: token[2],
  15793. column: token[3]
  15794. },
  15795. end: {
  15796. line: token[4],
  15797. column: token[5]
  15798. }
  15799. },
  15800. sourceIndex: token[6]
  15801. }));
  15802. this.position++; // url functions get special treatment, and anything between the function
  15803. // parens get treated as one word, if the contents aren't not a string.
  15804. if (this.current.type === 'func' && this.current.unbalanced && this.current.value === 'url' && this.currToken[0] !== 'string' && this.currToken[0] !== ')' && !this.options.loose) {
  15805. var nextToken = this.nextToken,
  15806. value = this.currToken[1],
  15807. start = {
  15808. line: this.currToken[2],
  15809. column: this.currToken[3]
  15810. };
  15811. while (nextToken && nextToken[0] !== ')' && this.current.unbalanced) {
  15812. this.position++;
  15813. value += this.currToken[1];
  15814. nextToken = this.nextToken;
  15815. }
  15816. if (this.position !== this.tokens.length - 1) {
  15817. // skip the following word definition, or it'll be a duplicate
  15818. this.position++;
  15819. this.newNode(new Word({
  15820. value: value,
  15821. source: {
  15822. start: start,
  15823. end: {
  15824. line: this.currToken[4],
  15825. column: this.currToken[5]
  15826. }
  15827. },
  15828. sourceIndex: this.currToken[6]
  15829. }));
  15830. }
  15831. }
  15832. }
  15833. }, {
  15834. key: "parenClose",
  15835. value: function parenClose() {
  15836. var token = this.currToken;
  15837. this.newNode(new Paren({
  15838. value: token[1],
  15839. source: {
  15840. start: {
  15841. line: token[2],
  15842. column: token[3]
  15843. },
  15844. end: {
  15845. line: token[4],
  15846. column: token[5]
  15847. }
  15848. },
  15849. sourceIndex: token[6]
  15850. }));
  15851. this.position++;
  15852. if (this.position >= this.tokens.length - 1 && !this.current.unbalanced) {
  15853. return;
  15854. }
  15855. this.current.unbalanced--;
  15856. if (this.current.unbalanced < 0) {
  15857. this.error('Expected opening parenthesis', token);
  15858. }
  15859. if (!this.current.unbalanced && this.cache.length) {
  15860. this.current = this.cache.pop();
  15861. }
  15862. }
  15863. }, {
  15864. key: "space",
  15865. value: function space() {
  15866. var token = this.currToken; // Handle space before and after the selector
  15867. if (this.position === this.tokens.length - 1 || this.nextToken[0] === ',' || this.nextToken[0] === ')') {
  15868. this.current.last.raws.after += token[1];
  15869. this.position++;
  15870. } else {
  15871. this.spaces = token[1];
  15872. this.position++;
  15873. }
  15874. }
  15875. }, {
  15876. key: "unicodeRange",
  15877. value: function unicodeRange() {
  15878. var token = this.currToken;
  15879. this.newNode(new UnicodeRange({
  15880. value: token[1],
  15881. source: {
  15882. start: {
  15883. line: token[2],
  15884. column: token[3]
  15885. },
  15886. end: {
  15887. line: token[4],
  15888. column: token[5]
  15889. }
  15890. },
  15891. sourceIndex: token[6]
  15892. }));
  15893. this.position++;
  15894. }
  15895. }, {
  15896. key: "splitWord",
  15897. value: function splitWord() {
  15898. var _this = this;
  15899. var nextToken = this.nextToken,
  15900. word = this.currToken[1],
  15901. rNumber = /^[\+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][\+\-]?\d+)?/,
  15902. // treat css-like groupings differently so they can be inspected,
  15903. // but don't address them as anything but a word, but allow hex values
  15904. // to pass through.
  15905. rNoFollow = /^(?!\#([a-z0-9]+))[\#\{\}]/gi,
  15906. hasAt,
  15907. indices;
  15908. if (!rNoFollow.test(word)) {
  15909. while (nextToken && nextToken[0] === 'word') {
  15910. this.position++;
  15911. var current = this.currToken[1];
  15912. word += current;
  15913. nextToken = this.nextToken;
  15914. }
  15915. }
  15916. hasAt = indexesOf(word, '@');
  15917. indices = sortAscending(uniq(flatten([[0], hasAt])));
  15918. indices.forEach(function (ind, i) {
  15919. var index = indices[i + 1] || word.length,
  15920. value = word.slice(ind, index),
  15921. node;
  15922. if (~hasAt.indexOf(ind)) {
  15923. node = new AtWord({
  15924. value: value.slice(1),
  15925. source: {
  15926. start: {
  15927. line: _this.currToken[2],
  15928. column: _this.currToken[3] + ind
  15929. },
  15930. end: {
  15931. line: _this.currToken[4],
  15932. column: _this.currToken[3] + (index - 1)
  15933. }
  15934. },
  15935. sourceIndex: _this.currToken[6] + indices[i]
  15936. });
  15937. } else if (rNumber.test(_this.currToken[1])) {
  15938. var unit = value.replace(rNumber, '');
  15939. node = new Numbr({
  15940. value: value.replace(unit, ''),
  15941. source: {
  15942. start: {
  15943. line: _this.currToken[2],
  15944. column: _this.currToken[3] + ind
  15945. },
  15946. end: {
  15947. line: _this.currToken[4],
  15948. column: _this.currToken[3] + (index - 1)
  15949. }
  15950. },
  15951. sourceIndex: _this.currToken[6] + indices[i],
  15952. unit: unit
  15953. });
  15954. } else {
  15955. node = new (nextToken && nextToken[0] === '(' ? Func : Word)({
  15956. value: value,
  15957. source: {
  15958. start: {
  15959. line: _this.currToken[2],
  15960. column: _this.currToken[3] + ind
  15961. },
  15962. end: {
  15963. line: _this.currToken[4],
  15964. column: _this.currToken[3] + (index - 1)
  15965. }
  15966. },
  15967. sourceIndex: _this.currToken[6] + indices[i]
  15968. });
  15969. if (node.constructor.name === 'Word') {
  15970. node.isHex = /^#(.+)/.test(value);
  15971. node.isColor = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
  15972. } else {
  15973. _this.cache.push(_this.current);
  15974. }
  15975. }
  15976. _this.newNode(node);
  15977. });
  15978. this.position++;
  15979. }
  15980. }, {
  15981. key: "string",
  15982. value: function string() {
  15983. var token = this.currToken,
  15984. value = this.currToken[1],
  15985. rQuote = /^(\"|\')/,
  15986. quoted = rQuote.test(value),
  15987. quote = '',
  15988. node;
  15989. if (quoted) {
  15990. quote = value.match(rQuote)[0]; // set value to the string within the quotes
  15991. // quotes are stored in raws
  15992. value = value.slice(1, value.length - 1);
  15993. }
  15994. node = new Str({
  15995. value: value,
  15996. source: {
  15997. start: {
  15998. line: token[2],
  15999. column: token[3]
  16000. },
  16001. end: {
  16002. line: token[4],
  16003. column: token[5]
  16004. }
  16005. },
  16006. sourceIndex: token[6],
  16007. quoted: quoted
  16008. });
  16009. node.raws.quote = quote;
  16010. this.newNode(node);
  16011. this.position++;
  16012. }
  16013. }, {
  16014. key: "word",
  16015. value: function word() {
  16016. return this.splitWord();
  16017. }
  16018. }, {
  16019. key: "newNode",
  16020. value: function newNode(node) {
  16021. if (this.spaces) {
  16022. node.raws.before += this.spaces;
  16023. this.spaces = '';
  16024. }
  16025. return this.current.append(node);
  16026. }
  16027. }, {
  16028. key: "currToken",
  16029. get: function get() {
  16030. return this.tokens[this.position];
  16031. }
  16032. }, {
  16033. key: "nextToken",
  16034. get: function get() {
  16035. return this.tokens[this.position + 1];
  16036. }
  16037. }, {
  16038. key: "prevToken",
  16039. get: function get() {
  16040. return this.tokens[this.position - 1];
  16041. }
  16042. }]);
  16043. return Parser;
  16044. }();
  16045. /***/ }),
  16046. /* 99 */
  16047. /***/ (function(module, exports, __webpack_require__) {
  16048. "use strict";
  16049. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  16050. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16051. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  16052. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  16053. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  16054. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  16055. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  16056. var Container = __webpack_require__(1);
  16057. module.exports =
  16058. /*#__PURE__*/
  16059. function (_Container) {
  16060. _inherits(Root, _Container);
  16061. function Root(opts) {
  16062. var _this;
  16063. _classCallCheck(this, Root);
  16064. _this = _possibleConstructorReturn(this, _getPrototypeOf(Root).call(this, opts));
  16065. _this.type = 'root';
  16066. return _this;
  16067. }
  16068. return Root;
  16069. }(Container);
  16070. /***/ }),
  16071. /* 100 */
  16072. /***/ (function(module, exports, __webpack_require__) {
  16073. "use strict";
  16074. var openBracket = '{'.charCodeAt(0);
  16075. var closeBracket = '}'.charCodeAt(0);
  16076. var openParen = '('.charCodeAt(0);
  16077. var closeParen = ')'.charCodeAt(0);
  16078. var singleQuote = '\''.charCodeAt(0);
  16079. var doubleQuote = '"'.charCodeAt(0);
  16080. var backslash = '\\'.charCodeAt(0);
  16081. var slash = '/'.charCodeAt(0);
  16082. var period = '.'.charCodeAt(0);
  16083. var comma = ','.charCodeAt(0);
  16084. var colon = ':'.charCodeAt(0);
  16085. var asterisk = '*'.charCodeAt(0);
  16086. var minus = '-'.charCodeAt(0);
  16087. var plus = '+'.charCodeAt(0);
  16088. var pound = '#'.charCodeAt(0);
  16089. var newline = '\n'.charCodeAt(0);
  16090. var space = ' '.charCodeAt(0);
  16091. var feed = '\f'.charCodeAt(0);
  16092. var tab = '\t'.charCodeAt(0);
  16093. var cr = '\r'.charCodeAt(0);
  16094. var at = '@'.charCodeAt(0);
  16095. var lowerE = 'e'.charCodeAt(0);
  16096. var upperE = 'E'.charCodeAt(0);
  16097. var digit0 = '0'.charCodeAt(0);
  16098. var digit9 = '9'.charCodeAt(0);
  16099. var lowerU = 'u'.charCodeAt(0);
  16100. var upperU = 'U'.charCodeAt(0);
  16101. var atEnd = /[ \n\t\r\{\(\)'"\\;,/]/g;
  16102. var wordEnd = /[ \n\t\r\(\)\{\}\*:;@!&'"\+\|~>,\[\]\\]|\/(?=\*)/g;
  16103. var wordEndNum = /[ \n\t\r\(\)\{\}\*:;@!&'"\-\+\|~>,\[\]\\]|\//g;
  16104. var alphaNum = /^[a-z0-9]/i;
  16105. var unicodeRange = /^[a-f0-9?\-]/i;
  16106. var util = __webpack_require__(101);
  16107. var TokenizeError = __webpack_require__(104);
  16108. module.exports = function tokenize(input, options) {
  16109. options = options || {};
  16110. var tokens = [],
  16111. css = input.valueOf(),
  16112. length = css.length,
  16113. offset = -1,
  16114. line = 1,
  16115. pos = 0,
  16116. parentCount = 0,
  16117. isURLArg = null,
  16118. code,
  16119. next,
  16120. quote,
  16121. lines,
  16122. last,
  16123. content,
  16124. escape,
  16125. nextLine,
  16126. nextOffset,
  16127. escaped,
  16128. escapePos,
  16129. nextChar;
  16130. function unclosed(what) {
  16131. var message = util.format('Unclosed %s at line: %d, column: %d, token: %d', what, line, pos - offset, pos);
  16132. throw new TokenizeError(message);
  16133. }
  16134. function tokenizeError() {
  16135. var message = util.format('Syntax error at line: %d, column: %d, token: %d', line, pos - offset, pos);
  16136. throw new TokenizeError(message);
  16137. }
  16138. while (pos < length) {
  16139. code = css.charCodeAt(pos);
  16140. if (code === newline) {
  16141. offset = pos;
  16142. line += 1;
  16143. }
  16144. switch (code) {
  16145. case newline:
  16146. case space:
  16147. case tab:
  16148. case cr:
  16149. case feed:
  16150. next = pos;
  16151. do {
  16152. next += 1;
  16153. code = css.charCodeAt(next);
  16154. if (code === newline) {
  16155. offset = next;
  16156. line += 1;
  16157. }
  16158. } while (code === space || code === newline || code === tab || code === cr || code === feed);
  16159. tokens.push(['space', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16160. pos = next - 1;
  16161. break;
  16162. case colon:
  16163. next = pos + 1;
  16164. tokens.push(['colon', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16165. pos = next - 1;
  16166. break;
  16167. case comma:
  16168. next = pos + 1;
  16169. tokens.push(['comma', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16170. pos = next - 1;
  16171. break;
  16172. case openBracket:
  16173. tokens.push(['{', '{', line, pos - offset, line, next - offset, pos]);
  16174. break;
  16175. case closeBracket:
  16176. tokens.push(['}', '}', line, pos - offset, line, next - offset, pos]);
  16177. break;
  16178. case openParen:
  16179. parentCount++;
  16180. isURLArg = !isURLArg && parentCount === 1 && tokens.length > 0 && tokens[tokens.length - 1][0] === "word" && tokens[tokens.length - 1][1] === "url";
  16181. tokens.push(['(', '(', line, pos - offset, line, next - offset, pos]);
  16182. break;
  16183. case closeParen:
  16184. parentCount--;
  16185. isURLArg = !isURLArg && parentCount === 1;
  16186. tokens.push([')', ')', line, pos - offset, line, next - offset, pos]);
  16187. break;
  16188. case singleQuote:
  16189. case doubleQuote:
  16190. quote = code === singleQuote ? '\'' : '"';
  16191. next = pos;
  16192. do {
  16193. escaped = false;
  16194. next = css.indexOf(quote, next + 1);
  16195. if (next === -1) {
  16196. unclosed('quote', quote);
  16197. }
  16198. escapePos = next;
  16199. while (css.charCodeAt(escapePos - 1) === backslash) {
  16200. escapePos -= 1;
  16201. escaped = !escaped;
  16202. }
  16203. } while (escaped);
  16204. tokens.push(['string', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  16205. pos = next;
  16206. break;
  16207. case at:
  16208. atEnd.lastIndex = pos + 1;
  16209. atEnd.test(css);
  16210. if (atEnd.lastIndex === 0) {
  16211. next = css.length - 1;
  16212. } else {
  16213. next = atEnd.lastIndex - 2;
  16214. }
  16215. tokens.push(['atword', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  16216. pos = next;
  16217. break;
  16218. case backslash:
  16219. next = pos;
  16220. code = css.charCodeAt(next + 1);
  16221. if (escape && code !== slash && code !== space && code !== newline && code !== tab && code !== cr && code !== feed) {
  16222. next += 1;
  16223. }
  16224. tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  16225. pos = next;
  16226. break;
  16227. case plus:
  16228. case minus:
  16229. case asterisk:
  16230. next = pos + 1;
  16231. nextChar = css.slice(pos + 1, next + 1);
  16232. var prevChar = css.slice(pos - 1, pos); // if the operator is immediately followed by a word character, then we
  16233. // have a prefix of some kind, and should fall-through. eg. -webkit
  16234. // look for --* for custom variables
  16235. if (code === minus && nextChar.charCodeAt(0) === minus) {
  16236. next++;
  16237. tokens.push(['word', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16238. pos = next - 1;
  16239. break;
  16240. }
  16241. tokens.push(['operator', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16242. pos = next - 1;
  16243. break;
  16244. default:
  16245. if (code === slash && (css.charCodeAt(pos + 1) === asterisk || options.loose && !isURLArg && css.charCodeAt(pos + 1) === slash)) {
  16246. var isStandardComment = css.charCodeAt(pos + 1) === asterisk;
  16247. if (isStandardComment) {
  16248. next = css.indexOf('*/', pos + 2) + 1;
  16249. if (next === 0) {
  16250. unclosed('comment', '*/');
  16251. }
  16252. } else {
  16253. var newlinePos = css.indexOf('\n', pos + 2);
  16254. next = newlinePos !== -1 ? newlinePos - 1 : length;
  16255. }
  16256. content = css.slice(pos, next + 1);
  16257. lines = content.split('\n');
  16258. last = lines.length - 1;
  16259. if (last > 0) {
  16260. nextLine = line + last;
  16261. nextOffset = next - lines[last].length;
  16262. } else {
  16263. nextLine = line;
  16264. nextOffset = offset;
  16265. }
  16266. tokens.push(['comment', content, line, pos - offset, nextLine, next - nextOffset, pos]);
  16267. offset = nextOffset;
  16268. line = nextLine;
  16269. pos = next;
  16270. } else if (code === pound && !alphaNum.test(css.slice(pos + 1, pos + 2))) {
  16271. next = pos + 1;
  16272. tokens.push(['#', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16273. pos = next - 1;
  16274. } else if ((code === lowerU || code === upperU) && css.charCodeAt(pos + 1) === plus) {
  16275. next = pos + 2;
  16276. do {
  16277. next += 1;
  16278. code = css.charCodeAt(next);
  16279. } while (next < length && unicodeRange.test(css.slice(next, next + 1)));
  16280. tokens.push(['unicoderange', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16281. pos = next - 1;
  16282. } // catch a regular slash, that isn't a comment
  16283. else if (code === slash) {
  16284. next = pos + 1;
  16285. tokens.push(['operator', css.slice(pos, next), line, pos - offset, line, next - offset, pos]);
  16286. pos = next - 1;
  16287. } else {
  16288. var regex = wordEnd; // we're dealing with a word that starts with a number
  16289. // those get treated differently
  16290. if (code >= digit0 && code <= digit9) {
  16291. regex = wordEndNum;
  16292. }
  16293. regex.lastIndex = pos + 1;
  16294. regex.test(css);
  16295. if (regex.lastIndex === 0) {
  16296. next = css.length - 1;
  16297. } else {
  16298. next = regex.lastIndex - 2;
  16299. } // Exponential number notation with minus or plus: 1e-10, 1e+10
  16300. if (regex === wordEndNum || code === period) {
  16301. var ncode = css.charCodeAt(next),
  16302. ncode1 = css.charCodeAt(next + 1),
  16303. ncode2 = css.charCodeAt(next + 2);
  16304. if ((ncode === lowerE || ncode === upperE) && (ncode1 === minus || ncode1 === plus) && ncode2 >= digit0 && ncode2 <= digit9) {
  16305. wordEndNum.lastIndex = next + 2;
  16306. wordEndNum.test(css);
  16307. if (wordEndNum.lastIndex === 0) {
  16308. next = css.length - 1;
  16309. } else {
  16310. next = wordEndNum.lastIndex - 2;
  16311. }
  16312. }
  16313. }
  16314. tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  16315. pos = next;
  16316. }
  16317. break;
  16318. }
  16319. pos++;
  16320. }
  16321. return tokens;
  16322. };
  16323. /***/ }),
  16324. /* 101 */
  16325. /***/ (function(module, exports, __webpack_require__) {
  16326. /* WEBPACK VAR INJECTION */(function(global, process) {function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  16327. // Copyright Joyent, Inc. and other Node contributors.
  16328. //
  16329. // Permission is hereby granted, free of charge, to any person obtaining a
  16330. // copy of this software and associated documentation files (the
  16331. // "Software"), to deal in the Software without restriction, including
  16332. // without limitation the rights to use, copy, modify, merge, publish,
  16333. // distribute, sublicense, and/or sell copies of the Software, and to permit
  16334. // persons to whom the Software is furnished to do so, subject to the
  16335. // following conditions:
  16336. //
  16337. // The above copyright notice and this permission notice shall be included
  16338. // in all copies or substantial portions of the Software.
  16339. //
  16340. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16341. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16342. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  16343. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  16344. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16345. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  16346. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  16347. var formatRegExp = /%[sdj%]/g;
  16348. exports.format = function (f) {
  16349. if (!isString(f)) {
  16350. var objects = [];
  16351. for (var i = 0; i < arguments.length; i++) {
  16352. objects.push(inspect(arguments[i]));
  16353. }
  16354. return objects.join(' ');
  16355. }
  16356. var i = 1;
  16357. var args = arguments;
  16358. var len = args.length;
  16359. var str = String(f).replace(formatRegExp, function (x) {
  16360. if (x === '%%') return '%';
  16361. if (i >= len) return x;
  16362. switch (x) {
  16363. case '%s':
  16364. return String(args[i++]);
  16365. case '%d':
  16366. return Number(args[i++]);
  16367. case '%j':
  16368. try {
  16369. return JSON.stringify(args[i++]);
  16370. } catch (_) {
  16371. return '[Circular]';
  16372. }
  16373. default:
  16374. return x;
  16375. }
  16376. });
  16377. for (var x = args[i]; i < len; x = args[++i]) {
  16378. if (isNull(x) || !isObject(x)) {
  16379. str += ' ' + x;
  16380. } else {
  16381. str += ' ' + inspect(x);
  16382. }
  16383. }
  16384. return str;
  16385. }; // Mark that a method should not be used.
  16386. // Returns a modified function which warns once by default.
  16387. // If --no-deprecation is set, then it is a no-op.
  16388. exports.deprecate = function (fn, msg) {
  16389. // Allow for deprecating things in the process of starting up.
  16390. if (isUndefined(global.process)) {
  16391. return function () {
  16392. return exports.deprecate(fn, msg).apply(this, arguments);
  16393. };
  16394. }
  16395. if (process.noDeprecation === true) {
  16396. return fn;
  16397. }
  16398. var warned = false;
  16399. function deprecated() {
  16400. if (!warned) {
  16401. if (process.throwDeprecation) {
  16402. throw new Error(msg);
  16403. } else if (process.traceDeprecation) {
  16404. console.trace(msg);
  16405. } else {
  16406. console.error(msg);
  16407. }
  16408. warned = true;
  16409. }
  16410. return fn.apply(this, arguments);
  16411. }
  16412. return deprecated;
  16413. };
  16414. var debugs = {};
  16415. var debugEnviron;
  16416. exports.debuglog = function (set) {
  16417. if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';
  16418. set = set.toUpperCase();
  16419. if (!debugs[set]) {
  16420. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  16421. var pid = process.pid;
  16422. debugs[set] = function () {
  16423. var msg = exports.format.apply(exports, arguments);
  16424. console.error('%s %d: %s', set, pid, msg);
  16425. };
  16426. } else {
  16427. debugs[set] = function () {};
  16428. }
  16429. }
  16430. return debugs[set];
  16431. };
  16432. /**
  16433. * Echos the value of a value. Trys to print the value out
  16434. * in the best way possible given the different types.
  16435. *
  16436. * @param {Object} obj The object to print out.
  16437. * @param {Object} opts Optional options object that alters the output.
  16438. */
  16439. /* legacy: obj, showHidden, depth, colors*/
  16440. function inspect(obj, opts) {
  16441. // default options
  16442. var ctx = {
  16443. seen: [],
  16444. stylize: stylizeNoColor
  16445. }; // legacy...
  16446. if (arguments.length >= 3) ctx.depth = arguments[2];
  16447. if (arguments.length >= 4) ctx.colors = arguments[3];
  16448. if (isBoolean(opts)) {
  16449. // legacy...
  16450. ctx.showHidden = opts;
  16451. } else if (opts) {
  16452. // got an "options" object
  16453. exports._extend(ctx, opts);
  16454. } // set default options
  16455. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  16456. if (isUndefined(ctx.depth)) ctx.depth = 2;
  16457. if (isUndefined(ctx.colors)) ctx.colors = false;
  16458. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  16459. if (ctx.colors) ctx.stylize = stylizeWithColor;
  16460. return formatValue(ctx, obj, ctx.depth);
  16461. }
  16462. exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  16463. inspect.colors = {
  16464. 'bold': [1, 22],
  16465. 'italic': [3, 23],
  16466. 'underline': [4, 24],
  16467. 'inverse': [7, 27],
  16468. 'white': [37, 39],
  16469. 'grey': [90, 39],
  16470. 'black': [30, 39],
  16471. 'blue': [34, 39],
  16472. 'cyan': [36, 39],
  16473. 'green': [32, 39],
  16474. 'magenta': [35, 39],
  16475. 'red': [31, 39],
  16476. 'yellow': [33, 39]
  16477. }; // Don't use 'blue' not visible on cmd.exe
  16478. inspect.styles = {
  16479. 'special': 'cyan',
  16480. 'number': 'yellow',
  16481. 'boolean': 'yellow',
  16482. 'undefined': 'grey',
  16483. 'null': 'bold',
  16484. 'string': 'green',
  16485. 'date': 'magenta',
  16486. // "name": intentionally not styling
  16487. 'regexp': 'red'
  16488. };
  16489. function stylizeWithColor(str, styleType) {
  16490. var style = inspect.styles[styleType];
  16491. if (style) {
  16492. return "\x1B[" + inspect.colors[style][0] + 'm' + str + "\x1B[" + inspect.colors[style][1] + 'm';
  16493. } else {
  16494. return str;
  16495. }
  16496. }
  16497. function stylizeNoColor(str, styleType) {
  16498. return str;
  16499. }
  16500. function arrayToHash(array) {
  16501. var hash = {};
  16502. array.forEach(function (val, idx) {
  16503. hash[val] = true;
  16504. });
  16505. return hash;
  16506. }
  16507. function formatValue(ctx, value, recurseTimes) {
  16508. // Provide a hook for user-specified inspect functions.
  16509. // Check that value is an object with an inspect function on it
  16510. if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
  16511. value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
  16512. !(value.constructor && value.constructor.prototype === value)) {
  16513. var ret = value.inspect(recurseTimes, ctx);
  16514. if (!isString(ret)) {
  16515. ret = formatValue(ctx, ret, recurseTimes);
  16516. }
  16517. return ret;
  16518. } // Primitive types cannot have properties
  16519. var primitive = formatPrimitive(ctx, value);
  16520. if (primitive) {
  16521. return primitive;
  16522. } // Look up the keys of the object.
  16523. var keys = Object.keys(value);
  16524. var visibleKeys = arrayToHash(keys);
  16525. if (ctx.showHidden) {
  16526. keys = Object.getOwnPropertyNames(value);
  16527. } // IE doesn't make error fields non-enumerable
  16528. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  16529. if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  16530. return formatError(value);
  16531. } // Some type of object without properties can be shortcutted.
  16532. if (keys.length === 0) {
  16533. if (isFunction(value)) {
  16534. var name = value.name ? ': ' + value.name : '';
  16535. return ctx.stylize('[Function' + name + ']', 'special');
  16536. }
  16537. if (isRegExp(value)) {
  16538. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  16539. }
  16540. if (isDate(value)) {
  16541. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  16542. }
  16543. if (isError(value)) {
  16544. return formatError(value);
  16545. }
  16546. }
  16547. var base = '',
  16548. array = false,
  16549. braces = ['{', '}']; // Make Array say that they are Array
  16550. if (isArray(value)) {
  16551. array = true;
  16552. braces = ['[', ']'];
  16553. } // Make functions say that they are functions
  16554. if (isFunction(value)) {
  16555. var n = value.name ? ': ' + value.name : '';
  16556. base = ' [Function' + n + ']';
  16557. } // Make RegExps say that they are RegExps
  16558. if (isRegExp(value)) {
  16559. base = ' ' + RegExp.prototype.toString.call(value);
  16560. } // Make dates with properties first say the date
  16561. if (isDate(value)) {
  16562. base = ' ' + Date.prototype.toUTCString.call(value);
  16563. } // Make error with message first say the error
  16564. if (isError(value)) {
  16565. base = ' ' + formatError(value);
  16566. }
  16567. if (keys.length === 0 && (!array || value.length == 0)) {
  16568. return braces[0] + base + braces[1];
  16569. }
  16570. if (recurseTimes < 0) {
  16571. if (isRegExp(value)) {
  16572. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  16573. } else {
  16574. return ctx.stylize('[Object]', 'special');
  16575. }
  16576. }
  16577. ctx.seen.push(value);
  16578. var output;
  16579. if (array) {
  16580. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  16581. } else {
  16582. output = keys.map(function (key) {
  16583. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  16584. });
  16585. }
  16586. ctx.seen.pop();
  16587. return reduceToSingleString(output, base, braces);
  16588. }
  16589. function formatPrimitive(ctx, value) {
  16590. if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
  16591. if (isString(value)) {
  16592. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
  16593. return ctx.stylize(simple, 'string');
  16594. }
  16595. if (isNumber(value)) return ctx.stylize('' + value, 'number');
  16596. if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here.
  16597. if (isNull(value)) return ctx.stylize('null', 'null');
  16598. }
  16599. function formatError(value) {
  16600. return '[' + Error.prototype.toString.call(value) + ']';
  16601. }
  16602. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  16603. var output = [];
  16604. for (var i = 0, l = value.length; i < l; ++i) {
  16605. if (hasOwnProperty(value, String(i))) {
  16606. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
  16607. } else {
  16608. output.push('');
  16609. }
  16610. }
  16611. keys.forEach(function (key) {
  16612. if (!key.match(/^\d+$/)) {
  16613. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
  16614. }
  16615. });
  16616. return output;
  16617. }
  16618. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  16619. var name, str, desc;
  16620. desc = Object.getOwnPropertyDescriptor(value, key) || {
  16621. value: value[key]
  16622. };
  16623. if (desc.get) {
  16624. if (desc.set) {
  16625. str = ctx.stylize('[Getter/Setter]', 'special');
  16626. } else {
  16627. str = ctx.stylize('[Getter]', 'special');
  16628. }
  16629. } else {
  16630. if (desc.set) {
  16631. str = ctx.stylize('[Setter]', 'special');
  16632. }
  16633. }
  16634. if (!hasOwnProperty(visibleKeys, key)) {
  16635. name = '[' + key + ']';
  16636. }
  16637. if (!str) {
  16638. if (ctx.seen.indexOf(desc.value) < 0) {
  16639. if (isNull(recurseTimes)) {
  16640. str = formatValue(ctx, desc.value, null);
  16641. } else {
  16642. str = formatValue(ctx, desc.value, recurseTimes - 1);
  16643. }
  16644. if (str.indexOf('\n') > -1) {
  16645. if (array) {
  16646. str = str.split('\n').map(function (line) {
  16647. return ' ' + line;
  16648. }).join('\n').substr(2);
  16649. } else {
  16650. str = '\n' + str.split('\n').map(function (line) {
  16651. return ' ' + line;
  16652. }).join('\n');
  16653. }
  16654. }
  16655. } else {
  16656. str = ctx.stylize('[Circular]', 'special');
  16657. }
  16658. }
  16659. if (isUndefined(name)) {
  16660. if (array && key.match(/^\d+$/)) {
  16661. return str;
  16662. }
  16663. name = JSON.stringify('' + key);
  16664. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  16665. name = name.substr(1, name.length - 2);
  16666. name = ctx.stylize(name, 'name');
  16667. } else {
  16668. name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
  16669. name = ctx.stylize(name, 'string');
  16670. }
  16671. }
  16672. return name + ': ' + str;
  16673. }
  16674. function reduceToSingleString(output, base, braces) {
  16675. var numLinesEst = 0;
  16676. var length = output.reduce(function (prev, cur) {
  16677. numLinesEst++;
  16678. if (cur.indexOf('\n') >= 0) numLinesEst++;
  16679. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  16680. }, 0);
  16681. if (length > 60) {
  16682. return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1];
  16683. }
  16684. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  16685. } // NOTE: These type checking functions intentionally don't use `instanceof`
  16686. // because it is fragile and can be easily faked with `Object.create()`.
  16687. function isArray(ar) {
  16688. return Array.isArray(ar);
  16689. }
  16690. exports.isArray = isArray;
  16691. function isBoolean(arg) {
  16692. return typeof arg === 'boolean';
  16693. }
  16694. exports.isBoolean = isBoolean;
  16695. function isNull(arg) {
  16696. return arg === null;
  16697. }
  16698. exports.isNull = isNull;
  16699. function isNullOrUndefined(arg) {
  16700. return arg == null;
  16701. }
  16702. exports.isNullOrUndefined = isNullOrUndefined;
  16703. function isNumber(arg) {
  16704. return typeof arg === 'number';
  16705. }
  16706. exports.isNumber = isNumber;
  16707. function isString(arg) {
  16708. return typeof arg === 'string';
  16709. }
  16710. exports.isString = isString;
  16711. function isSymbol(arg) {
  16712. return _typeof(arg) === 'symbol';
  16713. }
  16714. exports.isSymbol = isSymbol;
  16715. function isUndefined(arg) {
  16716. return arg === void 0;
  16717. }
  16718. exports.isUndefined = isUndefined;
  16719. function isRegExp(re) {
  16720. return isObject(re) && objectToString(re) === '[object RegExp]';
  16721. }
  16722. exports.isRegExp = isRegExp;
  16723. function isObject(arg) {
  16724. return _typeof(arg) === 'object' && arg !== null;
  16725. }
  16726. exports.isObject = isObject;
  16727. function isDate(d) {
  16728. return isObject(d) && objectToString(d) === '[object Date]';
  16729. }
  16730. exports.isDate = isDate;
  16731. function isError(e) {
  16732. return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
  16733. }
  16734. exports.isError = isError;
  16735. function isFunction(arg) {
  16736. return typeof arg === 'function';
  16737. }
  16738. exports.isFunction = isFunction;
  16739. function isPrimitive(arg) {
  16740. return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof(arg) === 'symbol' || // ES6 symbol
  16741. typeof arg === 'undefined';
  16742. }
  16743. exports.isPrimitive = isPrimitive;
  16744. exports.isBuffer = __webpack_require__(102);
  16745. function objectToString(o) {
  16746. return Object.prototype.toString.call(o);
  16747. }
  16748. function pad(n) {
  16749. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  16750. }
  16751. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34
  16752. function timestamp() {
  16753. var d = new Date();
  16754. var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
  16755. return [d.getDate(), months[d.getMonth()], time].join(' ');
  16756. } // log is just a thin wrapper to console.log that prepends a timestamp
  16757. exports.log = function () {
  16758. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  16759. };
  16760. /**
  16761. * Inherit the prototype methods from one constructor into another.
  16762. *
  16763. * The Function.prototype.inherits from lang.js rewritten as a standalone
  16764. * function (not on Function.prototype). NOTE: If this file is to be loaded
  16765. * during bootstrapping this function needs to be rewritten using some native
  16766. * functions as prototype setup using normal JavaScript does not work as
  16767. * expected during bootstrapping (see mirror.js in r114903).
  16768. *
  16769. * @param {function} ctor Constructor function which needs to inherit the
  16770. * prototype.
  16771. * @param {function} superCtor Constructor function to inherit prototype from.
  16772. */
  16773. exports.inherits = __webpack_require__(103);
  16774. exports._extend = function (origin, add) {
  16775. // Don't do anything if add isn't an object
  16776. if (!add || !isObject(add)) return origin;
  16777. var keys = Object.keys(add);
  16778. var i = keys.length;
  16779. while (i--) {
  16780. origin[keys[i]] = add[keys[i]];
  16781. }
  16782. return origin;
  16783. };
  16784. function hasOwnProperty(obj, prop) {
  16785. return Object.prototype.hasOwnProperty.call(obj, prop);
  16786. }
  16787. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15), __webpack_require__(12)))
  16788. /***/ }),
  16789. /* 102 */
  16790. /***/ (function(module, exports) {
  16791. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  16792. module.exports = function isBuffer(arg) {
  16793. return arg && _typeof(arg) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';
  16794. };
  16795. /***/ }),
  16796. /* 103 */
  16797. /***/ (function(module, exports) {
  16798. if (typeof Object.create === 'function') {
  16799. // implementation from standard node.js 'util' module
  16800. module.exports = function inherits(ctor, superCtor) {
  16801. ctor.super_ = superCtor;
  16802. ctor.prototype = Object.create(superCtor.prototype, {
  16803. constructor: {
  16804. value: ctor,
  16805. enumerable: false,
  16806. writable: true,
  16807. configurable: true
  16808. }
  16809. });
  16810. };
  16811. } else {
  16812. // old school shim for old browsers
  16813. module.exports = function inherits(ctor, superCtor) {
  16814. ctor.super_ = superCtor;
  16815. var TempCtor = function TempCtor() {};
  16816. TempCtor.prototype = superCtor.prototype;
  16817. ctor.prototype = new TempCtor();
  16818. ctor.prototype.constructor = ctor;
  16819. };
  16820. }
  16821. /***/ }),
  16822. /* 104 */
  16823. /***/ (function(module, exports, __webpack_require__) {
  16824. "use strict";
  16825. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  16826. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16827. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  16828. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  16829. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  16830. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  16831. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  16832. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  16833. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  16834. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  16835. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  16836. var TokenizeError =
  16837. /*#__PURE__*/
  16838. function (_Error) {
  16839. _inherits(TokenizeError, _Error);
  16840. function TokenizeError(message) {
  16841. var _this;
  16842. _classCallCheck(this, TokenizeError);
  16843. _this = _possibleConstructorReturn(this, _getPrototypeOf(TokenizeError).call(this, message));
  16844. _this.name = _this.constructor.name;
  16845. _this.message = message || 'An error ocurred while tokzenizing.';
  16846. if (typeof Error.captureStackTrace === 'function') {
  16847. Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), _this.constructor);
  16848. } else {
  16849. _this.stack = new Error(message).stack;
  16850. }
  16851. return _this;
  16852. }
  16853. return TokenizeError;
  16854. }(_wrapNativeSuper(Error));
  16855. module.exports = TokenizeError;
  16856. /***/ }),
  16857. /* 105 */
  16858. /***/ (function(module, exports, __webpack_require__) {
  16859. "use strict";
  16860. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  16861. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16862. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  16863. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  16864. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  16865. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  16866. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  16867. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  16868. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  16869. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  16870. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  16871. var ParserError =
  16872. /*#__PURE__*/
  16873. function (_Error) {
  16874. _inherits(ParserError, _Error);
  16875. function ParserError(message) {
  16876. var _this;
  16877. _classCallCheck(this, ParserError);
  16878. _this = _possibleConstructorReturn(this, _getPrototypeOf(ParserError).call(this, message));
  16879. _this.name = _this.constructor.name;
  16880. _this.message = message || 'An error ocurred while parsing.';
  16881. if (typeof Error.captureStackTrace === 'function') {
  16882. Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), _this.constructor);
  16883. } else {
  16884. _this.stack = new Error(message).stack;
  16885. }
  16886. return _this;
  16887. }
  16888. return ParserError;
  16889. }(_wrapNativeSuper(Error));
  16890. module.exports = ParserError;
  16891. /***/ }),
  16892. /* 106 */
  16893. /***/ (function(module, exports, __webpack_require__) {
  16894. "use strict";
  16895. exports.__esModule = true;
  16896. var _processor = __webpack_require__(107);
  16897. var _processor2 = _interopRequireDefault(_processor);
  16898. var _attribute = __webpack_require__(53);
  16899. var _attribute2 = _interopRequireDefault(_attribute);
  16900. var _className = __webpack_require__(47);
  16901. var _className2 = _interopRequireDefault(_className);
  16902. var _combinator = __webpack_require__(55);
  16903. var _combinator2 = _interopRequireDefault(_combinator);
  16904. var _comment = __webpack_require__(48);
  16905. var _comment2 = _interopRequireDefault(_comment);
  16906. var _id = __webpack_require__(49);
  16907. var _id2 = _interopRequireDefault(_id);
  16908. var _nesting = __webpack_require__(56);
  16909. var _nesting2 = _interopRequireDefault(_nesting);
  16910. var _pseudo = __webpack_require__(52);
  16911. var _pseudo2 = _interopRequireDefault(_pseudo);
  16912. var _root = __webpack_require__(45);
  16913. var _root2 = _interopRequireDefault(_root);
  16914. var _selector = __webpack_require__(46);
  16915. var _selector2 = _interopRequireDefault(_selector);
  16916. var _string = __webpack_require__(51);
  16917. var _string2 = _interopRequireDefault(_string);
  16918. var _tag = __webpack_require__(50);
  16919. var _tag2 = _interopRequireDefault(_tag);
  16920. var _universal = __webpack_require__(54);
  16921. var _universal2 = _interopRequireDefault(_universal);
  16922. var _types = __webpack_require__(0);
  16923. var types = _interopRequireWildcard(_types);
  16924. function _interopRequireWildcard(obj) {
  16925. if (obj && obj.__esModule) {
  16926. return obj;
  16927. } else {
  16928. var newObj = {};
  16929. if (obj != null) {
  16930. for (var key in obj) {
  16931. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  16932. }
  16933. }
  16934. newObj.default = obj;
  16935. return newObj;
  16936. }
  16937. }
  16938. function _interopRequireDefault(obj) {
  16939. return obj && obj.__esModule ? obj : {
  16940. default: obj
  16941. };
  16942. }
  16943. var parser = function parser(processor) {
  16944. return new _processor2.default(processor);
  16945. };
  16946. parser.attribute = function (opts) {
  16947. return new _attribute2.default(opts);
  16948. };
  16949. parser.className = function (opts) {
  16950. return new _className2.default(opts);
  16951. };
  16952. parser.combinator = function (opts) {
  16953. return new _combinator2.default(opts);
  16954. };
  16955. parser.comment = function (opts) {
  16956. return new _comment2.default(opts);
  16957. };
  16958. parser.id = function (opts) {
  16959. return new _id2.default(opts);
  16960. };
  16961. parser.nesting = function (opts) {
  16962. return new _nesting2.default(opts);
  16963. };
  16964. parser.pseudo = function (opts) {
  16965. return new _pseudo2.default(opts);
  16966. };
  16967. parser.root = function (opts) {
  16968. return new _root2.default(opts);
  16969. };
  16970. parser.selector = function (opts) {
  16971. return new _selector2.default(opts);
  16972. };
  16973. parser.string = function (opts) {
  16974. return new _string2.default(opts);
  16975. };
  16976. parser.tag = function (opts) {
  16977. return new _tag2.default(opts);
  16978. };
  16979. parser.universal = function (opts) {
  16980. return new _universal2.default(opts);
  16981. };
  16982. Object.keys(types).forEach(function (type) {
  16983. if (type === '__esModule') {
  16984. return;
  16985. }
  16986. parser[type] = types[type]; // eslint-disable-line
  16987. });
  16988. exports.default = parser;
  16989. module.exports = exports['default'];
  16990. /***/ }),
  16991. /* 107 */
  16992. /***/ (function(module, exports, __webpack_require__) {
  16993. "use strict";
  16994. exports.__esModule = true;
  16995. var _createClass = function () {
  16996. function defineProperties(target, props) {
  16997. for (var i = 0; i < props.length; i++) {
  16998. var descriptor = props[i];
  16999. descriptor.enumerable = descriptor.enumerable || false;
  17000. descriptor.configurable = true;
  17001. if ("value" in descriptor) descriptor.writable = true;
  17002. Object.defineProperty(target, descriptor.key, descriptor);
  17003. }
  17004. }
  17005. return function (Constructor, protoProps, staticProps) {
  17006. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17007. if (staticProps) defineProperties(Constructor, staticProps);
  17008. return Constructor;
  17009. };
  17010. }();
  17011. var _parser = __webpack_require__(108);
  17012. var _parser2 = _interopRequireDefault(_parser);
  17013. function _interopRequireDefault(obj) {
  17014. return obj && obj.__esModule ? obj : {
  17015. default: obj
  17016. };
  17017. }
  17018. function _classCallCheck(instance, Constructor) {
  17019. if (!(instance instanceof Constructor)) {
  17020. throw new TypeError("Cannot call a class as a function");
  17021. }
  17022. }
  17023. var Processor = function () {
  17024. function Processor(func) {
  17025. _classCallCheck(this, Processor);
  17026. this.func = func || function noop() {};
  17027. return this;
  17028. }
  17029. Processor.prototype.process = function process(selectors) {
  17030. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17031. var input = new _parser2.default({
  17032. css: selectors,
  17033. error: function error(e) {
  17034. throw new Error(e);
  17035. },
  17036. options: options
  17037. });
  17038. this.res = input;
  17039. this.func(input);
  17040. return this;
  17041. };
  17042. _createClass(Processor, [{
  17043. key: 'result',
  17044. get: function get() {
  17045. return String(this.res);
  17046. }
  17047. }]);
  17048. return Processor;
  17049. }();
  17050. exports.default = Processor;
  17051. module.exports = exports['default'];
  17052. /***/ }),
  17053. /* 108 */
  17054. /***/ (function(module, exports, __webpack_require__) {
  17055. "use strict";
  17056. exports.__esModule = true;
  17057. var _createClass = function () {
  17058. function defineProperties(target, props) {
  17059. for (var i = 0; i < props.length; i++) {
  17060. var descriptor = props[i];
  17061. descriptor.enumerable = descriptor.enumerable || false;
  17062. descriptor.configurable = true;
  17063. if ("value" in descriptor) descriptor.writable = true;
  17064. Object.defineProperty(target, descriptor.key, descriptor);
  17065. }
  17066. }
  17067. return function (Constructor, protoProps, staticProps) {
  17068. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17069. if (staticProps) defineProperties(Constructor, staticProps);
  17070. return Constructor;
  17071. };
  17072. }();
  17073. var _flatten = __webpack_require__(42);
  17074. var _flatten2 = _interopRequireDefault(_flatten);
  17075. var _indexesOf = __webpack_require__(43);
  17076. var _indexesOf2 = _interopRequireDefault(_indexesOf);
  17077. var _uniq = __webpack_require__(44);
  17078. var _uniq2 = _interopRequireDefault(_uniq);
  17079. var _root = __webpack_require__(45);
  17080. var _root2 = _interopRequireDefault(_root);
  17081. var _selector = __webpack_require__(46);
  17082. var _selector2 = _interopRequireDefault(_selector);
  17083. var _className = __webpack_require__(47);
  17084. var _className2 = _interopRequireDefault(_className);
  17085. var _comment = __webpack_require__(48);
  17086. var _comment2 = _interopRequireDefault(_comment);
  17087. var _id = __webpack_require__(49);
  17088. var _id2 = _interopRequireDefault(_id);
  17089. var _tag = __webpack_require__(50);
  17090. var _tag2 = _interopRequireDefault(_tag);
  17091. var _string = __webpack_require__(51);
  17092. var _string2 = _interopRequireDefault(_string);
  17093. var _pseudo = __webpack_require__(52);
  17094. var _pseudo2 = _interopRequireDefault(_pseudo);
  17095. var _attribute = __webpack_require__(53);
  17096. var _attribute2 = _interopRequireDefault(_attribute);
  17097. var _universal = __webpack_require__(54);
  17098. var _universal2 = _interopRequireDefault(_universal);
  17099. var _combinator = __webpack_require__(55);
  17100. var _combinator2 = _interopRequireDefault(_combinator);
  17101. var _nesting = __webpack_require__(56);
  17102. var _nesting2 = _interopRequireDefault(_nesting);
  17103. var _sortAscending = __webpack_require__(109);
  17104. var _sortAscending2 = _interopRequireDefault(_sortAscending);
  17105. var _tokenize = __webpack_require__(110);
  17106. var _tokenize2 = _interopRequireDefault(_tokenize);
  17107. var _types = __webpack_require__(0);
  17108. var types = _interopRequireWildcard(_types);
  17109. function _interopRequireWildcard(obj) {
  17110. if (obj && obj.__esModule) {
  17111. return obj;
  17112. } else {
  17113. var newObj = {};
  17114. if (obj != null) {
  17115. for (var key in obj) {
  17116. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  17117. }
  17118. }
  17119. newObj.default = obj;
  17120. return newObj;
  17121. }
  17122. }
  17123. function _interopRequireDefault(obj) {
  17124. return obj && obj.__esModule ? obj : {
  17125. default: obj
  17126. };
  17127. }
  17128. function _classCallCheck(instance, Constructor) {
  17129. if (!(instance instanceof Constructor)) {
  17130. throw new TypeError("Cannot call a class as a function");
  17131. }
  17132. }
  17133. var Parser = function () {
  17134. function Parser(input) {
  17135. _classCallCheck(this, Parser);
  17136. this.input = input;
  17137. this.lossy = input.options.lossless === false;
  17138. this.position = 0;
  17139. this.root = new _root2.default();
  17140. var selectors = new _selector2.default();
  17141. this.root.append(selectors);
  17142. this.current = selectors;
  17143. if (this.lossy) {
  17144. this.tokens = (0, _tokenize2.default)({
  17145. safe: input.safe,
  17146. css: input.css.trim()
  17147. });
  17148. } else {
  17149. this.tokens = (0, _tokenize2.default)(input);
  17150. }
  17151. return this.loop();
  17152. }
  17153. Parser.prototype.attribute = function attribute() {
  17154. var str = '';
  17155. var attr = void 0;
  17156. var startingToken = this.currToken;
  17157. this.position++;
  17158. while (this.position < this.tokens.length && this.currToken[0] !== ']') {
  17159. str += this.tokens[this.position][1];
  17160. this.position++;
  17161. }
  17162. if (this.position === this.tokens.length && !~str.indexOf(']')) {
  17163. this.error('Expected a closing square bracket.');
  17164. }
  17165. var parts = str.split(/((?:[*~^$|]?=))([^]*)/);
  17166. var namespace = parts[0].split(/(\|)/g);
  17167. var attributeProps = {
  17168. operator: parts[1],
  17169. value: parts[2],
  17170. source: {
  17171. start: {
  17172. line: startingToken[2],
  17173. column: startingToken[3]
  17174. },
  17175. end: {
  17176. line: this.currToken[2],
  17177. column: this.currToken[3]
  17178. }
  17179. },
  17180. sourceIndex: startingToken[4]
  17181. };
  17182. if (namespace.length > 1) {
  17183. if (namespace[0] === '') {
  17184. namespace[0] = true;
  17185. }
  17186. attributeProps.attribute = this.parseValue(namespace[2]);
  17187. attributeProps.namespace = this.parseNamespace(namespace[0]);
  17188. } else {
  17189. attributeProps.attribute = this.parseValue(parts[0]);
  17190. }
  17191. attr = new _attribute2.default(attributeProps);
  17192. if (parts[2]) {
  17193. var insensitive = parts[2].split(/(\s+i\s*?)$/);
  17194. var trimmedValue = insensitive[0].trim();
  17195. attr.value = this.lossy ? trimmedValue : insensitive[0];
  17196. if (insensitive[1]) {
  17197. attr.insensitive = true;
  17198. if (!this.lossy) {
  17199. attr.raws.insensitive = insensitive[1];
  17200. }
  17201. }
  17202. attr.quoted = trimmedValue[0] === '\'' || trimmedValue[0] === '"';
  17203. attr.raws.unquoted = attr.quoted ? trimmedValue.slice(1, -1) : trimmedValue;
  17204. }
  17205. this.newNode(attr);
  17206. this.position++;
  17207. };
  17208. Parser.prototype.combinator = function combinator() {
  17209. if (this.currToken[1] === '|') {
  17210. return this.namespace();
  17211. }
  17212. var node = new _combinator2.default({
  17213. value: '',
  17214. source: {
  17215. start: {
  17216. line: this.currToken[2],
  17217. column: this.currToken[3]
  17218. },
  17219. end: {
  17220. line: this.currToken[2],
  17221. column: this.currToken[3]
  17222. }
  17223. },
  17224. sourceIndex: this.currToken[4]
  17225. });
  17226. while (this.position < this.tokens.length && this.currToken && (this.currToken[0] === 'space' || this.currToken[0] === 'combinator')) {
  17227. if (this.nextToken && this.nextToken[0] === 'combinator') {
  17228. node.spaces.before = this.parseSpace(this.currToken[1]);
  17229. node.source.start.line = this.nextToken[2];
  17230. node.source.start.column = this.nextToken[3];
  17231. node.source.end.column = this.nextToken[3];
  17232. node.source.end.line = this.nextToken[2];
  17233. node.sourceIndex = this.nextToken[4];
  17234. } else if (this.prevToken && this.prevToken[0] === 'combinator') {
  17235. node.spaces.after = this.parseSpace(this.currToken[1]);
  17236. } else if (this.currToken[0] === 'combinator') {
  17237. node.value = this.currToken[1];
  17238. } else if (this.currToken[0] === 'space') {
  17239. node.value = this.parseSpace(this.currToken[1], ' ');
  17240. }
  17241. this.position++;
  17242. }
  17243. return this.newNode(node);
  17244. };
  17245. Parser.prototype.comma = function comma() {
  17246. if (this.position === this.tokens.length - 1) {
  17247. this.root.trailingComma = true;
  17248. this.position++;
  17249. return;
  17250. }
  17251. var selectors = new _selector2.default();
  17252. this.current.parent.append(selectors);
  17253. this.current = selectors;
  17254. this.position++;
  17255. };
  17256. Parser.prototype.comment = function comment() {
  17257. var node = new _comment2.default({
  17258. value: this.currToken[1],
  17259. source: {
  17260. start: {
  17261. line: this.currToken[2],
  17262. column: this.currToken[3]
  17263. },
  17264. end: {
  17265. line: this.currToken[4],
  17266. column: this.currToken[5]
  17267. }
  17268. },
  17269. sourceIndex: this.currToken[6]
  17270. });
  17271. this.newNode(node);
  17272. this.position++;
  17273. };
  17274. Parser.prototype.error = function error(message) {
  17275. throw new this.input.error(message); // eslint-disable-line new-cap
  17276. };
  17277. Parser.prototype.missingBackslash = function missingBackslash() {
  17278. return this.error('Expected a backslash preceding the semicolon.');
  17279. };
  17280. Parser.prototype.missingParenthesis = function missingParenthesis() {
  17281. return this.error('Expected opening parenthesis.');
  17282. };
  17283. Parser.prototype.missingSquareBracket = function missingSquareBracket() {
  17284. return this.error('Expected opening square bracket.');
  17285. };
  17286. Parser.prototype.namespace = function namespace() {
  17287. var before = this.prevToken && this.prevToken[1] || true;
  17288. if (this.nextToken[0] === 'word') {
  17289. this.position++;
  17290. return this.word(before);
  17291. } else if (this.nextToken[0] === '*') {
  17292. this.position++;
  17293. return this.universal(before);
  17294. }
  17295. };
  17296. Parser.prototype.nesting = function nesting() {
  17297. this.newNode(new _nesting2.default({
  17298. value: this.currToken[1],
  17299. source: {
  17300. start: {
  17301. line: this.currToken[2],
  17302. column: this.currToken[3]
  17303. },
  17304. end: {
  17305. line: this.currToken[2],
  17306. column: this.currToken[3]
  17307. }
  17308. },
  17309. sourceIndex: this.currToken[4]
  17310. }));
  17311. this.position++;
  17312. };
  17313. Parser.prototype.parentheses = function parentheses() {
  17314. var last = this.current.last;
  17315. if (last && last.type === types.PSEUDO) {
  17316. var selector = new _selector2.default();
  17317. var cache = this.current;
  17318. last.append(selector);
  17319. this.current = selector;
  17320. var balanced = 1;
  17321. this.position++;
  17322. while (this.position < this.tokens.length && balanced) {
  17323. if (this.currToken[0] === '(') {
  17324. balanced++;
  17325. }
  17326. if (this.currToken[0] === ')') {
  17327. balanced--;
  17328. }
  17329. if (balanced) {
  17330. this.parse();
  17331. } else {
  17332. selector.parent.source.end.line = this.currToken[2];
  17333. selector.parent.source.end.column = this.currToken[3];
  17334. this.position++;
  17335. }
  17336. }
  17337. if (balanced) {
  17338. this.error('Expected closing parenthesis.');
  17339. }
  17340. this.current = cache;
  17341. } else {
  17342. var _balanced = 1;
  17343. this.position++;
  17344. last.value += '(';
  17345. while (this.position < this.tokens.length && _balanced) {
  17346. if (this.currToken[0] === '(') {
  17347. _balanced++;
  17348. }
  17349. if (this.currToken[0] === ')') {
  17350. _balanced--;
  17351. }
  17352. last.value += this.parseParenthesisToken(this.currToken);
  17353. this.position++;
  17354. }
  17355. if (_balanced) {
  17356. this.error('Expected closing parenthesis.');
  17357. }
  17358. }
  17359. };
  17360. Parser.prototype.pseudo = function pseudo() {
  17361. var _this = this;
  17362. var pseudoStr = '';
  17363. var startingToken = this.currToken;
  17364. while (this.currToken && this.currToken[0] === ':') {
  17365. pseudoStr += this.currToken[1];
  17366. this.position++;
  17367. }
  17368. if (!this.currToken) {
  17369. return this.error('Expected pseudo-class or pseudo-element');
  17370. }
  17371. if (this.currToken[0] === 'word') {
  17372. var pseudo = void 0;
  17373. this.splitWord(false, function (first, length) {
  17374. pseudoStr += first;
  17375. pseudo = new _pseudo2.default({
  17376. value: pseudoStr,
  17377. source: {
  17378. start: {
  17379. line: startingToken[2],
  17380. column: startingToken[3]
  17381. },
  17382. end: {
  17383. line: _this.currToken[4],
  17384. column: _this.currToken[5]
  17385. }
  17386. },
  17387. sourceIndex: startingToken[4]
  17388. });
  17389. _this.newNode(pseudo);
  17390. if (length > 1 && _this.nextToken && _this.nextToken[0] === '(') {
  17391. _this.error('Misplaced parenthesis.');
  17392. }
  17393. });
  17394. } else {
  17395. this.error('Unexpected "' + this.currToken[0] + '" found.');
  17396. }
  17397. };
  17398. Parser.prototype.space = function space() {
  17399. var token = this.currToken; // Handle space before and after the selector
  17400. if (this.position === 0 || this.prevToken[0] === ',' || this.prevToken[0] === '(') {
  17401. this.spaces = this.parseSpace(token[1]);
  17402. this.position++;
  17403. } else if (this.position === this.tokens.length - 1 || this.nextToken[0] === ',' || this.nextToken[0] === ')') {
  17404. this.current.last.spaces.after = this.parseSpace(token[1]);
  17405. this.position++;
  17406. } else {
  17407. this.combinator();
  17408. }
  17409. };
  17410. Parser.prototype.string = function string() {
  17411. var token = this.currToken;
  17412. this.newNode(new _string2.default({
  17413. value: this.currToken[1],
  17414. source: {
  17415. start: {
  17416. line: token[2],
  17417. column: token[3]
  17418. },
  17419. end: {
  17420. line: token[4],
  17421. column: token[5]
  17422. }
  17423. },
  17424. sourceIndex: token[6]
  17425. }));
  17426. this.position++;
  17427. };
  17428. Parser.prototype.universal = function universal(namespace) {
  17429. var nextToken = this.nextToken;
  17430. if (nextToken && nextToken[1] === '|') {
  17431. this.position++;
  17432. return this.namespace();
  17433. }
  17434. this.newNode(new _universal2.default({
  17435. value: this.currToken[1],
  17436. source: {
  17437. start: {
  17438. line: this.currToken[2],
  17439. column: this.currToken[3]
  17440. },
  17441. end: {
  17442. line: this.currToken[2],
  17443. column: this.currToken[3]
  17444. }
  17445. },
  17446. sourceIndex: this.currToken[4]
  17447. }), namespace);
  17448. this.position++;
  17449. };
  17450. Parser.prototype.splitWord = function splitWord(namespace, firstCallback) {
  17451. var _this2 = this;
  17452. var nextToken = this.nextToken;
  17453. var word = this.currToken[1];
  17454. while (nextToken && nextToken[0] === 'word') {
  17455. this.position++;
  17456. var current = this.currToken[1];
  17457. word += current;
  17458. if (current.lastIndexOf('\\') === current.length - 1) {
  17459. var next = this.nextToken;
  17460. if (next && next[0] === 'space') {
  17461. word += this.parseSpace(next[1], ' ');
  17462. this.position++;
  17463. }
  17464. }
  17465. nextToken = this.nextToken;
  17466. }
  17467. var hasClass = (0, _indexesOf2.default)(word, '.');
  17468. var hasId = (0, _indexesOf2.default)(word, '#'); // Eliminate Sass interpolations from the list of id indexes
  17469. var interpolations = (0, _indexesOf2.default)(word, '#{');
  17470. if (interpolations.length) {
  17471. hasId = hasId.filter(function (hashIndex) {
  17472. return !~interpolations.indexOf(hashIndex);
  17473. });
  17474. }
  17475. var indices = (0, _sortAscending2.default)((0, _uniq2.default)((0, _flatten2.default)([[0], hasClass, hasId])));
  17476. indices.forEach(function (ind, i) {
  17477. var index = indices[i + 1] || word.length;
  17478. var value = word.slice(ind, index);
  17479. if (i === 0 && firstCallback) {
  17480. return firstCallback.call(_this2, value, indices.length);
  17481. }
  17482. var node = void 0;
  17483. if (~hasClass.indexOf(ind)) {
  17484. node = new _className2.default({
  17485. value: value.slice(1),
  17486. source: {
  17487. start: {
  17488. line: _this2.currToken[2],
  17489. column: _this2.currToken[3] + ind
  17490. },
  17491. end: {
  17492. line: _this2.currToken[4],
  17493. column: _this2.currToken[3] + (index - 1)
  17494. }
  17495. },
  17496. sourceIndex: _this2.currToken[6] + indices[i]
  17497. });
  17498. } else if (~hasId.indexOf(ind)) {
  17499. node = new _id2.default({
  17500. value: value.slice(1),
  17501. source: {
  17502. start: {
  17503. line: _this2.currToken[2],
  17504. column: _this2.currToken[3] + ind
  17505. },
  17506. end: {
  17507. line: _this2.currToken[4],
  17508. column: _this2.currToken[3] + (index - 1)
  17509. }
  17510. },
  17511. sourceIndex: _this2.currToken[6] + indices[i]
  17512. });
  17513. } else {
  17514. node = new _tag2.default({
  17515. value: value,
  17516. source: {
  17517. start: {
  17518. line: _this2.currToken[2],
  17519. column: _this2.currToken[3] + ind
  17520. },
  17521. end: {
  17522. line: _this2.currToken[4],
  17523. column: _this2.currToken[3] + (index - 1)
  17524. }
  17525. },
  17526. sourceIndex: _this2.currToken[6] + indices[i]
  17527. });
  17528. }
  17529. _this2.newNode(node, namespace);
  17530. });
  17531. this.position++;
  17532. };
  17533. Parser.prototype.word = function word(namespace) {
  17534. var nextToken = this.nextToken;
  17535. if (nextToken && nextToken[1] === '|') {
  17536. this.position++;
  17537. return this.namespace();
  17538. }
  17539. return this.splitWord(namespace);
  17540. };
  17541. Parser.prototype.loop = function loop() {
  17542. while (this.position < this.tokens.length) {
  17543. this.parse(true);
  17544. }
  17545. return this.root;
  17546. };
  17547. Parser.prototype.parse = function parse(throwOnParenthesis) {
  17548. switch (this.currToken[0]) {
  17549. case 'space':
  17550. this.space();
  17551. break;
  17552. case 'comment':
  17553. this.comment();
  17554. break;
  17555. case '(':
  17556. this.parentheses();
  17557. break;
  17558. case ')':
  17559. if (throwOnParenthesis) {
  17560. this.missingParenthesis();
  17561. }
  17562. break;
  17563. case '[':
  17564. this.attribute();
  17565. break;
  17566. case ']':
  17567. this.missingSquareBracket();
  17568. break;
  17569. case 'at-word':
  17570. case 'word':
  17571. this.word();
  17572. break;
  17573. case ':':
  17574. this.pseudo();
  17575. break;
  17576. case ';':
  17577. this.missingBackslash();
  17578. break;
  17579. case ',':
  17580. this.comma();
  17581. break;
  17582. case '*':
  17583. this.universal();
  17584. break;
  17585. case '&':
  17586. this.nesting();
  17587. break;
  17588. case 'combinator':
  17589. this.combinator();
  17590. break;
  17591. case 'string':
  17592. this.string();
  17593. break;
  17594. }
  17595. };
  17596. /**
  17597. * Helpers
  17598. */
  17599. Parser.prototype.parseNamespace = function parseNamespace(namespace) {
  17600. if (this.lossy && typeof namespace === 'string') {
  17601. var trimmed = namespace.trim();
  17602. if (!trimmed.length) {
  17603. return true;
  17604. }
  17605. return trimmed;
  17606. }
  17607. return namespace;
  17608. };
  17609. Parser.prototype.parseSpace = function parseSpace(space, replacement) {
  17610. return this.lossy ? replacement || '' : space;
  17611. };
  17612. Parser.prototype.parseValue = function parseValue(value) {
  17613. return this.lossy && value && typeof value === 'string' ? value.trim() : value;
  17614. };
  17615. Parser.prototype.parseParenthesisToken = function parseParenthesisToken(token) {
  17616. if (!this.lossy) {
  17617. return token[1];
  17618. }
  17619. if (token[0] === 'space') {
  17620. return this.parseSpace(token[1], ' ');
  17621. }
  17622. return this.parseValue(token[1]);
  17623. };
  17624. Parser.prototype.newNode = function newNode(node, namespace) {
  17625. if (namespace) {
  17626. node.namespace = this.parseNamespace(namespace);
  17627. }
  17628. if (this.spaces) {
  17629. node.spaces.before = this.spaces;
  17630. this.spaces = '';
  17631. }
  17632. return this.current.append(node);
  17633. };
  17634. _createClass(Parser, [{
  17635. key: 'currToken',
  17636. get: function get() {
  17637. return this.tokens[this.position];
  17638. }
  17639. }, {
  17640. key: 'nextToken',
  17641. get: function get() {
  17642. return this.tokens[this.position + 1];
  17643. }
  17644. }, {
  17645. key: 'prevToken',
  17646. get: function get() {
  17647. return this.tokens[this.position - 1];
  17648. }
  17649. }]);
  17650. return Parser;
  17651. }();
  17652. exports.default = Parser;
  17653. module.exports = exports['default'];
  17654. /***/ }),
  17655. /* 109 */
  17656. /***/ (function(module, exports, __webpack_require__) {
  17657. "use strict";
  17658. exports.__esModule = true;
  17659. exports.default = sortAscending;
  17660. function sortAscending(list) {
  17661. return list.sort(function (a, b) {
  17662. return a - b;
  17663. });
  17664. }
  17665. ;
  17666. module.exports = exports["default"];
  17667. /***/ }),
  17668. /* 110 */
  17669. /***/ (function(module, exports, __webpack_require__) {
  17670. "use strict";
  17671. exports.__esModule = true;
  17672. exports.default = tokenize;
  17673. var singleQuote = 39,
  17674. doubleQuote = 34,
  17675. backslash = 92,
  17676. slash = 47,
  17677. newline = 10,
  17678. space = 32,
  17679. feed = 12,
  17680. tab = 9,
  17681. cr = 13,
  17682. plus = 43,
  17683. gt = 62,
  17684. tilde = 126,
  17685. pipe = 124,
  17686. comma = 44,
  17687. openBracket = 40,
  17688. closeBracket = 41,
  17689. openSq = 91,
  17690. closeSq = 93,
  17691. semicolon = 59,
  17692. asterisk = 42,
  17693. colon = 58,
  17694. ampersand = 38,
  17695. at = 64,
  17696. atEnd = /[ \n\t\r\{\(\)'"\\;/]/g,
  17697. wordEnd = /[ \n\t\r\(\)\*:;@!&'"\+\|~>,\[\]\\]|\/(?=\*)/g;
  17698. function tokenize(input) {
  17699. var tokens = [];
  17700. var css = input.css.valueOf();
  17701. var code = void 0,
  17702. next = void 0,
  17703. quote = void 0,
  17704. lines = void 0,
  17705. last = void 0,
  17706. content = void 0,
  17707. escape = void 0,
  17708. nextLine = void 0,
  17709. nextOffset = void 0,
  17710. escaped = void 0,
  17711. escapePos = void 0;
  17712. var length = css.length;
  17713. var offset = -1;
  17714. var line = 1;
  17715. var pos = 0;
  17716. var unclosed = function unclosed(what, end) {
  17717. if (input.safe) {
  17718. css += end;
  17719. next = css.length - 1;
  17720. } else {
  17721. throw input.error('Unclosed ' + what, line, pos - offset, pos);
  17722. }
  17723. };
  17724. while (pos < length) {
  17725. code = css.charCodeAt(pos);
  17726. if (code === newline) {
  17727. offset = pos;
  17728. line += 1;
  17729. }
  17730. switch (code) {
  17731. case newline:
  17732. case space:
  17733. case tab:
  17734. case cr:
  17735. case feed:
  17736. next = pos;
  17737. do {
  17738. next += 1;
  17739. code = css.charCodeAt(next);
  17740. if (code === newline) {
  17741. offset = next;
  17742. line += 1;
  17743. }
  17744. } while (code === space || code === newline || code === tab || code === cr || code === feed);
  17745. tokens.push(['space', css.slice(pos, next), line, pos - offset, pos]);
  17746. pos = next - 1;
  17747. break;
  17748. case plus:
  17749. case gt:
  17750. case tilde:
  17751. case pipe:
  17752. next = pos;
  17753. do {
  17754. next += 1;
  17755. code = css.charCodeAt(next);
  17756. } while (code === plus || code === gt || code === tilde || code === pipe);
  17757. tokens.push(['combinator', css.slice(pos, next), line, pos - offset, pos]);
  17758. pos = next - 1;
  17759. break;
  17760. case asterisk:
  17761. tokens.push(['*', '*', line, pos - offset, pos]);
  17762. break;
  17763. case ampersand:
  17764. tokens.push(['&', '&', line, pos - offset, pos]);
  17765. break;
  17766. case comma:
  17767. tokens.push([',', ',', line, pos - offset, pos]);
  17768. break;
  17769. case openSq:
  17770. tokens.push(['[', '[', line, pos - offset, pos]);
  17771. break;
  17772. case closeSq:
  17773. tokens.push([']', ']', line, pos - offset, pos]);
  17774. break;
  17775. case colon:
  17776. tokens.push([':', ':', line, pos - offset, pos]);
  17777. break;
  17778. case semicolon:
  17779. tokens.push([';', ';', line, pos - offset, pos]);
  17780. break;
  17781. case openBracket:
  17782. tokens.push(['(', '(', line, pos - offset, pos]);
  17783. break;
  17784. case closeBracket:
  17785. tokens.push([')', ')', line, pos - offset, pos]);
  17786. break;
  17787. case singleQuote:
  17788. case doubleQuote:
  17789. quote = code === singleQuote ? "'" : '"';
  17790. next = pos;
  17791. do {
  17792. escaped = false;
  17793. next = css.indexOf(quote, next + 1);
  17794. if (next === -1) {
  17795. unclosed('quote', quote);
  17796. }
  17797. escapePos = next;
  17798. while (css.charCodeAt(escapePos - 1) === backslash) {
  17799. escapePos -= 1;
  17800. escaped = !escaped;
  17801. }
  17802. } while (escaped);
  17803. tokens.push(['string', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  17804. pos = next;
  17805. break;
  17806. case at:
  17807. atEnd.lastIndex = pos + 1;
  17808. atEnd.test(css);
  17809. if (atEnd.lastIndex === 0) {
  17810. next = css.length - 1;
  17811. } else {
  17812. next = atEnd.lastIndex - 2;
  17813. }
  17814. tokens.push(['at-word', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  17815. pos = next;
  17816. break;
  17817. case backslash:
  17818. next = pos;
  17819. escape = true;
  17820. while (css.charCodeAt(next + 1) === backslash) {
  17821. next += 1;
  17822. escape = !escape;
  17823. }
  17824. code = css.charCodeAt(next + 1);
  17825. if (escape && code !== slash && code !== space && code !== newline && code !== tab && code !== cr && code !== feed) {
  17826. next += 1;
  17827. }
  17828. tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  17829. pos = next;
  17830. break;
  17831. default:
  17832. if (code === slash && css.charCodeAt(pos + 1) === asterisk) {
  17833. next = css.indexOf('*/', pos + 2) + 1;
  17834. if (next === 0) {
  17835. unclosed('comment', '*/');
  17836. }
  17837. content = css.slice(pos, next + 1);
  17838. lines = content.split('\n');
  17839. last = lines.length - 1;
  17840. if (last > 0) {
  17841. nextLine = line + last;
  17842. nextOffset = next - lines[last].length;
  17843. } else {
  17844. nextLine = line;
  17845. nextOffset = offset;
  17846. }
  17847. tokens.push(['comment', content, line, pos - offset, nextLine, next - nextOffset, pos]);
  17848. offset = nextOffset;
  17849. line = nextLine;
  17850. pos = next;
  17851. } else {
  17852. wordEnd.lastIndex = pos + 1;
  17853. wordEnd.test(css);
  17854. if (wordEnd.lastIndex === 0) {
  17855. next = css.length - 1;
  17856. } else {
  17857. next = wordEnd.lastIndex - 2;
  17858. }
  17859. tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset, pos]);
  17860. pos = next;
  17861. }
  17862. break;
  17863. }
  17864. pos++;
  17865. }
  17866. return tokens;
  17867. }
  17868. module.exports = exports['default'];
  17869. /***/ }),
  17870. /* 111 */
  17871. /***/ (function(module, exports, __webpack_require__) {
  17872. "use strict";
  17873. Object.defineProperty(exports, "__esModule", {
  17874. value: true
  17875. });
  17876. exports.default = parseMedia;
  17877. var _Container = __webpack_require__(57);
  17878. var _Container2 = _interopRequireDefault(_Container);
  17879. var _parsers = __webpack_require__(112);
  17880. function _interopRequireDefault(obj) {
  17881. return obj && obj.__esModule ? obj : {
  17882. default: obj
  17883. };
  17884. }
  17885. /**
  17886. * Parses a media query list into an array of nodes. A typical node signature:
  17887. * {string} node.type -- one of: 'media-query', 'media-type', 'keyword',
  17888. * 'media-feature-expression', 'media-feature', 'colon', 'value'
  17889. * {string} node.value -- the contents of a particular element, trimmed
  17890. * e.g.: `screen`, `max-width`, `1024px`
  17891. * {string} node.after -- whitespaces that follow the element
  17892. * {string} node.before -- whitespaces that precede the element
  17893. * {string} node.sourceIndex -- the index of the element in a source media
  17894. * query list, 0-based
  17895. * {object} node.parent -- a link to the parent node (a container)
  17896. *
  17897. * Some nodes (media queries, media feature expressions) contain other nodes.
  17898. * They additionally have:
  17899. * {array} node.nodes -- an array of nodes of the type described here
  17900. * {funciton} node.each -- traverses direct children of the node, calling
  17901. * a callback for each one
  17902. * {funciton} node.walk -- traverses ALL descendants of the node, calling
  17903. * a callback for each one
  17904. */
  17905. function parseMedia(value) {
  17906. return new _Container2.default({
  17907. nodes: (0, _parsers.parseMediaList)(value),
  17908. type: 'media-query-list',
  17909. value: value.trim()
  17910. });
  17911. }
  17912. /***/ }),
  17913. /* 112 */
  17914. /***/ (function(module, exports, __webpack_require__) {
  17915. "use strict";
  17916. Object.defineProperty(exports, "__esModule", {
  17917. value: true
  17918. });
  17919. exports.parseMediaFeature = parseMediaFeature;
  17920. exports.parseMediaQuery = parseMediaQuery;
  17921. exports.parseMediaList = parseMediaList;
  17922. var _Node = __webpack_require__(58);
  17923. var _Node2 = _interopRequireDefault(_Node);
  17924. var _Container = __webpack_require__(57);
  17925. var _Container2 = _interopRequireDefault(_Container);
  17926. function _interopRequireDefault(obj) {
  17927. return obj && obj.__esModule ? obj : {
  17928. default: obj
  17929. };
  17930. }
  17931. /**
  17932. * Parses a media feature expression, e.g. `max-width: 10px`, `(color)`
  17933. *
  17934. * @param {string} string - the source expression string, can be inside parens
  17935. * @param {Number} index - the index of `string` in the overall input
  17936. *
  17937. * @return {Array} an array of Nodes, the first element being a media feature,
  17938. * the secont - its value (may be missing)
  17939. */
  17940. function parseMediaFeature(string) {
  17941. var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
  17942. var modesEntered = [{
  17943. mode: 'normal',
  17944. character: null
  17945. }];
  17946. var result = [];
  17947. var lastModeIndex = 0;
  17948. var mediaFeature = '';
  17949. var colon = null;
  17950. var mediaFeatureValue = null;
  17951. var indexLocal = index;
  17952. var stringNormalized = string; // Strip trailing parens (if any), and correct the starting index
  17953. if (string[0] === '(' && string[string.length - 1] === ')') {
  17954. stringNormalized = string.substring(1, string.length - 1);
  17955. indexLocal++;
  17956. }
  17957. for (var i = 0; i < stringNormalized.length; i++) {
  17958. var character = stringNormalized[i]; // If entering/exiting a string
  17959. if (character === '\'' || character === '"') {
  17960. if (modesEntered[lastModeIndex].isCalculationEnabled === true) {
  17961. modesEntered.push({
  17962. mode: 'string',
  17963. isCalculationEnabled: false,
  17964. character: character
  17965. });
  17966. lastModeIndex++;
  17967. } else if (modesEntered[lastModeIndex].mode === 'string' && modesEntered[lastModeIndex].character === character && stringNormalized[i - 1] !== '\\') {
  17968. modesEntered.pop();
  17969. lastModeIndex--;
  17970. }
  17971. } // If entering/exiting interpolation
  17972. if (character === '{') {
  17973. modesEntered.push({
  17974. mode: 'interpolation',
  17975. isCalculationEnabled: true
  17976. });
  17977. lastModeIndex++;
  17978. } else if (character === '}') {
  17979. modesEntered.pop();
  17980. lastModeIndex--;
  17981. } // If a : is met outside of a string, function call or interpolation, than
  17982. // this : separates a media feature and a value
  17983. if (modesEntered[lastModeIndex].mode === 'normal' && character === ':') {
  17984. var mediaFeatureValueStr = stringNormalized.substring(i + 1);
  17985. mediaFeatureValue = {
  17986. type: 'value',
  17987. before: /^(\s*)/.exec(mediaFeatureValueStr)[1],
  17988. after: /(\s*)$/.exec(mediaFeatureValueStr)[1],
  17989. value: mediaFeatureValueStr.trim()
  17990. }; // +1 for the colon
  17991. mediaFeatureValue.sourceIndex = mediaFeatureValue.before.length + i + 1 + indexLocal;
  17992. colon = {
  17993. type: 'colon',
  17994. sourceIndex: i + indexLocal,
  17995. after: mediaFeatureValue.before,
  17996. value: ':'
  17997. };
  17998. break;
  17999. }
  18000. mediaFeature += character;
  18001. } // Forming a media feature node
  18002. mediaFeature = {
  18003. type: 'media-feature',
  18004. before: /^(\s*)/.exec(mediaFeature)[1],
  18005. after: /(\s*)$/.exec(mediaFeature)[1],
  18006. value: mediaFeature.trim()
  18007. };
  18008. mediaFeature.sourceIndex = mediaFeature.before.length + indexLocal;
  18009. result.push(mediaFeature);
  18010. if (colon !== null) {
  18011. colon.before = mediaFeature.after;
  18012. result.push(colon);
  18013. }
  18014. if (mediaFeatureValue !== null) {
  18015. result.push(mediaFeatureValue);
  18016. }
  18017. return result;
  18018. }
  18019. /**
  18020. * Parses a media query, e.g. `screen and (color)`, `only tv`
  18021. *
  18022. * @param {string} string - the source media query string
  18023. * @param {Number} index - the index of `string` in the overall input
  18024. *
  18025. * @return {Array} an array of Nodes and Containers
  18026. */
  18027. function parseMediaQuery(string) {
  18028. var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
  18029. var result = []; // How many timies the parser entered parens/curly braces
  18030. var localLevel = 0; // Has any keyword, media type, media feature expression or interpolation
  18031. // ('element' hereafter) started
  18032. var insideSomeValue = false;
  18033. var node = void 0;
  18034. function resetNode() {
  18035. return {
  18036. before: '',
  18037. after: '',
  18038. value: ''
  18039. };
  18040. }
  18041. node = resetNode();
  18042. for (var i = 0; i < string.length; i++) {
  18043. var character = string[i]; // If not yet entered any element
  18044. if (!insideSomeValue) {
  18045. if (character.search(/\s/) !== -1) {
  18046. // A whitespace
  18047. // Don't form 'after' yet; will do it later
  18048. node.before += character;
  18049. } else {
  18050. // Not a whitespace - entering an element
  18051. // Expression start
  18052. if (character === '(') {
  18053. node.type = 'media-feature-expression';
  18054. localLevel++;
  18055. }
  18056. node.value = character;
  18057. node.sourceIndex = index + i;
  18058. insideSomeValue = true;
  18059. }
  18060. } else {
  18061. // Already in the middle of some alement
  18062. node.value += character; // Here parens just increase localLevel and don't trigger a start of
  18063. // a media feature expression (since they can't be nested)
  18064. // Interpolation start
  18065. if (character === '{' || character === '(') {
  18066. localLevel++;
  18067. } // Interpolation/function call/media feature expression end
  18068. if (character === ')' || character === '}') {
  18069. localLevel--;
  18070. }
  18071. } // If exited all parens/curlies and the next symbol
  18072. if (insideSomeValue && localLevel === 0 && (character === ')' || i === string.length - 1 || string[i + 1].search(/\s/) !== -1)) {
  18073. if (['not', 'only', 'and'].indexOf(node.value) !== -1) {
  18074. node.type = 'keyword';
  18075. } // if it's an expression, parse its contents
  18076. if (node.type === 'media-feature-expression') {
  18077. node.nodes = parseMediaFeature(node.value, node.sourceIndex);
  18078. }
  18079. result.push(Array.isArray(node.nodes) ? new _Container2.default(node) : new _Node2.default(node));
  18080. node = resetNode();
  18081. insideSomeValue = false;
  18082. }
  18083. } // Now process the result array - to specify undefined types of the nodes
  18084. // and specify the `after` prop
  18085. for (var _i = 0; _i < result.length; _i++) {
  18086. node = result[_i];
  18087. if (_i > 0) {
  18088. result[_i - 1].after = node.before;
  18089. } // Node types. Might not be set because contains interpolation/function
  18090. // calls or fully consists of them
  18091. if (node.type === undefined) {
  18092. if (_i > 0) {
  18093. // only `and` can follow an expression
  18094. if (result[_i - 1].type === 'media-feature-expression') {
  18095. node.type = 'keyword';
  18096. continue;
  18097. } // Anything after 'only|not' is a media type
  18098. if (result[_i - 1].value === 'not' || result[_i - 1].value === 'only') {
  18099. node.type = 'media-type';
  18100. continue;
  18101. } // Anything after 'and' is an expression
  18102. if (result[_i - 1].value === 'and') {
  18103. node.type = 'media-feature-expression';
  18104. continue;
  18105. }
  18106. if (result[_i - 1].type === 'media-type') {
  18107. // if it is the last element - it might be an expression
  18108. // or 'and' depending on what is after it
  18109. if (!result[_i + 1]) {
  18110. node.type = 'media-feature-expression';
  18111. } else {
  18112. node.type = result[_i + 1].type === 'media-feature-expression' ? 'keyword' : 'media-feature-expression';
  18113. }
  18114. }
  18115. }
  18116. if (_i === 0) {
  18117. // `screen`, `fn( ... )`, `#{ ... }`. Not an expression, since then
  18118. // its type would have been set by now
  18119. if (!result[_i + 1]) {
  18120. node.type = 'media-type';
  18121. continue;
  18122. } // `screen and` or `#{...} (max-width: 10px)`
  18123. if (result[_i + 1] && (result[_i + 1].type === 'media-feature-expression' || result[_i + 1].type === 'keyword')) {
  18124. node.type = 'media-type';
  18125. continue;
  18126. }
  18127. if (result[_i + 2]) {
  18128. // `screen and (color) ...`
  18129. if (result[_i + 2].type === 'media-feature-expression') {
  18130. node.type = 'media-type';
  18131. result[_i + 1].type = 'keyword';
  18132. continue;
  18133. } // `only screen and ...`
  18134. if (result[_i + 2].type === 'keyword') {
  18135. node.type = 'keyword';
  18136. result[_i + 1].type = 'media-type';
  18137. continue;
  18138. }
  18139. }
  18140. if (result[_i + 3]) {
  18141. // `screen and (color) ...`
  18142. if (result[_i + 3].type === 'media-feature-expression') {
  18143. node.type = 'keyword';
  18144. result[_i + 1].type = 'media-type';
  18145. result[_i + 2].type = 'keyword';
  18146. continue;
  18147. }
  18148. }
  18149. }
  18150. }
  18151. }
  18152. return result;
  18153. }
  18154. /**
  18155. * Parses a media query list. Takes a possible `url()` at the start into
  18156. * account, and divides the list into media queries that are parsed separately
  18157. *
  18158. * @param {string} string - the source media query list string
  18159. *
  18160. * @return {Array} an array of Nodes/Containers
  18161. */
  18162. function parseMediaList(string) {
  18163. var result = [];
  18164. var interimIndex = 0;
  18165. var levelLocal = 0; // Check for a `url(...)` part (if it is contents of an @import rule)
  18166. var doesHaveUrl = /^(\s*)url\s*\(/.exec(string);
  18167. if (doesHaveUrl !== null) {
  18168. var i = doesHaveUrl[0].length;
  18169. var parenthesesLv = 1;
  18170. while (parenthesesLv > 0) {
  18171. var character = string[i];
  18172. if (character === '(') {
  18173. parenthesesLv++;
  18174. }
  18175. if (character === ')') {
  18176. parenthesesLv--;
  18177. }
  18178. i++;
  18179. }
  18180. result.unshift(new _Node2.default({
  18181. type: 'url',
  18182. value: string.substring(0, i).trim(),
  18183. sourceIndex: doesHaveUrl[1].length,
  18184. before: doesHaveUrl[1],
  18185. after: /^(\s*)/.exec(string.substring(i))[1]
  18186. }));
  18187. interimIndex = i;
  18188. } // Start processing the media query list
  18189. for (var _i2 = interimIndex; _i2 < string.length; _i2++) {
  18190. var _character = string[_i2]; // Dividing the media query list into comma-separated media queries
  18191. // Only count commas that are outside of any parens
  18192. // (i.e., not part of function call params list, etc.)
  18193. if (_character === '(') {
  18194. levelLocal++;
  18195. }
  18196. if (_character === ')') {
  18197. levelLocal--;
  18198. }
  18199. if (levelLocal === 0 && _character === ',') {
  18200. var _mediaQueryString = string.substring(interimIndex, _i2);
  18201. var _spaceBefore = /^(\s*)/.exec(_mediaQueryString)[1];
  18202. result.push(new _Container2.default({
  18203. type: 'media-query',
  18204. value: _mediaQueryString.trim(),
  18205. sourceIndex: interimIndex + _spaceBefore.length,
  18206. nodes: parseMediaQuery(_mediaQueryString, interimIndex),
  18207. before: _spaceBefore,
  18208. after: /(\s*)$/.exec(_mediaQueryString)[1]
  18209. }));
  18210. interimIndex = _i2 + 1;
  18211. }
  18212. }
  18213. var mediaQueryString = string.substring(interimIndex);
  18214. var spaceBefore = /^(\s*)/.exec(mediaQueryString)[1];
  18215. result.push(new _Container2.default({
  18216. type: 'media-query',
  18217. value: mediaQueryString.trim(),
  18218. sourceIndex: interimIndex + spaceBefore.length,
  18219. nodes: parseMediaQuery(mediaQueryString, interimIndex),
  18220. before: spaceBefore,
  18221. after: /(\s*)$/.exec(mediaQueryString)[1]
  18222. }));
  18223. return result;
  18224. }
  18225. /***/ }),
  18226. /* 113 */
  18227. /***/ (function(module, exports, __webpack_require__) {
  18228. "use strict";
  18229. var stringify = __webpack_require__(114);
  18230. var parse = __webpack_require__(116);
  18231. module.exports = {
  18232. parse: parse,
  18233. stringify: stringify
  18234. };
  18235. /***/ }),
  18236. /* 114 */
  18237. /***/ (function(module, exports, __webpack_require__) {
  18238. "use strict";
  18239. var ScssStringifier = __webpack_require__(115);
  18240. module.exports = function scssStringify(node, builder) {
  18241. var str = new ScssStringifier(builder);
  18242. str.stringify(node);
  18243. };
  18244. /***/ }),
  18245. /* 115 */
  18246. /***/ (function(module, exports, __webpack_require__) {
  18247. "use strict";
  18248. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  18249. function _classCallCheck(instance, Constructor) {
  18250. if (!(instance instanceof Constructor)) {
  18251. throw new TypeError("Cannot call a class as a function");
  18252. }
  18253. }
  18254. function _possibleConstructorReturn(self, call) {
  18255. if (!self) {
  18256. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18257. }
  18258. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  18259. }
  18260. function _inherits(subClass, superClass) {
  18261. if (typeof superClass !== "function" && superClass !== null) {
  18262. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  18263. }
  18264. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18265. constructor: {
  18266. value: subClass,
  18267. enumerable: false,
  18268. writable: true,
  18269. configurable: true
  18270. }
  18271. });
  18272. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18273. }
  18274. var Stringifier = __webpack_require__(17);
  18275. var ScssStringifier = function (_Stringifier) {
  18276. _inherits(ScssStringifier, _Stringifier);
  18277. function ScssStringifier() {
  18278. _classCallCheck(this, ScssStringifier);
  18279. return _possibleConstructorReturn(this, _Stringifier.apply(this, arguments));
  18280. }
  18281. ScssStringifier.prototype.comment = function comment(node) {
  18282. var left = this.raw(node, 'left', 'commentLeft');
  18283. var right = this.raw(node, 'right', 'commentRight');
  18284. if (node.raws.inline) {
  18285. var text = node.raws.text || node.text;
  18286. this.builder('//' + left + text + right, node);
  18287. } else {
  18288. this.builder('/*' + left + node.text + right + '*/', node);
  18289. }
  18290. };
  18291. ScssStringifier.prototype.decl = function decl(node, semicolon) {
  18292. if (!node.isNested) {
  18293. _Stringifier.prototype.decl.call(this, node, semicolon);
  18294. } else {
  18295. var between = this.raw(node, 'between', 'colon');
  18296. var string = node.prop + between + this.rawValue(node, 'value');
  18297. if (node.important) {
  18298. string += node.raws.important || ' !important';
  18299. }
  18300. this.builder(string + '{', node, 'start');
  18301. var after = void 0;
  18302. if (node.nodes && node.nodes.length) {
  18303. this.body(node);
  18304. after = this.raw(node, 'after');
  18305. } else {
  18306. after = this.raw(node, 'after', 'emptyBody');
  18307. }
  18308. if (after) this.builder(after);
  18309. this.builder('}', node, 'end');
  18310. }
  18311. };
  18312. ScssStringifier.prototype.rawValue = function rawValue(node, prop) {
  18313. var value = node[prop];
  18314. var raw = node.raws[prop];
  18315. if (raw && raw.value === value) {
  18316. return raw.scss ? raw.scss : raw.raw;
  18317. } else {
  18318. return value;
  18319. }
  18320. };
  18321. return ScssStringifier;
  18322. }(Stringifier);
  18323. module.exports = ScssStringifier;
  18324. /***/ }),
  18325. /* 116 */
  18326. /***/ (function(module, exports, __webpack_require__) {
  18327. "use strict";
  18328. var Input = __webpack_require__(59);
  18329. var ScssParser = __webpack_require__(131);
  18330. module.exports = function scssParse(scss, opts) {
  18331. var input = new Input(scss, opts);
  18332. var parser = new ScssParser(input);
  18333. parser.parse();
  18334. return parser.root;
  18335. };
  18336. /***/ }),
  18337. /* 117 */
  18338. /***/ (function(module, exports) {
  18339. /* (ignored) */
  18340. /***/ }),
  18341. /* 118 */
  18342. /***/ (function(module, exports) {
  18343. /* (ignored) */
  18344. /***/ }),
  18345. /* 119 */
  18346. /***/ (function(module, exports) {
  18347. /* (ignored) */
  18348. /***/ }),
  18349. /* 120 */
  18350. /***/ (function(module, exports, __webpack_require__) {
  18351. "use strict";
  18352. /* WEBPACK VAR INJECTION */(function(Buffer) {
  18353. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  18354. exports.__esModule = true;
  18355. exports.default = void 0;
  18356. var _sourceMap = _interopRequireDefault(__webpack_require__(61));
  18357. var _path = _interopRequireDefault(__webpack_require__(6));
  18358. var _fs = _interopRequireDefault(__webpack_require__(130));
  18359. function _interopRequireDefault(obj) {
  18360. return obj && obj.__esModule ? obj : {
  18361. default: obj
  18362. };
  18363. }
  18364. function fromBase64(str) {
  18365. if (Buffer) {
  18366. return Buffer.from(str, 'base64').toString();
  18367. } else {
  18368. return window.atob(str);
  18369. }
  18370. }
  18371. /**
  18372. * Source map information from input CSS.
  18373. * For example, source map after Sass compiler.
  18374. *
  18375. * This class will automatically find source map in input CSS or in file system
  18376. * near input file (according `from` option).
  18377. *
  18378. * @example
  18379. * const root = postcss.parse(css, { from: 'a.sass.css' })
  18380. * root.input.map //=> PreviousMap
  18381. */
  18382. var PreviousMap =
  18383. /*#__PURE__*/
  18384. function () {
  18385. /**
  18386. * @param {string} css Input CSS source.
  18387. * @param {processOptions} [opts] {@link Processor#process} options.
  18388. */
  18389. function PreviousMap(css, opts) {
  18390. this.loadAnnotation(css);
  18391. /**
  18392. * Was source map inlined by data-uri to input CSS.
  18393. *
  18394. * @type {boolean}
  18395. */
  18396. this.inline = this.startWith(this.annotation, 'data:');
  18397. var prev = opts.map ? opts.map.prev : undefined;
  18398. var text = this.loadMap(opts.from, prev);
  18399. if (text) this.text = text;
  18400. }
  18401. /**
  18402. * Create a instance of `SourceMapGenerator` class
  18403. * from the `source-map` library to work with source map information.
  18404. *
  18405. * It is lazy method, so it will create object only on first call
  18406. * and then it will use cache.
  18407. *
  18408. * @return {SourceMapGenerator} Object with source map information.
  18409. */
  18410. var _proto = PreviousMap.prototype;
  18411. _proto.consumer = function consumer() {
  18412. if (!this.consumerCache) {
  18413. this.consumerCache = new _sourceMap.default.SourceMapConsumer(this.text);
  18414. }
  18415. return this.consumerCache;
  18416. };
  18417. /**
  18418. * Does source map contains `sourcesContent` with input source text.
  18419. *
  18420. * @return {boolean} Is `sourcesContent` present.
  18421. */
  18422. _proto.withContent = function withContent() {
  18423. return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
  18424. };
  18425. _proto.startWith = function startWith(string, start) {
  18426. if (!string) return false;
  18427. return string.substr(0, start.length) === start;
  18428. };
  18429. _proto.loadAnnotation = function loadAnnotation(css) {
  18430. var match = css.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//);
  18431. if (match) this.annotation = match[1].trim();
  18432. };
  18433. _proto.decodeInline = function decodeInline(text) {
  18434. var baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
  18435. var baseUri = /^data:application\/json;base64,/;
  18436. var uri = 'data:application/json,';
  18437. if (this.startWith(text, uri)) {
  18438. return decodeURIComponent(text.substr(uri.length));
  18439. }
  18440. if (baseCharsetUri.test(text) || baseUri.test(text)) {
  18441. return fromBase64(text.substr(RegExp.lastMatch.length));
  18442. }
  18443. var encoding = text.match(/data:application\/json;([^,]+),/)[1];
  18444. throw new Error('Unsupported source map encoding ' + encoding);
  18445. };
  18446. _proto.loadMap = function loadMap(file, prev) {
  18447. if (prev === false) return false;
  18448. if (prev) {
  18449. if (typeof prev === 'string') {
  18450. return prev;
  18451. } else if (typeof prev === 'function') {
  18452. var prevPath = prev(file);
  18453. if (prevPath && _fs.default.existsSync && _fs.default.existsSync(prevPath)) {
  18454. return _fs.default.readFileSync(prevPath, 'utf-8').toString().trim();
  18455. } else {
  18456. throw new Error('Unable to load previous source map: ' + prevPath.toString());
  18457. }
  18458. } else if (prev instanceof _sourceMap.default.SourceMapConsumer) {
  18459. return _sourceMap.default.SourceMapGenerator.fromSourceMap(prev).toString();
  18460. } else if (prev instanceof _sourceMap.default.SourceMapGenerator) {
  18461. return prev.toString();
  18462. } else if (this.isMap(prev)) {
  18463. return JSON.stringify(prev);
  18464. } else {
  18465. throw new Error('Unsupported previous source map format: ' + prev.toString());
  18466. }
  18467. } else if (this.inline) {
  18468. return this.decodeInline(this.annotation);
  18469. } else if (this.annotation) {
  18470. var map = this.annotation;
  18471. if (file) map = _path.default.join(_path.default.dirname(file), map);
  18472. this.root = _path.default.dirname(map);
  18473. if (_fs.default.existsSync && _fs.default.existsSync(map)) {
  18474. return _fs.default.readFileSync(map, 'utf-8').toString().trim();
  18475. } else {
  18476. return false;
  18477. }
  18478. }
  18479. };
  18480. _proto.isMap = function isMap(map) {
  18481. if (_typeof(map) !== 'object') return false;
  18482. return typeof map.mappings === 'string' || typeof map._mappings === 'string';
  18483. };
  18484. return PreviousMap;
  18485. }();
  18486. var _default = PreviousMap;
  18487. exports.default = _default;
  18488. module.exports = exports.default;
  18489. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).Buffer))
  18490. /***/ }),
  18491. /* 121 */
  18492. /***/ (function(module, exports, __webpack_require__) {
  18493. "use strict";
  18494. exports.byteLength = byteLength;
  18495. exports.toByteArray = toByteArray;
  18496. exports.fromByteArray = fromByteArray;
  18497. var lookup = [];
  18498. var revLookup = [];
  18499. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
  18500. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  18501. for (var i = 0, len = code.length; i < len; ++i) {
  18502. lookup[i] = code[i];
  18503. revLookup[code.charCodeAt(i)] = i;
  18504. }
  18505. revLookup['-'.charCodeAt(0)] = 62;
  18506. revLookup['_'.charCodeAt(0)] = 63;
  18507. function placeHoldersCount(b64) {
  18508. var len = b64.length;
  18509. if (len % 4 > 0) {
  18510. throw new Error('Invalid string. Length must be a multiple of 4');
  18511. } // the number of equal signs (place holders)
  18512. // if there are two placeholders, than the two characters before it
  18513. // represent one byte
  18514. // if there is only one, then the three characters before it represent 2 bytes
  18515. // this is just a cheap hack to not do indexOf twice
  18516. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
  18517. }
  18518. function byteLength(b64) {
  18519. // base64 is 4/3 + up to two characters of the original data
  18520. return b64.length * 3 / 4 - placeHoldersCount(b64);
  18521. }
  18522. function toByteArray(b64) {
  18523. var i, j, l, tmp, placeHolders, arr;
  18524. var len = b64.length;
  18525. placeHolders = placeHoldersCount(b64);
  18526. arr = new Arr(len * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars
  18527. l = placeHolders > 0 ? len - 4 : len;
  18528. var L = 0;
  18529. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  18530. tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
  18531. arr[L++] = tmp >> 16 & 0xFF;
  18532. arr[L++] = tmp >> 8 & 0xFF;
  18533. arr[L++] = tmp & 0xFF;
  18534. }
  18535. if (placeHolders === 2) {
  18536. tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
  18537. arr[L++] = tmp & 0xFF;
  18538. } else if (placeHolders === 1) {
  18539. tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
  18540. arr[L++] = tmp >> 8 & 0xFF;
  18541. arr[L++] = tmp & 0xFF;
  18542. }
  18543. return arr;
  18544. }
  18545. function tripletToBase64(num) {
  18546. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
  18547. }
  18548. function encodeChunk(uint8, start, end) {
  18549. var tmp;
  18550. var output = [];
  18551. for (var i = start; i < end; i += 3) {
  18552. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
  18553. output.push(tripletToBase64(tmp));
  18554. }
  18555. return output.join('');
  18556. }
  18557. function fromByteArray(uint8) {
  18558. var tmp;
  18559. var len = uint8.length;
  18560. var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
  18561. var output = '';
  18562. var parts = [];
  18563. var maxChunkLength = 16383; // must be multiple of 3
  18564. // go through the array every three bytes, we'll deal with trailing stuff later
  18565. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  18566. parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
  18567. } // pad the end with zeros, but make sure to not forget the extra bytes
  18568. if (extraBytes === 1) {
  18569. tmp = uint8[len - 1];
  18570. output += lookup[tmp >> 2];
  18571. output += lookup[tmp << 4 & 0x3F];
  18572. output += '==';
  18573. } else if (extraBytes === 2) {
  18574. tmp = (uint8[len - 2] << 8) + uint8[len - 1];
  18575. output += lookup[tmp >> 10];
  18576. output += lookup[tmp >> 4 & 0x3F];
  18577. output += lookup[tmp << 2 & 0x3F];
  18578. output += '=';
  18579. }
  18580. parts.push(output);
  18581. return parts.join('');
  18582. }
  18583. /***/ }),
  18584. /* 122 */
  18585. /***/ (function(module, exports) {
  18586. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  18587. var e, m;
  18588. var eLen = nBytes * 8 - mLen - 1;
  18589. var eMax = (1 << eLen) - 1;
  18590. var eBias = eMax >> 1;
  18591. var nBits = -7;
  18592. var i = isLE ? nBytes - 1 : 0;
  18593. var d = isLE ? -1 : 1;
  18594. var s = buffer[offset + i];
  18595. i += d;
  18596. e = s & (1 << -nBits) - 1;
  18597. s >>= -nBits;
  18598. nBits += eLen;
  18599. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  18600. m = e & (1 << -nBits) - 1;
  18601. e >>= -nBits;
  18602. nBits += mLen;
  18603. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  18604. if (e === 0) {
  18605. e = 1 - eBias;
  18606. } else if (e === eMax) {
  18607. return m ? NaN : (s ? -1 : 1) * Infinity;
  18608. } else {
  18609. m = m + Math.pow(2, mLen);
  18610. e = e - eBias;
  18611. }
  18612. return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
  18613. };
  18614. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  18615. var e, m, c;
  18616. var eLen = nBytes * 8 - mLen - 1;
  18617. var eMax = (1 << eLen) - 1;
  18618. var eBias = eMax >> 1;
  18619. var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
  18620. var i = isLE ? 0 : nBytes - 1;
  18621. var d = isLE ? 1 : -1;
  18622. var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
  18623. value = Math.abs(value);
  18624. if (isNaN(value) || value === Infinity) {
  18625. m = isNaN(value) ? 1 : 0;
  18626. e = eMax;
  18627. } else {
  18628. e = Math.floor(Math.log(value) / Math.LN2);
  18629. if (value * (c = Math.pow(2, -e)) < 1) {
  18630. e--;
  18631. c *= 2;
  18632. }
  18633. if (e + eBias >= 1) {
  18634. value += rt / c;
  18635. } else {
  18636. value += rt * Math.pow(2, 1 - eBias);
  18637. }
  18638. if (value * c >= 2) {
  18639. e++;
  18640. c /= 2;
  18641. }
  18642. if (e + eBias >= eMax) {
  18643. m = 0;
  18644. e = eMax;
  18645. } else if (e + eBias >= 1) {
  18646. m = (value * c - 1) * Math.pow(2, mLen);
  18647. e = e + eBias;
  18648. } else {
  18649. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
  18650. e = 0;
  18651. }
  18652. }
  18653. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  18654. e = e << mLen | m;
  18655. eLen += mLen;
  18656. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  18657. buffer[offset + i - d] |= s * 128;
  18658. };
  18659. /***/ }),
  18660. /* 123 */
  18661. /***/ (function(module, exports) {
  18662. var toString = {}.toString;
  18663. module.exports = Array.isArray || function (arr) {
  18664. return toString.call(arr) == '[object Array]';
  18665. };
  18666. /***/ }),
  18667. /* 124 */
  18668. /***/ (function(module, exports) {
  18669. /* -*- Mode: js; js-indent-level: 2; -*- */
  18670. /*
  18671. * Copyright 2011 Mozilla Foundation and contributors
  18672. * Licensed under the New BSD license. See LICENSE or:
  18673. * http://opensource.org/licenses/BSD-3-Clause
  18674. */
  18675. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  18676. /**
  18677. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  18678. */
  18679. exports.encode = function (number) {
  18680. if (0 <= number && number < intToCharMap.length) {
  18681. return intToCharMap[number];
  18682. }
  18683. throw new TypeError("Must be between 0 and 63: " + number);
  18684. };
  18685. /**
  18686. * Decode a single base 64 character code digit to an integer. Returns -1 on
  18687. * failure.
  18688. */
  18689. exports.decode = function (charCode) {
  18690. var bigA = 65; // 'A'
  18691. var bigZ = 90; // 'Z'
  18692. var littleA = 97; // 'a'
  18693. var littleZ = 122; // 'z'
  18694. var zero = 48; // '0'
  18695. var nine = 57; // '9'
  18696. var plus = 43; // '+'
  18697. var slash = 47; // '/'
  18698. var littleOffset = 26;
  18699. var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  18700. if (bigA <= charCode && charCode <= bigZ) {
  18701. return charCode - bigA;
  18702. } // 26 - 51: abcdefghijklmnopqrstuvwxyz
  18703. if (littleA <= charCode && charCode <= littleZ) {
  18704. return charCode - littleA + littleOffset;
  18705. } // 52 - 61: 0123456789
  18706. if (zero <= charCode && charCode <= nine) {
  18707. return charCode - zero + numberOffset;
  18708. } // 62: +
  18709. if (charCode == plus) {
  18710. return 62;
  18711. } // 63: /
  18712. if (charCode == slash) {
  18713. return 63;
  18714. } // Invalid base64 digit.
  18715. return -1;
  18716. };
  18717. /***/ }),
  18718. /* 125 */
  18719. /***/ (function(module, exports, __webpack_require__) {
  18720. /* -*- Mode: js; js-indent-level: 2; -*- */
  18721. /*
  18722. * Copyright 2014 Mozilla Foundation and contributors
  18723. * Licensed under the New BSD license. See LICENSE or:
  18724. * http://opensource.org/licenses/BSD-3-Clause
  18725. */
  18726. var util = __webpack_require__(8);
  18727. /**
  18728. * Determine whether mappingB is after mappingA with respect to generated
  18729. * position.
  18730. */
  18731. function generatedPositionAfter(mappingA, mappingB) {
  18732. // Optimized for most common case
  18733. var lineA = mappingA.generatedLine;
  18734. var lineB = mappingB.generatedLine;
  18735. var columnA = mappingA.generatedColumn;
  18736. var columnB = mappingB.generatedColumn;
  18737. return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  18738. }
  18739. /**
  18740. * A data structure to provide a sorted view of accumulated mappings in a
  18741. * performance conscious manner. It trades a neglibable overhead in general
  18742. * case for a large speedup in case of mappings being added in order.
  18743. */
  18744. function MappingList() {
  18745. this._array = [];
  18746. this._sorted = true; // Serves as infimum
  18747. this._last = {
  18748. generatedLine: -1,
  18749. generatedColumn: 0
  18750. };
  18751. }
  18752. /**
  18753. * Iterate through internal items. This method takes the same arguments that
  18754. * `Array.prototype.forEach` takes.
  18755. *
  18756. * NOTE: The order of the mappings is NOT guaranteed.
  18757. */
  18758. MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
  18759. this._array.forEach(aCallback, aThisArg);
  18760. };
  18761. /**
  18762. * Add the given source mapping.
  18763. *
  18764. * @param Object aMapping
  18765. */
  18766. MappingList.prototype.add = function MappingList_add(aMapping) {
  18767. if (generatedPositionAfter(this._last, aMapping)) {
  18768. this._last = aMapping;
  18769. this._array.push(aMapping);
  18770. } else {
  18771. this._sorted = false;
  18772. this._array.push(aMapping);
  18773. }
  18774. };
  18775. /**
  18776. * Returns the flat, sorted array of mappings. The mappings are sorted by
  18777. * generated position.
  18778. *
  18779. * WARNING: This method returns internal data without copying, for
  18780. * performance. The return value must NOT be mutated, and should be treated as
  18781. * an immutable borrow. If you want to take ownership, you must make your own
  18782. * copy.
  18783. */
  18784. MappingList.prototype.toArray = function MappingList_toArray() {
  18785. if (!this._sorted) {
  18786. this._array.sort(util.compareByGeneratedPositionsInflated);
  18787. this._sorted = true;
  18788. }
  18789. return this._array;
  18790. };
  18791. exports.MappingList = MappingList;
  18792. /***/ }),
  18793. /* 126 */
  18794. /***/ (function(module, exports, __webpack_require__) {
  18795. /* -*- Mode: js; js-indent-level: 2; -*- */
  18796. /*
  18797. * Copyright 2011 Mozilla Foundation and contributors
  18798. * Licensed under the New BSD license. See LICENSE or:
  18799. * http://opensource.org/licenses/BSD-3-Clause
  18800. */
  18801. var util = __webpack_require__(8);
  18802. var binarySearch = __webpack_require__(127);
  18803. var ArraySet = __webpack_require__(64).ArraySet;
  18804. var base64VLQ = __webpack_require__(63);
  18805. var quickSort = __webpack_require__(128).quickSort;
  18806. function SourceMapConsumer(aSourceMap, aSourceMapURL) {
  18807. var sourceMap = aSourceMap;
  18808. if (typeof aSourceMap === 'string') {
  18809. sourceMap = util.parseSourceMapInput(aSourceMap);
  18810. }
  18811. return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
  18812. }
  18813. SourceMapConsumer.fromSourceMap = function (aSourceMap, aSourceMapURL) {
  18814. return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
  18815. };
  18816. /**
  18817. * The version of the source mapping spec that we are consuming.
  18818. */
  18819. SourceMapConsumer.prototype._version = 3; // `__generatedMappings` and `__originalMappings` are arrays that hold the
  18820. // parsed mapping coordinates from the source map's "mappings" attribute. They
  18821. // are lazily instantiated, accessed via the `_generatedMappings` and
  18822. // `_originalMappings` getters respectively, and we only parse the mappings
  18823. // and create these arrays once queried for a source location. We jump through
  18824. // these hoops because there can be many thousands of mappings, and parsing
  18825. // them is expensive, so we only want to do it if we must.
  18826. //
  18827. // Each object in the arrays is of the form:
  18828. //
  18829. // {
  18830. // generatedLine: The line number in the generated code,
  18831. // generatedColumn: The column number in the generated code,
  18832. // source: The path to the original source file that generated this
  18833. // chunk of code,
  18834. // originalLine: The line number in the original source that
  18835. // corresponds to this chunk of generated code,
  18836. // originalColumn: The column number in the original source that
  18837. // corresponds to this chunk of generated code,
  18838. // name: The name of the original symbol which generated this chunk of
  18839. // code.
  18840. // }
  18841. //
  18842. // All properties except for `generatedLine` and `generatedColumn` can be
  18843. // `null`.
  18844. //
  18845. // `_generatedMappings` is ordered by the generated positions.
  18846. //
  18847. // `_originalMappings` is ordered by the original positions.
  18848. SourceMapConsumer.prototype.__generatedMappings = null;
  18849. Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
  18850. configurable: true,
  18851. enumerable: true,
  18852. get: function get() {
  18853. if (!this.__generatedMappings) {
  18854. this._parseMappings(this._mappings, this.sourceRoot);
  18855. }
  18856. return this.__generatedMappings;
  18857. }
  18858. });
  18859. SourceMapConsumer.prototype.__originalMappings = null;
  18860. Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
  18861. configurable: true,
  18862. enumerable: true,
  18863. get: function get() {
  18864. if (!this.__originalMappings) {
  18865. this._parseMappings(this._mappings, this.sourceRoot);
  18866. }
  18867. return this.__originalMappings;
  18868. }
  18869. });
  18870. SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  18871. var c = aStr.charAt(index);
  18872. return c === ";" || c === ",";
  18873. };
  18874. /**
  18875. * Parse the mappings in a string in to a data structure which we can easily
  18876. * query (the ordered arrays in the `this.__generatedMappings` and
  18877. * `this.__originalMappings` properties).
  18878. */
  18879. SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  18880. throw new Error("Subclasses must implement _parseMappings");
  18881. };
  18882. SourceMapConsumer.GENERATED_ORDER = 1;
  18883. SourceMapConsumer.ORIGINAL_ORDER = 2;
  18884. SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  18885. SourceMapConsumer.LEAST_UPPER_BOUND = 2;
  18886. /**
  18887. * Iterate over each mapping between an original source/line/column and a
  18888. * generated line/column in this source map.
  18889. *
  18890. * @param Function aCallback
  18891. * The function that is called with each mapping.
  18892. * @param Object aContext
  18893. * Optional. If specified, this object will be the value of `this` every
  18894. * time that `aCallback` is called.
  18895. * @param aOrder
  18896. * Either `SourceMapConsumer.GENERATED_ORDER` or
  18897. * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  18898. * iterate over the mappings sorted by the generated file's line/column
  18899. * order or the original's source/line/column order, respectively. Defaults to
  18900. * `SourceMapConsumer.GENERATED_ORDER`.
  18901. */
  18902. SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  18903. var context = aContext || null;
  18904. var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
  18905. var mappings;
  18906. switch (order) {
  18907. case SourceMapConsumer.GENERATED_ORDER:
  18908. mappings = this._generatedMappings;
  18909. break;
  18910. case SourceMapConsumer.ORIGINAL_ORDER:
  18911. mappings = this._originalMappings;
  18912. break;
  18913. default:
  18914. throw new Error("Unknown order of iteration.");
  18915. }
  18916. var sourceRoot = this.sourceRoot;
  18917. mappings.map(function (mapping) {
  18918. var source = mapping.source === null ? null : this._sources.at(mapping.source);
  18919. source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
  18920. return {
  18921. source: source,
  18922. generatedLine: mapping.generatedLine,
  18923. generatedColumn: mapping.generatedColumn,
  18924. originalLine: mapping.originalLine,
  18925. originalColumn: mapping.originalColumn,
  18926. name: mapping.name === null ? null : this._names.at(mapping.name)
  18927. };
  18928. }, this).forEach(aCallback, context);
  18929. };
  18930. /**
  18931. * Returns all generated line and column information for the original source,
  18932. * line, and column provided. If no column is provided, returns all mappings
  18933. * corresponding to a either the line we are searching for or the next
  18934. * closest line that has any mappings. Otherwise, returns all mappings
  18935. * corresponding to the given line and either the column we are searching for
  18936. * or the next closest column that has any offsets.
  18937. *
  18938. * The only argument is an object with the following properties:
  18939. *
  18940. * - source: The filename of the original source.
  18941. * - line: The line number in the original source. The line number is 1-based.
  18942. * - column: Optional. the column number in the original source.
  18943. * The column number is 0-based.
  18944. *
  18945. * and an array of objects is returned, each with the following properties:
  18946. *
  18947. * - line: The line number in the generated source, or null. The
  18948. * line number is 1-based.
  18949. * - column: The column number in the generated source, or null.
  18950. * The column number is 0-based.
  18951. */
  18952. SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  18953. var line = util.getArg(aArgs, 'line'); // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  18954. // returns the index of the closest mapping less than the needle. By
  18955. // setting needle.originalColumn to 0, we thus find the last mapping for
  18956. // the given line, provided such a mapping exists.
  18957. var needle = {
  18958. source: util.getArg(aArgs, 'source'),
  18959. originalLine: line,
  18960. originalColumn: util.getArg(aArgs, 'column', 0)
  18961. };
  18962. needle.source = this._findSourceIndex(needle.source);
  18963. if (needle.source < 0) {
  18964. return [];
  18965. }
  18966. var mappings = [];
  18967. var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
  18968. if (index >= 0) {
  18969. var mapping = this._originalMappings[index];
  18970. if (aArgs.column === undefined) {
  18971. var originalLine = mapping.originalLine; // Iterate until either we run out of mappings, or we run into
  18972. // a mapping for a different line than the one we found. Since
  18973. // mappings are sorted, this is guaranteed to find all mappings for
  18974. // the line we found.
  18975. while (mapping && mapping.originalLine === originalLine) {
  18976. mappings.push({
  18977. line: util.getArg(mapping, 'generatedLine', null),
  18978. column: util.getArg(mapping, 'generatedColumn', null),
  18979. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  18980. });
  18981. mapping = this._originalMappings[++index];
  18982. }
  18983. } else {
  18984. var originalColumn = mapping.originalColumn; // Iterate until either we run out of mappings, or we run into
  18985. // a mapping for a different line than the one we were searching for.
  18986. // Since mappings are sorted, this is guaranteed to find all mappings for
  18987. // the line we are searching for.
  18988. while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
  18989. mappings.push({
  18990. line: util.getArg(mapping, 'generatedLine', null),
  18991. column: util.getArg(mapping, 'generatedColumn', null),
  18992. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  18993. });
  18994. mapping = this._originalMappings[++index];
  18995. }
  18996. }
  18997. }
  18998. return mappings;
  18999. };
  19000. exports.SourceMapConsumer = SourceMapConsumer;
  19001. /**
  19002. * A BasicSourceMapConsumer instance represents a parsed source map which we can
  19003. * query for information about the original file positions by giving it a file
  19004. * position in the generated source.
  19005. *
  19006. * The first parameter is the raw source map (either as a JSON string, or
  19007. * already parsed to an object). According to the spec, source maps have the
  19008. * following attributes:
  19009. *
  19010. * - version: Which version of the source map spec this map is following.
  19011. * - sources: An array of URLs to the original source files.
  19012. * - names: An array of identifiers which can be referrenced by individual mappings.
  19013. * - sourceRoot: Optional. The URL root from which all sources are relative.
  19014. * - sourcesContent: Optional. An array of contents of the original source files.
  19015. * - mappings: A string of base64 VLQs which contain the actual mappings.
  19016. * - file: Optional. The generated file this source map is associated with.
  19017. *
  19018. * Here is an example source map, taken from the source map spec[0]:
  19019. *
  19020. * {
  19021. * version : 3,
  19022. * file: "out.js",
  19023. * sourceRoot : "",
  19024. * sources: ["foo.js", "bar.js"],
  19025. * names: ["src", "maps", "are", "fun"],
  19026. * mappings: "AA,AB;;ABCDE;"
  19027. * }
  19028. *
  19029. * The second parameter, if given, is a string whose value is the URL
  19030. * at which the source map was found. This URL is used to compute the
  19031. * sources array.
  19032. *
  19033. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  19034. */
  19035. function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
  19036. var sourceMap = aSourceMap;
  19037. if (typeof aSourceMap === 'string') {
  19038. sourceMap = util.parseSourceMapInput(aSourceMap);
  19039. }
  19040. var version = util.getArg(sourceMap, 'version');
  19041. var sources = util.getArg(sourceMap, 'sources'); // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  19042. // requires the array) to play nice here.
  19043. var names = util.getArg(sourceMap, 'names', []);
  19044. var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  19045. var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  19046. var mappings = util.getArg(sourceMap, 'mappings');
  19047. var file = util.getArg(sourceMap, 'file', null); // Once again, Sass deviates from the spec and supplies the version as a
  19048. // string rather than a number, so we use loose equality checking here.
  19049. if (version != this._version) {
  19050. throw new Error('Unsupported version: ' + version);
  19051. }
  19052. if (sourceRoot) {
  19053. sourceRoot = util.normalize(sourceRoot);
  19054. }
  19055. sources = sources.map(String) // Some source maps produce relative source paths like "./foo.js" instead of
  19056. // "foo.js". Normalize these first so that future comparisons will succeed.
  19057. // See bugzil.la/1090768.
  19058. .map(util.normalize) // Always ensure that absolute sources are internally stored relative to
  19059. // the source root, if the source root is absolute. Not doing this would
  19060. // be particularly problematic when the source root is a prefix of the
  19061. // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  19062. .map(function (source) {
  19063. return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
  19064. }); // Pass `true` below to allow duplicate names and sources. While source maps
  19065. // are intended to be compressed and deduplicated, the TypeScript compiler
  19066. // sometimes generates source maps with duplicates in them. See Github issue
  19067. // #72 and bugzil.la/889492.
  19068. this._names = ArraySet.fromArray(names.map(String), true);
  19069. this._sources = ArraySet.fromArray(sources, true);
  19070. this._absoluteSources = this._sources.toArray().map(function (s) {
  19071. return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
  19072. });
  19073. this.sourceRoot = sourceRoot;
  19074. this.sourcesContent = sourcesContent;
  19075. this._mappings = mappings;
  19076. this._sourceMapURL = aSourceMapURL;
  19077. this.file = file;
  19078. }
  19079. BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  19080. BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
  19081. /**
  19082. * Utility function to find the index of a source. Returns -1 if not
  19083. * found.
  19084. */
  19085. BasicSourceMapConsumer.prototype._findSourceIndex = function (aSource) {
  19086. var relativeSource = aSource;
  19087. if (this.sourceRoot != null) {
  19088. relativeSource = util.relative(this.sourceRoot, relativeSource);
  19089. }
  19090. if (this._sources.has(relativeSource)) {
  19091. return this._sources.indexOf(relativeSource);
  19092. } // Maybe aSource is an absolute URL as returned by |sources|. In
  19093. // this case we can't simply undo the transform.
  19094. var i;
  19095. for (i = 0; i < this._absoluteSources.length; ++i) {
  19096. if (this._absoluteSources[i] == aSource) {
  19097. return i;
  19098. }
  19099. }
  19100. return -1;
  19101. };
  19102. /**
  19103. * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  19104. *
  19105. * @param SourceMapGenerator aSourceMap
  19106. * The source map that will be consumed.
  19107. * @param String aSourceMapURL
  19108. * The URL at which the source map can be found (optional)
  19109. * @returns BasicSourceMapConsumer
  19110. */
  19111. BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
  19112. var smc = Object.create(BasicSourceMapConsumer.prototype);
  19113. var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  19114. var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  19115. smc.sourceRoot = aSourceMap._sourceRoot;
  19116. smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
  19117. smc.file = aSourceMap._file;
  19118. smc._sourceMapURL = aSourceMapURL;
  19119. smc._absoluteSources = smc._sources.toArray().map(function (s) {
  19120. return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
  19121. }); // Because we are modifying the entries (by converting string sources and
  19122. // names to indices into the sources and names ArraySets), we have to make
  19123. // a copy of the entry or else bad things happen. Shared mutable state
  19124. // strikes again! See github issue #191.
  19125. var generatedMappings = aSourceMap._mappings.toArray().slice();
  19126. var destGeneratedMappings = smc.__generatedMappings = [];
  19127. var destOriginalMappings = smc.__originalMappings = [];
  19128. for (var i = 0, length = generatedMappings.length; i < length; i++) {
  19129. var srcMapping = generatedMappings[i];
  19130. var destMapping = new Mapping();
  19131. destMapping.generatedLine = srcMapping.generatedLine;
  19132. destMapping.generatedColumn = srcMapping.generatedColumn;
  19133. if (srcMapping.source) {
  19134. destMapping.source = sources.indexOf(srcMapping.source);
  19135. destMapping.originalLine = srcMapping.originalLine;
  19136. destMapping.originalColumn = srcMapping.originalColumn;
  19137. if (srcMapping.name) {
  19138. destMapping.name = names.indexOf(srcMapping.name);
  19139. }
  19140. destOriginalMappings.push(destMapping);
  19141. }
  19142. destGeneratedMappings.push(destMapping);
  19143. }
  19144. quickSort(smc.__originalMappings, util.compareByOriginalPositions);
  19145. return smc;
  19146. };
  19147. /**
  19148. * The version of the source mapping spec that we are consuming.
  19149. */
  19150. BasicSourceMapConsumer.prototype._version = 3;
  19151. /**
  19152. * The list of original sources.
  19153. */
  19154. Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  19155. get: function get() {
  19156. return this._absoluteSources.slice();
  19157. }
  19158. });
  19159. /**
  19160. * Provide the JIT with a nice shape / hidden class.
  19161. */
  19162. function Mapping() {
  19163. this.generatedLine = 0;
  19164. this.generatedColumn = 0;
  19165. this.source = null;
  19166. this.originalLine = null;
  19167. this.originalColumn = null;
  19168. this.name = null;
  19169. }
  19170. /**
  19171. * Parse the mappings in a string in to a data structure which we can easily
  19172. * query (the ordered arrays in the `this.__generatedMappings` and
  19173. * `this.__originalMappings` properties).
  19174. */
  19175. BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  19176. var generatedLine = 1;
  19177. var previousGeneratedColumn = 0;
  19178. var previousOriginalLine = 0;
  19179. var previousOriginalColumn = 0;
  19180. var previousSource = 0;
  19181. var previousName = 0;
  19182. var length = aStr.length;
  19183. var index = 0;
  19184. var cachedSegments = {};
  19185. var temp = {};
  19186. var originalMappings = [];
  19187. var generatedMappings = [];
  19188. var mapping, str, segment, end, value;
  19189. while (index < length) {
  19190. if (aStr.charAt(index) === ';') {
  19191. generatedLine++;
  19192. index++;
  19193. previousGeneratedColumn = 0;
  19194. } else if (aStr.charAt(index) === ',') {
  19195. index++;
  19196. } else {
  19197. mapping = new Mapping();
  19198. mapping.generatedLine = generatedLine; // Because each offset is encoded relative to the previous one,
  19199. // many segments often have the same encoding. We can exploit this
  19200. // fact by caching the parsed variable length fields of each segment,
  19201. // allowing us to avoid a second parse if we encounter the same
  19202. // segment again.
  19203. for (end = index; end < length; end++) {
  19204. if (this._charIsMappingSeparator(aStr, end)) {
  19205. break;
  19206. }
  19207. }
  19208. str = aStr.slice(index, end);
  19209. segment = cachedSegments[str];
  19210. if (segment) {
  19211. index += str.length;
  19212. } else {
  19213. segment = [];
  19214. while (index < end) {
  19215. base64VLQ.decode(aStr, index, temp);
  19216. value = temp.value;
  19217. index = temp.rest;
  19218. segment.push(value);
  19219. }
  19220. if (segment.length === 2) {
  19221. throw new Error('Found a source, but no line and column');
  19222. }
  19223. if (segment.length === 3) {
  19224. throw new Error('Found a source and line, but no column');
  19225. }
  19226. cachedSegments[str] = segment;
  19227. } // Generated column.
  19228. mapping.generatedColumn = previousGeneratedColumn + segment[0];
  19229. previousGeneratedColumn = mapping.generatedColumn;
  19230. if (segment.length > 1) {
  19231. // Original source.
  19232. mapping.source = previousSource + segment[1];
  19233. previousSource += segment[1]; // Original line.
  19234. mapping.originalLine = previousOriginalLine + segment[2];
  19235. previousOriginalLine = mapping.originalLine; // Lines are stored 0-based
  19236. mapping.originalLine += 1; // Original column.
  19237. mapping.originalColumn = previousOriginalColumn + segment[3];
  19238. previousOriginalColumn = mapping.originalColumn;
  19239. if (segment.length > 4) {
  19240. // Original name.
  19241. mapping.name = previousName + segment[4];
  19242. previousName += segment[4];
  19243. }
  19244. }
  19245. generatedMappings.push(mapping);
  19246. if (typeof mapping.originalLine === 'number') {
  19247. originalMappings.push(mapping);
  19248. }
  19249. }
  19250. }
  19251. quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
  19252. this.__generatedMappings = generatedMappings;
  19253. quickSort(originalMappings, util.compareByOriginalPositions);
  19254. this.__originalMappings = originalMappings;
  19255. };
  19256. /**
  19257. * Find the mapping that best matches the hypothetical "needle" mapping that
  19258. * we are searching for in the given "haystack" of mappings.
  19259. */
  19260. BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
  19261. // To return the position we are searching for, we must first find the
  19262. // mapping for the given position and then return the opposite position it
  19263. // points to. Because the mappings are sorted, we can use binary search to
  19264. // find the best mapping.
  19265. if (aNeedle[aLineName] <= 0) {
  19266. throw new TypeError('Line must be greater than or equal to 1, got ' + aNeedle[aLineName]);
  19267. }
  19268. if (aNeedle[aColumnName] < 0) {
  19269. throw new TypeError('Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]);
  19270. }
  19271. return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  19272. };
  19273. /**
  19274. * Compute the last column for each generated mapping. The last column is
  19275. * inclusive.
  19276. */
  19277. BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
  19278. for (var index = 0; index < this._generatedMappings.length; ++index) {
  19279. var mapping = this._generatedMappings[index]; // Mappings do not contain a field for the last generated columnt. We
  19280. // can come up with an optimistic estimate, however, by assuming that
  19281. // mappings are contiguous (i.e. given two consecutive mappings, the
  19282. // first mapping ends where the second one starts).
  19283. if (index + 1 < this._generatedMappings.length) {
  19284. var nextMapping = this._generatedMappings[index + 1];
  19285. if (mapping.generatedLine === nextMapping.generatedLine) {
  19286. mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  19287. continue;
  19288. }
  19289. } // The last mapping for each line spans the entire line.
  19290. mapping.lastGeneratedColumn = Infinity;
  19291. }
  19292. };
  19293. /**
  19294. * Returns the original source, line, and column information for the generated
  19295. * source's line and column positions provided. The only argument is an object
  19296. * with the following properties:
  19297. *
  19298. * - line: The line number in the generated source. The line number
  19299. * is 1-based.
  19300. * - column: The column number in the generated source. The column
  19301. * number is 0-based.
  19302. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  19303. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  19304. * closest element that is smaller than or greater than the one we are
  19305. * searching for, respectively, if the exact element cannot be found.
  19306. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  19307. *
  19308. * and an object is returned with the following properties:
  19309. *
  19310. * - source: The original source file, or null.
  19311. * - line: The line number in the original source, or null. The
  19312. * line number is 1-based.
  19313. * - column: The column number in the original source, or null. The
  19314. * column number is 0-based.
  19315. * - name: The original identifier, or null.
  19316. */
  19317. BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
  19318. var needle = {
  19319. generatedLine: util.getArg(aArgs, 'line'),
  19320. generatedColumn: util.getArg(aArgs, 'column')
  19321. };
  19322. var index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
  19323. if (index >= 0) {
  19324. var mapping = this._generatedMappings[index];
  19325. if (mapping.generatedLine === needle.generatedLine) {
  19326. var source = util.getArg(mapping, 'source', null);
  19327. if (source !== null) {
  19328. source = this._sources.at(source);
  19329. source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
  19330. }
  19331. var name = util.getArg(mapping, 'name', null);
  19332. if (name !== null) {
  19333. name = this._names.at(name);
  19334. }
  19335. return {
  19336. source: source,
  19337. line: util.getArg(mapping, 'originalLine', null),
  19338. column: util.getArg(mapping, 'originalColumn', null),
  19339. name: name
  19340. };
  19341. }
  19342. }
  19343. return {
  19344. source: null,
  19345. line: null,
  19346. column: null,
  19347. name: null
  19348. };
  19349. };
  19350. /**
  19351. * Return true if we have the source content for every source in the source
  19352. * map, false otherwise.
  19353. */
  19354. BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
  19355. if (!this.sourcesContent) {
  19356. return false;
  19357. }
  19358. return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) {
  19359. return sc == null;
  19360. });
  19361. };
  19362. /**
  19363. * Returns the original source content. The only argument is the url of the
  19364. * original source file. Returns null if no original source content is
  19365. * available.
  19366. */
  19367. BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  19368. if (!this.sourcesContent) {
  19369. return null;
  19370. }
  19371. var index = this._findSourceIndex(aSource);
  19372. if (index >= 0) {
  19373. return this.sourcesContent[index];
  19374. }
  19375. var relativeSource = aSource;
  19376. if (this.sourceRoot != null) {
  19377. relativeSource = util.relative(this.sourceRoot, relativeSource);
  19378. }
  19379. var url;
  19380. if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
  19381. // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  19382. // many users. We can help them out when they expect file:// URIs to
  19383. // behave like it would if they were running a local HTTP server. See
  19384. // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  19385. var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
  19386. if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
  19387. return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
  19388. }
  19389. if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
  19390. return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
  19391. }
  19392. } // This function is used recursively from
  19393. // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  19394. // don't want to throw if we can't find the source - we just want to
  19395. // return null, so we provide a flag to exit gracefully.
  19396. if (nullOnMissing) {
  19397. return null;
  19398. } else {
  19399. throw new Error('"' + relativeSource + '" is not in the SourceMap.');
  19400. }
  19401. };
  19402. /**
  19403. * Returns the generated line and column information for the original source,
  19404. * line, and column positions provided. The only argument is an object with
  19405. * the following properties:
  19406. *
  19407. * - source: The filename of the original source.
  19408. * - line: The line number in the original source. The line number
  19409. * is 1-based.
  19410. * - column: The column number in the original source. The column
  19411. * number is 0-based.
  19412. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  19413. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  19414. * closest element that is smaller than or greater than the one we are
  19415. * searching for, respectively, if the exact element cannot be found.
  19416. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  19417. *
  19418. * and an object is returned with the following properties:
  19419. *
  19420. * - line: The line number in the generated source, or null. The
  19421. * line number is 1-based.
  19422. * - column: The column number in the generated source, or null.
  19423. * The column number is 0-based.
  19424. */
  19425. BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
  19426. var source = util.getArg(aArgs, 'source');
  19427. source = this._findSourceIndex(source);
  19428. if (source < 0) {
  19429. return {
  19430. line: null,
  19431. column: null,
  19432. lastColumn: null
  19433. };
  19434. }
  19435. var needle = {
  19436. source: source,
  19437. originalLine: util.getArg(aArgs, 'line'),
  19438. originalColumn: util.getArg(aArgs, 'column')
  19439. };
  19440. var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
  19441. if (index >= 0) {
  19442. var mapping = this._originalMappings[index];
  19443. if (mapping.source === needle.source) {
  19444. return {
  19445. line: util.getArg(mapping, 'generatedLine', null),
  19446. column: util.getArg(mapping, 'generatedColumn', null),
  19447. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  19448. };
  19449. }
  19450. }
  19451. return {
  19452. line: null,
  19453. column: null,
  19454. lastColumn: null
  19455. };
  19456. };
  19457. exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
  19458. /**
  19459. * An IndexedSourceMapConsumer instance represents a parsed source map which
  19460. * we can query for information. It differs from BasicSourceMapConsumer in
  19461. * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  19462. * input.
  19463. *
  19464. * The first parameter is a raw source map (either as a JSON string, or already
  19465. * parsed to an object). According to the spec for indexed source maps, they
  19466. * have the following attributes:
  19467. *
  19468. * - version: Which version of the source map spec this map is following.
  19469. * - file: Optional. The generated file this source map is associated with.
  19470. * - sections: A list of section definitions.
  19471. *
  19472. * Each value under the "sections" field has two fields:
  19473. * - offset: The offset into the original specified at which this section
  19474. * begins to apply, defined as an object with a "line" and "column"
  19475. * field.
  19476. * - map: A source map definition. This source map could also be indexed,
  19477. * but doesn't have to be.
  19478. *
  19479. * Instead of the "map" field, it's also possible to have a "url" field
  19480. * specifying a URL to retrieve a source map from, but that's currently
  19481. * unsupported.
  19482. *
  19483. * Here's an example source map, taken from the source map spec[0], but
  19484. * modified to omit a section which uses the "url" field.
  19485. *
  19486. * {
  19487. * version : 3,
  19488. * file: "app.js",
  19489. * sections: [{
  19490. * offset: {line:100, column:10},
  19491. * map: {
  19492. * version : 3,
  19493. * file: "section.js",
  19494. * sources: ["foo.js", "bar.js"],
  19495. * names: ["src", "maps", "are", "fun"],
  19496. * mappings: "AAAA,E;;ABCDE;"
  19497. * }
  19498. * }],
  19499. * }
  19500. *
  19501. * The second parameter, if given, is a string whose value is the URL
  19502. * at which the source map was found. This URL is used to compute the
  19503. * sources array.
  19504. *
  19505. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  19506. */
  19507. function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
  19508. var sourceMap = aSourceMap;
  19509. if (typeof aSourceMap === 'string') {
  19510. sourceMap = util.parseSourceMapInput(aSourceMap);
  19511. }
  19512. var version = util.getArg(sourceMap, 'version');
  19513. var sections = util.getArg(sourceMap, 'sections');
  19514. if (version != this._version) {
  19515. throw new Error('Unsupported version: ' + version);
  19516. }
  19517. this._sources = new ArraySet();
  19518. this._names = new ArraySet();
  19519. var lastOffset = {
  19520. line: -1,
  19521. column: 0
  19522. };
  19523. this._sections = sections.map(function (s) {
  19524. if (s.url) {
  19525. // The url field will require support for asynchronicity.
  19526. // See https://github.com/mozilla/source-map/issues/16
  19527. throw new Error('Support for url field in sections not implemented.');
  19528. }
  19529. var offset = util.getArg(s, 'offset');
  19530. var offsetLine = util.getArg(offset, 'line');
  19531. var offsetColumn = util.getArg(offset, 'column');
  19532. if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
  19533. throw new Error('Section offsets must be ordered and non-overlapping.');
  19534. }
  19535. lastOffset = offset;
  19536. return {
  19537. generatedOffset: {
  19538. // The offset fields are 0-based, but we use 1-based indices when
  19539. // encoding/decoding from VLQ.
  19540. generatedLine: offsetLine + 1,
  19541. generatedColumn: offsetColumn + 1
  19542. },
  19543. consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
  19544. };
  19545. });
  19546. }
  19547. IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  19548. IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
  19549. /**
  19550. * The version of the source mapping spec that we are consuming.
  19551. */
  19552. IndexedSourceMapConsumer.prototype._version = 3;
  19553. /**
  19554. * The list of original sources.
  19555. */
  19556. Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  19557. get: function get() {
  19558. var sources = [];
  19559. for (var i = 0; i < this._sections.length; i++) {
  19560. for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  19561. sources.push(this._sections[i].consumer.sources[j]);
  19562. }
  19563. }
  19564. return sources;
  19565. }
  19566. });
  19567. /**
  19568. * Returns the original source, line, and column information for the generated
  19569. * source's line and column positions provided. The only argument is an object
  19570. * with the following properties:
  19571. *
  19572. * - line: The line number in the generated source. The line number
  19573. * is 1-based.
  19574. * - column: The column number in the generated source. The column
  19575. * number is 0-based.
  19576. *
  19577. * and an object is returned with the following properties:
  19578. *
  19579. * - source: The original source file, or null.
  19580. * - line: The line number in the original source, or null. The
  19581. * line number is 1-based.
  19582. * - column: The column number in the original source, or null. The
  19583. * column number is 0-based.
  19584. * - name: The original identifier, or null.
  19585. */
  19586. IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  19587. var needle = {
  19588. generatedLine: util.getArg(aArgs, 'line'),
  19589. generatedColumn: util.getArg(aArgs, 'column')
  19590. }; // Find the section containing the generated position we're trying to map
  19591. // to an original position.
  19592. var sectionIndex = binarySearch.search(needle, this._sections, function (needle, section) {
  19593. var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  19594. if (cmp) {
  19595. return cmp;
  19596. }
  19597. return needle.generatedColumn - section.generatedOffset.generatedColumn;
  19598. });
  19599. var section = this._sections[sectionIndex];
  19600. if (!section) {
  19601. return {
  19602. source: null,
  19603. line: null,
  19604. column: null,
  19605. name: null
  19606. };
  19607. }
  19608. return section.consumer.originalPositionFor({
  19609. line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
  19610. column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
  19611. bias: aArgs.bias
  19612. });
  19613. };
  19614. /**
  19615. * Return true if we have the source content for every source in the source
  19616. * map, false otherwise.
  19617. */
  19618. IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  19619. return this._sections.every(function (s) {
  19620. return s.consumer.hasContentsOfAllSources();
  19621. });
  19622. };
  19623. /**
  19624. * Returns the original source content. The only argument is the url of the
  19625. * original source file. Returns null if no original source content is
  19626. * available.
  19627. */
  19628. IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  19629. for (var i = 0; i < this._sections.length; i++) {
  19630. var section = this._sections[i];
  19631. var content = section.consumer.sourceContentFor(aSource, true);
  19632. if (content) {
  19633. return content;
  19634. }
  19635. }
  19636. if (nullOnMissing) {
  19637. return null;
  19638. } else {
  19639. throw new Error('"' + aSource + '" is not in the SourceMap.');
  19640. }
  19641. };
  19642. /**
  19643. * Returns the generated line and column information for the original source,
  19644. * line, and column positions provided. The only argument is an object with
  19645. * the following properties:
  19646. *
  19647. * - source: The filename of the original source.
  19648. * - line: The line number in the original source. The line number
  19649. * is 1-based.
  19650. * - column: The column number in the original source. The column
  19651. * number is 0-based.
  19652. *
  19653. * and an object is returned with the following properties:
  19654. *
  19655. * - line: The line number in the generated source, or null. The
  19656. * line number is 1-based.
  19657. * - column: The column number in the generated source, or null.
  19658. * The column number is 0-based.
  19659. */
  19660. IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  19661. for (var i = 0; i < this._sections.length; i++) {
  19662. var section = this._sections[i]; // Only consider this section if the requested source is in the list of
  19663. // sources of the consumer.
  19664. if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
  19665. continue;
  19666. }
  19667. var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  19668. if (generatedPosition) {
  19669. var ret = {
  19670. line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
  19671. column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
  19672. };
  19673. return ret;
  19674. }
  19675. }
  19676. return {
  19677. line: null,
  19678. column: null
  19679. };
  19680. };
  19681. /**
  19682. * Parse the mappings in a string in to a data structure which we can easily
  19683. * query (the ordered arrays in the `this.__generatedMappings` and
  19684. * `this.__originalMappings` properties).
  19685. */
  19686. IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  19687. this.__generatedMappings = [];
  19688. this.__originalMappings = [];
  19689. for (var i = 0; i < this._sections.length; i++) {
  19690. var section = this._sections[i];
  19691. var sectionMappings = section.consumer._generatedMappings;
  19692. for (var j = 0; j < sectionMappings.length; j++) {
  19693. var mapping = sectionMappings[j];
  19694. var source = section.consumer._sources.at(mapping.source);
  19695. source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
  19696. this._sources.add(source);
  19697. source = this._sources.indexOf(source);
  19698. var name = null;
  19699. if (mapping.name) {
  19700. name = section.consumer._names.at(mapping.name);
  19701. this._names.add(name);
  19702. name = this._names.indexOf(name);
  19703. } // The mappings coming from the consumer for the section have
  19704. // generated positions relative to the start of the section, so we
  19705. // need to offset them to be relative to the start of the concatenated
  19706. // generated file.
  19707. var adjustedMapping = {
  19708. source: source,
  19709. generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
  19710. generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
  19711. originalLine: mapping.originalLine,
  19712. originalColumn: mapping.originalColumn,
  19713. name: name
  19714. };
  19715. this.__generatedMappings.push(adjustedMapping);
  19716. if (typeof adjustedMapping.originalLine === 'number') {
  19717. this.__originalMappings.push(adjustedMapping);
  19718. }
  19719. }
  19720. }
  19721. quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
  19722. quickSort(this.__originalMappings, util.compareByOriginalPositions);
  19723. };
  19724. exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
  19725. /***/ }),
  19726. /* 127 */
  19727. /***/ (function(module, exports) {
  19728. /* -*- Mode: js; js-indent-level: 2; -*- */
  19729. /*
  19730. * Copyright 2011 Mozilla Foundation and contributors
  19731. * Licensed under the New BSD license. See LICENSE or:
  19732. * http://opensource.org/licenses/BSD-3-Clause
  19733. */
  19734. exports.GREATEST_LOWER_BOUND = 1;
  19735. exports.LEAST_UPPER_BOUND = 2;
  19736. /**
  19737. * Recursive implementation of binary search.
  19738. *
  19739. * @param aLow Indices here and lower do not contain the needle.
  19740. * @param aHigh Indices here and higher do not contain the needle.
  19741. * @param aNeedle The element being searched for.
  19742. * @param aHaystack The non-empty array being searched.
  19743. * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  19744. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  19745. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  19746. * closest element that is smaller than or greater than the one we are
  19747. * searching for, respectively, if the exact element cannot be found.
  19748. */
  19749. function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  19750. // This function terminates when one of the following is true:
  19751. //
  19752. // 1. We find the exact element we are looking for.
  19753. //
  19754. // 2. We did not find the exact element, but we can return the index of
  19755. // the next-closest element.
  19756. //
  19757. // 3. We did not find the exact element, and there is no next-closest
  19758. // element than the one we are searching for, so we return -1.
  19759. var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  19760. var cmp = aCompare(aNeedle, aHaystack[mid], true);
  19761. if (cmp === 0) {
  19762. // Found the element we are looking for.
  19763. return mid;
  19764. } else if (cmp > 0) {
  19765. // Our needle is greater than aHaystack[mid].
  19766. if (aHigh - mid > 1) {
  19767. // The element is in the upper half.
  19768. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  19769. } // The exact needle element was not found in this haystack. Determine if
  19770. // we are in termination case (3) or (2) and return the appropriate thing.
  19771. if (aBias == exports.LEAST_UPPER_BOUND) {
  19772. return aHigh < aHaystack.length ? aHigh : -1;
  19773. } else {
  19774. return mid;
  19775. }
  19776. } else {
  19777. // Our needle is less than aHaystack[mid].
  19778. if (mid - aLow > 1) {
  19779. // The element is in the lower half.
  19780. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  19781. } // we are in termination case (3) or (2) and return the appropriate thing.
  19782. if (aBias == exports.LEAST_UPPER_BOUND) {
  19783. return mid;
  19784. } else {
  19785. return aLow < 0 ? -1 : aLow;
  19786. }
  19787. }
  19788. }
  19789. /**
  19790. * This is an implementation of binary search which will always try and return
  19791. * the index of the closest element if there is no exact hit. This is because
  19792. * mappings between original and generated line/col pairs are single points,
  19793. * and there is an implicit region between each of them, so a miss just means
  19794. * that you aren't on the very start of a region.
  19795. *
  19796. * @param aNeedle The element you are looking for.
  19797. * @param aHaystack The array that is being searched.
  19798. * @param aCompare A function which takes the needle and an element in the
  19799. * array and returns -1, 0, or 1 depending on whether the needle is less
  19800. * than, equal to, or greater than the element, respectively.
  19801. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  19802. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  19803. * closest element that is smaller than or greater than the one we are
  19804. * searching for, respectively, if the exact element cannot be found.
  19805. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  19806. */
  19807. exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  19808. if (aHaystack.length === 0) {
  19809. return -1;
  19810. }
  19811. var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  19812. if (index < 0) {
  19813. return -1;
  19814. } // We have found either the exact element, or the next-closest element than
  19815. // the one we are searching for. However, there may be more than one such
  19816. // element. Make sure we always return the smallest of these.
  19817. while (index - 1 >= 0) {
  19818. if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  19819. break;
  19820. }
  19821. --index;
  19822. }
  19823. return index;
  19824. };
  19825. /***/ }),
  19826. /* 128 */
  19827. /***/ (function(module, exports) {
  19828. /* -*- Mode: js; js-indent-level: 2; -*- */
  19829. /*
  19830. * Copyright 2011 Mozilla Foundation and contributors
  19831. * Licensed under the New BSD license. See LICENSE or:
  19832. * http://opensource.org/licenses/BSD-3-Clause
  19833. */
  19834. // It turns out that some (most?) JavaScript engines don't self-host
  19835. // `Array.prototype.sort`. This makes sense because C++ will likely remain
  19836. // faster than JS when doing raw CPU-intensive sorting. However, when using a
  19837. // custom comparator function, calling back and forth between the VM's C++ and
  19838. // JIT'd JS is rather slow *and* loses JIT type information, resulting in
  19839. // worse generated code for the comparator function than would be optimal. In
  19840. // fact, when sorting with a comparator, these costs outweigh the benefits of
  19841. // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  19842. // a ~3500ms mean speed-up in `bench/bench.html`.
  19843. /**
  19844. * Swap the elements indexed by `x` and `y` in the array `ary`.
  19845. *
  19846. * @param {Array} ary
  19847. * The array.
  19848. * @param {Number} x
  19849. * The index of the first item.
  19850. * @param {Number} y
  19851. * The index of the second item.
  19852. */
  19853. function swap(ary, x, y) {
  19854. var temp = ary[x];
  19855. ary[x] = ary[y];
  19856. ary[y] = temp;
  19857. }
  19858. /**
  19859. * Returns a random integer within the range `low .. high` inclusive.
  19860. *
  19861. * @param {Number} low
  19862. * The lower bound on the range.
  19863. * @param {Number} high
  19864. * The upper bound on the range.
  19865. */
  19866. function randomIntInRange(low, high) {
  19867. return Math.round(low + Math.random() * (high - low));
  19868. }
  19869. /**
  19870. * The Quick Sort algorithm.
  19871. *
  19872. * @param {Array} ary
  19873. * An array to sort.
  19874. * @param {function} comparator
  19875. * Function to use to compare two items.
  19876. * @param {Number} p
  19877. * Start index of the array
  19878. * @param {Number} r
  19879. * End index of the array
  19880. */
  19881. function doQuickSort(ary, comparator, p, r) {
  19882. // If our lower bound is less than our upper bound, we (1) partition the
  19883. // array into two pieces and (2) recurse on each half. If it is not, this is
  19884. // the empty array and our base case.
  19885. if (p < r) {
  19886. // (1) Partitioning.
  19887. //
  19888. // The partitioning chooses a pivot between `p` and `r` and moves all
  19889. // elements that are less than or equal to the pivot to the before it, and
  19890. // all the elements that are greater than it after it. The effect is that
  19891. // once partition is done, the pivot is in the exact place it will be when
  19892. // the array is put in sorted order, and it will not need to be moved
  19893. // again. This runs in O(n) time.
  19894. // Always choose a random pivot so that an input array which is reverse
  19895. // sorted does not cause O(n^2) running time.
  19896. var pivotIndex = randomIntInRange(p, r);
  19897. var i = p - 1;
  19898. swap(ary, pivotIndex, r);
  19899. var pivot = ary[r]; // Immediately after `j` is incremented in this loop, the following hold
  19900. // true:
  19901. //
  19902. // * Every element in `ary[p .. i]` is less than or equal to the pivot.
  19903. //
  19904. // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  19905. for (var j = p; j < r; j++) {
  19906. if (comparator(ary[j], pivot) <= 0) {
  19907. i += 1;
  19908. swap(ary, i, j);
  19909. }
  19910. }
  19911. swap(ary, i + 1, j);
  19912. var q = i + 1; // (2) Recurse on each half.
  19913. doQuickSort(ary, comparator, p, q - 1);
  19914. doQuickSort(ary, comparator, q + 1, r);
  19915. }
  19916. }
  19917. /**
  19918. * Sort the given array in-place with the given comparator function.
  19919. *
  19920. * @param {Array} ary
  19921. * An array to sort.
  19922. * @param {function} comparator
  19923. * Function to use to compare two items.
  19924. */
  19925. exports.quickSort = function (ary, comparator) {
  19926. doQuickSort(ary, comparator, 0, ary.length - 1);
  19927. };
  19928. /***/ }),
  19929. /* 129 */
  19930. /***/ (function(module, exports, __webpack_require__) {
  19931. /* -*- Mode: js; js-indent-level: 2; -*- */
  19932. /*
  19933. * Copyright 2011 Mozilla Foundation and contributors
  19934. * Licensed under the New BSD license. See LICENSE or:
  19935. * http://opensource.org/licenses/BSD-3-Clause
  19936. */
  19937. var SourceMapGenerator = __webpack_require__(62).SourceMapGenerator;
  19938. var util = __webpack_require__(8); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  19939. // operating systems these days (capturing the result).
  19940. var REGEX_NEWLINE = /(\r?\n)/; // Newline character code for charCodeAt() comparisons
  19941. var NEWLINE_CODE = 10; // Private symbol for identifying `SourceNode`s when multiple versions of
  19942. // the source-map library are loaded. This MUST NOT CHANGE across
  19943. // versions!
  19944. var isSourceNode = "$$$isSourceNode$$$";
  19945. /**
  19946. * SourceNodes provide a way to abstract over interpolating/concatenating
  19947. * snippets of generated JavaScript source code while maintaining the line and
  19948. * column information associated with the original source code.
  19949. *
  19950. * @param aLine The original line number.
  19951. * @param aColumn The original column number.
  19952. * @param aSource The original source's filename.
  19953. * @param aChunks Optional. An array of strings which are snippets of
  19954. * generated JS, or other SourceNodes.
  19955. * @param aName The original identifier.
  19956. */
  19957. function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  19958. this.children = [];
  19959. this.sourceContents = {};
  19960. this.line = aLine == null ? null : aLine;
  19961. this.column = aColumn == null ? null : aColumn;
  19962. this.source = aSource == null ? null : aSource;
  19963. this.name = aName == null ? null : aName;
  19964. this[isSourceNode] = true;
  19965. if (aChunks != null) this.add(aChunks);
  19966. }
  19967. /**
  19968. * Creates a SourceNode from generated code and a SourceMapConsumer.
  19969. *
  19970. * @param aGeneratedCode The generated code
  19971. * @param aSourceMapConsumer The SourceMap for the generated code
  19972. * @param aRelativePath Optional. The path that relative sources in the
  19973. * SourceMapConsumer should be relative to.
  19974. */
  19975. SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  19976. // The SourceNode we want to fill with the generated code
  19977. // and the SourceMap
  19978. var node = new SourceNode(); // All even indices of this array are one line of the generated code,
  19979. // while all odd indices are the newlines between two adjacent lines
  19980. // (since `REGEX_NEWLINE` captures its match).
  19981. // Processed fragments are accessed by calling `shiftNextLine`.
  19982. var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  19983. var remainingLinesIndex = 0;
  19984. var shiftNextLine = function shiftNextLine() {
  19985. var lineContents = getNextLine(); // The last line of a file might not have a newline.
  19986. var newLine = getNextLine() || "";
  19987. return lineContents + newLine;
  19988. function getNextLine() {
  19989. return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined;
  19990. }
  19991. }; // We need to remember the position of "remainingLines"
  19992. var lastGeneratedLine = 1,
  19993. lastGeneratedColumn = 0; // The generate SourceNodes we need a code range.
  19994. // To extract it current and last mapping is used.
  19995. // Here we store the last mapping.
  19996. var lastMapping = null;
  19997. aSourceMapConsumer.eachMapping(function (mapping) {
  19998. if (lastMapping !== null) {
  19999. // We add the code from "lastMapping" to "mapping":
  20000. // First check if there is a new line in between.
  20001. if (lastGeneratedLine < mapping.generatedLine) {
  20002. // Associate first line with "lastMapping"
  20003. addMappingWithCode(lastMapping, shiftNextLine());
  20004. lastGeneratedLine++;
  20005. lastGeneratedColumn = 0; // The remaining code is added without mapping
  20006. } else {
  20007. // There is no new line in between.
  20008. // Associate the code between "lastGeneratedColumn" and
  20009. // "mapping.generatedColumn" with "lastMapping"
  20010. var nextLine = remainingLines[remainingLinesIndex] || '';
  20011. var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
  20012. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
  20013. lastGeneratedColumn = mapping.generatedColumn;
  20014. addMappingWithCode(lastMapping, code); // No more remaining code, continue
  20015. lastMapping = mapping;
  20016. return;
  20017. }
  20018. } // We add the generated code until the first mapping
  20019. // to the SourceNode without any mapping.
  20020. // Each line is added as separate string.
  20021. while (lastGeneratedLine < mapping.generatedLine) {
  20022. node.add(shiftNextLine());
  20023. lastGeneratedLine++;
  20024. }
  20025. if (lastGeneratedColumn < mapping.generatedColumn) {
  20026. var nextLine = remainingLines[remainingLinesIndex] || '';
  20027. node.add(nextLine.substr(0, mapping.generatedColumn));
  20028. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
  20029. lastGeneratedColumn = mapping.generatedColumn;
  20030. }
  20031. lastMapping = mapping;
  20032. }, this); // We have processed all mappings.
  20033. if (remainingLinesIndex < remainingLines.length) {
  20034. if (lastMapping) {
  20035. // Associate the remaining code in the current line with "lastMapping"
  20036. addMappingWithCode(lastMapping, shiftNextLine());
  20037. } // and add the remaining lines without any mapping
  20038. node.add(remainingLines.splice(remainingLinesIndex).join(""));
  20039. } // Copy sourcesContent into SourceNode
  20040. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  20041. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  20042. if (content != null) {
  20043. if (aRelativePath != null) {
  20044. sourceFile = util.join(aRelativePath, sourceFile);
  20045. }
  20046. node.setSourceContent(sourceFile, content);
  20047. }
  20048. });
  20049. return node;
  20050. function addMappingWithCode(mapping, code) {
  20051. if (mapping === null || mapping.source === undefined) {
  20052. node.add(code);
  20053. } else {
  20054. var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
  20055. node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
  20056. }
  20057. }
  20058. };
  20059. /**
  20060. * Add a chunk of generated JS to this source node.
  20061. *
  20062. * @param aChunk A string snippet of generated JS code, another instance of
  20063. * SourceNode, or an array where each member is one of those things.
  20064. */
  20065. SourceNode.prototype.add = function SourceNode_add(aChunk) {
  20066. if (Array.isArray(aChunk)) {
  20067. aChunk.forEach(function (chunk) {
  20068. this.add(chunk);
  20069. }, this);
  20070. } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  20071. if (aChunk) {
  20072. this.children.push(aChunk);
  20073. }
  20074. } else {
  20075. throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
  20076. }
  20077. return this;
  20078. };
  20079. /**
  20080. * Add a chunk of generated JS to the beginning of this source node.
  20081. *
  20082. * @param aChunk A string snippet of generated JS code, another instance of
  20083. * SourceNode, or an array where each member is one of those things.
  20084. */
  20085. SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
  20086. if (Array.isArray(aChunk)) {
  20087. for (var i = aChunk.length - 1; i >= 0; i--) {
  20088. this.prepend(aChunk[i]);
  20089. }
  20090. } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  20091. this.children.unshift(aChunk);
  20092. } else {
  20093. throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
  20094. }
  20095. return this;
  20096. };
  20097. /**
  20098. * Walk over the tree of JS snippets in this node and its children. The
  20099. * walking function is called once for each snippet of JS and is passed that
  20100. * snippet and the its original associated source's line/column location.
  20101. *
  20102. * @param aFn The traversal function.
  20103. */
  20104. SourceNode.prototype.walk = function SourceNode_walk(aFn) {
  20105. var chunk;
  20106. for (var i = 0, len = this.children.length; i < len; i++) {
  20107. chunk = this.children[i];
  20108. if (chunk[isSourceNode]) {
  20109. chunk.walk(aFn);
  20110. } else {
  20111. if (chunk !== '') {
  20112. aFn(chunk, {
  20113. source: this.source,
  20114. line: this.line,
  20115. column: this.column,
  20116. name: this.name
  20117. });
  20118. }
  20119. }
  20120. }
  20121. };
  20122. /**
  20123. * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  20124. * each of `this.children`.
  20125. *
  20126. * @param aSep The separator.
  20127. */
  20128. SourceNode.prototype.join = function SourceNode_join(aSep) {
  20129. var newChildren;
  20130. var i;
  20131. var len = this.children.length;
  20132. if (len > 0) {
  20133. newChildren = [];
  20134. for (i = 0; i < len - 1; i++) {
  20135. newChildren.push(this.children[i]);
  20136. newChildren.push(aSep);
  20137. }
  20138. newChildren.push(this.children[i]);
  20139. this.children = newChildren;
  20140. }
  20141. return this;
  20142. };
  20143. /**
  20144. * Call String.prototype.replace on the very right-most source snippet. Useful
  20145. * for trimming whitespace from the end of a source node, etc.
  20146. *
  20147. * @param aPattern The pattern to replace.
  20148. * @param aReplacement The thing to replace the pattern with.
  20149. */
  20150. SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  20151. var lastChild = this.children[this.children.length - 1];
  20152. if (lastChild[isSourceNode]) {
  20153. lastChild.replaceRight(aPattern, aReplacement);
  20154. } else if (typeof lastChild === 'string') {
  20155. this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  20156. } else {
  20157. this.children.push(''.replace(aPattern, aReplacement));
  20158. }
  20159. return this;
  20160. };
  20161. /**
  20162. * Set the source content for a source file. This will be added to the SourceMapGenerator
  20163. * in the sourcesContent field.
  20164. *
  20165. * @param aSourceFile The filename of the source file
  20166. * @param aSourceContent The content of the source file
  20167. */
  20168. SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  20169. this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
  20170. };
  20171. /**
  20172. * Walk over the tree of SourceNodes. The walking function is called for each
  20173. * source file content and is passed the filename and source content.
  20174. *
  20175. * @param aFn The traversal function.
  20176. */
  20177. SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
  20178. for (var i = 0, len = this.children.length; i < len; i++) {
  20179. if (this.children[i][isSourceNode]) {
  20180. this.children[i].walkSourceContents(aFn);
  20181. }
  20182. }
  20183. var sources = Object.keys(this.sourceContents);
  20184. for (var i = 0, len = sources.length; i < len; i++) {
  20185. aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  20186. }
  20187. };
  20188. /**
  20189. * Return the string representation of this source node. Walks over the tree
  20190. * and concatenates all the various snippets together to one string.
  20191. */
  20192. SourceNode.prototype.toString = function SourceNode_toString() {
  20193. var str = "";
  20194. this.walk(function (chunk) {
  20195. str += chunk;
  20196. });
  20197. return str;
  20198. };
  20199. /**
  20200. * Returns the string representation of this source node along with a source
  20201. * map.
  20202. */
  20203. SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  20204. var generated = {
  20205. code: "",
  20206. line: 1,
  20207. column: 0
  20208. };
  20209. var map = new SourceMapGenerator(aArgs);
  20210. var sourceMappingActive = false;
  20211. var lastOriginalSource = null;
  20212. var lastOriginalLine = null;
  20213. var lastOriginalColumn = null;
  20214. var lastOriginalName = null;
  20215. this.walk(function (chunk, original) {
  20216. generated.code += chunk;
  20217. if (original.source !== null && original.line !== null && original.column !== null) {
  20218. if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
  20219. map.addMapping({
  20220. source: original.source,
  20221. original: {
  20222. line: original.line,
  20223. column: original.column
  20224. },
  20225. generated: {
  20226. line: generated.line,
  20227. column: generated.column
  20228. },
  20229. name: original.name
  20230. });
  20231. }
  20232. lastOriginalSource = original.source;
  20233. lastOriginalLine = original.line;
  20234. lastOriginalColumn = original.column;
  20235. lastOriginalName = original.name;
  20236. sourceMappingActive = true;
  20237. } else if (sourceMappingActive) {
  20238. map.addMapping({
  20239. generated: {
  20240. line: generated.line,
  20241. column: generated.column
  20242. }
  20243. });
  20244. lastOriginalSource = null;
  20245. sourceMappingActive = false;
  20246. }
  20247. for (var idx = 0, length = chunk.length; idx < length; idx++) {
  20248. if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  20249. generated.line++;
  20250. generated.column = 0; // Mappings end at eol
  20251. if (idx + 1 === length) {
  20252. lastOriginalSource = null;
  20253. sourceMappingActive = false;
  20254. } else if (sourceMappingActive) {
  20255. map.addMapping({
  20256. source: original.source,
  20257. original: {
  20258. line: original.line,
  20259. column: original.column
  20260. },
  20261. generated: {
  20262. line: generated.line,
  20263. column: generated.column
  20264. },
  20265. name: original.name
  20266. });
  20267. }
  20268. } else {
  20269. generated.column++;
  20270. }
  20271. }
  20272. });
  20273. this.walkSourceContents(function (sourceFile, sourceContent) {
  20274. map.setSourceContent(sourceFile, sourceContent);
  20275. });
  20276. return {
  20277. code: generated.code,
  20278. map: map
  20279. };
  20280. };
  20281. exports.SourceNode = SourceNode;
  20282. /***/ }),
  20283. /* 130 */
  20284. /***/ (function(module, exports) {
  20285. /* (ignored) */
  20286. /***/ }),
  20287. /* 131 */
  20288. /***/ (function(module, exports, __webpack_require__) {
  20289. "use strict";
  20290. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  20291. function _classCallCheck(instance, Constructor) {
  20292. if (!(instance instanceof Constructor)) {
  20293. throw new TypeError("Cannot call a class as a function");
  20294. }
  20295. }
  20296. function _possibleConstructorReturn(self, call) {
  20297. if (!self) {
  20298. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  20299. }
  20300. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  20301. }
  20302. function _inherits(subClass, superClass) {
  20303. if (typeof superClass !== "function" && superClass !== null) {
  20304. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  20305. }
  20306. subClass.prototype = Object.create(superClass && superClass.prototype, {
  20307. constructor: {
  20308. value: subClass,
  20309. enumerable: false,
  20310. writable: true,
  20311. configurable: true
  20312. }
  20313. });
  20314. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  20315. }
  20316. var Comment = __webpack_require__(19);
  20317. var Parser = __webpack_require__(66);
  20318. var NestedDeclaration = __webpack_require__(140);
  20319. var scssTokenizer = __webpack_require__(141);
  20320. var ScssParser = function (_Parser) {
  20321. _inherits(ScssParser, _Parser);
  20322. function ScssParser() {
  20323. _classCallCheck(this, ScssParser);
  20324. return _possibleConstructorReturn(this, _Parser.apply(this, arguments));
  20325. }
  20326. ScssParser.prototype.createTokenizer = function createTokenizer() {
  20327. this.tokenizer = scssTokenizer(this.input);
  20328. };
  20329. ScssParser.prototype.rule = function rule(tokens) {
  20330. var withColon = false;
  20331. var brackets = 0;
  20332. var value = '';
  20333. for (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  20334. var _ref;
  20335. if (_isArray) {
  20336. if (_i >= _iterator.length) break;
  20337. _ref = _iterator[_i++];
  20338. } else {
  20339. _i = _iterator.next();
  20340. if (_i.done) break;
  20341. _ref = _i.value;
  20342. }
  20343. var i = _ref;
  20344. if (withColon) {
  20345. if (i[0] !== 'comment' && i[0] !== '{') {
  20346. value += i[1];
  20347. }
  20348. } else if (i[0] === 'space' && i[1].indexOf('\n') !== -1) {
  20349. break;
  20350. } else if (i[0] === '(') {
  20351. brackets += 1;
  20352. } else if (i[0] === ')') {
  20353. brackets -= 1;
  20354. } else if (brackets === 0 && i[0] === ':') {
  20355. withColon = true;
  20356. }
  20357. }
  20358. if (!withColon || value.trim() === '' || /^[a-zA-Z-:#]/.test(value)) {
  20359. _Parser.prototype.rule.call(this, tokens);
  20360. } else {
  20361. tokens.pop();
  20362. var node = new NestedDeclaration();
  20363. this.init(node);
  20364. var last = tokens[tokens.length - 1];
  20365. if (last[4]) {
  20366. node.source.end = {
  20367. line: last[4],
  20368. column: last[5]
  20369. };
  20370. } else {
  20371. node.source.end = {
  20372. line: last[2],
  20373. column: last[3]
  20374. };
  20375. }
  20376. while (tokens[0][0] !== 'word') {
  20377. node.raws.before += tokens.shift()[1];
  20378. }
  20379. node.source.start = {
  20380. line: tokens[0][2],
  20381. column: tokens[0][3]
  20382. };
  20383. node.prop = '';
  20384. while (tokens.length) {
  20385. var type = tokens[0][0];
  20386. if (type === ':' || type === 'space' || type === 'comment') {
  20387. break;
  20388. }
  20389. node.prop += tokens.shift()[1];
  20390. }
  20391. node.raws.between = '';
  20392. var token = void 0;
  20393. while (tokens.length) {
  20394. token = tokens.shift();
  20395. if (token[0] === ':') {
  20396. node.raws.between += token[1];
  20397. break;
  20398. } else {
  20399. node.raws.between += token[1];
  20400. }
  20401. }
  20402. if (node.prop[0] === '_' || node.prop[0] === '*') {
  20403. node.raws.before += node.prop[0];
  20404. node.prop = node.prop.slice(1);
  20405. }
  20406. node.raws.between += this.spacesAndCommentsFromStart(tokens);
  20407. this.precheckMissedSemicolon(tokens);
  20408. for (var _i2 = tokens.length - 1; _i2 > 0; _i2--) {
  20409. token = tokens[_i2];
  20410. if (token[1] === '!important') {
  20411. node.important = true;
  20412. var string = this.stringFrom(tokens, _i2);
  20413. string = this.spacesFromEnd(tokens) + string;
  20414. if (string !== ' !important') {
  20415. node.raws.important = string;
  20416. }
  20417. break;
  20418. } else if (token[1] === 'important') {
  20419. var cache = tokens.slice(0);
  20420. var str = '';
  20421. for (var j = _i2; j > 0; j--) {
  20422. var _type = cache[j][0];
  20423. if (str.trim().indexOf('!') === 0 && _type !== 'space') {
  20424. break;
  20425. }
  20426. str = cache.pop()[1] + str;
  20427. }
  20428. if (str.trim().indexOf('!') === 0) {
  20429. node.important = true;
  20430. node.raws.important = str;
  20431. tokens = cache;
  20432. }
  20433. }
  20434. if (token[0] !== 'space' && token[0] !== 'comment') {
  20435. break;
  20436. }
  20437. }
  20438. this.raw(node, 'value', tokens);
  20439. if (node.value.indexOf(':') !== -1) {
  20440. this.checkMissedSemicolon(tokens);
  20441. }
  20442. this.current = node;
  20443. }
  20444. };
  20445. ScssParser.prototype.comment = function comment(token) {
  20446. if (token[6] === 'inline') {
  20447. var node = new Comment();
  20448. this.init(node, token[2], token[3]);
  20449. node.raws.inline = true;
  20450. node.source.end = {
  20451. line: token[4],
  20452. column: token[5]
  20453. };
  20454. var text = token[1].slice(2);
  20455. if (/^\s*$/.test(text)) {
  20456. node.text = '';
  20457. node.raws.left = text;
  20458. node.raws.right = '';
  20459. } else {
  20460. var match = text.match(/^(\s*)([^]*[^\s])(\s*)$/);
  20461. var fixed = match[2].replace(/(\*\/|\/\*)/g, '*//*');
  20462. node.text = fixed;
  20463. node.raws.left = match[1];
  20464. node.raws.right = match[3];
  20465. node.raws.text = match[2];
  20466. }
  20467. } else {
  20468. _Parser.prototype.comment.call(this, token);
  20469. }
  20470. };
  20471. ScssParser.prototype.raw = function raw(node, prop, tokens) {
  20472. _Parser.prototype.raw.call(this, node, prop, tokens);
  20473. if (node.raws[prop]) {
  20474. var scss = node.raws[prop].raw;
  20475. node.raws[prop].raw = tokens.reduce(function (all, i) {
  20476. if (i[0] === 'comment' && i[6] === 'inline') {
  20477. var text = i[1].slice(2).replace(/(\*\/|\/\*)/g, '*//*');
  20478. return all + '/*' + text + '*/';
  20479. } else {
  20480. return all + i[1];
  20481. }
  20482. }, '');
  20483. if (scss !== node.raws[prop].raw) {
  20484. node.raws[prop].scss = scss;
  20485. }
  20486. }
  20487. };
  20488. return ScssParser;
  20489. }(Parser);
  20490. module.exports = ScssParser;
  20491. /***/ }),
  20492. /* 132 */
  20493. /***/ (function(module, exports, __webpack_require__) {
  20494. "use strict";
  20495. exports.__esModule = true;
  20496. exports.default = tokenizer;
  20497. var SINGLE_QUOTE = '\''.charCodeAt(0);
  20498. var DOUBLE_QUOTE = '"'.charCodeAt(0);
  20499. var BACKSLASH = '\\'.charCodeAt(0);
  20500. var SLASH = '/'.charCodeAt(0);
  20501. var NEWLINE = '\n'.charCodeAt(0);
  20502. var SPACE = ' '.charCodeAt(0);
  20503. var FEED = '\f'.charCodeAt(0);
  20504. var TAB = '\t'.charCodeAt(0);
  20505. var CR = '\r'.charCodeAt(0);
  20506. var OPEN_SQUARE = '['.charCodeAt(0);
  20507. var CLOSE_SQUARE = ']'.charCodeAt(0);
  20508. var OPEN_PARENTHESES = '('.charCodeAt(0);
  20509. var CLOSE_PARENTHESES = ')'.charCodeAt(0);
  20510. var OPEN_CURLY = '{'.charCodeAt(0);
  20511. var CLOSE_CURLY = '}'.charCodeAt(0);
  20512. var SEMICOLON = ';'.charCodeAt(0);
  20513. var ASTERISK = '*'.charCodeAt(0);
  20514. var COLON = ':'.charCodeAt(0);
  20515. var AT = '@'.charCodeAt(0);
  20516. var RE_AT_END = /[ \n\t\r\f{}()'"\\;/[\]#]/g;
  20517. var RE_WORD_END = /[ \n\t\r\f(){}:;@!'"\\\][#]|\/(?=\*)/g;
  20518. var RE_BAD_BRACKET = /.[\\/("'\n]/;
  20519. var RE_HEX_ESCAPE = /[a-f0-9]/i;
  20520. function tokenizer(input, options) {
  20521. if (options === void 0) {
  20522. options = {};
  20523. }
  20524. var css = input.css.valueOf();
  20525. var ignore = options.ignoreErrors;
  20526. var code, next, quote, lines, last, content, escape;
  20527. var nextLine, nextOffset, escaped, escapePos, prev, n, currentToken;
  20528. var length = css.length;
  20529. var offset = -1;
  20530. var line = 1;
  20531. var pos = 0;
  20532. var buffer = [];
  20533. var returned = [];
  20534. function unclosed(what) {
  20535. throw input.error('Unclosed ' + what, line, pos - offset);
  20536. }
  20537. function endOfFile() {
  20538. return returned.length === 0 && pos >= length;
  20539. }
  20540. function nextToken(opts) {
  20541. if (returned.length) return returned.pop();
  20542. if (pos >= length) return;
  20543. var ignoreUnclosed = opts ? opts.ignoreUnclosed : false;
  20544. code = css.charCodeAt(pos);
  20545. if (code === NEWLINE || code === FEED || code === CR && css.charCodeAt(pos + 1) !== NEWLINE) {
  20546. offset = pos;
  20547. line += 1;
  20548. }
  20549. switch (code) {
  20550. case NEWLINE:
  20551. case SPACE:
  20552. case TAB:
  20553. case CR:
  20554. case FEED:
  20555. next = pos;
  20556. do {
  20557. next += 1;
  20558. code = css.charCodeAt(next);
  20559. if (code === NEWLINE) {
  20560. offset = next;
  20561. line += 1;
  20562. }
  20563. } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
  20564. currentToken = ['space', css.slice(pos, next)];
  20565. pos = next - 1;
  20566. break;
  20567. case OPEN_SQUARE:
  20568. case CLOSE_SQUARE:
  20569. case OPEN_CURLY:
  20570. case CLOSE_CURLY:
  20571. case COLON:
  20572. case SEMICOLON:
  20573. case CLOSE_PARENTHESES:
  20574. var controlChar = String.fromCharCode(code);
  20575. currentToken = [controlChar, controlChar, line, pos - offset];
  20576. break;
  20577. case OPEN_PARENTHESES:
  20578. prev = buffer.length ? buffer.pop()[1] : '';
  20579. n = css.charCodeAt(pos + 1);
  20580. if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {
  20581. next = pos;
  20582. do {
  20583. escaped = false;
  20584. next = css.indexOf(')', next + 1);
  20585. if (next === -1) {
  20586. if (ignore || ignoreUnclosed) {
  20587. next = pos;
  20588. break;
  20589. } else {
  20590. unclosed('bracket');
  20591. }
  20592. }
  20593. escapePos = next;
  20594. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  20595. escapePos -= 1;
  20596. escaped = !escaped;
  20597. }
  20598. } while (escaped);
  20599. currentToken = ['brackets', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  20600. pos = next;
  20601. } else {
  20602. next = css.indexOf(')', pos + 1);
  20603. content = css.slice(pos, next + 1);
  20604. if (next === -1 || RE_BAD_BRACKET.test(content)) {
  20605. currentToken = ['(', '(', line, pos - offset];
  20606. } else {
  20607. currentToken = ['brackets', content, line, pos - offset, line, next - offset];
  20608. pos = next;
  20609. }
  20610. }
  20611. break;
  20612. case SINGLE_QUOTE:
  20613. case DOUBLE_QUOTE:
  20614. quote = code === SINGLE_QUOTE ? '\'' : '"';
  20615. next = pos;
  20616. do {
  20617. escaped = false;
  20618. next = css.indexOf(quote, next + 1);
  20619. if (next === -1) {
  20620. if (ignore || ignoreUnclosed) {
  20621. next = pos + 1;
  20622. break;
  20623. } else {
  20624. unclosed('string');
  20625. }
  20626. }
  20627. escapePos = next;
  20628. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  20629. escapePos -= 1;
  20630. escaped = !escaped;
  20631. }
  20632. } while (escaped);
  20633. content = css.slice(pos, next + 1);
  20634. lines = content.split('\n');
  20635. last = lines.length - 1;
  20636. if (last > 0) {
  20637. nextLine = line + last;
  20638. nextOffset = next - lines[last].length;
  20639. } else {
  20640. nextLine = line;
  20641. nextOffset = offset;
  20642. }
  20643. currentToken = ['string', css.slice(pos, next + 1), line, pos - offset, nextLine, next - nextOffset];
  20644. offset = nextOffset;
  20645. line = nextLine;
  20646. pos = next;
  20647. break;
  20648. case AT:
  20649. RE_AT_END.lastIndex = pos + 1;
  20650. RE_AT_END.test(css);
  20651. if (RE_AT_END.lastIndex === 0) {
  20652. next = css.length - 1;
  20653. } else {
  20654. next = RE_AT_END.lastIndex - 2;
  20655. }
  20656. currentToken = ['at-word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  20657. pos = next;
  20658. break;
  20659. case BACKSLASH:
  20660. next = pos;
  20661. escape = true;
  20662. while (css.charCodeAt(next + 1) === BACKSLASH) {
  20663. next += 1;
  20664. escape = !escape;
  20665. }
  20666. code = css.charCodeAt(next + 1);
  20667. if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
  20668. next += 1;
  20669. if (RE_HEX_ESCAPE.test(css.charAt(next))) {
  20670. while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
  20671. next += 1;
  20672. }
  20673. if (css.charCodeAt(next + 1) === SPACE) {
  20674. next += 1;
  20675. }
  20676. }
  20677. }
  20678. currentToken = ['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  20679. pos = next;
  20680. break;
  20681. default:
  20682. if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
  20683. next = css.indexOf('*/', pos + 2) + 1;
  20684. if (next === 0) {
  20685. if (ignore || ignoreUnclosed) {
  20686. next = css.length;
  20687. } else {
  20688. unclosed('comment');
  20689. }
  20690. }
  20691. content = css.slice(pos, next + 1);
  20692. lines = content.split('\n');
  20693. last = lines.length - 1;
  20694. if (last > 0) {
  20695. nextLine = line + last;
  20696. nextOffset = next - lines[last].length;
  20697. } else {
  20698. nextLine = line;
  20699. nextOffset = offset;
  20700. }
  20701. currentToken = ['comment', content, line, pos - offset, nextLine, next - nextOffset];
  20702. offset = nextOffset;
  20703. line = nextLine;
  20704. pos = next;
  20705. } else {
  20706. RE_WORD_END.lastIndex = pos + 1;
  20707. RE_WORD_END.test(css);
  20708. if (RE_WORD_END.lastIndex === 0) {
  20709. next = css.length - 1;
  20710. } else {
  20711. next = RE_WORD_END.lastIndex - 2;
  20712. }
  20713. currentToken = ['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  20714. buffer.push(currentToken);
  20715. pos = next;
  20716. }
  20717. break;
  20718. }
  20719. pos++;
  20720. return currentToken;
  20721. }
  20722. function back(token) {
  20723. returned.push(token);
  20724. }
  20725. return {
  20726. back: back,
  20727. nextToken: nextToken,
  20728. endOfFile: endOfFile
  20729. };
  20730. }
  20731. module.exports = exports.default;
  20732. /***/ }),
  20733. /* 133 */
  20734. /***/ (function(module, exports, __webpack_require__) {
  20735. "use strict";
  20736. exports.__esModule = true;
  20737. exports.default = void 0;
  20738. /**
  20739. * Contains helpers for safely splitting lists of CSS values,
  20740. * preserving parentheses and quotes.
  20741. *
  20742. * @example
  20743. * const list = postcss.list
  20744. *
  20745. * @namespace list
  20746. */
  20747. var list = {
  20748. split: function split(string, separators, last) {
  20749. var array = [];
  20750. var current = '';
  20751. var split = false;
  20752. var func = 0;
  20753. var quote = false;
  20754. var escape = false;
  20755. for (var i = 0; i < string.length; i++) {
  20756. var letter = string[i];
  20757. if (quote) {
  20758. if (escape) {
  20759. escape = false;
  20760. } else if (letter === '\\') {
  20761. escape = true;
  20762. } else if (letter === quote) {
  20763. quote = false;
  20764. }
  20765. } else if (letter === '"' || letter === '\'') {
  20766. quote = letter;
  20767. } else if (letter === '(') {
  20768. func += 1;
  20769. } else if (letter === ')') {
  20770. if (func > 0) func -= 1;
  20771. } else if (func === 0) {
  20772. if (separators.indexOf(letter) !== -1) split = true;
  20773. }
  20774. if (split) {
  20775. if (current !== '') array.push(current.trim());
  20776. current = '';
  20777. split = false;
  20778. } else {
  20779. current += letter;
  20780. }
  20781. }
  20782. if (last || current !== '') array.push(current.trim());
  20783. return array;
  20784. },
  20785. /**
  20786. * Safely splits space-separated values (such as those for `background`,
  20787. * `border-radius`, and other shorthand properties).
  20788. *
  20789. * @param {string} string Space-separated values.
  20790. *
  20791. * @return {string[]} Split values.
  20792. *
  20793. * @example
  20794. * postcss.list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
  20795. */
  20796. space: function space(string) {
  20797. var spaces = [' ', '\n', '\t'];
  20798. return list.split(string, spaces);
  20799. },
  20800. /**
  20801. * Safely splits comma-separated values (such as those for `transition-*`
  20802. * and `background` properties).
  20803. *
  20804. * @param {string} string Comma-separated values.
  20805. *
  20806. * @return {string[]} Split values.
  20807. *
  20808. * @example
  20809. * postcss.list.comma('black, linear-gradient(white, black)')
  20810. * //=> ['black', 'linear-gradient(white, black)']
  20811. */
  20812. comma: function comma(string) {
  20813. return list.split(string, [','], true);
  20814. }
  20815. };
  20816. var _default = list;
  20817. exports.default = _default;
  20818. module.exports = exports.default;
  20819. /***/ }),
  20820. /* 134 */
  20821. /***/ (function(module, exports, __webpack_require__) {
  20822. "use strict";
  20823. exports.__esModule = true;
  20824. exports.default = void 0;
  20825. var _container = _interopRequireDefault(__webpack_require__(13));
  20826. function _interopRequireDefault(obj) {
  20827. return obj && obj.__esModule ? obj : {
  20828. default: obj
  20829. };
  20830. }
  20831. function _inheritsLoose(subClass, superClass) {
  20832. subClass.prototype = Object.create(superClass.prototype);
  20833. subClass.prototype.constructor = subClass;
  20834. subClass.__proto__ = superClass;
  20835. }
  20836. /**
  20837. * Represents a CSS file and contains all its parsed nodes.
  20838. *
  20839. * @extends Container
  20840. *
  20841. * @example
  20842. * const root = postcss.parse('a{color:black} b{z-index:2}')
  20843. * root.type //=> 'root'
  20844. * root.nodes.length //=> 2
  20845. */
  20846. var Root =
  20847. /*#__PURE__*/
  20848. function (_Container) {
  20849. _inheritsLoose(Root, _Container);
  20850. function Root(defaults) {
  20851. var _this;
  20852. _this = _Container.call(this, defaults) || this;
  20853. _this.type = 'root';
  20854. if (!_this.nodes) _this.nodes = [];
  20855. return _this;
  20856. }
  20857. var _proto = Root.prototype;
  20858. _proto.removeChild = function removeChild(child, ignore) {
  20859. var index = this.index(child);
  20860. if (!ignore && index === 0 && this.nodes.length > 1) {
  20861. this.nodes[1].raws.before = this.nodes[index].raws.before;
  20862. }
  20863. return _Container.prototype.removeChild.call(this, child);
  20864. };
  20865. _proto.normalize = function normalize(child, sample, type) {
  20866. var nodes = _Container.prototype.normalize.call(this, child);
  20867. if (sample) {
  20868. if (type === 'prepend') {
  20869. if (this.nodes.length > 1) {
  20870. sample.raws.before = this.nodes[1].raws.before;
  20871. } else {
  20872. delete sample.raws.before;
  20873. }
  20874. } else if (this.first !== sample) {
  20875. for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  20876. var _ref;
  20877. if (_isArray) {
  20878. if (_i >= _iterator.length) break;
  20879. _ref = _iterator[_i++];
  20880. } else {
  20881. _i = _iterator.next();
  20882. if (_i.done) break;
  20883. _ref = _i.value;
  20884. }
  20885. var node = _ref;
  20886. node.raws.before = sample.raws.before;
  20887. }
  20888. }
  20889. }
  20890. return nodes;
  20891. };
  20892. /**
  20893. * Returns a {@link Result} instance representing the root’s CSS.
  20894. *
  20895. * @param {processOptions} [opts] Options with only `to` and `map` keys.
  20896. *
  20897. * @return {Result} Result with current root’s CSS.
  20898. *
  20899. * @example
  20900. * const root1 = postcss.parse(css1, { from: 'a.css' })
  20901. * const root2 = postcss.parse(css2, { from: 'b.css' })
  20902. * root1.append(root2)
  20903. * const result = root1.toResult({ to: 'all.css', map: true })
  20904. */
  20905. _proto.toResult = function toResult(opts) {
  20906. if (opts === void 0) {
  20907. opts = {};
  20908. }
  20909. var LazyResult = __webpack_require__(71);
  20910. var Processor = __webpack_require__(139);
  20911. var lazy = new LazyResult(new Processor(), this, opts);
  20912. return lazy.stringify();
  20913. };
  20914. /**
  20915. * @memberof Root#
  20916. * @member {object} raws Information to generate byte-to-byte equal
  20917. * node string as it was in the origin input.
  20918. *
  20919. * Every parser saves its own properties,
  20920. * but the default CSS parser uses:
  20921. *
  20922. * * `after`: the space symbols after the last child to the end of file.
  20923. * * `semicolon`: is the last child has an (optional) semicolon.
  20924. *
  20925. * @example
  20926. * postcss.parse('a {}\n').raws //=> { after: '\n' }
  20927. * postcss.parse('a {}').raws //=> { after: '' }
  20928. */
  20929. return Root;
  20930. }(_container.default);
  20931. var _default = Root;
  20932. exports.default = _default;
  20933. module.exports = exports.default;
  20934. /***/ }),
  20935. /* 135 */
  20936. /***/ (function(module, exports, __webpack_require__) {
  20937. "use strict";
  20938. /* WEBPACK VAR INJECTION */(function(Buffer) {
  20939. exports.__esModule = true;
  20940. exports.default = void 0;
  20941. var _sourceMap = _interopRequireDefault(__webpack_require__(61));
  20942. var _path = _interopRequireDefault(__webpack_require__(6));
  20943. function _interopRequireDefault(obj) {
  20944. return obj && obj.__esModule ? obj : {
  20945. default: obj
  20946. };
  20947. }
  20948. var MapGenerator =
  20949. /*#__PURE__*/
  20950. function () {
  20951. function MapGenerator(stringify, root, opts) {
  20952. this.stringify = stringify;
  20953. this.mapOpts = opts.map || {};
  20954. this.root = root;
  20955. this.opts = opts;
  20956. }
  20957. var _proto = MapGenerator.prototype;
  20958. _proto.isMap = function isMap() {
  20959. if (typeof this.opts.map !== 'undefined') {
  20960. return !!this.opts.map;
  20961. }
  20962. return this.previous().length > 0;
  20963. };
  20964. _proto.previous = function previous() {
  20965. var _this = this;
  20966. if (!this.previousMaps) {
  20967. this.previousMaps = [];
  20968. this.root.walk(function (node) {
  20969. if (node.source && node.source.input.map) {
  20970. var map = node.source.input.map;
  20971. if (_this.previousMaps.indexOf(map) === -1) {
  20972. _this.previousMaps.push(map);
  20973. }
  20974. }
  20975. });
  20976. }
  20977. return this.previousMaps;
  20978. };
  20979. _proto.isInline = function isInline() {
  20980. if (typeof this.mapOpts.inline !== 'undefined') {
  20981. return this.mapOpts.inline;
  20982. }
  20983. var annotation = this.mapOpts.annotation;
  20984. if (typeof annotation !== 'undefined' && annotation !== true) {
  20985. return false;
  20986. }
  20987. if (this.previous().length) {
  20988. return this.previous().some(function (i) {
  20989. return i.inline;
  20990. });
  20991. }
  20992. return true;
  20993. };
  20994. _proto.isSourcesContent = function isSourcesContent() {
  20995. if (typeof this.mapOpts.sourcesContent !== 'undefined') {
  20996. return this.mapOpts.sourcesContent;
  20997. }
  20998. if (this.previous().length) {
  20999. return this.previous().some(function (i) {
  21000. return i.withContent();
  21001. });
  21002. }
  21003. return true;
  21004. };
  21005. _proto.clearAnnotation = function clearAnnotation() {
  21006. if (this.mapOpts.annotation === false) return;
  21007. var node;
  21008. for (var i = this.root.nodes.length - 1; i >= 0; i--) {
  21009. node = this.root.nodes[i];
  21010. if (node.type !== 'comment') continue;
  21011. if (node.text.indexOf('# sourceMappingURL=') === 0) {
  21012. this.root.removeChild(i);
  21013. }
  21014. }
  21015. };
  21016. _proto.setSourcesContent = function setSourcesContent() {
  21017. var _this2 = this;
  21018. var already = {};
  21019. this.root.walk(function (node) {
  21020. if (node.source) {
  21021. var from = node.source.input.from;
  21022. if (from && !already[from]) {
  21023. already[from] = true;
  21024. var relative = _this2.relative(from);
  21025. _this2.map.setSourceContent(relative, node.source.input.css);
  21026. }
  21027. }
  21028. });
  21029. };
  21030. _proto.applyPrevMaps = function applyPrevMaps() {
  21031. for (var _iterator = this.previous(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  21032. var _ref;
  21033. if (_isArray) {
  21034. if (_i >= _iterator.length) break;
  21035. _ref = _iterator[_i++];
  21036. } else {
  21037. _i = _iterator.next();
  21038. if (_i.done) break;
  21039. _ref = _i.value;
  21040. }
  21041. var prev = _ref;
  21042. var from = this.relative(prev.file);
  21043. var root = prev.root || _path.default.dirname(prev.file);
  21044. var map = void 0;
  21045. if (this.mapOpts.sourcesContent === false) {
  21046. map = new _sourceMap.default.SourceMapConsumer(prev.text);
  21047. if (map.sourcesContent) {
  21048. map.sourcesContent = map.sourcesContent.map(function () {
  21049. return null;
  21050. });
  21051. }
  21052. } else {
  21053. map = prev.consumer();
  21054. }
  21055. this.map.applySourceMap(map, from, this.relative(root));
  21056. }
  21057. };
  21058. _proto.isAnnotation = function isAnnotation() {
  21059. if (this.isInline()) {
  21060. return true;
  21061. }
  21062. if (typeof this.mapOpts.annotation !== 'undefined') {
  21063. return this.mapOpts.annotation;
  21064. }
  21065. if (this.previous().length) {
  21066. return this.previous().some(function (i) {
  21067. return i.annotation;
  21068. });
  21069. }
  21070. return true;
  21071. };
  21072. _proto.toBase64 = function toBase64(str) {
  21073. if (Buffer) {
  21074. return Buffer.from(str).toString('base64');
  21075. }
  21076. return window.btoa(unescape(encodeURIComponent(str)));
  21077. };
  21078. _proto.addAnnotation = function addAnnotation() {
  21079. var content;
  21080. if (this.isInline()) {
  21081. content = 'data:application/json;base64,' + this.toBase64(this.map.toString());
  21082. } else if (typeof this.mapOpts.annotation === 'string') {
  21083. content = this.mapOpts.annotation;
  21084. } else {
  21085. content = this.outputFile() + '.map';
  21086. }
  21087. var eol = '\n';
  21088. if (this.css.indexOf('\r\n') !== -1) eol = '\r\n';
  21089. this.css += eol + '/*# sourceMappingURL=' + content + ' */';
  21090. };
  21091. _proto.outputFile = function outputFile() {
  21092. if (this.opts.to) {
  21093. return this.relative(this.opts.to);
  21094. }
  21095. if (this.opts.from) {
  21096. return this.relative(this.opts.from);
  21097. }
  21098. return 'to.css';
  21099. };
  21100. _proto.generateMap = function generateMap() {
  21101. this.generateString();
  21102. if (this.isSourcesContent()) this.setSourcesContent();
  21103. if (this.previous().length > 0) this.applyPrevMaps();
  21104. if (this.isAnnotation()) this.addAnnotation();
  21105. if (this.isInline()) {
  21106. return [this.css];
  21107. }
  21108. return [this.css, this.map];
  21109. };
  21110. _proto.relative = function relative(file) {
  21111. if (file.indexOf('<') === 0) return file;
  21112. if (/^\w+:\/\//.test(file)) return file;
  21113. var from = this.opts.to ? _path.default.dirname(this.opts.to) : '.';
  21114. if (typeof this.mapOpts.annotation === 'string') {
  21115. from = _path.default.dirname(_path.default.resolve(from, this.mapOpts.annotation));
  21116. }
  21117. file = _path.default.relative(from, file);
  21118. if (_path.default.sep === '\\') {
  21119. return file.replace(/\\/g, '/');
  21120. }
  21121. return file;
  21122. };
  21123. _proto.sourcePath = function sourcePath(node) {
  21124. if (this.mapOpts.from) {
  21125. return this.mapOpts.from;
  21126. }
  21127. return this.relative(node.source.input.from);
  21128. };
  21129. _proto.generateString = function generateString() {
  21130. var _this3 = this;
  21131. this.css = '';
  21132. this.map = new _sourceMap.default.SourceMapGenerator({
  21133. file: this.outputFile()
  21134. });
  21135. var line = 1;
  21136. var column = 1;
  21137. var lines, last;
  21138. this.stringify(this.root, function (str, node, type) {
  21139. _this3.css += str;
  21140. if (node && type !== 'end') {
  21141. if (node.source && node.source.start) {
  21142. _this3.map.addMapping({
  21143. source: _this3.sourcePath(node),
  21144. generated: {
  21145. line: line,
  21146. column: column - 1
  21147. },
  21148. original: {
  21149. line: node.source.start.line,
  21150. column: node.source.start.column - 1
  21151. }
  21152. });
  21153. } else {
  21154. _this3.map.addMapping({
  21155. source: '<no source>',
  21156. original: {
  21157. line: 1,
  21158. column: 0
  21159. },
  21160. generated: {
  21161. line: line,
  21162. column: column - 1
  21163. }
  21164. });
  21165. }
  21166. }
  21167. lines = str.match(/\n/g);
  21168. if (lines) {
  21169. line += lines.length;
  21170. last = str.lastIndexOf('\n');
  21171. column = str.length - last;
  21172. } else {
  21173. column += str.length;
  21174. }
  21175. if (node && type !== 'start') {
  21176. if (node.source && node.source.end) {
  21177. _this3.map.addMapping({
  21178. source: _this3.sourcePath(node),
  21179. generated: {
  21180. line: line,
  21181. column: column - 1
  21182. },
  21183. original: {
  21184. line: node.source.end.line,
  21185. column: node.source.end.column
  21186. }
  21187. });
  21188. } else {
  21189. _this3.map.addMapping({
  21190. source: '<no source>',
  21191. original: {
  21192. line: 1,
  21193. column: 0
  21194. },
  21195. generated: {
  21196. line: line,
  21197. column: column - 1
  21198. }
  21199. });
  21200. }
  21201. }
  21202. });
  21203. };
  21204. _proto.generate = function generate() {
  21205. this.clearAnnotation();
  21206. if (this.isMap()) {
  21207. return this.generateMap();
  21208. }
  21209. var result = '';
  21210. this.stringify(this.root, function (i) {
  21211. result += i;
  21212. });
  21213. return [result];
  21214. };
  21215. return MapGenerator;
  21216. }();
  21217. var _default = MapGenerator;
  21218. exports.default = _default;
  21219. module.exports = exports.default;
  21220. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).Buffer))
  21221. /***/ }),
  21222. /* 136 */
  21223. /***/ (function(module, exports, __webpack_require__) {
  21224. "use strict";
  21225. exports.__esModule = true;
  21226. exports.default = warnOnce;
  21227. var printed = {};
  21228. function warnOnce(message) {
  21229. if (printed[message]) return;
  21230. printed[message] = true;
  21231. if (typeof console !== 'undefined' && console.warn) {
  21232. console.warn(message);
  21233. }
  21234. }
  21235. module.exports = exports.default;
  21236. /***/ }),
  21237. /* 137 */
  21238. /***/ (function(module, exports, __webpack_require__) {
  21239. "use strict";
  21240. exports.__esModule = true;
  21241. exports.default = void 0;
  21242. var _warning = _interopRequireDefault(__webpack_require__(138));
  21243. function _interopRequireDefault(obj) {
  21244. return obj && obj.__esModule ? obj : {
  21245. default: obj
  21246. };
  21247. }
  21248. function _defineProperties(target, props) {
  21249. for (var i = 0; i < props.length; i++) {
  21250. var descriptor = props[i];
  21251. descriptor.enumerable = descriptor.enumerable || false;
  21252. descriptor.configurable = true;
  21253. if ("value" in descriptor) descriptor.writable = true;
  21254. Object.defineProperty(target, descriptor.key, descriptor);
  21255. }
  21256. }
  21257. function _createClass(Constructor, protoProps, staticProps) {
  21258. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  21259. if (staticProps) _defineProperties(Constructor, staticProps);
  21260. return Constructor;
  21261. }
  21262. /**
  21263. * Provides the result of the PostCSS transformations.
  21264. *
  21265. * A Result instance is returned by {@link LazyResult#then}
  21266. * or {@link Root#toResult} methods.
  21267. *
  21268. * @example
  21269. * postcss([autoprefixer]).process(css).then(result => {
  21270. * console.log(result.css)
  21271. * })
  21272. *
  21273. * @example
  21274. * const result2 = postcss.parse(css).toResult()
  21275. */
  21276. var Result =
  21277. /*#__PURE__*/
  21278. function () {
  21279. /**
  21280. * @param {Processor} processor Processor used for this transformation.
  21281. * @param {Root} root Root node after all transformations.
  21282. * @param {processOptions} opts Options from the {@link Processor#process}
  21283. * or {@link Root#toResult}.
  21284. */
  21285. function Result(processor, root, opts) {
  21286. /**
  21287. * The Processor instance used for this transformation.
  21288. *
  21289. * @type {Processor}
  21290. *
  21291. * @example
  21292. * for (const plugin of result.processor.plugins) {
  21293. * if (plugin.postcssPlugin === 'postcss-bad') {
  21294. * throw 'postcss-good is incompatible with postcss-bad'
  21295. * }
  21296. * })
  21297. */
  21298. this.processor = processor;
  21299. /**
  21300. * Contains messages from plugins (e.g., warnings or custom messages).
  21301. * Each message should have type and plugin properties.
  21302. *
  21303. * @type {Message[]}
  21304. *
  21305. * @example
  21306. * postcss.plugin('postcss-min-browser', () => {
  21307. * return (root, result) => {
  21308. * const browsers = detectMinBrowsersByCanIUse(root)
  21309. * result.messages.push({
  21310. * type: 'min-browser',
  21311. * plugin: 'postcss-min-browser',
  21312. * browsers
  21313. * })
  21314. * }
  21315. * })
  21316. */
  21317. this.messages = [];
  21318. /**
  21319. * Root node after all transformations.
  21320. *
  21321. * @type {Root}
  21322. *
  21323. * @example
  21324. * root.toResult().root === root
  21325. */
  21326. this.root = root;
  21327. /**
  21328. * Options from the {@link Processor#process} or {@link Root#toResult} call
  21329. * that produced this Result instance.
  21330. *
  21331. * @type {processOptions}
  21332. *
  21333. * @example
  21334. * root.toResult(opts).opts === opts
  21335. */
  21336. this.opts = opts;
  21337. /**
  21338. * A CSS string representing of {@link Result#root}.
  21339. *
  21340. * @type {string}
  21341. *
  21342. * @example
  21343. * postcss.parse('a{}').toResult().css //=> "a{}"
  21344. */
  21345. this.css = undefined;
  21346. /**
  21347. * An instance of `SourceMapGenerator` class from the `source-map` library,
  21348. * representing changes to the {@link Result#root} instance.
  21349. *
  21350. * @type {SourceMapGenerator}
  21351. *
  21352. * @example
  21353. * result.map.toJSON() //=> { version: 3, file: 'a.css', … }
  21354. *
  21355. * @example
  21356. * if (result.map) {
  21357. * fs.writeFileSync(result.opts.to + '.map', result.map.toString())
  21358. * }
  21359. */
  21360. this.map = undefined;
  21361. }
  21362. /**
  21363. * Returns for @{link Result#css} content.
  21364. *
  21365. * @example
  21366. * result + '' === result.css
  21367. *
  21368. * @return {string} String representing of {@link Result#root}.
  21369. */
  21370. var _proto = Result.prototype;
  21371. _proto.toString = function toString() {
  21372. return this.css;
  21373. };
  21374. /**
  21375. * Creates an instance of {@link Warning} and adds it
  21376. * to {@link Result#messages}.
  21377. *
  21378. * @param {string} text Warning message.
  21379. * @param {Object} [opts] Warning options.
  21380. * @param {Node} opts.node CSS node that caused the warning.
  21381. * @param {string} opts.word Word in CSS source that caused the warning.
  21382. * @param {number} opts.index Index in CSS node string that caused
  21383. * the warning.
  21384. * @param {string} opts.plugin Name of the plugin that created
  21385. * this warning. {@link Result#warn} fills
  21386. * this property automatically.
  21387. *
  21388. * @return {Warning} Created warning.
  21389. */
  21390. _proto.warn = function warn(text, opts) {
  21391. if (opts === void 0) {
  21392. opts = {};
  21393. }
  21394. if (!opts.plugin) {
  21395. if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
  21396. opts.plugin = this.lastPlugin.postcssPlugin;
  21397. }
  21398. }
  21399. var warning = new _warning.default(text, opts);
  21400. this.messages.push(warning);
  21401. return warning;
  21402. };
  21403. /**
  21404. * Returns warnings from plugins. Filters {@link Warning} instances
  21405. * from {@link Result#messages}.
  21406. *
  21407. * @example
  21408. * result.warnings().forEach(warn => {
  21409. * console.warn(warn.toString())
  21410. * })
  21411. *
  21412. * @return {Warning[]} Warnings from plugins.
  21413. */
  21414. _proto.warnings = function warnings() {
  21415. return this.messages.filter(function (i) {
  21416. return i.type === 'warning';
  21417. });
  21418. };
  21419. /**
  21420. * An alias for the {@link Result#css} property.
  21421. * Use it with syntaxes that generate non-CSS output.
  21422. *
  21423. * @type {string}
  21424. *
  21425. * @example
  21426. * result.css === result.content
  21427. */
  21428. _createClass(Result, [{
  21429. key: "content",
  21430. get: function get() {
  21431. return this.css;
  21432. }
  21433. }]);
  21434. return Result;
  21435. }();
  21436. var _default = Result;
  21437. /**
  21438. * @typedef {object} Message
  21439. * @property {string} type Message type.
  21440. * @property {string} plugin Source PostCSS plugin name.
  21441. */
  21442. exports.default = _default;
  21443. module.exports = exports.default;
  21444. /***/ }),
  21445. /* 138 */
  21446. /***/ (function(module, exports, __webpack_require__) {
  21447. "use strict";
  21448. exports.__esModule = true;
  21449. exports.default = void 0;
  21450. /**
  21451. * Represents a plugin’s warning. It can be created using {@link Node#warn}.
  21452. *
  21453. * @example
  21454. * if (decl.important) {
  21455. * decl.warn(result, 'Avoid !important', { word: '!important' })
  21456. * }
  21457. */
  21458. var Warning =
  21459. /*#__PURE__*/
  21460. function () {
  21461. /**
  21462. * @param {string} text Warning message.
  21463. * @param {Object} [opts] Warning options.
  21464. * @param {Node} opts.node CSS node that caused the warning.
  21465. * @param {string} opts.word Word in CSS source that caused the warning.
  21466. * @param {number} opts.index Index in CSS node string that caused
  21467. * the warning.
  21468. * @param {string} opts.plugin Name of the plugin that created
  21469. * this warning. {@link Result#warn} fills
  21470. * this property automatically.
  21471. */
  21472. function Warning(text, opts) {
  21473. if (opts === void 0) {
  21474. opts = {};
  21475. }
  21476. /**
  21477. * Type to filter warnings from {@link Result#messages}.
  21478. * Always equal to `"warning"`.
  21479. *
  21480. * @type {string}
  21481. *
  21482. * @example
  21483. * const nonWarning = result.messages.filter(i => i.type !== 'warning')
  21484. */
  21485. this.type = 'warning';
  21486. /**
  21487. * The warning message.
  21488. *
  21489. * @type {string}
  21490. *
  21491. * @example
  21492. * warning.text //=> 'Try to avoid !important'
  21493. */
  21494. this.text = text;
  21495. if (opts.node && opts.node.source) {
  21496. var pos = opts.node.positionBy(opts);
  21497. /**
  21498. * Line in the input file with this warning’s source.
  21499. * @type {number}
  21500. *
  21501. * @example
  21502. * warning.line //=> 5
  21503. */
  21504. this.line = pos.line;
  21505. /**
  21506. * Column in the input file with this warning’s source.
  21507. *
  21508. * @type {number}
  21509. *
  21510. * @example
  21511. * warning.column //=> 6
  21512. */
  21513. this.column = pos.column;
  21514. }
  21515. for (var opt in opts) {
  21516. this[opt] = opts[opt];
  21517. }
  21518. }
  21519. /**
  21520. * Returns a warning position and message.
  21521. *
  21522. * @example
  21523. * warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important'
  21524. *
  21525. * @return {string} Warning position and message.
  21526. */
  21527. var _proto = Warning.prototype;
  21528. _proto.toString = function toString() {
  21529. if (this.node) {
  21530. return this.node.error(this.text, {
  21531. plugin: this.plugin,
  21532. index: this.index,
  21533. word: this.word
  21534. }).message;
  21535. }
  21536. if (this.plugin) {
  21537. return this.plugin + ': ' + this.text;
  21538. }
  21539. return this.text;
  21540. };
  21541. /**
  21542. * @memberof Warning#
  21543. * @member {string} plugin The name of the plugin that created
  21544. * it will fill this property automatically.
  21545. * this warning. When you call {@link Node#warn}
  21546. *
  21547. * @example
  21548. * warning.plugin //=> 'postcss-important'
  21549. */
  21550. /**
  21551. * @memberof Warning#
  21552. * @member {Node} node Contains the CSS node that caused the warning.
  21553. *
  21554. * @example
  21555. * warning.node.toString() //=> 'color: white !important'
  21556. */
  21557. return Warning;
  21558. }();
  21559. var _default = Warning;
  21560. exports.default = _default;
  21561. module.exports = exports.default;
  21562. /***/ }),
  21563. /* 139 */
  21564. /***/ (function(module, exports, __webpack_require__) {
  21565. "use strict";
  21566. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  21567. exports.__esModule = true;
  21568. exports.default = void 0;
  21569. var _lazyResult = _interopRequireDefault(__webpack_require__(71));
  21570. function _interopRequireDefault(obj) {
  21571. return obj && obj.__esModule ? obj : {
  21572. default: obj
  21573. };
  21574. }
  21575. /**
  21576. * Contains plugins to process CSS. Create one `Processor` instance,
  21577. * initialize its plugins, and then use that instance on numerous CSS files.
  21578. *
  21579. * @example
  21580. * const processor = postcss([autoprefixer, precss])
  21581. * processor.process(css1).then(result => console.log(result.css))
  21582. * processor.process(css2).then(result => console.log(result.css))
  21583. */
  21584. var Processor =
  21585. /*#__PURE__*/
  21586. function () {
  21587. /**
  21588. * @param {Array.<Plugin|pluginFunction>|Processor} plugins PostCSS plugins.
  21589. * See {@link Processor#use} for plugin format.
  21590. */
  21591. function Processor(plugins) {
  21592. if (plugins === void 0) {
  21593. plugins = [];
  21594. }
  21595. /**
  21596. * Current PostCSS version.
  21597. *
  21598. * @type {string}
  21599. *
  21600. * @example
  21601. * if (result.processor.version.split('.')[0] !== '6') {
  21602. * throw new Error('This plugin works only with PostCSS 6')
  21603. * }
  21604. */
  21605. this.version = '7.0.5';
  21606. /**
  21607. * Plugins added to this processor.
  21608. *
  21609. * @type {pluginFunction[]}
  21610. *
  21611. * @example
  21612. * const processor = postcss([autoprefixer, precss])
  21613. * processor.plugins.length //=> 2
  21614. */
  21615. this.plugins = this.normalize(plugins);
  21616. }
  21617. /**
  21618. * Adds a plugin to be used as a CSS processor.
  21619. *
  21620. * PostCSS plugin can be in 4 formats:
  21621. * * A plugin created by {@link postcss.plugin} method.
  21622. * * A function. PostCSS will pass the function a @{link Root}
  21623. * as the first argument and current {@link Result} instance
  21624. * as the second.
  21625. * * An object with a `postcss` method. PostCSS will use that method
  21626. * as described in #2.
  21627. * * Another {@link Processor} instance. PostCSS will copy plugins
  21628. * from that instance into this one.
  21629. *
  21630. * Plugins can also be added by passing them as arguments when creating
  21631. * a `postcss` instance (see [`postcss(plugins)`]).
  21632. *
  21633. * Asynchronous plugins should return a `Promise` instance.
  21634. *
  21635. * @param {Plugin|pluginFunction|Processor} plugin PostCSS plugin
  21636. * or {@link Processor}
  21637. * with plugins.
  21638. *
  21639. * @example
  21640. * const processor = postcss()
  21641. * .use(autoprefixer)
  21642. * .use(precss)
  21643. *
  21644. * @return {Processes} Current processor to make methods chain.
  21645. */
  21646. var _proto = Processor.prototype;
  21647. _proto.use = function use(plugin) {
  21648. this.plugins = this.plugins.concat(this.normalize([plugin]));
  21649. return this;
  21650. };
  21651. /**
  21652. * Parses source CSS and returns a {@link LazyResult} Promise proxy.
  21653. * Because some plugins can be asynchronous it doesn’t make
  21654. * any transformations. Transformations will be applied
  21655. * in the {@link LazyResult} methods.
  21656. *
  21657. * @param {string|toString|Result} css String with input CSS or any object
  21658. * with a `toString()` method,
  21659. * like a Buffer. Optionally, send
  21660. * a {@link Result} instance
  21661. * and the processor will take
  21662. * the {@link Root} from it.
  21663. * @param {processOptions} [opts] Options.
  21664. *
  21665. * @return {LazyResult} Promise proxy.
  21666. *
  21667. * @example
  21668. * processor.process(css, { from: 'a.css', to: 'a.out.css' })
  21669. * .then(result => {
  21670. * console.log(result.css)
  21671. * })
  21672. */
  21673. _proto.process = function (_process) {
  21674. function process(_x) {
  21675. return _process.apply(this, arguments);
  21676. }
  21677. process.toString = function () {
  21678. return _process.toString();
  21679. };
  21680. return process;
  21681. }(function (css, opts) {
  21682. if (opts === void 0) {
  21683. opts = {};
  21684. }
  21685. if (this.plugins.length === 0 && opts.parser === opts.stringifier) {
  21686. if (false) {
  21687. if (typeof console !== 'undefined' && console.warn) {
  21688. console.warn('You did not set any plugins, parser, or stringifier. ' + 'Right now, PostCSS does nothing. Pick plugins for your case ' + 'on https://www.postcss.parts/ and use them in postcss.config.js.');
  21689. }
  21690. }
  21691. }
  21692. return new _lazyResult.default(this, css, opts);
  21693. });
  21694. _proto.normalize = function normalize(plugins) {
  21695. var normalized = [];
  21696. for (var _iterator = plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  21697. var _ref;
  21698. if (_isArray) {
  21699. if (_i >= _iterator.length) break;
  21700. _ref = _iterator[_i++];
  21701. } else {
  21702. _i = _iterator.next();
  21703. if (_i.done) break;
  21704. _ref = _i.value;
  21705. }
  21706. var i = _ref;
  21707. if (i.postcss) i = i.postcss;
  21708. if (_typeof(i) === 'object' && Array.isArray(i.plugins)) {
  21709. normalized = normalized.concat(i.plugins);
  21710. } else if (typeof i === 'function') {
  21711. normalized.push(i);
  21712. } else if (_typeof(i) === 'object' && (i.parse || i.stringify)) {
  21713. if (false) {
  21714. throw new Error('PostCSS syntaxes cannot be used as plugins. Instead, please use ' + 'one of the syntax/parser/stringifier options as outlined ' + 'in your PostCSS runner documentation.');
  21715. }
  21716. } else {
  21717. throw new Error(i + ' is not a PostCSS plugin');
  21718. }
  21719. }
  21720. return normalized;
  21721. };
  21722. return Processor;
  21723. }();
  21724. var _default = Processor;
  21725. /**
  21726. * @callback builder
  21727. * @param {string} part Part of generated CSS connected to this node.
  21728. * @param {Node} node AST node.
  21729. * @param {"start"|"end"} [type] Node’s part type.
  21730. */
  21731. /**
  21732. * @callback parser
  21733. *
  21734. * @param {string|toString} css String with input CSS or any object
  21735. * with toString() method, like a Buffer.
  21736. * @param {processOptions} [opts] Options with only `from` and `map` keys.
  21737. *
  21738. * @return {Root} PostCSS AST
  21739. */
  21740. /**
  21741. * @callback stringifier
  21742. *
  21743. * @param {Node} node Start node for stringifing. Usually {@link Root}.
  21744. * @param {builder} builder Function to concatenate CSS from node’s parts
  21745. * or generate string and source map.
  21746. *
  21747. * @return {void}
  21748. */
  21749. /**
  21750. * @typedef {object} syntax
  21751. * @property {parser} parse Function to generate AST by string.
  21752. * @property {stringifier} stringify Function to generate string by AST.
  21753. */
  21754. /**
  21755. * @typedef {object} toString
  21756. * @property {function} toString
  21757. */
  21758. /**
  21759. * @callback pluginFunction
  21760. * @param {Root} root Parsed input CSS.
  21761. * @param {Result} result Result to set warnings or check other plugins.
  21762. */
  21763. /**
  21764. * @typedef {object} Plugin
  21765. * @property {function} postcss PostCSS plugin function.
  21766. */
  21767. /**
  21768. * @typedef {object} processOptions
  21769. * @property {string} from The path of the CSS source file.
  21770. * You should always set `from`,
  21771. * because it is used in source map
  21772. * generation and syntax error messages.
  21773. * @property {string} to The path where you’ll put the output
  21774. * CSS file. You should always set `to`
  21775. * to generate correct source maps.
  21776. * @property {parser} parser Function to generate AST by string.
  21777. * @property {stringifier} stringifier Class to generate string by AST.
  21778. * @property {syntax} syntax Object with `parse` and `stringify`.
  21779. * @property {object} map Source map options.
  21780. * @property {boolean} map.inline Does source map should
  21781. * be embedded in the output
  21782. * CSS as a base64-encoded
  21783. * comment.
  21784. * @property {string|object|false|function} map.prev Source map content
  21785. * from a previous
  21786. * processing step
  21787. * (for example, Sass).
  21788. * PostCSS will try to find
  21789. * previous map automatically,
  21790. * so you could disable it by
  21791. * `false` value.
  21792. * @property {boolean} map.sourcesContent Does PostCSS should set
  21793. * the origin content to map.
  21794. * @property {string|false} map.annotation Does PostCSS should set
  21795. * annotation comment to map.
  21796. * @property {string} map.from Override `from` in map’s
  21797. * sources`.
  21798. */
  21799. exports.default = _default;
  21800. module.exports = exports.default;
  21801. /***/ }),
  21802. /* 140 */
  21803. /***/ (function(module, exports, __webpack_require__) {
  21804. "use strict";
  21805. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  21806. function _classCallCheck(instance, Constructor) {
  21807. if (!(instance instanceof Constructor)) {
  21808. throw new TypeError("Cannot call a class as a function");
  21809. }
  21810. }
  21811. function _possibleConstructorReturn(self, call) {
  21812. if (!self) {
  21813. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  21814. }
  21815. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  21816. }
  21817. function _inherits(subClass, superClass) {
  21818. if (typeof superClass !== "function" && superClass !== null) {
  21819. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  21820. }
  21821. subClass.prototype = Object.create(superClass && superClass.prototype, {
  21822. constructor: {
  21823. value: subClass,
  21824. enumerable: false,
  21825. writable: true,
  21826. configurable: true
  21827. }
  21828. });
  21829. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  21830. }
  21831. var Container = __webpack_require__(13);
  21832. var NestedDeclaration = function (_Container) {
  21833. _inherits(NestedDeclaration, _Container);
  21834. function NestedDeclaration(defaults) {
  21835. _classCallCheck(this, NestedDeclaration);
  21836. var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
  21837. _this.type = 'decl';
  21838. _this.isNested = true;
  21839. if (!_this.nodes) _this.nodes = [];
  21840. return _this;
  21841. }
  21842. return NestedDeclaration;
  21843. }(Container);
  21844. module.exports = NestedDeclaration;
  21845. /***/ }),
  21846. /* 141 */
  21847. /***/ (function(module, exports, __webpack_require__) {
  21848. "use strict";
  21849. var SINGLE_QUOTE = 39;
  21850. var DOUBLE_QUOTE = 34;
  21851. var BACKSLASH = 92;
  21852. var SLASH = 47;
  21853. var NEWLINE = 10;
  21854. var SPACE = 32;
  21855. var FEED = 12;
  21856. var TAB = 9;
  21857. var CR = 13;
  21858. var OPEN_SQUARE = 91;
  21859. var CLOSE_SQUARE = 93;
  21860. var OPEN_PARENTHESES = 40;
  21861. var CLOSE_PARENTHESES = 41;
  21862. var OPEN_CURLY = 123;
  21863. var CLOSE_CURLY = 125;
  21864. var SEMICOLON = 59;
  21865. var ASTERISK = 42;
  21866. var COLON = 58;
  21867. var AT = 64; // SCSS PATCH {
  21868. var COMMA = 44;
  21869. var HASH = 35; // } SCSS PATCH
  21870. var RE_AT_END = /[ \n\t\r\f{}()'"\\;/[\]#]/g;
  21871. var RE_WORD_END = /[ \n\t\r\f(){}:;@!'"\\\][#]|\/(?=\*)/g;
  21872. var RE_BAD_BRACKET = /.[\\/("'\n]/;
  21873. var RE_HEX_ESCAPE = /[a-f0-9]/i;
  21874. var RE_NEW_LINE = /[\r\f\n]/g; // SCSS PATCH
  21875. // SCSS PATCH function name was changed
  21876. module.exports = function scssTokenize(input) {
  21877. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21878. var css = input.css.valueOf();
  21879. var ignore = options.ignoreErrors;
  21880. var code = void 0,
  21881. next = void 0,
  21882. quote = void 0,
  21883. lines = void 0,
  21884. last = void 0,
  21885. content = void 0,
  21886. escape = void 0,
  21887. nextLine = void 0,
  21888. nextOffset = void 0,
  21889. escaped = void 0,
  21890. prev = void 0,
  21891. n = void 0,
  21892. currentToken = void 0;
  21893. var brackets = void 0; // SCSS PATCH
  21894. var length = css.length;
  21895. var offset = -1;
  21896. var line = 1;
  21897. var pos = 0;
  21898. var buffer = [];
  21899. var returned = [];
  21900. function unclosed(what) {
  21901. throw input.error('Unclosed ' + what, line, pos - offset);
  21902. }
  21903. function endOfFile() {
  21904. return returned.length === 0 && pos >= length;
  21905. } // SCSS PATCH {
  21906. function interpolation() {
  21907. var deep = 1;
  21908. var stringQuote = false;
  21909. var stringEscaped = false;
  21910. while (deep > 0) {
  21911. next += 1;
  21912. if (css.length <= next) unclosed('interpolation');
  21913. code = css.charCodeAt(next);
  21914. n = css.charCodeAt(next + 1);
  21915. if (stringQuote) {
  21916. if (!stringEscaped && code === stringQuote) {
  21917. stringQuote = false;
  21918. stringEscaped = false;
  21919. } else if (code === BACKSLASH) {
  21920. stringEscaped = !escaped;
  21921. } else if (stringEscaped) {
  21922. stringEscaped = false;
  21923. }
  21924. } else if (code === SINGLE_QUOTE || code === DOUBLE_QUOTE) {
  21925. stringQuote = code;
  21926. } else if (code === CLOSE_CURLY) {
  21927. deep -= 1;
  21928. } else if (code === HASH && n === OPEN_CURLY) {
  21929. deep += 1;
  21930. }
  21931. }
  21932. } // } SCSS PATCH
  21933. function nextToken() {
  21934. if (returned.length) return returned.pop();
  21935. if (pos >= length) return;
  21936. code = css.charCodeAt(pos);
  21937. if (code === NEWLINE || code === FEED || code === CR && css.charCodeAt(pos + 1) !== NEWLINE) {
  21938. offset = pos;
  21939. line += 1;
  21940. }
  21941. switch (code) {
  21942. case NEWLINE:
  21943. case SPACE:
  21944. case TAB:
  21945. case CR:
  21946. case FEED:
  21947. next = pos;
  21948. do {
  21949. next += 1;
  21950. code = css.charCodeAt(next);
  21951. if (code === NEWLINE) {
  21952. offset = next;
  21953. line += 1;
  21954. }
  21955. } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
  21956. currentToken = ['space', css.slice(pos, next)];
  21957. pos = next - 1;
  21958. break;
  21959. case OPEN_SQUARE:
  21960. currentToken = ['[', '[', line, pos - offset];
  21961. break;
  21962. case CLOSE_SQUARE:
  21963. currentToken = [']', ']', line, pos - offset];
  21964. break;
  21965. case OPEN_CURLY:
  21966. currentToken = ['{', '{', line, pos - offset];
  21967. break;
  21968. case CLOSE_CURLY:
  21969. currentToken = ['}', '}', line, pos - offset];
  21970. break;
  21971. // SCSS PATCH {
  21972. case COMMA:
  21973. currentToken = ['word', ',', line, pos - offset, line, pos - offset + 1];
  21974. break;
  21975. // } SCSS PATCH
  21976. case COLON:
  21977. currentToken = [':', ':', line, pos - offset];
  21978. break;
  21979. case SEMICOLON:
  21980. currentToken = [';', ';', line, pos - offset];
  21981. break;
  21982. case OPEN_PARENTHESES:
  21983. prev = buffer.length ? buffer.pop()[1] : '';
  21984. n = css.charCodeAt(pos + 1); // SCSS PATCH {
  21985. if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE) {
  21986. brackets = 1;
  21987. escaped = false;
  21988. next = pos + 1;
  21989. while (next <= css.length - 1) {
  21990. n = css.charCodeAt(next);
  21991. if (n === BACKSLASH) {
  21992. escaped = !escaped;
  21993. } else if (n === OPEN_PARENTHESES) {
  21994. brackets += 1;
  21995. } else if (n === CLOSE_PARENTHESES) {
  21996. brackets -= 1;
  21997. if (brackets === 0) break;
  21998. }
  21999. next += 1;
  22000. }
  22001. content = css.slice(pos, next + 1);
  22002. lines = content.split('\n');
  22003. last = lines.length - 1;
  22004. if (last > 0) {
  22005. nextLine = line + last;
  22006. nextOffset = next - lines[last].length;
  22007. } else {
  22008. nextLine = line;
  22009. nextOffset = offset;
  22010. }
  22011. currentToken = ['brackets', content, line, pos - offset, nextLine, next - nextOffset];
  22012. offset = nextOffset;
  22013. line = nextLine;
  22014. pos = next; // } SCSS PATCH
  22015. } else {
  22016. next = css.indexOf(')', pos + 1);
  22017. content = css.slice(pos, next + 1);
  22018. if (next === -1 || RE_BAD_BRACKET.test(content)) {
  22019. currentToken = ['(', '(', line, pos - offset];
  22020. } else {
  22021. currentToken = ['brackets', content, line, pos - offset, line, next - offset];
  22022. pos = next;
  22023. }
  22024. }
  22025. break;
  22026. case CLOSE_PARENTHESES:
  22027. currentToken = [')', ')', line, pos - offset];
  22028. break;
  22029. case SINGLE_QUOTE:
  22030. case DOUBLE_QUOTE:
  22031. // SCSS PATCH {
  22032. quote = code;
  22033. next = pos;
  22034. escaped = false;
  22035. while (next < length) {
  22036. next++;
  22037. if (next === length) unclosed('string');
  22038. code = css.charCodeAt(next);
  22039. n = css.charCodeAt(next + 1);
  22040. if (!escaped && code === quote) {
  22041. break;
  22042. } else if (code === BACKSLASH) {
  22043. escaped = !escaped;
  22044. } else if (escaped) {
  22045. escaped = false;
  22046. } else if (code === HASH && n === OPEN_CURLY) {
  22047. interpolation();
  22048. }
  22049. } // } SCSS PATCH
  22050. content = css.slice(pos, next + 1);
  22051. lines = content.split('\n');
  22052. last = lines.length - 1;
  22053. if (last > 0) {
  22054. nextLine = line + last;
  22055. nextOffset = next - lines[last].length;
  22056. } else {
  22057. nextLine = line;
  22058. nextOffset = offset;
  22059. }
  22060. currentToken = ['string', css.slice(pos, next + 1), line, pos - offset, nextLine, next - nextOffset];
  22061. offset = nextOffset;
  22062. line = nextLine;
  22063. pos = next;
  22064. break;
  22065. case AT:
  22066. RE_AT_END.lastIndex = pos + 1;
  22067. RE_AT_END.test(css);
  22068. if (RE_AT_END.lastIndex === 0) {
  22069. next = css.length - 1;
  22070. } else {
  22071. next = RE_AT_END.lastIndex - 2;
  22072. }
  22073. currentToken = ['at-word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  22074. pos = next;
  22075. break;
  22076. case BACKSLASH:
  22077. next = pos;
  22078. escape = true;
  22079. while (css.charCodeAt(next + 1) === BACKSLASH) {
  22080. next += 1;
  22081. escape = !escape;
  22082. }
  22083. code = css.charCodeAt(next + 1);
  22084. if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
  22085. next += 1;
  22086. if (RE_HEX_ESCAPE.test(css.charAt(next))) {
  22087. while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
  22088. next += 1;
  22089. }
  22090. if (css.charCodeAt(next + 1) === SPACE) {
  22091. next += 1;
  22092. }
  22093. }
  22094. }
  22095. currentToken = ['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  22096. pos = next;
  22097. break;
  22098. default:
  22099. // SCSS PATCH {
  22100. n = css.charCodeAt(pos + 1);
  22101. if (code === HASH && n === OPEN_CURLY) {
  22102. next = pos;
  22103. interpolation();
  22104. content = css.slice(pos, next + 1);
  22105. lines = content.split('\n');
  22106. last = lines.length - 1;
  22107. if (last > 0) {
  22108. nextLine = line + last;
  22109. nextOffset = next - lines[last].length;
  22110. } else {
  22111. nextLine = line;
  22112. nextOffset = offset;
  22113. }
  22114. currentToken = ['word', content, line, pos - offset, nextLine, next - nextOffset];
  22115. offset = nextOffset;
  22116. line = nextLine;
  22117. pos = next;
  22118. } else if (code === SLASH && n === ASTERISK) {
  22119. // } SCSS PATCH
  22120. next = css.indexOf('*/', pos + 2) + 1;
  22121. if (next === 0) {
  22122. if (ignore) {
  22123. next = css.length;
  22124. } else {
  22125. unclosed('comment');
  22126. }
  22127. }
  22128. content = css.slice(pos, next + 1);
  22129. lines = content.split('\n');
  22130. last = lines.length - 1;
  22131. if (last > 0) {
  22132. nextLine = line + last;
  22133. nextOffset = next - lines[last].length;
  22134. } else {
  22135. nextLine = line;
  22136. nextOffset = offset;
  22137. }
  22138. currentToken = ['comment', content, line, pos - offset, nextLine, next - nextOffset];
  22139. offset = nextOffset;
  22140. line = nextLine;
  22141. pos = next; // SCSS PATCH {
  22142. } else if (code === SLASH && n === SLASH) {
  22143. RE_NEW_LINE.lastIndex = pos + 1;
  22144. RE_NEW_LINE.test(css);
  22145. if (RE_NEW_LINE.lastIndex === 0) {
  22146. next = css.length - 1;
  22147. } else {
  22148. next = RE_NEW_LINE.lastIndex - 2;
  22149. }
  22150. content = css.slice(pos, next + 1);
  22151. currentToken = ['comment', content, line, pos - offset, line, next - offset, 'inline'];
  22152. pos = next; // } SCSS PATCH
  22153. } else {
  22154. RE_WORD_END.lastIndex = pos + 1;
  22155. RE_WORD_END.test(css);
  22156. if (RE_WORD_END.lastIndex === 0) {
  22157. next = css.length - 1;
  22158. } else {
  22159. next = RE_WORD_END.lastIndex - 2;
  22160. }
  22161. currentToken = ['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];
  22162. buffer.push(currentToken);
  22163. pos = next;
  22164. }
  22165. break;
  22166. }
  22167. pos++;
  22168. return currentToken;
  22169. }
  22170. function back(token) {
  22171. returned.push(token);
  22172. }
  22173. return {
  22174. back: back,
  22175. nextToken: nextToken,
  22176. endOfFile: endOfFile
  22177. };
  22178. };
  22179. /***/ }),
  22180. /* 142 */
  22181. /***/ (function(module, exports, __webpack_require__) {
  22182. "use strict";
  22183. module.exports = false;
  22184. /***/ }),
  22185. /* 143 */
  22186. /***/ (function(module, exports, __webpack_require__) {
  22187. "use strict";
  22188. /* WEBPACK VAR INJECTION */(function(module) {
  22189. function assembleStyles() {
  22190. var styles = {
  22191. modifiers: {
  22192. reset: [0, 0],
  22193. bold: [1, 22],
  22194. // 21 isn't widely supported and 22 does the same thing
  22195. dim: [2, 22],
  22196. italic: [3, 23],
  22197. underline: [4, 24],
  22198. inverse: [7, 27],
  22199. hidden: [8, 28],
  22200. strikethrough: [9, 29]
  22201. },
  22202. colors: {
  22203. black: [30, 39],
  22204. red: [31, 39],
  22205. green: [32, 39],
  22206. yellow: [33, 39],
  22207. blue: [34, 39],
  22208. magenta: [35, 39],
  22209. cyan: [36, 39],
  22210. white: [37, 39],
  22211. gray: [90, 39]
  22212. },
  22213. bgColors: {
  22214. bgBlack: [40, 49],
  22215. bgRed: [41, 49],
  22216. bgGreen: [42, 49],
  22217. bgYellow: [43, 49],
  22218. bgBlue: [44, 49],
  22219. bgMagenta: [45, 49],
  22220. bgCyan: [46, 49],
  22221. bgWhite: [47, 49]
  22222. }
  22223. }; // fix humans
  22224. styles.colors.grey = styles.colors.gray;
  22225. Object.keys(styles).forEach(function (groupName) {
  22226. var group = styles[groupName];
  22227. Object.keys(group).forEach(function (styleName) {
  22228. var style = group[styleName];
  22229. styles[styleName] = group[styleName] = {
  22230. open: "\x1B[" + style[0] + 'm',
  22231. close: "\x1B[" + style[1] + 'm'
  22232. };
  22233. });
  22234. Object.defineProperty(styles, groupName, {
  22235. value: group,
  22236. enumerable: false
  22237. });
  22238. });
  22239. return styles;
  22240. }
  22241. Object.defineProperty(module, 'exports', {
  22242. enumerable: true,
  22243. get: assembleStyles
  22244. });
  22245. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(144)(module)))
  22246. /***/ }),
  22247. /* 144 */
  22248. /***/ (function(module, exports) {
  22249. module.exports = function (module) {
  22250. if (!module.webpackPolyfill) {
  22251. module.deprecate = function () {};
  22252. module.paths = []; // module.parent = undefined by default
  22253. if (!module.children) module.children = [];
  22254. Object.defineProperty(module, "loaded", {
  22255. enumerable: true,
  22256. get: function get() {
  22257. return module.l;
  22258. }
  22259. });
  22260. Object.defineProperty(module, "id", {
  22261. enumerable: true,
  22262. get: function get() {
  22263. return module.i;
  22264. }
  22265. });
  22266. module.webpackPolyfill = 1;
  22267. }
  22268. return module;
  22269. };
  22270. /***/ }),
  22271. /* 145 */
  22272. /***/ (function(module, exports, __webpack_require__) {
  22273. "use strict";
  22274. var ansiRegex = __webpack_require__(75)();
  22275. module.exports = function (str) {
  22276. return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
  22277. };
  22278. /***/ }),
  22279. /* 146 */
  22280. /***/ (function(module, exports, __webpack_require__) {
  22281. "use strict";
  22282. var ansiRegex = __webpack_require__(75);
  22283. var re = new RegExp(ansiRegex().source); // remove the `g` flag
  22284. module.exports = re.test.bind(re);
  22285. /***/ }),
  22286. /* 147 */
  22287. /***/ (function(module, exports, __webpack_require__) {
  22288. "use strict";
  22289. /* WEBPACK VAR INJECTION */(function(process) {
  22290. var argv = process.argv;
  22291. var terminator = argv.indexOf('--');
  22292. var hasFlag = function hasFlag(flag) {
  22293. flag = '--' + flag;
  22294. var pos = argv.indexOf(flag);
  22295. return pos !== -1 && (terminator !== -1 ? pos < terminator : true);
  22296. };
  22297. module.exports = function () {
  22298. if ('FORCE_COLOR' in process.env) {
  22299. return true;
  22300. }
  22301. if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
  22302. return false;
  22303. }
  22304. if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
  22305. return true;
  22306. }
  22307. if (process.stdout && !process.stdout.isTTY) {
  22308. return false;
  22309. }
  22310. if (process.platform === 'win32') {
  22311. return true;
  22312. }
  22313. if ('COLORTERM' in process.env) {
  22314. return true;
  22315. }
  22316. if (process.env.TERM === 'dumb') {
  22317. return false;
  22318. }
  22319. if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
  22320. return true;
  22321. }
  22322. return false;
  22323. }();
  22324. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12)))
  22325. /***/ }),
  22326. /* 148 */
  22327. /***/ (function(module, exports, __webpack_require__) {
  22328. "use strict";
  22329. exports.__esModule = true;
  22330. var _chalk = __webpack_require__(74);
  22331. var _chalk2 = _interopRequireDefault(_chalk);
  22332. var _tokenize = __webpack_require__(76);
  22333. var _tokenize2 = _interopRequireDefault(_tokenize);
  22334. var _input = __webpack_require__(23);
  22335. var _input2 = _interopRequireDefault(_input);
  22336. function _interopRequireDefault(obj) {
  22337. return obj && obj.__esModule ? obj : {
  22338. default: obj
  22339. };
  22340. }
  22341. var colors = new _chalk2.default.constructor({
  22342. enabled: true
  22343. });
  22344. var HIGHLIGHT_THEME = {
  22345. 'brackets': colors.cyan,
  22346. 'at-word': colors.cyan,
  22347. 'call': colors.cyan,
  22348. 'comment': colors.gray,
  22349. 'string': colors.green,
  22350. 'class': colors.yellow,
  22351. 'hash': colors.magenta,
  22352. '(': colors.cyan,
  22353. ')': colors.cyan,
  22354. '{': colors.yellow,
  22355. '}': colors.yellow,
  22356. '[': colors.yellow,
  22357. ']': colors.yellow,
  22358. ':': colors.yellow,
  22359. ';': colors.yellow
  22360. };
  22361. function getTokenType(_ref, index, tokens) {
  22362. var type = _ref[0],
  22363. value = _ref[1];
  22364. if (type === 'word') {
  22365. if (value[0] === '.') {
  22366. return 'class';
  22367. }
  22368. if (value[0] === '#') {
  22369. return 'hash';
  22370. }
  22371. }
  22372. var nextToken = tokens[index + 1];
  22373. if (nextToken && (nextToken[0] === 'brackets' || nextToken[0] === '(')) {
  22374. return 'call';
  22375. }
  22376. return type;
  22377. }
  22378. function terminalHighlight(css) {
  22379. var tokens = (0, _tokenize2.default)(new _input2.default(css), {
  22380. ignoreErrors: true
  22381. });
  22382. return tokens.map(function (token, index) {
  22383. var color = HIGHLIGHT_THEME[getTokenType(token, index, tokens)];
  22384. if (color) {
  22385. return token[1].split(/\r?\n/).map(function (i) {
  22386. return color(i);
  22387. }).join('\n');
  22388. } else {
  22389. return token[1];
  22390. }
  22391. }).join('');
  22392. }
  22393. exports.default = terminalHighlight;
  22394. module.exports = exports['default'];
  22395. /***/ }),
  22396. /* 149 */
  22397. /***/ (function(module, exports, __webpack_require__) {
  22398. "use strict";
  22399. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  22400. exports.__esModule = true;
  22401. var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  22402. return _typeof2(obj);
  22403. } : function (obj) {
  22404. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  22405. };
  22406. var _jsBase = __webpack_require__(77);
  22407. var _sourceMap = __webpack_require__(78);
  22408. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  22409. var _path = __webpack_require__(6);
  22410. var _path2 = _interopRequireDefault(_path);
  22411. var _fs = __webpack_require__(156);
  22412. var _fs2 = _interopRequireDefault(_fs);
  22413. function _interopRequireDefault(obj) {
  22414. return obj && obj.__esModule ? obj : {
  22415. default: obj
  22416. };
  22417. }
  22418. function _classCallCheck(instance, Constructor) {
  22419. if (!(instance instanceof Constructor)) {
  22420. throw new TypeError("Cannot call a class as a function");
  22421. }
  22422. }
  22423. /**
  22424. * Source map information from input CSS.
  22425. * For example, source map after Sass compiler.
  22426. *
  22427. * This class will automatically find source map in input CSS or in file system
  22428. * near input file (according `from` option).
  22429. *
  22430. * @example
  22431. * const root = postcss.parse(css, { from: 'a.sass.css' });
  22432. * root.input.map //=> PreviousMap
  22433. */
  22434. var PreviousMap = function () {
  22435. /**
  22436. * @param {string} css - input CSS source
  22437. * @param {processOptions} [opts] - {@link Processor#process} options
  22438. */
  22439. function PreviousMap(css, opts) {
  22440. _classCallCheck(this, PreviousMap);
  22441. this.loadAnnotation(css);
  22442. /**
  22443. * @member {boolean} - Was source map inlined by data-uri to input CSS.
  22444. */
  22445. this.inline = this.startWith(this.annotation, 'data:');
  22446. var prev = opts.map ? opts.map.prev : undefined;
  22447. var text = this.loadMap(opts.from, prev);
  22448. if (text) this.text = text;
  22449. }
  22450. /**
  22451. * Create a instance of `SourceMapGenerator` class
  22452. * from the `source-map` library to work with source map information.
  22453. *
  22454. * It is lazy method, so it will create object only on first call
  22455. * and then it will use cache.
  22456. *
  22457. * @return {SourceMapGenerator} object with source map information
  22458. */
  22459. PreviousMap.prototype.consumer = function consumer() {
  22460. if (!this.consumerCache) {
  22461. this.consumerCache = new _sourceMap2.default.SourceMapConsumer(this.text);
  22462. }
  22463. return this.consumerCache;
  22464. };
  22465. /**
  22466. * Does source map contains `sourcesContent` with input source text.
  22467. *
  22468. * @return {boolean} Is `sourcesContent` present
  22469. */
  22470. PreviousMap.prototype.withContent = function withContent() {
  22471. return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
  22472. };
  22473. PreviousMap.prototype.startWith = function startWith(string, start) {
  22474. if (!string) return false;
  22475. return string.substr(0, start.length) === start;
  22476. };
  22477. PreviousMap.prototype.loadAnnotation = function loadAnnotation(css) {
  22478. var match = css.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//);
  22479. if (match) this.annotation = match[1].trim();
  22480. };
  22481. PreviousMap.prototype.decodeInline = function decodeInline(text) {
  22482. var utfd64 = 'data:application/json;charset=utf-8;base64,';
  22483. var utf64 = 'data:application/json;charset=utf8;base64,';
  22484. var b64 = 'data:application/json;base64,';
  22485. var uri = 'data:application/json,';
  22486. if (this.startWith(text, uri)) {
  22487. return decodeURIComponent(text.substr(uri.length));
  22488. } else if (this.startWith(text, b64)) {
  22489. return _jsBase.Base64.decode(text.substr(b64.length));
  22490. } else if (this.startWith(text, utf64)) {
  22491. return _jsBase.Base64.decode(text.substr(utf64.length));
  22492. } else if (this.startWith(text, utfd64)) {
  22493. return _jsBase.Base64.decode(text.substr(utfd64.length));
  22494. } else {
  22495. var encoding = text.match(/data:application\/json;([^,]+),/)[1];
  22496. throw new Error('Unsupported source map encoding ' + encoding);
  22497. }
  22498. };
  22499. PreviousMap.prototype.loadMap = function loadMap(file, prev) {
  22500. if (prev === false) return false;
  22501. if (prev) {
  22502. if (typeof prev === 'string') {
  22503. return prev;
  22504. } else if (typeof prev === 'function') {
  22505. var prevPath = prev(file);
  22506. if (prevPath && _fs2.default.existsSync && _fs2.default.existsSync(prevPath)) {
  22507. return _fs2.default.readFileSync(prevPath, 'utf-8').toString().trim();
  22508. } else {
  22509. throw new Error('Unable to load previous source map: ' + prevPath.toString());
  22510. }
  22511. } else if (prev instanceof _sourceMap2.default.SourceMapConsumer) {
  22512. return _sourceMap2.default.SourceMapGenerator.fromSourceMap(prev).toString();
  22513. } else if (prev instanceof _sourceMap2.default.SourceMapGenerator) {
  22514. return prev.toString();
  22515. } else if (this.isMap(prev)) {
  22516. return JSON.stringify(prev);
  22517. } else {
  22518. throw new Error('Unsupported previous source map format: ' + prev.toString());
  22519. }
  22520. } else if (this.inline) {
  22521. return this.decodeInline(this.annotation);
  22522. } else if (this.annotation) {
  22523. var map = this.annotation;
  22524. if (file) map = _path2.default.join(_path2.default.dirname(file), map);
  22525. this.root = _path2.default.dirname(map);
  22526. if (_fs2.default.existsSync && _fs2.default.existsSync(map)) {
  22527. return _fs2.default.readFileSync(map, 'utf-8').toString().trim();
  22528. } else {
  22529. return false;
  22530. }
  22531. }
  22532. };
  22533. PreviousMap.prototype.isMap = function isMap(map) {
  22534. if ((typeof map === 'undefined' ? 'undefined' : _typeof(map)) !== 'object') return false;
  22535. return typeof map.mappings === 'string' || typeof map._mappings === 'string';
  22536. };
  22537. return PreviousMap;
  22538. }();
  22539. exports.default = PreviousMap;
  22540. module.exports = exports['default'];
  22541. /***/ }),
  22542. /* 150 */
  22543. /***/ (function(module, exports) {
  22544. /* -*- Mode: js; js-indent-level: 2; -*- */
  22545. /*
  22546. * Copyright 2011 Mozilla Foundation and contributors
  22547. * Licensed under the New BSD license. See LICENSE or:
  22548. * http://opensource.org/licenses/BSD-3-Clause
  22549. */
  22550. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  22551. /**
  22552. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  22553. */
  22554. exports.encode = function (number) {
  22555. if (0 <= number && number < intToCharMap.length) {
  22556. return intToCharMap[number];
  22557. }
  22558. throw new TypeError("Must be between 0 and 63: " + number);
  22559. };
  22560. /**
  22561. * Decode a single base 64 character code digit to an integer. Returns -1 on
  22562. * failure.
  22563. */
  22564. exports.decode = function (charCode) {
  22565. var bigA = 65; // 'A'
  22566. var bigZ = 90; // 'Z'
  22567. var littleA = 97; // 'a'
  22568. var littleZ = 122; // 'z'
  22569. var zero = 48; // '0'
  22570. var nine = 57; // '9'
  22571. var plus = 43; // '+'
  22572. var slash = 47; // '/'
  22573. var littleOffset = 26;
  22574. var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  22575. if (bigA <= charCode && charCode <= bigZ) {
  22576. return charCode - bigA;
  22577. } // 26 - 51: abcdefghijklmnopqrstuvwxyz
  22578. if (littleA <= charCode && charCode <= littleZ) {
  22579. return charCode - littleA + littleOffset;
  22580. } // 52 - 61: 0123456789
  22581. if (zero <= charCode && charCode <= nine) {
  22582. return charCode - zero + numberOffset;
  22583. } // 62: +
  22584. if (charCode == plus) {
  22585. return 62;
  22586. } // 63: /
  22587. if (charCode == slash) {
  22588. return 63;
  22589. } // Invalid base64 digit.
  22590. return -1;
  22591. };
  22592. /***/ }),
  22593. /* 151 */
  22594. /***/ (function(module, exports, __webpack_require__) {
  22595. /* -*- Mode: js; js-indent-level: 2; -*- */
  22596. /*
  22597. * Copyright 2014 Mozilla Foundation and contributors
  22598. * Licensed under the New BSD license. See LICENSE or:
  22599. * http://opensource.org/licenses/BSD-3-Clause
  22600. */
  22601. var util = __webpack_require__(9);
  22602. /**
  22603. * Determine whether mappingB is after mappingA with respect to generated
  22604. * position.
  22605. */
  22606. function generatedPositionAfter(mappingA, mappingB) {
  22607. // Optimized for most common case
  22608. var lineA = mappingA.generatedLine;
  22609. var lineB = mappingB.generatedLine;
  22610. var columnA = mappingA.generatedColumn;
  22611. var columnB = mappingB.generatedColumn;
  22612. return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  22613. }
  22614. /**
  22615. * A data structure to provide a sorted view of accumulated mappings in a
  22616. * performance conscious manner. It trades a neglibable overhead in general
  22617. * case for a large speedup in case of mappings being added in order.
  22618. */
  22619. function MappingList() {
  22620. this._array = [];
  22621. this._sorted = true; // Serves as infimum
  22622. this._last = {
  22623. generatedLine: -1,
  22624. generatedColumn: 0
  22625. };
  22626. }
  22627. /**
  22628. * Iterate through internal items. This method takes the same arguments that
  22629. * `Array.prototype.forEach` takes.
  22630. *
  22631. * NOTE: The order of the mappings is NOT guaranteed.
  22632. */
  22633. MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
  22634. this._array.forEach(aCallback, aThisArg);
  22635. };
  22636. /**
  22637. * Add the given source mapping.
  22638. *
  22639. * @param Object aMapping
  22640. */
  22641. MappingList.prototype.add = function MappingList_add(aMapping) {
  22642. if (generatedPositionAfter(this._last, aMapping)) {
  22643. this._last = aMapping;
  22644. this._array.push(aMapping);
  22645. } else {
  22646. this._sorted = false;
  22647. this._array.push(aMapping);
  22648. }
  22649. };
  22650. /**
  22651. * Returns the flat, sorted array of mappings. The mappings are sorted by
  22652. * generated position.
  22653. *
  22654. * WARNING: This method returns internal data without copying, for
  22655. * performance. The return value must NOT be mutated, and should be treated as
  22656. * an immutable borrow. If you want to take ownership, you must make your own
  22657. * copy.
  22658. */
  22659. MappingList.prototype.toArray = function MappingList_toArray() {
  22660. if (!this._sorted) {
  22661. this._array.sort(util.compareByGeneratedPositionsInflated);
  22662. this._sorted = true;
  22663. }
  22664. return this._array;
  22665. };
  22666. exports.MappingList = MappingList;
  22667. /***/ }),
  22668. /* 152 */
  22669. /***/ (function(module, exports, __webpack_require__) {
  22670. /* -*- Mode: js; js-indent-level: 2; -*- */
  22671. /*
  22672. * Copyright 2011 Mozilla Foundation and contributors
  22673. * Licensed under the New BSD license. See LICENSE or:
  22674. * http://opensource.org/licenses/BSD-3-Clause
  22675. */
  22676. var util = __webpack_require__(9);
  22677. var binarySearch = __webpack_require__(153);
  22678. var ArraySet = __webpack_require__(81).ArraySet;
  22679. var base64VLQ = __webpack_require__(80);
  22680. var quickSort = __webpack_require__(154).quickSort;
  22681. function SourceMapConsumer(aSourceMap) {
  22682. var sourceMap = aSourceMap;
  22683. if (typeof aSourceMap === 'string') {
  22684. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  22685. }
  22686. return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap) : new BasicSourceMapConsumer(sourceMap);
  22687. }
  22688. SourceMapConsumer.fromSourceMap = function (aSourceMap) {
  22689. return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
  22690. };
  22691. /**
  22692. * The version of the source mapping spec that we are consuming.
  22693. */
  22694. SourceMapConsumer.prototype._version = 3; // `__generatedMappings` and `__originalMappings` are arrays that hold the
  22695. // parsed mapping coordinates from the source map's "mappings" attribute. They
  22696. // are lazily instantiated, accessed via the `_generatedMappings` and
  22697. // `_originalMappings` getters respectively, and we only parse the mappings
  22698. // and create these arrays once queried for a source location. We jump through
  22699. // these hoops because there can be many thousands of mappings, and parsing
  22700. // them is expensive, so we only want to do it if we must.
  22701. //
  22702. // Each object in the arrays is of the form:
  22703. //
  22704. // {
  22705. // generatedLine: The line number in the generated code,
  22706. // generatedColumn: The column number in the generated code,
  22707. // source: The path to the original source file that generated this
  22708. // chunk of code,
  22709. // originalLine: The line number in the original source that
  22710. // corresponds to this chunk of generated code,
  22711. // originalColumn: The column number in the original source that
  22712. // corresponds to this chunk of generated code,
  22713. // name: The name of the original symbol which generated this chunk of
  22714. // code.
  22715. // }
  22716. //
  22717. // All properties except for `generatedLine` and `generatedColumn` can be
  22718. // `null`.
  22719. //
  22720. // `_generatedMappings` is ordered by the generated positions.
  22721. //
  22722. // `_originalMappings` is ordered by the original positions.
  22723. SourceMapConsumer.prototype.__generatedMappings = null;
  22724. Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
  22725. get: function get() {
  22726. if (!this.__generatedMappings) {
  22727. this._parseMappings(this._mappings, this.sourceRoot);
  22728. }
  22729. return this.__generatedMappings;
  22730. }
  22731. });
  22732. SourceMapConsumer.prototype.__originalMappings = null;
  22733. Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
  22734. get: function get() {
  22735. if (!this.__originalMappings) {
  22736. this._parseMappings(this._mappings, this.sourceRoot);
  22737. }
  22738. return this.__originalMappings;
  22739. }
  22740. });
  22741. SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  22742. var c = aStr.charAt(index);
  22743. return c === ";" || c === ",";
  22744. };
  22745. /**
  22746. * Parse the mappings in a string in to a data structure which we can easily
  22747. * query (the ordered arrays in the `this.__generatedMappings` and
  22748. * `this.__originalMappings` properties).
  22749. */
  22750. SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  22751. throw new Error("Subclasses must implement _parseMappings");
  22752. };
  22753. SourceMapConsumer.GENERATED_ORDER = 1;
  22754. SourceMapConsumer.ORIGINAL_ORDER = 2;
  22755. SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  22756. SourceMapConsumer.LEAST_UPPER_BOUND = 2;
  22757. /**
  22758. * Iterate over each mapping between an original source/line/column and a
  22759. * generated line/column in this source map.
  22760. *
  22761. * @param Function aCallback
  22762. * The function that is called with each mapping.
  22763. * @param Object aContext
  22764. * Optional. If specified, this object will be the value of `this` every
  22765. * time that `aCallback` is called.
  22766. * @param aOrder
  22767. * Either `SourceMapConsumer.GENERATED_ORDER` or
  22768. * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  22769. * iterate over the mappings sorted by the generated file's line/column
  22770. * order or the original's source/line/column order, respectively. Defaults to
  22771. * `SourceMapConsumer.GENERATED_ORDER`.
  22772. */
  22773. SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  22774. var context = aContext || null;
  22775. var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
  22776. var mappings;
  22777. switch (order) {
  22778. case SourceMapConsumer.GENERATED_ORDER:
  22779. mappings = this._generatedMappings;
  22780. break;
  22781. case SourceMapConsumer.ORIGINAL_ORDER:
  22782. mappings = this._originalMappings;
  22783. break;
  22784. default:
  22785. throw new Error("Unknown order of iteration.");
  22786. }
  22787. var sourceRoot = this.sourceRoot;
  22788. mappings.map(function (mapping) {
  22789. var source = mapping.source === null ? null : this._sources.at(mapping.source);
  22790. if (source != null && sourceRoot != null) {
  22791. source = util.join(sourceRoot, source);
  22792. }
  22793. return {
  22794. source: source,
  22795. generatedLine: mapping.generatedLine,
  22796. generatedColumn: mapping.generatedColumn,
  22797. originalLine: mapping.originalLine,
  22798. originalColumn: mapping.originalColumn,
  22799. name: mapping.name === null ? null : this._names.at(mapping.name)
  22800. };
  22801. }, this).forEach(aCallback, context);
  22802. };
  22803. /**
  22804. * Returns all generated line and column information for the original source,
  22805. * line, and column provided. If no column is provided, returns all mappings
  22806. * corresponding to a either the line we are searching for or the next
  22807. * closest line that has any mappings. Otherwise, returns all mappings
  22808. * corresponding to the given line and either the column we are searching for
  22809. * or the next closest column that has any offsets.
  22810. *
  22811. * The only argument is an object with the following properties:
  22812. *
  22813. * - source: The filename of the original source.
  22814. * - line: The line number in the original source.
  22815. * - column: Optional. the column number in the original source.
  22816. *
  22817. * and an array of objects is returned, each with the following properties:
  22818. *
  22819. * - line: The line number in the generated source, or null.
  22820. * - column: The column number in the generated source, or null.
  22821. */
  22822. SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  22823. var line = util.getArg(aArgs, 'line'); // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  22824. // returns the index of the closest mapping less than the needle. By
  22825. // setting needle.originalColumn to 0, we thus find the last mapping for
  22826. // the given line, provided such a mapping exists.
  22827. var needle = {
  22828. source: util.getArg(aArgs, 'source'),
  22829. originalLine: line,
  22830. originalColumn: util.getArg(aArgs, 'column', 0)
  22831. };
  22832. if (this.sourceRoot != null) {
  22833. needle.source = util.relative(this.sourceRoot, needle.source);
  22834. }
  22835. if (!this._sources.has(needle.source)) {
  22836. return [];
  22837. }
  22838. needle.source = this._sources.indexOf(needle.source);
  22839. var mappings = [];
  22840. var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
  22841. if (index >= 0) {
  22842. var mapping = this._originalMappings[index];
  22843. if (aArgs.column === undefined) {
  22844. var originalLine = mapping.originalLine; // Iterate until either we run out of mappings, or we run into
  22845. // a mapping for a different line than the one we found. Since
  22846. // mappings are sorted, this is guaranteed to find all mappings for
  22847. // the line we found.
  22848. while (mapping && mapping.originalLine === originalLine) {
  22849. mappings.push({
  22850. line: util.getArg(mapping, 'generatedLine', null),
  22851. column: util.getArg(mapping, 'generatedColumn', null),
  22852. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  22853. });
  22854. mapping = this._originalMappings[++index];
  22855. }
  22856. } else {
  22857. var originalColumn = mapping.originalColumn; // Iterate until either we run out of mappings, or we run into
  22858. // a mapping for a different line than the one we were searching for.
  22859. // Since mappings are sorted, this is guaranteed to find all mappings for
  22860. // the line we are searching for.
  22861. while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
  22862. mappings.push({
  22863. line: util.getArg(mapping, 'generatedLine', null),
  22864. column: util.getArg(mapping, 'generatedColumn', null),
  22865. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  22866. });
  22867. mapping = this._originalMappings[++index];
  22868. }
  22869. }
  22870. }
  22871. return mappings;
  22872. };
  22873. exports.SourceMapConsumer = SourceMapConsumer;
  22874. /**
  22875. * A BasicSourceMapConsumer instance represents a parsed source map which we can
  22876. * query for information about the original file positions by giving it a file
  22877. * position in the generated source.
  22878. *
  22879. * The only parameter is the raw source map (either as a JSON string, or
  22880. * already parsed to an object). According to the spec, source maps have the
  22881. * following attributes:
  22882. *
  22883. * - version: Which version of the source map spec this map is following.
  22884. * - sources: An array of URLs to the original source files.
  22885. * - names: An array of identifiers which can be referrenced by individual mappings.
  22886. * - sourceRoot: Optional. The URL root from which all sources are relative.
  22887. * - sourcesContent: Optional. An array of contents of the original source files.
  22888. * - mappings: A string of base64 VLQs which contain the actual mappings.
  22889. * - file: Optional. The generated file this source map is associated with.
  22890. *
  22891. * Here is an example source map, taken from the source map spec[0]:
  22892. *
  22893. * {
  22894. * version : 3,
  22895. * file: "out.js",
  22896. * sourceRoot : "",
  22897. * sources: ["foo.js", "bar.js"],
  22898. * names: ["src", "maps", "are", "fun"],
  22899. * mappings: "AA,AB;;ABCDE;"
  22900. * }
  22901. *
  22902. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  22903. */
  22904. function BasicSourceMapConsumer(aSourceMap) {
  22905. var sourceMap = aSourceMap;
  22906. if (typeof aSourceMap === 'string') {
  22907. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  22908. }
  22909. var version = util.getArg(sourceMap, 'version');
  22910. var sources = util.getArg(sourceMap, 'sources'); // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  22911. // requires the array) to play nice here.
  22912. var names = util.getArg(sourceMap, 'names', []);
  22913. var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  22914. var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  22915. var mappings = util.getArg(sourceMap, 'mappings');
  22916. var file = util.getArg(sourceMap, 'file', null); // Once again, Sass deviates from the spec and supplies the version as a
  22917. // string rather than a number, so we use loose equality checking here.
  22918. if (version != this._version) {
  22919. throw new Error('Unsupported version: ' + version);
  22920. }
  22921. sources = sources.map(String) // Some source maps produce relative source paths like "./foo.js" instead of
  22922. // "foo.js". Normalize these first so that future comparisons will succeed.
  22923. // See bugzil.la/1090768.
  22924. .map(util.normalize) // Always ensure that absolute sources are internally stored relative to
  22925. // the source root, if the source root is absolute. Not doing this would
  22926. // be particularly problematic when the source root is a prefix of the
  22927. // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  22928. .map(function (source) {
  22929. return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
  22930. }); // Pass `true` below to allow duplicate names and sources. While source maps
  22931. // are intended to be compressed and deduplicated, the TypeScript compiler
  22932. // sometimes generates source maps with duplicates in them. See Github issue
  22933. // #72 and bugzil.la/889492.
  22934. this._names = ArraySet.fromArray(names.map(String), true);
  22935. this._sources = ArraySet.fromArray(sources, true);
  22936. this.sourceRoot = sourceRoot;
  22937. this.sourcesContent = sourcesContent;
  22938. this._mappings = mappings;
  22939. this.file = file;
  22940. }
  22941. BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  22942. BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
  22943. /**
  22944. * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  22945. *
  22946. * @param SourceMapGenerator aSourceMap
  22947. * The source map that will be consumed.
  22948. * @returns BasicSourceMapConsumer
  22949. */
  22950. BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap) {
  22951. var smc = Object.create(BasicSourceMapConsumer.prototype);
  22952. var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  22953. var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  22954. smc.sourceRoot = aSourceMap._sourceRoot;
  22955. smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
  22956. smc.file = aSourceMap._file; // Because we are modifying the entries (by converting string sources and
  22957. // names to indices into the sources and names ArraySets), we have to make
  22958. // a copy of the entry or else bad things happen. Shared mutable state
  22959. // strikes again! See github issue #191.
  22960. var generatedMappings = aSourceMap._mappings.toArray().slice();
  22961. var destGeneratedMappings = smc.__generatedMappings = [];
  22962. var destOriginalMappings = smc.__originalMappings = [];
  22963. for (var i = 0, length = generatedMappings.length; i < length; i++) {
  22964. var srcMapping = generatedMappings[i];
  22965. var destMapping = new Mapping();
  22966. destMapping.generatedLine = srcMapping.generatedLine;
  22967. destMapping.generatedColumn = srcMapping.generatedColumn;
  22968. if (srcMapping.source) {
  22969. destMapping.source = sources.indexOf(srcMapping.source);
  22970. destMapping.originalLine = srcMapping.originalLine;
  22971. destMapping.originalColumn = srcMapping.originalColumn;
  22972. if (srcMapping.name) {
  22973. destMapping.name = names.indexOf(srcMapping.name);
  22974. }
  22975. destOriginalMappings.push(destMapping);
  22976. }
  22977. destGeneratedMappings.push(destMapping);
  22978. }
  22979. quickSort(smc.__originalMappings, util.compareByOriginalPositions);
  22980. return smc;
  22981. };
  22982. /**
  22983. * The version of the source mapping spec that we are consuming.
  22984. */
  22985. BasicSourceMapConsumer.prototype._version = 3;
  22986. /**
  22987. * The list of original sources.
  22988. */
  22989. Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  22990. get: function get() {
  22991. return this._sources.toArray().map(function (s) {
  22992. return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
  22993. }, this);
  22994. }
  22995. });
  22996. /**
  22997. * Provide the JIT with a nice shape / hidden class.
  22998. */
  22999. function Mapping() {
  23000. this.generatedLine = 0;
  23001. this.generatedColumn = 0;
  23002. this.source = null;
  23003. this.originalLine = null;
  23004. this.originalColumn = null;
  23005. this.name = null;
  23006. }
  23007. /**
  23008. * Parse the mappings in a string in to a data structure which we can easily
  23009. * query (the ordered arrays in the `this.__generatedMappings` and
  23010. * `this.__originalMappings` properties).
  23011. */
  23012. BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  23013. var generatedLine = 1;
  23014. var previousGeneratedColumn = 0;
  23015. var previousOriginalLine = 0;
  23016. var previousOriginalColumn = 0;
  23017. var previousSource = 0;
  23018. var previousName = 0;
  23019. var length = aStr.length;
  23020. var index = 0;
  23021. var cachedSegments = {};
  23022. var temp = {};
  23023. var originalMappings = [];
  23024. var generatedMappings = [];
  23025. var mapping, str, segment, end, value;
  23026. while (index < length) {
  23027. if (aStr.charAt(index) === ';') {
  23028. generatedLine++;
  23029. index++;
  23030. previousGeneratedColumn = 0;
  23031. } else if (aStr.charAt(index) === ',') {
  23032. index++;
  23033. } else {
  23034. mapping = new Mapping();
  23035. mapping.generatedLine = generatedLine; // Because each offset is encoded relative to the previous one,
  23036. // many segments often have the same encoding. We can exploit this
  23037. // fact by caching the parsed variable length fields of each segment,
  23038. // allowing us to avoid a second parse if we encounter the same
  23039. // segment again.
  23040. for (end = index; end < length; end++) {
  23041. if (this._charIsMappingSeparator(aStr, end)) {
  23042. break;
  23043. }
  23044. }
  23045. str = aStr.slice(index, end);
  23046. segment = cachedSegments[str];
  23047. if (segment) {
  23048. index += str.length;
  23049. } else {
  23050. segment = [];
  23051. while (index < end) {
  23052. base64VLQ.decode(aStr, index, temp);
  23053. value = temp.value;
  23054. index = temp.rest;
  23055. segment.push(value);
  23056. }
  23057. if (segment.length === 2) {
  23058. throw new Error('Found a source, but no line and column');
  23059. }
  23060. if (segment.length === 3) {
  23061. throw new Error('Found a source and line, but no column');
  23062. }
  23063. cachedSegments[str] = segment;
  23064. } // Generated column.
  23065. mapping.generatedColumn = previousGeneratedColumn + segment[0];
  23066. previousGeneratedColumn = mapping.generatedColumn;
  23067. if (segment.length > 1) {
  23068. // Original source.
  23069. mapping.source = previousSource + segment[1];
  23070. previousSource += segment[1]; // Original line.
  23071. mapping.originalLine = previousOriginalLine + segment[2];
  23072. previousOriginalLine = mapping.originalLine; // Lines are stored 0-based
  23073. mapping.originalLine += 1; // Original column.
  23074. mapping.originalColumn = previousOriginalColumn + segment[3];
  23075. previousOriginalColumn = mapping.originalColumn;
  23076. if (segment.length > 4) {
  23077. // Original name.
  23078. mapping.name = previousName + segment[4];
  23079. previousName += segment[4];
  23080. }
  23081. }
  23082. generatedMappings.push(mapping);
  23083. if (typeof mapping.originalLine === 'number') {
  23084. originalMappings.push(mapping);
  23085. }
  23086. }
  23087. }
  23088. quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
  23089. this.__generatedMappings = generatedMappings;
  23090. quickSort(originalMappings, util.compareByOriginalPositions);
  23091. this.__originalMappings = originalMappings;
  23092. };
  23093. /**
  23094. * Find the mapping that best matches the hypothetical "needle" mapping that
  23095. * we are searching for in the given "haystack" of mappings.
  23096. */
  23097. BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
  23098. // To return the position we are searching for, we must first find the
  23099. // mapping for the given position and then return the opposite position it
  23100. // points to. Because the mappings are sorted, we can use binary search to
  23101. // find the best mapping.
  23102. if (aNeedle[aLineName] <= 0) {
  23103. throw new TypeError('Line must be greater than or equal to 1, got ' + aNeedle[aLineName]);
  23104. }
  23105. if (aNeedle[aColumnName] < 0) {
  23106. throw new TypeError('Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]);
  23107. }
  23108. return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  23109. };
  23110. /**
  23111. * Compute the last column for each generated mapping. The last column is
  23112. * inclusive.
  23113. */
  23114. BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
  23115. for (var index = 0; index < this._generatedMappings.length; ++index) {
  23116. var mapping = this._generatedMappings[index]; // Mappings do not contain a field for the last generated columnt. We
  23117. // can come up with an optimistic estimate, however, by assuming that
  23118. // mappings are contiguous (i.e. given two consecutive mappings, the
  23119. // first mapping ends where the second one starts).
  23120. if (index + 1 < this._generatedMappings.length) {
  23121. var nextMapping = this._generatedMappings[index + 1];
  23122. if (mapping.generatedLine === nextMapping.generatedLine) {
  23123. mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  23124. continue;
  23125. }
  23126. } // The last mapping for each line spans the entire line.
  23127. mapping.lastGeneratedColumn = Infinity;
  23128. }
  23129. };
  23130. /**
  23131. * Returns the original source, line, and column information for the generated
  23132. * source's line and column positions provided. The only argument is an object
  23133. * with the following properties:
  23134. *
  23135. * - line: The line number in the generated source.
  23136. * - column: The column number in the generated source.
  23137. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  23138. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  23139. * closest element that is smaller than or greater than the one we are
  23140. * searching for, respectively, if the exact element cannot be found.
  23141. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  23142. *
  23143. * and an object is returned with the following properties:
  23144. *
  23145. * - source: The original source file, or null.
  23146. * - line: The line number in the original source, or null.
  23147. * - column: The column number in the original source, or null.
  23148. * - name: The original identifier, or null.
  23149. */
  23150. BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
  23151. var needle = {
  23152. generatedLine: util.getArg(aArgs, 'line'),
  23153. generatedColumn: util.getArg(aArgs, 'column')
  23154. };
  23155. var index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
  23156. if (index >= 0) {
  23157. var mapping = this._generatedMappings[index];
  23158. if (mapping.generatedLine === needle.generatedLine) {
  23159. var source = util.getArg(mapping, 'source', null);
  23160. if (source !== null) {
  23161. source = this._sources.at(source);
  23162. if (this.sourceRoot != null) {
  23163. source = util.join(this.sourceRoot, source);
  23164. }
  23165. }
  23166. var name = util.getArg(mapping, 'name', null);
  23167. if (name !== null) {
  23168. name = this._names.at(name);
  23169. }
  23170. return {
  23171. source: source,
  23172. line: util.getArg(mapping, 'originalLine', null),
  23173. column: util.getArg(mapping, 'originalColumn', null),
  23174. name: name
  23175. };
  23176. }
  23177. }
  23178. return {
  23179. source: null,
  23180. line: null,
  23181. column: null,
  23182. name: null
  23183. };
  23184. };
  23185. /**
  23186. * Return true if we have the source content for every source in the source
  23187. * map, false otherwise.
  23188. */
  23189. BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
  23190. if (!this.sourcesContent) {
  23191. return false;
  23192. }
  23193. return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) {
  23194. return sc == null;
  23195. });
  23196. };
  23197. /**
  23198. * Returns the original source content. The only argument is the url of the
  23199. * original source file. Returns null if no original source content is
  23200. * available.
  23201. */
  23202. BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  23203. if (!this.sourcesContent) {
  23204. return null;
  23205. }
  23206. if (this.sourceRoot != null) {
  23207. aSource = util.relative(this.sourceRoot, aSource);
  23208. }
  23209. if (this._sources.has(aSource)) {
  23210. return this.sourcesContent[this._sources.indexOf(aSource)];
  23211. }
  23212. var url;
  23213. if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
  23214. // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  23215. // many users. We can help them out when they expect file:// URIs to
  23216. // behave like it would if they were running a local HTTP server. See
  23217. // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  23218. var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
  23219. if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
  23220. return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
  23221. }
  23222. if ((!url.path || url.path == "/") && this._sources.has("/" + aSource)) {
  23223. return this.sourcesContent[this._sources.indexOf("/" + aSource)];
  23224. }
  23225. } // This function is used recursively from
  23226. // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  23227. // don't want to throw if we can't find the source - we just want to
  23228. // return null, so we provide a flag to exit gracefully.
  23229. if (nullOnMissing) {
  23230. return null;
  23231. } else {
  23232. throw new Error('"' + aSource + '" is not in the SourceMap.');
  23233. }
  23234. };
  23235. /**
  23236. * Returns the generated line and column information for the original source,
  23237. * line, and column positions provided. The only argument is an object with
  23238. * the following properties:
  23239. *
  23240. * - source: The filename of the original source.
  23241. * - line: The line number in the original source.
  23242. * - column: The column number in the original source.
  23243. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  23244. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  23245. * closest element that is smaller than or greater than the one we are
  23246. * searching for, respectively, if the exact element cannot be found.
  23247. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  23248. *
  23249. * and an object is returned with the following properties:
  23250. *
  23251. * - line: The line number in the generated source, or null.
  23252. * - column: The column number in the generated source, or null.
  23253. */
  23254. BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
  23255. var source = util.getArg(aArgs, 'source');
  23256. if (this.sourceRoot != null) {
  23257. source = util.relative(this.sourceRoot, source);
  23258. }
  23259. if (!this._sources.has(source)) {
  23260. return {
  23261. line: null,
  23262. column: null,
  23263. lastColumn: null
  23264. };
  23265. }
  23266. source = this._sources.indexOf(source);
  23267. var needle = {
  23268. source: source,
  23269. originalLine: util.getArg(aArgs, 'line'),
  23270. originalColumn: util.getArg(aArgs, 'column')
  23271. };
  23272. var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
  23273. if (index >= 0) {
  23274. var mapping = this._originalMappings[index];
  23275. if (mapping.source === needle.source) {
  23276. return {
  23277. line: util.getArg(mapping, 'generatedLine', null),
  23278. column: util.getArg(mapping, 'generatedColumn', null),
  23279. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  23280. };
  23281. }
  23282. }
  23283. return {
  23284. line: null,
  23285. column: null,
  23286. lastColumn: null
  23287. };
  23288. };
  23289. exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
  23290. /**
  23291. * An IndexedSourceMapConsumer instance represents a parsed source map which
  23292. * we can query for information. It differs from BasicSourceMapConsumer in
  23293. * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  23294. * input.
  23295. *
  23296. * The only parameter is a raw source map (either as a JSON string, or already
  23297. * parsed to an object). According to the spec for indexed source maps, they
  23298. * have the following attributes:
  23299. *
  23300. * - version: Which version of the source map spec this map is following.
  23301. * - file: Optional. The generated file this source map is associated with.
  23302. * - sections: A list of section definitions.
  23303. *
  23304. * Each value under the "sections" field has two fields:
  23305. * - offset: The offset into the original specified at which this section
  23306. * begins to apply, defined as an object with a "line" and "column"
  23307. * field.
  23308. * - map: A source map definition. This source map could also be indexed,
  23309. * but doesn't have to be.
  23310. *
  23311. * Instead of the "map" field, it's also possible to have a "url" field
  23312. * specifying a URL to retrieve a source map from, but that's currently
  23313. * unsupported.
  23314. *
  23315. * Here's an example source map, taken from the source map spec[0], but
  23316. * modified to omit a section which uses the "url" field.
  23317. *
  23318. * {
  23319. * version : 3,
  23320. * file: "app.js",
  23321. * sections: [{
  23322. * offset: {line:100, column:10},
  23323. * map: {
  23324. * version : 3,
  23325. * file: "section.js",
  23326. * sources: ["foo.js", "bar.js"],
  23327. * names: ["src", "maps", "are", "fun"],
  23328. * mappings: "AAAA,E;;ABCDE;"
  23329. * }
  23330. * }],
  23331. * }
  23332. *
  23333. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  23334. */
  23335. function IndexedSourceMapConsumer(aSourceMap) {
  23336. var sourceMap = aSourceMap;
  23337. if (typeof aSourceMap === 'string') {
  23338. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  23339. }
  23340. var version = util.getArg(sourceMap, 'version');
  23341. var sections = util.getArg(sourceMap, 'sections');
  23342. if (version != this._version) {
  23343. throw new Error('Unsupported version: ' + version);
  23344. }
  23345. this._sources = new ArraySet();
  23346. this._names = new ArraySet();
  23347. var lastOffset = {
  23348. line: -1,
  23349. column: 0
  23350. };
  23351. this._sections = sections.map(function (s) {
  23352. if (s.url) {
  23353. // The url field will require support for asynchronicity.
  23354. // See https://github.com/mozilla/source-map/issues/16
  23355. throw new Error('Support for url field in sections not implemented.');
  23356. }
  23357. var offset = util.getArg(s, 'offset');
  23358. var offsetLine = util.getArg(offset, 'line');
  23359. var offsetColumn = util.getArg(offset, 'column');
  23360. if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
  23361. throw new Error('Section offsets must be ordered and non-overlapping.');
  23362. }
  23363. lastOffset = offset;
  23364. return {
  23365. generatedOffset: {
  23366. // The offset fields are 0-based, but we use 1-based indices when
  23367. // encoding/decoding from VLQ.
  23368. generatedLine: offsetLine + 1,
  23369. generatedColumn: offsetColumn + 1
  23370. },
  23371. consumer: new SourceMapConsumer(util.getArg(s, 'map'))
  23372. };
  23373. });
  23374. }
  23375. IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  23376. IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
  23377. /**
  23378. * The version of the source mapping spec that we are consuming.
  23379. */
  23380. IndexedSourceMapConsumer.prototype._version = 3;
  23381. /**
  23382. * The list of original sources.
  23383. */
  23384. Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  23385. get: function get() {
  23386. var sources = [];
  23387. for (var i = 0; i < this._sections.length; i++) {
  23388. for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  23389. sources.push(this._sections[i].consumer.sources[j]);
  23390. }
  23391. }
  23392. return sources;
  23393. }
  23394. });
  23395. /**
  23396. * Returns the original source, line, and column information for the generated
  23397. * source's line and column positions provided. The only argument is an object
  23398. * with the following properties:
  23399. *
  23400. * - line: The line number in the generated source.
  23401. * - column: The column number in the generated source.
  23402. *
  23403. * and an object is returned with the following properties:
  23404. *
  23405. * - source: The original source file, or null.
  23406. * - line: The line number in the original source, or null.
  23407. * - column: The column number in the original source, or null.
  23408. * - name: The original identifier, or null.
  23409. */
  23410. IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  23411. var needle = {
  23412. generatedLine: util.getArg(aArgs, 'line'),
  23413. generatedColumn: util.getArg(aArgs, 'column')
  23414. }; // Find the section containing the generated position we're trying to map
  23415. // to an original position.
  23416. var sectionIndex = binarySearch.search(needle, this._sections, function (needle, section) {
  23417. var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  23418. if (cmp) {
  23419. return cmp;
  23420. }
  23421. return needle.generatedColumn - section.generatedOffset.generatedColumn;
  23422. });
  23423. var section = this._sections[sectionIndex];
  23424. if (!section) {
  23425. return {
  23426. source: null,
  23427. line: null,
  23428. column: null,
  23429. name: null
  23430. };
  23431. }
  23432. return section.consumer.originalPositionFor({
  23433. line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
  23434. column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
  23435. bias: aArgs.bias
  23436. });
  23437. };
  23438. /**
  23439. * Return true if we have the source content for every source in the source
  23440. * map, false otherwise.
  23441. */
  23442. IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  23443. return this._sections.every(function (s) {
  23444. return s.consumer.hasContentsOfAllSources();
  23445. });
  23446. };
  23447. /**
  23448. * Returns the original source content. The only argument is the url of the
  23449. * original source file. Returns null if no original source content is
  23450. * available.
  23451. */
  23452. IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  23453. for (var i = 0; i < this._sections.length; i++) {
  23454. var section = this._sections[i];
  23455. var content = section.consumer.sourceContentFor(aSource, true);
  23456. if (content) {
  23457. return content;
  23458. }
  23459. }
  23460. if (nullOnMissing) {
  23461. return null;
  23462. } else {
  23463. throw new Error('"' + aSource + '" is not in the SourceMap.');
  23464. }
  23465. };
  23466. /**
  23467. * Returns the generated line and column information for the original source,
  23468. * line, and column positions provided. The only argument is an object with
  23469. * the following properties:
  23470. *
  23471. * - source: The filename of the original source.
  23472. * - line: The line number in the original source.
  23473. * - column: The column number in the original source.
  23474. *
  23475. * and an object is returned with the following properties:
  23476. *
  23477. * - line: The line number in the generated source, or null.
  23478. * - column: The column number in the generated source, or null.
  23479. */
  23480. IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  23481. for (var i = 0; i < this._sections.length; i++) {
  23482. var section = this._sections[i]; // Only consider this section if the requested source is in the list of
  23483. // sources of the consumer.
  23484. if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
  23485. continue;
  23486. }
  23487. var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  23488. if (generatedPosition) {
  23489. var ret = {
  23490. line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
  23491. column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
  23492. };
  23493. return ret;
  23494. }
  23495. }
  23496. return {
  23497. line: null,
  23498. column: null
  23499. };
  23500. };
  23501. /**
  23502. * Parse the mappings in a string in to a data structure which we can easily
  23503. * query (the ordered arrays in the `this.__generatedMappings` and
  23504. * `this.__originalMappings` properties).
  23505. */
  23506. IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  23507. this.__generatedMappings = [];
  23508. this.__originalMappings = [];
  23509. for (var i = 0; i < this._sections.length; i++) {
  23510. var section = this._sections[i];
  23511. var sectionMappings = section.consumer._generatedMappings;
  23512. for (var j = 0; j < sectionMappings.length; j++) {
  23513. var mapping = sectionMappings[j];
  23514. var source = section.consumer._sources.at(mapping.source);
  23515. if (section.consumer.sourceRoot !== null) {
  23516. source = util.join(section.consumer.sourceRoot, source);
  23517. }
  23518. this._sources.add(source);
  23519. source = this._sources.indexOf(source);
  23520. var name = section.consumer._names.at(mapping.name);
  23521. this._names.add(name);
  23522. name = this._names.indexOf(name); // The mappings coming from the consumer for the section have
  23523. // generated positions relative to the start of the section, so we
  23524. // need to offset them to be relative to the start of the concatenated
  23525. // generated file.
  23526. var adjustedMapping = {
  23527. source: source,
  23528. generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
  23529. generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
  23530. originalLine: mapping.originalLine,
  23531. originalColumn: mapping.originalColumn,
  23532. name: name
  23533. };
  23534. this.__generatedMappings.push(adjustedMapping);
  23535. if (typeof adjustedMapping.originalLine === 'number') {
  23536. this.__originalMappings.push(adjustedMapping);
  23537. }
  23538. }
  23539. }
  23540. quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
  23541. quickSort(this.__originalMappings, util.compareByOriginalPositions);
  23542. };
  23543. exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
  23544. /***/ }),
  23545. /* 153 */
  23546. /***/ (function(module, exports) {
  23547. /* -*- Mode: js; js-indent-level: 2; -*- */
  23548. /*
  23549. * Copyright 2011 Mozilla Foundation and contributors
  23550. * Licensed under the New BSD license. See LICENSE or:
  23551. * http://opensource.org/licenses/BSD-3-Clause
  23552. */
  23553. exports.GREATEST_LOWER_BOUND = 1;
  23554. exports.LEAST_UPPER_BOUND = 2;
  23555. /**
  23556. * Recursive implementation of binary search.
  23557. *
  23558. * @param aLow Indices here and lower do not contain the needle.
  23559. * @param aHigh Indices here and higher do not contain the needle.
  23560. * @param aNeedle The element being searched for.
  23561. * @param aHaystack The non-empty array being searched.
  23562. * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  23563. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  23564. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  23565. * closest element that is smaller than or greater than the one we are
  23566. * searching for, respectively, if the exact element cannot be found.
  23567. */
  23568. function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  23569. // This function terminates when one of the following is true:
  23570. //
  23571. // 1. We find the exact element we are looking for.
  23572. //
  23573. // 2. We did not find the exact element, but we can return the index of
  23574. // the next-closest element.
  23575. //
  23576. // 3. We did not find the exact element, and there is no next-closest
  23577. // element than the one we are searching for, so we return -1.
  23578. var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  23579. var cmp = aCompare(aNeedle, aHaystack[mid], true);
  23580. if (cmp === 0) {
  23581. // Found the element we are looking for.
  23582. return mid;
  23583. } else if (cmp > 0) {
  23584. // Our needle is greater than aHaystack[mid].
  23585. if (aHigh - mid > 1) {
  23586. // The element is in the upper half.
  23587. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  23588. } // The exact needle element was not found in this haystack. Determine if
  23589. // we are in termination case (3) or (2) and return the appropriate thing.
  23590. if (aBias == exports.LEAST_UPPER_BOUND) {
  23591. return aHigh < aHaystack.length ? aHigh : -1;
  23592. } else {
  23593. return mid;
  23594. }
  23595. } else {
  23596. // Our needle is less than aHaystack[mid].
  23597. if (mid - aLow > 1) {
  23598. // The element is in the lower half.
  23599. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  23600. } // we are in termination case (3) or (2) and return the appropriate thing.
  23601. if (aBias == exports.LEAST_UPPER_BOUND) {
  23602. return mid;
  23603. } else {
  23604. return aLow < 0 ? -1 : aLow;
  23605. }
  23606. }
  23607. }
  23608. /**
  23609. * This is an implementation of binary search which will always try and return
  23610. * the index of the closest element if there is no exact hit. This is because
  23611. * mappings between original and generated line/col pairs are single points,
  23612. * and there is an implicit region between each of them, so a miss just means
  23613. * that you aren't on the very start of a region.
  23614. *
  23615. * @param aNeedle The element you are looking for.
  23616. * @param aHaystack The array that is being searched.
  23617. * @param aCompare A function which takes the needle and an element in the
  23618. * array and returns -1, 0, or 1 depending on whether the needle is less
  23619. * than, equal to, or greater than the element, respectively.
  23620. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  23621. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  23622. * closest element that is smaller than or greater than the one we are
  23623. * searching for, respectively, if the exact element cannot be found.
  23624. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  23625. */
  23626. exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  23627. if (aHaystack.length === 0) {
  23628. return -1;
  23629. }
  23630. var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  23631. if (index < 0) {
  23632. return -1;
  23633. } // We have found either the exact element, or the next-closest element than
  23634. // the one we are searching for. However, there may be more than one such
  23635. // element. Make sure we always return the smallest of these.
  23636. while (index - 1 >= 0) {
  23637. if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  23638. break;
  23639. }
  23640. --index;
  23641. }
  23642. return index;
  23643. };
  23644. /***/ }),
  23645. /* 154 */
  23646. /***/ (function(module, exports) {
  23647. /* -*- Mode: js; js-indent-level: 2; -*- */
  23648. /*
  23649. * Copyright 2011 Mozilla Foundation and contributors
  23650. * Licensed under the New BSD license. See LICENSE or:
  23651. * http://opensource.org/licenses/BSD-3-Clause
  23652. */
  23653. // It turns out that some (most?) JavaScript engines don't self-host
  23654. // `Array.prototype.sort`. This makes sense because C++ will likely remain
  23655. // faster than JS when doing raw CPU-intensive sorting. However, when using a
  23656. // custom comparator function, calling back and forth between the VM's C++ and
  23657. // JIT'd JS is rather slow *and* loses JIT type information, resulting in
  23658. // worse generated code for the comparator function than would be optimal. In
  23659. // fact, when sorting with a comparator, these costs outweigh the benefits of
  23660. // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  23661. // a ~3500ms mean speed-up in `bench/bench.html`.
  23662. /**
  23663. * Swap the elements indexed by `x` and `y` in the array `ary`.
  23664. *
  23665. * @param {Array} ary
  23666. * The array.
  23667. * @param {Number} x
  23668. * The index of the first item.
  23669. * @param {Number} y
  23670. * The index of the second item.
  23671. */
  23672. function swap(ary, x, y) {
  23673. var temp = ary[x];
  23674. ary[x] = ary[y];
  23675. ary[y] = temp;
  23676. }
  23677. /**
  23678. * Returns a random integer within the range `low .. high` inclusive.
  23679. *
  23680. * @param {Number} low
  23681. * The lower bound on the range.
  23682. * @param {Number} high
  23683. * The upper bound on the range.
  23684. */
  23685. function randomIntInRange(low, high) {
  23686. return Math.round(low + Math.random() * (high - low));
  23687. }
  23688. /**
  23689. * The Quick Sort algorithm.
  23690. *
  23691. * @param {Array} ary
  23692. * An array to sort.
  23693. * @param {function} comparator
  23694. * Function to use to compare two items.
  23695. * @param {Number} p
  23696. * Start index of the array
  23697. * @param {Number} r
  23698. * End index of the array
  23699. */
  23700. function doQuickSort(ary, comparator, p, r) {
  23701. // If our lower bound is less than our upper bound, we (1) partition the
  23702. // array into two pieces and (2) recurse on each half. If it is not, this is
  23703. // the empty array and our base case.
  23704. if (p < r) {
  23705. // (1) Partitioning.
  23706. //
  23707. // The partitioning chooses a pivot between `p` and `r` and moves all
  23708. // elements that are less than or equal to the pivot to the before it, and
  23709. // all the elements that are greater than it after it. The effect is that
  23710. // once partition is done, the pivot is in the exact place it will be when
  23711. // the array is put in sorted order, and it will not need to be moved
  23712. // again. This runs in O(n) time.
  23713. // Always choose a random pivot so that an input array which is reverse
  23714. // sorted does not cause O(n^2) running time.
  23715. var pivotIndex = randomIntInRange(p, r);
  23716. var i = p - 1;
  23717. swap(ary, pivotIndex, r);
  23718. var pivot = ary[r]; // Immediately after `j` is incremented in this loop, the following hold
  23719. // true:
  23720. //
  23721. // * Every element in `ary[p .. i]` is less than or equal to the pivot.
  23722. //
  23723. // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  23724. for (var j = p; j < r; j++) {
  23725. if (comparator(ary[j], pivot) <= 0) {
  23726. i += 1;
  23727. swap(ary, i, j);
  23728. }
  23729. }
  23730. swap(ary, i + 1, j);
  23731. var q = i + 1; // (2) Recurse on each half.
  23732. doQuickSort(ary, comparator, p, q - 1);
  23733. doQuickSort(ary, comparator, q + 1, r);
  23734. }
  23735. }
  23736. /**
  23737. * Sort the given array in-place with the given comparator function.
  23738. *
  23739. * @param {Array} ary
  23740. * An array to sort.
  23741. * @param {function} comparator
  23742. * Function to use to compare two items.
  23743. */
  23744. exports.quickSort = function (ary, comparator) {
  23745. doQuickSort(ary, comparator, 0, ary.length - 1);
  23746. };
  23747. /***/ }),
  23748. /* 155 */
  23749. /***/ (function(module, exports, __webpack_require__) {
  23750. /* -*- Mode: js; js-indent-level: 2; -*- */
  23751. /*
  23752. * Copyright 2011 Mozilla Foundation and contributors
  23753. * Licensed under the New BSD license. See LICENSE or:
  23754. * http://opensource.org/licenses/BSD-3-Clause
  23755. */
  23756. var SourceMapGenerator = __webpack_require__(79).SourceMapGenerator;
  23757. var util = __webpack_require__(9); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  23758. // operating systems these days (capturing the result).
  23759. var REGEX_NEWLINE = /(\r?\n)/; // Newline character code for charCodeAt() comparisons
  23760. var NEWLINE_CODE = 10; // Private symbol for identifying `SourceNode`s when multiple versions of
  23761. // the source-map library are loaded. This MUST NOT CHANGE across
  23762. // versions!
  23763. var isSourceNode = "$$$isSourceNode$$$";
  23764. /**
  23765. * SourceNodes provide a way to abstract over interpolating/concatenating
  23766. * snippets of generated JavaScript source code while maintaining the line and
  23767. * column information associated with the original source code.
  23768. *
  23769. * @param aLine The original line number.
  23770. * @param aColumn The original column number.
  23771. * @param aSource The original source's filename.
  23772. * @param aChunks Optional. An array of strings which are snippets of
  23773. * generated JS, or other SourceNodes.
  23774. * @param aName The original identifier.
  23775. */
  23776. function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  23777. this.children = [];
  23778. this.sourceContents = {};
  23779. this.line = aLine == null ? null : aLine;
  23780. this.column = aColumn == null ? null : aColumn;
  23781. this.source = aSource == null ? null : aSource;
  23782. this.name = aName == null ? null : aName;
  23783. this[isSourceNode] = true;
  23784. if (aChunks != null) this.add(aChunks);
  23785. }
  23786. /**
  23787. * Creates a SourceNode from generated code and a SourceMapConsumer.
  23788. *
  23789. * @param aGeneratedCode The generated code
  23790. * @param aSourceMapConsumer The SourceMap for the generated code
  23791. * @param aRelativePath Optional. The path that relative sources in the
  23792. * SourceMapConsumer should be relative to.
  23793. */
  23794. SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  23795. // The SourceNode we want to fill with the generated code
  23796. // and the SourceMap
  23797. var node = new SourceNode(); // All even indices of this array are one line of the generated code,
  23798. // while all odd indices are the newlines between two adjacent lines
  23799. // (since `REGEX_NEWLINE` captures its match).
  23800. // Processed fragments are removed from this array, by calling `shiftNextLine`.
  23801. var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  23802. var shiftNextLine = function shiftNextLine() {
  23803. var lineContents = remainingLines.shift(); // The last line of a file might not have a newline.
  23804. var newLine = remainingLines.shift() || "";
  23805. return lineContents + newLine;
  23806. }; // We need to remember the position of "remainingLines"
  23807. var lastGeneratedLine = 1,
  23808. lastGeneratedColumn = 0; // The generate SourceNodes we need a code range.
  23809. // To extract it current and last mapping is used.
  23810. // Here we store the last mapping.
  23811. var lastMapping = null;
  23812. aSourceMapConsumer.eachMapping(function (mapping) {
  23813. if (lastMapping !== null) {
  23814. // We add the code from "lastMapping" to "mapping":
  23815. // First check if there is a new line in between.
  23816. if (lastGeneratedLine < mapping.generatedLine) {
  23817. // Associate first line with "lastMapping"
  23818. addMappingWithCode(lastMapping, shiftNextLine());
  23819. lastGeneratedLine++;
  23820. lastGeneratedColumn = 0; // The remaining code is added without mapping
  23821. } else {
  23822. // There is no new line in between.
  23823. // Associate the code between "lastGeneratedColumn" and
  23824. // "mapping.generatedColumn" with "lastMapping"
  23825. var nextLine = remainingLines[0];
  23826. var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
  23827. remainingLines[0] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
  23828. lastGeneratedColumn = mapping.generatedColumn;
  23829. addMappingWithCode(lastMapping, code); // No more remaining code, continue
  23830. lastMapping = mapping;
  23831. return;
  23832. }
  23833. } // We add the generated code until the first mapping
  23834. // to the SourceNode without any mapping.
  23835. // Each line is added as separate string.
  23836. while (lastGeneratedLine < mapping.generatedLine) {
  23837. node.add(shiftNextLine());
  23838. lastGeneratedLine++;
  23839. }
  23840. if (lastGeneratedColumn < mapping.generatedColumn) {
  23841. var nextLine = remainingLines[0];
  23842. node.add(nextLine.substr(0, mapping.generatedColumn));
  23843. remainingLines[0] = nextLine.substr(mapping.generatedColumn);
  23844. lastGeneratedColumn = mapping.generatedColumn;
  23845. }
  23846. lastMapping = mapping;
  23847. }, this); // We have processed all mappings.
  23848. if (remainingLines.length > 0) {
  23849. if (lastMapping) {
  23850. // Associate the remaining code in the current line with "lastMapping"
  23851. addMappingWithCode(lastMapping, shiftNextLine());
  23852. } // and add the remaining lines without any mapping
  23853. node.add(remainingLines.join(""));
  23854. } // Copy sourcesContent into SourceNode
  23855. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  23856. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  23857. if (content != null) {
  23858. if (aRelativePath != null) {
  23859. sourceFile = util.join(aRelativePath, sourceFile);
  23860. }
  23861. node.setSourceContent(sourceFile, content);
  23862. }
  23863. });
  23864. return node;
  23865. function addMappingWithCode(mapping, code) {
  23866. if (mapping === null || mapping.source === undefined) {
  23867. node.add(code);
  23868. } else {
  23869. var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
  23870. node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
  23871. }
  23872. }
  23873. };
  23874. /**
  23875. * Add a chunk of generated JS to this source node.
  23876. *
  23877. * @param aChunk A string snippet of generated JS code, another instance of
  23878. * SourceNode, or an array where each member is one of those things.
  23879. */
  23880. SourceNode.prototype.add = function SourceNode_add(aChunk) {
  23881. if (Array.isArray(aChunk)) {
  23882. aChunk.forEach(function (chunk) {
  23883. this.add(chunk);
  23884. }, this);
  23885. } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  23886. if (aChunk) {
  23887. this.children.push(aChunk);
  23888. }
  23889. } else {
  23890. throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
  23891. }
  23892. return this;
  23893. };
  23894. /**
  23895. * Add a chunk of generated JS to the beginning of this source node.
  23896. *
  23897. * @param aChunk A string snippet of generated JS code, another instance of
  23898. * SourceNode, or an array where each member is one of those things.
  23899. */
  23900. SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
  23901. if (Array.isArray(aChunk)) {
  23902. for (var i = aChunk.length - 1; i >= 0; i--) {
  23903. this.prepend(aChunk[i]);
  23904. }
  23905. } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  23906. this.children.unshift(aChunk);
  23907. } else {
  23908. throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
  23909. }
  23910. return this;
  23911. };
  23912. /**
  23913. * Walk over the tree of JS snippets in this node and its children. The
  23914. * walking function is called once for each snippet of JS and is passed that
  23915. * snippet and the its original associated source's line/column location.
  23916. *
  23917. * @param aFn The traversal function.
  23918. */
  23919. SourceNode.prototype.walk = function SourceNode_walk(aFn) {
  23920. var chunk;
  23921. for (var i = 0, len = this.children.length; i < len; i++) {
  23922. chunk = this.children[i];
  23923. if (chunk[isSourceNode]) {
  23924. chunk.walk(aFn);
  23925. } else {
  23926. if (chunk !== '') {
  23927. aFn(chunk, {
  23928. source: this.source,
  23929. line: this.line,
  23930. column: this.column,
  23931. name: this.name
  23932. });
  23933. }
  23934. }
  23935. }
  23936. };
  23937. /**
  23938. * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  23939. * each of `this.children`.
  23940. *
  23941. * @param aSep The separator.
  23942. */
  23943. SourceNode.prototype.join = function SourceNode_join(aSep) {
  23944. var newChildren;
  23945. var i;
  23946. var len = this.children.length;
  23947. if (len > 0) {
  23948. newChildren = [];
  23949. for (i = 0; i < len - 1; i++) {
  23950. newChildren.push(this.children[i]);
  23951. newChildren.push(aSep);
  23952. }
  23953. newChildren.push(this.children[i]);
  23954. this.children = newChildren;
  23955. }
  23956. return this;
  23957. };
  23958. /**
  23959. * Call String.prototype.replace on the very right-most source snippet. Useful
  23960. * for trimming whitespace from the end of a source node, etc.
  23961. *
  23962. * @param aPattern The pattern to replace.
  23963. * @param aReplacement The thing to replace the pattern with.
  23964. */
  23965. SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  23966. var lastChild = this.children[this.children.length - 1];
  23967. if (lastChild[isSourceNode]) {
  23968. lastChild.replaceRight(aPattern, aReplacement);
  23969. } else if (typeof lastChild === 'string') {
  23970. this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  23971. } else {
  23972. this.children.push(''.replace(aPattern, aReplacement));
  23973. }
  23974. return this;
  23975. };
  23976. /**
  23977. * Set the source content for a source file. This will be added to the SourceMapGenerator
  23978. * in the sourcesContent field.
  23979. *
  23980. * @param aSourceFile The filename of the source file
  23981. * @param aSourceContent The content of the source file
  23982. */
  23983. SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  23984. this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
  23985. };
  23986. /**
  23987. * Walk over the tree of SourceNodes. The walking function is called for each
  23988. * source file content and is passed the filename and source content.
  23989. *
  23990. * @param aFn The traversal function.
  23991. */
  23992. SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
  23993. for (var i = 0, len = this.children.length; i < len; i++) {
  23994. if (this.children[i][isSourceNode]) {
  23995. this.children[i].walkSourceContents(aFn);
  23996. }
  23997. }
  23998. var sources = Object.keys(this.sourceContents);
  23999. for (var i = 0, len = sources.length; i < len; i++) {
  24000. aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  24001. }
  24002. };
  24003. /**
  24004. * Return the string representation of this source node. Walks over the tree
  24005. * and concatenates all the various snippets together to one string.
  24006. */
  24007. SourceNode.prototype.toString = function SourceNode_toString() {
  24008. var str = "";
  24009. this.walk(function (chunk) {
  24010. str += chunk;
  24011. });
  24012. return str;
  24013. };
  24014. /**
  24015. * Returns the string representation of this source node along with a source
  24016. * map.
  24017. */
  24018. SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  24019. var generated = {
  24020. code: "",
  24021. line: 1,
  24022. column: 0
  24023. };
  24024. var map = new SourceMapGenerator(aArgs);
  24025. var sourceMappingActive = false;
  24026. var lastOriginalSource = null;
  24027. var lastOriginalLine = null;
  24028. var lastOriginalColumn = null;
  24029. var lastOriginalName = null;
  24030. this.walk(function (chunk, original) {
  24031. generated.code += chunk;
  24032. if (original.source !== null && original.line !== null && original.column !== null) {
  24033. if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
  24034. map.addMapping({
  24035. source: original.source,
  24036. original: {
  24037. line: original.line,
  24038. column: original.column
  24039. },
  24040. generated: {
  24041. line: generated.line,
  24042. column: generated.column
  24043. },
  24044. name: original.name
  24045. });
  24046. }
  24047. lastOriginalSource = original.source;
  24048. lastOriginalLine = original.line;
  24049. lastOriginalColumn = original.column;
  24050. lastOriginalName = original.name;
  24051. sourceMappingActive = true;
  24052. } else if (sourceMappingActive) {
  24053. map.addMapping({
  24054. generated: {
  24055. line: generated.line,
  24056. column: generated.column
  24057. }
  24058. });
  24059. lastOriginalSource = null;
  24060. sourceMappingActive = false;
  24061. }
  24062. for (var idx = 0, length = chunk.length; idx < length; idx++) {
  24063. if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  24064. generated.line++;
  24065. generated.column = 0; // Mappings end at eol
  24066. if (idx + 1 === length) {
  24067. lastOriginalSource = null;
  24068. sourceMappingActive = false;
  24069. } else if (sourceMappingActive) {
  24070. map.addMapping({
  24071. source: original.source,
  24072. original: {
  24073. line: original.line,
  24074. column: original.column
  24075. },
  24076. generated: {
  24077. line: generated.line,
  24078. column: generated.column
  24079. },
  24080. name: original.name
  24081. });
  24082. }
  24083. } else {
  24084. generated.column++;
  24085. }
  24086. }
  24087. });
  24088. this.walkSourceContents(function (sourceFile, sourceContent) {
  24089. map.setSourceContent(sourceFile, sourceContent);
  24090. });
  24091. return {
  24092. code: generated.code,
  24093. map: map
  24094. };
  24095. };
  24096. exports.SourceNode = SourceNode;
  24097. /***/ }),
  24098. /* 156 */
  24099. /***/ (function(module, exports) {
  24100. /* (ignored) */
  24101. /***/ }),
  24102. /* 157 */
  24103. /***/ (function(module, exports, __webpack_require__) {
  24104. "use strict";
  24105. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  24106. Object.defineProperty(exports, "__esModule", {
  24107. value: true
  24108. });
  24109. var _createClass = function () {
  24110. function defineProperties(target, props) {
  24111. for (var i = 0; i < props.length; i++) {
  24112. var descriptor = props[i];
  24113. descriptor.enumerable = descriptor.enumerable || false;
  24114. descriptor.configurable = true;
  24115. if ("value" in descriptor) descriptor.writable = true;
  24116. Object.defineProperty(target, descriptor.key, descriptor);
  24117. }
  24118. }
  24119. return function (Constructor, protoProps, staticProps) {
  24120. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  24121. if (staticProps) defineProperties(Constructor, staticProps);
  24122. return Constructor;
  24123. };
  24124. }();
  24125. var _get = function get(object, property, receiver) {
  24126. if (object === null) object = Function.prototype;
  24127. var desc = Object.getOwnPropertyDescriptor(object, property);
  24128. if (desc === undefined) {
  24129. var parent = Object.getPrototypeOf(object);
  24130. if (parent === null) {
  24131. return undefined;
  24132. } else {
  24133. return get(parent, property, receiver);
  24134. }
  24135. } else if ("value" in desc) {
  24136. return desc.value;
  24137. } else {
  24138. var getter = desc.get;
  24139. if (getter === undefined) {
  24140. return undefined;
  24141. }
  24142. return getter.call(receiver);
  24143. }
  24144. };
  24145. var _rule = __webpack_require__(10);
  24146. var _rule2 = _interopRequireDefault(_rule);
  24147. var _lessStringify = __webpack_require__(14);
  24148. var _lessStringify2 = _interopRequireDefault(_lessStringify);
  24149. function _interopRequireDefault(obj) {
  24150. return obj && obj.__esModule ? obj : {
  24151. default: obj
  24152. };
  24153. }
  24154. function _classCallCheck(instance, Constructor) {
  24155. if (!(instance instanceof Constructor)) {
  24156. throw new TypeError("Cannot call a class as a function");
  24157. }
  24158. }
  24159. function _possibleConstructorReturn(self, call) {
  24160. if (!self) {
  24161. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  24162. }
  24163. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  24164. }
  24165. function _inherits(subClass, superClass) {
  24166. if (typeof superClass !== "function" && superClass !== null) {
  24167. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  24168. }
  24169. subClass.prototype = Object.create(superClass && superClass.prototype, {
  24170. constructor: {
  24171. value: subClass,
  24172. enumerable: false,
  24173. writable: true,
  24174. configurable: true
  24175. }
  24176. });
  24177. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  24178. }
  24179. var Import = function (_PostCssRule) {
  24180. _inherits(Import, _PostCssRule);
  24181. function Import(defaults) {
  24182. _classCallCheck(this, Import);
  24183. var _this = _possibleConstructorReturn(this, (Import.__proto__ || Object.getPrototypeOf(Import)).call(this, defaults));
  24184. _this.type = 'import';
  24185. return _this;
  24186. }
  24187. _createClass(Import, [{
  24188. key: 'toString',
  24189. value: function toString(stringifier) {
  24190. if (!stringifier) {
  24191. stringifier = {
  24192. stringify: _lessStringify2.default
  24193. };
  24194. }
  24195. return _get(Import.prototype.__proto__ || Object.getPrototypeOf(Import.prototype), 'toString', this).call(this, stringifier);
  24196. }
  24197. }]);
  24198. return Import;
  24199. }(_rule2.default);
  24200. exports.default = Import;
  24201. module.exports = exports['default'];
  24202. /***/ }),
  24203. /* 158 */
  24204. /***/ (function(module, exports, __webpack_require__) {
  24205. "use strict";
  24206. exports.__esModule = true;
  24207. var _jsBase = __webpack_require__(77);
  24208. var _sourceMap = __webpack_require__(78);
  24209. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  24210. var _path = __webpack_require__(6);
  24211. var _path2 = _interopRequireDefault(_path);
  24212. function _interopRequireDefault(obj) {
  24213. return obj && obj.__esModule ? obj : {
  24214. default: obj
  24215. };
  24216. }
  24217. function _classCallCheck(instance, Constructor) {
  24218. if (!(instance instanceof Constructor)) {
  24219. throw new TypeError("Cannot call a class as a function");
  24220. }
  24221. }
  24222. var MapGenerator = function () {
  24223. function MapGenerator(stringify, root, opts) {
  24224. _classCallCheck(this, MapGenerator);
  24225. this.stringify = stringify;
  24226. this.mapOpts = opts.map || {};
  24227. this.root = root;
  24228. this.opts = opts;
  24229. }
  24230. MapGenerator.prototype.isMap = function isMap() {
  24231. if (typeof this.opts.map !== 'undefined') {
  24232. return !!this.opts.map;
  24233. } else {
  24234. return this.previous().length > 0;
  24235. }
  24236. };
  24237. MapGenerator.prototype.previous = function previous() {
  24238. var _this = this;
  24239. if (!this.previousMaps) {
  24240. this.previousMaps = [];
  24241. this.root.walk(function (node) {
  24242. if (node.source && node.source.input.map) {
  24243. var map = node.source.input.map;
  24244. if (_this.previousMaps.indexOf(map) === -1) {
  24245. _this.previousMaps.push(map);
  24246. }
  24247. }
  24248. });
  24249. }
  24250. return this.previousMaps;
  24251. };
  24252. MapGenerator.prototype.isInline = function isInline() {
  24253. if (typeof this.mapOpts.inline !== 'undefined') {
  24254. return this.mapOpts.inline;
  24255. }
  24256. var annotation = this.mapOpts.annotation;
  24257. if (typeof annotation !== 'undefined' && annotation !== true) {
  24258. return false;
  24259. }
  24260. if (this.previous().length) {
  24261. return this.previous().some(function (i) {
  24262. return i.inline;
  24263. });
  24264. } else {
  24265. return true;
  24266. }
  24267. };
  24268. MapGenerator.prototype.isSourcesContent = function isSourcesContent() {
  24269. if (typeof this.mapOpts.sourcesContent !== 'undefined') {
  24270. return this.mapOpts.sourcesContent;
  24271. }
  24272. if (this.previous().length) {
  24273. return this.previous().some(function (i) {
  24274. return i.withContent();
  24275. });
  24276. } else {
  24277. return true;
  24278. }
  24279. };
  24280. MapGenerator.prototype.clearAnnotation = function clearAnnotation() {
  24281. if (this.mapOpts.annotation === false) return;
  24282. var node = void 0;
  24283. for (var i = this.root.nodes.length - 1; i >= 0; i--) {
  24284. node = this.root.nodes[i];
  24285. if (node.type !== 'comment') continue;
  24286. if (node.text.indexOf('# sourceMappingURL=') === 0) {
  24287. this.root.removeChild(i);
  24288. }
  24289. }
  24290. };
  24291. MapGenerator.prototype.setSourcesContent = function setSourcesContent() {
  24292. var _this2 = this;
  24293. var already = {};
  24294. this.root.walk(function (node) {
  24295. if (node.source) {
  24296. var from = node.source.input.from;
  24297. if (from && !already[from]) {
  24298. already[from] = true;
  24299. var relative = _this2.relative(from);
  24300. _this2.map.setSourceContent(relative, node.source.input.css);
  24301. }
  24302. }
  24303. });
  24304. };
  24305. MapGenerator.prototype.applyPrevMaps = function applyPrevMaps() {
  24306. for (var _iterator = this.previous(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  24307. var _ref;
  24308. if (_isArray) {
  24309. if (_i >= _iterator.length) break;
  24310. _ref = _iterator[_i++];
  24311. } else {
  24312. _i = _iterator.next();
  24313. if (_i.done) break;
  24314. _ref = _i.value;
  24315. }
  24316. var prev = _ref;
  24317. var from = this.relative(prev.file);
  24318. var root = prev.root || _path2.default.dirname(prev.file);
  24319. var map = void 0;
  24320. if (this.mapOpts.sourcesContent === false) {
  24321. map = new _sourceMap2.default.SourceMapConsumer(prev.text);
  24322. if (map.sourcesContent) {
  24323. map.sourcesContent = map.sourcesContent.map(function () {
  24324. return null;
  24325. });
  24326. }
  24327. } else {
  24328. map = prev.consumer();
  24329. }
  24330. this.map.applySourceMap(map, from, this.relative(root));
  24331. }
  24332. };
  24333. MapGenerator.prototype.isAnnotation = function isAnnotation() {
  24334. if (this.isInline()) {
  24335. return true;
  24336. } else if (typeof this.mapOpts.annotation !== 'undefined') {
  24337. return this.mapOpts.annotation;
  24338. } else if (this.previous().length) {
  24339. return this.previous().some(function (i) {
  24340. return i.annotation;
  24341. });
  24342. } else {
  24343. return true;
  24344. }
  24345. };
  24346. MapGenerator.prototype.addAnnotation = function addAnnotation() {
  24347. var content = void 0;
  24348. if (this.isInline()) {
  24349. content = 'data:application/json;base64,' + _jsBase.Base64.encode(this.map.toString());
  24350. } else if (typeof this.mapOpts.annotation === 'string') {
  24351. content = this.mapOpts.annotation;
  24352. } else {
  24353. content = this.outputFile() + '.map';
  24354. }
  24355. var eol = '\n';
  24356. if (this.css.indexOf('\r\n') !== -1) eol = '\r\n';
  24357. this.css += eol + '/*# sourceMappingURL=' + content + ' */';
  24358. };
  24359. MapGenerator.prototype.outputFile = function outputFile() {
  24360. if (this.opts.to) {
  24361. return this.relative(this.opts.to);
  24362. } else if (this.opts.from) {
  24363. return this.relative(this.opts.from);
  24364. } else {
  24365. return 'to.css';
  24366. }
  24367. };
  24368. MapGenerator.prototype.generateMap = function generateMap() {
  24369. this.generateString();
  24370. if (this.isSourcesContent()) this.setSourcesContent();
  24371. if (this.previous().length > 0) this.applyPrevMaps();
  24372. if (this.isAnnotation()) this.addAnnotation();
  24373. if (this.isInline()) {
  24374. return [this.css];
  24375. } else {
  24376. return [this.css, this.map];
  24377. }
  24378. };
  24379. MapGenerator.prototype.relative = function relative(file) {
  24380. if (file.indexOf('<') === 0) return file;
  24381. if (/^\w+:\/\//.test(file)) return file;
  24382. var from = this.opts.to ? _path2.default.dirname(this.opts.to) : '.';
  24383. if (typeof this.mapOpts.annotation === 'string') {
  24384. from = _path2.default.dirname(_path2.default.resolve(from, this.mapOpts.annotation));
  24385. }
  24386. file = _path2.default.relative(from, file);
  24387. if (_path2.default.sep === '\\') {
  24388. return file.replace(/\\/g, '/');
  24389. } else {
  24390. return file;
  24391. }
  24392. };
  24393. MapGenerator.prototype.sourcePath = function sourcePath(node) {
  24394. if (this.mapOpts.from) {
  24395. return this.mapOpts.from;
  24396. } else {
  24397. return this.relative(node.source.input.from);
  24398. }
  24399. };
  24400. MapGenerator.prototype.generateString = function generateString() {
  24401. var _this3 = this;
  24402. this.css = '';
  24403. this.map = new _sourceMap2.default.SourceMapGenerator({
  24404. file: this.outputFile()
  24405. });
  24406. var line = 1;
  24407. var column = 1;
  24408. var lines = void 0,
  24409. last = void 0;
  24410. this.stringify(this.root, function (str, node, type) {
  24411. _this3.css += str;
  24412. if (node && type !== 'end') {
  24413. if (node.source && node.source.start) {
  24414. _this3.map.addMapping({
  24415. source: _this3.sourcePath(node),
  24416. generated: {
  24417. line: line,
  24418. column: column - 1
  24419. },
  24420. original: {
  24421. line: node.source.start.line,
  24422. column: node.source.start.column - 1
  24423. }
  24424. });
  24425. } else {
  24426. _this3.map.addMapping({
  24427. source: '<no source>',
  24428. original: {
  24429. line: 1,
  24430. column: 0
  24431. },
  24432. generated: {
  24433. line: line,
  24434. column: column - 1
  24435. }
  24436. });
  24437. }
  24438. }
  24439. lines = str.match(/\n/g);
  24440. if (lines) {
  24441. line += lines.length;
  24442. last = str.lastIndexOf('\n');
  24443. column = str.length - last;
  24444. } else {
  24445. column += str.length;
  24446. }
  24447. if (node && type !== 'start') {
  24448. if (node.source && node.source.end) {
  24449. _this3.map.addMapping({
  24450. source: _this3.sourcePath(node),
  24451. generated: {
  24452. line: line,
  24453. column: column - 1
  24454. },
  24455. original: {
  24456. line: node.source.end.line,
  24457. column: node.source.end.column
  24458. }
  24459. });
  24460. } else {
  24461. _this3.map.addMapping({
  24462. source: '<no source>',
  24463. original: {
  24464. line: 1,
  24465. column: 0
  24466. },
  24467. generated: {
  24468. line: line,
  24469. column: column - 1
  24470. }
  24471. });
  24472. }
  24473. }
  24474. });
  24475. };
  24476. MapGenerator.prototype.generate = function generate() {
  24477. this.clearAnnotation();
  24478. if (this.isMap()) {
  24479. return this.generateMap();
  24480. } else {
  24481. var result = '';
  24482. this.stringify(this.root, function (i) {
  24483. result += i;
  24484. });
  24485. return [result];
  24486. }
  24487. };
  24488. return MapGenerator;
  24489. }();
  24490. exports.default = MapGenerator;
  24491. module.exports = exports['default'];
  24492. /***/ }),
  24493. /* 159 */
  24494. /***/ (function(module, exports, __webpack_require__) {
  24495. "use strict";
  24496. exports.__esModule = true;
  24497. var _createClass = function () {
  24498. function defineProperties(target, props) {
  24499. for (var i = 0; i < props.length; i++) {
  24500. var descriptor = props[i];
  24501. descriptor.enumerable = descriptor.enumerable || false;
  24502. descriptor.configurable = true;
  24503. if ("value" in descriptor) descriptor.writable = true;
  24504. Object.defineProperty(target, descriptor.key, descriptor);
  24505. }
  24506. }
  24507. return function (Constructor, protoProps, staticProps) {
  24508. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  24509. if (staticProps) defineProperties(Constructor, staticProps);
  24510. return Constructor;
  24511. };
  24512. }();
  24513. var _warning = __webpack_require__(160);
  24514. var _warning2 = _interopRequireDefault(_warning);
  24515. function _interopRequireDefault(obj) {
  24516. return obj && obj.__esModule ? obj : {
  24517. default: obj
  24518. };
  24519. }
  24520. function _classCallCheck(instance, Constructor) {
  24521. if (!(instance instanceof Constructor)) {
  24522. throw new TypeError("Cannot call a class as a function");
  24523. }
  24524. }
  24525. /**
  24526. * Provides the result of the PostCSS transformations.
  24527. *
  24528. * A Result instance is returned by {@link LazyResult#then}
  24529. * or {@link Root#toResult} methods.
  24530. *
  24531. * @example
  24532. * postcss([cssnext]).process(css).then(function (result) {
  24533. * console.log(result.css);
  24534. * });
  24535. *
  24536. * @example
  24537. * var result2 = postcss.parse(css).toResult();
  24538. */
  24539. var Result = function () {
  24540. /**
  24541. * @param {Processor} processor - processor used for this transformation.
  24542. * @param {Root} root - Root node after all transformations.
  24543. * @param {processOptions} opts - options from the {@link Processor#process}
  24544. * or {@link Root#toResult}
  24545. */
  24546. function Result(processor, root, opts) {
  24547. _classCallCheck(this, Result);
  24548. /**
  24549. * @member {Processor} - The Processor instance used
  24550. * for this transformation.
  24551. *
  24552. * @example
  24553. * for ( let plugin of result.processor.plugins) {
  24554. * if ( plugin.postcssPlugin === 'postcss-bad' ) {
  24555. * throw 'postcss-good is incompatible with postcss-bad';
  24556. * }
  24557. * });
  24558. */
  24559. this.processor = processor;
  24560. /**
  24561. * @member {Message[]} - Contains messages from plugins
  24562. * (e.g., warnings or custom messages).
  24563. * Each message should have type
  24564. * and plugin properties.
  24565. *
  24566. * @example
  24567. * postcss.plugin('postcss-min-browser', () => {
  24568. * return (root, result) => {
  24569. * var browsers = detectMinBrowsersByCanIUse(root);
  24570. * result.messages.push({
  24571. * type: 'min-browser',
  24572. * plugin: 'postcss-min-browser',
  24573. * browsers: browsers
  24574. * });
  24575. * };
  24576. * });
  24577. */
  24578. this.messages = [];
  24579. /**
  24580. * @member {Root} - Root node after all transformations.
  24581. *
  24582. * @example
  24583. * root.toResult().root == root;
  24584. */
  24585. this.root = root;
  24586. /**
  24587. * @member {processOptions} - Options from the {@link Processor#process}
  24588. * or {@link Root#toResult} call
  24589. * that produced this Result instance.
  24590. *
  24591. * @example
  24592. * root.toResult(opts).opts == opts;
  24593. */
  24594. this.opts = opts;
  24595. /**
  24596. * @member {string} - A CSS string representing of {@link Result#root}.
  24597. *
  24598. * @example
  24599. * postcss.parse('a{}').toResult().css //=> "a{}"
  24600. */
  24601. this.css = undefined;
  24602. /**
  24603. * @member {SourceMapGenerator} - An instance of `SourceMapGenerator`
  24604. * class from the `source-map` library,
  24605. * representing changes
  24606. * to the {@link Result#root} instance.
  24607. *
  24608. * @example
  24609. * result.map.toJSON() //=> { version: 3, file: 'a.css', … }
  24610. *
  24611. * @example
  24612. * if ( result.map ) {
  24613. * fs.writeFileSync(result.opts.to + '.map', result.map.toString());
  24614. * }
  24615. */
  24616. this.map = undefined;
  24617. }
  24618. /**
  24619. * Returns for @{link Result#css} content.
  24620. *
  24621. * @example
  24622. * result + '' === result.css
  24623. *
  24624. * @return {string} string representing of {@link Result#root}
  24625. */
  24626. Result.prototype.toString = function toString() {
  24627. return this.css;
  24628. };
  24629. /**
  24630. * Creates an instance of {@link Warning} and adds it
  24631. * to {@link Result#messages}.
  24632. *
  24633. * @param {string} text - warning message
  24634. * @param {Object} [opts] - warning options
  24635. * @param {Node} opts.node - CSS node that caused the warning
  24636. * @param {string} opts.word - word in CSS source that caused the warning
  24637. * @param {number} opts.index - index in CSS node string that caused
  24638. * the warning
  24639. * @param {string} opts.plugin - name of the plugin that created
  24640. * this warning. {@link Result#warn} fills
  24641. * this property automatically.
  24642. *
  24643. * @return {Warning} created warning
  24644. */
  24645. Result.prototype.warn = function warn(text) {
  24646. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  24647. if (!opts.plugin) {
  24648. if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
  24649. opts.plugin = this.lastPlugin.postcssPlugin;
  24650. }
  24651. }
  24652. var warning = new _warning2.default(text, opts);
  24653. this.messages.push(warning);
  24654. return warning;
  24655. };
  24656. /**
  24657. * Returns warnings from plugins. Filters {@link Warning} instances
  24658. * from {@link Result#messages}.
  24659. *
  24660. * @example
  24661. * result.warnings().forEach(warn => {
  24662. * console.warn(warn.toString());
  24663. * });
  24664. *
  24665. * @return {Warning[]} warnings from plugins
  24666. */
  24667. Result.prototype.warnings = function warnings() {
  24668. return this.messages.filter(function (i) {
  24669. return i.type === 'warning';
  24670. });
  24671. };
  24672. /**
  24673. * An alias for the {@link Result#css} property.
  24674. * Use it with syntaxes that generate non-CSS output.
  24675. * @type {string}
  24676. *
  24677. * @example
  24678. * result.css === result.content;
  24679. */
  24680. _createClass(Result, [{
  24681. key: 'content',
  24682. get: function get() {
  24683. return this.css;
  24684. }
  24685. }]);
  24686. return Result;
  24687. }();
  24688. exports.default = Result;
  24689. /**
  24690. * @typedef {object} Message
  24691. * @property {string} type - message type
  24692. * @property {string} plugin - source PostCSS plugin name
  24693. */
  24694. module.exports = exports['default'];
  24695. /***/ }),
  24696. /* 160 */
  24697. /***/ (function(module, exports, __webpack_require__) {
  24698. "use strict";
  24699. exports.__esModule = true;
  24700. function _classCallCheck(instance, Constructor) {
  24701. if (!(instance instanceof Constructor)) {
  24702. throw new TypeError("Cannot call a class as a function");
  24703. }
  24704. }
  24705. /**
  24706. * Represents a plugin’s warning. It can be created using {@link Node#warn}.
  24707. *
  24708. * @example
  24709. * if ( decl.important ) {
  24710. * decl.warn(result, 'Avoid !important', { word: '!important' });
  24711. * }
  24712. */
  24713. var Warning = function () {
  24714. /**
  24715. * @param {string} text - warning message
  24716. * @param {Object} [opts] - warning options
  24717. * @param {Node} opts.node - CSS node that caused the warning
  24718. * @param {string} opts.word - word in CSS source that caused the warning
  24719. * @param {number} opts.index - index in CSS node string that caused
  24720. * the warning
  24721. * @param {string} opts.plugin - name of the plugin that created
  24722. * this warning. {@link Result#warn} fills
  24723. * this property automatically.
  24724. */
  24725. function Warning(text) {
  24726. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  24727. _classCallCheck(this, Warning);
  24728. /**
  24729. * @member {string} - Type to filter warnings from
  24730. * {@link Result#messages}. Always equal
  24731. * to `"warning"`.
  24732. *
  24733. * @example
  24734. * const nonWarning = result.messages.filter(i => i.type !== 'warning')
  24735. */
  24736. this.type = 'warning';
  24737. /**
  24738. * @member {string} - The warning message.
  24739. *
  24740. * @example
  24741. * warning.text //=> 'Try to avoid !important'
  24742. */
  24743. this.text = text;
  24744. if (opts.node && opts.node.source) {
  24745. var pos = opts.node.positionBy(opts);
  24746. /**
  24747. * @member {number} - Line in the input file
  24748. * with this warning’s source
  24749. *
  24750. * @example
  24751. * warning.line //=> 5
  24752. */
  24753. this.line = pos.line;
  24754. /**
  24755. * @member {number} - Column in the input file
  24756. * with this warning’s source.
  24757. *
  24758. * @example
  24759. * warning.column //=> 6
  24760. */
  24761. this.column = pos.column;
  24762. }
  24763. for (var opt in opts) {
  24764. this[opt] = opts[opt];
  24765. }
  24766. }
  24767. /**
  24768. * Returns a warning position and message.
  24769. *
  24770. * @example
  24771. * warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important'
  24772. *
  24773. * @return {string} warning position and message
  24774. */
  24775. Warning.prototype.toString = function toString() {
  24776. if (this.node) {
  24777. return this.node.error(this.text, {
  24778. plugin: this.plugin,
  24779. index: this.index,
  24780. word: this.word
  24781. }).message;
  24782. } else if (this.plugin) {
  24783. return this.plugin + ': ' + this.text;
  24784. } else {
  24785. return this.text;
  24786. }
  24787. };
  24788. /**
  24789. * @memberof Warning#
  24790. * @member {string} plugin - The name of the plugin that created
  24791. * it will fill this property automatically.
  24792. * this warning. When you call {@link Node#warn}
  24793. *
  24794. * @example
  24795. * warning.plugin //=> 'postcss-important'
  24796. */
  24797. /**
  24798. * @memberof Warning#
  24799. * @member {Node} node - Contains the CSS node that caused the warning.
  24800. *
  24801. * @example
  24802. * warning.node.toString() //=> 'color: white !important'
  24803. */
  24804. return Warning;
  24805. }();
  24806. exports.default = Warning;
  24807. module.exports = exports['default'];
  24808. /***/ }),
  24809. /* 161 */
  24810. /***/ (function(module, exports, __webpack_require__) {
  24811. "use strict";
  24812. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  24813. exports.__esModule = true;
  24814. var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  24815. return _typeof2(obj);
  24816. } : function (obj) {
  24817. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  24818. };
  24819. var _lazyResult = __webpack_require__(86);
  24820. var _lazyResult2 = _interopRequireDefault(_lazyResult);
  24821. function _interopRequireDefault(obj) {
  24822. return obj && obj.__esModule ? obj : {
  24823. default: obj
  24824. };
  24825. }
  24826. function _classCallCheck(instance, Constructor) {
  24827. if (!(instance instanceof Constructor)) {
  24828. throw new TypeError("Cannot call a class as a function");
  24829. }
  24830. }
  24831. /**
  24832. * Contains plugins to process CSS. Create one `Processor` instance,
  24833. * initialize its plugins, and then use that instance on numerous CSS files.
  24834. *
  24835. * @example
  24836. * const processor = postcss([autoprefixer, precss]);
  24837. * processor.process(css1).then(result => console.log(result.css));
  24838. * processor.process(css2).then(result => console.log(result.css));
  24839. */
  24840. var Processor = function () {
  24841. /**
  24842. * @param {Array.<Plugin|pluginFunction>|Processor} plugins - PostCSS
  24843. * plugins. See {@link Processor#use} for plugin format.
  24844. */
  24845. function Processor() {
  24846. var plugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  24847. _classCallCheck(this, Processor);
  24848. /**
  24849. * @member {string} - Current PostCSS version.
  24850. *
  24851. * @example
  24852. * if ( result.processor.version.split('.')[0] !== '5' ) {
  24853. * throw new Error('This plugin works only with PostCSS 5');
  24854. * }
  24855. */
  24856. this.version = '5.2.17';
  24857. /**
  24858. * @member {pluginFunction[]} - Plugins added to this processor.
  24859. *
  24860. * @example
  24861. * const processor = postcss([autoprefixer, precss]);
  24862. * processor.plugins.length //=> 2
  24863. */
  24864. this.plugins = this.normalize(plugins);
  24865. }
  24866. /**
  24867. * Adds a plugin to be used as a CSS processor.
  24868. *
  24869. * PostCSS plugin can be in 4 formats:
  24870. * * A plugin created by {@link postcss.plugin} method.
  24871. * * A function. PostCSS will pass the function a @{link Root}
  24872. * as the first argument and current {@link Result} instance
  24873. * as the second.
  24874. * * An object with a `postcss` method. PostCSS will use that method
  24875. * as described in #2.
  24876. * * Another {@link Processor} instance. PostCSS will copy plugins
  24877. * from that instance into this one.
  24878. *
  24879. * Plugins can also be added by passing them as arguments when creating
  24880. * a `postcss` instance (see [`postcss(plugins)`]).
  24881. *
  24882. * Asynchronous plugins should return a `Promise` instance.
  24883. *
  24884. * @param {Plugin|pluginFunction|Processor} plugin - PostCSS plugin
  24885. * or {@link Processor}
  24886. * with plugins
  24887. *
  24888. * @example
  24889. * const processor = postcss()
  24890. * .use(autoprefixer)
  24891. * .use(precss);
  24892. *
  24893. * @return {Processes} current processor to make methods chain
  24894. */
  24895. Processor.prototype.use = function use(plugin) {
  24896. this.plugins = this.plugins.concat(this.normalize([plugin]));
  24897. return this;
  24898. };
  24899. /**
  24900. * Parses source CSS and returns a {@link LazyResult} Promise proxy.
  24901. * Because some plugins can be asynchronous it doesn’t make
  24902. * any transformations. Transformations will be applied
  24903. * in the {@link LazyResult} methods.
  24904. *
  24905. * @param {string|toString|Result} css - String with input CSS or
  24906. * any object with a `toString()`
  24907. * method, like a Buffer.
  24908. * Optionally, send a {@link Result}
  24909. * instance and the processor will
  24910. * take the {@link Root} from it.
  24911. * @param {processOptions} [opts] - options
  24912. *
  24913. * @return {LazyResult} Promise proxy
  24914. *
  24915. * @example
  24916. * processor.process(css, { from: 'a.css', to: 'a.out.css' })
  24917. * .then(result => {
  24918. * console.log(result.css);
  24919. * });
  24920. */
  24921. Processor.prototype.process = function process(css) {
  24922. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  24923. return new _lazyResult2.default(this, css, opts);
  24924. };
  24925. Processor.prototype.normalize = function normalize(plugins) {
  24926. var normalized = [];
  24927. for (var _iterator = plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  24928. var _ref;
  24929. if (_isArray) {
  24930. if (_i >= _iterator.length) break;
  24931. _ref = _iterator[_i++];
  24932. } else {
  24933. _i = _iterator.next();
  24934. if (_i.done) break;
  24935. _ref = _i.value;
  24936. }
  24937. var i = _ref;
  24938. if (i.postcss) i = i.postcss;
  24939. if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object' && Array.isArray(i.plugins)) {
  24940. normalized = normalized.concat(i.plugins);
  24941. } else if (typeof i === 'function') {
  24942. normalized.push(i);
  24943. } else if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object' && (i.parse || i.stringify)) {
  24944. throw new Error('PostCSS syntaxes cannot be used as plugins. ' + 'Instead, please use one of the ' + 'syntax/parser/stringifier options as ' + 'outlined in your PostCSS ' + 'runner documentation.');
  24945. } else {
  24946. throw new Error(i + ' is not a PostCSS plugin');
  24947. }
  24948. }
  24949. return normalized;
  24950. };
  24951. return Processor;
  24952. }();
  24953. exports.default = Processor;
  24954. /**
  24955. * @callback builder
  24956. * @param {string} part - part of generated CSS connected to this node
  24957. * @param {Node} node - AST node
  24958. * @param {"start"|"end"} [type] - node’s part type
  24959. */
  24960. /**
  24961. * @callback parser
  24962. *
  24963. * @param {string|toString} css - string with input CSS or any object
  24964. * with toString() method, like a Buffer
  24965. * @param {processOptions} [opts] - options with only `from` and `map` keys
  24966. *
  24967. * @return {Root} PostCSS AST
  24968. */
  24969. /**
  24970. * @callback stringifier
  24971. *
  24972. * @param {Node} node - start node for stringifing. Usually {@link Root}.
  24973. * @param {builder} builder - function to concatenate CSS from node’s parts
  24974. * or generate string and source map
  24975. *
  24976. * @return {void}
  24977. */
  24978. /**
  24979. * @typedef {object} syntax
  24980. * @property {parser} parse - function to generate AST by string
  24981. * @property {stringifier} stringify - function to generate string by AST
  24982. */
  24983. /**
  24984. * @typedef {object} toString
  24985. * @property {function} toString
  24986. */
  24987. /**
  24988. * @callback pluginFunction
  24989. * @param {Root} root - parsed input CSS
  24990. * @param {Result} result - result to set warnings or check other plugins
  24991. */
  24992. /**
  24993. * @typedef {object} Plugin
  24994. * @property {function} postcss - PostCSS plugin function
  24995. */
  24996. /**
  24997. * @typedef {object} processOptions
  24998. * @property {string} from - the path of the CSS source file.
  24999. * You should always set `from`,
  25000. * because it is used in source map
  25001. * generation and syntax error messages.
  25002. * @property {string} to - the path where you’ll put the output
  25003. * CSS file. You should always set `to`
  25004. * to generate correct source maps.
  25005. * @property {parser} parser - function to generate AST by string
  25006. * @property {stringifier} stringifier - class to generate string by AST
  25007. * @property {syntax} syntax - object with `parse` and `stringify`
  25008. * @property {object} map - source map options
  25009. * @property {boolean} map.inline - does source map should
  25010. * be embedded in the output
  25011. * CSS as a base64-encoded
  25012. * comment
  25013. * @property {string|object|false|function} map.prev - source map content
  25014. * from a previous
  25015. * processing step
  25016. * (for example, Sass).
  25017. * PostCSS will try to find
  25018. * previous map
  25019. * automatically, so you
  25020. * could disable it by
  25021. * `false` value.
  25022. * @property {boolean} map.sourcesContent - does PostCSS should set
  25023. * the origin content to map
  25024. * @property {string|false} map.annotation - does PostCSS should set
  25025. * annotation comment to map
  25026. * @property {string} map.from - override `from` in map’s
  25027. * `sources`
  25028. */
  25029. module.exports = exports['default'];
  25030. /***/ }),
  25031. /* 162 */
  25032. /***/ (function(module, exports, __webpack_require__) {
  25033. "use strict";
  25034. exports.__esModule = true;
  25035. /**
  25036. * Contains helpers for safely splitting lists of CSS values,
  25037. * preserving parentheses and quotes.
  25038. *
  25039. * @example
  25040. * const list = postcss.list;
  25041. *
  25042. * @namespace list
  25043. */
  25044. var list = {
  25045. split: function split(string, separators, last) {
  25046. var array = [];
  25047. var current = '';
  25048. var split = false;
  25049. var func = 0;
  25050. var quote = false;
  25051. var escape = false;
  25052. for (var i = 0; i < string.length; i++) {
  25053. var letter = string[i];
  25054. if (quote) {
  25055. if (escape) {
  25056. escape = false;
  25057. } else if (letter === '\\') {
  25058. escape = true;
  25059. } else if (letter === quote) {
  25060. quote = false;
  25061. }
  25062. } else if (letter === '"' || letter === '\'') {
  25063. quote = letter;
  25064. } else if (letter === '(') {
  25065. func += 1;
  25066. } else if (letter === ')') {
  25067. if (func > 0) func -= 1;
  25068. } else if (func === 0) {
  25069. if (separators.indexOf(letter) !== -1) split = true;
  25070. }
  25071. if (split) {
  25072. if (current !== '') array.push(current.trim());
  25073. current = '';
  25074. split = false;
  25075. } else {
  25076. current += letter;
  25077. }
  25078. }
  25079. if (last || current !== '') array.push(current.trim());
  25080. return array;
  25081. },
  25082. /**
  25083. * Safely splits space-separated values (such as those for `background`,
  25084. * `border-radius`, and other shorthand properties).
  25085. *
  25086. * @param {string} string - space-separated values
  25087. *
  25088. * @return {string[]} split values
  25089. *
  25090. * @example
  25091. * postcss.list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
  25092. */
  25093. space: function space(string) {
  25094. var spaces = [' ', '\n', '\t'];
  25095. return list.split(string, spaces);
  25096. },
  25097. /**
  25098. * Safely splits comma-separated values (such as those for `transition-*`
  25099. * and `background` properties).
  25100. *
  25101. * @param {string} string - comma-separated values
  25102. *
  25103. * @return {string[]} split values
  25104. *
  25105. * @example
  25106. * postcss.list.comma('black, linear-gradient(white, black)')
  25107. * //=> ['black', 'linear-gradient(white, black)']
  25108. */
  25109. comma: function comma(string) {
  25110. var comma = ',';
  25111. return list.split(string, [comma], true);
  25112. }
  25113. };
  25114. exports.default = list;
  25115. module.exports = exports['default'];
  25116. /***/ }),
  25117. /* 163 */
  25118. /***/ (function(module, exports, __webpack_require__) {
  25119. "use strict";
  25120. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  25121. Object.defineProperty(exports, "__esModule", {
  25122. value: true
  25123. });
  25124. var _createClass = function () {
  25125. function defineProperties(target, props) {
  25126. for (var i = 0; i < props.length; i++) {
  25127. var descriptor = props[i];
  25128. descriptor.enumerable = descriptor.enumerable || false;
  25129. descriptor.configurable = true;
  25130. if ("value" in descriptor) descriptor.writable = true;
  25131. Object.defineProperty(target, descriptor.key, descriptor);
  25132. }
  25133. }
  25134. return function (Constructor, protoProps, staticProps) {
  25135. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  25136. if (staticProps) defineProperties(Constructor, staticProps);
  25137. return Constructor;
  25138. };
  25139. }();
  25140. var _get = function get(object, property, receiver) {
  25141. if (object === null) object = Function.prototype;
  25142. var desc = Object.getOwnPropertyDescriptor(object, property);
  25143. if (desc === undefined) {
  25144. var parent = Object.getPrototypeOf(object);
  25145. if (parent === null) {
  25146. return undefined;
  25147. } else {
  25148. return get(parent, property, receiver);
  25149. }
  25150. } else if ("value" in desc) {
  25151. return desc.value;
  25152. } else {
  25153. var getter = desc.get;
  25154. if (getter === undefined) {
  25155. return undefined;
  25156. }
  25157. return getter.call(receiver);
  25158. }
  25159. };
  25160. var _stringifier = __webpack_require__(24);
  25161. var _stringifier2 = _interopRequireDefault(_stringifier);
  25162. function _interopRequireDefault(obj) {
  25163. return obj && obj.__esModule ? obj : {
  25164. default: obj
  25165. };
  25166. }
  25167. function _classCallCheck(instance, Constructor) {
  25168. if (!(instance instanceof Constructor)) {
  25169. throw new TypeError("Cannot call a class as a function");
  25170. }
  25171. }
  25172. function _possibleConstructorReturn(self, call) {
  25173. if (!self) {
  25174. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25175. }
  25176. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  25177. }
  25178. function _inherits(subClass, superClass) {
  25179. if (typeof superClass !== "function" && superClass !== null) {
  25180. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  25181. }
  25182. subClass.prototype = Object.create(superClass && superClass.prototype, {
  25183. constructor: {
  25184. value: subClass,
  25185. enumerable: false,
  25186. writable: true,
  25187. configurable: true
  25188. }
  25189. });
  25190. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  25191. }
  25192. var LessStringifier = function (_Stringifier) {
  25193. _inherits(LessStringifier, _Stringifier);
  25194. function LessStringifier() {
  25195. _classCallCheck(this, LessStringifier);
  25196. return _possibleConstructorReturn(this, (LessStringifier.__proto__ || Object.getPrototypeOf(LessStringifier)).apply(this, arguments));
  25197. }
  25198. _createClass(LessStringifier, [{
  25199. key: 'comment',
  25200. value: function comment(node) {
  25201. this.builder(node.raws.content, node);
  25202. }
  25203. }, {
  25204. key: 'import',
  25205. value: function _import(node) {
  25206. this.builder('@' + node.name);
  25207. this.builder((node.raws.afterName || '') + (node.directives || '') + (node.raws.between || '') + (node.urlFunc ? 'url(' : '') + (node.raws.beforeUrl || '') + (node.importPath || '') + (node.raws.afterUrl || '') + (node.urlFunc ? ')' : '') + (node.raws.after || ''));
  25208. if (node.raws.semicolon) {
  25209. this.builder(';');
  25210. }
  25211. }
  25212. }, {
  25213. key: 'rule',
  25214. value: function rule(node) {
  25215. _get(LessStringifier.prototype.__proto__ || Object.getPrototypeOf(LessStringifier.prototype), 'rule', this).call(this, node);
  25216. if (node.empty && node.raws.semicolon) {
  25217. if (node.important) {
  25218. if (node.raws.important) {
  25219. this.builder(node.raws.important);
  25220. } else {
  25221. this.builder(' !important');
  25222. }
  25223. }
  25224. if (node.raws.semicolon) {
  25225. this.builder(';');
  25226. }
  25227. }
  25228. }
  25229. }, {
  25230. key: 'block',
  25231. value: function block(node, start) {
  25232. var empty = node.empty;
  25233. var between = this.raw(node, 'between', 'beforeOpen');
  25234. var after = '';
  25235. if (empty) {
  25236. this.builder(start + between, node, 'start');
  25237. } else {
  25238. this.builder(start + between + '{', node, 'start');
  25239. }
  25240. if (node.nodes && node.nodes.length) {
  25241. this.body(node);
  25242. after = this.raw(node, 'after');
  25243. } else {
  25244. after = this.raw(node, 'after', 'emptyBody');
  25245. }
  25246. if (after) {
  25247. this.builder(after);
  25248. }
  25249. if (!empty) {
  25250. this.builder('}', node, 'end');
  25251. }
  25252. }
  25253. }]);
  25254. return LessStringifier;
  25255. }(_stringifier2.default);
  25256. exports.default = LessStringifier;
  25257. module.exports = exports['default'];
  25258. /***/ }),
  25259. /* 164 */
  25260. /***/ (function(module, exports, __webpack_require__) {
  25261. "use strict";
  25262. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  25263. Object.defineProperty(exports, "__esModule", {
  25264. value: true
  25265. });
  25266. var _createClass = function () {
  25267. function defineProperties(target, props) {
  25268. for (var i = 0; i < props.length; i++) {
  25269. var descriptor = props[i];
  25270. descriptor.enumerable = descriptor.enumerable || false;
  25271. descriptor.configurable = true;
  25272. if ("value" in descriptor) descriptor.writable = true;
  25273. Object.defineProperty(target, descriptor.key, descriptor);
  25274. }
  25275. }
  25276. return function (Constructor, protoProps, staticProps) {
  25277. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  25278. if (staticProps) defineProperties(Constructor, staticProps);
  25279. return Constructor;
  25280. };
  25281. }();
  25282. var _get = function get(object, property, receiver) {
  25283. if (object === null) object = Function.prototype;
  25284. var desc = Object.getOwnPropertyDescriptor(object, property);
  25285. if (desc === undefined) {
  25286. var parent = Object.getPrototypeOf(object);
  25287. if (parent === null) {
  25288. return undefined;
  25289. } else {
  25290. return get(parent, property, receiver);
  25291. }
  25292. } else if ("value" in desc) {
  25293. return desc.value;
  25294. } else {
  25295. var getter = desc.get;
  25296. if (getter === undefined) {
  25297. return undefined;
  25298. }
  25299. return getter.call(receiver);
  25300. }
  25301. };
  25302. var _rule = __webpack_require__(10);
  25303. var _rule2 = _interopRequireDefault(_rule);
  25304. var _lessStringify = __webpack_require__(14);
  25305. var _lessStringify2 = _interopRequireDefault(_lessStringify);
  25306. function _interopRequireDefault(obj) {
  25307. return obj && obj.__esModule ? obj : {
  25308. default: obj
  25309. };
  25310. }
  25311. function _classCallCheck(instance, Constructor) {
  25312. if (!(instance instanceof Constructor)) {
  25313. throw new TypeError("Cannot call a class as a function");
  25314. }
  25315. }
  25316. function _possibleConstructorReturn(self, call) {
  25317. if (!self) {
  25318. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25319. }
  25320. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  25321. }
  25322. function _inherits(subClass, superClass) {
  25323. if (typeof superClass !== "function" && superClass !== null) {
  25324. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  25325. }
  25326. subClass.prototype = Object.create(superClass && superClass.prototype, {
  25327. constructor: {
  25328. value: subClass,
  25329. enumerable: false,
  25330. writable: true,
  25331. configurable: true
  25332. }
  25333. });
  25334. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  25335. }
  25336. var Rule = function (_PostCssRule) {
  25337. _inherits(Rule, _PostCssRule);
  25338. function Rule() {
  25339. _classCallCheck(this, Rule);
  25340. return _possibleConstructorReturn(this, (Rule.__proto__ || Object.getPrototypeOf(Rule)).apply(this, arguments));
  25341. }
  25342. _createClass(Rule, [{
  25343. key: 'toString',
  25344. value: function toString(stringifier) {
  25345. if (!stringifier) {
  25346. stringifier = {
  25347. stringify: _lessStringify2.default
  25348. };
  25349. }
  25350. return _get(Rule.prototype.__proto__ || Object.getPrototypeOf(Rule.prototype), 'toString', this).call(this, stringifier);
  25351. }
  25352. }]);
  25353. return Rule;
  25354. }(_rule2.default);
  25355. exports.default = Rule;
  25356. module.exports = exports['default'];
  25357. /***/ }),
  25358. /* 165 */
  25359. /***/ (function(module, exports, __webpack_require__) {
  25360. "use strict";
  25361. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  25362. Object.defineProperty(exports, "__esModule", {
  25363. value: true
  25364. });
  25365. var _createClass = function () {
  25366. function defineProperties(target, props) {
  25367. for (var i = 0; i < props.length; i++) {
  25368. var descriptor = props[i];
  25369. descriptor.enumerable = descriptor.enumerable || false;
  25370. descriptor.configurable = true;
  25371. if ("value" in descriptor) descriptor.writable = true;
  25372. Object.defineProperty(target, descriptor.key, descriptor);
  25373. }
  25374. }
  25375. return function (Constructor, protoProps, staticProps) {
  25376. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  25377. if (staticProps) defineProperties(Constructor, staticProps);
  25378. return Constructor;
  25379. };
  25380. }();
  25381. var _get = function get(object, property, receiver) {
  25382. if (object === null) object = Function.prototype;
  25383. var desc = Object.getOwnPropertyDescriptor(object, property);
  25384. if (desc === undefined) {
  25385. var parent = Object.getPrototypeOf(object);
  25386. if (parent === null) {
  25387. return undefined;
  25388. } else {
  25389. return get(parent, property, receiver);
  25390. }
  25391. } else if ("value" in desc) {
  25392. return desc.value;
  25393. } else {
  25394. var getter = desc.get;
  25395. if (getter === undefined) {
  25396. return undefined;
  25397. }
  25398. return getter.call(receiver);
  25399. }
  25400. };
  25401. var _root = __webpack_require__(27);
  25402. var _root2 = _interopRequireDefault(_root);
  25403. var _lessStringify = __webpack_require__(14);
  25404. var _lessStringify2 = _interopRequireDefault(_lessStringify);
  25405. function _interopRequireDefault(obj) {
  25406. return obj && obj.__esModule ? obj : {
  25407. default: obj
  25408. };
  25409. }
  25410. function _classCallCheck(instance, Constructor) {
  25411. if (!(instance instanceof Constructor)) {
  25412. throw new TypeError("Cannot call a class as a function");
  25413. }
  25414. }
  25415. function _possibleConstructorReturn(self, call) {
  25416. if (!self) {
  25417. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25418. }
  25419. return call && (_typeof(call) === "object" || typeof call === "function") ? call : self;
  25420. }
  25421. function _inherits(subClass, superClass) {
  25422. if (typeof superClass !== "function" && superClass !== null) {
  25423. throw new TypeError("Super expression must either be null or a function, not " + _typeof(superClass));
  25424. }
  25425. subClass.prototype = Object.create(superClass && superClass.prototype, {
  25426. constructor: {
  25427. value: subClass,
  25428. enumerable: false,
  25429. writable: true,
  25430. configurable: true
  25431. }
  25432. });
  25433. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  25434. }
  25435. var Root = function (_PostCssRoot) {
  25436. _inherits(Root, _PostCssRoot);
  25437. function Root() {
  25438. _classCallCheck(this, Root);
  25439. return _possibleConstructorReturn(this, (Root.__proto__ || Object.getPrototypeOf(Root)).apply(this, arguments));
  25440. }
  25441. _createClass(Root, [{
  25442. key: 'toString',
  25443. value: function toString(stringifier) {
  25444. if (!stringifier) {
  25445. stringifier = {
  25446. stringify: _lessStringify2.default
  25447. };
  25448. }
  25449. return _get(Root.prototype.__proto__ || Object.getPrototypeOf(Root.prototype), 'toString', this).call(this, stringifier);
  25450. }
  25451. }]);
  25452. return Root;
  25453. }(_root2.default);
  25454. exports.default = Root;
  25455. module.exports = exports['default'];
  25456. /***/ }),
  25457. /* 166 */
  25458. /***/ (function(module, exports, __webpack_require__) {
  25459. "use strict";
  25460. Object.defineProperty(exports, "__esModule", {
  25461. value: true
  25462. });
  25463. exports.default = findExtendRule;
  25464. var extendRuleKeyWords = ['&', ':', 'extend'];
  25465. var extendRuleKeyWordsCount = extendRuleKeyWords.length;
  25466. function findExtendRule(tokens) {
  25467. var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  25468. var stack = [];
  25469. var len = tokens.length;
  25470. var end = start;
  25471. while (end < len) {
  25472. var token = tokens[end];
  25473. if (extendRuleKeyWords.indexOf(token[1]) >= 0) {
  25474. stack.push(token[1]);
  25475. } else if (token[0] !== 'space') {
  25476. break;
  25477. }
  25478. end++;
  25479. }
  25480. for (var index = 0; index < extendRuleKeyWordsCount; index++) {
  25481. if (stack[index] !== extendRuleKeyWords[index]) {
  25482. return null;
  25483. }
  25484. }
  25485. return tokens.slice(start, end);
  25486. }
  25487. module.exports = exports['default'];
  25488. /***/ }),
  25489. /* 167 */
  25490. /***/ (function(module, exports, __webpack_require__) {
  25491. "use strict";
  25492. Object.defineProperty(exports, "__esModule", {
  25493. value: true
  25494. });
  25495. exports.default = isMixinToken;
  25496. var _globals = __webpack_require__(2);
  25497. var unpaddedFractionalNumbersPattern = /\.[0-9]/;
  25498. function isMixinToken(token) {
  25499. var symbol = token[1];
  25500. var firstSymbolCode = symbol ? symbol[0].charCodeAt(0) : null;
  25501. return (firstSymbolCode === _globals.dot || firstSymbolCode === _globals.hash) && // ignore hashes used for colors
  25502. _globals.hashColorPattern.test(symbol) === false && // ignore dots used for unpadded fractional numbers
  25503. unpaddedFractionalNumbersPattern.test(symbol) === false;
  25504. }
  25505. module.exports = exports['default'];
  25506. /***/ }),
  25507. /* 168 */
  25508. /***/ (function(module, exports, __webpack_require__) {
  25509. "use strict";
  25510. Object.defineProperty(exports, "__esModule", {
  25511. value: true
  25512. });
  25513. exports.default = lessTokenize;
  25514. var _globals = __webpack_require__(2);
  25515. var _tokenizeSymbol = __webpack_require__(169);
  25516. var _tokenizeSymbol2 = _interopRequireDefault(_tokenizeSymbol);
  25517. function _interopRequireDefault(obj) {
  25518. return obj && obj.__esModule ? obj : {
  25519. default: obj
  25520. };
  25521. }
  25522. function lessTokenize(input) {
  25523. var state = {
  25524. input: input,
  25525. tokens: [],
  25526. css: input.css.valueOf(),
  25527. offset: -1,
  25528. line: 1,
  25529. pos: 0
  25530. };
  25531. state.length = state.css.length;
  25532. while (state.pos < state.length) {
  25533. state.symbolCode = state.css.charCodeAt(state.pos);
  25534. state.symbol = state.css[state.pos];
  25535. state.nextPos = null;
  25536. state.escaped = null;
  25537. state.lines = null;
  25538. state.lastLine = null;
  25539. state.cssPart = null;
  25540. state.escape = null;
  25541. state.nextLine = null;
  25542. state.nextOffset = null;
  25543. state.escapePos = null;
  25544. state.token = null;
  25545. if (state.symbolCode === _globals.newline) {
  25546. state.offset = state.pos;
  25547. state.line += 1;
  25548. }
  25549. (0, _tokenizeSymbol2.default)(state);
  25550. state.pos++;
  25551. }
  25552. return state.tokens;
  25553. }
  25554. module.exports = exports['default'];
  25555. /***/ }),
  25556. /* 169 */
  25557. /***/ (function(module, exports, __webpack_require__) {
  25558. "use strict";
  25559. Object.defineProperty(exports, "__esModule", {
  25560. value: true
  25561. });
  25562. exports.default = tokenizeSymbol;
  25563. var _globals = __webpack_require__(2);
  25564. var _tokenizeAtRule = __webpack_require__(170);
  25565. var _tokenizeAtRule2 = _interopRequireDefault(_tokenizeAtRule);
  25566. var _tokenizeBackslash = __webpack_require__(171);
  25567. var _tokenizeBackslash2 = _interopRequireDefault(_tokenizeBackslash);
  25568. var _tokenizeBasicSymbol = __webpack_require__(172);
  25569. var _tokenizeBasicSymbol2 = _interopRequireDefault(_tokenizeBasicSymbol);
  25570. var _tokenizeComma = __webpack_require__(173);
  25571. var _tokenizeComma2 = _interopRequireDefault(_tokenizeComma);
  25572. var _tokenizeDefault = __webpack_require__(174);
  25573. var _tokenizeDefault2 = _interopRequireDefault(_tokenizeDefault);
  25574. var _tokenizeOpenedParenthesis = __webpack_require__(179);
  25575. var _tokenizeOpenedParenthesis2 = _interopRequireDefault(_tokenizeOpenedParenthesis);
  25576. var _tokenizeQuotes = __webpack_require__(180);
  25577. var _tokenizeQuotes2 = _interopRequireDefault(_tokenizeQuotes);
  25578. var _tokenizeWhitespace = __webpack_require__(181);
  25579. var _tokenizeWhitespace2 = _interopRequireDefault(_tokenizeWhitespace);
  25580. function _interopRequireDefault(obj) {
  25581. return obj && obj.__esModule ? obj : {
  25582. default: obj
  25583. };
  25584. } // we cannot reduce complexity beyond this level
  25585. // eslint-disable-next-line complexity
  25586. function tokenizeSymbol(state) {
  25587. switch (state.symbolCode) {
  25588. case _globals.newline:
  25589. case _globals.space:
  25590. case _globals.tab:
  25591. case _globals.carriageReturn:
  25592. case _globals.feed:
  25593. (0, _tokenizeWhitespace2.default)(state);
  25594. break;
  25595. case _globals.comma:
  25596. (0, _tokenizeComma2.default)(state);
  25597. break;
  25598. case _globals.colon:
  25599. case _globals.semicolon:
  25600. case _globals.openedCurlyBracket:
  25601. case _globals.closedCurlyBracket:
  25602. case _globals.closedParenthesis:
  25603. case _globals.openSquareBracket:
  25604. case _globals.closeSquareBracket:
  25605. (0, _tokenizeBasicSymbol2.default)(state);
  25606. break;
  25607. case _globals.openedParenthesis:
  25608. (0, _tokenizeOpenedParenthesis2.default)(state);
  25609. break;
  25610. case _globals.singleQuote:
  25611. case _globals.doubleQuote:
  25612. (0, _tokenizeQuotes2.default)(state);
  25613. break;
  25614. case _globals.atRule:
  25615. (0, _tokenizeAtRule2.default)(state);
  25616. break;
  25617. case _globals.backslash:
  25618. (0, _tokenizeBackslash2.default)(state);
  25619. break;
  25620. default:
  25621. (0, _tokenizeDefault2.default)(state);
  25622. break;
  25623. }
  25624. }
  25625. module.exports = exports['default'];
  25626. /***/ }),
  25627. /* 170 */
  25628. /***/ (function(module, exports, __webpack_require__) {
  25629. "use strict";
  25630. Object.defineProperty(exports, "__esModule", {
  25631. value: true
  25632. });
  25633. exports.default = tokenizeAtRule;
  25634. var _globals = __webpack_require__(2);
  25635. var _unclosed = __webpack_require__(11);
  25636. var _unclosed2 = _interopRequireDefault(_unclosed);
  25637. function _interopRequireDefault(obj) {
  25638. return obj && obj.__esModule ? obj : {
  25639. default: obj
  25640. };
  25641. }
  25642. function tokenizeAtRule(state) {
  25643. // it's an interpolation
  25644. if (state.css.charCodeAt(state.pos + 1) === _globals.openedCurlyBracket) {
  25645. state.nextPos = state.css.indexOf('}', state.pos + 2);
  25646. if (state.nextPos === -1) {
  25647. (0, _unclosed2.default)(state, 'interpolation');
  25648. }
  25649. state.cssPart = state.css.slice(state.pos, state.nextPos + 1);
  25650. state.lines = state.cssPart.split('\n');
  25651. state.lastLine = state.lines.length - 1;
  25652. if (state.lastLine > 0) {
  25653. state.nextLine = state.line + state.lastLine;
  25654. state.nextOffset = state.nextPos - state.lines[state.lastLine].length;
  25655. } else {
  25656. state.nextLine = state.line;
  25657. state.nextOffset = state.offset;
  25658. }
  25659. state.tokens.push(['word', state.cssPart, state.line, state.pos - state.offset, state.nextLine, state.nextPos - state.nextOffset]);
  25660. state.offset = state.nextOffset;
  25661. state.line = state.nextLine;
  25662. } else {
  25663. _globals.atEndPattern.lastIndex = state.pos + 1;
  25664. _globals.atEndPattern.test(state.css);
  25665. if (_globals.atEndPattern.lastIndex === 0) {
  25666. state.nextPos = state.css.length - 1;
  25667. } else {
  25668. state.nextPos = _globals.atEndPattern.lastIndex - 2;
  25669. }
  25670. state.cssPart = state.css.slice(state.pos, state.nextPos + 1);
  25671. state.token = 'at-word'; // check if it's a variable
  25672. if (_globals.variablePattern.test(state.cssPart)) {
  25673. _globals.wordEndPattern.lastIndex = state.pos + 1;
  25674. _globals.wordEndPattern.test(state.css);
  25675. if (_globals.wordEndPattern.lastIndex === 0) {
  25676. state.nextPos = state.css.length - 1;
  25677. } else {
  25678. state.nextPos = _globals.wordEndPattern.lastIndex - 2;
  25679. }
  25680. state.cssPart = state.css.slice(state.pos, state.nextPos + 1);
  25681. state.token = 'word';
  25682. }
  25683. state.tokens.push([state.token, state.cssPart, state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);
  25684. }
  25685. state.pos = state.nextPos;
  25686. }
  25687. module.exports = exports['default'];
  25688. /***/ }),
  25689. /* 171 */
  25690. /***/ (function(module, exports, __webpack_require__) {
  25691. "use strict";
  25692. Object.defineProperty(exports, "__esModule", {
  25693. value: true
  25694. });
  25695. exports.default = tokenizeBackslash;
  25696. var _globals = __webpack_require__(2);
  25697. function tokenizeBackslash(state) {
  25698. state.nextPos = state.pos;
  25699. state.escape = true;
  25700. while (state.css.charCodeAt(state.nextPos + 1) === _globals.backslash) {
  25701. state.nextPos += 1;
  25702. state.escape = !state.escape;
  25703. }
  25704. state.symbolCode = state.css.charCodeAt(state.nextPos + 1);
  25705. if (state.escape && state.symbolCode !== _globals.slash && state.symbolCode !== _globals.space && state.symbolCode !== _globals.newline && state.symbolCode !== _globals.tab && state.symbolCode !== _globals.carriageReturn && state.symbolCode !== _globals.feed) {
  25706. state.nextPos += 1;
  25707. }
  25708. state.tokens.push(['word', state.css.slice(state.pos, state.nextPos + 1), state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);
  25709. state.pos = state.nextPos;
  25710. }
  25711. module.exports = exports['default'];
  25712. /***/ }),
  25713. /* 172 */
  25714. /***/ (function(module, exports, __webpack_require__) {
  25715. "use strict";
  25716. Object.defineProperty(exports, "__esModule", {
  25717. value: true
  25718. });
  25719. exports.default = tokenizeBasicSymbol;
  25720. function tokenizeBasicSymbol(state) {
  25721. state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);
  25722. }
  25723. module.exports = exports["default"];
  25724. /***/ }),
  25725. /* 173 */
  25726. /***/ (function(module, exports, __webpack_require__) {
  25727. "use strict";
  25728. Object.defineProperty(exports, "__esModule", {
  25729. value: true
  25730. });
  25731. exports.default = tokenizeComma;
  25732. function tokenizeComma(state) {
  25733. state.tokens.push(['word', state.symbol, state.line, state.pos - state.offset, state.line, state.pos - state.offset + 1]);
  25734. }
  25735. module.exports = exports['default'];
  25736. /***/ }),
  25737. /* 174 */
  25738. /***/ (function(module, exports, __webpack_require__) {
  25739. "use strict";
  25740. Object.defineProperty(exports, "__esModule", {
  25741. value: true
  25742. });
  25743. exports.default = tokenizeDefault;
  25744. var _globals = __webpack_require__(2);
  25745. var _findEndOfEscaping = __webpack_require__(175);
  25746. var _findEndOfEscaping2 = _interopRequireDefault(_findEndOfEscaping);
  25747. var _isEscaping = __webpack_require__(176);
  25748. var _isEscaping2 = _interopRequireDefault(_isEscaping);
  25749. var _tokenizeInlineComment = __webpack_require__(177);
  25750. var _tokenizeInlineComment2 = _interopRequireDefault(_tokenizeInlineComment);
  25751. var _tokenizeMultilineComment = __webpack_require__(178);
  25752. var _tokenizeMultilineComment2 = _interopRequireDefault(_tokenizeMultilineComment);
  25753. var _unclosed = __webpack_require__(11);
  25754. var _unclosed2 = _interopRequireDefault(_unclosed);
  25755. function _interopRequireDefault(obj) {
  25756. return obj && obj.__esModule ? obj : {
  25757. default: obj
  25758. };
  25759. }
  25760. function tokenizeDefault(state) {
  25761. var nextSymbolCode = state.css.charCodeAt(state.pos + 1);
  25762. if (state.symbolCode === _globals.slash && nextSymbolCode === _globals.asterisk) {
  25763. (0, _tokenizeMultilineComment2.default)(state);
  25764. } else if (state.symbolCode === _globals.slash && nextSymbolCode === _globals.slash) {
  25765. (0, _tokenizeInlineComment2.default)(state);
  25766. } else {
  25767. if ((0, _isEscaping2.default)(state)) {
  25768. var pos = (0, _findEndOfEscaping2.default)(state);
  25769. if (pos < 0) {
  25770. (0, _unclosed2.default)(state, 'escaping');
  25771. } else {
  25772. state.nextPos = pos;
  25773. }
  25774. } else {
  25775. _globals.wordEndPattern.lastIndex = state.pos + 1;
  25776. _globals.wordEndPattern.test(state.css);
  25777. if (_globals.wordEndPattern.lastIndex === 0) {
  25778. state.nextPos = state.css.length - 1;
  25779. } else {
  25780. state.nextPos = _globals.wordEndPattern.lastIndex - 2;
  25781. }
  25782. }
  25783. state.cssPart = state.css.slice(state.pos, state.nextPos + 1);
  25784. state.tokens.push(['word', state.cssPart, state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);
  25785. state.pos = state.nextPos;
  25786. }
  25787. }
  25788. module.exports = exports['default'];
  25789. /***/ }),
  25790. /* 175 */
  25791. /***/ (function(module, exports, __webpack_require__) {
  25792. "use strict";
  25793. Object.defineProperty(exports, "__esModule", {
  25794. value: true
  25795. });
  25796. exports.default = findEndOfEscaping;
  25797. var _globals = __webpack_require__(2);
  25798. /**
  25799. * @param state
  25800. * @returns {number}
  25801. */
  25802. function findEndOfEscaping(state) {
  25803. var openQuotesCount = 0,
  25804. quoteCode = -1;
  25805. for (var i = state.pos + 1; i < state.length; i++) {
  25806. var symbolCode = state.css.charCodeAt(i);
  25807. var prevSymbolCode = state.css.charCodeAt(i - 1);
  25808. if (prevSymbolCode !== _globals.backslash && (symbolCode === _globals.singleQuote || symbolCode === _globals.doubleQuote || symbolCode === _globals.backTick)) {
  25809. if (quoteCode === -1) {
  25810. quoteCode = symbolCode;
  25811. openQuotesCount++;
  25812. } else if (symbolCode === quoteCode) {
  25813. openQuotesCount--;
  25814. if (!openQuotesCount) {
  25815. return i;
  25816. }
  25817. }
  25818. }
  25819. }
  25820. return -1;
  25821. }
  25822. module.exports = exports['default'];
  25823. /***/ }),
  25824. /* 176 */
  25825. /***/ (function(module, exports, __webpack_require__) {
  25826. "use strict";
  25827. Object.defineProperty(exports, "__esModule", {
  25828. value: true
  25829. });
  25830. exports.default = isEscaping;
  25831. var _globals = __webpack_require__(2);
  25832. var nextSymbolVariants = [_globals.backTick, _globals.doubleQuote, _globals.singleQuote];
  25833. function isEscaping(state) {
  25834. var nextSymbolCode = state.css.charCodeAt(state.pos + 1);
  25835. return state.symbolCode === _globals.tilde && nextSymbolVariants.indexOf(nextSymbolCode) >= 0;
  25836. }
  25837. module.exports = exports['default'];
  25838. /***/ }),
  25839. /* 177 */
  25840. /***/ (function(module, exports, __webpack_require__) {
  25841. "use strict";
  25842. Object.defineProperty(exports, "__esModule", {
  25843. value: true
  25844. });
  25845. exports.default = tokenizeInlineComment;
  25846. function tokenizeInlineComment(state) {
  25847. state.nextPos = state.css.indexOf('\n', state.pos + 2) - 1;
  25848. if (state.nextPos === -2) {
  25849. state.nextPos = state.css.length - 1;
  25850. }
  25851. state.tokens.push(['comment', state.css.slice(state.pos, state.nextPos + 1), state.line, state.pos - state.offset, state.line, state.nextPos - state.offset, 'inline']);
  25852. state.pos = state.nextPos;
  25853. }
  25854. module.exports = exports['default'];
  25855. /***/ }),
  25856. /* 178 */
  25857. /***/ (function(module, exports, __webpack_require__) {
  25858. "use strict";
  25859. Object.defineProperty(exports, "__esModule", {
  25860. value: true
  25861. });
  25862. exports.default = tokenizeMultilineComment;
  25863. var _unclosed = __webpack_require__(11);
  25864. var _unclosed2 = _interopRequireDefault(_unclosed);
  25865. function _interopRequireDefault(obj) {
  25866. return obj && obj.__esModule ? obj : {
  25867. default: obj
  25868. };
  25869. }
  25870. function tokenizeMultilineComment(state) {
  25871. state.nextPos = state.css.indexOf('*/', state.pos + 2) + 1;
  25872. if (state.nextPos === 0) {
  25873. (0, _unclosed2.default)(state, 'comment');
  25874. }
  25875. state.cssPart = state.css.slice(state.pos, state.nextPos + 1);
  25876. state.lines = state.cssPart.split('\n');
  25877. state.lastLine = state.lines.length - 1;
  25878. if (state.lastLine > 0) {
  25879. state.nextLine = state.line + state.lastLine;
  25880. state.nextOffset = state.nextPos - state.lines[state.lastLine].length;
  25881. } else {
  25882. state.nextLine = state.line;
  25883. state.nextOffset = state.offset;
  25884. }
  25885. state.tokens.push(['comment', state.cssPart, state.line, state.pos - state.offset, state.nextLine, state.nextPos - state.nextOffset]);
  25886. state.offset = state.nextOffset;
  25887. state.line = state.nextLine;
  25888. state.pos = state.nextPos;
  25889. }
  25890. module.exports = exports['default'];
  25891. /***/ }),
  25892. /* 179 */
  25893. /***/ (function(module, exports, __webpack_require__) {
  25894. "use strict";
  25895. Object.defineProperty(exports, "__esModule", {
  25896. value: true
  25897. });
  25898. exports.default = tokenizeOpenedParenthesis;
  25899. var _globals = __webpack_require__(2);
  25900. var _unclosed = __webpack_require__(11);
  25901. var _unclosed2 = _interopRequireDefault(_unclosed);
  25902. function _interopRequireDefault(obj) {
  25903. return obj && obj.__esModule ? obj : {
  25904. default: obj
  25905. };
  25906. }
  25907. function findClosedParenthesisPosition(css, length, start) {
  25908. var openedParenthesisCount = 0;
  25909. for (var i = start; i < length; i++) {
  25910. var symbol = css[i];
  25911. if (symbol === '(') {
  25912. openedParenthesisCount++;
  25913. } else if (symbol === ')') {
  25914. openedParenthesisCount--;
  25915. if (!openedParenthesisCount) {
  25916. return i;
  25917. }
  25918. }
  25919. }
  25920. return -1;
  25921. } // it is not very reasonable to reduce complexity beyond this level
  25922. // eslint-disable-next-line complexity
  25923. function tokenizeOpenedParenthesis(state) {
  25924. var nextSymbolCode = state.css.charCodeAt(state.pos + 1);
  25925. var tokensCount = state.tokens.length;
  25926. var prevTokenCssPart = tokensCount ? state.tokens[tokensCount - 1][1] : '';
  25927. if (prevTokenCssPart === 'url' && nextSymbolCode !== _globals.singleQuote && nextSymbolCode !== _globals.doubleQuote && nextSymbolCode !== _globals.space && nextSymbolCode !== _globals.newline && nextSymbolCode !== _globals.tab && nextSymbolCode !== _globals.feed && nextSymbolCode !== _globals.carriageReturn) {
  25928. state.nextPos = state.pos;
  25929. do {
  25930. state.escaped = false;
  25931. state.nextPos = state.css.indexOf(')', state.nextPos + 1);
  25932. if (state.nextPos === -1) {
  25933. (0, _unclosed2.default)(state, 'bracket');
  25934. }
  25935. state.escapePos = state.nextPos;
  25936. while (state.css.charCodeAt(state.escapePos - 1) === _globals.backslash) {
  25937. state.escapePos -= 1;
  25938. state.escaped = !state.escaped;
  25939. }
  25940. } while (state.escaped);
  25941. state.tokens.push(['brackets', state.css.slice(state.pos, state.nextPos + 1), state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);
  25942. state.pos = state.nextPos;
  25943. } else {
  25944. state.nextPos = findClosedParenthesisPosition(state.css, state.length, state.pos);
  25945. state.cssPart = state.css.slice(state.pos, state.nextPos + 1);
  25946. var foundParam = state.cssPart.indexOf('@') >= 0;
  25947. var foundString = /['"]/.test(state.cssPart);
  25948. if (state.cssPart.length === 0 || state.cssPart === '...' || foundParam && !foundString) {
  25949. // we're dealing with a mixin param block
  25950. if (state.nextPos === -1) {
  25951. (0, _unclosed2.default)(state, 'bracket');
  25952. }
  25953. state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);
  25954. } else {
  25955. var badBracket = _globals.badBracketPattern.test(state.cssPart);
  25956. if (state.nextPos === -1 || badBracket) {
  25957. state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);
  25958. } else {
  25959. state.tokens.push(['brackets', state.cssPart, state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);
  25960. state.pos = state.nextPos;
  25961. }
  25962. }
  25963. }
  25964. }
  25965. module.exports = exports['default'];
  25966. /***/ }),
  25967. /* 180 */
  25968. /***/ (function(module, exports, __webpack_require__) {
  25969. "use strict";
  25970. Object.defineProperty(exports, "__esModule", {
  25971. value: true
  25972. });
  25973. exports.default = tokenizeQuotes;
  25974. var _globals = __webpack_require__(2);
  25975. var _unclosed = __webpack_require__(11);
  25976. var _unclosed2 = _interopRequireDefault(_unclosed);
  25977. function _interopRequireDefault(obj) {
  25978. return obj && obj.__esModule ? obj : {
  25979. default: obj
  25980. };
  25981. }
  25982. function tokenizeQuotes(state) {
  25983. state.nextPos = state.pos;
  25984. do {
  25985. state.escaped = false;
  25986. state.nextPos = state.css.indexOf(state.symbol, state.nextPos + 1);
  25987. if (state.nextPos === -1) {
  25988. (0, _unclosed2.default)(state, 'quote');
  25989. }
  25990. state.escapePos = state.nextPos;
  25991. while (state.css.charCodeAt(state.escapePos - 1) === _globals.backslash) {
  25992. state.escapePos -= 1;
  25993. state.escaped = !state.escaped;
  25994. }
  25995. } while (state.escaped);
  25996. state.tokens.push(['string', state.css.slice(state.pos, state.nextPos + 1), state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);
  25997. state.pos = state.nextPos;
  25998. }
  25999. module.exports = exports['default'];
  26000. /***/ }),
  26001. /* 181 */
  26002. /***/ (function(module, exports, __webpack_require__) {
  26003. "use strict";
  26004. Object.defineProperty(exports, "__esModule", {
  26005. value: true
  26006. });
  26007. exports.default = tokenizeWhitespace;
  26008. var _globals = __webpack_require__(2);
  26009. function tokenizeWhitespace(state) {
  26010. state.nextPos = state.pos; // collect all neighbour space symbols
  26011. do {
  26012. state.nextPos += 1;
  26013. state.symbolCode = state.css.charCodeAt(state.nextPos);
  26014. if (state.symbolCode === _globals.newline) {
  26015. state.offset = state.nextPos;
  26016. state.line += 1;
  26017. }
  26018. } while (state.symbolCode === _globals.space || state.symbolCode === _globals.newline || state.symbolCode === _globals.tab || state.symbolCode === _globals.carriageReturn || state.symbolCode === _globals.feed);
  26019. state.tokens.push(['space', state.css.slice(state.pos, state.nextPos)]);
  26020. state.pos = state.nextPos - 1;
  26021. }
  26022. module.exports = exports['default'];
  26023. /***/ }),
  26024. /* 182 */
  26025. /***/ (function(module, exports, __webpack_require__) {
  26026. "use strict";
  26027. Object.defineProperty(exports, "__esModule", {
  26028. value: true
  26029. });
  26030. var _lessParse = __webpack_require__(183);
  26031. var _lessParse2 = _interopRequireDefault(_lessParse);
  26032. var _lessStringify = __webpack_require__(14);
  26033. var _lessStringify2 = _interopRequireDefault(_lessStringify);
  26034. function _interopRequireDefault(obj) {
  26035. return obj && obj.__esModule ? obj : {
  26036. default: obj
  26037. };
  26038. }
  26039. exports.default = {
  26040. parse: _lessParse2.default,
  26041. stringify: _lessStringify2.default
  26042. };
  26043. module.exports = exports['default'];
  26044. /***/ }),
  26045. /* 183 */
  26046. /***/ (function(module, exports, __webpack_require__) {
  26047. "use strict";
  26048. Object.defineProperty(exports, "__esModule", {
  26049. value: true
  26050. });
  26051. exports.default = lessParse;
  26052. var _input = __webpack_require__(23);
  26053. var _input2 = _interopRequireDefault(_input);
  26054. var _lessParser = __webpack_require__(72);
  26055. var _lessParser2 = _interopRequireDefault(_lessParser);
  26056. function _interopRequireDefault(obj) {
  26057. return obj && obj.__esModule ? obj : {
  26058. default: obj
  26059. };
  26060. }
  26061. function lessParse(less, opts) {
  26062. var input = new _input2.default(less, opts);
  26063. var parser = new _lessParser2.default(input, opts); // const parser = new Parser(input, opts);
  26064. parser.tokenize();
  26065. parser.loop();
  26066. return parser.root;
  26067. } // import Parser from 'postcss/lib/parser';
  26068. module.exports = exports['default'];
  26069. /***/ })
  26070. /******/ ]);
  26071. });