data.js 149 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author sheo13666q @sheo13666q
  4. */
  5. // GENERATED by tooling/generate-css-data.js — do not edit.
  6. // Sources: mdn-data 2.33.0, color-name 2.1.1, @mdn/browser-compat-data 8.0.12.
  7. "use strict";
  8. /** @typedef {(sums: Map<string, number>[]) => [string, number[]] | null} MathArgumentReader */
  9. /** @typedef {(values: number[], strategy: string, table: Map<number, number> | null) => number | null} MathOperation */
  10. // The arithmetic the math-function descriptors at the end of this file bind to.
  11. // It knows nothing of CSS beyond the shape of an evaluated argument, and names
  12. // no math function: which one uses which is the descriptors' business, and
  13. // `lib/css/syntax.js` only drives the binding.
  14. /**
  15. * Add two doubles, or decline when the sum carries rounding of its own.
  16. * @param {number} a one term
  17. * @param {number} b the other
  18. * @returns {number | null} their exact sum, or `null`
  19. */
  20. const exactAdd = (a, b) => {
  21. const sum = a + b;
  22. return sum - b === a && sum - a === b ? sum : null;
  23. };
  24. /**
  25. * Multiply, or decline, on the same terms.
  26. * @param {number} a the value
  27. * @param {number} k the factor
  28. * @returns {number | null} their exact product, or `null`
  29. */
  30. const exactMultiply = (a, k) => {
  31. const product = a * k;
  32. if (!Number.isFinite(product)) return null;
  33. if (a === 0 || k === 0) return product;
  34. return product / k === a ? product : null;
  35. };
  36. /**
  37. * Divide, or decline, on the same terms.
  38. * @param {number} a the value
  39. * @param {number} k the divisor
  40. * @returns {number | null} their exact quotient, or `null`
  41. */
  42. const exactDivide = (a, k) => {
  43. if (k === 0) return null;
  44. const quotient = a / k;
  45. if (!Number.isFinite(quotient)) return null;
  46. return quotient * k === a ? quotient : null;
  47. };
  48. /**
  49. * `floor(value / step)` for a positive step, checked against the step exactly.
  50. * The double quotient can land an ulp either side of an integer, which would put
  51. * the multiple a whole step out, so the candidate is verified by multiplying
  52. * back and nudged at most once either way.
  53. * @param {number} value the dividend
  54. * @param {number} step the divisor, greater than zero
  55. * @returns {number | null} the floor, or `null` when it cannot be pinned down
  56. */
  57. const exactFloorDivide = (value, step) => {
  58. let n = Math.floor(value / step);
  59. if (!Number.isFinite(n)) return null;
  60. for (let attempt = 0; attempt < 3; attempt++) {
  61. const at = exactMultiply(n, step);
  62. const next = exactMultiply(n + 1, step);
  63. if (at === null || next === null) return null;
  64. if (at > value) {
  65. n--;
  66. continue;
  67. }
  68. if (next <= value) {
  69. n++;
  70. continue;
  71. }
  72. return n;
  73. }
  74. return null;
  75. };
  76. /**
  77. * The square root of a value, where it is one that can be written down. IEEE-754
  78. * makes `Math.sqrt` correctly rounded, so squaring the result back is a complete
  79. * test — and it fails for every irrational root, which is most of them.
  80. * @param {number} value the radicand
  81. * @returns {number | null} the root, or `null`
  82. */
  83. const exactSquareRoot = (value) => {
  84. if (!(value >= 0)) return null;
  85. const root = Math.sqrt(value);
  86. const back = exactMultiply(root, root);
  87. return back === null || back !== value ? null : root;
  88. };
  89. // Beyond this an integer exponent is not worth multiplying out, and every result
  90. // overflows a double for all but a base within an ulp of 1.
  91. const POWER_LIMIT = 64;
  92. /**
  93. * `base ** exponent` for a whole exponent, by multiplying out. Every step is
  94. * checked, so the result is the one an engine computing in doubles gets — which
  95. * `Math.pow` is not required to be for a general exponent.
  96. * @param {number} base the base
  97. * @param {number} exponent a whole exponent
  98. * @returns {number | null} the power, or `null`
  99. */
  100. const exactIntegerPower = (base, exponent) => {
  101. if (!Number.isInteger(exponent) || Math.abs(exponent) > POWER_LIMIT) {
  102. return null;
  103. }
  104. let power = 1;
  105. for (let n = Math.abs(exponent); n > 0; n--) {
  106. const next = exactMultiply(power, base);
  107. if (next === null) return null;
  108. power = next;
  109. }
  110. return exponent < 0 ? exactDivide(1, power) : power;
  111. };
  112. /**
  113. * One evaluated argument list, read as a shared unit and its coefficients. A
  114. * percentage is refused: its basis can be negative (a `background-position`
  115. * against an image wider than its box), and comparing two of them depends on
  116. * that sign in a way `calc()`'s arithmetic does not — scaling a percentage is
  117. * linear, picking the smaller of two is not.
  118. * @param {Map<string, number>[]} sums the evaluated arguments
  119. * @returns {[string, number[]] | null} the shared unit and the coefficients
  120. */
  121. const readSameUnit = (sums) => {
  122. /** @type {string | null} */
  123. let shared = null;
  124. /** @type {number[]} */
  125. const values = [];
  126. for (const sum of sums) {
  127. if (sum.size !== 1) return null;
  128. const [[key, coefficient]] = sum;
  129. if (key === "%") return null;
  130. if (shared === null) shared = key;
  131. else if (shared !== key) return null;
  132. values.push(coefficient);
  133. }
  134. return shared === null ? null : [shared, values];
  135. };
  136. /**
  137. * The same, narrowed to arguments that reduced to a plain `<number>`.
  138. * @param {Map<string, number>[]} sums the evaluated arguments
  139. * @returns {[string, number[]] | null} the unit (always `""`) and the numbers
  140. */
  141. const readNumber = (sums) => {
  142. const shared = readSameUnit(sums);
  143. return shared === null || shared[0] !== "" ? null : shared;
  144. };
  145. /**
  146. * A reader answering which eighth turn a single angle argument is, as the one
  147. * "coefficient" — a lookup key rather than a magnitude, which `lookup` takes. A
  148. * plain number is an angle in radians, where only zero lands on a whole one.
  149. * @param {Map<string, number>} quarterTurnAngle a quarter turn in each unit that spells one exactly
  150. * @returns {(sums: Map<string, number>[]) => [string, number[]] | null} the reader
  151. */
  152. const eighthTurnReader = (quarterTurnAngle) => (sums) => {
  153. const shared = readSameUnit(sums);
  154. if (shared === null) return null;
  155. const [unit, [angle]] = shared;
  156. if (unit === "") return angle === 0 ? ["", [0]] : null;
  157. const quarter = quarterTurnAngle.get(unit);
  158. if (quarter === undefined) return null;
  159. // Halving a quarter turn is exact in each unit that spells one: 45, 50 and an
  160. // eighth, which is a power of two.
  161. const eighths = exactDivide(angle, quarter / 2);
  162. if (eighths === null || !Number.isInteger(eighths)) return null;
  163. return ["", [((eighths % 8) + 8) % 8]];
  164. };
  165. /**
  166. * @param {number[]} values the coefficients
  167. * @returns {number} the smallest
  168. */
  169. const minimum = (values) => Math.min(...values);
  170. /**
  171. * @param {number[]} values the coefficients
  172. * @returns {number} the largest
  173. */
  174. const maximum = (values) => Math.max(...values);
  175. /**
  176. * CSS Values 4 §10.4: the lower bound wins a contradictory pair.
  177. * @param {number[]} values the lower bound, the value and the upper bound
  178. * @returns {number} the value held between them
  179. */
  180. const clamp = ([lower, value, upper]) =>
  181. Math.max(lower, Math.min(value, upper));
  182. /**
  183. * @param {number[]} values the one coefficient
  184. * @returns {number} its magnitude
  185. */
  186. const absolute = ([value]) => Math.abs(value);
  187. /**
  188. * The one operation whose answer changes unit: a sign is a `<number>`. Every
  189. * unit reaching here scales by a positive factor, so the coefficient's sign is
  190. * the value's even where the factor is not known.
  191. * @param {number[]} values the one coefficient
  192. * @returns {number} its sign
  193. */
  194. const sign = ([value]) => Math.sign(value);
  195. /**
  196. * @param {number[]} values the coefficients
  197. * @returns {number | null} the root of their sum of squares, or `null`
  198. */
  199. const hypotenuse = (values) => {
  200. let total = 0;
  201. for (const value of values) {
  202. const square = exactMultiply(value, value);
  203. if (square === null) return null;
  204. const sum = exactAdd(total, square);
  205. if (sum === null) return null;
  206. total = sum;
  207. }
  208. return exactSquareRoot(total);
  209. };
  210. /**
  211. * The multiple of `step` that `strategy` rounds `value` to, as CSS Values 4
  212. * §10.6 defines them and headless Chromium confirms: `nearest` breaks a tie
  213. * toward positive infinity, and the other three are the ceiling, the floor and
  214. * the truncation. A step of zero is NaN per the spec and engines do not agree
  215. * on what that renders as; a negative one is left alone rather than reasoned
  216. * about.
  217. * @param {number[]} values the value and the step
  218. * @param {string} strategy one of the grammar's rounding strategies
  219. * @returns {number | null} the rounded multiple, or `null`
  220. */
  221. const round = ([value, step], strategy) => {
  222. if (!(step > 0)) return null;
  223. const below = exactFloorDivide(value, step);
  224. if (below === null) return null;
  225. const at = /** @type {number} */ (exactMultiply(below, step));
  226. // Exactly on a step is where engines stop agreeing: these are step functions,
  227. // so an ulp of error in the engine's own conversion moves the answer a whole
  228. // step. Headless Chromium reads `round(down,10cm,2cm)` as `8cm` and
  229. // `round(down,-7cm,.5cm)` as `-7.5cm`. Away from a boundary the gap is orders
  230. // of magnitude wider than any such error, so only the boundary is refused.
  231. if (at === value) return null;
  232. let multiple;
  233. if (strategy === "down") {
  234. multiple = below;
  235. } else if (strategy === "up") {
  236. multiple = below + 1;
  237. } else if (strategy === "to-zero") {
  238. multiple = value < 0 ? below + 1 : below;
  239. } else {
  240. // The remainder is in `[0, step)`, so twice it against the step is the
  241. // comparison, and an exact half rounds up — toward positive infinity.
  242. const remainder = exactAdd(value, -at);
  243. if (remainder === null) return null;
  244. const doubled = exactMultiply(remainder, 2);
  245. if (doubled === null) return null;
  246. multiple = doubled >= step ? below + 1 : below;
  247. }
  248. return exactMultiply(multiple, step);
  249. };
  250. /**
  251. * The remainder carrying the divisor's sign.
  252. * @param {number[]} values the dividend and the divisor
  253. * @returns {number | null} the remainder, or `null`
  254. */
  255. const modulus = ([value, divisor]) => {
  256. if (divisor === 0) return null;
  257. const remainder = value % divisor;
  258. // A zero remainder is the boundary these two share with `round()`, and engines
  259. // do not agree on it: headless Chromium reads `mod(10px,-2px)` and
  260. // `mod(-9px,3px)` as the divisor where both are zero.
  261. if (remainder === 0) return null;
  262. // A remainder on the other side of zero is brought back across it.
  263. return remainder < 0 === divisor < 0
  264. ? remainder
  265. : exactAdd(remainder, divisor);
  266. };
  267. /**
  268. * The remainder carrying the dividend's sign, which is what `%` already does.
  269. * @param {number[]} values the dividend and the divisor
  270. * @returns {number | null} the remainder, or `null`
  271. */
  272. const remainder = ([value, divisor]) => {
  273. if (divisor === 0) return null;
  274. // The same zero boundary `modulus` declines.
  275. const rest = value % divisor;
  276. return rest === 0 ? null : rest;
  277. };
  278. /**
  279. * @param {number[]} values the one radicand
  280. * @returns {number | null} its root, or `null`
  281. */
  282. const squareRoot = ([value]) => exactSquareRoot(value);
  283. /**
  284. * @param {number[]} values the base and the exponent
  285. * @returns {number | null} the power, or `null`
  286. */
  287. const power = ([base, exponent]) => exactIntegerPower(base, exponent);
  288. /**
  289. * A logarithm is transcendental except where it lands on a whole power of its
  290. * base, so the candidate is raised back and only an exact match is taken. The
  291. * natural logarithm's base is not a double at all, which leaves only `log(1)`.
  292. * @param {number[]} values the value and, optionally, the base
  293. * @returns {number | null} the logarithm, or `null`
  294. */
  295. const logarithm = ([value, base]) => {
  296. if (base === undefined) return value === 1 ? 0 : null;
  297. const exponent = Math.round(Math.log(value) / Math.log(base));
  298. const back = exactIntegerPower(base, exponent);
  299. return back === null || back !== value ? null : exponent;
  300. };
  301. /**
  302. * `e` is not a double, so every other power of it is a number this cannot write
  303. * down and an engine's math library rounds its own way.
  304. * @param {number[]} values the one exponent
  305. * @returns {number | null} the power of `e`, or `null`
  306. */
  307. const exponential = ([value]) => (value === 0 ? 1 : null);
  308. /**
  309. * Read the answer out of the table the descriptor carries. Absent means the
  310. * value is one no stylesheet can hold, so the call stays written out.
  311. * @param {number[]} values the one lookup key
  312. * @param {string} _strategy unused
  313. * @param {Map<number, number> | null} table the descriptor's table
  314. * @returns {number | null} the answer, or `null`
  315. */
  316. const lookup = ([key], _strategy, table) => {
  317. const value = /** @type {Map<number, number>} */ (table).get(key);
  318. return value === undefined ? null : value;
  319. };
  320. /**
  321. * The eight directions the arc tangent of a ratio is a whole number of degrees
  322. * in, an eighth turn apart. Both zero is refused: the spec leaves it to the
  323. * engine.
  324. * @param {number[]} values the two coordinates
  325. * @returns {number | null} the angle in degrees, or `null`
  326. */
  327. const arcTangent2 = ([y, x]) => {
  328. if (y === 0 && x === 0) return null;
  329. if (y === 0) return x > 0 ? 0 : 180;
  330. if (x === 0) return y > 0 ? 90 : -90;
  331. if (Math.abs(y) !== Math.abs(x)) return null;
  332. if (x > 0) return y > 0 ? 45 : -45;
  333. return y > 0 ? 135 : -135;
  334. };
  335. // Properties whose value is CSS's `{1,4}` box notation, where an omitted value
  336. // is copied from the opposite side. That makes a repeated value redundant:
  337. // `margin:1px 1px 1px 1px` is `margin:1px`. `border-radius` collapses each side
  338. // of its `/` independently.
  339. const BOX_SHORTHANDS = new Set([
  340. "border-color",
  341. "border-image-outset",
  342. "border-image-width",
  343. "border-radius",
  344. "border-style",
  345. "border-width",
  346. "corner-shape",
  347. "inset",
  348. "margin",
  349. "mask-border-outset",
  350. "mask-border-width",
  351. "padding",
  352. "scroll-margin",
  353. "scroll-padding"
  354. ]);
  355. // The subset carrying a second box after a `/`, which collapses on its own.
  356. const SLASH_BOX_SHORTHANDS = new Set(["border-radius"]);
  357. // The four longhands each box shorthand sets, in the order `{1,4}` writes them:
  358. // `top right bottom left`, or clockwise from the top left for a corner family.
  359. // Only the families whose longhands are those four: merging those into the
  360. // shorthand sets exactly the same properties, resetting nothing extra.
  361. // prettier-ignore
  362. const BOX_LONGHANDS = new Map([
  363. ["border-color", ["border-top-color", "border-right-color", "border-bottom-color", "border-left-color"]],
  364. ["border-radius", ["border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius"]],
  365. ["border-style", ["border-top-style", "border-right-style", "border-bottom-style", "border-left-style"]],
  366. ["border-width", ["border-top-width", "border-right-width", "border-bottom-width", "border-left-width"]],
  367. ["corner-shape", ["corner-top-left-shape", "corner-top-right-shape", "corner-bottom-right-shape", "corner-bottom-left-shape"]],
  368. ["inset", ["top", "right", "bottom", "left"]],
  369. ["margin", ["margin-top", "margin-right", "margin-bottom", "margin-left"]],
  370. ["padding", ["padding-top", "padding-right", "padding-bottom", "padding-left"]],
  371. ["scroll-margin", ["scroll-margin-top", "scroll-margin-right", "scroll-margin-bottom", "scroll-margin-left"]],
  372. ["scroll-padding", ["scroll-padding-top", "scroll-padding-right", "scroll-padding-bottom", "scroll-padding-left"]]
  373. ]);
  374. // The shorthands setting exactly two longhands, positionally — the same merge
  375. // as the box families, two values wide. Only these: a shorthand gathering a
  376. // whole family resets longhands `computed` does not name.
  377. const PAIR_LONGHANDS = new Map([
  378. [
  379. "border-block-color",
  380. ["border-block-start-color", "border-block-end-color"]
  381. ],
  382. [
  383. "border-block-style",
  384. ["border-block-start-style", "border-block-end-style"]
  385. ],
  386. [
  387. "border-block-width",
  388. ["border-block-start-width", "border-block-end-width"]
  389. ],
  390. [
  391. "border-inline-color",
  392. ["border-inline-start-color", "border-inline-end-color"]
  393. ],
  394. [
  395. "border-inline-style",
  396. ["border-inline-start-style", "border-inline-end-style"]
  397. ],
  398. [
  399. "border-inline-width",
  400. ["border-inline-start-width", "border-inline-end-width"]
  401. ],
  402. [
  403. "contain-intrinsic-size",
  404. ["contain-intrinsic-width", "contain-intrinsic-height"]
  405. ],
  406. [
  407. "corner-block-end-shape",
  408. ["corner-end-start-shape", "corner-end-end-shape"]
  409. ],
  410. [
  411. "corner-block-start-shape",
  412. ["corner-start-start-shape", "corner-start-end-shape"]
  413. ],
  414. [
  415. "corner-bottom-shape",
  416. ["corner-bottom-left-shape", "corner-bottom-right-shape"]
  417. ],
  418. [
  419. "corner-inline-end-shape",
  420. ["corner-start-end-shape", "corner-end-end-shape"]
  421. ],
  422. [
  423. "corner-inline-start-shape",
  424. ["corner-start-start-shape", "corner-end-start-shape"]
  425. ],
  426. ["corner-left-shape", ["corner-top-left-shape", "corner-bottom-left-shape"]],
  427. [
  428. "corner-right-shape",
  429. ["corner-top-right-shape", "corner-bottom-right-shape"]
  430. ],
  431. ["corner-top-shape", ["corner-top-left-shape", "corner-top-right-shape"]],
  432. ["gap", ["row-gap", "column-gap"]],
  433. ["inset-block", ["inset-block-start", "inset-block-end"]],
  434. ["inset-inline", ["inset-inline-start", "inset-inline-end"]],
  435. ["interest-delay", ["interest-delay-start", "interest-delay-end"]],
  436. ["margin-block", ["margin-block-start", "margin-block-end"]],
  437. ["margin-inline", ["margin-inline-start", "margin-inline-end"]],
  438. ["overflow", ["overflow-x", "overflow-y"]],
  439. ["overscroll-behavior", ["overscroll-behavior-x", "overscroll-behavior-y"]],
  440. ["padding-block", ["padding-block-start", "padding-block-end"]],
  441. ["padding-inline", ["padding-inline-start", "padding-inline-end"]],
  442. ["place-content", ["align-content", "justify-content"]],
  443. ["place-items", ["align-items", "justify-items"]],
  444. ["place-self", ["align-self", "justify-self"]],
  445. [
  446. "scroll-margin-block",
  447. ["scroll-margin-block-start", "scroll-margin-block-end"]
  448. ],
  449. [
  450. "scroll-margin-inline",
  451. ["scroll-margin-inline-start", "scroll-margin-inline-end"]
  452. ],
  453. [
  454. "scroll-padding-block",
  455. ["scroll-padding-block-start", "scroll-padding-block-end"]
  456. ],
  457. [
  458. "scroll-padding-inline",
  459. ["scroll-padding-inline-start", "scroll-padding-inline-end"]
  460. ]
  461. ]);
  462. // The subset whose two-value form is newer than the longhands, so only a merge
  463. // collapsing to one value may emit it.
  464. const ONE_VALUE_PAIR_SHORTHANDS = new Set(["overflow"]);
  465. // The pair shorthands the target's `placeShorthand` ability gates, newer than
  466. // the longhands they merge.
  467. const PLACE_SHORTHANDS = new Set([
  468. "place-content",
  469. "place-items",
  470. "place-self"
  471. ]);
  472. // The keywords a shorthand's longhands disagree on, so a merge writing one into
  473. // every slot would turn a declaration the engine kept into a shorthand it drops:
  474. // `justify-items` takes `left` and `align-items` does not.
  475. const UNSHARED_LONGHAND_KEYWORDS = new Map([
  476. ["place-content", new Set(["baseline", "first", "last", "left", "right"])],
  477. ["place-items", new Set(["left", "legacy", "right"])],
  478. ["place-self", new Set(["left", "right"])]
  479. ]);
  480. // The shorthands written as an order-free `||` of their own longhands, each
  481. // appearing once, in grammar order. A merge emits every value, so the only
  482. // question is whether each parses back into the longhand it was authored on.
  483. // prettier-ignore
  484. const FAMILY_LONGHANDS = new Map([["border-bottom", ["border-bottom-width","border-bottom-style","border-bottom-color"]], ["border-left", ["border-left-width","border-left-style","border-left-color"]], ["border-right", ["border-right-width","border-right-style","border-right-color"]], ["border-top", ["border-top-width","border-top-style","border-top-color"]], ["column-rule", ["column-rule-width","column-rule-style","column-rule-color"]], ["flex-flow", ["flex-direction","flex-wrap"]], ["list-style", ["list-style-type","list-style-position","list-style-image"]], ["outline", ["outline-width","outline-style","outline-color"]], ["text-decoration", ["text-decoration-line","text-decoration-style","text-decoration-color","text-decoration-thickness"]], ["text-emphasis", ["text-emphasis-style","text-emphasis-color"]], ["text-wrap", ["text-wrap-mode","text-wrap-style"]]]);
  485. // The properties whose comma-separated items take a `<custom-ident>`, where a
  486. // vendor spelling is a name the engine parses rather than one it may drop — so a
  487. // later declaration listing an earlier one's items cannot be its fallback.
  488. const CUSTOM_IDENT_LIST_PROPERTIES = new Set([
  489. "animation",
  490. "animation-name",
  491. "animation-trigger",
  492. "font-family",
  493. "font-variant",
  494. "font-variant-alternates",
  495. "timeline-trigger-name",
  496. "timeline-trigger-source",
  497. "transition",
  498. "transition-property",
  499. "trigger-scope",
  500. "will-change"
  501. ]);
  502. const SLASH_LONGHANDS = new Map([
  503. [
  504. "grid-area",
  505. ["grid-row-start", "grid-column-start", "grid-row-end", "grid-column-end"]
  506. ],
  507. ["grid-column", ["grid-column-start", "grid-column-end"]],
  508. ["grid-row", ["grid-row-start", "grid-row-end"]]
  509. ]);
  510. // Every longhand the three merge tables above can consume, so a block is asked
  511. // once whether it holds anything mergeable at all. Two of them have to be
  512. // present before any shorthand can be written, and almost no block holds one,
  513. // which is what keeps the merge off the declarations it cannot serve.
  514. const MERGE_LONGHANDS = new Set([
  515. "align-content",
  516. "align-items",
  517. "align-self",
  518. "border-block-end-color",
  519. "border-block-end-style",
  520. "border-block-end-width",
  521. "border-block-start-color",
  522. "border-block-start-style",
  523. "border-block-start-width",
  524. "border-bottom-color",
  525. "border-bottom-left-radius",
  526. "border-bottom-right-radius",
  527. "border-bottom-style",
  528. "border-bottom-width",
  529. "border-inline-end-color",
  530. "border-inline-end-style",
  531. "border-inline-end-width",
  532. "border-inline-start-color",
  533. "border-inline-start-style",
  534. "border-inline-start-width",
  535. "border-left-color",
  536. "border-left-style",
  537. "border-left-width",
  538. "border-right-color",
  539. "border-right-style",
  540. "border-right-width",
  541. "border-top-color",
  542. "border-top-left-radius",
  543. "border-top-right-radius",
  544. "border-top-style",
  545. "border-top-width",
  546. "bottom",
  547. "column-gap",
  548. "column-rule-color",
  549. "column-rule-style",
  550. "column-rule-width",
  551. "contain-intrinsic-height",
  552. "contain-intrinsic-width",
  553. "corner-bottom-left-shape",
  554. "corner-bottom-right-shape",
  555. "corner-end-end-shape",
  556. "corner-end-start-shape",
  557. "corner-start-end-shape",
  558. "corner-start-start-shape",
  559. "corner-top-left-shape",
  560. "corner-top-right-shape",
  561. "flex-direction",
  562. "flex-wrap",
  563. "grid-column-end",
  564. "grid-column-start",
  565. "grid-row-end",
  566. "grid-row-start",
  567. "inset-block-end",
  568. "inset-block-start",
  569. "inset-inline-end",
  570. "inset-inline-start",
  571. "interest-delay-end",
  572. "interest-delay-start",
  573. "justify-content",
  574. "justify-items",
  575. "justify-self",
  576. "left",
  577. "list-style-image",
  578. "list-style-position",
  579. "list-style-type",
  580. "margin-block-end",
  581. "margin-block-start",
  582. "margin-bottom",
  583. "margin-inline-end",
  584. "margin-inline-start",
  585. "margin-left",
  586. "margin-right",
  587. "margin-top",
  588. "outline-color",
  589. "outline-style",
  590. "outline-width",
  591. "overflow-x",
  592. "overflow-y",
  593. "overscroll-behavior-x",
  594. "overscroll-behavior-y",
  595. "padding-block-end",
  596. "padding-block-start",
  597. "padding-bottom",
  598. "padding-inline-end",
  599. "padding-inline-start",
  600. "padding-left",
  601. "padding-right",
  602. "padding-top",
  603. "right",
  604. "row-gap",
  605. "scroll-margin-block-end",
  606. "scroll-margin-block-start",
  607. "scroll-margin-bottom",
  608. "scroll-margin-inline-end",
  609. "scroll-margin-inline-start",
  610. "scroll-margin-left",
  611. "scroll-margin-right",
  612. "scroll-margin-top",
  613. "scroll-padding-block-end",
  614. "scroll-padding-block-start",
  615. "scroll-padding-bottom",
  616. "scroll-padding-inline-end",
  617. "scroll-padding-inline-start",
  618. "scroll-padding-left",
  619. "scroll-padding-right",
  620. "scroll-padding-top",
  621. "text-decoration-color",
  622. "text-decoration-line",
  623. "text-decoration-style",
  624. "text-decoration-thickness",
  625. "text-emphasis-color",
  626. "text-emphasis-style",
  627. "text-wrap-mode",
  628. "text-wrap-style",
  629. "top"
  630. ]);
  631. // The initial keyword each of these may drop when another component stands
  632. // beside it: omitting the group it belongs to leaves exactly that keyword. The
  633. // second half is every keyword that group offers — a value naming two of them
  634. // (`grid-auto-flow:row dense column`) fills the slot twice and is invalid, so
  635. // dropping the initial there would print a value the author never wrote.
  636. /** @type {Map<string, [string, string[]]>} */
  637. // prettier-ignore
  638. const OMITTABLE_INITIAL_KEYWORDS = new Map([["grid-auto-flow", ["row", ["column","row"]]]]);
  639. // What each of those longhands accepts as a whole value: the keywords it names,
  640. // and the value classes it reaches. A value acceptable to a second slot is what
  641. // makes the merge ambiguous, and `FAMILY_SLOT_CLASSES` names a type the printer
  642. // cannot classify as readily as one it can, so an unknown one declines.
  643. // prettier-ignore
  644. const FAMILY_SLOT_KEYWORDS = new Map([["border-bottom-width", ["medium","thick","thin"]], ["border-bottom-style", ["dashed","dotted","double","groove","hidden","inset","none","outset","ridge","solid"]], ["border-bottom-color", []], ["border-left-width", ["medium","thick","thin"]], ["border-left-style", ["dashed","dotted","double","groove","hidden","inset","none","outset","ridge","solid"]], ["border-left-color", []], ["border-right-width", ["medium","thick","thin"]], ["border-right-style", ["dashed","dotted","double","groove","hidden","inset","none","outset","ridge","solid"]], ["border-right-color", []], ["border-top-width", ["medium","thick","thin"]], ["border-top-style", ["dashed","dotted","double","groove","hidden","inset","none","outset","ridge","solid"]], ["border-top-color", []], ["column-rule-width", ["medium","thick","thin"]], ["column-rule-style", ["dashed","dotted","double","groove","hidden","inset","none","outset","ridge","solid"]], ["column-rule-color", []], ["flex-direction", ["column","column-reverse","row","row-reverse"]], ["flex-wrap", ["nowrap","wrap","wrap-reverse"]], ["list-style-type", ["none"]], ["list-style-position", ["inside","outside"]], ["list-style-image", ["none"]], ["outline-width", ["medium","thick","thin"]], ["outline-style", ["auto","dashed","dotted","double","groove","inset","none","outset","ridge","solid"]], ["outline-color", ["auto"]], ["text-decoration-line", ["blink","grammar-error","line-through","none","overline","spelling-error","underline"]], ["text-decoration-style", ["dashed","dotted","double","solid","wavy"]], ["text-decoration-color", []], ["text-decoration-thickness", ["auto","from-font"]], ["text-emphasis-style", ["circle","dot","double-circle","filled","none","open","sesame","triangle"]], ["text-emphasis-color", []], ["text-wrap-mode", ["nowrap","wrap"]], ["text-wrap-style", ["auto","balance","pretty","stable"]]]);
  645. // prettier-ignore
  646. const FAMILY_SLOT_CLASSES = new Map([["border-bottom-width", ["length"]], ["border-bottom-style", []], ["border-bottom-color", ["color"]], ["border-left-width", ["length"]], ["border-left-style", []], ["border-left-color", ["color"]], ["border-right-width", ["length"]], ["border-right-style", []], ["border-right-color", ["color"]], ["border-top-width", ["length"]], ["border-top-style", []], ["border-top-color", ["color"]], ["column-rule-width", ["length"]], ["column-rule-style", []], ["column-rule-color", ["color"]], ["flex-direction", []], ["flex-wrap", []], ["list-style-type", ["custom-ident","string"]], ["list-style-position", []], ["list-style-image", ["image"]], ["outline-width", ["length"]], ["outline-style", []], ["outline-color", ["color"]], ["text-decoration-line", []], ["text-decoration-style", []], ["text-decoration-color", ["color"]], ["text-decoration-thickness", ["length","percentage"]], ["text-emphasis-style", ["string"]], ["text-emphasis-color", ["color"]], ["text-wrap-mode", []], ["text-wrap-style", []]]);
  647. // The identifiers that are a `<color>` on their own — named, system and the two
  648. // context-dependent ones. Read off the `<color>` grammar outside any function,
  649. // so a channel keyword like the `none` in `hsl(0 none 0)` is not among them.
  650. // cspell:ignore accentcolor accentcolortext activeborder activecaption activetext aliceblue antiquewhite appworkspace aqua aquamarine azure background beige bisque black blanchedalmond blue blueviolet brown burlywood buttonborder buttonface buttonhighlight buttonshadow buttontext cadetblue canvas canvastext captiontext chartreuse chocolate coral cornflowerblue cornsilk crimson currentcolor cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue field fieldtext firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray graytext green greenyellow grey highlight highlighttext honeydew hotpink inactiveborder inactivecaption inactivecaptiontext indianred indigo infobackground infotext ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen linktext magenta mark marktext maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred menu menutext midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown scrollbar seagreen seashell selecteditem selecteditemtext sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle threeddarkshadow threedface threedhighlight threedlightshadow threedshadow tomato transparent turquoise violet visitedtext wheat white whitesmoke window windowframe windowtext yellow yellowgreen
  651. const COLOR_KEYWORDS = new Set([
  652. "accentcolor",
  653. "accentcolortext",
  654. "activeborder",
  655. "activecaption",
  656. "activetext",
  657. "aliceblue",
  658. "antiquewhite",
  659. "appworkspace",
  660. "aqua",
  661. "aquamarine",
  662. "azure",
  663. "background",
  664. "beige",
  665. "bisque",
  666. "black",
  667. "blanchedalmond",
  668. "blue",
  669. "blueviolet",
  670. "brown",
  671. "burlywood",
  672. "buttonborder",
  673. "buttonface",
  674. "buttonhighlight",
  675. "buttonshadow",
  676. "buttontext",
  677. "cadetblue",
  678. "canvas",
  679. "canvastext",
  680. "captiontext",
  681. "chartreuse",
  682. "chocolate",
  683. "coral",
  684. "cornflowerblue",
  685. "cornsilk",
  686. "crimson",
  687. "currentcolor",
  688. "cyan",
  689. "darkblue",
  690. "darkcyan",
  691. "darkgoldenrod",
  692. "darkgray",
  693. "darkgreen",
  694. "darkgrey",
  695. "darkkhaki",
  696. "darkmagenta",
  697. "darkolivegreen",
  698. "darkorange",
  699. "darkorchid",
  700. "darkred",
  701. "darksalmon",
  702. "darkseagreen",
  703. "darkslateblue",
  704. "darkslategray",
  705. "darkslategrey",
  706. "darkturquoise",
  707. "darkviolet",
  708. "deeppink",
  709. "deepskyblue",
  710. "dimgray",
  711. "dimgrey",
  712. "dodgerblue",
  713. "field",
  714. "fieldtext",
  715. "firebrick",
  716. "floralwhite",
  717. "forestgreen",
  718. "fuchsia",
  719. "gainsboro",
  720. "ghostwhite",
  721. "gold",
  722. "goldenrod",
  723. "gray",
  724. "graytext",
  725. "green",
  726. "greenyellow",
  727. "grey",
  728. "highlight",
  729. "highlighttext",
  730. "honeydew",
  731. "hotpink",
  732. "inactiveborder",
  733. "inactivecaption",
  734. "inactivecaptiontext",
  735. "indianred",
  736. "indigo",
  737. "infobackground",
  738. "infotext",
  739. "ivory",
  740. "khaki",
  741. "lavender",
  742. "lavenderblush",
  743. "lawngreen",
  744. "lemonchiffon",
  745. "lightblue",
  746. "lightcoral",
  747. "lightcyan",
  748. "lightgoldenrodyellow",
  749. "lightgray",
  750. "lightgreen",
  751. "lightgrey",
  752. "lightpink",
  753. "lightsalmon",
  754. "lightseagreen",
  755. "lightskyblue",
  756. "lightslategray",
  757. "lightslategrey",
  758. "lightsteelblue",
  759. "lightyellow",
  760. "lime",
  761. "limegreen",
  762. "linen",
  763. "linktext",
  764. "magenta",
  765. "mark",
  766. "marktext",
  767. "maroon",
  768. "mediumaquamarine",
  769. "mediumblue",
  770. "mediumorchid",
  771. "mediumpurple",
  772. "mediumseagreen",
  773. "mediumslateblue",
  774. "mediumspringgreen",
  775. "mediumturquoise",
  776. "mediumvioletred",
  777. "menu",
  778. "menutext",
  779. "midnightblue",
  780. "mintcream",
  781. "mistyrose",
  782. "moccasin",
  783. "navajowhite",
  784. "navy",
  785. "oldlace",
  786. "olive",
  787. "olivedrab",
  788. "orange",
  789. "orangered",
  790. "orchid",
  791. "palegoldenrod",
  792. "palegreen",
  793. "paleturquoise",
  794. "palevioletred",
  795. "papayawhip",
  796. "peachpuff",
  797. "peru",
  798. "pink",
  799. "plum",
  800. "powderblue",
  801. "purple",
  802. "rebeccapurple",
  803. "red",
  804. "rosybrown",
  805. "royalblue",
  806. "saddlebrown",
  807. "salmon",
  808. "sandybrown",
  809. "scrollbar",
  810. "seagreen",
  811. "seashell",
  812. "selecteditem",
  813. "selecteditemtext",
  814. "sienna",
  815. "silver",
  816. "skyblue",
  817. "slateblue",
  818. "slategray",
  819. "slategrey",
  820. "snow",
  821. "springgreen",
  822. "steelblue",
  823. "tan",
  824. "teal",
  825. "thistle",
  826. "threeddarkshadow",
  827. "threedface",
  828. "threedhighlight",
  829. "threedlightshadow",
  830. "threedshadow",
  831. "tomato",
  832. "transparent",
  833. "turquoise",
  834. "violet",
  835. "visitedtext",
  836. "wheat",
  837. "white",
  838. "whitesmoke",
  839. "window",
  840. "windowframe",
  841. "windowtext",
  842. "yellow",
  843. "yellowgreen"
  844. ]);
  845. // The name prefix a declaration between two box longhands must not carry for the
  846. // merge to step over it. The shorthand's first segment, which is deliberately
  847. // wider than the family: `border-color` blocks every `border*` property, since
  848. // `border`, `border-top` and `border-block-start-color` all write its longhands
  849. // and `mdn-data`'s `computed` lists only some of them.
  850. const BOX_FAMILY_PREFIX = new Map([
  851. ["border-color", "border"],
  852. ["border-radius", "border"],
  853. ["border-style", "border"],
  854. ["border-width", "border"],
  855. ["corner-shape", "corner"],
  856. ["inset", "inset"],
  857. ["margin", "margin"],
  858. ["padding", "padding"],
  859. ["scroll-margin", "scroll"],
  860. ["scroll-padding", "scroll"]
  861. ]);
  862. // Functions that take a `<color>` directly, so a hash among their arguments is a
  863. // hex color rather than a case-sensitive reference (`element(#id)`). Only direct
  864. // arguments: a gradient nested in `image-set()` is matched as the gradient.
  865. const COLOR_ARGUMENT_FUNCTIONS = new Set([
  866. "color",
  867. "color-mix",
  868. "conic-gradient",
  869. "cross-fade",
  870. "drop-shadow",
  871. "image",
  872. "light-dark",
  873. "linear-gradient",
  874. "radial-gradient",
  875. "repeating-conic-gradient",
  876. "repeating-linear-gradient",
  877. "repeating-radial-gradient"
  878. ]);
  879. // Functions that substitute an arbitrary token sequence, so two identical
  880. // references need not be one repeated value: with `--x:1px 2px`,
  881. // `margin:var(--x) var(--x)` is four values, not two.
  882. const SUBSTITUTION_FUNCTIONS = new Set([
  883. "attr",
  884. "env",
  885. "first-valid",
  886. "if",
  887. "inherit",
  888. "paint",
  889. "param",
  890. "random-item",
  891. "var"
  892. ]);
  893. // The pseudo-class functions whose argument is An+B, where `2n+1` is the
  894. // notation `odd` names in one byte less.
  895. const NTH_PSEUDO_FUNCTIONS = new Set([
  896. "nth-child",
  897. "nth-last-child",
  898. "nth-last-of-type",
  899. "nth-of-type"
  900. ]);
  901. // Each An+B pseudo-class whose one-element case has a name of its own:
  902. // `:nth-child(1)` is what `:first-child` selects, in fewer bytes.
  903. const NTH_NAMED_EQUIVALENTS = new Map([
  904. ["nth-child", "first-child"],
  905. ["nth-last-child", "last-child"],
  906. ["nth-last-of-type", "last-of-type"],
  907. ["nth-of-type", "first-of-type"]
  908. ]);
  909. // The properties taking a color and never an identifier of the author's own, so
  910. // a named color written in one is that color and may be spelled the shortest way.
  911. const COLOR_ONLY_PROPERTIES = new Set([
  912. "-moz-border-bottom-colors",
  913. "-moz-border-left-colors",
  914. "-moz-border-right-colors",
  915. "-moz-border-top-colors",
  916. "-ms-scrollbar-3dlight-color",
  917. "-ms-scrollbar-arrow-color",
  918. "-ms-scrollbar-base-color",
  919. "-ms-scrollbar-darkshadow-color",
  920. "-ms-scrollbar-face-color",
  921. "-ms-scrollbar-highlight-color",
  922. "-ms-scrollbar-shadow-color",
  923. "-ms-scrollbar-track-color",
  924. "-webkit-border-after",
  925. "-webkit-border-after-color",
  926. "-webkit-border-before",
  927. "-webkit-border-before-color",
  928. "-webkit-border-end",
  929. "-webkit-border-end-color",
  930. "-webkit-border-start",
  931. "-webkit-border-start-color",
  932. "-webkit-tap-highlight-color",
  933. "-webkit-text-fill-color",
  934. "-webkit-text-stroke",
  935. "-webkit-text-stroke-color",
  936. "accent-color",
  937. "backdrop-filter",
  938. "background-color",
  939. "border",
  940. "border-block",
  941. "border-block-color",
  942. "border-block-end",
  943. "border-block-end-color",
  944. "border-block-start",
  945. "border-block-start-color",
  946. "border-bottom",
  947. "border-bottom-color",
  948. "border-color",
  949. "border-inline",
  950. "border-inline-color",
  951. "border-inline-end",
  952. "border-inline-end-color",
  953. "border-inline-start",
  954. "border-inline-start-color",
  955. "border-left",
  956. "border-left-color",
  957. "border-right",
  958. "border-right-color",
  959. "border-top",
  960. "border-top-color",
  961. "box-shadow",
  962. "caret",
  963. "caret-color",
  964. "color",
  965. "column-rule",
  966. "column-rule-color",
  967. "fill",
  968. "filter",
  969. "flood-color",
  970. "lighting-color",
  971. "outline",
  972. "outline-color",
  973. "scrollbar-color",
  974. "stop-color",
  975. "stroke",
  976. "stroke-color",
  977. "text-decoration",
  978. "text-decoration-color",
  979. "text-emphasis",
  980. "text-emphasis-color",
  981. "text-shadow"
  982. ]);
  983. // The properties whose value is keywords alone, so an identifier standing
  984. // directly in one is a keyword rather than a name of the author's — and matches
  985. // ASCII case-insensitively. A call's arguments are read against the function's
  986. // own grammar, so they are not covered.
  987. const KEYWORD_ONLY_PROPERTIES = new Set([
  988. "-moz-appearance",
  989. "-moz-context-properties",
  990. "-moz-float-edge",
  991. "-moz-force-broken-image-icon",
  992. "-moz-orient",
  993. "-moz-stack-sizing",
  994. "-moz-text-blink",
  995. "-moz-user-focus",
  996. "-moz-user-input",
  997. "-moz-user-modify",
  998. "-moz-window-dragging",
  999. "-moz-window-shadow",
  1000. "-ms-accelerator",
  1001. "-ms-block-progression",
  1002. "-ms-content-zoom-chaining",
  1003. "-ms-content-zoom-snap",
  1004. "-ms-content-zoom-snap-type",
  1005. "-ms-content-zooming",
  1006. "-ms-high-contrast-adjust",
  1007. "-ms-ime-align",
  1008. "-ms-overflow-style",
  1009. "-ms-scroll-chaining",
  1010. "-ms-scroll-rails",
  1011. "-ms-scroll-snap-type",
  1012. "-ms-scroll-snap-x",
  1013. "-ms-scroll-snap-y",
  1014. "-ms-scroll-translation",
  1015. "-ms-text-autospace",
  1016. "-ms-touch-select",
  1017. "-ms-user-select",
  1018. "-ms-wrap-flow",
  1019. "-ms-wrap-through",
  1020. "-webkit-appearance",
  1021. "-webkit-border-after-style",
  1022. "-webkit-border-before-style",
  1023. "-webkit-border-end-style",
  1024. "-webkit-border-start-style",
  1025. "-webkit-mask-attachment",
  1026. "-webkit-mask-clip",
  1027. "-webkit-mask-composite",
  1028. "-webkit-mask-origin",
  1029. "-webkit-mask-repeat",
  1030. "-webkit-mask-repeat-x",
  1031. "-webkit-mask-repeat-y",
  1032. "-webkit-overflow-scrolling",
  1033. "-webkit-touch-callout",
  1034. "-webkit-user-modify",
  1035. "-webkit-user-select",
  1036. "align-content",
  1037. "align-items",
  1038. "align-self",
  1039. "align-tracks",
  1040. "alignment-baseline",
  1041. "all",
  1042. "animation-composition",
  1043. "animation-direction",
  1044. "animation-fill-mode",
  1045. "animation-play-state",
  1046. "animation-timing-function",
  1047. "appearance",
  1048. "backface-visibility",
  1049. "background-attachment",
  1050. "background-blend-mode",
  1051. "background-clip",
  1052. "background-origin",
  1053. "background-repeat",
  1054. "baseline-source",
  1055. "border-block-end-style",
  1056. "border-block-start-style",
  1057. "border-block-style",
  1058. "border-bottom-style",
  1059. "border-collapse",
  1060. "border-image-repeat",
  1061. "border-inline-end-style",
  1062. "border-inline-start-style",
  1063. "border-inline-style",
  1064. "border-left-style",
  1065. "border-right-style",
  1066. "border-shape",
  1067. "border-style",
  1068. "border-top-style",
  1069. "box-align",
  1070. "box-decoration-break",
  1071. "box-direction",
  1072. "box-lines",
  1073. "box-orient",
  1074. "box-pack",
  1075. "box-sizing",
  1076. "break-after",
  1077. "break-before",
  1078. "break-inside",
  1079. "caption-side",
  1080. "caret-animation",
  1081. "caret-shape",
  1082. "clear",
  1083. "clip",
  1084. "clip-rule",
  1085. "color-interpolation-filters",
  1086. "column-fill",
  1087. "column-rule-style",
  1088. "column-span",
  1089. "column-wrap",
  1090. "contain",
  1091. "container-type",
  1092. "content-visibility",
  1093. "corner-block-end-shape",
  1094. "corner-block-start-shape",
  1095. "corner-bottom-left-shape",
  1096. "corner-bottom-right-shape",
  1097. "corner-bottom-shape",
  1098. "corner-end-end-shape",
  1099. "corner-end-start-shape",
  1100. "corner-inline-end-shape",
  1101. "corner-inline-start-shape",
  1102. "corner-left-shape",
  1103. "corner-right-shape",
  1104. "corner-shape",
  1105. "corner-start-end-shape",
  1106. "corner-start-start-shape",
  1107. "corner-top-left-shape",
  1108. "corner-top-right-shape",
  1109. "corner-top-shape",
  1110. "d",
  1111. "direction",
  1112. "display",
  1113. "dominant-baseline",
  1114. "dynamic-range-limit",
  1115. "empty-cells",
  1116. "field-sizing",
  1117. "fill-rule",
  1118. "flex-direction",
  1119. "flex-flow",
  1120. "flex-wrap",
  1121. "float",
  1122. "font-kerning",
  1123. "font-optical-sizing",
  1124. "font-synthesis",
  1125. "font-synthesis-position",
  1126. "font-synthesis-small-caps",
  1127. "font-synthesis-style",
  1128. "font-synthesis-weight",
  1129. "font-variant",
  1130. "font-variant-alternates",
  1131. "font-variant-caps",
  1132. "font-variant-east-asian",
  1133. "font-variant-emoji",
  1134. "font-variant-ligatures",
  1135. "font-variant-numeric",
  1136. "font-variant-position",
  1137. "forced-color-adjust",
  1138. "frame-sizing",
  1139. "grid-auto-flow",
  1140. "hanging-punctuation",
  1141. "hyphens",
  1142. "image-rendering",
  1143. "ime-mode",
  1144. "initial-letter-align",
  1145. "interactivity",
  1146. "interpolate-size",
  1147. "isolation",
  1148. "justify-content",
  1149. "justify-items",
  1150. "justify-self",
  1151. "justify-tracks",
  1152. "line-break",
  1153. "list-style-position",
  1154. "margin-trim",
  1155. "mask-border-mode",
  1156. "mask-border-repeat",
  1157. "mask-clip",
  1158. "mask-composite",
  1159. "mask-mode",
  1160. "mask-origin",
  1161. "mask-repeat",
  1162. "mask-type",
  1163. "masonry-auto-flow",
  1164. "math-shift",
  1165. "math-style",
  1166. "mix-blend-mode",
  1167. "object-fit",
  1168. "object-view-box",
  1169. "outline-style",
  1170. "overflow",
  1171. "overflow-anchor",
  1172. "overflow-block",
  1173. "overflow-clip-box",
  1174. "overflow-inline",
  1175. "overflow-wrap",
  1176. "overflow-x",
  1177. "overflow-y",
  1178. "overlay",
  1179. "overscroll-behavior",
  1180. "overscroll-behavior-block",
  1181. "overscroll-behavior-inline",
  1182. "overscroll-behavior-x",
  1183. "overscroll-behavior-y",
  1184. "page-break-after",
  1185. "page-break-before",
  1186. "page-break-inside",
  1187. "paint-order",
  1188. "place-content",
  1189. "place-items",
  1190. "place-self",
  1191. "pointer-events",
  1192. "position",
  1193. "position-area",
  1194. "position-try-order",
  1195. "position-visibility",
  1196. "print-color-adjust",
  1197. "reading-flow",
  1198. "resize",
  1199. "ruby-align",
  1200. "ruby-merge",
  1201. "ruby-overhang",
  1202. "ruby-position",
  1203. "scroll-behavior",
  1204. "scroll-initial-target",
  1205. "scroll-marker-group",
  1206. "scroll-snap-align",
  1207. "scroll-snap-points-x",
  1208. "scroll-snap-points-y",
  1209. "scroll-snap-stop",
  1210. "scroll-snap-type",
  1211. "scroll-snap-type-x",
  1212. "scroll-snap-type-y",
  1213. "scroll-target-group",
  1214. "scroll-timeline-axis",
  1215. "scrollbar-gutter",
  1216. "scrollbar-width",
  1217. "shape-rendering",
  1218. "speak-as",
  1219. "stroke-linecap",
  1220. "stroke-linejoin",
  1221. "table-layout",
  1222. "text-align",
  1223. "text-align-last",
  1224. "text-anchor",
  1225. "text-box",
  1226. "text-box-edge",
  1227. "text-box-trim",
  1228. "text-decoration-line",
  1229. "text-decoration-skip",
  1230. "text-decoration-skip-ink",
  1231. "text-decoration-style",
  1232. "text-emphasis-position",
  1233. "text-justify",
  1234. "text-orientation",
  1235. "text-rendering",
  1236. "text-spacing-trim",
  1237. "text-transform",
  1238. "text-underline-position",
  1239. "text-wrap",
  1240. "text-wrap-mode",
  1241. "text-wrap-style",
  1242. "touch-action",
  1243. "transform",
  1244. "transform-box",
  1245. "transform-style",
  1246. "transition-behavior",
  1247. "transition-timing-function",
  1248. "unicode-bidi",
  1249. "user-select",
  1250. "vector-effect",
  1251. "view-timeline-axis",
  1252. "view-transition-scope",
  1253. "visibility",
  1254. "white-space",
  1255. "white-space-collapse",
  1256. "word-break",
  1257. "word-wrap",
  1258. "writing-mode"
  1259. ]);
  1260. // Each two-keyword `display` -> the single keyword naming the same box.
  1261. const DISPLAY_SHORT_FORMS = new Map([
  1262. ["block flex", "flex"],
  1263. ["block flow", "block"],
  1264. ["block flow-root", "flow-root"],
  1265. ["block grid", "grid"],
  1266. ["block table", "table"],
  1267. ["inline flow", "inline"],
  1268. ["inline flow-root", "inline-block"],
  1269. ["inline ruby", "ruby"],
  1270. ["run-in flow", "run-in"]
  1271. ]);
  1272. // Each property whose value is a list of shadows -> the count of lengths a
  1273. // shadow cannot go below, past which a trailing zero is already implied.
  1274. const SHADOW_PROPERTIES = new Map([
  1275. ["box-shadow", 2],
  1276. ["text-shadow", 2]
  1277. ]);
  1278. // Each shorthand -> the keywords one of its values may drop, each with every
  1279. // spelling its own slot takes: the slot's keywords, and each function it
  1280. // accepts written `name()`. A sibling out of that set means the value fills the
  1281. // slot twice, which is a declaration the engine drops.
  1282. const SHORTHAND_INITIAL_KEYWORDS = new Map([
  1283. [
  1284. "animation",
  1285. new Map([
  1286. [
  1287. "ease",
  1288. new Set([
  1289. "cubic-bezier()",
  1290. "ease",
  1291. "ease-in",
  1292. "ease-in-out",
  1293. "ease-out",
  1294. "linear",
  1295. "linear()",
  1296. "step-end",
  1297. "step-start",
  1298. "steps()"
  1299. ])
  1300. ],
  1301. [
  1302. "normal",
  1303. new Set(["alternate", "alternate-reverse", "normal", "reverse"])
  1304. ],
  1305. ["running", new Set(["paused", "running"])]
  1306. ])
  1307. ],
  1308. [
  1309. "background",
  1310. new Map([
  1311. [
  1312. "none",
  1313. new Set([
  1314. "color()",
  1315. "color-mix()",
  1316. "conic-gradient()",
  1317. "cross-fade()",
  1318. "element()",
  1319. "hsl()",
  1320. "hsla()",
  1321. "hwb()",
  1322. "image()",
  1323. "image-set()",
  1324. "lab()",
  1325. "lch()",
  1326. "light-dark()",
  1327. "linear-gradient()",
  1328. "none",
  1329. "oklab()",
  1330. "oklch()",
  1331. "paint()",
  1332. "radial-gradient()",
  1333. "repeating-conic-gradient()",
  1334. "repeating-linear-gradient()",
  1335. "repeating-radial-gradient()",
  1336. "rgb()",
  1337. "rgba()",
  1338. "src()",
  1339. "type()",
  1340. "url()"
  1341. ])
  1342. ],
  1343. [
  1344. "repeat",
  1345. new Set([
  1346. "no-repeat",
  1347. "repeat",
  1348. "repeat-x",
  1349. "repeat-y",
  1350. "round",
  1351. "space"
  1352. ])
  1353. ],
  1354. ["scroll", new Set(["fixed", "local", "scroll"])]
  1355. ])
  1356. ],
  1357. [
  1358. "border",
  1359. new Map([
  1360. [
  1361. "none",
  1362. new Set([
  1363. "dashed",
  1364. "dotted",
  1365. "double",
  1366. "groove",
  1367. "hidden",
  1368. "inset",
  1369. "none",
  1370. "outset",
  1371. "ridge",
  1372. "solid"
  1373. ])
  1374. ]
  1375. ])
  1376. ],
  1377. [
  1378. "border-bottom",
  1379. new Map([
  1380. [
  1381. "none",
  1382. new Set([
  1383. "dashed",
  1384. "dotted",
  1385. "double",
  1386. "groove",
  1387. "hidden",
  1388. "inset",
  1389. "none",
  1390. "outset",
  1391. "ridge",
  1392. "solid"
  1393. ])
  1394. ]
  1395. ])
  1396. ],
  1397. [
  1398. "border-image",
  1399. new Map([
  1400. [
  1401. "none",
  1402. new Set([
  1403. "color()",
  1404. "color-mix()",
  1405. "conic-gradient()",
  1406. "cross-fade()",
  1407. "element()",
  1408. "hsl()",
  1409. "hsla()",
  1410. "hwb()",
  1411. "image()",
  1412. "image-set()",
  1413. "lab()",
  1414. "lch()",
  1415. "light-dark()",
  1416. "linear-gradient()",
  1417. "none",
  1418. "oklab()",
  1419. "oklch()",
  1420. "paint()",
  1421. "radial-gradient()",
  1422. "repeating-conic-gradient()",
  1423. "repeating-linear-gradient()",
  1424. "repeating-radial-gradient()",
  1425. "rgb()",
  1426. "rgba()",
  1427. "src()",
  1428. "type()",
  1429. "url()"
  1430. ])
  1431. ],
  1432. ["stretch", new Set(["repeat", "round", "space", "stretch"])]
  1433. ])
  1434. ],
  1435. [
  1436. "border-left",
  1437. new Map([
  1438. [
  1439. "none",
  1440. new Set([
  1441. "dashed",
  1442. "dotted",
  1443. "double",
  1444. "groove",
  1445. "hidden",
  1446. "inset",
  1447. "none",
  1448. "outset",
  1449. "ridge",
  1450. "solid"
  1451. ])
  1452. ]
  1453. ])
  1454. ],
  1455. [
  1456. "border-right",
  1457. new Map([
  1458. [
  1459. "none",
  1460. new Set([
  1461. "dashed",
  1462. "dotted",
  1463. "double",
  1464. "groove",
  1465. "hidden",
  1466. "inset",
  1467. "none",
  1468. "outset",
  1469. "ridge",
  1470. "solid"
  1471. ])
  1472. ]
  1473. ])
  1474. ],
  1475. [
  1476. "border-top",
  1477. new Map([
  1478. [
  1479. "none",
  1480. new Set([
  1481. "dashed",
  1482. "dotted",
  1483. "double",
  1484. "groove",
  1485. "hidden",
  1486. "inset",
  1487. "none",
  1488. "outset",
  1489. "ridge",
  1490. "solid"
  1491. ])
  1492. ]
  1493. ])
  1494. ],
  1495. [
  1496. "column-rule",
  1497. new Map([
  1498. [
  1499. "none",
  1500. new Set([
  1501. "dashed",
  1502. "dotted",
  1503. "double",
  1504. "groove",
  1505. "hidden",
  1506. "inset",
  1507. "none",
  1508. "outset",
  1509. "ridge",
  1510. "solid"
  1511. ])
  1512. ]
  1513. ])
  1514. ],
  1515. [
  1516. "flex-flow",
  1517. new Map([
  1518. ["nowrap", new Set(["balance", "nowrap", "wrap", "wrap-reverse"])],
  1519. ["row", new Set(["column", "column-reverse", "row", "row-reverse"])]
  1520. ])
  1521. ],
  1522. ["list-style", new Map([["outside", new Set(["inside", "outside"])]])],
  1523. [
  1524. "mask",
  1525. new Map([
  1526. ["add", new Set(["add", "exclude", "intersect", "subtract"])],
  1527. ["match-source", new Set(["alpha", "luminance", "match-source"])],
  1528. [
  1529. "none",
  1530. new Set([
  1531. "color()",
  1532. "color-mix()",
  1533. "conic-gradient()",
  1534. "cross-fade()",
  1535. "element()",
  1536. "hsl()",
  1537. "hsla()",
  1538. "hwb()",
  1539. "image()",
  1540. "image-set()",
  1541. "lab()",
  1542. "lch()",
  1543. "light-dark()",
  1544. "linear-gradient()",
  1545. "none",
  1546. "oklab()",
  1547. "oklch()",
  1548. "paint()",
  1549. "radial-gradient()",
  1550. "repeating-conic-gradient()",
  1551. "repeating-linear-gradient()",
  1552. "repeating-radial-gradient()",
  1553. "rgb()",
  1554. "rgba()",
  1555. "src()",
  1556. "type()",
  1557. "url()"
  1558. ])
  1559. ],
  1560. [
  1561. "repeat",
  1562. new Set([
  1563. "no-repeat",
  1564. "repeat",
  1565. "repeat-x",
  1566. "repeat-y",
  1567. "round",
  1568. "space"
  1569. ])
  1570. ]
  1571. ])
  1572. ],
  1573. [
  1574. "mask-border",
  1575. new Map([
  1576. ["alpha", new Set(["alpha", "luminance"])],
  1577. [
  1578. "none",
  1579. new Set([
  1580. "color()",
  1581. "color-mix()",
  1582. "conic-gradient()",
  1583. "cross-fade()",
  1584. "element()",
  1585. "hsl()",
  1586. "hsla()",
  1587. "hwb()",
  1588. "image()",
  1589. "image-set()",
  1590. "lab()",
  1591. "lch()",
  1592. "light-dark()",
  1593. "linear-gradient()",
  1594. "none",
  1595. "oklab()",
  1596. "oklch()",
  1597. "paint()",
  1598. "radial-gradient()",
  1599. "repeating-conic-gradient()",
  1600. "repeating-linear-gradient()",
  1601. "repeating-radial-gradient()",
  1602. "rgb()",
  1603. "rgba()",
  1604. "src()",
  1605. "type()",
  1606. "url()"
  1607. ])
  1608. ],
  1609. ["stretch", new Set(["repeat", "round", "space", "stretch"])]
  1610. ])
  1611. ],
  1612. [
  1613. "outline",
  1614. new Map([
  1615. [
  1616. "none",
  1617. new Set([
  1618. "auto",
  1619. "dashed",
  1620. "dotted",
  1621. "double",
  1622. "groove",
  1623. "inset",
  1624. "none",
  1625. "outset",
  1626. "ridge",
  1627. "solid"
  1628. ])
  1629. ]
  1630. ])
  1631. ],
  1632. [
  1633. "text-decoration",
  1634. new Map([
  1635. [
  1636. "none",
  1637. new Set([
  1638. "blink",
  1639. "grammar-error",
  1640. "line-through",
  1641. "none",
  1642. "overline",
  1643. "spelling-error",
  1644. "underline"
  1645. ])
  1646. ],
  1647. ["solid", new Set(["dashed", "dotted", "double", "solid", "wavy"])]
  1648. ])
  1649. ],
  1650. [
  1651. "transition",
  1652. new Map([
  1653. [
  1654. "ease",
  1655. new Set([
  1656. "cubic-bezier()",
  1657. "ease",
  1658. "ease-in",
  1659. "ease-in-out",
  1660. "ease-out",
  1661. "linear",
  1662. "linear()",
  1663. "step-end",
  1664. "step-start",
  1665. "steps()"
  1666. ])
  1667. ],
  1668. ["normal", new Set(["allow-discrete", "normal"])]
  1669. ])
  1670. ]
  1671. ]);
  1672. // Each `font-stretch` keyword -> the percentage it names, which is the same
  1673. // value in fewer bytes.
  1674. const FONT_STRETCH_PERCENTAGES = new Map([
  1675. ["ultra-condensed", "50%"],
  1676. ["extra-condensed", "62.5%"],
  1677. ["condensed", "75%"],
  1678. ["semi-condensed", "87.5%"],
  1679. ["normal", "100%"],
  1680. ["semi-expanded", "112.5%"],
  1681. ["expanded", "125%"],
  1682. ["extra-expanded", "150%"],
  1683. ["ultra-expanded", "200%"]
  1684. ]);
  1685. // Each `<filter-function>` with an optional argument -> the amount an omitted
  1686. // one means, which is what writing that amount already says.
  1687. const FILTER_FUNCTION_OMITTED = new Map([
  1688. ["blur", "0"],
  1689. ["brightness", "1"],
  1690. ["contrast", "1"],
  1691. ["grayscale", "1"],
  1692. ["hue-rotate", "0"],
  1693. ["invert", "1"],
  1694. ["opacity", "1"],
  1695. ["saturate", "1"],
  1696. ["sepia", "1"]
  1697. ]);
  1698. // The generic font families: an unquoted one of these names the generic rather
  1699. // than a family called that, so a quoted family spelled like one keeps its quotes.
  1700. const GENERIC_FONT_FAMILIES = new Set([
  1701. "cursive",
  1702. "emoji",
  1703. "fangsong",
  1704. "fantasy",
  1705. "math",
  1706. "monospace",
  1707. "sans-serif",
  1708. "serif",
  1709. "system-ui",
  1710. "ui-monospace",
  1711. "ui-rounded",
  1712. "ui-sans-serif",
  1713. "ui-serif"
  1714. ]);
  1715. // The `font` size slot's keywords: `<absolute-size>` and `<relative-size>`.
  1716. const FONT_SIZE_KEYWORDS = new Set([
  1717. "large",
  1718. "larger",
  1719. "medium",
  1720. "small",
  1721. "smaller",
  1722. "x-large",
  1723. "x-small",
  1724. "xx-large",
  1725. "xx-small",
  1726. "xxx-large"
  1727. ]);
  1728. // The `<easing-function>` spellings that are a keyword rather than a function.
  1729. const EASING_KEYWORDS = new Set([
  1730. "ease",
  1731. "ease-in",
  1732. "ease-in-out",
  1733. "ease-out",
  1734. "linear",
  1735. "step-end",
  1736. "step-start"
  1737. ]);
  1738. // What `transition-behavior` accepts, the slot of a `transition` that is
  1739. // neither a time, an easing nor the property name.
  1740. const TRANSITION_BEHAVIORS = new Set(["allow-discrete", "normal"]);
  1741. // The linear gradients, whose flow a `<side-or-corner>` or angle states.
  1742. const LINEAR_GRADIENTS = new Set([
  1743. "linear-gradient",
  1744. "repeating-linear-gradient"
  1745. ]);
  1746. // A size whose omitted second value is `auto`, not the first repeated.
  1747. const AUTO_SECOND_VALUE_PROPERTIES = new Set(["background-size", "mask-size"]);
  1748. // The direction each unprefixed linear gradient already starts from. A
  1749. // `-webkit-` one measures its angle the other way, so it keeps what it says.
  1750. const DEFAULT_GRADIENT_DIRECTIONS = new Set(["to bottom", "180deg", "0.5turn"]);
  1751. // A name CSS matches ASCII case-insensitively but spells with a capital ->
  1752. // that spelling, so lowercasing a name normalizes its case without printing
  1753. // `translatey` or `1q` for what everything else writes `translateY` and `1Q`.
  1754. const CANONICAL_NAMES = new Map([
  1755. ["hz", "Hz"],
  1756. ["khz", "kHz"],
  1757. ["q", "Q"],
  1758. ["rotatex", "rotateX"],
  1759. ["rotatey", "rotateY"],
  1760. ["rotatez", "rotateZ"],
  1761. ["scalex", "scaleX"],
  1762. ["scaley", "scaleY"],
  1763. ["scalez", "scaleZ"],
  1764. ["skewx", "skewX"],
  1765. ["skewy", "skewY"],
  1766. ["translatex", "translateX"],
  1767. ["translatey", "translateY"],
  1768. ["translatez", "translateZ"]
  1769. ]);
  1770. // A transform along x only -> the pair spelling whose second component is the
  1771. // 0 the one-axis call already means.
  1772. const X_AXIS_TRANSFORMS = new Map([
  1773. ["translatex", "translate"],
  1774. ["skewx", "skew"]
  1775. ]);
  1776. // Each gradient function -> the positions its last color stop already means, so
  1777. // writing one of them there says nothing (CSS Images 3 §3.4.3).
  1778. const GRADIENT_LAST_POSITIONS = new Map([
  1779. ["conic-gradient", new Set(["100%", "360deg", "1turn"])],
  1780. ["linear-gradient", new Set(["100%"])],
  1781. ["radial-gradient", new Set(["100%"])],
  1782. ["repeating-conic-gradient", new Set(["100%", "360deg", "1turn"])],
  1783. ["repeating-linear-gradient", new Set(["100%"])],
  1784. ["repeating-radial-gradient", new Set(["100%"])]
  1785. ]);
  1786. // The properties whose value is a position, where each edge keyword names the
  1787. // percentage that axis resolves to.
  1788. const POSITION_PROPERTIES = new Set([
  1789. "-webkit-mask-position",
  1790. "background-position",
  1791. "mask-position",
  1792. "object-position",
  1793. "offset-anchor",
  1794. "offset-position",
  1795. "perspective-origin",
  1796. "scroll-snap-coordinate",
  1797. "scroll-snap-destination",
  1798. "transform-origin"
  1799. ]);
  1800. // Each keyword one axis of a `<position>` accepts -> the percentage it resolves
  1801. // to. A keyword both maps carry (`center`) names whichever axis is still free,
  1802. // and every free axis is `50%` anyway.
  1803. const POSITION_X_KEYWORDS = new Map([
  1804. ["center", "50%"],
  1805. ["left", "0%"],
  1806. ["right", "100%"]
  1807. ]);
  1808. const POSITION_Y_KEYWORDS = new Map([
  1809. ["bottom", "100%"],
  1810. ["center", "50%"],
  1811. ["top", "0%"]
  1812. ]);
  1813. // The keywords one `<repeat-style>` axis can be: a pair only collapses where
  1814. // both halves are one of these.
  1815. const REPEAT_STYLE_KEYWORDS = new Set([
  1816. "no-repeat",
  1817. "repeat",
  1818. "round",
  1819. "space"
  1820. ]);
  1821. // The properties whose value is a `<repeat-style>`, where one value already
  1822. // says what two equal ones do.
  1823. const REPEAT_STYLE_PROPERTIES = new Set([
  1824. "-webkit-mask",
  1825. "-webkit-mask-repeat",
  1826. "background",
  1827. "background-repeat",
  1828. "mask",
  1829. "mask-repeat"
  1830. ]);
  1831. // Each property whose initial value is a keyword shorter than `initial` -> that
  1832. // keyword, which is the same declaration written in fewer bytes.
  1833. const INITIAL_VALUE_KEYWORDS = new Map([
  1834. ["-moz-binding", "none"],
  1835. ["-moz-border-bottom-colors", "none"],
  1836. ["-moz-border-left-colors", "none"],
  1837. ["-moz-border-right-colors", "none"],
  1838. ["-moz-border-top-colors", "none"],
  1839. ["-moz-context-properties", "none"],
  1840. ["-moz-orient", "inline"],
  1841. ["-moz-text-blink", "none"],
  1842. ["-moz-user-focus", "none"],
  1843. ["-moz-user-input", "auto"],
  1844. ["-moz-window-dragging", "drag"],
  1845. ["-ms-accelerator", "false"],
  1846. ["-ms-block-progression", "tb"],
  1847. ["-ms-content-zoom-chaining", "none"],
  1848. ["-ms-content-zoom-snap-type", "none"],
  1849. ["-ms-flow-from", "none"],
  1850. ["-ms-flow-into", "none"],
  1851. ["-ms-grid-columns", "none"],
  1852. ["-ms-grid-rows", "none"],
  1853. ["-ms-high-contrast-adjust", "auto"],
  1854. ["-ms-hyphenate-limit-chars", "auto"],
  1855. ["-ms-ime-align", "auto"],
  1856. ["-ms-overflow-style", "auto"],
  1857. ["-ms-scroll-limit-x-max", "auto"],
  1858. ["-ms-scroll-limit-y-max", "auto"],
  1859. ["-ms-scroll-rails", "railed"],
  1860. ["-ms-scroll-snap-type", "none"],
  1861. ["-ms-scroll-translation", "none"],
  1862. ["-ms-text-autospace", "none"],
  1863. ["-ms-user-select", "text"],
  1864. ["-ms-wrap-flow", "auto"],
  1865. ["-ms-wrap-through", "wrap"],
  1866. ["-webkit-border-after-style", "none"],
  1867. ["-webkit-border-before-style", "none"],
  1868. ["-webkit-border-end-style", "none"],
  1869. ["-webkit-border-start-style", "none"],
  1870. ["-webkit-line-clamp", "none"],
  1871. ["-webkit-mask-attachment", "scroll"],
  1872. ["-webkit-mask-clip", "border"],
  1873. ["-webkit-mask-image", "none"],
  1874. ["-webkit-mask-repeat", "repeat"],
  1875. ["-webkit-mask-repeat-x", "repeat"],
  1876. ["-webkit-mask-repeat-y", "repeat"],
  1877. ["-webkit-overflow-scrolling", "auto"],
  1878. ["-webkit-user-select", "auto"],
  1879. ["accent-color", "auto"],
  1880. ["align-content", "normal"],
  1881. ["align-items", "normal"],
  1882. ["align-self", "auto"],
  1883. ["align-tracks", "normal"],
  1884. ["anchor-name", "none"],
  1885. ["anchor-scope", "none"],
  1886. ["animation-direction", "normal"],
  1887. ["animation-fill-mode", "none"],
  1888. ["animation-name", "none"],
  1889. ["animation-range-end", "normal"],
  1890. ["animation-range-start", "normal"],
  1891. ["animation-timeline", "auto"],
  1892. ["animation-timing-function", "ease"],
  1893. ["animation-trigger", "none"],
  1894. ["appearance", "none"],
  1895. ["aspect-ratio", "auto"],
  1896. ["backdrop-filter", "none"],
  1897. ["background-attachment", "scroll"],
  1898. ["background-blend-mode", "normal"],
  1899. ["background-image", "none"],
  1900. ["background-repeat", "repeat"],
  1901. ["baseline-source", "auto"],
  1902. ["block-size", "auto"],
  1903. ["border-block-end-style", "none"],
  1904. ["border-block-start-style", "none"],
  1905. ["border-bottom-style", "none"],
  1906. ["border-image-source", "none"],
  1907. ["border-inline-end-style", "none"],
  1908. ["border-inline-start-style", "none"],
  1909. ["border-left-style", "none"],
  1910. ["border-right-style", "none"],
  1911. ["border-shape", "none"],
  1912. ["border-top-style", "none"],
  1913. ["bottom", "auto"],
  1914. ["box-decoration-break", "slice"],
  1915. ["box-direction", "normal"],
  1916. ["box-lines", "single"],
  1917. ["box-pack", "start"],
  1918. ["box-shadow", "none"],
  1919. ["break-after", "auto"],
  1920. ["break-before", "auto"],
  1921. ["break-inside", "auto"],
  1922. ["caption-side", "top"],
  1923. ["caret-animation", "auto"],
  1924. ["caret-color", "auto"],
  1925. ["caret-shape", "auto"],
  1926. ["clear", "none"],
  1927. ["clip", "auto"],
  1928. ["clip-path", "none"],
  1929. ["color-scheme", "normal"],
  1930. ["column-count", "auto"],
  1931. ["column-gap", "normal"],
  1932. ["column-height", "auto"],
  1933. ["column-rule-style", "none"],
  1934. ["column-span", "none"],
  1935. ["column-width", "auto"],
  1936. ["column-wrap", "auto"],
  1937. ["contain", "none"],
  1938. ["contain-intrinsic-block-size", "none"],
  1939. ["contain-intrinsic-height", "none"],
  1940. ["contain-intrinsic-inline-size", "none"],
  1941. ["contain-intrinsic-width", "none"],
  1942. ["container-name", "none"],
  1943. ["container-type", "normal"],
  1944. ["content", "normal"],
  1945. ["corner-bottom-left-shape", "round"],
  1946. ["corner-bottom-right-shape", "round"],
  1947. ["corner-end-end-shape", "round"],
  1948. ["corner-end-start-shape", "round"],
  1949. ["corner-start-end-shape", "round"],
  1950. ["corner-start-start-shape", "round"],
  1951. ["corner-top-left-shape", "round"],
  1952. ["corner-top-right-shape", "round"],
  1953. ["counter-increment", "none"],
  1954. ["counter-reset", "none"],
  1955. ["counter-set", "none"],
  1956. ["cursor", "auto"],
  1957. ["d", "none"],
  1958. ["direction", "ltr"],
  1959. ["display", "inline"],
  1960. ["dominant-baseline", "auto"],
  1961. ["empty-cells", "show"],
  1962. ["field-sizing", "fixed"],
  1963. ["filter", "none"],
  1964. ["flex-basis", "auto"],
  1965. ["flex-direction", "row"],
  1966. ["flex-wrap", "nowrap"],
  1967. ["float", "none"],
  1968. ["font-feature-settings", "normal"],
  1969. ["font-kerning", "auto"],
  1970. ["font-language-override", "normal"],
  1971. ["font-optical-sizing", "auto"],
  1972. ["font-palette", "normal"],
  1973. ["font-size-adjust", "none"],
  1974. ["font-smooth", "auto"],
  1975. ["font-stretch", "normal"],
  1976. ["font-style", "normal"],
  1977. ["font-synthesis-position", "none"],
  1978. ["font-synthesis-small-caps", "auto"],
  1979. ["font-synthesis-style", "auto"],
  1980. ["font-synthesis-weight", "auto"],
  1981. ["font-variant", "normal"],
  1982. ["font-variant-alternates", "normal"],
  1983. ["font-variant-caps", "normal"],
  1984. ["font-variant-east-asian", "normal"],
  1985. ["font-variant-emoji", "normal"],
  1986. ["font-variant-ligatures", "normal"],
  1987. ["font-variant-numeric", "normal"],
  1988. ["font-variant-position", "normal"],
  1989. ["font-variation-settings", "normal"],
  1990. ["font-weight", "normal"],
  1991. ["font-width", "normal"],
  1992. ["forced-color-adjust", "auto"],
  1993. ["frame-sizing", "auto"],
  1994. ["grid-auto-columns", "auto"],
  1995. ["grid-auto-flow", "row"],
  1996. ["grid-auto-rows", "auto"],
  1997. ["grid-column-end", "auto"],
  1998. ["grid-column-start", "auto"],
  1999. ["grid-row-end", "auto"],
  2000. ["grid-row-start", "auto"],
  2001. ["grid-template-areas", "none"],
  2002. ["grid-template-columns", "none"],
  2003. ["grid-template-rows", "none"],
  2004. ["hanging-punctuation", "none"],
  2005. ["height", "auto"],
  2006. ["hyphenate-character", "auto"],
  2007. ["hyphenate-limit-chars", "auto"],
  2008. ["hyphens", "manual"],
  2009. ["image-rendering", "auto"],
  2010. ["ime-mode", "auto"],
  2011. ["initial-letter", "normal"],
  2012. ["initial-letter-align", "auto"],
  2013. ["inline-size", "auto"],
  2014. ["inset-block-end", "auto"],
  2015. ["inset-block-start", "auto"],
  2016. ["inset-inline-end", "auto"],
  2017. ["inset-inline-start", "auto"],
  2018. ["interactivity", "auto"],
  2019. ["interest-delay-end", "normal"],
  2020. ["interest-delay-start", "normal"],
  2021. ["isolation", "auto"],
  2022. ["justify-content", "normal"],
  2023. ["justify-items", "legacy"],
  2024. ["justify-self", "auto"],
  2025. ["justify-tracks", "normal"],
  2026. ["left", "auto"],
  2027. ["letter-spacing", "normal"],
  2028. ["line-break", "auto"],
  2029. ["line-clamp", "none"],
  2030. ["line-height", "normal"],
  2031. ["link-parameters", "none"],
  2032. ["list-style-image", "none"],
  2033. ["margin-trim", "none"],
  2034. ["marker-end", "none"],
  2035. ["marker-mid", "none"],
  2036. ["marker-start", "none"],
  2037. ["mask-border-mode", "alpha"],
  2038. ["mask-border-source", "none"],
  2039. ["mask-border-width", "auto"],
  2040. ["mask-composite", "add"],
  2041. ["mask-image", "none"],
  2042. ["mask-repeat", "repeat"],
  2043. ["mask-size", "auto"],
  2044. ["masonry-auto-flow", "pack"],
  2045. ["math-shift", "normal"],
  2046. ["math-style", "normal"],
  2047. ["max-block-size", "none"],
  2048. ["max-height", "none"],
  2049. ["max-inline-size", "none"],
  2050. ["max-lines", "none"],
  2051. ["max-width", "none"],
  2052. ["min-height", "auto"],
  2053. ["min-width", "auto"],
  2054. ["mix-blend-mode", "normal"],
  2055. ["object-fit", "fill"],
  2056. ["object-view-box", "none"],
  2057. ["offset-anchor", "auto"],
  2058. ["offset-path", "none"],
  2059. ["offset-position", "normal"],
  2060. ["offset-rotate", "auto"],
  2061. ["outline-color", "auto"],
  2062. ["outline-style", "none"],
  2063. ["overflow-anchor", "auto"],
  2064. ["overflow-block", "auto"],
  2065. ["overflow-inline", "auto"],
  2066. ["overflow-wrap", "normal"],
  2067. ["overlay", "none"],
  2068. ["overscroll-behavior", "auto"],
  2069. ["overscroll-behavior-block", "auto"],
  2070. ["overscroll-behavior-inline", "auto"],
  2071. ["overscroll-behavior-x", "auto"],
  2072. ["overscroll-behavior-y", "auto"],
  2073. ["page", "auto"],
  2074. ["page-break-after", "auto"],
  2075. ["page-break-before", "auto"],
  2076. ["page-break-inside", "auto"],
  2077. ["paint-order", "normal"],
  2078. ["path-length", "none"],
  2079. ["perspective", "none"],
  2080. ["pointer-events", "auto"],
  2081. ["position", "static"],
  2082. ["position-anchor", "normal"],
  2083. ["position-area", "none"],
  2084. ["position-try-fallbacks", "none"],
  2085. ["position-try-order", "normal"],
  2086. ["reading-flow", "normal"],
  2087. ["resize", "none"],
  2088. ["right", "auto"],
  2089. ["rotate", "none"],
  2090. ["row-gap", "normal"],
  2091. ["ruby-overhang", "auto"],
  2092. ["rx", "auto"],
  2093. ["ry", "auto"],
  2094. ["scale", "none"],
  2095. ["scroll-behavior", "auto"],
  2096. ["scroll-initial-target", "none"],
  2097. ["scroll-marker-group", "none"],
  2098. ["scroll-padding-block-end", "auto"],
  2099. ["scroll-padding-block-start", "auto"],
  2100. ["scroll-padding-bottom", "auto"],
  2101. ["scroll-padding-inline-end", "auto"],
  2102. ["scroll-padding-inline-start", "auto"],
  2103. ["scroll-padding-left", "auto"],
  2104. ["scroll-padding-right", "auto"],
  2105. ["scroll-padding-top", "auto"],
  2106. ["scroll-snap-align", "none"],
  2107. ["scroll-snap-coordinate", "none"],
  2108. ["scroll-snap-points-x", "none"],
  2109. ["scroll-snap-points-y", "none"],
  2110. ["scroll-snap-stop", "normal"],
  2111. ["scroll-snap-type", "none"],
  2112. ["scroll-snap-type-x", "none"],
  2113. ["scroll-snap-type-y", "none"],
  2114. ["scroll-target-group", "none"],
  2115. ["scroll-timeline-axis", "block"],
  2116. ["scroll-timeline-name", "none"],
  2117. ["scrollbar-color", "auto"],
  2118. ["scrollbar-gutter", "auto"],
  2119. ["scrollbar-width", "auto"],
  2120. ["shape-outside", "none"],
  2121. ["shape-rendering", "auto"],
  2122. ["stroke-dasharray", "none"],
  2123. ["stroke-linecap", "butt"],
  2124. ["stroke-linejoin", "miter"],
  2125. ["table-layout", "auto"],
  2126. ["text-align", "start"],
  2127. ["text-align-last", "auto"],
  2128. ["text-anchor", "start"],
  2129. ["text-autospace", "normal"],
  2130. ["text-box", "normal"],
  2131. ["text-box-edge", "auto"],
  2132. ["text-box-trim", "none"],
  2133. ["text-combine-upright", "none"],
  2134. ["text-decoration-line", "none"],
  2135. ["text-decoration-skip-ink", "auto"],
  2136. ["text-decoration-style", "solid"],
  2137. ["text-decoration-thickness", "auto"],
  2138. ["text-emphasis-position", "auto"],
  2139. ["text-emphasis-style", "none"],
  2140. ["text-fit", "none"],
  2141. ["text-justify", "auto"],
  2142. ["text-orientation", "mixed"],
  2143. ["text-overflow", "clip"],
  2144. ["text-rendering", "auto"],
  2145. ["text-shadow", "none"],
  2146. ["text-spacing-trim", "normal"],
  2147. ["text-transform", "none"],
  2148. ["text-underline-offset", "auto"],
  2149. ["text-underline-position", "auto"],
  2150. ["text-wrap", "wrap"],
  2151. ["text-wrap-mode", "wrap"],
  2152. ["text-wrap-style", "auto"],
  2153. ["timeline-scope", "none"],
  2154. ["timeline-trigger-activation-range-end", "normal"],
  2155. ["timeline-trigger-activation-range-start", "normal"],
  2156. ["timeline-trigger-active-range-end", "auto"],
  2157. ["timeline-trigger-active-range-start", "auto"],
  2158. ["timeline-trigger-name", "none"],
  2159. ["timeline-trigger-source", "auto"],
  2160. ["top", "auto"],
  2161. ["touch-action", "auto"],
  2162. ["transform", "none"],
  2163. ["transform-style", "flat"],
  2164. ["transition-behavior", "normal"],
  2165. ["transition-property", "all"],
  2166. ["transition-timing-function", "ease"],
  2167. ["translate", "none"],
  2168. ["trigger-scope", "none"],
  2169. ["unicode-bidi", "normal"],
  2170. ["user-select", "auto"],
  2171. ["vector-effect", "none"],
  2172. ["view-timeline-axis", "block"],
  2173. ["view-timeline-inset", "auto"],
  2174. ["view-timeline-name", "none"],
  2175. ["view-transition-class", "none"],
  2176. ["view-transition-name", "none"],
  2177. ["view-transition-scope", "none"],
  2178. ["white-space", "normal"],
  2179. ["width", "auto"],
  2180. ["will-change", "auto"],
  2181. ["word-break", "normal"],
  2182. ["word-spacing", "normal"],
  2183. ["word-wrap", "normal"],
  2184. ["z-index", "auto"]
  2185. ]);
  2186. // Each named color a shorter spelling beats -> that spelling, so a name written
  2187. // where a color is unambiguous prints as the shortest text for the same value.
  2188. const COLOR_NAME_TO_SHORTEST = new Map([
  2189. ["aliceblue", "#f0f8ff"],
  2190. ["antiquewhite", "#faebd7"],
  2191. ["aquamarine", "#7fffd4"],
  2192. ["black", "#000"],
  2193. ["blanchedalmond", "#ffebcd"],
  2194. ["blueviolet", "#8a2be2"],
  2195. ["burlywood", "#deb887"],
  2196. ["cadetblue", "#5f9ea0"],
  2197. ["chartreuse", "#7fff00"],
  2198. ["chocolate", "#d2691e"],
  2199. ["cornflowerblue", "#6495ed"],
  2200. ["cornsilk", "#fff8dc"],
  2201. ["darkblue", "#00008b"],
  2202. ["darkcyan", "#008b8b"],
  2203. ["darkgoldenrod", "#b8860b"],
  2204. ["darkgray", "#a9a9a9"],
  2205. ["darkgreen", "#006400"],
  2206. ["darkgrey", "#a9a9a9"],
  2207. ["darkkhaki", "#bdb76b"],
  2208. ["darkmagenta", "#8b008b"],
  2209. ["darkolivegreen", "#556b2f"],
  2210. ["darkorange", "#ff8c00"],
  2211. ["darkorchid", "#9932cc"],
  2212. ["darksalmon", "#e9967a"],
  2213. ["darkseagreen", "#8fbc8f"],
  2214. ["darkslateblue", "#483d8b"],
  2215. ["darkslategray", "#2f4f4f"],
  2216. ["darkslategrey", "#2f4f4f"],
  2217. ["darkturquoise", "#00ced1"],
  2218. ["darkviolet", "#9400d3"],
  2219. ["deeppink", "#ff1493"],
  2220. ["deepskyblue", "#00bfff"],
  2221. ["dodgerblue", "#1e90ff"],
  2222. ["firebrick", "#b22222"],
  2223. ["floralwhite", "#fffaf0"],
  2224. ["forestgreen", "#228b22"],
  2225. ["fuchsia", "#f0f"],
  2226. ["gainsboro", "#dcdcdc"],
  2227. ["ghostwhite", "#f8f8ff"],
  2228. ["goldenrod", "#daa520"],
  2229. ["greenyellow", "#adff2f"],
  2230. ["honeydew", "#f0fff0"],
  2231. ["indianred", "#cd5c5c"],
  2232. ["lavender", "#e6e6fa"],
  2233. ["lavenderblush", "#fff0f5"],
  2234. ["lawngreen", "#7cfc00"],
  2235. ["lemonchiffon", "#fffacd"],
  2236. ["lightblue", "#add8e6"],
  2237. ["lightcoral", "#f08080"],
  2238. ["lightcyan", "#e0ffff"],
  2239. ["lightgoldenrodyellow", "#fafad2"],
  2240. ["lightgray", "#d3d3d3"],
  2241. ["lightgreen", "#90ee90"],
  2242. ["lightgrey", "#d3d3d3"],
  2243. ["lightpink", "#ffb6c1"],
  2244. ["lightsalmon", "#ffa07a"],
  2245. ["lightseagreen", "#20b2aa"],
  2246. ["lightskyblue", "#87cefa"],
  2247. ["lightslategray", "#789"],
  2248. ["lightslategrey", "#789"],
  2249. ["lightsteelblue", "#b0c4de"],
  2250. ["lightyellow", "#ffffe0"],
  2251. ["limegreen", "#32cd32"],
  2252. ["magenta", "#f0f"],
  2253. ["mediumaquamarine", "#66cdaa"],
  2254. ["mediumblue", "#0000cd"],
  2255. ["mediumorchid", "#ba55d3"],
  2256. ["mediumpurple", "#9370db"],
  2257. ["mediumseagreen", "#3cb371"],
  2258. ["mediumslateblue", "#7b68ee"],
  2259. ["mediumspringgreen", "#00fa9a"],
  2260. ["mediumturquoise", "#48d1cc"],
  2261. ["mediumvioletred", "#c71585"],
  2262. ["midnightblue", "#191970"],
  2263. ["mintcream", "#f5fffa"],
  2264. ["mistyrose", "#ffe4e1"],
  2265. ["moccasin", "#ffe4b5"],
  2266. ["navajowhite", "#ffdead"],
  2267. ["olivedrab", "#6b8e23"],
  2268. ["orangered", "#ff4500"],
  2269. ["palegoldenrod", "#eee8aa"],
  2270. ["palegreen", "#98fb98"],
  2271. ["paleturquoise", "#afeeee"],
  2272. ["palevioletred", "#db7093"],
  2273. ["papayawhip", "#ffefd5"],
  2274. ["peachpuff", "#ffdab9"],
  2275. ["powderblue", "#b0e0e6"],
  2276. ["rebeccapurple", "#639"],
  2277. ["rosybrown", "#bc8f8f"],
  2278. ["royalblue", "#4169e1"],
  2279. ["saddlebrown", "#8b4513"],
  2280. ["sandybrown", "#f4a460"],
  2281. ["seagreen", "#2e8b57"],
  2282. ["seashell", "#fff5ee"],
  2283. ["slateblue", "#6a5acd"],
  2284. ["slategray", "#708090"],
  2285. ["slategrey", "#708090"],
  2286. ["springgreen", "#00ff7f"],
  2287. ["steelblue", "#4682b4"],
  2288. ["turquoise", "#40e0d0"],
  2289. ["white", "#fff"],
  2290. ["whitesmoke", "#f5f5f5"],
  2291. ["yellow", "#ff0"],
  2292. ["yellowgreen", "#9acd32"]
  2293. ]);
  2294. // The functions whose argument is a selector, so a `>` / `+` / `~` inside one
  2295. // is a combinator and needs no whitespace around it.
  2296. const SELECTOR_FUNCTIONS = new Set([
  2297. "cue",
  2298. "element",
  2299. "has",
  2300. "host",
  2301. "host-context",
  2302. "is",
  2303. "not",
  2304. "nth-child",
  2305. "nth-last-child",
  2306. "selector",
  2307. "slotted",
  2308. "where"
  2309. ]);
  2310. // The functions every argument of which is an angle, so a zero one needs no
  2311. // unit wherever it stands.
  2312. const ZERO_ANGLE_FUNCTIONS = new Set([
  2313. "hue-rotate",
  2314. "rotate",
  2315. "rotatex",
  2316. "rotatey",
  2317. "rotatez",
  2318. "skew",
  2319. "skewx",
  2320. "skewy"
  2321. ]);
  2322. // CSS Values 4's math functions: everything inside one is a math expression, so
  2323. // `*` and `/` there are operators, and the whitespace around them carries nothing.
  2324. const MATH_FUNCTIONS = new Set([
  2325. "abs",
  2326. "acos",
  2327. "asin",
  2328. "atan",
  2329. "atan2",
  2330. "calc",
  2331. "calc-size",
  2332. "clamp",
  2333. "cos",
  2334. "exp",
  2335. "hypot",
  2336. "log",
  2337. "max",
  2338. "min",
  2339. "mod",
  2340. "pow",
  2341. "rem",
  2342. "round",
  2343. "sign",
  2344. "sin",
  2345. "sqrt",
  2346. "tan"
  2347. ]);
  2348. // How many `<calc-sum>` arguments each of them takes, off its own grammar. A
  2349. // function whose arguments are not all expressions (`round()` leads with a
  2350. // strategy, `calc-size()` with a basis) is absent, and absence is what the
  2351. // folding reads as "leave this one alone".
  2352. /** @type {Map<string, [number, number]>} */
  2353. const MATH_FUNCTION_ARITY = new Map([
  2354. ["abs", [1, 1]],
  2355. ["acos", [1, 1]],
  2356. ["asin", [1, 1]],
  2357. ["atan", [1, 1]],
  2358. ["atan2", [2, 2]],
  2359. ["calc", [1, 1]],
  2360. ["clamp", [3, 3]],
  2361. ["cos", [1, 1]],
  2362. ["exp", [1, 1]],
  2363. ["hypot", [1, Infinity]],
  2364. ["log", [1, 2]],
  2365. ["max", [1, Infinity]],
  2366. ["min", [1, Infinity]],
  2367. ["mod", [2, 2]],
  2368. ["pow", [2, 2]],
  2369. ["rem", [2, 2]],
  2370. ["round", [2, 2]],
  2371. ["sign", [1, 1]],
  2372. ["sin", [1, 1]],
  2373. ["sqrt", [1, 1]],
  2374. ["tan", [1, 1]]
  2375. ]);
  2376. // The optional keyword a math function may lead with, for the ones whose
  2377. // grammar offers a choice of them (`round( <rounding-strategy>?, … )`). Read
  2378. // off that production, so a strategy joining it needs no edit here.
  2379. /** @type {Map<string, string[]>} */
  2380. const MATH_FUNCTION_KEYWORDS = new Map([
  2381. ["round", ["down", "nearest", "to-zero", "up"]]
  2382. ]);
  2383. // Where a function the fold cannot read as a whole still takes a `<calc-sum>`,
  2384. // so that argument reduces on its own. Keyed by name to the argument positions.
  2385. /** @type {Map<string, number[]>} */
  2386. const MATH_FUNCTION_SUM_ARGUMENTS = new Map([["calc-size", [1]]]);
  2387. // A CSS-wide keyword is only valid as the whole value, so a box repeating one is
  2388. // invalid and already discarded — collapsing it would switch the declaration on.
  2389. const CSS_WIDE_KEYWORDS = new Set([
  2390. "inherit",
  2391. "initial",
  2392. "revert",
  2393. "revert-layer",
  2394. "unset"
  2395. ]);
  2396. // `<easing-function>` argument lists that are exactly a shorter keyword, keyed
  2397. // by the arguments as `Number` prints them.
  2398. const CUBIC_BEZIER_KEYWORDS = new Map([
  2399. ["0.25,0.1,0.25,1", "ease"],
  2400. ["0,0,1,1", "linear"],
  2401. ["0.42,0,1,1", "ease-in"],
  2402. ["0,0,0.58,1", "ease-out"],
  2403. ["0.42,0,0.58,1", "ease-in-out"]
  2404. ]);
  2405. // The two `flex` values CSS Flexbox 7.1.1 gives a keyword spelling.
  2406. const FLEX_KEYWORDS = new Map([
  2407. ["0 0 auto", "none"],
  2408. ["1 1 auto", "auto"]
  2409. ]);
  2410. // The `font-weight` keywords CSS Fonts 4 §2.2 defines as a number, which is what
  2411. // `getComputedStyle().fontWeight` reports either way.
  2412. const FONT_WEIGHT_NUMBERS = new Map([
  2413. ["normal", "400"],
  2414. ["bold", "700"]
  2415. ]);
  2416. // Selectors 4 §3.3: the pseudo-elements engines must also accept with one colon,
  2417. // so their second colon carries nothing.
  2418. const LEGACY_PSEUDO_ELEMENTS = new Set([
  2419. "before",
  2420. "after",
  2421. "first-line",
  2422. "first-letter"
  2423. ]);
  2424. // What may follow the `*` a compound selector implies: another simple selector
  2425. // in the same compound. A separator between them would be a descendant
  2426. // combinator instead, and `|` makes the `*` a namespace's, not a redundant one.
  2427. const COMPOUND_CONTINUATIONS = new Set([":", ".", "#", "["]);
  2428. // The pseudo-classes selecting a featureless element, which matches no type or
  2429. // universal selector — so an implied `*` before one is what makes the selector
  2430. // match nothing, and dropping it would bring the rule to life.
  2431. const FEATURELESS_PSEUDO_CLASSES = new Set(["host", "host-context"]);
  2432. // The properties whose zero length keeps its unit: those whose own grammar
  2433. // offers a bare number beside the length, so the unit is what picks the
  2434. // reading, and the two an engine reads its own way.
  2435. const ZERO_UNIT_KEEPING_PROPERTIES = new Set([
  2436. "border-image",
  2437. "border-image-outset",
  2438. "border-image-width",
  2439. "columns",
  2440. "flex",
  2441. "flex-basis",
  2442. "font",
  2443. "line-height",
  2444. "mask-border",
  2445. "mask-border-outset",
  2446. "mask-border-width",
  2447. "overflow-clip-margin",
  2448. "stroke-dasharray",
  2449. "stroke-dashoffset",
  2450. "stroke-width",
  2451. "tab-size"
  2452. ]);
  2453. // The properties an engine takes no `calc()` in, so one stays as written
  2454. // rather than folding to the value it equals.
  2455. const CALC_REJECTING_PROPERTIES = new Set(["overflow-clip-margin"]);
  2456. // The range a `calc()` is clamped to where the literal outside it is invalid,
  2457. // keyed by property: `[unit, min, max]`.
  2458. /** @type {Map<string, [string, number, number]>} */
  2459. const CLAMPED_VALUE_RANGES = new Map([["font-style", ["deg", -90, 90]]]);
  2460. // At-rules whose empty block is inert, so dropping it changes nothing.
  2461. const DROPPABLE_WHEN_EMPTY_AT_RULES = new Set([
  2462. "media",
  2463. "supports",
  2464. "container"
  2465. ]);
  2466. // At-rules whose block holds rules and whose prelude states a condition, so two
  2467. // adjacent blocks with the same prelude are the one block they resolve to.
  2468. const MERGEABLE_AT_RULES = new Set([
  2469. "container",
  2470. "document",
  2471. "layer",
  2472. "media",
  2473. "scope",
  2474. "starting-style",
  2475. "supports"
  2476. ]);
  2477. // The math functions whose result steps with their arguments, so a value inside
  2478. // one keeps the unit and the digits it was written with.
  2479. const STEPPED_FUNCTIONS = new Set(["mod", "rem", "round"]);
  2480. // The units fixed against each other (CSS Values 4 §6.2, §8), as
  2481. // `unit -> [group, how many of the group's base unit one is]`. Two units in the
  2482. // same group convert into each other exactly when the ratio is binary-exact.
  2483. /** @type {Map<string, [string, number]>} */
  2484. const ABSOLUTE_UNIT_SCALE = new Map([
  2485. ["px", ["length", 381]],
  2486. ["pc", ["length", 6096]],
  2487. ["pt", ["length", 508]],
  2488. ["in", ["length", 36576]],
  2489. ["cm", ["length", 14400]],
  2490. ["mm", ["length", 1440]],
  2491. ["q", ["length", 360]],
  2492. ["ms", ["time", 1]],
  2493. ["s", ["time", 1000]]
  2494. ]);
  2495. // Each convertible group's reference unit, as `group -> [unit, scale]`. A sum
  2496. // counted in the group's base unit divides by the scale to get back to a unit
  2497. // that can be written down.
  2498. /** @type {Map<string, [string, number]>} */
  2499. const UNIT_GROUP_BASE = new Map([
  2500. ["length", ["px", 381]],
  2501. ["time", ["ms", 1]]
  2502. ]);
  2503. // The units a conversion may emit. Every one is CSS 2.1's, so rewriting into it
  2504. // cannot outrun what an engine reading the stylesheet already parses.
  2505. const UNIT_CONVERSION_TARGETS = new Set([
  2506. "px",
  2507. "pc",
  2508. "pt",
  2509. "in",
  2510. "cm",
  2511. "mm",
  2512. "ms",
  2513. "s"
  2514. ]);
  2515. // The angle units. Excluded from rounding: `rotate()` runs its argument through
  2516. // trig, which turns a truncated digit into a different computed matrix.
  2517. const ANGLE_UNITS = new Set(["deg", "grad", "rad", "turn"]);
  2518. // A quarter turn in each unit that spells it exactly (CSS Values 4 §8.1), as
  2519. // `unit -> the count`. The trig functions are folded only where their argument
  2520. // is a whole number of these, which is where sine and cosine are rational.
  2521. /** @type {Map<string, number>} */
  2522. const QUARTER_TURN_ANGLE = new Map([
  2523. ["deg", 90],
  2524. ["grad", 100],
  2525. ["turn", 0.25]
  2526. ]);
  2527. // Sine, cosine and tangent as `eighth turn from zero -> value`. The eighths
  2528. // where the value is irrational are absent — sine and cosine on the odd ones,
  2529. // tangent on the asymptotes. Cosine is sine a quarter turn along.
  2530. /** @type {Map<number, number>} */
  2531. const EIGHTH_TURN_SINE = new Map([
  2532. [0, 0],
  2533. [2, 1],
  2534. [4, 0],
  2535. [6, -1]
  2536. ]);
  2537. /** @type {Map<number, number>} */
  2538. const EIGHTH_TURN_COSINE = new Map([
  2539. [0, 1],
  2540. [2, 0],
  2541. [4, -1],
  2542. [6, 0]
  2543. ]);
  2544. /** @type {Map<number, number>} */
  2545. const EIGHTH_TURN_TANGENT = new Map([
  2546. [0, 0],
  2547. [1, 1],
  2548. [3, -1],
  2549. [4, 0],
  2550. [5, 1],
  2551. [7, -1]
  2552. ]);
  2553. // What each inverse trig function answers, as `argument -> degrees`, by
  2554. // inverting the table above it over that function's principal branch. Every
  2555. // other argument is transcendental and leaves the call written out.
  2556. /** @type {Map<number, number>} */
  2557. const ARC_SINE_DEGREES = new Map([
  2558. [-1, -90],
  2559. [0, 0],
  2560. [1, 90]
  2561. ]);
  2562. /** @type {Map<number, number>} */
  2563. const ARC_COSINE_DEGREES = new Map([
  2564. [-1, 180],
  2565. [0, 90],
  2566. [1, 0]
  2567. ]);
  2568. /** @type {Map<number, number>} */
  2569. const ARC_TANGENT_DEGREES = new Map([
  2570. [-1, -45],
  2571. [0, 0],
  2572. [1, 45]
  2573. ]);
  2574. // The reader that needs a table, built once here — `mathPrimitives` knows the
  2575. // arithmetic of an eighth turn but not which units spell one.
  2576. const readEighthTurn = eighthTurnReader(QUARTER_TURN_ANGLE);
  2577. // What folding each math function comes down to, as
  2578. // `name -> { read, apply, result, table }`: how its arguments are read, which
  2579. // arithmetic runs, and the unit the answer carries. `read` and `apply` are the
  2580. // functions themselves, so `lib/css/syntax.js` drives the fold while naming
  2581. // neither a math function nor an arithmetic of its own.
  2582. /** @type {Map<string, { read: MathArgumentReader, apply: MathOperation, result: string, table: Map<number, number> | null }>} */
  2583. const MATH_FUNCTION_FOLD = new Map([
  2584. ["abs", { read: readSameUnit, apply: absolute, result: "same", table: null }],
  2585. [
  2586. "acos",
  2587. {
  2588. read: readNumber,
  2589. apply: lookup,
  2590. result: "deg",
  2591. table: ARC_COSINE_DEGREES
  2592. }
  2593. ],
  2594. [
  2595. "asin",
  2596. { read: readNumber, apply: lookup, result: "deg", table: ARC_SINE_DEGREES }
  2597. ],
  2598. [
  2599. "atan",
  2600. {
  2601. read: readNumber,
  2602. apply: lookup,
  2603. result: "deg",
  2604. table: ARC_TANGENT_DEGREES
  2605. }
  2606. ],
  2607. [
  2608. "atan2",
  2609. { read: readSameUnit, apply: arcTangent2, result: "deg", table: null }
  2610. ],
  2611. ["clamp", { read: readSameUnit, apply: clamp, result: "same", table: null }],
  2612. [
  2613. "cos",
  2614. {
  2615. read: readEighthTurn,
  2616. apply: lookup,
  2617. result: "",
  2618. table: EIGHTH_TURN_COSINE
  2619. }
  2620. ],
  2621. ["exp", { read: readNumber, apply: exponential, result: "", table: null }],
  2622. [
  2623. "hypot",
  2624. { read: readSameUnit, apply: hypotenuse, result: "same", table: null }
  2625. ],
  2626. ["log", { read: readNumber, apply: logarithm, result: "", table: null }],
  2627. ["max", { read: readSameUnit, apply: maximum, result: "same", table: null }],
  2628. ["min", { read: readSameUnit, apply: minimum, result: "same", table: null }],
  2629. ["mod", { read: readSameUnit, apply: modulus, result: "same", table: null }],
  2630. ["pow", { read: readNumber, apply: power, result: "", table: null }],
  2631. [
  2632. "rem",
  2633. { read: readSameUnit, apply: remainder, result: "same", table: null }
  2634. ],
  2635. ["round", { read: readSameUnit, apply: round, result: "same", table: null }],
  2636. ["sign", { read: readSameUnit, apply: sign, result: "", table: null }],
  2637. [
  2638. "sin",
  2639. { read: readEighthTurn, apply: lookup, result: "", table: EIGHTH_TURN_SINE }
  2640. ],
  2641. ["sqrt", { read: readNumber, apply: squareRoot, result: "", table: null }],
  2642. [
  2643. "tan",
  2644. {
  2645. read: readEighthTurn,
  2646. apply: lookup,
  2647. result: "",
  2648. table: EIGHTH_TURN_TANGENT
  2649. }
  2650. ]
  2651. ]);
  2652. // Properties whose grammar can reach an `<integer>`. Deliberately wide: a
  2653. // non-integer where an integer is expected is rounded rather than dropped
  2654. // (`z-index: calc(1.5)` computes to `2`), so this is read to refuse a rewrite,
  2655. // and one name too many costs only that rewrite.
  2656. const INTEGER_PROPERTIES = new Set([
  2657. "-ms-grid-columns",
  2658. "-ms-grid-rows",
  2659. "-ms-hyphenate-limit-chars",
  2660. "-ms-hyphenate-limit-lines",
  2661. "-webkit-line-clamp",
  2662. "animation",
  2663. "animation-timing-function",
  2664. "box-flex-group",
  2665. "box-ordinal-group",
  2666. "column-count",
  2667. "columns",
  2668. "counter-increment",
  2669. "counter-reset",
  2670. "counter-set",
  2671. "flex-line-count",
  2672. "font-feature-settings",
  2673. "grid",
  2674. "grid-area",
  2675. "grid-column",
  2676. "grid-column-end",
  2677. "grid-column-start",
  2678. "grid-row",
  2679. "grid-row-end",
  2680. "grid-row-start",
  2681. "grid-template",
  2682. "grid-template-columns",
  2683. "grid-template-rows",
  2684. "hyphenate-limit-chars",
  2685. "initial-letter",
  2686. "line-clamp",
  2687. "math-depth",
  2688. "max-lines",
  2689. "order",
  2690. "orphans",
  2691. "reading-order",
  2692. "tab-size",
  2693. "text-combine-upright",
  2694. "transition",
  2695. "transition-timing-function",
  2696. "widows",
  2697. "z-index"
  2698. ]);
  2699. // The properties whose value is one `<number> | <percentage>`, where the
  2700. // percentage is the number hundredfold and the two compute to the same thing.
  2701. const ALPHA_VALUE_PROPERTIES = new Set(["opacity", "shape-image-threshold"]);
  2702. // The properties taking a `<ratio>`, whose second number of `1` is the one an
  2703. // omitted denominator means.
  2704. const RATIO_PROPERTIES = new Set(["aspect-ratio"]);
  2705. // The keywords of every property a `css/module` reads a scoped name out of,
  2706. // each mapped to how many times it may be spelled before the next one is the
  2707. // name (`Infinity` — never the name). Derived from each property's grammar.
  2708. const CSS_MODULES_KEYWORDS = new Map([
  2709. [
  2710. "animation",
  2711. new Map([
  2712. ["alternate", 1],
  2713. ["alternate-reverse", 1],
  2714. ["auto", Infinity],
  2715. ["backwards", 1],
  2716. ["both", 1],
  2717. ["ease", 1],
  2718. ["ease-in", 1],
  2719. ["ease-in-out", 1],
  2720. ["ease-out", 1],
  2721. ["forwards", 1],
  2722. ["infinite", 1],
  2723. ["inherit", Infinity],
  2724. ["initial", Infinity],
  2725. ["linear", 1],
  2726. ["none", Infinity],
  2727. ["normal", 1],
  2728. ["paused", 1],
  2729. ["reverse", 1],
  2730. ["revert", Infinity],
  2731. ["revert-layer", Infinity],
  2732. ["running", 1],
  2733. ["step-end", 1],
  2734. ["step-start", 1],
  2735. ["unset", Infinity]
  2736. ])
  2737. ],
  2738. [
  2739. "animation-name",
  2740. new Map([
  2741. ["inherit", Infinity],
  2742. ["initial", Infinity],
  2743. ["none", Infinity],
  2744. ["revert", Infinity],
  2745. ["revert-layer", Infinity],
  2746. ["unset", Infinity]
  2747. ])
  2748. ],
  2749. [
  2750. "container",
  2751. new Map([
  2752. ["inherit", Infinity],
  2753. ["initial", Infinity],
  2754. ["inline-size", 1],
  2755. ["none", Infinity],
  2756. ["normal", 1],
  2757. ["revert", Infinity],
  2758. ["revert-layer", Infinity],
  2759. ["scroll-state", 1],
  2760. ["size", 1],
  2761. ["unset", Infinity]
  2762. ])
  2763. ],
  2764. [
  2765. "container-name",
  2766. new Map([
  2767. ["inherit", Infinity],
  2768. ["initial", Infinity],
  2769. ["none", Infinity],
  2770. ["revert", Infinity],
  2771. ["revert-layer", Infinity],
  2772. ["unset", Infinity]
  2773. ])
  2774. ],
  2775. [
  2776. "list-style",
  2777. new Map([
  2778. ["arabic-indic", 1],
  2779. ["armenian", 1],
  2780. ["bengali", 1],
  2781. ["cambodian", 1],
  2782. ["circle", 1],
  2783. ["cjk-decimal", 1],
  2784. ["cjk-earthly-branch", 1],
  2785. ["cjk-heavenly-stem", 1],
  2786. ["cjk-ideographic", 1],
  2787. ["decimal", 1],
  2788. ["decimal-leading-zero", 1],
  2789. ["devanagari", 1],
  2790. ["disc", 1],
  2791. ["disclosure-closed", 1],
  2792. ["disclosure-open", 1],
  2793. ["ethiopic-numeric", 1],
  2794. ["georgian", 1],
  2795. ["gujarati", 1],
  2796. ["gurmukhi", 1],
  2797. ["hebrew", 1],
  2798. ["hiragana", 1],
  2799. ["hiragana-iroha", 1],
  2800. ["inherit", Infinity],
  2801. ["initial", Infinity],
  2802. ["inside", 1],
  2803. ["japanese-formal", 1],
  2804. ["japanese-informal", 1],
  2805. ["kannada", 1],
  2806. ["katakana", 1],
  2807. ["katakana-iroha", 1],
  2808. ["khmer", 1],
  2809. ["korean-hangul-formal", 1],
  2810. ["korean-hanja-formal", 1],
  2811. ["korean-hanja-informal", 1],
  2812. ["lao", 1],
  2813. ["lower-alpha", 1],
  2814. ["lower-armenian", 1],
  2815. ["lower-greek", 1],
  2816. ["lower-latin", 1],
  2817. ["lower-roman", 1],
  2818. ["malayalam", 1],
  2819. ["mongolian", 1],
  2820. ["myanmar", 1],
  2821. ["none", Infinity],
  2822. ["oriya", 1],
  2823. ["outside", 1],
  2824. ["persian", 1],
  2825. ["revert", Infinity],
  2826. ["revert-layer", Infinity],
  2827. ["simp-chinese-formal", 1],
  2828. ["simp-chinese-informal", 1],
  2829. ["square", 1],
  2830. ["tamil", 1],
  2831. ["telugu", 1],
  2832. ["thai", 1],
  2833. ["tibetan", 1],
  2834. ["trad-chinese-formal", 1],
  2835. ["trad-chinese-informal", 1],
  2836. ["unset", Infinity],
  2837. ["upper-alpha", 1],
  2838. ["upper-armenian", 1],
  2839. ["upper-latin", 1],
  2840. ["upper-roman", 1]
  2841. ])
  2842. ],
  2843. [
  2844. "list-style-type",
  2845. new Map([
  2846. ["arabic-indic", 1],
  2847. ["armenian", 1],
  2848. ["bengali", 1],
  2849. ["cambodian", 1],
  2850. ["circle", 1],
  2851. ["cjk-decimal", 1],
  2852. ["cjk-earthly-branch", 1],
  2853. ["cjk-heavenly-stem", 1],
  2854. ["cjk-ideographic", 1],
  2855. ["decimal", 1],
  2856. ["decimal-leading-zero", 1],
  2857. ["devanagari", 1],
  2858. ["disc", 1],
  2859. ["disclosure-closed", 1],
  2860. ["disclosure-open", 1],
  2861. ["ethiopic-numeric", 1],
  2862. ["georgian", 1],
  2863. ["gujarati", 1],
  2864. ["gurmukhi", 1],
  2865. ["hebrew", 1],
  2866. ["hiragana", 1],
  2867. ["hiragana-iroha", 1],
  2868. ["inherit", Infinity],
  2869. ["initial", Infinity],
  2870. ["japanese-formal", 1],
  2871. ["japanese-informal", 1],
  2872. ["kannada", 1],
  2873. ["katakana", 1],
  2874. ["katakana-iroha", 1],
  2875. ["khmer", 1],
  2876. ["korean-hangul-formal", 1],
  2877. ["korean-hanja-formal", 1],
  2878. ["korean-hanja-informal", 1],
  2879. ["lao", 1],
  2880. ["lower-alpha", 1],
  2881. ["lower-armenian", 1],
  2882. ["lower-greek", 1],
  2883. ["lower-latin", 1],
  2884. ["lower-roman", 1],
  2885. ["malayalam", 1],
  2886. ["mongolian", 1],
  2887. ["myanmar", 1],
  2888. ["none", Infinity],
  2889. ["oriya", 1],
  2890. ["persian", 1],
  2891. ["revert", Infinity],
  2892. ["revert-layer", Infinity],
  2893. ["simp-chinese-formal", 1],
  2894. ["simp-chinese-informal", 1],
  2895. ["square", 1],
  2896. ["tamil", 1],
  2897. ["telugu", 1],
  2898. ["thai", 1],
  2899. ["tibetan", 1],
  2900. ["trad-chinese-formal", 1],
  2901. ["trad-chinese-informal", 1],
  2902. ["unset", Infinity],
  2903. ["upper-alpha", 1],
  2904. ["upper-armenian", 1],
  2905. ["upper-latin", 1],
  2906. ["upper-roman", 1]
  2907. ])
  2908. ],
  2909. [
  2910. "system",
  2911. new Map([
  2912. ["additive", 1],
  2913. ["alphabetic", 1],
  2914. ["arabic-indic", 1],
  2915. ["armenian", 1],
  2916. ["bengali", 1],
  2917. ["cambodian", 1],
  2918. ["circle", 1],
  2919. ["cjk-decimal", 1],
  2920. ["cjk-earthly-branch", 1],
  2921. ["cjk-heavenly-stem", 1],
  2922. ["cjk-ideographic", 1],
  2923. ["cyclic", 1],
  2924. ["decimal", 1],
  2925. ["decimal-leading-zero", 1],
  2926. ["devanagari", 1],
  2927. ["disc", 1],
  2928. ["disclosure-closed", 1],
  2929. ["disclosure-open", 1],
  2930. ["ethiopic-numeric", 1],
  2931. ["extends", 1],
  2932. ["fixed", 1],
  2933. ["georgian", 1],
  2934. ["gujarati", 1],
  2935. ["gurmukhi", 1],
  2936. ["hebrew", 1],
  2937. ["hiragana", 1],
  2938. ["hiragana-iroha", 1],
  2939. ["japanese-formal", 1],
  2940. ["japanese-informal", 1],
  2941. ["kannada", 1],
  2942. ["katakana", 1],
  2943. ["katakana-iroha", 1],
  2944. ["khmer", 1],
  2945. ["korean-hangul-formal", 1],
  2946. ["korean-hanja-formal", 1],
  2947. ["korean-hanja-informal", 1],
  2948. ["lao", 1],
  2949. ["lower-alpha", 1],
  2950. ["lower-armenian", 1],
  2951. ["lower-greek", 1],
  2952. ["lower-latin", 1],
  2953. ["lower-roman", 1],
  2954. ["malayalam", 1],
  2955. ["mongolian", 1],
  2956. ["myanmar", 1],
  2957. ["numeric", 1],
  2958. ["oriya", 1],
  2959. ["persian", 1],
  2960. ["simp-chinese-formal", 1],
  2961. ["simp-chinese-informal", 1],
  2962. ["square", 1],
  2963. ["symbolic", 1],
  2964. ["tamil", 1],
  2965. ["telugu", 1],
  2966. ["thai", 1],
  2967. ["tibetan", 1],
  2968. ["trad-chinese-formal", 1],
  2969. ["trad-chinese-informal", 1],
  2970. ["upper-alpha", 1],
  2971. ["upper-armenian", 1],
  2972. ["upper-latin", 1],
  2973. ["upper-roman", 1]
  2974. ])
  2975. ],
  2976. [
  2977. "fallback",
  2978. new Map([
  2979. ["arabic-indic", 1],
  2980. ["armenian", 1],
  2981. ["bengali", 1],
  2982. ["cambodian", 1],
  2983. ["circle", 1],
  2984. ["cjk-decimal", 1],
  2985. ["cjk-earthly-branch", 1],
  2986. ["cjk-heavenly-stem", 1],
  2987. ["cjk-ideographic", 1],
  2988. ["decimal", 1],
  2989. ["decimal-leading-zero", 1],
  2990. ["devanagari", 1],
  2991. ["disc", 1],
  2992. ["disclosure-closed", 1],
  2993. ["disclosure-open", 1],
  2994. ["ethiopic-numeric", 1],
  2995. ["georgian", 1],
  2996. ["gujarati", 1],
  2997. ["gurmukhi", 1],
  2998. ["hebrew", 1],
  2999. ["hiragana", 1],
  3000. ["hiragana-iroha", 1],
  3001. ["japanese-formal", 1],
  3002. ["japanese-informal", 1],
  3003. ["kannada", 1],
  3004. ["katakana", 1],
  3005. ["katakana-iroha", 1],
  3006. ["khmer", 1],
  3007. ["korean-hangul-formal", 1],
  3008. ["korean-hanja-formal", 1],
  3009. ["korean-hanja-informal", 1],
  3010. ["lao", 1],
  3011. ["lower-alpha", 1],
  3012. ["lower-armenian", 1],
  3013. ["lower-greek", 1],
  3014. ["lower-latin", 1],
  3015. ["lower-roman", 1],
  3016. ["malayalam", 1],
  3017. ["mongolian", 1],
  3018. ["myanmar", 1],
  3019. ["oriya", 1],
  3020. ["persian", 1],
  3021. ["simp-chinese-formal", 1],
  3022. ["simp-chinese-informal", 1],
  3023. ["square", 1],
  3024. ["tamil", 1],
  3025. ["telugu", 1],
  3026. ["thai", 1],
  3027. ["tibetan", 1],
  3028. ["trad-chinese-formal", 1],
  3029. ["trad-chinese-informal", 1],
  3030. ["upper-alpha", 1],
  3031. ["upper-armenian", 1],
  3032. ["upper-latin", 1],
  3033. ["upper-roman", 1]
  3034. ])
  3035. ],
  3036. [
  3037. "speak-as",
  3038. new Map([
  3039. ["arabic-indic", 1],
  3040. ["armenian", 1],
  3041. ["auto", Infinity],
  3042. ["bengali", 1],
  3043. ["bullets", Infinity],
  3044. ["cambodian", 1],
  3045. ["circle", 1],
  3046. ["cjk-decimal", 1],
  3047. ["cjk-earthly-branch", 1],
  3048. ["cjk-heavenly-stem", 1],
  3049. ["cjk-ideographic", 1],
  3050. ["decimal", 1],
  3051. ["decimal-leading-zero", 1],
  3052. ["devanagari", 1],
  3053. ["disc", 1],
  3054. ["disclosure-closed", 1],
  3055. ["disclosure-open", 1],
  3056. ["ethiopic-numeric", 1],
  3057. ["georgian", 1],
  3058. ["gujarati", 1],
  3059. ["gurmukhi", 1],
  3060. ["hebrew", 1],
  3061. ["hiragana", 1],
  3062. ["hiragana-iroha", 1],
  3063. ["japanese-formal", 1],
  3064. ["japanese-informal", 1],
  3065. ["kannada", 1],
  3066. ["katakana", 1],
  3067. ["katakana-iroha", 1],
  3068. ["khmer", 1],
  3069. ["korean-hangul-formal", 1],
  3070. ["korean-hanja-formal", 1],
  3071. ["korean-hanja-informal", 1],
  3072. ["lao", 1],
  3073. ["lower-alpha", 1],
  3074. ["lower-armenian", 1],
  3075. ["lower-greek", 1],
  3076. ["lower-latin", 1],
  3077. ["lower-roman", 1],
  3078. ["malayalam", 1],
  3079. ["mongolian", 1],
  3080. ["myanmar", 1],
  3081. ["numbers", Infinity],
  3082. ["oriya", 1],
  3083. ["persian", 1],
  3084. ["simp-chinese-formal", 1],
  3085. ["simp-chinese-informal", 1],
  3086. ["spell-out", Infinity],
  3087. ["square", 1],
  3088. ["tamil", 1],
  3089. ["telugu", 1],
  3090. ["thai", 1],
  3091. ["tibetan", 1],
  3092. ["trad-chinese-formal", 1],
  3093. ["trad-chinese-informal", 1],
  3094. ["upper-alpha", 1],
  3095. ["upper-armenian", 1],
  3096. ["upper-latin", 1],
  3097. ["upper-roman", 1],
  3098. ["words", Infinity]
  3099. ])
  3100. ],
  3101. [
  3102. "counter-reset",
  3103. new Map([
  3104. ["inherit", Infinity],
  3105. ["initial", Infinity],
  3106. ["list-item", Infinity],
  3107. ["none", 1],
  3108. ["page", Infinity],
  3109. ["pages", Infinity],
  3110. ["revert", Infinity],
  3111. ["revert-layer", Infinity],
  3112. ["unset", Infinity]
  3113. ])
  3114. ],
  3115. [
  3116. "counter-increment",
  3117. new Map([
  3118. ["inherit", Infinity],
  3119. ["initial", Infinity],
  3120. ["list-item", Infinity],
  3121. ["none", 1],
  3122. ["page", Infinity],
  3123. ["pages", Infinity],
  3124. ["revert", Infinity],
  3125. ["revert-layer", Infinity],
  3126. ["unset", Infinity]
  3127. ])
  3128. ],
  3129. [
  3130. "counter-set",
  3131. new Map([
  3132. ["inherit", Infinity],
  3133. ["initial", Infinity],
  3134. ["list-item", Infinity],
  3135. ["none", 1],
  3136. ["page", Infinity],
  3137. ["pages", Infinity],
  3138. ["revert", Infinity],
  3139. ["revert-layer", Infinity],
  3140. ["unset", Infinity]
  3141. ])
  3142. ],
  3143. [
  3144. "view-transition-name",
  3145. new Map([
  3146. ["auto", Infinity],
  3147. ["inherit", Infinity],
  3148. ["initial", Infinity],
  3149. ["match-element", Infinity],
  3150. ["none", Infinity],
  3151. ["revert", Infinity],
  3152. ["revert-layer", Infinity],
  3153. ["unset", Infinity]
  3154. ])
  3155. ],
  3156. [
  3157. "view-transition-group",
  3158. new Map([
  3159. ["contain", Infinity],
  3160. ["inherit", Infinity],
  3161. ["initial", Infinity],
  3162. ["nearest", Infinity],
  3163. ["normal", Infinity],
  3164. ["revert", Infinity],
  3165. ["revert-layer", Infinity],
  3166. ["unset", Infinity]
  3167. ])
  3168. ],
  3169. [
  3170. "view-transition-class",
  3171. new Map([
  3172. ["inherit", Infinity],
  3173. ["initial", Infinity],
  3174. ["none", Infinity],
  3175. ["revert", Infinity],
  3176. ["revert-layer", Infinity],
  3177. ["unset", Infinity]
  3178. ])
  3179. ],
  3180. [
  3181. "grid",
  3182. new Map([
  3183. ["auto", Infinity],
  3184. ["auto-flow", 1],
  3185. ["column", 1],
  3186. ["dense", 1],
  3187. ["inherit", Infinity],
  3188. ["initial", Infinity],
  3189. ["masonry", 1],
  3190. ["max-content", Infinity],
  3191. ["min-content", Infinity],
  3192. ["none", 2],
  3193. ["revert", Infinity],
  3194. ["revert-layer", Infinity],
  3195. ["row", 1],
  3196. ["subgrid", 2],
  3197. ["unset", Infinity]
  3198. ])
  3199. ],
  3200. [
  3201. "grid-area",
  3202. new Map([
  3203. ["auto", Infinity],
  3204. ["inherit", Infinity],
  3205. ["initial", Infinity],
  3206. ["revert", Infinity],
  3207. ["revert-layer", Infinity],
  3208. ["span", Infinity],
  3209. ["unset", Infinity]
  3210. ])
  3211. ],
  3212. [
  3213. "grid-column",
  3214. new Map([
  3215. ["auto", Infinity],
  3216. ["inherit", Infinity],
  3217. ["initial", Infinity],
  3218. ["revert", Infinity],
  3219. ["revert-layer", Infinity],
  3220. ["span", Infinity],
  3221. ["unset", Infinity]
  3222. ])
  3223. ],
  3224. [
  3225. "grid-column-end",
  3226. new Map([
  3227. ["auto", Infinity],
  3228. ["inherit", Infinity],
  3229. ["initial", Infinity],
  3230. ["revert", Infinity],
  3231. ["revert-layer", Infinity],
  3232. ["span", Infinity],
  3233. ["unset", Infinity]
  3234. ])
  3235. ],
  3236. [
  3237. "grid-column-start",
  3238. new Map([
  3239. ["auto", Infinity],
  3240. ["inherit", Infinity],
  3241. ["initial", Infinity],
  3242. ["revert", Infinity],
  3243. ["revert-layer", Infinity],
  3244. ["span", Infinity],
  3245. ["unset", Infinity]
  3246. ])
  3247. ],
  3248. [
  3249. "grid-row",
  3250. new Map([
  3251. ["auto", Infinity],
  3252. ["inherit", Infinity],
  3253. ["initial", Infinity],
  3254. ["revert", Infinity],
  3255. ["revert-layer", Infinity],
  3256. ["span", Infinity],
  3257. ["unset", Infinity]
  3258. ])
  3259. ],
  3260. [
  3261. "grid-row-end",
  3262. new Map([
  3263. ["auto", Infinity],
  3264. ["inherit", Infinity],
  3265. ["initial", Infinity],
  3266. ["revert", Infinity],
  3267. ["revert-layer", Infinity],
  3268. ["span", Infinity],
  3269. ["unset", Infinity]
  3270. ])
  3271. ],
  3272. [
  3273. "grid-row-start",
  3274. new Map([
  3275. ["auto", Infinity],
  3276. ["inherit", Infinity],
  3277. ["initial", Infinity],
  3278. ["revert", Infinity],
  3279. ["revert-layer", Infinity],
  3280. ["span", Infinity],
  3281. ["unset", Infinity]
  3282. ])
  3283. ],
  3284. [
  3285. "grid-template",
  3286. new Map([
  3287. ["auto", Infinity],
  3288. ["inherit", Infinity],
  3289. ["initial", Infinity],
  3290. ["masonry", 1],
  3291. ["max-content", Infinity],
  3292. ["min-content", Infinity],
  3293. ["none", 2],
  3294. ["revert", Infinity],
  3295. ["revert-layer", Infinity],
  3296. ["subgrid", 2],
  3297. ["unset", Infinity]
  3298. ])
  3299. ],
  3300. [
  3301. "grid-template-areas",
  3302. new Map([
  3303. ["inherit", Infinity],
  3304. ["initial", Infinity],
  3305. ["none", 1],
  3306. ["revert", Infinity],
  3307. ["revert-layer", Infinity],
  3308. ["unset", Infinity]
  3309. ])
  3310. ],
  3311. [
  3312. "grid-template-columns",
  3313. new Map([
  3314. ["auto", Infinity],
  3315. ["inherit", Infinity],
  3316. ["initial", Infinity],
  3317. ["masonry", 1],
  3318. ["max-content", Infinity],
  3319. ["min-content", Infinity],
  3320. ["none", 1],
  3321. ["revert", Infinity],
  3322. ["revert-layer", Infinity],
  3323. ["subgrid", 1],
  3324. ["unset", Infinity]
  3325. ])
  3326. ],
  3327. [
  3328. "grid-template-rows",
  3329. new Map([
  3330. ["auto", Infinity],
  3331. ["inherit", Infinity],
  3332. ["initial", Infinity],
  3333. ["masonry", 1],
  3334. ["max-content", Infinity],
  3335. ["min-content", Infinity],
  3336. ["none", 1],
  3337. ["revert", Infinity],
  3338. ["revert-layer", Infinity],
  3339. ["subgrid", 1],
  3340. ["unset", Infinity]
  3341. ])
  3342. ]
  3343. ]);
  3344. // The parser option gating each of them.
  3345. const CSS_MODULES_KEYWORD_OPTIONS = new Map([
  3346. ["animation", "animation"],
  3347. ["animation-name", "animation"],
  3348. ["container", "container"],
  3349. ["container-name", "container"],
  3350. ["list-style", "customIdents"],
  3351. ["list-style-type", "customIdents"],
  3352. ["system", "customIdents"],
  3353. ["fallback", "customIdents"],
  3354. ["speak-as", "customIdents"],
  3355. ["counter-reset", "customIdents"],
  3356. ["counter-increment", "customIdents"],
  3357. ["counter-set", "customIdents"],
  3358. ["view-transition-name", "customIdents"],
  3359. ["view-transition-group", "customIdents"],
  3360. ["view-transition-class", "customIdents"],
  3361. ["grid", "grid"],
  3362. ["grid-area", "grid"],
  3363. ["grid-column", "grid"],
  3364. ["grid-column-end", "grid"],
  3365. ["grid-column-start", "grid"],
  3366. ["grid-row", "grid"],
  3367. ["grid-row-end", "grid"],
  3368. ["grid-row-start", "grid"],
  3369. ["grid-template", "grid"],
  3370. ["grid-template-areas", "grid"],
  3371. ["grid-template-columns", "grid"],
  3372. ["grid-template-rows", "grid"]
  3373. ]);
  3374. // The properties a negative value is valid on, so `calc(-5px)` may lose its
  3375. // parentheses there. Read to permit a rewrite, which is the opposite of
  3376. // `INTEGER_PROPERTIES` above: naming one property too many is a bug, naming one
  3377. // too few only costs a rewrite.
  3378. const NEGATIVE_ACCEPTING_PROPERTIES = new Set([
  3379. "animation-delay",
  3380. "background-position",
  3381. "background-position-x",
  3382. "background-position-y",
  3383. "bottom",
  3384. "inset",
  3385. "inset-block",
  3386. "inset-block-end",
  3387. "inset-block-start",
  3388. "inset-inline",
  3389. "inset-inline-end",
  3390. "inset-inline-start",
  3391. "left",
  3392. "letter-spacing",
  3393. "margin",
  3394. "margin-block",
  3395. "margin-block-end",
  3396. "margin-block-start",
  3397. "margin-bottom",
  3398. "margin-inline",
  3399. "margin-inline-end",
  3400. "margin-inline-start",
  3401. "margin-left",
  3402. "margin-right",
  3403. "margin-top",
  3404. "offset-distance",
  3405. "order",
  3406. "outline-offset",
  3407. "perspective-origin",
  3408. "right",
  3409. "rotate",
  3410. "scroll-margin",
  3411. "scroll-margin-block",
  3412. "scroll-margin-bottom",
  3413. "scroll-margin-inline",
  3414. "scroll-margin-left",
  3415. "scroll-margin-right",
  3416. "scroll-margin-top",
  3417. "stroke-dashoffset",
  3418. "text-indent",
  3419. "text-underline-offset",
  3420. "top",
  3421. "transform-origin",
  3422. "transition-delay",
  3423. "translate",
  3424. "vertical-align",
  3425. "word-spacing",
  3426. "z-index"
  3427. ]);
  3428. // The functions whose every numeric argument is a length, so a zero inside one
  3429. // drops its unit the way a whole component's does. Read to permit a rewrite:
  3430. // any other numeric type would make the bare `0` mean something else, or make
  3431. // a dropped declaration valid.
  3432. const LENGTH_ONLY_FUNCTIONS = new Set([
  3433. "anchor",
  3434. "anchor-size",
  3435. "blur",
  3436. "circle",
  3437. "ellipse",
  3438. "fit-content",
  3439. "inset",
  3440. "perspective",
  3441. "polygon",
  3442. "rect",
  3443. "translate",
  3444. "translate3d",
  3445. "translatex",
  3446. "translatey",
  3447. "translatez",
  3448. "view",
  3449. "xywh"
  3450. ]);
  3451. // Packed `0xrrggbb` -> the shortest named color with that value. Only names that
  3452. // can beat `#rrggbb`; anything longer would never be picked.
  3453. const RGB_TO_NAME = new Map([
  3454. [0x000080, "navy"],
  3455. [0x008000, "green"],
  3456. [0x008080, "teal"],
  3457. [0x4b0082, "indigo"],
  3458. [0x800000, "maroon"],
  3459. [0x800080, "purple"],
  3460. [0x808000, "olive"],
  3461. [0x808080, "gray"],
  3462. [0xa0522d, "sienna"],
  3463. [0xa52a2a, "brown"],
  3464. [0xc0c0c0, "silver"],
  3465. [0xcd853f, "peru"],
  3466. [0xd2b48c, "tan"],
  3467. [0xda70d6, "orchid"],
  3468. [0xdda0dd, "plum"],
  3469. [0xee82ee, "violet"],
  3470. [0xf0e68c, "khaki"],
  3471. [0xf0ffff, "azure"],
  3472. [0xf5deb3, "wheat"],
  3473. [0xf5f5dc, "beige"],
  3474. [0xfa8072, "salmon"],
  3475. [0xfaf0e6, "linen"],
  3476. [0xff0000, "red"],
  3477. [0xff6347, "tomato"],
  3478. [0xff7f50, "coral"],
  3479. [0xffa500, "orange"],
  3480. [0xffc0cb, "pink"],
  3481. [0xffd700, "gold"],
  3482. [0xffe4c4, "bisque"],
  3483. [0xfffafa, "snow"],
  3484. [0xfffff0, "ivory"]
  3485. ]);
  3486. // Prefixed constructs the minifier reads back, one table per axis, as `name ->
  3487. // [prefix, windowList][]`. Versions are `major * 100000 + minor`; a target
  3488. // browser at version V needs the prefix when `prefixedFrom <= V < unprefixedFrom`
  3489. // (`NEVER` = never unprefixed). Non-standard-only constructs are absent.
  3490. // Every window list laid end to end as `browserSlot, prefixedFrom,
  3491. // unprefixedFrom` triples — the slot is the browser's place in
  3492. // `SUPPORT_BROWSERS`, so no name is restated. A spelling names its list by
  3493. // index, and two thirds of the lists are shared.
  3494. const PREFIX_WINDOWS = new Float64Array([
  3495. 3, 2100000, 2900000, 0, 2500000, 2900000, 10, 1500000, 1600000, 9, 1400000,
  3496. 1600000, 11, 700000, 900000, 8, 700000, 900000, 12, 100005, 200000, 6,
  3497. 1000000, 1100000, 7, 1000000, 1100000, 3, 2100000, 2900000, 0, 2500000,
  3498. 2900000, 11, 700000, 900000, 8, 700000, 900000, 12, 100005, 200000, 10,
  3499. 1500000, 1600000, 9, 1400000, 1600000, 11, 800000, 1800000, 8, 800000,
  3500. 1800000, 3, 300000, 4300000, 0, 1800000, 4300000, 10, 1500000, 3000000, 9,
  3501. 1400000, 3000000, 11, 400000, 900000, 8, 300002, 900000, 12, 100000, 400000,
  3502. 2, 200000, 4300000, 5, 500000, 1600000, 1, 500000, 1600000, 10, 1200000,
  3503. 1500000, 9, 1200000, 1400000, 3, 300000, 4300000, 0, 1800000, 4300000, 10,
  3504. 1500000, 3000000, 9, 1400000, 3000000, 11, 400000, 900000, 8, 300002, 900000,
  3505. 12, 100000, 400000, 2, 400004, 4300000, 3, 300000, 4300000, 0, 1800000,
  3506. 4300000, 10, 1500000, 3000000, 9, 1400000, 3000000, 11, 400000, 900000, 8,
  3507. 400002, 900000, 12, 100000, 400000, 2, 200000, 4300000, 3, 300000, 4300000, 0,
  3508. 1800000, 4300000, 10, 1500000, 3000000, 9, 1400000, 3000000, 11, 500000,
  3509. 900000, 8, 400000, 900000, 12, 100000, 400000, 2, 400004, 4300000, 3, 300000,
  3510. 4300000, 0, 1800000, 4300000, 10, 1500000, 3000000, 9, 1400000, 3000000, 11,
  3511. 400000, 900000, 8, 200000, 900000, 12, 100000, 400000, 2, 400004, 4300000, 3,
  3512. 100000, 8400000, 0, 1800000, 8400000, 4, 1200000, 8400000, 10, 1500000,
  3513. 7000000, 9, 1400000, 6000000, 11, 300000, 1500004, 8, 100000, 1500004, 12,
  3514. 100000, 1400000, 2, 400004, 8400000, 5, 100000, 8000000, 1, 400000, 8000000,
  3515. 4, 1700000, 7900000, 11, 900000, 1800000, 8, 900000, 1800000, 3, 1200000,
  3516. 3600000, 0, 1800000, 3600000, 10, 1500000, 2300000, 9, 1400000, 2400000, 11,
  3517. 500001, 1500004, 8, 500000, 1500004, 12, 100000, 300000, 2, 300000, 3700000,
  3518. 5, 1000000, 1600000, 1, 1000000, 1600000, 5, 100000, 400000, 11, 300000,
  3519. 500000, 8, 100000, 500000, 3, 100000, 300000, 11, 300000, 500000, 8, 100000,
  3520. 400002, 5, 300006, 400000, 10, 900005, 1000002, 3, 800000, 5700000, 0,
  3521. 1800000, 5700000, 10, 1500000, 4400000, 9, 1400000, 4300000, 11, 500001,
  3522. 1200001, 8, 500000, 1200002, 12, 100000, 700000, 2, 400004, 5700000, 3,
  3523. 100000, 400000, 11, 300000, 500000, 8, 100000, 400002, 3, 700000, 1600000, 11,
  3524. 300000, 600000, 8, 200000, 600000, 2, 200000, 400004, 5, 300005, 1500000, 1,
  3525. 400000, 1500000, 10, 1000005, 1500000, 9, 1100000, 1400000, 5, 300000,
  3526. 4100000, 1, 400000, 4100000, 3, 100000, 400000, 11, 300000, 500000, 8, 100000,
  3527. 400002, 2, 200000, 400004, 3, 100000, 1e15, 0, 1800000, 1e15, 4, 1200000,
  3528. 1e15, 10, 1500000, 1e15, 9, 1400000, 1e15, 11, 300000, 1e15, 8, 100000, 1e15,
  3529. 12, 100000, 1e15, 2, 400004, 1e15, 5, 100000, 1e15, 1, 400000, 1e15, 3,
  3530. 2200000, 13000000, 0, 2500000, 13000000, 4, 7900000, 13000000, 10, 1500000,
  3531. 11500000, 9, 1400000, 8600000, 11, 700000, 1e15, 8, 700000, 1e15, 12, 100005,
  3532. 2800000, 2, 400004, 13000000, 3, 100000, 6700000, 0, 1800000, 6700000, 10,
  3533. 1500000, 5500000, 9, 1400000, 4800000, 11, 300000, 1e15, 8, 100000, 1e15, 12,
  3534. 100000, 900000, 2, 400004, 6700000, 3, 100000, 1000000, 11, 300000, 500001, 8,
  3535. 100000, 500000, 5, 300005, 400000, 3, 100000, 1000000, 11, 300000, 500001, 8,
  3536. 100000, 600000, 2, 200000, 400000, 5, 100000, 2900000, 1, 400000, 2900000, 3,
  3537. 2300000, 5500000, 0, 2500000, 5500000, 10, 1500000, 4200000, 9, 1400000,
  3538. 4200000, 11, 700000, 900001, 8, 700000, 900003, 12, 100005, 600000, 2, 400004,
  3539. 5500000, 3, 100000, 5000000, 0, 1800000, 5000000, 10, 1500000, 3700000, 9,
  3540. 1400000, 3700000, 11, 300000, 900000, 8, 200000, 900000, 12, 100000, 500000,
  3541. 2, 400004, 5000000, 5, 100005, 5200000, 1, 400000, 5200000, 5, 1700000,
  3542. 5200000, 1, 1700000, 5200000, 11, 800000, 900000, 8, 800000, 900000, 3,
  3543. 400000, 5000000, 11, 300001, 900000, 8, 300002, 900000, 10, 1500000, 3700000,
  3544. 2, 200001, 500000, 12, 400000, 500000, 9, 1400000, 3700000, 5, 200000,
  3545. 5200000, 3, 100000, 5000000, 0, 1800000, 5000000, 11, 300000, 900000, 8,
  3546. 100000, 900000, 12, 100000, 500000, 2, 400004, 5000000, 10, 1500000, 3700000,
  3547. 9, 1400000, 3700000, 5, 300005, 5200000, 1, 400000, 5200000, 3, 400000,
  3548. 5000000, 0, 1800000, 5000000, 10, 1500000, 3700000, 9, 1400000, 3700000, 11,
  3549. 300001, 900000, 8, 300002, 900000, 12, 100000, 500000, 2, 200001, 5000000, 5,
  3550. 900000, 5200000, 1, 2200000, 5200000, 11, 300000, 900000, 8, 300002, 900000,
  3551. 2, 200000, 5000000, 3, 400000, 5000000, 10, 1500000, 3700000, 12, 400000,
  3552. 500000, 9, 1400000, 3700000, 3, 1800000, 5300000, 0, 1800000, 5300000, 10,
  3553. 1500000, 4000000, 9, 1400000, 4100000, 11, 600000, 900001, 8, 600000, 900003,
  3554. 12, 100000, 600000, 2, 400004, 5300000, 3, 2200000, 2900000, 0, 2500000,
  3555. 2900000, 11, 700000, 900000, 8, 700000, 900000, 12, 100005, 200000, 10,
  3556. 1500000, 1600000, 9, 1400000, 1600000, 3, 2200000, 2900000, 0, 2500000,
  3557. 2900000, 11, 800000, 900000, 8, 800000, 900000, 12, 100005, 200000, 10,
  3558. 1500000, 1600000, 9, 1400000, 1600000, 3, 1600000, 4800000, 0, 1800000,
  3559. 4800000, 10, 1500000, 3500000, 9, 1400000, 3500000, 12, 100000, 500000, 5,
  3560. 1500000, 3400000, 1, 1500000, 3400000, 3, 2900000, 3300000, 0, 2900000,
  3561. 3300000, 10, 1600000, 2000000, 9, 1600000, 2000000, 11, 600000, 900001, 8,
  3562. 600000, 1200000, 12, 100000, 200000, 5, 400000, 3400000, 1, 400000, 3400000,
  3563. 3, 3100000, 3400000, 0, 3100000, 3400000, 10, 1800000, 2100000, 9, 1800000,
  3564. 2100000, 11, 700000, 900001, 8, 700000, 900003, 2, 400004, 3700000, 4,
  3565. 1200000, 7900000, 6, 1000000, 1e15, 7, 1000000, 1e15, 3, 600000, 10600000, 0,
  3566. 1800000, 10600000, 4, 7900000, 10600000, 10, 1500000, 9200000, 9, 1400000,
  3567. 7200000, 11, 500001, 1700000, 8, 500000, 1700000, 12, 100000, 2000000, 2,
  3568. 400004, 10600000, 3, 1300000, 5500000, 0, 1800000, 5500000, 10, 1500000,
  3569. 4200000, 9, 1400000, 4200000, 11, 500001, 1700000, 8, 400002, 1700000, 12,
  3570. 100000, 600000, 2, 400004, 5500000, 5, 600000, 4300000, 1, 600000, 4300000, 4,
  3571. 1200000, 7900000, 11, 900000, 1e15, 8, 900000, 1e15, 3, 100000, 5800000, 0,
  3572. 1800000, 5800000, 10, 1500000, 4500000, 9, 1400000, 4300000, 11, 300000,
  3573. 1100000, 8, 100000, 1100000, 12, 100000, 700000, 2, 400004, 5800000, 3,
  3574. 600000, 1e15, 0, 1800000, 1e15, 4, 7900000, 1e15, 5, 6800000, 1e15, 1,
  3575. 6800000, 1e15, 10, 1500000, 1e15, 9, 1400000, 1e15, 11, 500000, 1e15, 8,
  3576. 400002, 1e15, 12, 100000, 1e15, 2, 400004, 1e15, 3, 800000, 6900000, 0,
  3577. 1800000, 6900000, 10, 1500000, 5600000, 9, 1400000, 4800000, 11, 500001,
  3578. 1200001, 8, 500000, 1200002, 12, 100000, 1000000, 2, 400004, 6900000, 3,
  3579. 200000, 6900000, 0, 1800000, 6900000, 10, 1500000, 5600000, 9, 1400000,
  3580. 4800000, 11, 300000, 1200001, 8, 300000, 1200002, 12, 100000, 1000000, 2,
  3581. 200000, 8700000, 3, 100000, 12000000, 0, 1800000, 12000000, 4, 7900000,
  3582. 12000000, 10, 1500000, 10600000, 9, 1400000, 8000000, 11, 300001, 1500004, 8,
  3583. 200000, 1500004, 12, 100000, 2500000, 2, 200000, 12000000, 3, 100000, 1e15, 0,
  3584. 1800000, 1e15, 4, 7900000, 1e15, 10, 1500000, 1e15, 9, 1400000, 1e15, 11,
  3585. 300001, 1700002, 8, 200000, 1700002, 12, 100000, 1e15, 2, 400004, 1e15, 3,
  3586. 100000, 12000000, 0, 1800000, 12000000, 4, 7900000, 12000000, 10, 1500000,
  3587. 10600000, 9, 1400000, 8000000, 11, 400000, 1500004, 8, 300002, 1500004, 12,
  3588. 100000, 2500000, 2, 200000, 12000000, 3, 100000, 12000000, 0, 1800000,
  3589. 12000000, 4, 7900000, 12000000, 10, 1500000, 1e15, 9, 1400000, 8000000, 11,
  3590. 400000, 1500004, 8, 300002, 1500004, 12, 100000, 2500000, 2, 200000, 12000000,
  3591. 3, 400000, 12000000, 0, 1800000, 12000000, 4, 7900000, 12000000, 10, 1500000,
  3592. 10600000, 9, 1400000, 8000000, 11, 400000, 1500004, 8, 200000, 1500004, 12,
  3593. 100000, 2500000, 2, 400004, 12000000, 10, 1000006, 1500000, 9, 1100000,
  3594. 1400000, 5, 100000, 300006, 5, 100000, 100005, 3, 1200000, 3600000, 0,
  3595. 1800000, 3600000, 10, 1500000, 2300000, 9, 1400000, 2400000, 11, 400000,
  3596. 900000, 8, 200000, 900000, 12, 100000, 300000, 2, 300000, 400004, 3, 1700000,
  3597. 13600000, 0, 1800000, 13600000, 4, 7900000, 13600000, 10, 1500000, 12100000,
  3598. 9, 1400000, 9000000, 11, 600000, 1500004, 8, 600000, 1500004, 12, 100000,
  3599. 2900000, 2, 400004, 13600000, 3, 100000, 8400000, 0, 1800000, 8400000, 4,
  3600. 7900000, 8400000, 10, 1500000, 7000000, 9, 1400000, 6000000, 11, 700000,
  3601. 1800002, 8, 700000, 1800002, 2, 400004, 8400000, 11, 900000, 1100000, 8,
  3602. 900000, 1100000, 11, 700001, 1000001, 8, 800000, 1000003, 5, 400000, 9100000,
  3603. 1, 400000, 9100000, 5, 1200000, 4900000, 1, 1400000, 4900000, 4, 1200000,
  3604. 7900000, 6, 1100000, 1e15, 7, 1100000, 1e15, 5, 600000, 3600000, 1, 600000,
  3605. 3600000, 11, 800000, 1200001, 8, 800000, 1200002, 11, 700000, 1200001, 8,
  3606. 700000, 1200002, 3, 2500000, 9900000, 0, 2500000, 9900000, 4, 7900000,
  3607. 9900000, 10, 1500000, 8500000, 9, 1400000, 6800000, 12, 100005, 1800000, 2,
  3608. 400004, 9900000, 3, 1200000, 4800000, 0, 1800000, 4800000, 10, 1500000,
  3609. 3500000, 9, 1400000, 3500000, 11, 500001, 1400000, 8, 500000, 1400000, 12,
  3610. 100000, 500000, 2, 400004, 4800000, 10, 900000, 1100000, 9, 1000000, 1200001,
  3611. 4, 1200000, 7900000, 8, 100000, 1e15, 1, 1400000, 1e15, 5, 1400000, 1e15, 7,
  3612. 1000000, 1200000, 4, 1200000, 1900000, 11, 900000, 1200001, 8, 900000,
  3613. 1200002, 3, 100000, 3600000, 0, 1800000, 3600000, 10, 1500000, 2300000, 9,
  3614. 1400000, 2400000, 11, 300001, 900000, 8, 300002, 900000, 12, 100000, 300000,
  3615. 2, 200000, 400004, 5, 300005, 1600000, 1, 400000, 1600000, 6, 900000, 1000000,
  3616. 7, 900000, 1000000, 3, 100000, 3600000, 0, 1800000, 3600000, 10, 1500000,
  3617. 2300000, 9, 1400000, 2400000, 11, 200000, 900000, 8, 100000, 900000, 12,
  3618. 100000, 300000, 2, 400004, 3700000, 3, 100000, 2600000, 0, 1800000, 2600000,
  3619. 11, 300001, 900000, 8, 200000, 900000, 12, 100000, 100005, 2, 200000, 400004,
  3620. 5, 400000, 1600000, 1, 400000, 1600000, 10, 1000001, 1200001, 9, 1000001,
  3621. 1200001, 3, 100000, 2600000, 0, 1800000, 2600000, 11, 400000, 900000, 8,
  3622. 200000, 900000, 12, 100000, 100005, 2, 200000, 400004, 10, 1100006, 1200001,
  3623. 9, 1200000, 1200001, 10, 1000000, 1200001, 9, 1000001, 1200001, 3, 100000,
  3624. 2600000, 0, 1800000, 2600000, 11, 300001, 900000, 8, 200000, 900000, 12,
  3625. 100000, 100005, 3, 100000, 1e15, 0, 1800000, 1e15, 4, 1200000, 1e15, 10,
  3626. 1500000, 1e15, 9, 1400000, 1e15, 11, 300000, 1e15, 8, 500000, 1e15, 12,
  3627. 100000, 1e15, 2, 3700000, 1e15, 5, 100000, 13200000, 1, 400000, 13200000, 3,
  3628. 100000, 5400000, 0, 1800000, 5400000, 4, 1200000, 7900000, 10, 1500000,
  3629. 4100000, 9, 1400000, 4100000, 11, 300000, 1e15, 8, 300000, 1e15, 12, 100000,
  3630. 600000, 2, 400004, 5400000, 5, 100000, 6900000, 1, 400000, 7900000, 3, 800000,
  3631. 4800000, 0, 1800000, 4800000, 10, 1500000, 3500000, 9, 1400000, 3500000, 11,
  3632. 500001, 1000001, 8, 500000, 1000003, 12, 100000, 500000, 2, 300000, 4800000,
  3633. 3, 100000, 6500000, 0, 1800000, 6500000, 10, 1500000, 5200000, 9, 1400000,
  3634. 4700000, 11, 300000, 900000, 8, 100000, 900000, 12, 100000, 900000, 2, 400004,
  3635. 6500000, 5, 100000, 5000000, 1, 400000, 5000000, 3, 100000, 11000000, 0,
  3636. 1800000, 11000000, 4, 7900000, 11000000, 10, 1500000, 9600000, 9, 1400000,
  3637. 7400000, 11, 300000, 1500000, 8, 100000, 1500000, 12, 100000, 2100000, 2,
  3638. 400004, 11000000, 3, 3200000, 3700000, 0, 3200000, 3700000, 10, 1900000,
  3639. 2400000, 9, 1900000, 2400000, 12, 200000, 300000, 2, 400004, 3700000, 5,
  3640. 1700000, 4900000, 1, 1700000, 4900000, 3, 100000, 8900000, 0, 1800000,
  3641. 8900000, 4, 7900000, 8900000, 10, 1500000, 7500000, 9, 1400000, 6300000, 11,
  3642. 300000, 1400001, 8, 100000, 1400005, 12, 100000, 1500000, 2, 400004, 8900000,
  3643. 5, 400000, 8500000, 1, 400000, 8500000, 3, 1500000, 7100000, 0, 1800000,
  3644. 7100000, 10, 1500000, 5800000, 9, 1400000, 5000000, 11, 600000, 1600004, 8,
  3645. 1200000, 1600004, 12, 100000, 1000000, 2, 3700000, 7100000, 5, 900000,
  3646. 6400000, 1, 900000, 6400000, 6, 1100000, 1e15, 7, 1100000, 1e15, 3, 1200000,
  3647. 8800000, 0, 1800000, 8800000, 4, 7900000, 8800000, 10, 1500000, 7400000, 9,
  3648. 1400000, 6300000, 11, 500000, 1400000, 8, 500000, 1400000, 12, 100000,
  3649. 1500000, 2, 400004, 8800000, 5, 400000, 7800000, 1, 400000, 7900000, 3,
  3650. 600000, 5700000, 0, 1800000, 5700000, 4, 1200000, 7900000, 10, 1500000,
  3651. 4400000, 9, 1400000, 4300000, 11, 500000, 1000001, 8, 400002, 1000003, 12,
  3652. 100000, 700000, 2, 200000, 5700000, 5, 1900000, 5100000, 1, 1900000, 5100000,
  3653. 5, 100005, 7800000, 1, 400000, 7900000, 5, 100000, 6200000, 1, 400000,
  3654. 6200000, 5, 400000, 8800000, 1, 400000, 8800000, 5, 100005, 1e15, 1, 400000,
  3655. 1e15, 3, 100000, 4300000, 0, 1800000, 4300000, 10, 1500000, 3000000, 9,
  3656. 1400000, 3000000, 11, 400000, 900000, 8, 400000, 900000, 12, 100000, 400000,
  3657. 2, 400004, 4300000, 5, 300000, 9400000, 1, 400000, 9400000, 11, 700000,
  3658. 1100000, 8, 700000, 1100000, 3, 2200000, 4600000, 0, 2500000, 4600000, 12,
  3659. 100005, 500000, 2, 400004, 4600000, 10, 1500000, 3300000, 9, 1400000, 3300000,
  3660. 5, 300000, 6600000, 1, 400000, 6600000, 11, 900000, 1100000, 8, 900000,
  3661. 1100000, 3, 2200000, 4600000, 0, 2500000, 4600000, 10, 1500000, 3300000, 9,
  3662. 1400000, 3300000, 12, 100005, 500000, 2, 400004, 4600000, 11, 900000, 1100000,
  3663. 8, 900000, 1100000, 3, 2500000, 4600000, 0, 2500000, 4600000, 10, 1500000,
  3664. 3300000, 9, 1400000, 3300000, 12, 100005, 500000, 2, 400004, 4600000, 3,
  3665. 100000, 6800000, 0, 1800000, 6800000, 10, 1500000, 5500000, 9, 1400000,
  3666. 4800000, 11, 400000, 1100000, 12, 100000, 1000000, 2, 400004, 6800000, 5,
  3667. 100005, 2700000, 3, 100000, 6800000, 0, 1800000, 6800000, 10, 1500000,
  3668. 5500000, 9, 1400000, 4800000, 12, 100000, 1000000, 2, 400004, 6800000, 3,
  3669. 100000, 3700000, 0, 1800000, 3700000, 10, 1500000, 2300000, 9, 1400000,
  3670. 2400000, 11, 300000, 900000, 12, 100000, 300000, 2, 400004, 3700000, 5,
  3671. 100000, 2400000, 6, 800000, 1100000, 7, 800000, 1100000, 5, 2200000, 9400000,
  3672. 1, 2200000, 9400000, 5, 2200000, 6600000, 1, 2200000, 6600000, 3, 1300000,
  3673. 14800000, 0, 1800000, 14800000, 4, 7900000, 14800000, 10, 1500000, 13200000,
  3674. 9, 1400000, 9900000, 11, 600000, 700000, 8, 600000, 700000, 12, 100000, 1e15,
  3675. 2, 400004, 14800000, 5, 300006, 6500000, 1, 400000, 6500000, 3, 2500000,
  3676. 4600000, 0, 2500000, 4600000, 11, 700000, 1100000, 8, 700000, 1100000, 12,
  3677. 100005, 500000, 2, 400004, 4600000, 11, 700000, 1100000, 8, 700000, 1100000,
  3678. 3, 2200000, 4600000, 0, 2500000, 4600000, 12, 100005, 500000, 2, 400004,
  3679. 4600000, 11, 700000, 1100000, 8, 700000, 1100000, 3, 2500000, 4600000, 0,
  3680. 2500000, 4600000, 12, 100005, 500000, 2, 400004, 4600000, 5, 100005, 8100000,
  3681. 1, 400000, 8100000, 11, 700000, 1300000, 8, 700000, 1300000, 3, 1600000, 1e15,
  3682. 0, 1800000, 1e15, 4, 7900000, 1e15, 10, 1500000, 1e15, 9, 1400000, 1e15, 12,
  3683. 100000, 1e15, 3, 1600000, 4800000, 10, 1500000, 3500000, 11, 600000, 1100000,
  3684. 8, 600000, 1100000, 5, 1000000, 5000000, 1, 1000000, 5000000, 5, 1700000,
  3685. 5000000, 1, 1700000, 5000000, 11, 700000, 1100000, 8, 700000, 1100000, 3,
  3686. 1600000, 4800000, 10, 1500000, 3500000, 11, 600000, 1100000, 8, 600000,
  3687. 1100000, 3, 1600000, 4800000, 10, 1500000, 3500000, 5, 100000, 300000
  3688. ]);
  3689. // Where each window list begins; the entry after it is where it ends.
  3690. const PREFIX_WINDOW_STARTS = new Int32Array([
  3691. 0, 21, 27, 48, 54, 78, 84, 90, 114, 138, 162, 186, 213, 219, 228, 252, 258,
  3692. 261, 267, 276, 279, 282, 306, 315, 327, 333, 339, 345, 357, 384, 390, 417,
  3693. 441, 450, 453, 465, 471, 495, 519, 525, 531, 537, 558, 561, 585, 591, 615,
  3694. 621, 642, 666, 687, 708, 723, 729, 750, 756, 777, 786, 813, 837, 843, 846,
  3695. 852, 876, 909, 933, 957, 984, 1011, 1038, 1065, 1092, 1098, 1101, 1104, 1128,
  3696. 1155, 1179, 1185, 1191, 1197, 1203, 1212, 1218, 1224, 1230, 1251, 1275, 1281,
  3697. 1287, 1293, 1299, 1305, 1329, 1335, 1341, 1365, 1383, 1389, 1395, 1413, 1419,
  3698. 1425, 1440, 1467, 1473, 1500, 1506, 1530, 1554, 1560, 1587, 1605, 1611, 1638,
  3699. 1644, 1668, 1674, 1680, 1707, 1713, 1740, 1746, 1752, 1758, 1764, 1770, 1794,
  3700. 1800, 1824, 1830, 1854, 1878, 1899, 1902, 1920, 1941, 1944, 1950, 1956, 1962,
  3701. 1989, 1995, 2013, 2031, 2049, 2055, 2061, 2079, 2091, 2097, 2103, 2115, 2127,
  3702. 2130
  3703. ]);
  3704. /** @type {Map<string, [string, number][]>} */
  3705. const PREFIXED_PROPERTIES = new Map([
  3706. [
  3707. "align-content",
  3708. [
  3709. ["-webkit-align-content", 0],
  3710. ["-ms-flex-line-pack", 1]
  3711. ]
  3712. ],
  3713. [
  3714. "align-items",
  3715. [
  3716. ["-webkit-align-items", 0],
  3717. ["-ms-flex-align", 1]
  3718. ]
  3719. ],
  3720. [
  3721. "align-self",
  3722. [
  3723. ["-webkit-align-self", 2],
  3724. ["-ms-flex-item-align", 1]
  3725. ]
  3726. ],
  3727. ["alt", [["-webkit-alt", 3]]],
  3728. [
  3729. "animation",
  3730. [
  3731. ["-webkit-animation", 4],
  3732. ["-moz-animation", 5],
  3733. ["-o-animation", 6]
  3734. ]
  3735. ],
  3736. [
  3737. "animation-delay",
  3738. [
  3739. ["-webkit-animation-delay", 7],
  3740. ["-moz-animation-delay", 5],
  3741. ["-o-animation-delay", 6]
  3742. ]
  3743. ],
  3744. [
  3745. "animation-direction",
  3746. [
  3747. ["-webkit-animation-direction", 7],
  3748. ["-moz-animation-direction", 5],
  3749. ["-o-animation-direction", 6]
  3750. ]
  3751. ],
  3752. [
  3753. "animation-duration",
  3754. [
  3755. ["-webkit-animation-duration", 8],
  3756. ["-moz-animation-duration", 5],
  3757. ["-o-animation-duration", 6]
  3758. ]
  3759. ],
  3760. [
  3761. "animation-fill-mode",
  3762. [
  3763. ["-webkit-animation-fill-mode", 9],
  3764. ["-moz-animation-fill-mode", 5],
  3765. ["-o-animation-fill-mode", 6]
  3766. ]
  3767. ],
  3768. [
  3769. "animation-iteration-count",
  3770. [
  3771. ["-webkit-animation-iteration-count", 7],
  3772. ["-moz-animation-iteration-count", 5],
  3773. ["-o-animation-iteration-count", 6]
  3774. ]
  3775. ],
  3776. [
  3777. "animation-name",
  3778. [
  3779. ["-webkit-animation-name", 7],
  3780. ["-moz-animation-name", 5],
  3781. ["-o-animation-name", 6]
  3782. ]
  3783. ],
  3784. [
  3785. "animation-play-state",
  3786. [
  3787. ["-webkit-animation-play-state", 10],
  3788. ["-moz-animation-play-state", 5],
  3789. ["-o-animation-play-state", 6]
  3790. ]
  3791. ],
  3792. [
  3793. "animation-timing-function",
  3794. [
  3795. ["-webkit-animation-timing-function", 7],
  3796. ["-moz-animation-timing-function", 5],
  3797. ["-o-animation-timing-function", 6]
  3798. ]
  3799. ],
  3800. [
  3801. "appearance",
  3802. [
  3803. ["-webkit-appearance", 11],
  3804. ["-moz-appearance", 12]
  3805. ]
  3806. ],
  3807. ["backdrop-filter", [["-webkit-backdrop-filter", 13]]],
  3808. [
  3809. "backface-visibility",
  3810. [
  3811. ["-webkit-backface-visibility", 14],
  3812. ["-moz-backface-visibility", 15]
  3813. ]
  3814. ],
  3815. [
  3816. "background-clip",
  3817. [
  3818. ["-moz-background-clip", 16],
  3819. ["-webkit-background-clip", 17]
  3820. ]
  3821. ],
  3822. ["background-origin", [["-moz-background-origin", 16]]],
  3823. [
  3824. "background-size",
  3825. [
  3826. ["-webkit-background-size", 18],
  3827. ["-moz-background-size", 19],
  3828. ["-o-background-size", 20]
  3829. ]
  3830. ],
  3831. ["block-size", [["-webkit-logical-height", 21]]],
  3832. [
  3833. "border-bottom-left-radius",
  3834. [
  3835. ["-webkit-border-bottom-left-radius", 22],
  3836. ["-moz-border-radius-bottomleft", 16]
  3837. ]
  3838. ],
  3839. [
  3840. "border-bottom-right-radius",
  3841. [
  3842. ["-webkit-border-bottom-right-radius", 22],
  3843. ["-moz-border-radius-bottomright", 16]
  3844. ]
  3845. ],
  3846. [
  3847. "border-image",
  3848. [
  3849. ["-webkit-border-image", 23],
  3850. ["-moz-border-image", 24],
  3851. ["-o-border-image", 25]
  3852. ]
  3853. ],
  3854. ["border-inline-end-color", [["-moz-border-end-color", 26]]],
  3855. ["border-inline-end-style", [["-moz-border-end-style", 26]]],
  3856. ["border-inline-end-width", [["-moz-border-end-width", 26]]],
  3857. ["border-inline-start-color", [["-moz-border-start-color", 26]]],
  3858. ["border-inline-start-style", [["-moz-border-start-style", 26]]],
  3859. [
  3860. "border-radius",
  3861. [
  3862. ["-webkit-border-radius", 27],
  3863. ["-moz-border-radius", 16]
  3864. ]
  3865. ],
  3866. [
  3867. "border-top-left-radius",
  3868. [
  3869. ["-webkit-border-top-left-radius", 22],
  3870. ["-moz-border-radius-topleft", 16]
  3871. ]
  3872. ],
  3873. [
  3874. "border-top-right-radius",
  3875. [
  3876. ["-webkit-border-top-right-radius", 22],
  3877. ["-moz-border-radius-topright", 16]
  3878. ]
  3879. ],
  3880. [
  3881. "box-align",
  3882. [
  3883. ["-webkit-box-align", 28],
  3884. ["-moz-box-align", 29]
  3885. ]
  3886. ],
  3887. ["box-decoration-break", [["-webkit-box-decoration-break", 30]]],
  3888. [
  3889. "box-direction",
  3890. [
  3891. ["-webkit-box-direction", 28],
  3892. ["-moz-box-direction", 29]
  3893. ]
  3894. ],
  3895. [
  3896. "box-flex",
  3897. [
  3898. ["-webkit-box-flex", 28],
  3899. ["-moz-box-flex", 29]
  3900. ]
  3901. ],
  3902. ["box-flex-group", [["-webkit-box-flex-group", 31]]],
  3903. ["box-lines", [["-webkit-box-lines", 31]]],
  3904. [
  3905. "box-ordinal-group",
  3906. [
  3907. ["-webkit-box-ordinal-group", 28],
  3908. ["-moz-box-ordinal-group", 29]
  3909. ]
  3910. ],
  3911. [
  3912. "box-orient",
  3913. [
  3914. ["-webkit-box-orient", 28],
  3915. ["-moz-box-orient", 29]
  3916. ]
  3917. ],
  3918. [
  3919. "box-pack",
  3920. [
  3921. ["-webkit-box-pack", 28],
  3922. ["-moz-box-pack", 29]
  3923. ]
  3924. ],
  3925. [
  3926. "box-shadow",
  3927. [
  3928. ["-webkit-box-shadow", 32],
  3929. ["-moz-box-shadow", 33]
  3930. ]
  3931. ],
  3932. [
  3933. "box-sizing",
  3934. [
  3935. ["-webkit-box-sizing", 34],
  3936. ["-moz-box-sizing", 35]
  3937. ]
  3938. ],
  3939. ["clip-path", [["-webkit-clip-path", 36]]],
  3940. [
  3941. "column-count",
  3942. [
  3943. ["-webkit-column-count", 37],
  3944. ["-moz-column-count", 38]
  3945. ]
  3946. ],
  3947. [
  3948. "column-fill",
  3949. [
  3950. ["-moz-column-fill", 39],
  3951. ["-webkit-column-fill", 40]
  3952. ]
  3953. ],
  3954. [
  3955. "column-gap",
  3956. [
  3957. ["-webkit-column-gap", 41],
  3958. ["-moz-column-gap", 42]
  3959. ]
  3960. ],
  3961. [
  3962. "column-rule",
  3963. [
  3964. ["-webkit-column-rule", 43],
  3965. ["-moz-column-rule", 44]
  3966. ]
  3967. ],
  3968. [
  3969. "column-rule-color",
  3970. [
  3971. ["-webkit-column-rule-color", 43],
  3972. ["-moz-column-rule-color", 44]
  3973. ]
  3974. ],
  3975. [
  3976. "column-rule-style",
  3977. [
  3978. ["-webkit-column-rule-style", 43],
  3979. ["-moz-column-rule-style", 44]
  3980. ]
  3981. ],
  3982. [
  3983. "column-rule-width",
  3984. [
  3985. ["-webkit-column-rule-width", 43],
  3986. ["-moz-column-rule-width", 44]
  3987. ]
  3988. ],
  3989. ["column-span", [["-webkit-column-span", 45]]],
  3990. [
  3991. "column-width",
  3992. [
  3993. ["-webkit-column-width", 43],
  3994. ["-moz-column-width", 38]
  3995. ]
  3996. ],
  3997. [
  3998. "columns",
  3999. [
  4000. ["-moz-columns", 46],
  4001. ["-webkit-columns", 47]
  4002. ]
  4003. ],
  4004. ["filter", [["-webkit-filter", 48]]],
  4005. [
  4006. "flex",
  4007. [
  4008. ["-webkit-flex", 2],
  4009. ["-ms-flex", 1]
  4010. ]
  4011. ],
  4012. [
  4013. "flex-basis",
  4014. [
  4015. ["-webkit-flex-basis", 49],
  4016. ["-ms-flex-preferred-size", 1]
  4017. ]
  4018. ],
  4019. [
  4020. "flex-direction",
  4021. [
  4022. ["-webkit-flex-direction", 2],
  4023. ["-ms-flex-direction", 1]
  4024. ]
  4025. ],
  4026. [
  4027. "flex-flow",
  4028. [
  4029. ["-webkit-flex-flow", 2],
  4030. ["-ms-flex-flow", 1]
  4031. ]
  4032. ],
  4033. [
  4034. "flex-grow",
  4035. [
  4036. ["-webkit-flex-grow", 49],
  4037. ["-ms-flex-positive", 1]
  4038. ]
  4039. ],
  4040. [
  4041. "flex-shrink",
  4042. [
  4043. ["-webkit-flex-shrink", 50],
  4044. ["-ms-flex-negative", 1]
  4045. ]
  4046. ],
  4047. [
  4048. "flex-wrap",
  4049. [
  4050. ["-webkit-flex-wrap", 0],
  4051. ["-ms-flex-wrap", 1]
  4052. ]
  4053. ],
  4054. [
  4055. "font-feature-settings",
  4056. [
  4057. ["-webkit-font-feature-settings", 51],
  4058. ["-moz-font-feature-settings", 52]
  4059. ]
  4060. ],
  4061. ["font-kerning", [["-webkit-font-kerning", 53]]],
  4062. ["font-language-override", [["-moz-font-language-override", 54]]],
  4063. ["font-variant-ligatures", [["-webkit-font-variant-ligatures", 55]]],
  4064. ["forced-color-adjust", [["-ms-high-contrast-adjust", 56]]],
  4065. ["hyphenate-character", [["-webkit-hyphenate-character", 57]]],
  4066. [
  4067. "hyphens",
  4068. [
  4069. ["-webkit-hyphens", 58],
  4070. ["-ms-hyphens", 56],
  4071. ["-moz-hyphens", 59]
  4072. ]
  4073. ],
  4074. ["ime-mode", [["-ms-ime-mode", 60]]],
  4075. ["initial-letter", [["-webkit-initial-letter", 61]]],
  4076. ["inline-size", [["-webkit-logical-width", 21]]],
  4077. [
  4078. "justify-content",
  4079. [
  4080. ["-webkit-justify-content", 2],
  4081. ["-ms-flex-pack", 1]
  4082. ]
  4083. ],
  4084. ["line-break", [["-webkit-line-break", 62]]],
  4085. ["line-clamp", [["-webkit-line-clamp", 63]]],
  4086. ["margin-block-end", [["-webkit-margin-after", 64]]],
  4087. ["margin-block-start", [["-webkit-margin-before", 64]]],
  4088. [
  4089. "margin-inline-end",
  4090. [
  4091. ["-webkit-margin-end", 65],
  4092. ["-moz-margin-end", 26]
  4093. ]
  4094. ],
  4095. [
  4096. "margin-inline-start",
  4097. [
  4098. ["-webkit-margin-start", 65],
  4099. ["-moz-margin-start", 26]
  4100. ]
  4101. ],
  4102. ["mask", [["-webkit-mask", 66]]],
  4103. ["mask-border", [["-webkit-mask-box-image", 67]]],
  4104. ["mask-border-outset", [["-webkit-mask-box-image-outset", 67]]],
  4105. ["mask-border-repeat", [["-webkit-mask-box-image-repeat", 67]]],
  4106. ["mask-border-slice", [["-webkit-mask-box-image-slice", 67]]],
  4107. ["mask-border-source", [["-webkit-mask-box-image-source", 67]]],
  4108. ["mask-border-width", [["-webkit-mask-box-image-width", 67]]],
  4109. ["mask-clip", [["-webkit-mask-clip", 68]]],
  4110. ["mask-image", [["-webkit-mask-image", 69]]],
  4111. ["mask-origin", [["-webkit-mask-origin", 68]]],
  4112. ["mask-position", [["-webkit-mask-position", 66]]],
  4113. ["mask-repeat", [["-webkit-mask-repeat", 66]]],
  4114. ["mask-size", [["-webkit-mask-size", 70]]],
  4115. ["max-block-size", [["-webkit-max-logical-height", 21]]],
  4116. ["max-inline-size", [["-webkit-max-logical-width", 21]]],
  4117. ["min-block-size", [["-webkit-min-logical-height", 21]]],
  4118. ["min-inline-size", [["-webkit-min-logical-width", 21]]],
  4119. ["object-fit", [["-o-object-fit", 71]]],
  4120. ["object-position", [["-o-object-position", 71]]],
  4121. [
  4122. "order",
  4123. [
  4124. ["-webkit-order", 2],
  4125. ["-ms-flex-order", 1]
  4126. ]
  4127. ],
  4128. ["outline", [["-moz-outline", 72]]],
  4129. ["outline-color", [["-moz-outline-color", 73]]],
  4130. ["outline-style", [["-moz-outline-style", 73]]],
  4131. ["outline-width", [["-moz-outline-width", 73]]],
  4132. [
  4133. "padding-inline-end",
  4134. [
  4135. ["-webkit-padding-end", 65],
  4136. ["-moz-padding-end", 26]
  4137. ]
  4138. ],
  4139. [
  4140. "padding-inline-start",
  4141. [
  4142. ["-webkit-padding-start", 65],
  4143. ["-moz-padding-start", 26]
  4144. ]
  4145. ],
  4146. [
  4147. "perspective",
  4148. [
  4149. ["-webkit-perspective", 74],
  4150. ["-moz-perspective", 15]
  4151. ]
  4152. ],
  4153. [
  4154. "perspective-origin",
  4155. [
  4156. ["-webkit-perspective-origin", 74],
  4157. ["-moz-perspective-origin", 15]
  4158. ]
  4159. ],
  4160. ["print-color-adjust", [["-webkit-print-color-adjust", 75]]],
  4161. ["ruby-position", [["-webkit-ruby-position", 76]]],
  4162. [
  4163. "scroll-snap-type",
  4164. [
  4165. ["-ms-scroll-snap-type", 56],
  4166. ["-webkit-scroll-snap-type", 77]
  4167. ]
  4168. ],
  4169. ["shape-image-threshold", [["-webkit-shape-image-threshold", 78]]],
  4170. ["shape-margin", [["-webkit-shape-margin", 78]]],
  4171. ["shape-outside", [["-webkit-shape-outside", 78]]],
  4172. [
  4173. "tab-size",
  4174. [
  4175. ["-moz-tab-size", 79],
  4176. ["-o-tab-size", 25]
  4177. ]
  4178. ],
  4179. ["text-align-last", [["-moz-text-align-last", 80]]],
  4180. ["text-combine-upright", [["-ms-text-combine-horizontal", 81]]],
  4181. [
  4182. "text-decoration-color",
  4183. [
  4184. ["-moz-text-decoration-color", 82],
  4185. ["-webkit-text-decoration-color", 83]
  4186. ]
  4187. ],
  4188. [
  4189. "text-decoration-line",
  4190. [
  4191. ["-moz-text-decoration-line", 82],
  4192. ["-webkit-text-decoration-line", 83]
  4193. ]
  4194. ],
  4195. ["text-decoration-skip", [["-webkit-text-decoration-skip", 84]]],
  4196. [
  4197. "text-decoration-style",
  4198. [
  4199. ["-moz-text-decoration-style", 82],
  4200. ["-webkit-text-decoration-style", 83]
  4201. ]
  4202. ],
  4203. ["text-emphasis", [["-webkit-text-emphasis", 85]]],
  4204. ["text-emphasis-color", [["-webkit-text-emphasis-color", 85]]],
  4205. ["text-emphasis-position", [["-webkit-text-emphasis-position", 85]]],
  4206. ["text-emphasis-style", [["-webkit-text-emphasis-style", 85]]],
  4207. ["text-orientation", [["-webkit-text-orientation", 86]]],
  4208. ["text-overflow", [["-o-text-overflow", 87]]],
  4209. [
  4210. "text-size-adjust",
  4211. [
  4212. ["-webkit-text-size-adjust", 88],
  4213. ["-moz-text-size-adjust", 89],
  4214. ["-ms-text-size-adjust", 90]
  4215. ]
  4216. ],
  4217. ["text-underline-position", [["-webkit-text-underline-position", 91]]],
  4218. ["touch-action", [["-ms-touch-action", 1]]],
  4219. [
  4220. "transform",
  4221. [
  4222. ["-webkit-transform", 92],
  4223. ["-moz-transform", 93],
  4224. ["-ms-transform", 94],
  4225. ["-o-transform", 25]
  4226. ]
  4227. ],
  4228. [
  4229. "transform-origin",
  4230. [
  4231. ["-webkit-transform-origin", 95],
  4232. ["-moz-transform-origin", 93],
  4233. ["-ms-transform-origin", 94],
  4234. ["-o-transform-origin", 25]
  4235. ]
  4236. ],
  4237. [
  4238. "transform-style",
  4239. [
  4240. ["-webkit-transform-style", 74],
  4241. ["-moz-transform-style", 15]
  4242. ]
  4243. ],
  4244. [
  4245. "transition",
  4246. [
  4247. ["-webkit-transition", 96],
  4248. ["-moz-transition", 97],
  4249. ["-o-transition", 98]
  4250. ]
  4251. ],
  4252. [
  4253. "transition-delay",
  4254. [
  4255. ["-webkit-transition-delay", 99],
  4256. ["-moz-transition-delay", 97],
  4257. ["-o-transition-delay", 100]
  4258. ]
  4259. ],
  4260. [
  4261. "transition-duration",
  4262. [
  4263. ["-webkit-transition-duration", 96],
  4264. ["-moz-transition-duration", 97],
  4265. ["-o-transition-duration", 101]
  4266. ]
  4267. ],
  4268. [
  4269. "transition-property",
  4270. [
  4271. ["-webkit-transition-property", 102],
  4272. ["-moz-transition-property", 97],
  4273. ["-o-transition-property", 100]
  4274. ]
  4275. ],
  4276. [
  4277. "transition-timing-function",
  4278. [
  4279. ["-webkit-transition-timing-function", 102],
  4280. ["-moz-transition-timing-function", 97],
  4281. ["-o-transition-timing-function", 100]
  4282. ]
  4283. ],
  4284. [
  4285. "user-modify",
  4286. [
  4287. ["-webkit-user-modify", 103],
  4288. ["-moz-user-modify", 104]
  4289. ]
  4290. ],
  4291. [
  4292. "user-select",
  4293. [
  4294. ["-webkit-user-select", 105],
  4295. ["-ms-user-select", 56],
  4296. ["-moz-user-select", 106]
  4297. ]
  4298. ],
  4299. ["writing-mode", [["-webkit-writing-mode", 107]]]
  4300. ]);
  4301. /** @type {Map<string, [string, number][]>} */
  4302. const PREFIXED_SELECTORS = new Map([
  4303. [
  4304. "any-link",
  4305. [
  4306. ["-webkit-any-link", 108],
  4307. ["-moz-any-link", 109]
  4308. ]
  4309. ],
  4310. ["autofill", [["-webkit-autofill", 110]]],
  4311. [
  4312. "backdrop",
  4313. [
  4314. ["-webkit-backdrop", 111],
  4315. ["-ms-backdrop", 81]
  4316. ]
  4317. ],
  4318. ["dir", [["-moz-dir", 112]]],
  4319. [
  4320. "file-selector-button",
  4321. [
  4322. ["-webkit-file-upload-button", 113],
  4323. ["-ms-browse", 56]
  4324. ]
  4325. ],
  4326. ["focus-visible", [["-moz-focusring", 114]]],
  4327. [
  4328. "fullscreen",
  4329. [
  4330. ["-webkit-full-screen", 115],
  4331. ["-moz-full-screen", 116],
  4332. ["-ms-fullscreen", 117]
  4333. ]
  4334. ],
  4335. [
  4336. "is",
  4337. [
  4338. ["-webkit-any", 118],
  4339. ["-moz-any", 119]
  4340. ]
  4341. ],
  4342. [
  4343. "placeholder",
  4344. [
  4345. ["-webkit-input-placeholder", 120],
  4346. ["-ms-input-placeholder", 60],
  4347. ["-moz-placeholder", 121]
  4348. ]
  4349. ],
  4350. ["read-only", [["-moz-read-only", 122]]],
  4351. ["read-write", [["-moz-read-write", 122]]],
  4352. ["selection", [["-moz-selection", 123]]],
  4353. ["user-invalid", [["-moz-ui-invalid", 124]]],
  4354. ["user-valid", [["-moz-ui-valid", 124]]]
  4355. ]);
  4356. /** @type {Map<string, [string, number][]>} */
  4357. const PREFIXED_AT_RULES = new Map([
  4358. ["document", [["-moz-document", 125]]],
  4359. [
  4360. "keyframes",
  4361. [
  4362. ["-webkit-keyframes", 126],
  4363. ["-moz-keyframes", 5],
  4364. ["-o-keyframes", 6]
  4365. ]
  4366. ]
  4367. ]);
  4368. // The version a browser that never shipped a construct is given below, and the
  4369. // one a spelling still prefixed today is unprefixed at. Finite and a plain
  4370. // number, so both version tables hold numbers alone; far past any real version,
  4371. // and past the one Safari TP is read as.
  4372. const NEVER = 1e15;
  4373. // The browsers every support profile below covers, in the order it states them.
  4374. // A selection has an ability when every browser in it is named here and at or
  4375. // past the version its profile row gives.
  4376. /** @type {string[]} */
  4377. const SUPPORT_BROWSERS = [
  4378. "and_chr",
  4379. "and_ff",
  4380. "android",
  4381. "chrome",
  4382. "edge",
  4383. "firefox",
  4384. "ie",
  4385. "ie_mob",
  4386. "ios_saf",
  4387. "op_mob",
  4388. "opera",
  4389. "safari",
  4390. "samsung"
  4391. ];
  4392. // The versions themselves, rows of `SUPPORT_BROWSERS.length` laid end to end,
  4393. // one row per distinct profile: a construct names the row it reads rather than
  4394. // carrying its own copy of it. `NEVER` is a browser that never shipped it.
  4395. const SUPPORT_PROFILES = new Float64Array([
  4396. 6200000, 4900000, 6200000, 6200000, 7900000, 4900000, 1e15, 1e15, 900003,
  4397. 4700000, 4900000, 1000000, 800000, 7200000, 8300000, 7200000, 7200000,
  4398. 7900000, 8300000, 1e15, 1e15, 1200002, 5100000, 6000000, 1200001, 1100000,
  4399. 8700000, 6600000, 8700000, 8700000, 8700000, 6600000, 1e15, 1e15, 1400005,
  4400. 6200000, 7300000, 1400001, 1400000, 10400000, 10200000, 10400000, 10400000,
  4401. 10400000, 10200000, 1e15, 1e15, 1600004, 7100000, 9000000, 1600004, 2000000,
  4402. 6800000, 6100000, 6800000, 6800000, 7900000, 6100000, 1e15, 1e15, 1300004,
  4403. 4800000, 5500000, 1300001, 1000000, 5900000, 4500000, 5900000, 5900000,
  4404. 7900000, 4500000, 1e15, 1e15, 1100000, 4300000, 4600000, 1100000, 700000,
  4405. 1800000, 400000, 400004, 100000, 1200000, 100005, 900000, 900000, 300002,
  4406. 1000001, 700000, 400000, 100000, 3700000, 4700000, 3700000, 3700000, 7900000,
  4407. 4700000, 1e15, 1e15, 1500004, 2400000, 2400000, 1500004, 300000, 1800000,
  4408. 400000, 400004, 100000, 1200000, 100005, 900000, 900000, 300000, 1000001,
  4409. 700000, 400000, 100000, 13300000, 1e15, 13300000, 13300000, 13300000, 1e15,
  4410. 1e15, 1e15, 2700000, 8800000, 11800000, 2700000, 2900000, 2600000, 5500000,
  4411. 400004, 2600000, 7900000, 5500000, 1e15, 1e15, 700000, 1400000, 1500000,
  4412. 700000, 100005, 13100000, 14300000, 13100000, 13100000, 13100000, 14300000,
  4413. 1e15, 1e15, 1800004, 8700000, 11600000, 1800004, 2900000, 8900000, 8200000,
  4414. 8900000, 8900000, 8900000, 8200000, 1e15, 1e15, 1400005, 6300000, 7500000,
  4415. 1400001, 1500000, 1800000, 400000, 3700000, 100000, 1200000, 100000, 900000,
  4416. 900000, 100000, 1000001, 700000, 100000, 100000, 1800000, 400000, 400004,
  4417. 100000, 1200000, 100000, 900000, 900000, 100000, 1000001, 700000, 100000,
  4418. 100000, 12100000, 1e15, 12100000, 12100000, 12100000, 1e15, 1e15, 1e15,
  4419. 1700004, 8100000, 10700000, 1700004, 2500000, 10500000, 14900000, 10500000,
  4420. 10500000, 10500000, 14900000, 1e15, 1e15, 1700002, 7200000, 9100000, 1700002,
  4421. 2000000, 8600000, 6800000, 8600000, 8600000, 8600000, 6800000, 1e15, 1e15,
  4422. 1100003, 6100000, 7200000, 1100001, 1400000, 7300000, 7900000, 7300000,
  4423. 7300000, 7900000, 7200000, 1e15, 1e15, 1300004, 5200000, 6000000, 1300001,
  4424. 1100000, 13500000, 1e15, 13500000, 13500000, 13500000, 1e15, 1e15, 1e15,
  4425. 2700000, 8900000, 12000000, 2700000, 2900000, 5700000, 5100000, 5700000,
  4426. 5700000, 7900000, 5100000, 1e15, 1e15, 1000003, 4300000, 4400000, 1000001,
  4427. 700000, 1800000, 6200000, 3700000, 100000, 1200000, 6200000, 900000, 900000,
  4428. 1e15, 1400000, 900005, 100001, 100000, 5000000, 6300000, 5000000, 5000000,
  4429. 7900000, 6300000, 1e15, 1e15, 1000000, 3700000, 3700000, 1000000, 500000,
  4430. 8900000, 13100000, 8900000, 8900000, 8900000, 13100000, 1e15, 1e15, 1800002,
  4431. 6300000, 7500000, 1800002, 1500000, 10900000, 14400000, 10900000, 10900000,
  4432. 10900000, 14400000, 1e15, 1e15, 1800000, 7400000, 9500000, 1800000, 2100000,
  4433. 1800000, 400000, 400004, 100000, 1200000, 100000, 400000, 400000, 100000,
  4434. 1000001, 500000, 100000, 100000, 12500000, 14400000, 12500000, 12500000,
  4435. 12500000, 14400000, 1e15, 1e15, 1800000, 8300000, 11100000, 1800000, 2700000,
  4436. 12500000, 14700000, 12500000, 12500000, 12500000, 14700000, 1e15, 1e15,
  4437. 1800002, 8300000, 11100000, 1800002, 2700000, 6500000, 5000000, 6500000,
  4438. 6500000, 7900000, 5000000, 1e15, 1e15, 900000, 4700000, 5200000, 900000,
  4439. 900000, 11000000, 8600000, 11000000, 11000000, 11000000, 8600000, 1e15, 1e15,
  4440. 1500000, 7400000, 9600000, 1500000, 2100000, 15200000, 15000000, 15200000,
  4441. 15200000, 15200000, 15000000, 1e15, 1e15, 1500004, 1e15, 13600000, 1500004,
  4442. 1e15, 1800000, 400000, 200000, 100000, 1200000, 100000, 900000, 900000,
  4443. 200000, 1000001, 900000, 300001, 100000, 1800000, 400000, 3700000, 1000000,
  4444. 7900000, 400000, 1e15, 1e15, 500000, 1000001, 1000000, 500000, 100000,
  4445. 5400000, 6300000, 5400000, 5400000, 7900000, 6300000, 1e15, 1e15, 1000000,
  4446. 4100000, 4100000, 1000000, 600000, 12000000, 4900000, 12000000, 12000000,
  4447. 12000000, 4900000, 1e15, 1e15, 1600004, 8000000, 10600000, 1600004, 2500000,
  4448. 1800000, 400000, 200000, 100000, 1200000, 100000, 900000, 900000, 200000,
  4449. 1000001, 900005, 300001, 100000, 1800000, 11600000, 400004, 1800000, 1200000,
  4450. 11600000, 800000, 800000, 600000, 1000001, 900002, 600000, 100000, 1800000,
  4451. 400000, 400004, 400000, 1200000, 300000, 700000, 700000, 400000, 1000001,
  4452. 900005, 300001, 100000, 1800000, 400000, 200000, 100000, 1200000, 300005,
  4453. 900000, 900000, 200000, 1000001, 900005, 300001, 100000, 1800000, 400000,
  4454. 400004, 100000, 1200000, 100000, 800000, 800000, 100000, 1000001, 700000,
  4455. 100000, 100000, 8600000, 8500000, 8600000, 8600000, 8600000, 8500000, 1e15,
  4456. 1e15, 1500004, 6100000, 7200000, 1500004, 1400000, 6000000, 5200000, 6000000,
  4457. 6000000, 7900000, 5200000, 1e15, 1e15, 1000003, 4400000, 4700000, 1000001,
  4458. 800000, 7100000, 6400000, 7100000, 7100000, 1200000, 6400000, 1e15, 1e15,
  4459. 1600004, 5000000, 5800000, 1600004, 1000000, 2500000, 1e15, 400004, 2300000,
  4460. 7900000, 1e15, 1e15, 1e15, 700000, 1400000, 1500000, 700000, 100005, 10500000,
  4461. 12100000, 10500000, 10500000, 10500000, 12100000, 1e15, 1e15, 1500004,
  4462. 7200000, 9100000, 1500004, 2000000, 1e15, 13600000, 1e15, 1e15, 1e15,
  4463. 13600000, 1e15, 1e15, 1e15, 1e15, 1e15, 1e15, 1e15, 5400000, 1e15, 5400000,
  4464. 5400000, 7900000, 1e15, 1e15, 1e15, 1e15, 4100000, 4100000, 1e15, 600000,
  4465. 1800000, 400000, 400004, 100000, 1200000, 100000, 400000, 400000, 100000,
  4466. 1000001, 400000, 200000, 100000, 1800000, 1600000, 200002, 1000000, 1300000,
  4467. 2900000, 1e15, 1e15, 500000, 1100000, 1100000, 500001, 100000, 1800000,
  4468. 400000, 400004, 100000, 1200000, 200000, 1000000, 1000000, 100000, 1000001,
  4469. 900000, 300000, 100000, 1800000, 400000, 3700000, 1000000, 1200000, 400000,
  4470. 1000000, 1000000, 500000, 1000001, 1000000, 500000, 100000, 8800000, 7900000,
  4471. 8800000, 8800000, 8800000, 7800000, 1e15, 1e15, 1400000, 6300000, 7400000,
  4472. 1400000, 1500000, 1800000, 400000, 400004, 100000, 1200000, 100000, 800000,
  4473. 800000, 200000, 1000001, 800000, 300001, 100000, 1800000, 400000, 400004,
  4474. 100000, 1200000, 100000, 900000, 900000, 200000, 1000001, 900005, 300001,
  4475. 100000, 1800000, 1e15, 400004, 600000, 1200000, 1e15, 800000, 800000, 400002,
  4476. 1000001, 900002, 500000, 100000, 1800000, 400000, 100005, 100000, 1200000,
  4477. 100000, 300000, 300000, 300002, 1400000, 300005, 100000, 100000, 10500000,
  4478. 10300000, 10500000, 10500000, 10500000, 10300000, 1e15, 1e15, 1500006,
  4479. 7200000, 9100000, 1500006, 2000000, 1800000, 400000, 400004, 100000, 1200000,
  4480. 300005, 900000, 900000, 200000, 1000001, 900005, 300001, 100000, 1800000,
  4481. 400000, 400004, 400000, 1200000, 300005, 900000, 900000, 200000, 1000001,
  4482. 900000, 300001, 100000, 1800000, 400000, 200000, 400000, 1200000, 300005,
  4483. 900000, 900000, 200000, 1000001, 900005, 300001, 100000, 1800000, 400000,
  4484. 400004, 200000, 1200000, 100005, 900000, 900000, 200000, 1000001, 900005,
  4485. 300001, 100000, 13300000, 13600000, 13300000, 13300000, 13300000, 13600000,
  4486. 1e15, 1e15, 2600005, 8800000, 11800000, 2600005, 2900000, 11000000, 1e15,
  4487. 11000000, 11000000, 11000000, 15300000, 1e15, 1e15, 1300004, 7400000, 9600000,
  4488. 1300001, 2100000, 4700000, 5100000, 4700000, 4700000, 7900000, 5100000, 1e15,
  4489. 1e15, 900000, 3400000, 3400000, 900000, 500000, 11400000, 12500000, 11400000,
  4490. 11400000, 11400000, 12500000, 1e15, 1e15, 1700000, 7600000, 10000000, 1700000,
  4491. 2300000, 1800000, 7900000, 400004, 100000, 1300000, 7800000, 1e15, 1e15,
  4492. 300002, 1000001, 900000, 400000, 100000, 1800000, 400000, 400004, 1000000,
  4493. 1200000, 400000, 1000000, 1000000, 500000, 1000001, 1000000, 500000, 100000,
  4494. 1800000, 400000, 3700000, 100000, 1200000, 100000, 900000, 900000, 100000,
  4495. 1400000, 900005, 100000, 100000, 2700000, 3200000, 400004, 2700000, 7900000,
  4496. 3200000, 1e15, 1e15, 700000, 1500000, 1500000, 700000, 100005, 12500000,
  4497. 12600000, 12500000, 12500000, 12500000, 12600000, 1e15, 1e15, 1e15, 8300000,
  4498. 11100000, 1700004, 2700000, 1800000, 400000, 200000, 100000, 1200000, 100000,
  4499. 900000, 900000, 200000, 1000001, 900005, 100003, 100000, 11900000, 8800000,
  4500. 11900000, 11900000, 11900000, 8800000, 1e15, 1e15, 1600005, 7900000, 10500000,
  4501. 1600005, 2500000, 1800000, 400000, 400004, 100000, 1200000, 100000, 400000,
  4502. 400000, 100000, 1000001, 300005, 100000, 100000
  4503. ]);
  4504. /** @type {Map<string, number>} */
  4505. const SUPPORTED_FROM = new Map([
  4506. ["colorHexAlpha", 0],
  4507. ["gradientDoublePosition", 1],
  4508. ["insetShorthand", 2],
  4509. ["mediaQueryRange", 3],
  4510. ["overflowTwoValues", 4],
  4511. ["placeShorthand", 5]
  4512. ]);
  4513. // When each browser first read a pseudo-class or pseudo-element, by the spelling
  4514. // a selector carries. A pseudo missing here is one no target is known to read,
  4515. // so it never joins a selector list.
  4516. /** @type {Map<string, number>} */
  4517. const SELECTOR_SUPPORTED_FROM = new Map([
  4518. ["::after", 6],
  4519. ["::backdrop", 7],
  4520. ["::before", 8],
  4521. ["::checkmark", 9],
  4522. ["::cue", 10],
  4523. ["::cue", 10],
  4524. ["::details-content", 11],
  4525. ["::file-selector-button", 12],
  4526. ["::first-letter", 13],
  4527. ["::first-line", 14],
  4528. ["::grammar-error", 15],
  4529. ["::highlight", 16],
  4530. ["::marker", 17],
  4531. ["::part", 18],
  4532. ["::picker", 19],
  4533. ["::picker-icon", 9],
  4534. ["::placeholder", 20],
  4535. ["::selection", 21],
  4536. ["::slotted", 22],
  4537. ["::spelling-error", 15],
  4538. ["::target-text", 23],
  4539. ["::view-transition", 24],
  4540. ["::view-transition-group", 24],
  4541. ["::view-transition-image-pair", 24],
  4542. ["::view-transition-new", 24],
  4543. ["::view-transition-old", 24],
  4544. [":active", 25],
  4545. [":active-view-transition", 26],
  4546. [":active-view-transition-type", 27],
  4547. [":any-link", 28],
  4548. [":autofill", 29],
  4549. [":buffering", 30],
  4550. [":checked", 31],
  4551. [":default", 32],
  4552. [":defined", 33],
  4553. [":dir", 34],
  4554. [":disabled", 31],
  4555. [":empty", 35],
  4556. [":enabled", 31],
  4557. [":first", 36],
  4558. [":first-child", 37],
  4559. [":first-of-type", 38],
  4560. [":focus", 39],
  4561. [":focus-visible", 40],
  4562. [":focus-within", 41],
  4563. [":fullscreen", 42],
  4564. [":future", 43],
  4565. [":has", 44],
  4566. [":has-slotted", 45],
  4567. [":host", 33],
  4568. [":host", 33],
  4569. [":host-context", 46],
  4570. [":hover", 47],
  4571. [":in-range", 48],
  4572. [":indeterminate", 49],
  4573. [":invalid", 50],
  4574. [":is", 51],
  4575. [":lang", 52],
  4576. [":last-child", 53],
  4577. [":last-of-type", 38],
  4578. [":left", 54],
  4579. [":link", 55],
  4580. [":modal", 56],
  4581. [":muted", 30],
  4582. [":not", 35],
  4583. [":nth-child", 57],
  4584. [":nth-last-child", 58],
  4585. [":nth-last-of-type", 59],
  4586. [":nth-of-type", 38],
  4587. [":only-child", 60],
  4588. [":only-of-type", 38],
  4589. [":open", 61],
  4590. [":optional", 50],
  4591. [":out-of-range", 48],
  4592. [":past", 43],
  4593. [":paused", 30],
  4594. [":picture-in-picture", 62],
  4595. [":placeholder-shown", 63],
  4596. [":playing", 30],
  4597. [":popover-open", 64],
  4598. [":read-only", 65],
  4599. [":read-write", 65],
  4600. [":required", 66],
  4601. [":right", 54],
  4602. [":root", 67],
  4603. [":scope", 68],
  4604. [":seeking", 30],
  4605. [":stalled", 30],
  4606. [":state", 69],
  4607. [":target", 70],
  4608. [":user-invalid", 71],
  4609. [":user-valid", 71],
  4610. [":valid", 50],
  4611. [":visited", 72],
  4612. [":volume-locked", 30],
  4613. [":where", 51]
  4614. ]);
  4615. // The vendor spellings of a property's own keyword values, as `property ->
  4616. // keyword -> [spelling, [browserslistBrowser, from, to][]][]` — `display:flex`
  4617. // was `display:-webkit-flex`, and `width:max-content` `width:-moz-max-content`.
  4618. // Only keywords the property's syntax names are here, so a function whose older
  4619. // spelling read its arguments differently is not.
  4620. /** @type {Map<string, Map<string, [string, number][]>>} */
  4621. const PREFIXED_VALUES = new Map([
  4622. [
  4623. "block-size",
  4624. new Map([
  4625. [
  4626. "fit-content",
  4627. [
  4628. ["-moz-fit-content", 127],
  4629. ["-webkit-fit-content", 128]
  4630. ]
  4631. ],
  4632. [
  4633. "max-content",
  4634. [
  4635. ["-moz-max-content", 129],
  4636. ["-webkit-max-content", 130]
  4637. ]
  4638. ],
  4639. [
  4640. "min-content",
  4641. [
  4642. ["-moz-min-content", 129],
  4643. ["-webkit-min-content", 131]
  4644. ]
  4645. ]
  4646. ])
  4647. ],
  4648. [
  4649. "cursor",
  4650. new Map([
  4651. [
  4652. "grab",
  4653. [
  4654. ["-webkit-grab", 132],
  4655. ["-moz-grab", 133]
  4656. ]
  4657. ],
  4658. ["grabbing", [["-webkit-grabbing", 134]]],
  4659. [
  4660. "zoom-in",
  4661. [
  4662. ["-webkit-zoom-in", 135],
  4663. ["-moz-zoom-in", 136]
  4664. ]
  4665. ],
  4666. [
  4667. "zoom-out",
  4668. [
  4669. ["-webkit-zoom-out", 135],
  4670. ["-moz-zoom-out", 136]
  4671. ]
  4672. ]
  4673. ])
  4674. ],
  4675. [
  4676. "display",
  4677. new Map([
  4678. [
  4679. "flex",
  4680. [
  4681. ["-webkit-flex", 0],
  4682. ["-ms-flexbox", 137]
  4683. ]
  4684. ],
  4685. [
  4686. "inline-flex",
  4687. [
  4688. ["-webkit-inline-flex", 0],
  4689. ["-ms-inline-flexbox", 137]
  4690. ]
  4691. ]
  4692. ])
  4693. ],
  4694. [
  4695. "flex-basis",
  4696. new Map([
  4697. ["fit-content", [["-moz-fit-content", 138]]],
  4698. ["max-content", [["-moz-max-content", 139]]],
  4699. ["min-content", [["-moz-min-content", 139]]]
  4700. ])
  4701. ],
  4702. [
  4703. "height",
  4704. new Map([
  4705. [
  4706. "fit-content",
  4707. [
  4708. ["-moz-fit-content", 127],
  4709. ["-webkit-fit-content", 128]
  4710. ]
  4711. ],
  4712. [
  4713. "max-content",
  4714. [
  4715. ["-moz-max-content", 129],
  4716. ["-webkit-max-content", 130]
  4717. ]
  4718. ],
  4719. [
  4720. "min-content",
  4721. [
  4722. ["-moz-min-content", 129],
  4723. ["-webkit-min-content", 131]
  4724. ]
  4725. ]
  4726. ])
  4727. ],
  4728. [
  4729. "image-rendering",
  4730. new Map([
  4731. [
  4732. "crisp-edges",
  4733. [
  4734. ["-webkit-optimize-contrast", 140],
  4735. ["-moz-crisp-edges", 141]
  4736. ]
  4737. ]
  4738. ])
  4739. ],
  4740. [
  4741. "inline-size",
  4742. new Map([
  4743. [
  4744. "fit-content",
  4745. [
  4746. ["-moz-fit-content", 127],
  4747. ["-webkit-fit-content", 128]
  4748. ]
  4749. ],
  4750. [
  4751. "max-content",
  4752. [
  4753. ["-moz-max-content", 129],
  4754. ["-webkit-max-content", 130]
  4755. ]
  4756. ],
  4757. [
  4758. "min-content",
  4759. [
  4760. ["-moz-min-content", 129],
  4761. ["-webkit-min-content", 131]
  4762. ]
  4763. ]
  4764. ])
  4765. ],
  4766. [
  4767. "max-block-size",
  4768. new Map([
  4769. [
  4770. "fit-content",
  4771. [
  4772. ["-webkit-fit-content", 142],
  4773. ["-moz-fit-content", 127]
  4774. ]
  4775. ],
  4776. [
  4777. "max-content",
  4778. [
  4779. ["-moz-max-content", 129],
  4780. ["-webkit-max-content", 143]
  4781. ]
  4782. ],
  4783. [
  4784. "min-content",
  4785. [
  4786. ["-moz-min-content", 129],
  4787. ["-webkit-min-content", 144]
  4788. ]
  4789. ]
  4790. ])
  4791. ],
  4792. [
  4793. "max-height",
  4794. new Map([
  4795. [
  4796. "fit-content",
  4797. [
  4798. ["-webkit-fit-content", 142],
  4799. ["-moz-fit-content", 127]
  4800. ]
  4801. ],
  4802. [
  4803. "max-content",
  4804. [
  4805. ["-moz-max-content", 129],
  4806. ["-webkit-max-content", 143]
  4807. ]
  4808. ],
  4809. [
  4810. "min-content",
  4811. [
  4812. ["-moz-min-content", 129],
  4813. ["-webkit-min-content", 144]
  4814. ]
  4815. ]
  4816. ])
  4817. ],
  4818. [
  4819. "max-inline-size",
  4820. new Map([
  4821. [
  4822. "fit-content",
  4823. [
  4824. ["-webkit-fit-content", 142],
  4825. ["-moz-fit-content", 127]
  4826. ]
  4827. ],
  4828. [
  4829. "max-content",
  4830. [
  4831. ["-moz-max-content", 129],
  4832. ["-webkit-max-content", 143]
  4833. ]
  4834. ],
  4835. [
  4836. "min-content",
  4837. [
  4838. ["-moz-min-content", 129],
  4839. ["-webkit-min-content", 144]
  4840. ]
  4841. ]
  4842. ])
  4843. ],
  4844. [
  4845. "max-width",
  4846. new Map([
  4847. [
  4848. "fit-content",
  4849. [
  4850. ["-webkit-fit-content", 142],
  4851. ["-moz-fit-content", 127]
  4852. ]
  4853. ],
  4854. [
  4855. "max-content",
  4856. [
  4857. ["-moz-max-content", 129],
  4858. ["-webkit-max-content", 143]
  4859. ]
  4860. ],
  4861. [
  4862. "min-content",
  4863. [
  4864. ["-moz-min-content", 129],
  4865. ["-webkit-min-content", 144]
  4866. ]
  4867. ]
  4868. ])
  4869. ],
  4870. [
  4871. "min-block-size",
  4872. new Map([
  4873. [
  4874. "fit-content",
  4875. [
  4876. ["-moz-fit-content", 127],
  4877. ["-webkit-fit-content", 128]
  4878. ]
  4879. ],
  4880. [
  4881. "max-content",
  4882. [
  4883. ["-moz-max-content", 129],
  4884. ["-webkit-max-content", 130]
  4885. ]
  4886. ],
  4887. [
  4888. "min-content",
  4889. [
  4890. ["-moz-min-content", 129],
  4891. ["-webkit-min-content", 131]
  4892. ]
  4893. ]
  4894. ])
  4895. ],
  4896. [
  4897. "min-height",
  4898. new Map([
  4899. [
  4900. "fit-content",
  4901. [
  4902. ["-moz-fit-content", 127],
  4903. ["-webkit-fit-content", 128]
  4904. ]
  4905. ],
  4906. [
  4907. "max-content",
  4908. [
  4909. ["-moz-max-content", 129],
  4910. ["-webkit-max-content", 130]
  4911. ]
  4912. ],
  4913. [
  4914. "min-content",
  4915. [
  4916. ["-moz-min-content", 129],
  4917. ["-webkit-min-content", 131]
  4918. ]
  4919. ]
  4920. ])
  4921. ],
  4922. [
  4923. "min-inline-size",
  4924. new Map([
  4925. [
  4926. "fit-content",
  4927. [
  4928. ["-moz-fit-content", 127],
  4929. ["-webkit-fit-content", 128]
  4930. ]
  4931. ],
  4932. [
  4933. "max-content",
  4934. [
  4935. ["-moz-max-content", 129],
  4936. ["-webkit-max-content", 130]
  4937. ]
  4938. ],
  4939. [
  4940. "min-content",
  4941. [
  4942. ["-moz-min-content", 129],
  4943. ["-webkit-min-content", 131]
  4944. ]
  4945. ]
  4946. ])
  4947. ],
  4948. [
  4949. "min-width",
  4950. new Map([
  4951. [
  4952. "fit-content",
  4953. [
  4954. ["-moz-fit-content", 127],
  4955. ["-webkit-fit-content", 128]
  4956. ]
  4957. ],
  4958. [
  4959. "max-content",
  4960. [
  4961. ["-moz-max-content", 129],
  4962. ["-webkit-max-content", 130]
  4963. ]
  4964. ],
  4965. [
  4966. "min-content",
  4967. [
  4968. ["-moz-min-content", 129],
  4969. ["-webkit-min-content", 131]
  4970. ]
  4971. ]
  4972. ])
  4973. ],
  4974. ["overflow", new Map([["clip", [["-moz-hidden-unscrollable", 145]]]])],
  4975. ["overflow-block", new Map([["clip", [["-moz-hidden-unscrollable", 145]]]])],
  4976. ["overflow-inline", new Map([["clip", [["-moz-hidden-unscrollable", 145]]]])],
  4977. ["overflow-x", new Map([["clip", [["-moz-hidden-unscrollable", 145]]]])],
  4978. ["overflow-y", new Map([["clip", [["-moz-hidden-unscrollable", 145]]]])],
  4979. ["position", new Map([["sticky", [["-webkit-sticky", 146]]]])],
  4980. ["text-align", new Map([["match-parent", [["-webkit-match-parent", 147]]]])],
  4981. [
  4982. "unicode-bidi",
  4983. new Map([
  4984. [
  4985. "isolate",
  4986. [
  4987. ["-webkit-isolate", 148],
  4988. ["-moz-isolate", 149]
  4989. ]
  4990. ],
  4991. [
  4992. "isolate-override",
  4993. [
  4994. ["-moz-isolate-override", 150],
  4995. ["-webkit-isolate-override", 151]
  4996. ]
  4997. ],
  4998. [
  4999. "plaintext",
  5000. [
  5001. ["-moz-plaintext", 149],
  5002. ["-webkit-plaintext", 152]
  5003. ]
  5004. ]
  5005. ])
  5006. ],
  5007. ["white-space", new Map([["pre-wrap", [["-moz-pre-wrap", 153]]]])],
  5008. [
  5009. "width",
  5010. new Map([
  5011. [
  5012. "fit-content",
  5013. [
  5014. ["-moz-fit-content", 127],
  5015. ["-webkit-fit-content", 128]
  5016. ]
  5017. ],
  5018. [
  5019. "max-content",
  5020. [
  5021. ["-moz-max-content", 129],
  5022. ["-webkit-max-content", 130]
  5023. ]
  5024. ],
  5025. [
  5026. "min-content",
  5027. [
  5028. ["-moz-min-content", 129],
  5029. ["-webkit-min-content", 131]
  5030. ]
  5031. ]
  5032. ])
  5033. ]
  5034. ]);
  5035. // The keywords a vendor spelling reads in place of the standard ones, as
  5036. // `spelling -> standard -> legacy` — IE 10's `-ms-flex-pack` reads
  5037. // `space-around` as `distribute`. Each map is the older property's whole
  5038. // grammar, so a value naming anything it does not is one that property cannot
  5039. // read and no copy is written.
  5040. /** @type {Map<string, Map<string, string>>} */
  5041. const PREFIXED_SPELLING_KEYWORDS = new Map([
  5042. [
  5043. "-ms-flex-align",
  5044. new Map([
  5045. ["flex-start", "start"],
  5046. ["flex-end", "end"],
  5047. ["center", "center"],
  5048. ["baseline", "baseline"],
  5049. ["stretch", "stretch"]
  5050. ])
  5051. ],
  5052. [
  5053. "-ms-flex-item-align",
  5054. new Map([
  5055. ["auto", "auto"],
  5056. ["flex-start", "start"],
  5057. ["flex-end", "end"],
  5058. ["center", "center"],
  5059. ["baseline", "baseline"],
  5060. ["stretch", "stretch"]
  5061. ])
  5062. ],
  5063. [
  5064. "-ms-flex-line-pack",
  5065. new Map([
  5066. ["flex-start", "start"],
  5067. ["flex-end", "end"],
  5068. ["center", "center"],
  5069. ["space-between", "justify"],
  5070. ["space-around", "distribute"],
  5071. ["stretch", "stretch"]
  5072. ])
  5073. ],
  5074. [
  5075. "-ms-flex-pack",
  5076. new Map([
  5077. ["flex-start", "start"],
  5078. ["flex-end", "end"],
  5079. ["center", "center"],
  5080. ["space-between", "justify"],
  5081. ["space-around", "distribute"]
  5082. ])
  5083. ],
  5084. [
  5085. "-webkit-ruby-position",
  5086. new Map([
  5087. ["over", "before"],
  5088. ["under", "after"]
  5089. ])
  5090. ],
  5091. [
  5092. "-webkit-text-orientation",
  5093. new Map([
  5094. ["mixed", "vertical-right"],
  5095. ["upright", "upright"],
  5096. ["sideways", "sideways"]
  5097. ])
  5098. ]
  5099. ]);
  5100. module.exports.ABSOLUTE_UNIT_SCALE = ABSOLUTE_UNIT_SCALE;
  5101. module.exports.ALPHA_VALUE_PROPERTIES = ALPHA_VALUE_PROPERTIES;
  5102. module.exports.ANGLE_UNITS = ANGLE_UNITS;
  5103. module.exports.ARC_COSINE_DEGREES = ARC_COSINE_DEGREES;
  5104. module.exports.ARC_SINE_DEGREES = ARC_SINE_DEGREES;
  5105. module.exports.ARC_TANGENT_DEGREES = ARC_TANGENT_DEGREES;
  5106. module.exports.AUTO_SECOND_VALUE_PROPERTIES = AUTO_SECOND_VALUE_PROPERTIES;
  5107. module.exports.BOX_FAMILY_PREFIX = BOX_FAMILY_PREFIX;
  5108. module.exports.BOX_LONGHANDS = BOX_LONGHANDS;
  5109. module.exports.BOX_SHORTHANDS = BOX_SHORTHANDS;
  5110. module.exports.CALC_REJECTING_PROPERTIES = CALC_REJECTING_PROPERTIES;
  5111. module.exports.CANONICAL_NAMES = CANONICAL_NAMES;
  5112. module.exports.CLAMPED_VALUE_RANGES = CLAMPED_VALUE_RANGES;
  5113. module.exports.COLOR_ARGUMENT_FUNCTIONS = COLOR_ARGUMENT_FUNCTIONS;
  5114. module.exports.COLOR_KEYWORDS = COLOR_KEYWORDS;
  5115. module.exports.COLOR_NAME_TO_SHORTEST = COLOR_NAME_TO_SHORTEST;
  5116. module.exports.COLOR_ONLY_PROPERTIES = COLOR_ONLY_PROPERTIES;
  5117. module.exports.COMPOUND_CONTINUATIONS = COMPOUND_CONTINUATIONS;
  5118. module.exports.CSS_MODULES_KEYWORDS = CSS_MODULES_KEYWORDS;
  5119. module.exports.CSS_MODULES_KEYWORD_OPTIONS = CSS_MODULES_KEYWORD_OPTIONS;
  5120. module.exports.CSS_WIDE_KEYWORDS = CSS_WIDE_KEYWORDS;
  5121. module.exports.CUBIC_BEZIER_KEYWORDS = CUBIC_BEZIER_KEYWORDS;
  5122. module.exports.CUSTOM_IDENT_LIST_PROPERTIES = CUSTOM_IDENT_LIST_PROPERTIES;
  5123. module.exports.DEFAULT_GRADIENT_DIRECTIONS = DEFAULT_GRADIENT_DIRECTIONS;
  5124. module.exports.DISPLAY_SHORT_FORMS = DISPLAY_SHORT_FORMS;
  5125. module.exports.DROPPABLE_WHEN_EMPTY_AT_RULES = DROPPABLE_WHEN_EMPTY_AT_RULES;
  5126. module.exports.EASING_KEYWORDS = EASING_KEYWORDS;
  5127. module.exports.EIGHTH_TURN_COSINE = EIGHTH_TURN_COSINE;
  5128. module.exports.EIGHTH_TURN_SINE = EIGHTH_TURN_SINE;
  5129. module.exports.EIGHTH_TURN_TANGENT = EIGHTH_TURN_TANGENT;
  5130. module.exports.FAMILY_LONGHANDS = FAMILY_LONGHANDS;
  5131. module.exports.FAMILY_SLOT_CLASSES = FAMILY_SLOT_CLASSES;
  5132. module.exports.FAMILY_SLOT_KEYWORDS = FAMILY_SLOT_KEYWORDS;
  5133. module.exports.FEATURELESS_PSEUDO_CLASSES = FEATURELESS_PSEUDO_CLASSES;
  5134. module.exports.FILTER_FUNCTION_OMITTED = FILTER_FUNCTION_OMITTED;
  5135. module.exports.FLEX_KEYWORDS = FLEX_KEYWORDS;
  5136. module.exports.FONT_SIZE_KEYWORDS = FONT_SIZE_KEYWORDS;
  5137. module.exports.FONT_STRETCH_PERCENTAGES = FONT_STRETCH_PERCENTAGES;
  5138. module.exports.FONT_WEIGHT_NUMBERS = FONT_WEIGHT_NUMBERS;
  5139. module.exports.GENERIC_FONT_FAMILIES = GENERIC_FONT_FAMILIES;
  5140. module.exports.GRADIENT_LAST_POSITIONS = GRADIENT_LAST_POSITIONS;
  5141. module.exports.INITIAL_VALUE_KEYWORDS = INITIAL_VALUE_KEYWORDS;
  5142. module.exports.INTEGER_PROPERTIES = INTEGER_PROPERTIES;
  5143. module.exports.KEYWORD_ONLY_PROPERTIES = KEYWORD_ONLY_PROPERTIES;
  5144. module.exports.LEGACY_PSEUDO_ELEMENTS = LEGACY_PSEUDO_ELEMENTS;
  5145. module.exports.LENGTH_ONLY_FUNCTIONS = LENGTH_ONLY_FUNCTIONS;
  5146. module.exports.LINEAR_GRADIENTS = LINEAR_GRADIENTS;
  5147. module.exports.MATH_FUNCTIONS = MATH_FUNCTIONS;
  5148. module.exports.MATH_FUNCTION_ARITY = MATH_FUNCTION_ARITY;
  5149. module.exports.MATH_FUNCTION_FOLD = MATH_FUNCTION_FOLD;
  5150. module.exports.MATH_FUNCTION_KEYWORDS = MATH_FUNCTION_KEYWORDS;
  5151. module.exports.MATH_FUNCTION_SUM_ARGUMENTS = MATH_FUNCTION_SUM_ARGUMENTS;
  5152. module.exports.MERGEABLE_AT_RULES = MERGEABLE_AT_RULES;
  5153. module.exports.MERGE_LONGHANDS = MERGE_LONGHANDS;
  5154. module.exports.NEGATIVE_ACCEPTING_PROPERTIES = NEGATIVE_ACCEPTING_PROPERTIES;
  5155. module.exports.NEVER = NEVER;
  5156. module.exports.NTH_NAMED_EQUIVALENTS = NTH_NAMED_EQUIVALENTS;
  5157. module.exports.NTH_PSEUDO_FUNCTIONS = NTH_PSEUDO_FUNCTIONS;
  5158. module.exports.OMITTABLE_INITIAL_KEYWORDS = OMITTABLE_INITIAL_KEYWORDS;
  5159. module.exports.ONE_VALUE_PAIR_SHORTHANDS = ONE_VALUE_PAIR_SHORTHANDS;
  5160. module.exports.PAIR_LONGHANDS = PAIR_LONGHANDS;
  5161. module.exports.PLACE_SHORTHANDS = PLACE_SHORTHANDS;
  5162. module.exports.POSITION_PROPERTIES = POSITION_PROPERTIES;
  5163. module.exports.POSITION_X_KEYWORDS = POSITION_X_KEYWORDS;
  5164. module.exports.POSITION_Y_KEYWORDS = POSITION_Y_KEYWORDS;
  5165. module.exports.PREFIXED_AT_RULES = PREFIXED_AT_RULES;
  5166. module.exports.PREFIXED_PROPERTIES = PREFIXED_PROPERTIES;
  5167. module.exports.PREFIXED_SELECTORS = PREFIXED_SELECTORS;
  5168. module.exports.PREFIXED_SPELLING_KEYWORDS = PREFIXED_SPELLING_KEYWORDS;
  5169. module.exports.PREFIXED_VALUES = PREFIXED_VALUES;
  5170. module.exports.PREFIX_WINDOWS = PREFIX_WINDOWS;
  5171. module.exports.PREFIX_WINDOW_STARTS = PREFIX_WINDOW_STARTS;
  5172. module.exports.QUARTER_TURN_ANGLE = QUARTER_TURN_ANGLE;
  5173. module.exports.RATIO_PROPERTIES = RATIO_PROPERTIES;
  5174. module.exports.REPEAT_STYLE_KEYWORDS = REPEAT_STYLE_KEYWORDS;
  5175. module.exports.REPEAT_STYLE_PROPERTIES = REPEAT_STYLE_PROPERTIES;
  5176. module.exports.RGB_TO_NAME = RGB_TO_NAME;
  5177. module.exports.SELECTOR_FUNCTIONS = SELECTOR_FUNCTIONS;
  5178. module.exports.SELECTOR_SUPPORTED_FROM = SELECTOR_SUPPORTED_FROM;
  5179. module.exports.SHADOW_PROPERTIES = SHADOW_PROPERTIES;
  5180. module.exports.SHORTHAND_INITIAL_KEYWORDS = SHORTHAND_INITIAL_KEYWORDS;
  5181. module.exports.SLASH_BOX_SHORTHANDS = SLASH_BOX_SHORTHANDS;
  5182. module.exports.SLASH_LONGHANDS = SLASH_LONGHANDS;
  5183. module.exports.STEPPED_FUNCTIONS = STEPPED_FUNCTIONS;
  5184. module.exports.SUBSTITUTION_FUNCTIONS = SUBSTITUTION_FUNCTIONS;
  5185. module.exports.SUPPORTED_FROM = SUPPORTED_FROM;
  5186. module.exports.SUPPORT_BROWSERS = SUPPORT_BROWSERS;
  5187. module.exports.SUPPORT_PROFILES = SUPPORT_PROFILES;
  5188. module.exports.TRANSITION_BEHAVIORS = TRANSITION_BEHAVIORS;
  5189. module.exports.UNIT_CONVERSION_TARGETS = UNIT_CONVERSION_TARGETS;
  5190. module.exports.UNIT_GROUP_BASE = UNIT_GROUP_BASE;
  5191. module.exports.UNSHARED_LONGHAND_KEYWORDS = UNSHARED_LONGHAND_KEYWORDS;
  5192. module.exports.X_AXIS_TRANSFORMS = X_AXIS_TRANSFORMS;
  5193. module.exports.ZERO_ANGLE_FUNCTIONS = ZERO_ANGLE_FUNCTIONS;
  5194. module.exports.ZERO_UNIT_KEEPING_PROPERTIES = ZERO_UNIT_KEEPING_PROPERTIES;
  5195. // The exact arithmetic the printer's own evaluator needs. Sorted after the
  5196. // tables: `import/order` orders exports by case, uppercase first.
  5197. module.exports.exactAdd = exactAdd;
  5198. module.exports.exactDivide = exactDivide;
  5199. module.exports.exactMultiply = exactMultiply;