| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355 |
- import {
- asciiAlpha,
- asciiAlphanumeric,
- asciiAtext,
- asciiControl,
- asciiDigit,
- asciiHexDigit,
- asciiPunctuation,
- codes,
- constants,
- factorySpace,
- markdownLineEnding,
- markdownLineEndingOrSpace,
- markdownSpace,
- ok,
- types,
- unicodePunctuation,
- unicodeWhitespace,
- unreachable,
- values
- } from "./chunk-EIBGEDEJ.js";
- import {
- find,
- hastToReact,
- html,
- stringify,
- stringify2,
- svg,
- visitParents
- } from "./chunk-BDV6QPQQ.js";
- import {
- require_jsx_runtime
- } from "./chunk-VTS4FBCU.js";
- import {
- require_react
- } from "./chunk-6KCF6AHO.js";
- import {
- __commonJS,
- __export,
- __toESM
- } from "./chunk-DC5AMYBS.js";
- // node_modules/inline-style-parser/cjs/index.js
- var require_cjs = __commonJS({
- "node_modules/inline-style-parser/cjs/index.js"(exports, module) {
- "use strict";
- var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
- var NEWLINE_REGEX = /\n/g;
- var WHITESPACE_REGEX = /^\s*/;
- var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
- var COLON_REGEX = /^:\s*/;
- var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
- var SEMICOLON_REGEX = /^[;\s]*/;
- var TRIM_REGEX = /^\s+|\s+$/g;
- var NEWLINE = "\n";
- var FORWARD_SLASH = "/";
- var ASTERISK = "*";
- var EMPTY_STRING = "";
- var TYPE_COMMENT = "comment";
- var TYPE_DECLARATION = "declaration";
- function index2(style, options) {
- if (typeof style !== "string") {
- throw new TypeError("First argument must be a string");
- }
- if (!style) return [];
- options = options || {};
- var lineno = 1;
- var column = 1;
- function updatePosition(str) {
- var lines = str.match(NEWLINE_REGEX);
- if (lines) lineno += lines.length;
- var i = str.lastIndexOf(NEWLINE);
- column = ~i ? str.length - i : column + str.length;
- }
- function position3() {
- var start2 = { line: lineno, column };
- return function(node2) {
- node2.position = new Position(start2);
- whitespace2();
- return node2;
- };
- }
- function Position(start2) {
- this.start = start2;
- this.end = { line: lineno, column };
- this.source = options.source;
- }
- Position.prototype.content = style;
- function error(msg) {
- var err = new Error(
- options.source + ":" + lineno + ":" + column + ": " + msg
- );
- err.reason = msg;
- err.filename = options.source;
- err.line = lineno;
- err.column = column;
- err.source = style;
- if (options.silent) ;
- else {
- throw err;
- }
- }
- function match(re2) {
- var m = re2.exec(style);
- if (!m) return;
- var str = m[0];
- updatePosition(str);
- style = style.slice(str.length);
- return m;
- }
- function whitespace2() {
- match(WHITESPACE_REGEX);
- }
- function comments(rules) {
- var c;
- rules = rules || [];
- while (c = comment()) {
- if (c !== false) {
- rules.push(c);
- }
- }
- return rules;
- }
- function comment() {
- var pos = position3();
- if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
- var i = 2;
- while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) {
- ++i;
- }
- i += 2;
- if (EMPTY_STRING === style.charAt(i - 1)) {
- return error("End of comment missing");
- }
- var str = style.slice(2, i - 2);
- column += 2;
- updatePosition(str);
- style = style.slice(i);
- column += 2;
- return pos({
- type: TYPE_COMMENT,
- comment: str
- });
- }
- function declaration() {
- var pos = position3();
- var prop = match(PROPERTY_REGEX);
- if (!prop) return;
- comment();
- if (!match(COLON_REGEX)) return error("property missing ':'");
- var val = match(VALUE_REGEX);
- var ret = pos({
- type: TYPE_DECLARATION,
- property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
- value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
- });
- match(SEMICOLON_REGEX);
- return ret;
- }
- function declarations() {
- var decls = [];
- comments(decls);
- var decl;
- while (decl = declaration()) {
- if (decl !== false) {
- decls.push(decl);
- comments(decls);
- }
- }
- return decls;
- }
- whitespace2();
- return declarations();
- }
- function trim(str) {
- return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
- }
- module.exports = index2;
- }
- });
- // node_modules/style-to-object/cjs/index.js
- var require_cjs2 = __commonJS({
- "node_modules/style-to-object/cjs/index.js"(exports) {
- "use strict";
- var __importDefault = exports && exports.__importDefault || function(mod) {
- return mod && mod.__esModule ? mod : { "default": mod };
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.default = StyleToObject;
- var inline_style_parser_1 = __importDefault(require_cjs());
- function StyleToObject(style, iterator) {
- let styleObject = null;
- if (!style || typeof style !== "string") {
- return styleObject;
- }
- const declarations = (0, inline_style_parser_1.default)(style);
- const hasIterator = typeof iterator === "function";
- declarations.forEach((declaration) => {
- if (declaration.type !== "declaration") {
- return;
- }
- const { property, value } = declaration;
- if (hasIterator) {
- iterator(property, value, declaration);
- } else if (value) {
- styleObject = styleObject || {};
- styleObject[property] = value;
- }
- });
- return styleObject;
- }
- }
- });
- // node_modules/style-to-js/cjs/utilities.js
- var require_utilities = __commonJS({
- "node_modules/style-to-js/cjs/utilities.js"(exports) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.camelCase = void 0;
- var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
- var HYPHEN_REGEX = /-([a-z])/g;
- var NO_HYPHEN_REGEX = /^[^-]+$/;
- var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
- var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
- var skipCamelCase = function(property) {
- return !property || NO_HYPHEN_REGEX.test(property) || CUSTOM_PROPERTY_REGEX.test(property);
- };
- var capitalize = function(match, character) {
- return character.toUpperCase();
- };
- var trimHyphen = function(match, prefix) {
- return "".concat(prefix, "-");
- };
- var camelCase = function(property, options) {
- if (options === void 0) {
- options = {};
- }
- if (skipCamelCase(property)) {
- return property;
- }
- property = property.toLowerCase();
- if (options.reactCompat) {
- property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
- } else {
- property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
- }
- return property.replace(HYPHEN_REGEX, capitalize);
- };
- exports.camelCase = camelCase;
- }
- });
- // node_modules/style-to-js/cjs/index.js
- var require_cjs3 = __commonJS({
- "node_modules/style-to-js/cjs/index.js"(exports, module) {
- "use strict";
- var __importDefault = exports && exports.__importDefault || function(mod) {
- return mod && mod.__esModule ? mod : { "default": mod };
- };
- var style_to_object_1 = __importDefault(require_cjs2());
- var utilities_1 = require_utilities();
- function StyleToJS(style, options) {
- var output = {};
- if (!style || typeof style !== "string") {
- return output;
- }
- (0, style_to_object_1.default)(style, function(property, value) {
- if (property && value) {
- output[(0, utilities_1.camelCase)(property, options)] = value;
- }
- });
- return output;
- }
- StyleToJS.default = StyleToJS;
- module.exports = StyleToJS;
- }
- });
- // node_modules/ms/index.js
- var require_ms = __commonJS({
- "node_modules/ms/index.js"(exports, module) {
- var s = 1e3;
- var m = s * 60;
- var h = m * 60;
- var d = h * 24;
- var w = d * 7;
- var y = d * 365.25;
- module.exports = function(val, options) {
- options = options || {};
- var type = typeof val;
- if (type === "string" && val.length > 0) {
- return parse2(val);
- } else if (type === "number" && isFinite(val)) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error(
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
- );
- };
- function parse2(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
- str
- );
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || "ms").toLowerCase();
- switch (type) {
- case "years":
- case "year":
- case "yrs":
- case "yr":
- case "y":
- return n * y;
- case "weeks":
- case "week":
- case "w":
- return n * w;
- case "days":
- case "day":
- case "d":
- return n * d;
- case "hours":
- case "hour":
- case "hrs":
- case "hr":
- case "h":
- return n * h;
- case "minutes":
- case "minute":
- case "mins":
- case "min":
- case "m":
- return n * m;
- case "seconds":
- case "second":
- case "secs":
- case "sec":
- case "s":
- return n * s;
- case "milliseconds":
- case "millisecond":
- case "msecs":
- case "msec":
- case "ms":
- return n;
- default:
- return void 0;
- }
- }
- function fmtShort(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return Math.round(ms / d) + "d";
- }
- if (msAbs >= h) {
- return Math.round(ms / h) + "h";
- }
- if (msAbs >= m) {
- return Math.round(ms / m) + "m";
- }
- if (msAbs >= s) {
- return Math.round(ms / s) + "s";
- }
- return ms + "ms";
- }
- function fmtLong(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return plural(ms, msAbs, d, "day");
- }
- if (msAbs >= h) {
- return plural(ms, msAbs, h, "hour");
- }
- if (msAbs >= m) {
- return plural(ms, msAbs, m, "minute");
- }
- if (msAbs >= s) {
- return plural(ms, msAbs, s, "second");
- }
- return ms + " ms";
- }
- function plural(ms, msAbs, n, name2) {
- var isPlural = msAbs >= n * 1.5;
- return Math.round(ms / n) + " " + name2 + (isPlural ? "s" : "");
- }
- }
- });
- // node_modules/debug/src/common.js
- var require_common = __commonJS({
- "node_modules/debug/src/common.js"(exports, module) {
- function setup(env2) {
- createDebug2.debug = createDebug2;
- createDebug2.default = createDebug2;
- createDebug2.coerce = coerce;
- createDebug2.disable = disable2;
- createDebug2.enable = enable;
- createDebug2.enabled = enabled;
- createDebug2.humanize = require_ms();
- createDebug2.destroy = destroy;
- Object.keys(env2).forEach((key) => {
- createDebug2[key] = env2[key];
- });
- createDebug2.names = [];
- createDebug2.skips = [];
- createDebug2.formatters = {};
- function selectColor(namespace) {
- let hash = 0;
- for (let i = 0; i < namespace.length; i++) {
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
- hash |= 0;
- }
- return createDebug2.colors[Math.abs(hash) % createDebug2.colors.length];
- }
- createDebug2.selectColor = selectColor;
- function createDebug2(namespace) {
- let prevTime;
- let enableOverride = null;
- let namespacesCache;
- let enabledCache;
- function debug2(...args) {
- if (!debug2.enabled) {
- return;
- }
- const self2 = debug2;
- const curr = Number(/* @__PURE__ */ new Date());
- const ms = curr - (prevTime || curr);
- self2.diff = ms;
- self2.prev = prevTime;
- self2.curr = curr;
- prevTime = curr;
- args[0] = createDebug2.coerce(args[0]);
- if (typeof args[0] !== "string") {
- args.unshift("%O");
- }
- let index2 = 0;
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
- if (match === "%%") {
- return "%";
- }
- index2++;
- const formatter = createDebug2.formatters[format];
- if (typeof formatter === "function") {
- const val = args[index2];
- match = formatter.call(self2, val);
- args.splice(index2, 1);
- index2--;
- }
- return match;
- });
- createDebug2.formatArgs.call(self2, args);
- const logFn = self2.log || createDebug2.log;
- logFn.apply(self2, args);
- }
- debug2.namespace = namespace;
- debug2.useColors = createDebug2.useColors();
- debug2.color = createDebug2.selectColor(namespace);
- debug2.extend = extend2;
- debug2.destroy = createDebug2.destroy;
- Object.defineProperty(debug2, "enabled", {
- enumerable: true,
- configurable: false,
- get: () => {
- if (enableOverride !== null) {
- return enableOverride;
- }
- if (namespacesCache !== createDebug2.namespaces) {
- namespacesCache = createDebug2.namespaces;
- enabledCache = createDebug2.enabled(namespace);
- }
- return enabledCache;
- },
- set: (v) => {
- enableOverride = v;
- }
- });
- if (typeof createDebug2.init === "function") {
- createDebug2.init(debug2);
- }
- return debug2;
- }
- function extend2(namespace, delimiter) {
- const newDebug = createDebug2(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
- newDebug.log = this.log;
- return newDebug;
- }
- function enable(namespaces) {
- createDebug2.save(namespaces);
- createDebug2.namespaces = namespaces;
- createDebug2.names = [];
- createDebug2.skips = [];
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
- for (const ns of split) {
- if (ns[0] === "-") {
- createDebug2.skips.push(ns.slice(1));
- } else {
- createDebug2.names.push(ns);
- }
- }
- }
- function matchesTemplate(search2, template) {
- let searchIndex = 0;
- let templateIndex = 0;
- let starIndex = -1;
- let matchIndex = 0;
- while (searchIndex < search2.length) {
- if (templateIndex < template.length && (template[templateIndex] === search2[searchIndex] || template[templateIndex] === "*")) {
- if (template[templateIndex] === "*") {
- starIndex = templateIndex;
- matchIndex = searchIndex;
- templateIndex++;
- } else {
- searchIndex++;
- templateIndex++;
- }
- } else if (starIndex !== -1) {
- templateIndex = starIndex + 1;
- matchIndex++;
- searchIndex = matchIndex;
- } else {
- return false;
- }
- }
- while (templateIndex < template.length && template[templateIndex] === "*") {
- templateIndex++;
- }
- return templateIndex === template.length;
- }
- function disable2() {
- const namespaces = [
- ...createDebug2.names,
- ...createDebug2.skips.map((namespace) => "-" + namespace)
- ].join(",");
- createDebug2.enable("");
- return namespaces;
- }
- function enabled(name2) {
- for (const skip of createDebug2.skips) {
- if (matchesTemplate(name2, skip)) {
- return false;
- }
- }
- for (const ns of createDebug2.names) {
- if (matchesTemplate(name2, ns)) {
- return true;
- }
- }
- return false;
- }
- function coerce(val) {
- if (val instanceof Error) {
- return val.stack || val.message;
- }
- return val;
- }
- function destroy() {
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
- }
- createDebug2.enable(createDebug2.load());
- return createDebug2;
- }
- module.exports = setup;
- }
- });
- // node_modules/debug/src/browser.js
- var require_browser = __commonJS({
- "node_modules/debug/src/browser.js"(exports, module) {
- exports.formatArgs = formatArgs;
- exports.save = save;
- exports.load = load;
- exports.useColors = useColors;
- exports.storage = localstorage();
- exports.destroy = /* @__PURE__ */ (() => {
- let warned = false;
- return () => {
- if (!warned) {
- warned = true;
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
- }
- };
- })();
- exports.colors = [
- "#0000CC",
- "#0000FF",
- "#0033CC",
- "#0033FF",
- "#0066CC",
- "#0066FF",
- "#0099CC",
- "#0099FF",
- "#00CC00",
- "#00CC33",
- "#00CC66",
- "#00CC99",
- "#00CCCC",
- "#00CCFF",
- "#3300CC",
- "#3300FF",
- "#3333CC",
- "#3333FF",
- "#3366CC",
- "#3366FF",
- "#3399CC",
- "#3399FF",
- "#33CC00",
- "#33CC33",
- "#33CC66",
- "#33CC99",
- "#33CCCC",
- "#33CCFF",
- "#6600CC",
- "#6600FF",
- "#6633CC",
- "#6633FF",
- "#66CC00",
- "#66CC33",
- "#9900CC",
- "#9900FF",
- "#9933CC",
- "#9933FF",
- "#99CC00",
- "#99CC33",
- "#CC0000",
- "#CC0033",
- "#CC0066",
- "#CC0099",
- "#CC00CC",
- "#CC00FF",
- "#CC3300",
- "#CC3333",
- "#CC3366",
- "#CC3399",
- "#CC33CC",
- "#CC33FF",
- "#CC6600",
- "#CC6633",
- "#CC9900",
- "#CC9933",
- "#CCCC00",
- "#CCCC33",
- "#FF0000",
- "#FF0033",
- "#FF0066",
- "#FF0099",
- "#FF00CC",
- "#FF00FF",
- "#FF3300",
- "#FF3333",
- "#FF3366",
- "#FF3399",
- "#FF33CC",
- "#FF33FF",
- "#FF6600",
- "#FF6633",
- "#FF9900",
- "#FF9933",
- "#FFCC00",
- "#FFCC33"
- ];
- function useColors() {
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
- return true;
- }
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
- return false;
- }
- let m;
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
- typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
- }
- function formatArgs(args) {
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
- if (!this.useColors) {
- return;
- }
- const c = "color: " + this.color;
- args.splice(1, 0, c, "color: inherit");
- let index2 = 0;
- let lastC = 0;
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
- if (match === "%%") {
- return;
- }
- index2++;
- if (match === "%c") {
- lastC = index2;
- }
- });
- args.splice(lastC, 0, c);
- }
- exports.log = console.debug || console.log || (() => {
- });
- function save(namespaces) {
- try {
- if (namespaces) {
- exports.storage.setItem("debug", namespaces);
- } else {
- exports.storage.removeItem("debug");
- }
- } catch (error) {
- }
- }
- function load() {
- let r;
- try {
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
- } catch (error) {
- }
- if (!r && typeof process !== "undefined" && "env" in process) {
- r = process.env.DEBUG;
- }
- return r;
- }
- function localstorage() {
- try {
- return localStorage;
- } catch (error) {
- }
- }
- module.exports = require_common()(exports);
- var { formatters } = module.exports;
- formatters.j = function(v) {
- try {
- return JSON.stringify(v);
- } catch (error) {
- return "[UnexpectedJSONParseError]: " + error.message;
- }
- };
- }
- });
- // node_modules/extend/index.js
- var require_extend = __commonJS({
- "node_modules/extend/index.js"(exports, module) {
- "use strict";
- var hasOwn = Object.prototype.hasOwnProperty;
- var toStr = Object.prototype.toString;
- var defineProperty = Object.defineProperty;
- var gOPD = Object.getOwnPropertyDescriptor;
- var isArray = function isArray2(arr) {
- if (typeof Array.isArray === "function") {
- return Array.isArray(arr);
- }
- return toStr.call(arr) === "[object Array]";
- };
- var isPlainObject2 = function isPlainObject3(obj) {
- if (!obj || toStr.call(obj) !== "[object Object]") {
- return false;
- }
- var hasOwnConstructor = hasOwn.call(obj, "constructor");
- var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
- if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
- return false;
- }
- var key;
- for (key in obj) {
- }
- return typeof key === "undefined" || hasOwn.call(obj, key);
- };
- var setProperty = function setProperty2(target, options) {
- if (defineProperty && options.name === "__proto__") {
- defineProperty(target, options.name, {
- enumerable: true,
- configurable: true,
- value: options.newValue,
- writable: true
- });
- } else {
- target[options.name] = options.newValue;
- }
- };
- var getProperty = function getProperty2(obj, name2) {
- if (name2 === "__proto__") {
- if (!hasOwn.call(obj, name2)) {
- return void 0;
- } else if (gOPD) {
- return gOPD(obj, name2).value;
- }
- }
- return obj[name2];
- };
- module.exports = function extend2() {
- var options, name2, src, copy, copyIsArray, clone;
- var target = arguments[0];
- var i = 1;
- var length = arguments.length;
- var deep = false;
- if (typeof target === "boolean") {
- deep = target;
- target = arguments[1] || {};
- i = 2;
- }
- if (target == null || typeof target !== "object" && typeof target !== "function") {
- target = {};
- }
- for (; i < length; ++i) {
- options = arguments[i];
- if (options != null) {
- for (name2 in options) {
- src = getProperty(target, name2);
- copy = getProperty(options, name2);
- if (target !== copy) {
- if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray(copy)))) {
- if (copyIsArray) {
- copyIsArray = false;
- clone = src && isArray(src) ? src : [];
- } else {
- clone = src && isPlainObject2(src) ? src : {};
- }
- setProperty(target, { name: name2, newValue: extend2(deep, clone, copy) });
- } else if (typeof copy !== "undefined") {
- setProperty(target, { name: name2, newValue: copy });
- }
- }
- }
- }
- }
- return target;
- };
- }
- });
- // node_modules/estree-util-is-identifier-name/lib/index.js
- var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
- var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
- var emptyOptions = {};
- function name(name2, options) {
- const settings = options || emptyOptions;
- const re2 = settings.jsx ? nameReJsx : nameRe;
- return re2.test(name2);
- }
- // node_modules/hast-util-whitespace/lib/index.js
- var re = /[ \t\n\f\r]/g;
- function whitespace(thing) {
- return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
- }
- function empty(value) {
- return value.replace(re, "") === "";
- }
- // node_modules/hast-util-to-jsx-runtime/lib/index.js
- var import_style_to_js = __toESM(require_cjs3(), 1);
- // node_modules/unist-util-position/lib/index.js
- var pointEnd = point("end");
- var pointStart = point("start");
- function point(type) {
- return point4;
- function point4(node2) {
- const point5 = node2 && node2.position && node2.position[type] || {};
- if (typeof point5.line === "number" && point5.line > 0 && typeof point5.column === "number" && point5.column > 0) {
- return {
- line: point5.line,
- column: point5.column,
- offset: typeof point5.offset === "number" && point5.offset > -1 ? point5.offset : void 0
- };
- }
- }
- }
- function position(node2) {
- const start2 = pointStart(node2);
- const end = pointEnd(node2);
- if (start2 && end) {
- return { start: start2, end };
- }
- }
- // node_modules/unist-util-stringify-position/lib/index.js
- function stringifyPosition(value) {
- if (!value || typeof value !== "object") {
- return "";
- }
- if ("position" in value || "type" in value) {
- return position2(value.position);
- }
- if ("start" in value || "end" in value) {
- return position2(value);
- }
- if ("line" in value || "column" in value) {
- return point2(value);
- }
- return "";
- }
- function point2(point4) {
- return index(point4 && point4.line) + ":" + index(point4 && point4.column);
- }
- function position2(pos) {
- return point2(pos && pos.start) + "-" + point2(pos && pos.end);
- }
- function index(value) {
- return value && typeof value === "number" ? value : 1;
- }
- // node_modules/vfile-message/lib/index.js
- var VFileMessage = class extends Error {
- /**
- * Create a message for `reason`.
- *
- * > 🪦 **Note**: also has obsolete signatures.
- *
- * @overload
- * @param {string} reason
- * @param {Options | null | undefined} [options]
- * @returns
- *
- * @overload
- * @param {string} reason
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns
- *
- * @overload
- * @param {string} reason
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns
- *
- * @overload
- * @param {string} reason
- * @param {string | null | undefined} [origin]
- * @returns
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {string | null | undefined} [origin]
- * @returns
- *
- * @param {Error | VFileMessage | string} causeOrReason
- * Reason for message, should use markdown.
- * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
- * Configuration (optional).
- * @param {string | null | undefined} [origin]
- * Place in code where the message originates (example:
- * `'my-package:my-rule'` or `'my-rule'`).
- * @returns
- * Instance of `VFileMessage`.
- */
- // eslint-disable-next-line complexity
- constructor(causeOrReason, optionsOrParentOrPlace, origin) {
- super();
- if (typeof optionsOrParentOrPlace === "string") {
- origin = optionsOrParentOrPlace;
- optionsOrParentOrPlace = void 0;
- }
- let reason = "";
- let options = {};
- let legacyCause = false;
- if (optionsOrParentOrPlace) {
- if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) {
- options = { place: optionsOrParentOrPlace };
- } else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) {
- options = { place: optionsOrParentOrPlace };
- } else if ("type" in optionsOrParentOrPlace) {
- options = {
- ancestors: [optionsOrParentOrPlace],
- place: optionsOrParentOrPlace.position
- };
- } else {
- options = { ...optionsOrParentOrPlace };
- }
- }
- if (typeof causeOrReason === "string") {
- reason = causeOrReason;
- } else if (!options.cause && causeOrReason) {
- legacyCause = true;
- reason = causeOrReason.message;
- options.cause = causeOrReason;
- }
- if (!options.ruleId && !options.source && typeof origin === "string") {
- const index2 = origin.indexOf(":");
- if (index2 === -1) {
- options.ruleId = origin;
- } else {
- options.source = origin.slice(0, index2);
- options.ruleId = origin.slice(index2 + 1);
- }
- }
- if (!options.place && options.ancestors && options.ancestors) {
- const parent = options.ancestors[options.ancestors.length - 1];
- if (parent) {
- options.place = parent.position;
- }
- }
- const start2 = options.place && "start" in options.place ? options.place.start : options.place;
- this.ancestors = options.ancestors || void 0;
- this.cause = options.cause || void 0;
- this.column = start2 ? start2.column : void 0;
- this.fatal = void 0;
- this.file = "";
- this.message = reason;
- this.line = start2 ? start2.line : void 0;
- this.name = stringifyPosition(options.place) || "1:1";
- this.place = options.place || void 0;
- this.reason = this.message;
- this.ruleId = options.ruleId || void 0;
- this.source = options.source || void 0;
- this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : "";
- this.actual = void 0;
- this.expected = void 0;
- this.note = void 0;
- this.url = void 0;
- }
- };
- VFileMessage.prototype.file = "";
- VFileMessage.prototype.name = "";
- VFileMessage.prototype.reason = "";
- VFileMessage.prototype.message = "";
- VFileMessage.prototype.stack = "";
- VFileMessage.prototype.column = void 0;
- VFileMessage.prototype.line = void 0;
- VFileMessage.prototype.ancestors = void 0;
- VFileMessage.prototype.cause = void 0;
- VFileMessage.prototype.fatal = void 0;
- VFileMessage.prototype.place = void 0;
- VFileMessage.prototype.ruleId = void 0;
- VFileMessage.prototype.source = void 0;
- // node_modules/hast-util-to-jsx-runtime/lib/index.js
- var own = {}.hasOwnProperty;
- var emptyMap = /* @__PURE__ */ new Map();
- var cap = /[A-Z]/g;
- var tableElements = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]);
- var tableCellElement = /* @__PURE__ */ new Set(["td", "th"]);
- var docs = "https://github.com/syntax-tree/hast-util-to-jsx-runtime";
- function toJsxRuntime(tree, options) {
- if (!options || options.Fragment === void 0) {
- throw new TypeError("Expected `Fragment` in options");
- }
- const filePath = options.filePath || void 0;
- let create;
- if (options.development) {
- if (typeof options.jsxDEV !== "function") {
- throw new TypeError(
- "Expected `jsxDEV` in options when `development: true`"
- );
- }
- create = developmentCreate(filePath, options.jsxDEV);
- } else {
- if (typeof options.jsx !== "function") {
- throw new TypeError("Expected `jsx` in production options");
- }
- if (typeof options.jsxs !== "function") {
- throw new TypeError("Expected `jsxs` in production options");
- }
- create = productionCreate(filePath, options.jsx, options.jsxs);
- }
- const state = {
- Fragment: options.Fragment,
- ancestors: [],
- components: options.components || {},
- create,
- elementAttributeNameCase: options.elementAttributeNameCase || "react",
- evaluater: options.createEvaluater ? options.createEvaluater() : void 0,
- filePath,
- ignoreInvalidStyle: options.ignoreInvalidStyle || false,
- passKeys: options.passKeys !== false,
- passNode: options.passNode || false,
- schema: options.space === "svg" ? svg : html,
- stylePropertyNameCase: options.stylePropertyNameCase || "dom",
- tableCellAlignToStyle: options.tableCellAlignToStyle !== false
- };
- const result = one(state, tree, void 0);
- if (result && typeof result !== "string") {
- return result;
- }
- return state.create(
- tree,
- state.Fragment,
- { children: result || void 0 },
- void 0
- );
- }
- function one(state, node2, key) {
- if (node2.type === "element") {
- return element(state, node2, key);
- }
- if (node2.type === "mdxFlowExpression" || node2.type === "mdxTextExpression") {
- return mdxExpression(state, node2);
- }
- if (node2.type === "mdxJsxFlowElement" || node2.type === "mdxJsxTextElement") {
- return mdxJsxElement(state, node2, key);
- }
- if (node2.type === "mdxjsEsm") {
- return mdxEsm(state, node2);
- }
- if (node2.type === "root") {
- return root(state, node2, key);
- }
- if (node2.type === "text") {
- return text(state, node2);
- }
- }
- function element(state, node2, key) {
- const parentSchema = state.schema;
- let schema = parentSchema;
- if (node2.tagName.toLowerCase() === "svg" && parentSchema.space === "html") {
- schema = svg;
- state.schema = schema;
- }
- state.ancestors.push(node2);
- const type = findComponentFromName(state, node2.tagName, false);
- const props = createElementProps(state, node2);
- let children = createChildren(state, node2);
- if (tableElements.has(node2.tagName)) {
- children = children.filter(function(child) {
- return typeof child === "string" ? !whitespace(child) : true;
- });
- }
- addNode(state, props, type, node2);
- addChildren(props, children);
- state.ancestors.pop();
- state.schema = parentSchema;
- return state.create(node2, type, props, key);
- }
- function mdxExpression(state, node2) {
- if (node2.data && node2.data.estree && state.evaluater) {
- const program = node2.data.estree;
- const expression = program.body[0];
- ok(expression.type === "ExpressionStatement");
- return (
- /** @type {Child | undefined} */
- state.evaluater.evaluateExpression(expression.expression)
- );
- }
- crashEstree(state, node2.position);
- }
- function mdxEsm(state, node2) {
- if (node2.data && node2.data.estree && state.evaluater) {
- return (
- /** @type {Child | undefined} */
- state.evaluater.evaluateProgram(node2.data.estree)
- );
- }
- crashEstree(state, node2.position);
- }
- function mdxJsxElement(state, node2, key) {
- const parentSchema = state.schema;
- let schema = parentSchema;
- if (node2.name === "svg" && parentSchema.space === "html") {
- schema = svg;
- state.schema = schema;
- }
- state.ancestors.push(node2);
- const type = node2.name === null ? state.Fragment : findComponentFromName(state, node2.name, true);
- const props = createJsxElementProps(state, node2);
- const children = createChildren(state, node2);
- addNode(state, props, type, node2);
- addChildren(props, children);
- state.ancestors.pop();
- state.schema = parentSchema;
- return state.create(node2, type, props, key);
- }
- function root(state, node2, key) {
- const props = {};
- addChildren(props, createChildren(state, node2));
- return state.create(node2, state.Fragment, props, key);
- }
- function text(_, node2) {
- return node2.value;
- }
- function addNode(state, props, type, node2) {
- if (typeof type !== "string" && type !== state.Fragment && state.passNode) {
- props.node = node2;
- }
- }
- function addChildren(props, children) {
- if (children.length > 0) {
- const value = children.length > 1 ? children : children[0];
- if (value) {
- props.children = value;
- }
- }
- }
- function productionCreate(_, jsx2, jsxs2) {
- return create;
- function create(_2, type, props, key) {
- const isStaticChildren = Array.isArray(props.children);
- const fn = isStaticChildren ? jsxs2 : jsx2;
- return key ? fn(type, props, key) : fn(type, props);
- }
- }
- function developmentCreate(filePath, jsxDEV) {
- return create;
- function create(node2, type, props, key) {
- const isStaticChildren = Array.isArray(props.children);
- const point4 = pointStart(node2);
- return jsxDEV(
- type,
- props,
- key,
- isStaticChildren,
- {
- columnNumber: point4 ? point4.column - 1 : void 0,
- fileName: filePath,
- lineNumber: point4 ? point4.line : void 0
- },
- void 0
- );
- }
- }
- function createElementProps(state, node2) {
- const props = {};
- let alignValue;
- let prop;
- for (prop in node2.properties) {
- if (prop !== "children" && own.call(node2.properties, prop)) {
- const result = createProperty(state, prop, node2.properties[prop]);
- if (result) {
- const [key, value] = result;
- if (state.tableCellAlignToStyle && key === "align" && typeof value === "string" && tableCellElement.has(node2.tagName)) {
- alignValue = value;
- } else {
- props[key] = value;
- }
- }
- }
- }
- if (alignValue) {
- const style = (
- /** @type {Style} */
- props.style || (props.style = {})
- );
- style[state.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = alignValue;
- }
- return props;
- }
- function createJsxElementProps(state, node2) {
- const props = {};
- for (const attribute of node2.attributes) {
- if (attribute.type === "mdxJsxExpressionAttribute") {
- if (attribute.data && attribute.data.estree && state.evaluater) {
- const program = attribute.data.estree;
- const expression = program.body[0];
- ok(expression.type === "ExpressionStatement");
- const objectExpression = expression.expression;
- ok(objectExpression.type === "ObjectExpression");
- const property = objectExpression.properties[0];
- ok(property.type === "SpreadElement");
- Object.assign(
- props,
- state.evaluater.evaluateExpression(property.argument)
- );
- } else {
- crashEstree(state, node2.position);
- }
- } else {
- const name2 = attribute.name;
- let value;
- if (attribute.value && typeof attribute.value === "object") {
- if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
- const program = attribute.value.data.estree;
- const expression = program.body[0];
- ok(expression.type === "ExpressionStatement");
- value = state.evaluater.evaluateExpression(expression.expression);
- } else {
- crashEstree(state, node2.position);
- }
- } else {
- value = attribute.value === null ? true : attribute.value;
- }
- props[name2] = /** @type {Props[keyof Props]} */
- value;
- }
- }
- return props;
- }
- function createChildren(state, node2) {
- const children = [];
- let index2 = -1;
- const countsByName = state.passKeys ? /* @__PURE__ */ new Map() : emptyMap;
- while (++index2 < node2.children.length) {
- const child = node2.children[index2];
- let key;
- if (state.passKeys) {
- const name2 = child.type === "element" ? child.tagName : child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement" ? child.name : void 0;
- if (name2) {
- const count = countsByName.get(name2) || 0;
- key = name2 + "-" + count;
- countsByName.set(name2, count + 1);
- }
- }
- const result = one(state, child, key);
- if (result !== void 0) children.push(result);
- }
- return children;
- }
- function createProperty(state, prop, value) {
- const info = find(state.schema, prop);
- if (value === null || value === void 0 || typeof value === "number" && Number.isNaN(value)) {
- return;
- }
- if (Array.isArray(value)) {
- value = info.commaSeparated ? stringify(value) : stringify2(value);
- }
- if (info.property === "style") {
- let styleObject = typeof value === "object" ? value : parseStyle(state, String(value));
- if (state.stylePropertyNameCase === "css") {
- styleObject = transformStylesToCssCasing(styleObject);
- }
- return ["style", styleObject];
- }
- return [
- state.elementAttributeNameCase === "react" && info.space ? hastToReact[info.property] || info.property : info.attribute,
- value
- ];
- }
- function parseStyle(state, value) {
- try {
- return (0, import_style_to_js.default)(value, { reactCompat: true });
- } catch (error) {
- if (state.ignoreInvalidStyle) {
- return {};
- }
- const cause = (
- /** @type {Error} */
- error
- );
- const message = new VFileMessage("Cannot parse `style` attribute", {
- ancestors: state.ancestors,
- cause,
- ruleId: "style",
- source: "hast-util-to-jsx-runtime"
- });
- message.file = state.filePath || void 0;
- message.url = docs + "#cannot-parse-style-attribute";
- throw message;
- }
- }
- function findComponentFromName(state, name2, allowExpression) {
- let result;
- if (!allowExpression) {
- result = { type: "Literal", value: name2 };
- } else if (name2.includes(".")) {
- const identifiers = name2.split(".");
- let index2 = -1;
- let node2;
- while (++index2 < identifiers.length) {
- const prop = name(identifiers[index2]) ? { type: "Identifier", name: identifiers[index2] } : { type: "Literal", value: identifiers[index2] };
- node2 = node2 ? {
- type: "MemberExpression",
- object: node2,
- property: prop,
- computed: Boolean(index2 && prop.type === "Literal"),
- optional: false
- } : prop;
- }
- ok(node2, "always a result");
- result = node2;
- } else {
- result = name(name2) && !/^[a-z]/.test(name2) ? { type: "Identifier", name: name2 } : { type: "Literal", value: name2 };
- }
- if (result.type === "Literal") {
- const name3 = (
- /** @type {string | number} */
- result.value
- );
- return own.call(state.components, name3) ? state.components[name3] : name3;
- }
- if (state.evaluater) {
- return state.evaluater.evaluateExpression(result);
- }
- crashEstree(state);
- }
- function crashEstree(state, place) {
- const message = new VFileMessage(
- "Cannot handle MDX estrees without `createEvaluater`",
- {
- ancestors: state.ancestors,
- place,
- ruleId: "mdx-estree",
- source: "hast-util-to-jsx-runtime"
- }
- );
- message.file = state.filePath || void 0;
- message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
- throw message;
- }
- function transformStylesToCssCasing(domCasing) {
- const cssCasing = {};
- let from;
- for (from in domCasing) {
- if (own.call(domCasing, from)) {
- cssCasing[transformStyleToCssCasing(from)] = domCasing[from];
- }
- }
- return cssCasing;
- }
- function transformStyleToCssCasing(from) {
- let to = from.replace(cap, toDash);
- if (to.slice(0, 3) === "ms-") to = "-" + to;
- return to;
- }
- function toDash($0) {
- return "-" + $0.toLowerCase();
- }
- // node_modules/html-url-attributes/lib/index.js
- var urlAttributes = {
- action: ["form"],
- cite: ["blockquote", "del", "ins", "q"],
- data: ["object"],
- formAction: ["button", "input"],
- href: ["a", "area", "base", "link"],
- icon: ["menuitem"],
- itemId: null,
- manifest: ["html"],
- ping: ["a", "area"],
- poster: ["video"],
- src: [
- "audio",
- "embed",
- "iframe",
- "img",
- "input",
- "script",
- "source",
- "track",
- "video"
- ]
- };
- // node_modules/react-markdown/lib/index.js
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
- var import_react = __toESM(require_react(), 1);
- // node_modules/mdast-util-to-string/lib/index.js
- var emptyOptions2 = {};
- function toString(value, options) {
- const settings = options || emptyOptions2;
- const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
- const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
- return one2(value, includeImageAlt, includeHtml);
- }
- function one2(value, includeImageAlt, includeHtml) {
- if (node(value)) {
- if ("value" in value) {
- return value.type === "html" && !includeHtml ? "" : value.value;
- }
- if (includeImageAlt && "alt" in value && value.alt) {
- return value.alt;
- }
- if ("children" in value) {
- return all(value.children, includeImageAlt, includeHtml);
- }
- }
- if (Array.isArray(value)) {
- return all(value, includeImageAlt, includeHtml);
- }
- return "";
- }
- function all(values2, includeImageAlt, includeHtml) {
- const result = [];
- let index2 = -1;
- while (++index2 < values2.length) {
- result[index2] = one2(values2[index2], includeImageAlt, includeHtml);
- }
- return result.join("");
- }
- function node(value) {
- return Boolean(value && typeof value === "object");
- }
- // node_modules/decode-named-character-reference/index.dom.js
- var element2 = document.createElement("i");
- function decodeNamedCharacterReference(value) {
- const characterReference2 = "&" + value + ";";
- element2.innerHTML = characterReference2;
- const character = element2.textContent;
- if (character.charCodeAt(character.length - 1) === 59 && value !== "semi") {
- return false;
- }
- return character === characterReference2 ? false : character;
- }
- // node_modules/micromark-util-chunked/dev/index.js
- function splice(list3, start2, remove, items) {
- const end = list3.length;
- let chunkStart = 0;
- let parameters;
- if (start2 < 0) {
- start2 = -start2 > end ? 0 : end + start2;
- } else {
- start2 = start2 > end ? end : start2;
- }
- remove = remove > 0 ? remove : 0;
- if (items.length < constants.v8MaxSafeChunkSize) {
- parameters = Array.from(items);
- parameters.unshift(start2, remove);
- list3.splice(...parameters);
- } else {
- if (remove) list3.splice(start2, remove);
- while (chunkStart < items.length) {
- parameters = items.slice(
- chunkStart,
- chunkStart + constants.v8MaxSafeChunkSize
- );
- parameters.unshift(start2, 0);
- list3.splice(...parameters);
- chunkStart += constants.v8MaxSafeChunkSize;
- start2 += constants.v8MaxSafeChunkSize;
- }
- }
- }
- function push(list3, items) {
- if (list3.length > 0) {
- splice(list3, list3.length, 0, items);
- return list3;
- }
- return items;
- }
- // node_modules/micromark-util-combine-extensions/index.js
- var hasOwnProperty = {}.hasOwnProperty;
- function combineExtensions(extensions) {
- const all2 = {};
- let index2 = -1;
- while (++index2 < extensions.length) {
- syntaxExtension(all2, extensions[index2]);
- }
- return all2;
- }
- function syntaxExtension(all2, extension2) {
- let hook;
- for (hook in extension2) {
- const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;
- const left = maybe || (all2[hook] = {});
- const right = extension2[hook];
- let code2;
- if (right) {
- for (code2 in right) {
- if (!hasOwnProperty.call(left, code2)) left[code2] = [];
- const value = right[code2];
- constructs(
- // @ts-expect-error Looks like a list.
- left[code2],
- Array.isArray(value) ? value : value ? [value] : []
- );
- }
- }
- }
- }
- function constructs(existing, list3) {
- let index2 = -1;
- const before = [];
- while (++index2 < list3.length) {
- ;
- (list3[index2].add === "after" ? existing : before).push(list3[index2]);
- }
- splice(existing, 0, 0, before);
- }
- // node_modules/micromark-util-decode-numeric-character-reference/dev/index.js
- function decodeNumericCharacterReference(value, base) {
- const code2 = Number.parseInt(value, base);
- if (
- // C0 except for HT, LF, FF, CR, space.
- code2 < codes.ht || code2 === codes.vt || code2 > codes.cr && code2 < codes.space || // Control character (DEL) of C0, and C1 controls.
- code2 > codes.tilde && code2 < 160 || // Lone high surrogates and low surrogates.
- code2 > 55295 && code2 < 57344 || // Noncharacters.
- code2 > 64975 && code2 < 65008 || /* eslint-disable no-bitwise */
- (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || /* eslint-enable no-bitwise */
- // Out of range
- code2 > 1114111
- ) {
- return values.replacementCharacter;
- }
- return String.fromCodePoint(code2);
- }
- // node_modules/micromark-util-normalize-identifier/dev/index.js
- function normalizeIdentifier(value) {
- return value.replace(/[\t\n\r ]+/g, values.space).replace(/^ | $/g, "").toLowerCase().toUpperCase();
- }
- // node_modules/micromark-util-sanitize-uri/dev/index.js
- function normalizeUri(value) {
- const result = [];
- let index2 = -1;
- let start2 = 0;
- let skip = 0;
- while (++index2 < value.length) {
- const code2 = value.charCodeAt(index2);
- let replace = "";
- if (code2 === codes.percentSign && asciiAlphanumeric(value.charCodeAt(index2 + 1)) && asciiAlphanumeric(value.charCodeAt(index2 + 2))) {
- skip = 2;
- } else if (code2 < 128) {
- if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))) {
- replace = String.fromCharCode(code2);
- }
- } else if (code2 > 55295 && code2 < 57344) {
- const next = value.charCodeAt(index2 + 1);
- if (code2 < 56320 && next > 56319 && next < 57344) {
- replace = String.fromCharCode(code2, next);
- skip = 1;
- } else {
- replace = values.replacementCharacter;
- }
- } else {
- replace = String.fromCharCode(code2);
- }
- if (replace) {
- result.push(value.slice(start2, index2), encodeURIComponent(replace));
- start2 = index2 + skip + 1;
- replace = "";
- }
- if (skip) {
- index2 += skip;
- skip = 0;
- }
- }
- return result.join("") + value.slice(start2);
- }
- // node_modules/micromark/dev/lib/compile.js
- var hasOwnProperty2 = {}.hasOwnProperty;
- // node_modules/micromark/dev/lib/initialize/content.js
- var content = { tokenize: initializeContent };
- function initializeContent(effects) {
- const contentStart = effects.attempt(
- this.parser.constructs.contentInitial,
- afterContentStartConstruct,
- paragraphInitial
- );
- let previous2;
- return contentStart;
- function afterContentStartConstruct(code2) {
- ok(
- code2 === codes.eof || markdownLineEnding(code2),
- "expected eol or eof"
- );
- if (code2 === codes.eof) {
- effects.consume(code2);
- return;
- }
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return factorySpace(effects, contentStart, types.linePrefix);
- }
- function paragraphInitial(code2) {
- ok(
- code2 !== codes.eof && !markdownLineEnding(code2),
- "expected anything other than a line ending or EOF"
- );
- effects.enter(types.paragraph);
- return lineStart(code2);
- }
- function lineStart(code2) {
- const token = effects.enter(types.chunkText, {
- contentType: constants.contentTypeText,
- previous: previous2
- });
- if (previous2) {
- previous2.next = token;
- }
- previous2 = token;
- return data(code2);
- }
- function data(code2) {
- if (code2 === codes.eof) {
- effects.exit(types.chunkText);
- effects.exit(types.paragraph);
- effects.consume(code2);
- return;
- }
- if (markdownLineEnding(code2)) {
- effects.consume(code2);
- effects.exit(types.chunkText);
- return lineStart;
- }
- effects.consume(code2);
- return data;
- }
- }
- // node_modules/micromark/dev/lib/initialize/document.js
- var document2 = { tokenize: initializeDocument };
- var containerConstruct = { tokenize: tokenizeContainer };
- function initializeDocument(effects) {
- const self2 = this;
- const stack = [];
- let continued = 0;
- let childFlow;
- let childToken;
- let lineStartOffset;
- return start2;
- function start2(code2) {
- if (continued < stack.length) {
- const item = stack[continued];
- self2.containerState = item[1];
- ok(
- item[0].continuation,
- "expected `continuation` to be defined on container construct"
- );
- return effects.attempt(
- item[0].continuation,
- documentContinue,
- checkNewContainers
- )(code2);
- }
- return checkNewContainers(code2);
- }
- function documentContinue(code2) {
- ok(
- self2.containerState,
- "expected `containerState` to be defined after continuation"
- );
- continued++;
- if (self2.containerState._closeFlow) {
- self2.containerState._closeFlow = void 0;
- if (childFlow) {
- closeFlow();
- }
- const indexBeforeExits = self2.events.length;
- let indexBeforeFlow = indexBeforeExits;
- let point4;
- while (indexBeforeFlow--) {
- if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === types.chunkFlow) {
- point4 = self2.events[indexBeforeFlow][1].end;
- break;
- }
- }
- ok(point4, "could not find previous flow chunk");
- exitContainers(continued);
- let index2 = indexBeforeExits;
- while (index2 < self2.events.length) {
- self2.events[index2][1].end = { ...point4 };
- index2++;
- }
- splice(
- self2.events,
- indexBeforeFlow + 1,
- 0,
- self2.events.slice(indexBeforeExits)
- );
- self2.events.length = index2;
- return checkNewContainers(code2);
- }
- return start2(code2);
- }
- function checkNewContainers(code2) {
- if (continued === stack.length) {
- if (!childFlow) {
- return documentContinued(code2);
- }
- if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
- return flowStart(code2);
- }
- self2.interrupt = Boolean(
- childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack
- );
- }
- self2.containerState = {};
- return effects.check(
- containerConstruct,
- thereIsANewContainer,
- thereIsNoNewContainer
- )(code2);
- }
- function thereIsANewContainer(code2) {
- if (childFlow) closeFlow();
- exitContainers(continued);
- return documentContinued(code2);
- }
- function thereIsNoNewContainer(code2) {
- self2.parser.lazy[self2.now().line] = continued !== stack.length;
- lineStartOffset = self2.now().offset;
- return flowStart(code2);
- }
- function documentContinued(code2) {
- self2.containerState = {};
- return effects.attempt(
- containerConstruct,
- containerContinue,
- flowStart
- )(code2);
- }
- function containerContinue(code2) {
- ok(
- self2.currentConstruct,
- "expected `currentConstruct` to be defined on tokenizer"
- );
- ok(
- self2.containerState,
- "expected `containerState` to be defined on tokenizer"
- );
- continued++;
- stack.push([self2.currentConstruct, self2.containerState]);
- return documentContinued(code2);
- }
- function flowStart(code2) {
- if (code2 === codes.eof) {
- if (childFlow) closeFlow();
- exitContainers(0);
- effects.consume(code2);
- return;
- }
- childFlow = childFlow || self2.parser.flow(self2.now());
- effects.enter(types.chunkFlow, {
- _tokenizer: childFlow,
- contentType: constants.contentTypeFlow,
- previous: childToken
- });
- return flowContinue(code2);
- }
- function flowContinue(code2) {
- if (code2 === codes.eof) {
- writeToChild(effects.exit(types.chunkFlow), true);
- exitContainers(0);
- effects.consume(code2);
- return;
- }
- if (markdownLineEnding(code2)) {
- effects.consume(code2);
- writeToChild(effects.exit(types.chunkFlow));
- continued = 0;
- self2.interrupt = void 0;
- return start2;
- }
- effects.consume(code2);
- return flowContinue;
- }
- function writeToChild(token, endOfFile) {
- ok(childFlow, "expected `childFlow` to be defined when continuing");
- const stream = self2.sliceStream(token);
- if (endOfFile) stream.push(null);
- token.previous = childToken;
- if (childToken) childToken.next = token;
- childToken = token;
- childFlow.defineSkip(token.start);
- childFlow.write(stream);
- if (self2.parser.lazy[token.start.line]) {
- let index2 = childFlow.events.length;
- while (index2--) {
- if (
- // The token starts before the line ending…
- childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet…
- (!childFlow.events[index2][1].end || // …or ends after it.
- childFlow.events[index2][1].end.offset > lineStartOffset)
- ) {
- return;
- }
- }
- const indexBeforeExits = self2.events.length;
- let indexBeforeFlow = indexBeforeExits;
- let seen;
- let point4;
- while (indexBeforeFlow--) {
- if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === types.chunkFlow) {
- if (seen) {
- point4 = self2.events[indexBeforeFlow][1].end;
- break;
- }
- seen = true;
- }
- }
- ok(point4, "could not find previous flow chunk");
- exitContainers(continued);
- index2 = indexBeforeExits;
- while (index2 < self2.events.length) {
- self2.events[index2][1].end = { ...point4 };
- index2++;
- }
- splice(
- self2.events,
- indexBeforeFlow + 1,
- 0,
- self2.events.slice(indexBeforeExits)
- );
- self2.events.length = index2;
- }
- }
- function exitContainers(size) {
- let index2 = stack.length;
- while (index2-- > size) {
- const entry = stack[index2];
- self2.containerState = entry[1];
- ok(
- entry[0].exit,
- "expected `exit` to be defined on container construct"
- );
- entry[0].exit.call(self2, effects);
- }
- stack.length = size;
- }
- function closeFlow() {
- ok(
- self2.containerState,
- "expected `containerState` to be defined when closing flow"
- );
- ok(childFlow, "expected `childFlow` to be defined when closing it");
- childFlow.write([codes.eof]);
- childToken = void 0;
- childFlow = void 0;
- self2.containerState._closeFlow = void 0;
- }
- }
- function tokenizeContainer(effects, ok2, nok) {
- ok(
- this.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- return factorySpace(
- effects,
- effects.attempt(this.parser.constructs.document, ok2, nok),
- types.linePrefix,
- this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
- );
- }
- // node_modules/micromark-util-classify-character/dev/index.js
- function classifyCharacter(code2) {
- if (code2 === codes.eof || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
- return constants.characterGroupWhitespace;
- }
- if (unicodePunctuation(code2)) {
- return constants.characterGroupPunctuation;
- }
- }
- // node_modules/micromark-util-resolve-all/index.js
- function resolveAll(constructs2, events, context) {
- const called = [];
- let index2 = -1;
- while (++index2 < constructs2.length) {
- const resolve = constructs2[index2].resolveAll;
- if (resolve && !called.includes(resolve)) {
- events = resolve(events, context);
- called.push(resolve);
- }
- }
- return events;
- }
- // node_modules/micromark-core-commonmark/dev/lib/attention.js
- var attention = {
- name: "attention",
- resolveAll: resolveAllAttention,
- tokenize: tokenizeAttention
- };
- function resolveAllAttention(events, context) {
- let index2 = -1;
- let open;
- let group;
- let text5;
- let openingSequence;
- let closingSequence;
- let use;
- let nextEvents;
- let offset;
- while (++index2 < events.length) {
- if (events[index2][0] === "enter" && events[index2][1].type === "attentionSequence" && events[index2][1]._close) {
- open = index2;
- while (open--) {
- if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && // If the markers are the same:
- context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) {
- if ((events[open][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) {
- continue;
- }
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index2][1].end.offset - events[index2][1].start.offset > 1 ? 2 : 1;
- const start2 = { ...events[open][1].end };
- const end = { ...events[index2][1].start };
- movePoint(start2, -use);
- movePoint(end, use);
- openingSequence = {
- type: use > 1 ? types.strongSequence : types.emphasisSequence,
- start: start2,
- end: { ...events[open][1].end }
- };
- closingSequence = {
- type: use > 1 ? types.strongSequence : types.emphasisSequence,
- start: { ...events[index2][1].start },
- end
- };
- text5 = {
- type: use > 1 ? types.strongText : types.emphasisText,
- start: { ...events[open][1].end },
- end: { ...events[index2][1].start }
- };
- group = {
- type: use > 1 ? types.strong : types.emphasis,
- start: { ...openingSequence.start },
- end: { ...closingSequence.end }
- };
- events[open][1].end = { ...openingSequence.start };
- events[index2][1].start = { ...closingSequence.end };
- nextEvents = [];
- if (events[open][1].end.offset - events[open][1].start.offset) {
- nextEvents = push(nextEvents, [
- ["enter", events[open][1], context],
- ["exit", events[open][1], context]
- ]);
- }
- nextEvents = push(nextEvents, [
- ["enter", group, context],
- ["enter", openingSequence, context],
- ["exit", openingSequence, context],
- ["enter", text5, context]
- ]);
- ok(
- context.parser.constructs.insideSpan.null,
- "expected `insideSpan` to be populated"
- );
- nextEvents = push(
- nextEvents,
- resolveAll(
- context.parser.constructs.insideSpan.null,
- events.slice(open + 1, index2),
- context
- )
- );
- nextEvents = push(nextEvents, [
- ["exit", text5, context],
- ["enter", closingSequence, context],
- ["exit", closingSequence, context],
- ["exit", group, context]
- ]);
- if (events[index2][1].end.offset - events[index2][1].start.offset) {
- offset = 2;
- nextEvents = push(nextEvents, [
- ["enter", events[index2][1], context],
- ["exit", events[index2][1], context]
- ]);
- } else {
- offset = 0;
- }
- splice(events, open - 1, index2 - open + 3, nextEvents);
- index2 = open + nextEvents.length - offset - 2;
- break;
- }
- }
- }
- }
- index2 = -1;
- while (++index2 < events.length) {
- if (events[index2][1].type === "attentionSequence") {
- events[index2][1].type = "data";
- }
- }
- return events;
- }
- function tokenizeAttention(effects, ok2) {
- const attentionMarkers2 = this.parser.constructs.attentionMarkers.null;
- const previous2 = this.previous;
- const before = classifyCharacter(previous2);
- let marker;
- return start2;
- function start2(code2) {
- ok(
- code2 === codes.asterisk || code2 === codes.underscore,
- "expected asterisk or underscore"
- );
- marker = code2;
- effects.enter("attentionSequence");
- return inside(code2);
- }
- function inside(code2) {
- if (code2 === marker) {
- effects.consume(code2);
- return inside;
- }
- const token = effects.exit("attentionSequence");
- const after = classifyCharacter(code2);
- ok(attentionMarkers2, "expected `attentionMarkers` to be populated");
- const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers2.includes(code2);
- const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers2.includes(previous2);
- token._open = Boolean(
- marker === codes.asterisk ? open : open && (before || !close)
- );
- token._close = Boolean(
- marker === codes.asterisk ? close : close && (after || !open)
- );
- return ok2(code2);
- }
- }
- function movePoint(point4, offset) {
- point4.column += offset;
- point4.offset += offset;
- point4._bufferIndex += offset;
- }
- // node_modules/micromark-core-commonmark/dev/lib/autolink.js
- var autolink = { name: "autolink", tokenize: tokenizeAutolink };
- function tokenizeAutolink(effects, ok2, nok) {
- let size = 0;
- return start2;
- function start2(code2) {
- ok(code2 === codes.lessThan, "expected `<`");
- effects.enter(types.autolink);
- effects.enter(types.autolinkMarker);
- effects.consume(code2);
- effects.exit(types.autolinkMarker);
- effects.enter(types.autolinkProtocol);
- return open;
- }
- function open(code2) {
- if (asciiAlpha(code2)) {
- effects.consume(code2);
- return schemeOrEmailAtext;
- }
- if (code2 === codes.atSign) {
- return nok(code2);
- }
- return emailAtext(code2);
- }
- function schemeOrEmailAtext(code2) {
- if (code2 === codes.plusSign || code2 === codes.dash || code2 === codes.dot || asciiAlphanumeric(code2)) {
- size = 1;
- return schemeInsideOrEmailAtext(code2);
- }
- return emailAtext(code2);
- }
- function schemeInsideOrEmailAtext(code2) {
- if (code2 === codes.colon) {
- effects.consume(code2);
- size = 0;
- return urlInside;
- }
- if ((code2 === codes.plusSign || code2 === codes.dash || code2 === codes.dot || asciiAlphanumeric(code2)) && size++ < constants.autolinkSchemeSizeMax) {
- effects.consume(code2);
- return schemeInsideOrEmailAtext;
- }
- size = 0;
- return emailAtext(code2);
- }
- function urlInside(code2) {
- if (code2 === codes.greaterThan) {
- effects.exit(types.autolinkProtocol);
- effects.enter(types.autolinkMarker);
- effects.consume(code2);
- effects.exit(types.autolinkMarker);
- effects.exit(types.autolink);
- return ok2;
- }
- if (code2 === codes.eof || code2 === codes.space || code2 === codes.lessThan || asciiControl(code2)) {
- return nok(code2);
- }
- effects.consume(code2);
- return urlInside;
- }
- function emailAtext(code2) {
- if (code2 === codes.atSign) {
- effects.consume(code2);
- return emailAtSignOrDot;
- }
- if (asciiAtext(code2)) {
- effects.consume(code2);
- return emailAtext;
- }
- return nok(code2);
- }
- function emailAtSignOrDot(code2) {
- return asciiAlphanumeric(code2) ? emailLabel(code2) : nok(code2);
- }
- function emailLabel(code2) {
- if (code2 === codes.dot) {
- effects.consume(code2);
- size = 0;
- return emailAtSignOrDot;
- }
- if (code2 === codes.greaterThan) {
- effects.exit(types.autolinkProtocol).type = types.autolinkEmail;
- effects.enter(types.autolinkMarker);
- effects.consume(code2);
- effects.exit(types.autolinkMarker);
- effects.exit(types.autolink);
- return ok2;
- }
- return emailValue(code2);
- }
- function emailValue(code2) {
- if ((code2 === codes.dash || asciiAlphanumeric(code2)) && size++ < constants.autolinkDomainSizeMax) {
- const next = code2 === codes.dash ? emailValue : emailLabel;
- effects.consume(code2);
- return next;
- }
- return nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/blank-line.js
- var blankLine = { partial: true, tokenize: tokenizeBlankLine };
- function tokenizeBlankLine(effects, ok2, nok) {
- return start2;
- function start2(code2) {
- return markdownSpace(code2) ? factorySpace(effects, after, types.linePrefix)(code2) : after(code2);
- }
- function after(code2) {
- return code2 === codes.eof || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/block-quote.js
- var blockQuote = {
- continuation: { tokenize: tokenizeBlockQuoteContinuation },
- exit,
- name: "blockQuote",
- tokenize: tokenizeBlockQuoteStart
- };
- function tokenizeBlockQuoteStart(effects, ok2, nok) {
- const self2 = this;
- return start2;
- function start2(code2) {
- if (code2 === codes.greaterThan) {
- const state = self2.containerState;
- ok(state, "expected `containerState` to be defined in container");
- if (!state.open) {
- effects.enter(types.blockQuote, { _container: true });
- state.open = true;
- }
- effects.enter(types.blockQuotePrefix);
- effects.enter(types.blockQuoteMarker);
- effects.consume(code2);
- effects.exit(types.blockQuoteMarker);
- return after;
- }
- return nok(code2);
- }
- function after(code2) {
- if (markdownSpace(code2)) {
- effects.enter(types.blockQuotePrefixWhitespace);
- effects.consume(code2);
- effects.exit(types.blockQuotePrefixWhitespace);
- effects.exit(types.blockQuotePrefix);
- return ok2;
- }
- effects.exit(types.blockQuotePrefix);
- return ok2(code2);
- }
- }
- function tokenizeBlockQuoteContinuation(effects, ok2, nok) {
- const self2 = this;
- return contStart;
- function contStart(code2) {
- if (markdownSpace(code2)) {
- ok(
- self2.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- return factorySpace(
- effects,
- contBefore,
- types.linePrefix,
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
- )(code2);
- }
- return contBefore(code2);
- }
- function contBefore(code2) {
- return effects.attempt(blockQuote, ok2, nok)(code2);
- }
- }
- function exit(effects) {
- effects.exit(types.blockQuote);
- }
- // node_modules/micromark-core-commonmark/dev/lib/character-escape.js
- var characterEscape = {
- name: "characterEscape",
- tokenize: tokenizeCharacterEscape
- };
- function tokenizeCharacterEscape(effects, ok2, nok) {
- return start2;
- function start2(code2) {
- ok(code2 === codes.backslash, "expected `\\`");
- effects.enter(types.characterEscape);
- effects.enter(types.escapeMarker);
- effects.consume(code2);
- effects.exit(types.escapeMarker);
- return inside;
- }
- function inside(code2) {
- if (asciiPunctuation(code2)) {
- effects.enter(types.characterEscapeValue);
- effects.consume(code2);
- effects.exit(types.characterEscapeValue);
- effects.exit(types.characterEscape);
- return ok2;
- }
- return nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/character-reference.js
- var characterReference = {
- name: "characterReference",
- tokenize: tokenizeCharacterReference
- };
- function tokenizeCharacterReference(effects, ok2, nok) {
- const self2 = this;
- let size = 0;
- let max;
- let test;
- return start2;
- function start2(code2) {
- ok(code2 === codes.ampersand, "expected `&`");
- effects.enter(types.characterReference);
- effects.enter(types.characterReferenceMarker);
- effects.consume(code2);
- effects.exit(types.characterReferenceMarker);
- return open;
- }
- function open(code2) {
- if (code2 === codes.numberSign) {
- effects.enter(types.characterReferenceMarkerNumeric);
- effects.consume(code2);
- effects.exit(types.characterReferenceMarkerNumeric);
- return numeric;
- }
- effects.enter(types.characterReferenceValue);
- max = constants.characterReferenceNamedSizeMax;
- test = asciiAlphanumeric;
- return value(code2);
- }
- function numeric(code2) {
- if (code2 === codes.uppercaseX || code2 === codes.lowercaseX) {
- effects.enter(types.characterReferenceMarkerHexadecimal);
- effects.consume(code2);
- effects.exit(types.characterReferenceMarkerHexadecimal);
- effects.enter(types.characterReferenceValue);
- max = constants.characterReferenceHexadecimalSizeMax;
- test = asciiHexDigit;
- return value;
- }
- effects.enter(types.characterReferenceValue);
- max = constants.characterReferenceDecimalSizeMax;
- test = asciiDigit;
- return value(code2);
- }
- function value(code2) {
- if (code2 === codes.semicolon && size) {
- const token = effects.exit(types.characterReferenceValue);
- if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) {
- return nok(code2);
- }
- effects.enter(types.characterReferenceMarker);
- effects.consume(code2);
- effects.exit(types.characterReferenceMarker);
- effects.exit(types.characterReference);
- return ok2;
- }
- if (test(code2) && size++ < max) {
- effects.consume(code2);
- return value;
- }
- return nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
- var nonLazyContinuation = {
- partial: true,
- tokenize: tokenizeNonLazyContinuation
- };
- var codeFenced = {
- concrete: true,
- name: "codeFenced",
- tokenize: tokenizeCodeFenced
- };
- function tokenizeCodeFenced(effects, ok2, nok) {
- const self2 = this;
- const closeStart = { partial: true, tokenize: tokenizeCloseStart };
- let initialPrefix = 0;
- let sizeOpen = 0;
- let marker;
- return start2;
- function start2(code2) {
- return beforeSequenceOpen(code2);
- }
- function beforeSequenceOpen(code2) {
- ok(
- code2 === codes.graveAccent || code2 === codes.tilde,
- "expected `` ` `` or `~`"
- );
- const tail = self2.events[self2.events.length - 1];
- initialPrefix = tail && tail[1].type === types.linePrefix ? tail[2].sliceSerialize(tail[1], true).length : 0;
- marker = code2;
- effects.enter(types.codeFenced);
- effects.enter(types.codeFencedFence);
- effects.enter(types.codeFencedFenceSequence);
- return sequenceOpen(code2);
- }
- function sequenceOpen(code2) {
- if (code2 === marker) {
- sizeOpen++;
- effects.consume(code2);
- return sequenceOpen;
- }
- if (sizeOpen < constants.codeFencedSequenceSizeMin) {
- return nok(code2);
- }
- effects.exit(types.codeFencedFenceSequence);
- return markdownSpace(code2) ? factorySpace(effects, infoBefore, types.whitespace)(code2) : infoBefore(code2);
- }
- function infoBefore(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.codeFencedFence);
- return self2.interrupt ? ok2(code2) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
- }
- effects.enter(types.codeFencedFenceInfo);
- effects.enter(types.chunkString, { contentType: constants.contentTypeString });
- return info(code2);
- }
- function info(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.chunkString);
- effects.exit(types.codeFencedFenceInfo);
- return infoBefore(code2);
- }
- if (markdownSpace(code2)) {
- effects.exit(types.chunkString);
- effects.exit(types.codeFencedFenceInfo);
- return factorySpace(effects, metaBefore, types.whitespace)(code2);
- }
- if (code2 === codes.graveAccent && code2 === marker) {
- return nok(code2);
- }
- effects.consume(code2);
- return info;
- }
- function metaBefore(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- return infoBefore(code2);
- }
- effects.enter(types.codeFencedFenceMeta);
- effects.enter(types.chunkString, { contentType: constants.contentTypeString });
- return meta(code2);
- }
- function meta(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.chunkString);
- effects.exit(types.codeFencedFenceMeta);
- return infoBefore(code2);
- }
- if (code2 === codes.graveAccent && code2 === marker) {
- return nok(code2);
- }
- effects.consume(code2);
- return meta;
- }
- function atNonLazyBreak(code2) {
- ok(markdownLineEnding(code2), "expected eol");
- return effects.attempt(closeStart, after, contentBefore)(code2);
- }
- function contentBefore(code2) {
- ok(markdownLineEnding(code2), "expected eol");
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return contentStart;
- }
- function contentStart(code2) {
- return initialPrefix > 0 && markdownSpace(code2) ? factorySpace(
- effects,
- beforeContentChunk,
- types.linePrefix,
- initialPrefix + 1
- )(code2) : beforeContentChunk(code2);
- }
- function beforeContentChunk(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
- }
- effects.enter(types.codeFlowValue);
- return contentChunk(code2);
- }
- function contentChunk(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.codeFlowValue);
- return beforeContentChunk(code2);
- }
- effects.consume(code2);
- return contentChunk;
- }
- function after(code2) {
- effects.exit(types.codeFenced);
- return ok2(code2);
- }
- function tokenizeCloseStart(effects2, ok3, nok2) {
- let size = 0;
- return startBefore;
- function startBefore(code2) {
- ok(markdownLineEnding(code2), "expected eol");
- effects2.enter(types.lineEnding);
- effects2.consume(code2);
- effects2.exit(types.lineEnding);
- return start3;
- }
- function start3(code2) {
- ok(
- self2.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- effects2.enter(types.codeFencedFence);
- return markdownSpace(code2) ? factorySpace(
- effects2,
- beforeSequenceClose,
- types.linePrefix,
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
- )(code2) : beforeSequenceClose(code2);
- }
- function beforeSequenceClose(code2) {
- if (code2 === marker) {
- effects2.enter(types.codeFencedFenceSequence);
- return sequenceClose(code2);
- }
- return nok2(code2);
- }
- function sequenceClose(code2) {
- if (code2 === marker) {
- size++;
- effects2.consume(code2);
- return sequenceClose;
- }
- if (size >= sizeOpen) {
- effects2.exit(types.codeFencedFenceSequence);
- return markdownSpace(code2) ? factorySpace(effects2, sequenceCloseAfter, types.whitespace)(code2) : sequenceCloseAfter(code2);
- }
- return nok2(code2);
- }
- function sequenceCloseAfter(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects2.exit(types.codeFencedFence);
- return ok3(code2);
- }
- return nok2(code2);
- }
- }
- }
- function tokenizeNonLazyContinuation(effects, ok2, nok) {
- const self2 = this;
- return start2;
- function start2(code2) {
- if (code2 === codes.eof) {
- return nok(code2);
- }
- ok(markdownLineEnding(code2), "expected eol");
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return lineStart;
- }
- function lineStart(code2) {
- return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/code-indented.js
- var codeIndented = {
- name: "codeIndented",
- tokenize: tokenizeCodeIndented
- };
- var furtherStart = { partial: true, tokenize: tokenizeFurtherStart };
- function tokenizeCodeIndented(effects, ok2, nok) {
- const self2 = this;
- return start2;
- function start2(code2) {
- ok(markdownSpace(code2));
- effects.enter(types.codeIndented);
- return factorySpace(
- effects,
- afterPrefix,
- types.linePrefix,
- constants.tabSize + 1
- )(code2);
- }
- function afterPrefix(code2) {
- const tail = self2.events[self2.events.length - 1];
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code2) : nok(code2);
- }
- function atBreak(code2) {
- if (code2 === codes.eof) {
- return after(code2);
- }
- if (markdownLineEnding(code2)) {
- return effects.attempt(furtherStart, atBreak, after)(code2);
- }
- effects.enter(types.codeFlowValue);
- return inside(code2);
- }
- function inside(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.codeFlowValue);
- return atBreak(code2);
- }
- effects.consume(code2);
- return inside;
- }
- function after(code2) {
- effects.exit(types.codeIndented);
- return ok2(code2);
- }
- }
- function tokenizeFurtherStart(effects, ok2, nok) {
- const self2 = this;
- return furtherStart2;
- function furtherStart2(code2) {
- if (self2.parser.lazy[self2.now().line]) {
- return nok(code2);
- }
- if (markdownLineEnding(code2)) {
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return furtherStart2;
- }
- return factorySpace(
- effects,
- afterPrefix,
- types.linePrefix,
- constants.tabSize + 1
- )(code2);
- }
- function afterPrefix(code2) {
- const tail = self2.events[self2.events.length - 1];
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok2(code2) : markdownLineEnding(code2) ? furtherStart2(code2) : nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/code-text.js
- var codeText = {
- name: "codeText",
- previous,
- resolve: resolveCodeText,
- tokenize: tokenizeCodeText
- };
- function resolveCodeText(events) {
- let tailExitIndex = events.length - 4;
- let headEnterIndex = 3;
- let index2;
- let enter;
- if ((events[headEnterIndex][1].type === types.lineEnding || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === types.lineEnding || events[tailExitIndex][1].type === "space")) {
- index2 = headEnterIndex;
- while (++index2 < tailExitIndex) {
- if (events[index2][1].type === types.codeTextData) {
- events[headEnterIndex][1].type = types.codeTextPadding;
- events[tailExitIndex][1].type = types.codeTextPadding;
- headEnterIndex += 2;
- tailExitIndex -= 2;
- break;
- }
- }
- }
- index2 = headEnterIndex - 1;
- tailExitIndex++;
- while (++index2 <= tailExitIndex) {
- if (enter === void 0) {
- if (index2 !== tailExitIndex && events[index2][1].type !== types.lineEnding) {
- enter = index2;
- }
- } else if (index2 === tailExitIndex || events[index2][1].type === types.lineEnding) {
- events[enter][1].type = types.codeTextData;
- if (index2 !== enter + 2) {
- events[enter][1].end = events[index2 - 1][1].end;
- events.splice(enter + 2, index2 - enter - 2);
- tailExitIndex -= index2 - enter - 2;
- index2 = enter + 2;
- }
- enter = void 0;
- }
- }
- return events;
- }
- function previous(code2) {
- return code2 !== codes.graveAccent || this.events[this.events.length - 1][1].type === types.characterEscape;
- }
- function tokenizeCodeText(effects, ok2, nok) {
- const self2 = this;
- let sizeOpen = 0;
- let size;
- let token;
- return start2;
- function start2(code2) {
- ok(code2 === codes.graveAccent, "expected `` ` ``");
- ok(previous.call(self2, self2.previous), "expected correct previous");
- effects.enter(types.codeText);
- effects.enter(types.codeTextSequence);
- return sequenceOpen(code2);
- }
- function sequenceOpen(code2) {
- if (code2 === codes.graveAccent) {
- effects.consume(code2);
- sizeOpen++;
- return sequenceOpen;
- }
- effects.exit(types.codeTextSequence);
- return between(code2);
- }
- function between(code2) {
- if (code2 === codes.eof) {
- return nok(code2);
- }
- if (code2 === codes.space) {
- effects.enter("space");
- effects.consume(code2);
- effects.exit("space");
- return between;
- }
- if (code2 === codes.graveAccent) {
- token = effects.enter(types.codeTextSequence);
- size = 0;
- return sequenceClose(code2);
- }
- if (markdownLineEnding(code2)) {
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return between;
- }
- effects.enter(types.codeTextData);
- return data(code2);
- }
- function data(code2) {
- if (code2 === codes.eof || code2 === codes.space || code2 === codes.graveAccent || markdownLineEnding(code2)) {
- effects.exit(types.codeTextData);
- return between(code2);
- }
- effects.consume(code2);
- return data;
- }
- function sequenceClose(code2) {
- if (code2 === codes.graveAccent) {
- effects.consume(code2);
- size++;
- return sequenceClose;
- }
- if (size === sizeOpen) {
- effects.exit(types.codeTextSequence);
- effects.exit(types.codeText);
- return ok2(code2);
- }
- token.type = types.codeTextData;
- return data(code2);
- }
- }
- // node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js
- var SpliceBuffer = class {
- /**
- * @param {ReadonlyArray<T> | null | undefined} [initial]
- * Initial items (optional).
- * @returns
- * Splice buffer.
- */
- constructor(initial) {
- this.left = initial ? [...initial] : [];
- this.right = [];
- }
- /**
- * Array access;
- * does not move the cursor.
- *
- * @param {number} index
- * Index.
- * @return {T}
- * Item.
- */
- get(index2) {
- if (index2 < 0 || index2 >= this.left.length + this.right.length) {
- throw new RangeError(
- "Cannot access index `" + index2 + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`"
- );
- }
- if (index2 < this.left.length) return this.left[index2];
- return this.right[this.right.length - index2 + this.left.length - 1];
- }
- /**
- * The length of the splice buffer, one greater than the largest index in the
- * array.
- */
- get length() {
- return this.left.length + this.right.length;
- }
- /**
- * Remove and return `list[0]`;
- * moves the cursor to `0`.
- *
- * @returns {T | undefined}
- * Item, optional.
- */
- shift() {
- this.setCursor(0);
- return this.right.pop();
- }
- /**
- * Slice the buffer to get an array;
- * does not move the cursor.
- *
- * @param {number} start
- * Start.
- * @param {number | null | undefined} [end]
- * End (optional).
- * @returns {Array<T>}
- * Array of items.
- */
- slice(start2, end) {
- const stop = end === null || end === void 0 ? Number.POSITIVE_INFINITY : end;
- if (stop < this.left.length) {
- return this.left.slice(start2, stop);
- }
- if (start2 > this.left.length) {
- return this.right.slice(
- this.right.length - stop + this.left.length,
- this.right.length - start2 + this.left.length
- ).reverse();
- }
- return this.left.slice(start2).concat(
- this.right.slice(this.right.length - stop + this.left.length).reverse()
- );
- }
- /**
- * Mimics the behavior of Array.prototype.splice() except for the change of
- * interface necessary to avoid segfaults when patching in very large arrays.
- *
- * This operation moves cursor is moved to `start` and results in the cursor
- * placed after any inserted items.
- *
- * @param {number} start
- * Start;
- * zero-based index at which to start changing the array;
- * negative numbers count backwards from the end of the array and values
- * that are out-of bounds are clamped to the appropriate end of the array.
- * @param {number | null | undefined} [deleteCount=0]
- * Delete count (default: `0`);
- * maximum number of elements to delete, starting from start.
- * @param {Array<T> | null | undefined} [items=[]]
- * Items to include in place of the deleted items (default: `[]`).
- * @return {Array<T>}
- * Any removed items.
- */
- splice(start2, deleteCount, items) {
- const count = deleteCount || 0;
- this.setCursor(Math.trunc(start2));
- const removed = this.right.splice(
- this.right.length - count,
- Number.POSITIVE_INFINITY
- );
- if (items) chunkedPush(this.left, items);
- return removed.reverse();
- }
- /**
- * Remove and return the highest-numbered item in the array, so
- * `list[list.length - 1]`;
- * Moves the cursor to `length`.
- *
- * @returns {T | undefined}
- * Item, optional.
- */
- pop() {
- this.setCursor(Number.POSITIVE_INFINITY);
- return this.left.pop();
- }
- /**
- * Inserts a single item to the high-numbered side of the array;
- * moves the cursor to `length`.
- *
- * @param {T} item
- * Item.
- * @returns {undefined}
- * Nothing.
- */
- push(item) {
- this.setCursor(Number.POSITIVE_INFINITY);
- this.left.push(item);
- }
- /**
- * Inserts many items to the high-numbered side of the array.
- * Moves the cursor to `length`.
- *
- * @param {Array<T>} items
- * Items.
- * @returns {undefined}
- * Nothing.
- */
- pushMany(items) {
- this.setCursor(Number.POSITIVE_INFINITY);
- chunkedPush(this.left, items);
- }
- /**
- * Inserts a single item to the low-numbered side of the array;
- * Moves the cursor to `0`.
- *
- * @param {T} item
- * Item.
- * @returns {undefined}
- * Nothing.
- */
- unshift(item) {
- this.setCursor(0);
- this.right.push(item);
- }
- /**
- * Inserts many items to the low-numbered side of the array;
- * moves the cursor to `0`.
- *
- * @param {Array<T>} items
- * Items.
- * @returns {undefined}
- * Nothing.
- */
- unshiftMany(items) {
- this.setCursor(0);
- chunkedPush(this.right, items.reverse());
- }
- /**
- * Move the cursor to a specific position in the array. Requires
- * time proportional to the distance moved.
- *
- * If `n < 0`, the cursor will end up at the beginning.
- * If `n > length`, the cursor will end up at the end.
- *
- * @param {number} n
- * Position.
- * @return {undefined}
- * Nothing.
- */
- setCursor(n) {
- if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0)
- return;
- if (n < this.left.length) {
- const removed = this.left.splice(n, Number.POSITIVE_INFINITY);
- chunkedPush(this.right, removed.reverse());
- } else {
- const removed = this.right.splice(
- this.left.length + this.right.length - n,
- Number.POSITIVE_INFINITY
- );
- chunkedPush(this.left, removed.reverse());
- }
- }
- };
- function chunkedPush(list3, right) {
- let chunkStart = 0;
- if (right.length < constants.v8MaxSafeChunkSize) {
- list3.push(...right);
- } else {
- while (chunkStart < right.length) {
- list3.push(
- ...right.slice(chunkStart, chunkStart + constants.v8MaxSafeChunkSize)
- );
- chunkStart += constants.v8MaxSafeChunkSize;
- }
- }
- }
- // node_modules/micromark-util-subtokenize/dev/index.js
- function subtokenize(eventsArray) {
- const jumps = {};
- let index2 = -1;
- let event;
- let lineIndex;
- let otherIndex;
- let otherEvent;
- let parameters;
- let subevents;
- let more;
- const events = new SpliceBuffer(eventsArray);
- while (++index2 < events.length) {
- while (index2 in jumps) {
- index2 = jumps[index2];
- }
- event = events.get(index2);
- if (index2 && event[1].type === types.chunkFlow && events.get(index2 - 1)[1].type === types.listItemPrefix) {
- ok(event[1]._tokenizer, "expected `_tokenizer` on subtokens");
- subevents = event[1]._tokenizer.events;
- otherIndex = 0;
- if (otherIndex < subevents.length && subevents[otherIndex][1].type === types.lineEndingBlank) {
- otherIndex += 2;
- }
- if (otherIndex < subevents.length && subevents[otherIndex][1].type === types.content) {
- while (++otherIndex < subevents.length) {
- if (subevents[otherIndex][1].type === types.content) {
- break;
- }
- if (subevents[otherIndex][1].type === types.chunkText) {
- subevents[otherIndex][1]._isInFirstContentOfListItem = true;
- otherIndex++;
- }
- }
- }
- }
- if (event[0] === "enter") {
- if (event[1].contentType) {
- Object.assign(jumps, subcontent(events, index2));
- index2 = jumps[index2];
- more = true;
- }
- } else if (event[1]._container) {
- otherIndex = index2;
- lineIndex = void 0;
- while (otherIndex--) {
- otherEvent = events.get(otherIndex);
- if (otherEvent[1].type === types.lineEnding || otherEvent[1].type === types.lineEndingBlank) {
- if (otherEvent[0] === "enter") {
- if (lineIndex) {
- events.get(lineIndex)[1].type = types.lineEndingBlank;
- }
- otherEvent[1].type = types.lineEnding;
- lineIndex = otherIndex;
- }
- } else if (otherEvent[1].type === types.linePrefix || otherEvent[1].type === types.listItemIndent) {
- } else {
- break;
- }
- }
- if (lineIndex) {
- event[1].end = { ...events.get(lineIndex)[1].start };
- parameters = events.slice(lineIndex, index2);
- parameters.unshift(event);
- events.splice(lineIndex, index2 - lineIndex + 1, parameters);
- }
- }
- }
- splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));
- return !more;
- }
- function subcontent(events, eventIndex) {
- const token = events.get(eventIndex)[1];
- const context = events.get(eventIndex)[2];
- let startPosition = eventIndex - 1;
- const startPositions = [];
- ok(token.contentType, "expected `contentType` on subtokens");
- let tokenizer = token._tokenizer;
- if (!tokenizer) {
- tokenizer = context.parser[token.contentType](token.start);
- if (token._contentTypeTextTrailing) {
- tokenizer._contentTypeTextTrailing = true;
- }
- }
- const childEvents = tokenizer.events;
- const jumps = [];
- const gaps = {};
- let stream;
- let previous2;
- let index2 = -1;
- let current = token;
- let adjust = 0;
- let start2 = 0;
- const breaks = [start2];
- while (current) {
- while (events.get(++startPosition)[1] !== current) {
- }
- ok(
- !previous2 || current.previous === previous2,
- "expected previous to match"
- );
- ok(!previous2 || previous2.next === current, "expected next to match");
- startPositions.push(startPosition);
- if (!current._tokenizer) {
- stream = context.sliceStream(current);
- if (!current.next) {
- stream.push(codes.eof);
- }
- if (previous2) {
- tokenizer.defineSkip(current.start);
- }
- if (current._isInFirstContentOfListItem) {
- tokenizer._gfmTasklistFirstContentOfListItem = true;
- }
- tokenizer.write(stream);
- if (current._isInFirstContentOfListItem) {
- tokenizer._gfmTasklistFirstContentOfListItem = void 0;
- }
- }
- previous2 = current;
- current = current.next;
- }
- current = token;
- while (++index2 < childEvents.length) {
- if (
- // Find a void token that includes a break.
- childEvents[index2][0] === "exit" && childEvents[index2 - 1][0] === "enter" && childEvents[index2][1].type === childEvents[index2 - 1][1].type && childEvents[index2][1].start.line !== childEvents[index2][1].end.line
- ) {
- ok(current, "expected a current token");
- start2 = index2 + 1;
- breaks.push(start2);
- current._tokenizer = void 0;
- current.previous = void 0;
- current = current.next;
- }
- }
- tokenizer.events = [];
- if (current) {
- current._tokenizer = void 0;
- current.previous = void 0;
- ok(!current.next, "expected no next token");
- } else {
- breaks.pop();
- }
- index2 = breaks.length;
- while (index2--) {
- const slice = childEvents.slice(breaks[index2], breaks[index2 + 1]);
- const start3 = startPositions.pop();
- ok(start3 !== void 0, "expected a start position when splicing");
- jumps.push([start3, start3 + slice.length - 1]);
- events.splice(start3, 2, slice);
- }
- jumps.reverse();
- index2 = -1;
- while (++index2 < jumps.length) {
- gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1];
- adjust += jumps[index2][1] - jumps[index2][0] - 1;
- }
- return gaps;
- }
- // node_modules/micromark-core-commonmark/dev/lib/content.js
- var content2 = { resolve: resolveContent, tokenize: tokenizeContent };
- var continuationConstruct = { partial: true, tokenize: tokenizeContinuation };
- function resolveContent(events) {
- subtokenize(events);
- return events;
- }
- function tokenizeContent(effects, ok2) {
- let previous2;
- return chunkStart;
- function chunkStart(code2) {
- ok(
- code2 !== codes.eof && !markdownLineEnding(code2),
- "expected no eof or eol"
- );
- effects.enter(types.content);
- previous2 = effects.enter(types.chunkContent, {
- contentType: constants.contentTypeContent
- });
- return chunkInside(code2);
- }
- function chunkInside(code2) {
- if (code2 === codes.eof) {
- return contentEnd(code2);
- }
- if (markdownLineEnding(code2)) {
- return effects.check(
- continuationConstruct,
- contentContinue,
- contentEnd
- )(code2);
- }
- effects.consume(code2);
- return chunkInside;
- }
- function contentEnd(code2) {
- effects.exit(types.chunkContent);
- effects.exit(types.content);
- return ok2(code2);
- }
- function contentContinue(code2) {
- ok(markdownLineEnding(code2), "expected eol");
- effects.consume(code2);
- effects.exit(types.chunkContent);
- ok(previous2, "expected previous token");
- previous2.next = effects.enter(types.chunkContent, {
- contentType: constants.contentTypeContent,
- previous: previous2
- });
- previous2 = previous2.next;
- return chunkInside;
- }
- }
- function tokenizeContinuation(effects, ok2, nok) {
- const self2 = this;
- return startLookahead;
- function startLookahead(code2) {
- ok(markdownLineEnding(code2), "expected a line ending");
- effects.exit(types.chunkContent);
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return factorySpace(effects, prefixed, types.linePrefix);
- }
- function prefixed(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- return nok(code2);
- }
- ok(
- self2.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- const tail = self2.events[self2.events.length - 1];
- if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize) {
- return ok2(code2);
- }
- return effects.interrupt(self2.parser.constructs.flow, nok, ok2)(code2);
- }
- }
- // node_modules/micromark-factory-destination/dev/index.js
- function factoryDestination(effects, ok2, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
- const limit = max || Number.POSITIVE_INFINITY;
- let balance = 0;
- return start2;
- function start2(code2) {
- if (code2 === codes.lessThan) {
- effects.enter(type);
- effects.enter(literalType);
- effects.enter(literalMarkerType);
- effects.consume(code2);
- effects.exit(literalMarkerType);
- return enclosedBefore;
- }
- if (code2 === codes.eof || code2 === codes.space || code2 === codes.rightParenthesis || asciiControl(code2)) {
- return nok(code2);
- }
- effects.enter(type);
- effects.enter(rawType);
- effects.enter(stringType);
- effects.enter(types.chunkString, { contentType: constants.contentTypeString });
- return raw(code2);
- }
- function enclosedBefore(code2) {
- if (code2 === codes.greaterThan) {
- effects.enter(literalMarkerType);
- effects.consume(code2);
- effects.exit(literalMarkerType);
- effects.exit(literalType);
- effects.exit(type);
- return ok2;
- }
- effects.enter(stringType);
- effects.enter(types.chunkString, { contentType: constants.contentTypeString });
- return enclosed(code2);
- }
- function enclosed(code2) {
- if (code2 === codes.greaterThan) {
- effects.exit(types.chunkString);
- effects.exit(stringType);
- return enclosedBefore(code2);
- }
- if (code2 === codes.eof || code2 === codes.lessThan || markdownLineEnding(code2)) {
- return nok(code2);
- }
- effects.consume(code2);
- return code2 === codes.backslash ? enclosedEscape : enclosed;
- }
- function enclosedEscape(code2) {
- if (code2 === codes.lessThan || code2 === codes.greaterThan || code2 === codes.backslash) {
- effects.consume(code2);
- return enclosed;
- }
- return enclosed(code2);
- }
- function raw(code2) {
- if (!balance && (code2 === codes.eof || code2 === codes.rightParenthesis || markdownLineEndingOrSpace(code2))) {
- effects.exit(types.chunkString);
- effects.exit(stringType);
- effects.exit(rawType);
- effects.exit(type);
- return ok2(code2);
- }
- if (balance < limit && code2 === codes.leftParenthesis) {
- effects.consume(code2);
- balance++;
- return raw;
- }
- if (code2 === codes.rightParenthesis) {
- effects.consume(code2);
- balance--;
- return raw;
- }
- if (code2 === codes.eof || code2 === codes.space || code2 === codes.leftParenthesis || asciiControl(code2)) {
- return nok(code2);
- }
- effects.consume(code2);
- return code2 === codes.backslash ? rawEscape : raw;
- }
- function rawEscape(code2) {
- if (code2 === codes.leftParenthesis || code2 === codes.rightParenthesis || code2 === codes.backslash) {
- effects.consume(code2);
- return raw;
- }
- return raw(code2);
- }
- }
- // node_modules/micromark-factory-label/dev/index.js
- function factoryLabel(effects, ok2, nok, type, markerType, stringType) {
- const self2 = this;
- let size = 0;
- let seen;
- return start2;
- function start2(code2) {
- ok(code2 === codes.leftSquareBracket, "expected `[`");
- effects.enter(type);
- effects.enter(markerType);
- effects.consume(code2);
- effects.exit(markerType);
- effects.enter(stringType);
- return atBreak;
- }
- function atBreak(code2) {
- if (size > constants.linkReferenceSizeMax || code2 === codes.eof || code2 === codes.leftSquareBracket || code2 === codes.rightSquareBracket && !seen || // To do: remove in the future once we’ve switched from
- // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
- // which doesn’t need this.
- // Hidden footnotes hook.
- /* c8 ignore next 3 */
- code2 === codes.caret && !size && "_hiddenFootnoteSupport" in self2.parser.constructs) {
- return nok(code2);
- }
- if (code2 === codes.rightSquareBracket) {
- effects.exit(stringType);
- effects.enter(markerType);
- effects.consume(code2);
- effects.exit(markerType);
- effects.exit(type);
- return ok2;
- }
- if (markdownLineEnding(code2)) {
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return atBreak;
- }
- effects.enter(types.chunkString, { contentType: constants.contentTypeString });
- return labelInside(code2);
- }
- function labelInside(code2) {
- if (code2 === codes.eof || code2 === codes.leftSquareBracket || code2 === codes.rightSquareBracket || markdownLineEnding(code2) || size++ > constants.linkReferenceSizeMax) {
- effects.exit(types.chunkString);
- return atBreak(code2);
- }
- effects.consume(code2);
- if (!seen) seen = !markdownSpace(code2);
- return code2 === codes.backslash ? labelEscape : labelInside;
- }
- function labelEscape(code2) {
- if (code2 === codes.leftSquareBracket || code2 === codes.backslash || code2 === codes.rightSquareBracket) {
- effects.consume(code2);
- size++;
- return labelInside;
- }
- return labelInside(code2);
- }
- }
- // node_modules/micromark-factory-title/dev/index.js
- function factoryTitle(effects, ok2, nok, type, markerType, stringType) {
- let marker;
- return start2;
- function start2(code2) {
- if (code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.leftParenthesis) {
- effects.enter(type);
- effects.enter(markerType);
- effects.consume(code2);
- effects.exit(markerType);
- marker = code2 === codes.leftParenthesis ? codes.rightParenthesis : code2;
- return begin;
- }
- return nok(code2);
- }
- function begin(code2) {
- if (code2 === marker) {
- effects.enter(markerType);
- effects.consume(code2);
- effects.exit(markerType);
- effects.exit(type);
- return ok2;
- }
- effects.enter(stringType);
- return atBreak(code2);
- }
- function atBreak(code2) {
- if (code2 === marker) {
- effects.exit(stringType);
- return begin(marker);
- }
- if (code2 === codes.eof) {
- return nok(code2);
- }
- if (markdownLineEnding(code2)) {
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return factorySpace(effects, atBreak, types.linePrefix);
- }
- effects.enter(types.chunkString, { contentType: constants.contentTypeString });
- return inside(code2);
- }
- function inside(code2) {
- if (code2 === marker || code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.chunkString);
- return atBreak(code2);
- }
- effects.consume(code2);
- return code2 === codes.backslash ? escape : inside;
- }
- function escape(code2) {
- if (code2 === marker || code2 === codes.backslash) {
- effects.consume(code2);
- return inside;
- }
- return inside(code2);
- }
- }
- // node_modules/micromark-factory-whitespace/dev/index.js
- function factoryWhitespace(effects, ok2) {
- let seen;
- return start2;
- function start2(code2) {
- if (markdownLineEnding(code2)) {
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- seen = true;
- return start2;
- }
- if (markdownSpace(code2)) {
- return factorySpace(
- effects,
- start2,
- seen ? types.linePrefix : types.lineSuffix
- )(code2);
- }
- return ok2(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/definition.js
- var definition = { name: "definition", tokenize: tokenizeDefinition };
- var titleBefore = { partial: true, tokenize: tokenizeTitleBefore };
- function tokenizeDefinition(effects, ok2, nok) {
- const self2 = this;
- let identifier;
- return start2;
- function start2(code2) {
- effects.enter(types.definition);
- return before(code2);
- }
- function before(code2) {
- ok(code2 === codes.leftSquareBracket, "expected `[`");
- return factoryLabel.call(
- self2,
- effects,
- labelAfter,
- // Note: we don’t need to reset the way `markdown-rs` does.
- nok,
- types.definitionLabel,
- types.definitionLabelMarker,
- types.definitionLabelString
- )(code2);
- }
- function labelAfter(code2) {
- identifier = normalizeIdentifier(
- self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)
- );
- if (code2 === codes.colon) {
- effects.enter(types.definitionMarker);
- effects.consume(code2);
- effects.exit(types.definitionMarker);
- return markerAfter;
- }
- return nok(code2);
- }
- function markerAfter(code2) {
- return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, destinationBefore)(code2) : destinationBefore(code2);
- }
- function destinationBefore(code2) {
- return factoryDestination(
- effects,
- destinationAfter,
- // Note: we don’t need to reset the way `markdown-rs` does.
- nok,
- types.definitionDestination,
- types.definitionDestinationLiteral,
- types.definitionDestinationLiteralMarker,
- types.definitionDestinationRaw,
- types.definitionDestinationString
- )(code2);
- }
- function destinationAfter(code2) {
- return effects.attempt(titleBefore, after, after)(code2);
- }
- function after(code2) {
- return markdownSpace(code2) ? factorySpace(effects, afterWhitespace, types.whitespace)(code2) : afterWhitespace(code2);
- }
- function afterWhitespace(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.definition);
- self2.parser.defined.push(identifier);
- return ok2(code2);
- }
- return nok(code2);
- }
- }
- function tokenizeTitleBefore(effects, ok2, nok) {
- return titleBefore2;
- function titleBefore2(code2) {
- return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, beforeMarker)(code2) : nok(code2);
- }
- function beforeMarker(code2) {
- return factoryTitle(
- effects,
- titleAfter,
- nok,
- types.definitionTitle,
- types.definitionTitleMarker,
- types.definitionTitleString
- )(code2);
- }
- function titleAfter(code2) {
- return markdownSpace(code2) ? factorySpace(
- effects,
- titleAfterOptionalWhitespace,
- types.whitespace
- )(code2) : titleAfterOptionalWhitespace(code2);
- }
- function titleAfterOptionalWhitespace(code2) {
- return code2 === codes.eof || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js
- var hardBreakEscape = {
- name: "hardBreakEscape",
- tokenize: tokenizeHardBreakEscape
- };
- function tokenizeHardBreakEscape(effects, ok2, nok) {
- return start2;
- function start2(code2) {
- ok(code2 === codes.backslash, "expected `\\`");
- effects.enter(types.hardBreakEscape);
- effects.consume(code2);
- return after;
- }
- function after(code2) {
- if (markdownLineEnding(code2)) {
- effects.exit(types.hardBreakEscape);
- return ok2(code2);
- }
- return nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/heading-atx.js
- var headingAtx = {
- name: "headingAtx",
- resolve: resolveHeadingAtx,
- tokenize: tokenizeHeadingAtx
- };
- function resolveHeadingAtx(events, context) {
- let contentEnd = events.length - 2;
- let contentStart = 3;
- let content3;
- let text5;
- if (events[contentStart][1].type === types.whitespace) {
- contentStart += 2;
- }
- if (contentEnd - 2 > contentStart && events[contentEnd][1].type === types.whitespace) {
- contentEnd -= 2;
- }
- if (events[contentEnd][1].type === types.atxHeadingSequence && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === types.whitespace)) {
- contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
- }
- if (contentEnd > contentStart) {
- content3 = {
- type: types.atxHeadingText,
- start: events[contentStart][1].start,
- end: events[contentEnd][1].end
- };
- text5 = {
- type: types.chunkText,
- start: events[contentStart][1].start,
- end: events[contentEnd][1].end,
- contentType: constants.contentTypeText
- };
- splice(events, contentStart, contentEnd - contentStart + 1, [
- ["enter", content3, context],
- ["enter", text5, context],
- ["exit", text5, context],
- ["exit", content3, context]
- ]);
- }
- return events;
- }
- function tokenizeHeadingAtx(effects, ok2, nok) {
- let size = 0;
- return start2;
- function start2(code2) {
- effects.enter(types.atxHeading);
- return before(code2);
- }
- function before(code2) {
- ok(code2 === codes.numberSign, "expected `#`");
- effects.enter(types.atxHeadingSequence);
- return sequenceOpen(code2);
- }
- function sequenceOpen(code2) {
- if (code2 === codes.numberSign && size++ < constants.atxHeadingOpeningFenceSizeMax) {
- effects.consume(code2);
- return sequenceOpen;
- }
- if (code2 === codes.eof || markdownLineEndingOrSpace(code2)) {
- effects.exit(types.atxHeadingSequence);
- return atBreak(code2);
- }
- return nok(code2);
- }
- function atBreak(code2) {
- if (code2 === codes.numberSign) {
- effects.enter(types.atxHeadingSequence);
- return sequenceFurther(code2);
- }
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.atxHeading);
- return ok2(code2);
- }
- if (markdownSpace(code2)) {
- return factorySpace(effects, atBreak, types.whitespace)(code2);
- }
- effects.enter(types.atxHeadingText);
- return data(code2);
- }
- function sequenceFurther(code2) {
- if (code2 === codes.numberSign) {
- effects.consume(code2);
- return sequenceFurther;
- }
- effects.exit(types.atxHeadingSequence);
- return atBreak(code2);
- }
- function data(code2) {
- if (code2 === codes.eof || code2 === codes.numberSign || markdownLineEndingOrSpace(code2)) {
- effects.exit(types.atxHeadingText);
- return atBreak(code2);
- }
- effects.consume(code2);
- return data;
- }
- }
- // node_modules/micromark-util-html-tag-name/index.js
- var htmlBlockNames = [
- "address",
- "article",
- "aside",
- "base",
- "basefont",
- "blockquote",
- "body",
- "caption",
- "center",
- "col",
- "colgroup",
- "dd",
- "details",
- "dialog",
- "dir",
- "div",
- "dl",
- "dt",
- "fieldset",
- "figcaption",
- "figure",
- "footer",
- "form",
- "frame",
- "frameset",
- "h1",
- "h2",
- "h3",
- "h4",
- "h5",
- "h6",
- "head",
- "header",
- "hr",
- "html",
- "iframe",
- "legend",
- "li",
- "link",
- "main",
- "menu",
- "menuitem",
- "nav",
- "noframes",
- "ol",
- "optgroup",
- "option",
- "p",
- "param",
- "search",
- "section",
- "summary",
- "table",
- "tbody",
- "td",
- "tfoot",
- "th",
- "thead",
- "title",
- "tr",
- "track",
- "ul"
- ];
- var htmlRawNames = ["pre", "script", "style", "textarea"];
- // node_modules/micromark-core-commonmark/dev/lib/html-flow.js
- var htmlFlow = {
- concrete: true,
- name: "htmlFlow",
- resolveTo: resolveToHtmlFlow,
- tokenize: tokenizeHtmlFlow
- };
- var blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore };
- var nonLazyContinuationStart = {
- partial: true,
- tokenize: tokenizeNonLazyContinuationStart
- };
- function resolveToHtmlFlow(events) {
- let index2 = events.length;
- while (index2--) {
- if (events[index2][0] === "enter" && events[index2][1].type === types.htmlFlow) {
- break;
- }
- }
- if (index2 > 1 && events[index2 - 2][1].type === types.linePrefix) {
- events[index2][1].start = events[index2 - 2][1].start;
- events[index2 + 1][1].start = events[index2 - 2][1].start;
- events.splice(index2 - 2, 2);
- }
- return events;
- }
- function tokenizeHtmlFlow(effects, ok2, nok) {
- const self2 = this;
- let marker;
- let closingTag;
- let buffer;
- let index2;
- let markerB;
- return start2;
- function start2(code2) {
- return before(code2);
- }
- function before(code2) {
- ok(code2 === codes.lessThan, "expected `<`");
- effects.enter(types.htmlFlow);
- effects.enter(types.htmlFlowData);
- effects.consume(code2);
- return open;
- }
- function open(code2) {
- if (code2 === codes.exclamationMark) {
- effects.consume(code2);
- return declarationOpen;
- }
- if (code2 === codes.slash) {
- effects.consume(code2);
- closingTag = true;
- return tagCloseStart;
- }
- if (code2 === codes.questionMark) {
- effects.consume(code2);
- marker = constants.htmlInstruction;
- return self2.interrupt ? ok2 : continuationDeclarationInside;
- }
- if (asciiAlpha(code2)) {
- ok(code2 !== null);
- effects.consume(code2);
- buffer = String.fromCharCode(code2);
- return tagName;
- }
- return nok(code2);
- }
- function declarationOpen(code2) {
- if (code2 === codes.dash) {
- effects.consume(code2);
- marker = constants.htmlComment;
- return commentOpenInside;
- }
- if (code2 === codes.leftSquareBracket) {
- effects.consume(code2);
- marker = constants.htmlCdata;
- index2 = 0;
- return cdataOpenInside;
- }
- if (asciiAlpha(code2)) {
- effects.consume(code2);
- marker = constants.htmlDeclaration;
- return self2.interrupt ? ok2 : continuationDeclarationInside;
- }
- return nok(code2);
- }
- function commentOpenInside(code2) {
- if (code2 === codes.dash) {
- effects.consume(code2);
- return self2.interrupt ? ok2 : continuationDeclarationInside;
- }
- return nok(code2);
- }
- function cdataOpenInside(code2) {
- const value = constants.cdataOpeningString;
- if (code2 === value.charCodeAt(index2++)) {
- effects.consume(code2);
- if (index2 === value.length) {
- return self2.interrupt ? ok2 : continuation;
- }
- return cdataOpenInside;
- }
- return nok(code2);
- }
- function tagCloseStart(code2) {
- if (asciiAlpha(code2)) {
- ok(code2 !== null);
- effects.consume(code2);
- buffer = String.fromCharCode(code2);
- return tagName;
- }
- return nok(code2);
- }
- function tagName(code2) {
- if (code2 === codes.eof || code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
- const slash = code2 === codes.slash;
- const name2 = buffer.toLowerCase();
- if (!slash && !closingTag && htmlRawNames.includes(name2)) {
- marker = constants.htmlRaw;
- return self2.interrupt ? ok2(code2) : continuation(code2);
- }
- if (htmlBlockNames.includes(buffer.toLowerCase())) {
- marker = constants.htmlBasic;
- if (slash) {
- effects.consume(code2);
- return basicSelfClosing;
- }
- return self2.interrupt ? ok2(code2) : continuation(code2);
- }
- marker = constants.htmlComplete;
- return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code2) : closingTag ? completeClosingTagAfter(code2) : completeAttributeNameBefore(code2);
- }
- if (code2 === codes.dash || asciiAlphanumeric(code2)) {
- effects.consume(code2);
- buffer += String.fromCharCode(code2);
- return tagName;
- }
- return nok(code2);
- }
- function basicSelfClosing(code2) {
- if (code2 === codes.greaterThan) {
- effects.consume(code2);
- return self2.interrupt ? ok2 : continuation;
- }
- return nok(code2);
- }
- function completeClosingTagAfter(code2) {
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return completeClosingTagAfter;
- }
- return completeEnd(code2);
- }
- function completeAttributeNameBefore(code2) {
- if (code2 === codes.slash) {
- effects.consume(code2);
- return completeEnd;
- }
- if (code2 === codes.colon || code2 === codes.underscore || asciiAlpha(code2)) {
- effects.consume(code2);
- return completeAttributeName;
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return completeAttributeNameBefore;
- }
- return completeEnd(code2);
- }
- function completeAttributeName(code2) {
- if (code2 === codes.dash || code2 === codes.dot || code2 === codes.colon || code2 === codes.underscore || asciiAlphanumeric(code2)) {
- effects.consume(code2);
- return completeAttributeName;
- }
- return completeAttributeNameAfter(code2);
- }
- function completeAttributeNameAfter(code2) {
- if (code2 === codes.equalsTo) {
- effects.consume(code2);
- return completeAttributeValueBefore;
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return completeAttributeNameAfter;
- }
- return completeAttributeNameBefore(code2);
- }
- function completeAttributeValueBefore(code2) {
- if (code2 === codes.eof || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.greaterThan || code2 === codes.graveAccent) {
- return nok(code2);
- }
- if (code2 === codes.quotationMark || code2 === codes.apostrophe) {
- effects.consume(code2);
- markerB = code2;
- return completeAttributeValueQuoted;
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return completeAttributeValueBefore;
- }
- return completeAttributeValueUnquoted(code2);
- }
- function completeAttributeValueQuoted(code2) {
- if (code2 === markerB) {
- effects.consume(code2);
- markerB = null;
- return completeAttributeValueQuotedAfter;
- }
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- return nok(code2);
- }
- effects.consume(code2);
- return completeAttributeValueQuoted;
- }
- function completeAttributeValueUnquoted(code2) {
- if (code2 === codes.eof || code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.slash || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.greaterThan || code2 === codes.graveAccent || markdownLineEndingOrSpace(code2)) {
- return completeAttributeNameAfter(code2);
- }
- effects.consume(code2);
- return completeAttributeValueUnquoted;
- }
- function completeAttributeValueQuotedAfter(code2) {
- if (code2 === codes.slash || code2 === codes.greaterThan || markdownSpace(code2)) {
- return completeAttributeNameBefore(code2);
- }
- return nok(code2);
- }
- function completeEnd(code2) {
- if (code2 === codes.greaterThan) {
- effects.consume(code2);
- return completeAfter;
- }
- return nok(code2);
- }
- function completeAfter(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- return continuation(code2);
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return completeAfter;
- }
- return nok(code2);
- }
- function continuation(code2) {
- if (code2 === codes.dash && marker === constants.htmlComment) {
- effects.consume(code2);
- return continuationCommentInside;
- }
- if (code2 === codes.lessThan && marker === constants.htmlRaw) {
- effects.consume(code2);
- return continuationRawTagOpen;
- }
- if (code2 === codes.greaterThan && marker === constants.htmlDeclaration) {
- effects.consume(code2);
- return continuationClose;
- }
- if (code2 === codes.questionMark && marker === constants.htmlInstruction) {
- effects.consume(code2);
- return continuationDeclarationInside;
- }
- if (code2 === codes.rightSquareBracket && marker === constants.htmlCdata) {
- effects.consume(code2);
- return continuationCdataInside;
- }
- if (markdownLineEnding(code2) && (marker === constants.htmlBasic || marker === constants.htmlComplete)) {
- effects.exit(types.htmlFlowData);
- return effects.check(
- blankLineBefore,
- continuationAfter,
- continuationStart
- )(code2);
- }
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.htmlFlowData);
- return continuationStart(code2);
- }
- effects.consume(code2);
- return continuation;
- }
- function continuationStart(code2) {
- return effects.check(
- nonLazyContinuationStart,
- continuationStartNonLazy,
- continuationAfter
- )(code2);
- }
- function continuationStartNonLazy(code2) {
- ok(markdownLineEnding(code2));
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return continuationBefore;
- }
- function continuationBefore(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- return continuationStart(code2);
- }
- effects.enter(types.htmlFlowData);
- return continuation(code2);
- }
- function continuationCommentInside(code2) {
- if (code2 === codes.dash) {
- effects.consume(code2);
- return continuationDeclarationInside;
- }
- return continuation(code2);
- }
- function continuationRawTagOpen(code2) {
- if (code2 === codes.slash) {
- effects.consume(code2);
- buffer = "";
- return continuationRawEndTag;
- }
- return continuation(code2);
- }
- function continuationRawEndTag(code2) {
- if (code2 === codes.greaterThan) {
- const name2 = buffer.toLowerCase();
- if (htmlRawNames.includes(name2)) {
- effects.consume(code2);
- return continuationClose;
- }
- return continuation(code2);
- }
- if (asciiAlpha(code2) && buffer.length < constants.htmlRawSizeMax) {
- ok(code2 !== null);
- effects.consume(code2);
- buffer += String.fromCharCode(code2);
- return continuationRawEndTag;
- }
- return continuation(code2);
- }
- function continuationCdataInside(code2) {
- if (code2 === codes.rightSquareBracket) {
- effects.consume(code2);
- return continuationDeclarationInside;
- }
- return continuation(code2);
- }
- function continuationDeclarationInside(code2) {
- if (code2 === codes.greaterThan) {
- effects.consume(code2);
- return continuationClose;
- }
- if (code2 === codes.dash && marker === constants.htmlComment) {
- effects.consume(code2);
- return continuationDeclarationInside;
- }
- return continuation(code2);
- }
- function continuationClose(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.htmlFlowData);
- return continuationAfter(code2);
- }
- effects.consume(code2);
- return continuationClose;
- }
- function continuationAfter(code2) {
- effects.exit(types.htmlFlow);
- return ok2(code2);
- }
- }
- function tokenizeNonLazyContinuationStart(effects, ok2, nok) {
- const self2 = this;
- return start2;
- function start2(code2) {
- if (markdownLineEnding(code2)) {
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return after;
- }
- return nok(code2);
- }
- function after(code2) {
- return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
- }
- }
- function tokenizeBlankLineBefore(effects, ok2, nok) {
- return start2;
- function start2(code2) {
- ok(markdownLineEnding(code2), "expected a line ending");
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return effects.attempt(blankLine, ok2, nok);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/html-text.js
- var htmlText = { name: "htmlText", tokenize: tokenizeHtmlText };
- function tokenizeHtmlText(effects, ok2, nok) {
- const self2 = this;
- let marker;
- let index2;
- let returnState;
- return start2;
- function start2(code2) {
- ok(code2 === codes.lessThan, "expected `<`");
- effects.enter(types.htmlText);
- effects.enter(types.htmlTextData);
- effects.consume(code2);
- return open;
- }
- function open(code2) {
- if (code2 === codes.exclamationMark) {
- effects.consume(code2);
- return declarationOpen;
- }
- if (code2 === codes.slash) {
- effects.consume(code2);
- return tagCloseStart;
- }
- if (code2 === codes.questionMark) {
- effects.consume(code2);
- return instruction;
- }
- if (asciiAlpha(code2)) {
- effects.consume(code2);
- return tagOpen;
- }
- return nok(code2);
- }
- function declarationOpen(code2) {
- if (code2 === codes.dash) {
- effects.consume(code2);
- return commentOpenInside;
- }
- if (code2 === codes.leftSquareBracket) {
- effects.consume(code2);
- index2 = 0;
- return cdataOpenInside;
- }
- if (asciiAlpha(code2)) {
- effects.consume(code2);
- return declaration;
- }
- return nok(code2);
- }
- function commentOpenInside(code2) {
- if (code2 === codes.dash) {
- effects.consume(code2);
- return commentEnd;
- }
- return nok(code2);
- }
- function comment(code2) {
- if (code2 === codes.eof) {
- return nok(code2);
- }
- if (code2 === codes.dash) {
- effects.consume(code2);
- return commentClose;
- }
- if (markdownLineEnding(code2)) {
- returnState = comment;
- return lineEndingBefore(code2);
- }
- effects.consume(code2);
- return comment;
- }
- function commentClose(code2) {
- if (code2 === codes.dash) {
- effects.consume(code2);
- return commentEnd;
- }
- return comment(code2);
- }
- function commentEnd(code2) {
- return code2 === codes.greaterThan ? end(code2) : code2 === codes.dash ? commentClose(code2) : comment(code2);
- }
- function cdataOpenInside(code2) {
- const value = constants.cdataOpeningString;
- if (code2 === value.charCodeAt(index2++)) {
- effects.consume(code2);
- return index2 === value.length ? cdata : cdataOpenInside;
- }
- return nok(code2);
- }
- function cdata(code2) {
- if (code2 === codes.eof) {
- return nok(code2);
- }
- if (code2 === codes.rightSquareBracket) {
- effects.consume(code2);
- return cdataClose;
- }
- if (markdownLineEnding(code2)) {
- returnState = cdata;
- return lineEndingBefore(code2);
- }
- effects.consume(code2);
- return cdata;
- }
- function cdataClose(code2) {
- if (code2 === codes.rightSquareBracket) {
- effects.consume(code2);
- return cdataEnd;
- }
- return cdata(code2);
- }
- function cdataEnd(code2) {
- if (code2 === codes.greaterThan) {
- return end(code2);
- }
- if (code2 === codes.rightSquareBracket) {
- effects.consume(code2);
- return cdataEnd;
- }
- return cdata(code2);
- }
- function declaration(code2) {
- if (code2 === codes.eof || code2 === codes.greaterThan) {
- return end(code2);
- }
- if (markdownLineEnding(code2)) {
- returnState = declaration;
- return lineEndingBefore(code2);
- }
- effects.consume(code2);
- return declaration;
- }
- function instruction(code2) {
- if (code2 === codes.eof) {
- return nok(code2);
- }
- if (code2 === codes.questionMark) {
- effects.consume(code2);
- return instructionClose;
- }
- if (markdownLineEnding(code2)) {
- returnState = instruction;
- return lineEndingBefore(code2);
- }
- effects.consume(code2);
- return instruction;
- }
- function instructionClose(code2) {
- return code2 === codes.greaterThan ? end(code2) : instruction(code2);
- }
- function tagCloseStart(code2) {
- if (asciiAlpha(code2)) {
- effects.consume(code2);
- return tagClose;
- }
- return nok(code2);
- }
- function tagClose(code2) {
- if (code2 === codes.dash || asciiAlphanumeric(code2)) {
- effects.consume(code2);
- return tagClose;
- }
- return tagCloseBetween(code2);
- }
- function tagCloseBetween(code2) {
- if (markdownLineEnding(code2)) {
- returnState = tagCloseBetween;
- return lineEndingBefore(code2);
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return tagCloseBetween;
- }
- return end(code2);
- }
- function tagOpen(code2) {
- if (code2 === codes.dash || asciiAlphanumeric(code2)) {
- effects.consume(code2);
- return tagOpen;
- }
- if (code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
- return tagOpenBetween(code2);
- }
- return nok(code2);
- }
- function tagOpenBetween(code2) {
- if (code2 === codes.slash) {
- effects.consume(code2);
- return end;
- }
- if (code2 === codes.colon || code2 === codes.underscore || asciiAlpha(code2)) {
- effects.consume(code2);
- return tagOpenAttributeName;
- }
- if (markdownLineEnding(code2)) {
- returnState = tagOpenBetween;
- return lineEndingBefore(code2);
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return tagOpenBetween;
- }
- return end(code2);
- }
- function tagOpenAttributeName(code2) {
- if (code2 === codes.dash || code2 === codes.dot || code2 === codes.colon || code2 === codes.underscore || asciiAlphanumeric(code2)) {
- effects.consume(code2);
- return tagOpenAttributeName;
- }
- return tagOpenAttributeNameAfter(code2);
- }
- function tagOpenAttributeNameAfter(code2) {
- if (code2 === codes.equalsTo) {
- effects.consume(code2);
- return tagOpenAttributeValueBefore;
- }
- if (markdownLineEnding(code2)) {
- returnState = tagOpenAttributeNameAfter;
- return lineEndingBefore(code2);
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return tagOpenAttributeNameAfter;
- }
- return tagOpenBetween(code2);
- }
- function tagOpenAttributeValueBefore(code2) {
- if (code2 === codes.eof || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.greaterThan || code2 === codes.graveAccent) {
- return nok(code2);
- }
- if (code2 === codes.quotationMark || code2 === codes.apostrophe) {
- effects.consume(code2);
- marker = code2;
- return tagOpenAttributeValueQuoted;
- }
- if (markdownLineEnding(code2)) {
- returnState = tagOpenAttributeValueBefore;
- return lineEndingBefore(code2);
- }
- if (markdownSpace(code2)) {
- effects.consume(code2);
- return tagOpenAttributeValueBefore;
- }
- effects.consume(code2);
- return tagOpenAttributeValueUnquoted;
- }
- function tagOpenAttributeValueQuoted(code2) {
- if (code2 === marker) {
- effects.consume(code2);
- marker = void 0;
- return tagOpenAttributeValueQuotedAfter;
- }
- if (code2 === codes.eof) {
- return nok(code2);
- }
- if (markdownLineEnding(code2)) {
- returnState = tagOpenAttributeValueQuoted;
- return lineEndingBefore(code2);
- }
- effects.consume(code2);
- return tagOpenAttributeValueQuoted;
- }
- function tagOpenAttributeValueUnquoted(code2) {
- if (code2 === codes.eof || code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.graveAccent) {
- return nok(code2);
- }
- if (code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
- return tagOpenBetween(code2);
- }
- effects.consume(code2);
- return tagOpenAttributeValueUnquoted;
- }
- function tagOpenAttributeValueQuotedAfter(code2) {
- if (code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
- return tagOpenBetween(code2);
- }
- return nok(code2);
- }
- function end(code2) {
- if (code2 === codes.greaterThan) {
- effects.consume(code2);
- effects.exit(types.htmlTextData);
- effects.exit(types.htmlText);
- return ok2;
- }
- return nok(code2);
- }
- function lineEndingBefore(code2) {
- ok(returnState, "expected return state");
- ok(markdownLineEnding(code2), "expected eol");
- effects.exit(types.htmlTextData);
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return lineEndingAfter;
- }
- function lineEndingAfter(code2) {
- ok(
- self2.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- return markdownSpace(code2) ? factorySpace(
- effects,
- lineEndingAfterPrefix,
- types.linePrefix,
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
- )(code2) : lineEndingAfterPrefix(code2);
- }
- function lineEndingAfterPrefix(code2) {
- effects.enter(types.htmlTextData);
- return returnState(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/label-end.js
- var labelEnd = {
- name: "labelEnd",
- resolveAll: resolveAllLabelEnd,
- resolveTo: resolveToLabelEnd,
- tokenize: tokenizeLabelEnd
- };
- var resourceConstruct = { tokenize: tokenizeResource };
- var referenceFullConstruct = { tokenize: tokenizeReferenceFull };
- var referenceCollapsedConstruct = { tokenize: tokenizeReferenceCollapsed };
- function resolveAllLabelEnd(events) {
- let index2 = -1;
- const newEvents = [];
- while (++index2 < events.length) {
- const token = events[index2][1];
- newEvents.push(events[index2]);
- if (token.type === types.labelImage || token.type === types.labelLink || token.type === types.labelEnd) {
- const offset = token.type === types.labelImage ? 4 : 2;
- token.type = types.data;
- index2 += offset;
- }
- }
- if (events.length !== newEvents.length) {
- splice(events, 0, events.length, newEvents);
- }
- return events;
- }
- function resolveToLabelEnd(events, context) {
- let index2 = events.length;
- let offset = 0;
- let token;
- let open;
- let close;
- let media;
- while (index2--) {
- token = events[index2][1];
- if (open) {
- if (token.type === types.link || token.type === types.labelLink && token._inactive) {
- break;
- }
- if (events[index2][0] === "enter" && token.type === types.labelLink) {
- token._inactive = true;
- }
- } else if (close) {
- if (events[index2][0] === "enter" && (token.type === types.labelImage || token.type === types.labelLink) && !token._balanced) {
- open = index2;
- if (token.type !== types.labelLink) {
- offset = 2;
- break;
- }
- }
- } else if (token.type === types.labelEnd) {
- close = index2;
- }
- }
- ok(open !== void 0, "`open` is supposed to be found");
- ok(close !== void 0, "`close` is supposed to be found");
- const group = {
- type: events[open][1].type === types.labelLink ? types.link : types.image,
- start: { ...events[open][1].start },
- end: { ...events[events.length - 1][1].end }
- };
- const label = {
- type: types.label,
- start: { ...events[open][1].start },
- end: { ...events[close][1].end }
- };
- const text5 = {
- type: types.labelText,
- start: { ...events[open + offset + 2][1].end },
- end: { ...events[close - 2][1].start }
- };
- media = [
- ["enter", group, context],
- ["enter", label, context]
- ];
- media = push(media, events.slice(open + 1, open + offset + 3));
- media = push(media, [["enter", text5, context]]);
- ok(
- context.parser.constructs.insideSpan.null,
- "expected `insideSpan.null` to be populated"
- );
- media = push(
- media,
- resolveAll(
- context.parser.constructs.insideSpan.null,
- events.slice(open + offset + 4, close - 3),
- context
- )
- );
- media = push(media, [
- ["exit", text5, context],
- events[close - 2],
- events[close - 1],
- ["exit", label, context]
- ]);
- media = push(media, events.slice(close + 1));
- media = push(media, [["exit", group, context]]);
- splice(events, open, events.length, media);
- return events;
- }
- function tokenizeLabelEnd(effects, ok2, nok) {
- const self2 = this;
- let index2 = self2.events.length;
- let labelStart;
- let defined;
- while (index2--) {
- if ((self2.events[index2][1].type === types.labelImage || self2.events[index2][1].type === types.labelLink) && !self2.events[index2][1]._balanced) {
- labelStart = self2.events[index2][1];
- break;
- }
- }
- return start2;
- function start2(code2) {
- ok(code2 === codes.rightSquareBracket, "expected `]`");
- if (!labelStart) {
- return nok(code2);
- }
- if (labelStart._inactive) {
- return labelEndNok(code2);
- }
- defined = self2.parser.defined.includes(
- normalizeIdentifier(
- self2.sliceSerialize({ start: labelStart.end, end: self2.now() })
- )
- );
- effects.enter(types.labelEnd);
- effects.enter(types.labelMarker);
- effects.consume(code2);
- effects.exit(types.labelMarker);
- effects.exit(types.labelEnd);
- return after;
- }
- function after(code2) {
- if (code2 === codes.leftParenthesis) {
- return effects.attempt(
- resourceConstruct,
- labelEndOk,
- defined ? labelEndOk : labelEndNok
- )(code2);
- }
- if (code2 === codes.leftSquareBracket) {
- return effects.attempt(
- referenceFullConstruct,
- labelEndOk,
- defined ? referenceNotFull : labelEndNok
- )(code2);
- }
- return defined ? labelEndOk(code2) : labelEndNok(code2);
- }
- function referenceNotFull(code2) {
- return effects.attempt(
- referenceCollapsedConstruct,
- labelEndOk,
- labelEndNok
- )(code2);
- }
- function labelEndOk(code2) {
- return ok2(code2);
- }
- function labelEndNok(code2) {
- labelStart._balanced = true;
- return nok(code2);
- }
- }
- function tokenizeResource(effects, ok2, nok) {
- return resourceStart;
- function resourceStart(code2) {
- ok(code2 === codes.leftParenthesis, "expected left paren");
- effects.enter(types.resource);
- effects.enter(types.resourceMarker);
- effects.consume(code2);
- effects.exit(types.resourceMarker);
- return resourceBefore;
- }
- function resourceBefore(code2) {
- return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceOpen)(code2) : resourceOpen(code2);
- }
- function resourceOpen(code2) {
- if (code2 === codes.rightParenthesis) {
- return resourceEnd(code2);
- }
- return factoryDestination(
- effects,
- resourceDestinationAfter,
- resourceDestinationMissing,
- types.resourceDestination,
- types.resourceDestinationLiteral,
- types.resourceDestinationLiteralMarker,
- types.resourceDestinationRaw,
- types.resourceDestinationString,
- constants.linkResourceDestinationBalanceMax
- )(code2);
- }
- function resourceDestinationAfter(code2) {
- return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceBetween)(code2) : resourceEnd(code2);
- }
- function resourceDestinationMissing(code2) {
- return nok(code2);
- }
- function resourceBetween(code2) {
- if (code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.leftParenthesis) {
- return factoryTitle(
- effects,
- resourceTitleAfter,
- nok,
- types.resourceTitle,
- types.resourceTitleMarker,
- types.resourceTitleString
- )(code2);
- }
- return resourceEnd(code2);
- }
- function resourceTitleAfter(code2) {
- return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceEnd)(code2) : resourceEnd(code2);
- }
- function resourceEnd(code2) {
- if (code2 === codes.rightParenthesis) {
- effects.enter(types.resourceMarker);
- effects.consume(code2);
- effects.exit(types.resourceMarker);
- effects.exit(types.resource);
- return ok2;
- }
- return nok(code2);
- }
- }
- function tokenizeReferenceFull(effects, ok2, nok) {
- const self2 = this;
- return referenceFull;
- function referenceFull(code2) {
- ok(code2 === codes.leftSquareBracket, "expected left bracket");
- return factoryLabel.call(
- self2,
- effects,
- referenceFullAfter,
- referenceFullMissing,
- types.reference,
- types.referenceMarker,
- types.referenceString
- )(code2);
- }
- function referenceFullAfter(code2) {
- return self2.parser.defined.includes(
- normalizeIdentifier(
- self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)
- )
- ) ? ok2(code2) : nok(code2);
- }
- function referenceFullMissing(code2) {
- return nok(code2);
- }
- }
- function tokenizeReferenceCollapsed(effects, ok2, nok) {
- return referenceCollapsedStart;
- function referenceCollapsedStart(code2) {
- ok(code2 === codes.leftSquareBracket, "expected left bracket");
- effects.enter(types.reference);
- effects.enter(types.referenceMarker);
- effects.consume(code2);
- effects.exit(types.referenceMarker);
- return referenceCollapsedOpen;
- }
- function referenceCollapsedOpen(code2) {
- if (code2 === codes.rightSquareBracket) {
- effects.enter(types.referenceMarker);
- effects.consume(code2);
- effects.exit(types.referenceMarker);
- effects.exit(types.reference);
- return ok2;
- }
- return nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
- var labelStartImage = {
- name: "labelStartImage",
- resolveAll: labelEnd.resolveAll,
- tokenize: tokenizeLabelStartImage
- };
- function tokenizeLabelStartImage(effects, ok2, nok) {
- const self2 = this;
- return start2;
- function start2(code2) {
- ok(code2 === codes.exclamationMark, "expected `!`");
- effects.enter(types.labelImage);
- effects.enter(types.labelImageMarker);
- effects.consume(code2);
- effects.exit(types.labelImageMarker);
- return open;
- }
- function open(code2) {
- if (code2 === codes.leftSquareBracket) {
- effects.enter(types.labelMarker);
- effects.consume(code2);
- effects.exit(types.labelMarker);
- effects.exit(types.labelImage);
- return after;
- }
- return nok(code2);
- }
- function after(code2) {
- return code2 === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
- var labelStartLink = {
- name: "labelStartLink",
- resolveAll: labelEnd.resolveAll,
- tokenize: tokenizeLabelStartLink
- };
- function tokenizeLabelStartLink(effects, ok2, nok) {
- const self2 = this;
- return start2;
- function start2(code2) {
- ok(code2 === codes.leftSquareBracket, "expected `[`");
- effects.enter(types.labelLink);
- effects.enter(types.labelMarker);
- effects.consume(code2);
- effects.exit(types.labelMarker);
- effects.exit(types.labelLink);
- return after;
- }
- function after(code2) {
- return code2 === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/line-ending.js
- var lineEnding = { name: "lineEnding", tokenize: tokenizeLineEnding };
- function tokenizeLineEnding(effects, ok2) {
- return start2;
- function start2(code2) {
- ok(markdownLineEnding(code2), "expected eol");
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- return factorySpace(effects, ok2, types.linePrefix);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/thematic-break.js
- var thematicBreak = {
- name: "thematicBreak",
- tokenize: tokenizeThematicBreak
- };
- function tokenizeThematicBreak(effects, ok2, nok) {
- let size = 0;
- let marker;
- return start2;
- function start2(code2) {
- effects.enter(types.thematicBreak);
- return before(code2);
- }
- function before(code2) {
- ok(
- code2 === codes.asterisk || code2 === codes.dash || code2 === codes.underscore,
- "expected `*`, `-`, or `_`"
- );
- marker = code2;
- return atBreak(code2);
- }
- function atBreak(code2) {
- if (code2 === marker) {
- effects.enter(types.thematicBreakSequence);
- return sequence(code2);
- }
- if (size >= constants.thematicBreakMarkerCountMin && (code2 === codes.eof || markdownLineEnding(code2))) {
- effects.exit(types.thematicBreak);
- return ok2(code2);
- }
- return nok(code2);
- }
- function sequence(code2) {
- if (code2 === marker) {
- effects.consume(code2);
- size++;
- return sequence;
- }
- effects.exit(types.thematicBreakSequence);
- return markdownSpace(code2) ? factorySpace(effects, atBreak, types.whitespace)(code2) : atBreak(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/list.js
- var list = {
- continuation: { tokenize: tokenizeListContinuation },
- exit: tokenizeListEnd,
- name: "list",
- tokenize: tokenizeListStart
- };
- var listItemPrefixWhitespaceConstruct = {
- partial: true,
- tokenize: tokenizeListItemPrefixWhitespace
- };
- var indentConstruct = { partial: true, tokenize: tokenizeIndent };
- function tokenizeListStart(effects, ok2, nok) {
- const self2 = this;
- const tail = self2.events[self2.events.length - 1];
- let initialSize = tail && tail[1].type === types.linePrefix ? tail[2].sliceSerialize(tail[1], true).length : 0;
- let size = 0;
- return start2;
- function start2(code2) {
- ok(self2.containerState, "expected state");
- const kind = self2.containerState.type || (code2 === codes.asterisk || code2 === codes.plusSign || code2 === codes.dash ? types.listUnordered : types.listOrdered);
- if (kind === types.listUnordered ? !self2.containerState.marker || code2 === self2.containerState.marker : asciiDigit(code2)) {
- if (!self2.containerState.type) {
- self2.containerState.type = kind;
- effects.enter(kind, { _container: true });
- }
- if (kind === types.listUnordered) {
- effects.enter(types.listItemPrefix);
- return code2 === codes.asterisk || code2 === codes.dash ? effects.check(thematicBreak, nok, atMarker)(code2) : atMarker(code2);
- }
- if (!self2.interrupt || code2 === codes.digit1) {
- effects.enter(types.listItemPrefix);
- effects.enter(types.listItemValue);
- return inside(code2);
- }
- }
- return nok(code2);
- }
- function inside(code2) {
- ok(self2.containerState, "expected state");
- if (asciiDigit(code2) && ++size < constants.listItemValueSizeMax) {
- effects.consume(code2);
- return inside;
- }
- if ((!self2.interrupt || size < 2) && (self2.containerState.marker ? code2 === self2.containerState.marker : code2 === codes.rightParenthesis || code2 === codes.dot)) {
- effects.exit(types.listItemValue);
- return atMarker(code2);
- }
- return nok(code2);
- }
- function atMarker(code2) {
- ok(self2.containerState, "expected state");
- ok(code2 !== codes.eof, "eof (`null`) is not a marker");
- effects.enter(types.listItemMarker);
- effects.consume(code2);
- effects.exit(types.listItemMarker);
- self2.containerState.marker = self2.containerState.marker || code2;
- return effects.check(
- blankLine,
- // Can’t be empty when interrupting.
- self2.interrupt ? nok : onBlank,
- effects.attempt(
- listItemPrefixWhitespaceConstruct,
- endOfPrefix,
- otherPrefix
- )
- );
- }
- function onBlank(code2) {
- ok(self2.containerState, "expected state");
- self2.containerState.initialBlankLine = true;
- initialSize++;
- return endOfPrefix(code2);
- }
- function otherPrefix(code2) {
- if (markdownSpace(code2)) {
- effects.enter(types.listItemPrefixWhitespace);
- effects.consume(code2);
- effects.exit(types.listItemPrefixWhitespace);
- return endOfPrefix;
- }
- return nok(code2);
- }
- function endOfPrefix(code2) {
- ok(self2.containerState, "expected state");
- self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit(types.listItemPrefix), true).length;
- return ok2(code2);
- }
- }
- function tokenizeListContinuation(effects, ok2, nok) {
- const self2 = this;
- ok(self2.containerState, "expected state");
- self2.containerState._closeFlow = void 0;
- return effects.check(blankLine, onBlank, notBlank);
- function onBlank(code2) {
- ok(self2.containerState, "expected state");
- ok(typeof self2.containerState.size === "number", "expected size");
- self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine;
- return factorySpace(
- effects,
- ok2,
- types.listItemIndent,
- self2.containerState.size + 1
- )(code2);
- }
- function notBlank(code2) {
- ok(self2.containerState, "expected state");
- if (self2.containerState.furtherBlankLines || !markdownSpace(code2)) {
- self2.containerState.furtherBlankLines = void 0;
- self2.containerState.initialBlankLine = void 0;
- return notInCurrentItem(code2);
- }
- self2.containerState.furtherBlankLines = void 0;
- self2.containerState.initialBlankLine = void 0;
- return effects.attempt(indentConstruct, ok2, notInCurrentItem)(code2);
- }
- function notInCurrentItem(code2) {
- ok(self2.containerState, "expected state");
- self2.containerState._closeFlow = true;
- self2.interrupt = void 0;
- ok(
- self2.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- return factorySpace(
- effects,
- effects.attempt(list, ok2, nok),
- types.linePrefix,
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
- )(code2);
- }
- }
- function tokenizeIndent(effects, ok2, nok) {
- const self2 = this;
- ok(self2.containerState, "expected state");
- ok(typeof self2.containerState.size === "number", "expected size");
- return factorySpace(
- effects,
- afterPrefix,
- types.listItemIndent,
- self2.containerState.size + 1
- );
- function afterPrefix(code2) {
- ok(self2.containerState, "expected state");
- const tail = self2.events[self2.events.length - 1];
- return tail && tail[1].type === types.listItemIndent && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code2) : nok(code2);
- }
- }
- function tokenizeListEnd(effects) {
- ok(this.containerState, "expected state");
- ok(typeof this.containerState.type === "string", "expected type");
- effects.exit(this.containerState.type);
- }
- function tokenizeListItemPrefixWhitespace(effects, ok2, nok) {
- const self2 = this;
- ok(
- self2.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- return factorySpace(
- effects,
- afterPrefix,
- types.listItemPrefixWhitespace,
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize + 1
- );
- function afterPrefix(code2) {
- const tail = self2.events[self2.events.length - 1];
- return !markdownSpace(code2) && tail && tail[1].type === types.listItemPrefixWhitespace ? ok2(code2) : nok(code2);
- }
- }
- // node_modules/micromark-core-commonmark/dev/lib/setext-underline.js
- var setextUnderline = {
- name: "setextUnderline",
- resolveTo: resolveToSetextUnderline,
- tokenize: tokenizeSetextUnderline
- };
- function resolveToSetextUnderline(events, context) {
- let index2 = events.length;
- let content3;
- let text5;
- let definition2;
- while (index2--) {
- if (events[index2][0] === "enter") {
- if (events[index2][1].type === types.content) {
- content3 = index2;
- break;
- }
- if (events[index2][1].type === types.paragraph) {
- text5 = index2;
- }
- } else {
- if (events[index2][1].type === types.content) {
- events.splice(index2, 1);
- }
- if (!definition2 && events[index2][1].type === types.definition) {
- definition2 = index2;
- }
- }
- }
- ok(text5 !== void 0, "expected a `text` index to be found");
- ok(content3 !== void 0, "expected a `text` index to be found");
- ok(events[content3][2] === context, "enter context should be same");
- ok(
- events[events.length - 1][2] === context,
- "enter context should be same"
- );
- const heading2 = {
- type: types.setextHeading,
- start: { ...events[content3][1].start },
- end: { ...events[events.length - 1][1].end }
- };
- events[text5][1].type = types.setextHeadingText;
- if (definition2) {
- events.splice(text5, 0, ["enter", heading2, context]);
- events.splice(definition2 + 1, 0, ["exit", events[content3][1], context]);
- events[content3][1].end = { ...events[definition2][1].end };
- } else {
- events[content3][1] = heading2;
- }
- events.push(["exit", heading2, context]);
- return events;
- }
- function tokenizeSetextUnderline(effects, ok2, nok) {
- const self2 = this;
- let marker;
- return start2;
- function start2(code2) {
- let index2 = self2.events.length;
- let paragraph2;
- ok(
- code2 === codes.dash || code2 === codes.equalsTo,
- "expected `=` or `-`"
- );
- while (index2--) {
- if (self2.events[index2][1].type !== types.lineEnding && self2.events[index2][1].type !== types.linePrefix && self2.events[index2][1].type !== types.content) {
- paragraph2 = self2.events[index2][1].type === types.paragraph;
- break;
- }
- }
- if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) {
- effects.enter(types.setextHeadingLine);
- marker = code2;
- return before(code2);
- }
- return nok(code2);
- }
- function before(code2) {
- effects.enter(types.setextHeadingLineSequence);
- return inside(code2);
- }
- function inside(code2) {
- if (code2 === marker) {
- effects.consume(code2);
- return inside;
- }
- effects.exit(types.setextHeadingLineSequence);
- return markdownSpace(code2) ? factorySpace(effects, after, types.lineSuffix)(code2) : after(code2);
- }
- function after(code2) {
- if (code2 === codes.eof || markdownLineEnding(code2)) {
- effects.exit(types.setextHeadingLine);
- return ok2(code2);
- }
- return nok(code2);
- }
- }
- // node_modules/micromark/dev/lib/initialize/flow.js
- var flow = { tokenize: initializeFlow };
- function initializeFlow(effects) {
- const self2 = this;
- const initial = effects.attempt(
- // Try to parse a blank line.
- blankLine,
- atBlankEnding,
- // Try to parse initial flow (essentially, only code).
- effects.attempt(
- this.parser.constructs.flowInitial,
- afterConstruct,
- factorySpace(
- effects,
- effects.attempt(
- this.parser.constructs.flow,
- afterConstruct,
- effects.attempt(content2, afterConstruct)
- ),
- types.linePrefix
- )
- )
- );
- return initial;
- function atBlankEnding(code2) {
- ok(
- code2 === codes.eof || markdownLineEnding(code2),
- "expected eol or eof"
- );
- if (code2 === codes.eof) {
- effects.consume(code2);
- return;
- }
- effects.enter(types.lineEndingBlank);
- effects.consume(code2);
- effects.exit(types.lineEndingBlank);
- self2.currentConstruct = void 0;
- return initial;
- }
- function afterConstruct(code2) {
- ok(
- code2 === codes.eof || markdownLineEnding(code2),
- "expected eol or eof"
- );
- if (code2 === codes.eof) {
- effects.consume(code2);
- return;
- }
- effects.enter(types.lineEnding);
- effects.consume(code2);
- effects.exit(types.lineEnding);
- self2.currentConstruct = void 0;
- return initial;
- }
- }
- // node_modules/micromark/dev/lib/initialize/text.js
- var resolver = { resolveAll: createResolver() };
- var string = initializeFactory("string");
- var text2 = initializeFactory("text");
- function initializeFactory(field) {
- return {
- resolveAll: createResolver(
- field === "text" ? resolveAllLineSuffixes : void 0
- ),
- tokenize: initializeText
- };
- function initializeText(effects) {
- const self2 = this;
- const constructs2 = this.parser.constructs[field];
- const text5 = effects.attempt(constructs2, start2, notText);
- return start2;
- function start2(code2) {
- return atBreak(code2) ? text5(code2) : notText(code2);
- }
- function notText(code2) {
- if (code2 === codes.eof) {
- effects.consume(code2);
- return;
- }
- effects.enter(types.data);
- effects.consume(code2);
- return data;
- }
- function data(code2) {
- if (atBreak(code2)) {
- effects.exit(types.data);
- return text5(code2);
- }
- effects.consume(code2);
- return data;
- }
- function atBreak(code2) {
- if (code2 === codes.eof) {
- return true;
- }
- const list3 = constructs2[code2];
- let index2 = -1;
- if (list3) {
- ok(Array.isArray(list3), "expected `disable.null` to be populated");
- while (++index2 < list3.length) {
- const item = list3[index2];
- if (!item.previous || item.previous.call(self2, self2.previous)) {
- return true;
- }
- }
- }
- return false;
- }
- }
- }
- function createResolver(extraResolver) {
- return resolveAllText;
- function resolveAllText(events, context) {
- let index2 = -1;
- let enter;
- while (++index2 <= events.length) {
- if (enter === void 0) {
- if (events[index2] && events[index2][1].type === types.data) {
- enter = index2;
- index2++;
- }
- } else if (!events[index2] || events[index2][1].type !== types.data) {
- if (index2 !== enter + 2) {
- events[enter][1].end = events[index2 - 1][1].end;
- events.splice(enter + 2, index2 - enter - 2);
- index2 = enter + 2;
- }
- enter = void 0;
- }
- }
- return extraResolver ? extraResolver(events, context) : events;
- }
- }
- function resolveAllLineSuffixes(events, context) {
- let eventIndex = 0;
- while (++eventIndex <= events.length) {
- if ((eventIndex === events.length || events[eventIndex][1].type === types.lineEnding) && events[eventIndex - 1][1].type === types.data) {
- const data = events[eventIndex - 1][1];
- const chunks = context.sliceStream(data);
- let index2 = chunks.length;
- let bufferIndex = -1;
- let size = 0;
- let tabs;
- while (index2--) {
- const chunk = chunks[index2];
- if (typeof chunk === "string") {
- bufferIndex = chunk.length;
- while (chunk.charCodeAt(bufferIndex - 1) === codes.space) {
- size++;
- bufferIndex--;
- }
- if (bufferIndex) break;
- bufferIndex = -1;
- } else if (chunk === codes.horizontalTab) {
- tabs = true;
- size++;
- } else if (chunk === codes.virtualSpace) {
- } else {
- index2++;
- break;
- }
- }
- if (context._contentTypeTextTrailing && eventIndex === events.length) {
- size = 0;
- }
- if (size) {
- const token = {
- type: eventIndex === events.length || tabs || size < constants.hardBreakPrefixSizeMin ? types.lineSuffix : types.hardBreakTrailing,
- start: {
- _bufferIndex: index2 ? bufferIndex : data.start._bufferIndex + bufferIndex,
- _index: data.start._index + index2,
- line: data.end.line,
- column: data.end.column - size,
- offset: data.end.offset - size
- },
- end: { ...data.end }
- };
- data.end = { ...token.start };
- if (data.start.offset === data.end.offset) {
- Object.assign(data, token);
- } else {
- events.splice(
- eventIndex,
- 0,
- ["enter", token, context],
- ["exit", token, context]
- );
- eventIndex += 2;
- }
- }
- eventIndex++;
- }
- }
- return events;
- }
- // node_modules/micromark/dev/lib/constructs.js
- var constructs_exports = {};
- __export(constructs_exports, {
- attentionMarkers: () => attentionMarkers,
- contentInitial: () => contentInitial,
- disable: () => disable,
- document: () => document3,
- flow: () => flow2,
- flowInitial: () => flowInitial,
- insideSpan: () => insideSpan,
- string: () => string2,
- text: () => text3
- });
- var document3 = {
- [codes.asterisk]: list,
- [codes.plusSign]: list,
- [codes.dash]: list,
- [codes.digit0]: list,
- [codes.digit1]: list,
- [codes.digit2]: list,
- [codes.digit3]: list,
- [codes.digit4]: list,
- [codes.digit5]: list,
- [codes.digit6]: list,
- [codes.digit7]: list,
- [codes.digit8]: list,
- [codes.digit9]: list,
- [codes.greaterThan]: blockQuote
- };
- var contentInitial = {
- [codes.leftSquareBracket]: definition
- };
- var flowInitial = {
- [codes.horizontalTab]: codeIndented,
- [codes.virtualSpace]: codeIndented,
- [codes.space]: codeIndented
- };
- var flow2 = {
- [codes.numberSign]: headingAtx,
- [codes.asterisk]: thematicBreak,
- [codes.dash]: [setextUnderline, thematicBreak],
- [codes.lessThan]: htmlFlow,
- [codes.equalsTo]: setextUnderline,
- [codes.underscore]: thematicBreak,
- [codes.graveAccent]: codeFenced,
- [codes.tilde]: codeFenced
- };
- var string2 = {
- [codes.ampersand]: characterReference,
- [codes.backslash]: characterEscape
- };
- var text3 = {
- [codes.carriageReturn]: lineEnding,
- [codes.lineFeed]: lineEnding,
- [codes.carriageReturnLineFeed]: lineEnding,
- [codes.exclamationMark]: labelStartImage,
- [codes.ampersand]: characterReference,
- [codes.asterisk]: attention,
- [codes.lessThan]: [autolink, htmlText],
- [codes.leftSquareBracket]: labelStartLink,
- [codes.backslash]: [hardBreakEscape, characterEscape],
- [codes.rightSquareBracket]: labelEnd,
- [codes.underscore]: attention,
- [codes.graveAccent]: codeText
- };
- var insideSpan = { null: [attention, resolver] };
- var attentionMarkers = { null: [codes.asterisk, codes.underscore] };
- var disable = { null: [] };
- // node_modules/micromark/dev/lib/create-tokenizer.js
- var import_debug = __toESM(require_browser(), 1);
- var debug = (0, import_debug.default)("micromark");
- function createTokenizer(parser, initialize, from) {
- let point4 = {
- _bufferIndex: -1,
- _index: 0,
- line: from && from.line || 1,
- column: from && from.column || 1,
- offset: from && from.offset || 0
- };
- const columnStart = {};
- const resolveAllConstructs = [];
- let chunks = [];
- let stack = [];
- let consumed = true;
- const effects = {
- attempt: constructFactory(onsuccessfulconstruct),
- check: constructFactory(onsuccessfulcheck),
- consume,
- enter,
- exit: exit2,
- interrupt: constructFactory(onsuccessfulcheck, { interrupt: true })
- };
- const context = {
- code: codes.eof,
- containerState: {},
- defineSkip,
- events: [],
- now,
- parser,
- previous: codes.eof,
- sliceSerialize,
- sliceStream,
- write
- };
- let state = initialize.tokenize.call(context, effects);
- let expectedCode;
- if (initialize.resolveAll) {
- resolveAllConstructs.push(initialize);
- }
- return context;
- function write(slice) {
- chunks = push(chunks, slice);
- main();
- if (chunks[chunks.length - 1] !== codes.eof) {
- return [];
- }
- addResult(initialize, 0);
- context.events = resolveAll(resolveAllConstructs, context.events, context);
- return context.events;
- }
- function sliceSerialize(token, expandTabs) {
- return serializeChunks(sliceStream(token), expandTabs);
- }
- function sliceStream(token) {
- return sliceChunks(chunks, token);
- }
- function now() {
- const { _bufferIndex, _index, line, column, offset } = point4;
- return { _bufferIndex, _index, line, column, offset };
- }
- function defineSkip(value) {
- columnStart[value.line] = value.column;
- accountForPotentialSkip();
- debug("position: define skip: `%j`", point4);
- }
- function main() {
- let chunkIndex;
- while (point4._index < chunks.length) {
- const chunk = chunks[point4._index];
- if (typeof chunk === "string") {
- chunkIndex = point4._index;
- if (point4._bufferIndex < 0) {
- point4._bufferIndex = 0;
- }
- while (point4._index === chunkIndex && point4._bufferIndex < chunk.length) {
- go(chunk.charCodeAt(point4._bufferIndex));
- }
- } else {
- go(chunk);
- }
- }
- }
- function go(code2) {
- ok(consumed === true, "expected character to be consumed");
- consumed = void 0;
- debug("main: passing `%s` to %s", code2, state && state.name);
- expectedCode = code2;
- ok(typeof state === "function", "expected state");
- state = state(code2);
- }
- function consume(code2) {
- ok(code2 === expectedCode, "expected given code to equal expected code");
- debug("consume: `%s`", code2);
- ok(
- consumed === void 0,
- "expected code to not have been consumed: this might be because `return x(code)` instead of `return x` was used"
- );
- ok(
- code2 === null ? context.events.length === 0 || context.events[context.events.length - 1][0] === "exit" : context.events[context.events.length - 1][0] === "enter",
- "expected last token to be open"
- );
- if (markdownLineEnding(code2)) {
- point4.line++;
- point4.column = 1;
- point4.offset += code2 === codes.carriageReturnLineFeed ? 2 : 1;
- accountForPotentialSkip();
- debug("position: after eol: `%j`", point4);
- } else if (code2 !== codes.virtualSpace) {
- point4.column++;
- point4.offset++;
- }
- if (point4._bufferIndex < 0) {
- point4._index++;
- } else {
- point4._bufferIndex++;
- if (point4._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
- // strings.
- /** @type {string} */
- chunks[point4._index].length) {
- point4._bufferIndex = -1;
- point4._index++;
- }
- }
- context.previous = code2;
- consumed = true;
- }
- function enter(type, fields) {
- const token = fields || {};
- token.type = type;
- token.start = now();
- ok(typeof type === "string", "expected string type");
- ok(type.length > 0, "expected non-empty string");
- debug("enter: `%s`", type);
- context.events.push(["enter", token, context]);
- stack.push(token);
- return token;
- }
- function exit2(type) {
- ok(typeof type === "string", "expected string type");
- ok(type.length > 0, "expected non-empty string");
- const token = stack.pop();
- ok(token, "cannot close w/o open tokens");
- token.end = now();
- ok(type === token.type, "expected exit token to match current token");
- ok(
- !(token.start._index === token.end._index && token.start._bufferIndex === token.end._bufferIndex),
- "expected non-empty token (`" + type + "`)"
- );
- debug("exit: `%s`", token.type);
- context.events.push(["exit", token, context]);
- return token;
- }
- function onsuccessfulconstruct(construct, info) {
- addResult(construct, info.from);
- }
- function onsuccessfulcheck(_, info) {
- info.restore();
- }
- function constructFactory(onreturn, fields) {
- return hook;
- function hook(constructs2, returnState, bogusState) {
- let listOfConstructs;
- let constructIndex;
- let currentConstruct;
- let info;
- return Array.isArray(constructs2) ? (
- /* c8 ignore next 1 */
- handleListOfConstructs(constructs2)
- ) : "tokenize" in constructs2 ? (
- // Looks like a construct.
- handleListOfConstructs([
- /** @type {Construct} */
- constructs2
- ])
- ) : handleMapOfConstructs(constructs2);
- function handleMapOfConstructs(map) {
- return start2;
- function start2(code2) {
- const left = code2 !== null && map[code2];
- const all2 = code2 !== null && map.null;
- const list3 = [
- // To do: add more extension tests.
- /* c8 ignore next 2 */
- ...Array.isArray(left) ? left : left ? [left] : [],
- ...Array.isArray(all2) ? all2 : all2 ? [all2] : []
- ];
- return handleListOfConstructs(list3)(code2);
- }
- }
- function handleListOfConstructs(list3) {
- listOfConstructs = list3;
- constructIndex = 0;
- if (list3.length === 0) {
- ok(bogusState, "expected `bogusState` to be given");
- return bogusState;
- }
- return handleConstruct(list3[constructIndex]);
- }
- function handleConstruct(construct) {
- return start2;
- function start2(code2) {
- info = store();
- currentConstruct = construct;
- if (!construct.partial) {
- context.currentConstruct = construct;
- }
- ok(
- context.parser.constructs.disable.null,
- "expected `disable.null` to be populated"
- );
- if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
- return nok(code2);
- }
- return construct.tokenize.call(
- // If we do have fields, create an object w/ `context` as its
- // prototype.
- // This allows a “live binding”, which is needed for `interrupt`.
- fields ? Object.assign(Object.create(context), fields) : context,
- effects,
- ok2,
- nok
- )(code2);
- }
- }
- function ok2(code2) {
- ok(code2 === expectedCode, "expected code");
- consumed = true;
- onreturn(currentConstruct, info);
- return returnState;
- }
- function nok(code2) {
- ok(code2 === expectedCode, "expected code");
- consumed = true;
- info.restore();
- if (++constructIndex < listOfConstructs.length) {
- return handleConstruct(listOfConstructs[constructIndex]);
- }
- return bogusState;
- }
- }
- }
- function addResult(construct, from2) {
- if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
- resolveAllConstructs.push(construct);
- }
- if (construct.resolve) {
- splice(
- context.events,
- from2,
- context.events.length - from2,
- construct.resolve(context.events.slice(from2), context)
- );
- }
- if (construct.resolveTo) {
- context.events = construct.resolveTo(context.events, context);
- }
- ok(
- construct.partial || context.events.length === 0 || context.events[context.events.length - 1][0] === "exit",
- "expected last token to end"
- );
- }
- function store() {
- const startPoint = now();
- const startPrevious = context.previous;
- const startCurrentConstruct = context.currentConstruct;
- const startEventsIndex = context.events.length;
- const startStack = Array.from(stack);
- return { from: startEventsIndex, restore };
- function restore() {
- point4 = startPoint;
- context.previous = startPrevious;
- context.currentConstruct = startCurrentConstruct;
- context.events.length = startEventsIndex;
- stack = startStack;
- accountForPotentialSkip();
- debug("position: restore: `%j`", point4);
- }
- }
- function accountForPotentialSkip() {
- if (point4.line in columnStart && point4.column < 2) {
- point4.column = columnStart[point4.line];
- point4.offset += columnStart[point4.line] - 1;
- }
- }
- }
- function sliceChunks(chunks, token) {
- const startIndex = token.start._index;
- const startBufferIndex = token.start._bufferIndex;
- const endIndex = token.end._index;
- const endBufferIndex = token.end._bufferIndex;
- let view;
- if (startIndex === endIndex) {
- ok(endBufferIndex > -1, "expected non-negative end buffer index");
- ok(startBufferIndex > -1, "expected non-negative start buffer index");
- view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
- } else {
- view = chunks.slice(startIndex, endIndex);
- if (startBufferIndex > -1) {
- const head = view[0];
- if (typeof head === "string") {
- view[0] = head.slice(startBufferIndex);
- } else {
- ok(startBufferIndex === 0, "expected `startBufferIndex` to be `0`");
- view.shift();
- }
- }
- if (endBufferIndex > 0) {
- view.push(chunks[endIndex].slice(0, endBufferIndex));
- }
- }
- return view;
- }
- function serializeChunks(chunks, expandTabs) {
- let index2 = -1;
- const result = [];
- let atTab;
- while (++index2 < chunks.length) {
- const chunk = chunks[index2];
- let value;
- if (typeof chunk === "string") {
- value = chunk;
- } else
- switch (chunk) {
- case codes.carriageReturn: {
- value = values.cr;
- break;
- }
- case codes.lineFeed: {
- value = values.lf;
- break;
- }
- case codes.carriageReturnLineFeed: {
- value = values.cr + values.lf;
- break;
- }
- case codes.horizontalTab: {
- value = expandTabs ? values.space : values.ht;
- break;
- }
- case codes.virtualSpace: {
- if (!expandTabs && atTab) continue;
- value = values.space;
- break;
- }
- default: {
- ok(typeof chunk === "number", "expected number");
- value = String.fromCharCode(chunk);
- }
- }
- atTab = chunk === codes.horizontalTab;
- result.push(value);
- }
- return result.join("");
- }
- // node_modules/micromark/dev/lib/parse.js
- function parse(options) {
- const settings = options || {};
- const constructs2 = (
- /** @type {FullNormalizedExtension} */
- combineExtensions([constructs_exports, ...settings.extensions || []])
- );
- const parser = {
- constructs: constructs2,
- content: create(content),
- defined: [],
- document: create(document2),
- flow: create(flow),
- lazy: {},
- string: create(string),
- text: create(text2)
- };
- return parser;
- function create(initial) {
- return creator;
- function creator(from) {
- return createTokenizer(parser, initial, from);
- }
- }
- }
- // node_modules/micromark/dev/lib/postprocess.js
- function postprocess(events) {
- while (!subtokenize(events)) {
- }
- return events;
- }
- // node_modules/micromark/dev/lib/preprocess.js
- var search = /[\0\t\n\r]/g;
- function preprocess() {
- let column = 1;
- let buffer = "";
- let start2 = true;
- let atCarriageReturn;
- return preprocessor;
- function preprocessor(value, encoding, end) {
- const chunks = [];
- let match;
- let next;
- let startPosition;
- let endPosition;
- let code2;
- value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
- startPosition = 0;
- buffer = "";
- if (start2) {
- if (value.charCodeAt(0) === codes.byteOrderMarker) {
- startPosition++;
- }
- start2 = void 0;
- }
- while (startPosition < value.length) {
- search.lastIndex = startPosition;
- match = search.exec(value);
- endPosition = match && match.index !== void 0 ? match.index : value.length;
- code2 = value.charCodeAt(endPosition);
- if (!match) {
- buffer = value.slice(startPosition);
- break;
- }
- if (code2 === codes.lf && startPosition === endPosition && atCarriageReturn) {
- chunks.push(codes.carriageReturnLineFeed);
- atCarriageReturn = void 0;
- } else {
- if (atCarriageReturn) {
- chunks.push(codes.carriageReturn);
- atCarriageReturn = void 0;
- }
- if (startPosition < endPosition) {
- chunks.push(value.slice(startPosition, endPosition));
- column += endPosition - startPosition;
- }
- switch (code2) {
- case codes.nul: {
- chunks.push(codes.replacementCharacter);
- column++;
- break;
- }
- case codes.ht: {
- next = Math.ceil(column / constants.tabSize) * constants.tabSize;
- chunks.push(codes.horizontalTab);
- while (column++ < next) chunks.push(codes.virtualSpace);
- break;
- }
- case codes.lf: {
- chunks.push(codes.lineFeed);
- column = 1;
- break;
- }
- default: {
- atCarriageReturn = true;
- column = 1;
- }
- }
- }
- startPosition = endPosition + 1;
- }
- if (end) {
- if (atCarriageReturn) chunks.push(codes.carriageReturn);
- if (buffer) chunks.push(buffer);
- chunks.push(codes.eof);
- }
- return chunks;
- }
- }
- // node_modules/micromark-util-decode-string/dev/index.js
- var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
- function decodeString(value) {
- return value.replace(characterEscapeOrReference, decode);
- }
- function decode($0, $1, $2) {
- if ($1) {
- return $1;
- }
- const head = $2.charCodeAt(0);
- if (head === codes.numberSign) {
- const head2 = $2.charCodeAt(1);
- const hex = head2 === codes.lowercaseX || head2 === codes.uppercaseX;
- return decodeNumericCharacterReference(
- $2.slice(hex ? 2 : 1),
- hex ? constants.numericBaseHexadecimal : constants.numericBaseDecimal
- );
- }
- return decodeNamedCharacterReference($2) || $0;
- }
- // node_modules/mdast-util-from-markdown/dev/lib/index.js
- var own2 = {}.hasOwnProperty;
- function fromMarkdown(value, encoding, options) {
- if (encoding && typeof encoding === "object") {
- options = encoding;
- encoding = void 0;
- }
- return compiler(options)(
- postprocess(
- parse(options).document().write(preprocess()(value, encoding, true))
- )
- );
- }
- function compiler(options) {
- const config = {
- transforms: [],
- canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
- enter: {
- autolink: opener(link2),
- autolinkProtocol: onenterdata,
- autolinkEmail: onenterdata,
- atxHeading: opener(heading2),
- blockQuote: opener(blockQuote2),
- characterEscape: onenterdata,
- characterReference: onenterdata,
- codeFenced: opener(codeFlow),
- codeFencedFenceInfo: buffer,
- codeFencedFenceMeta: buffer,
- codeIndented: opener(codeFlow, buffer),
- codeText: opener(codeText2, buffer),
- codeTextData: onenterdata,
- data: onenterdata,
- codeFlowValue: onenterdata,
- definition: opener(definition2),
- definitionDestinationString: buffer,
- definitionLabelString: buffer,
- definitionTitleString: buffer,
- emphasis: opener(emphasis2),
- hardBreakEscape: opener(hardBreak2),
- hardBreakTrailing: opener(hardBreak2),
- htmlFlow: opener(html3, buffer),
- htmlFlowData: onenterdata,
- htmlText: opener(html3, buffer),
- htmlTextData: onenterdata,
- image: opener(image2),
- label: buffer,
- link: opener(link2),
- listItem: opener(listItem2),
- listItemValue: onenterlistitemvalue,
- listOrdered: opener(list3, onenterlistordered),
- listUnordered: opener(list3),
- paragraph: opener(paragraph2),
- reference: onenterreference,
- referenceString: buffer,
- resourceDestinationString: buffer,
- resourceTitleString: buffer,
- setextHeading: opener(heading2),
- strong: opener(strong2),
- thematicBreak: opener(thematicBreak3)
- },
- exit: {
- atxHeading: closer(),
- atxHeadingSequence: onexitatxheadingsequence,
- autolink: closer(),
- autolinkEmail: onexitautolinkemail,
- autolinkProtocol: onexitautolinkprotocol,
- blockQuote: closer(),
- characterEscapeValue: onexitdata,
- characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
- characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
- characterReferenceValue: onexitcharacterreferencevalue,
- characterReference: onexitcharacterreference,
- codeFenced: closer(onexitcodefenced),
- codeFencedFence: onexitcodefencedfence,
- codeFencedFenceInfo: onexitcodefencedfenceinfo,
- codeFencedFenceMeta: onexitcodefencedfencemeta,
- codeFlowValue: onexitdata,
- codeIndented: closer(onexitcodeindented),
- codeText: closer(onexitcodetext),
- codeTextData: onexitdata,
- data: onexitdata,
- definition: closer(),
- definitionDestinationString: onexitdefinitiondestinationstring,
- definitionLabelString: onexitdefinitionlabelstring,
- definitionTitleString: onexitdefinitiontitlestring,
- emphasis: closer(),
- hardBreakEscape: closer(onexithardbreak),
- hardBreakTrailing: closer(onexithardbreak),
- htmlFlow: closer(onexithtmlflow),
- htmlFlowData: onexitdata,
- htmlText: closer(onexithtmltext),
- htmlTextData: onexitdata,
- image: closer(onexitimage),
- label: onexitlabel,
- labelText: onexitlabeltext,
- lineEnding: onexitlineending,
- link: closer(onexitlink),
- listItem: closer(),
- listOrdered: closer(),
- listUnordered: closer(),
- paragraph: closer(),
- referenceString: onexitreferencestring,
- resourceDestinationString: onexitresourcedestinationstring,
- resourceTitleString: onexitresourcetitlestring,
- resource: onexitresource,
- setextHeading: closer(onexitsetextheading),
- setextHeadingLineSequence: onexitsetextheadinglinesequence,
- setextHeadingText: onexitsetextheadingtext,
- strong: closer(),
- thematicBreak: closer()
- }
- };
- configure(config, (options || {}).mdastExtensions || []);
- const data = {};
- return compile2;
- function compile2(events) {
- let tree = { type: "root", children: [] };
- const context = {
- stack: [tree],
- tokenStack: [],
- config,
- enter,
- exit: exit2,
- buffer,
- resume,
- data
- };
- const listStack = [];
- let index2 = -1;
- while (++index2 < events.length) {
- if (events[index2][1].type === types.listOrdered || events[index2][1].type === types.listUnordered) {
- if (events[index2][0] === "enter") {
- listStack.push(index2);
- } else {
- const tail = listStack.pop();
- ok(typeof tail === "number", "expected list to be open");
- index2 = prepareList(events, tail, index2);
- }
- }
- }
- index2 = -1;
- while (++index2 < events.length) {
- const handler = config[events[index2][0]];
- if (own2.call(handler, events[index2][1].type)) {
- handler[events[index2][1].type].call(
- Object.assign(
- { sliceSerialize: events[index2][2].sliceSerialize },
- context
- ),
- events[index2][1]
- );
- }
- }
- if (context.tokenStack.length > 0) {
- const tail = context.tokenStack[context.tokenStack.length - 1];
- const handler = tail[1] || defaultOnError;
- handler.call(context, void 0, tail[0]);
- }
- tree.position = {
- start: point3(
- events.length > 0 ? events[0][1].start : { line: 1, column: 1, offset: 0 }
- ),
- end: point3(
- events.length > 0 ? events[events.length - 2][1].end : { line: 1, column: 1, offset: 0 }
- )
- };
- index2 = -1;
- while (++index2 < config.transforms.length) {
- tree = config.transforms[index2](tree) || tree;
- }
- return tree;
- }
- function prepareList(events, start2, length) {
- let index2 = start2 - 1;
- let containerBalance = -1;
- let listSpread = false;
- let listItem3;
- let lineIndex;
- let firstBlankLineIndex;
- let atMarker;
- while (++index2 <= length) {
- const event = events[index2];
- switch (event[1].type) {
- case types.listUnordered:
- case types.listOrdered:
- case types.blockQuote: {
- if (event[0] === "enter") {
- containerBalance++;
- } else {
- containerBalance--;
- }
- atMarker = void 0;
- break;
- }
- case types.lineEndingBlank: {
- if (event[0] === "enter") {
- if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) {
- firstBlankLineIndex = index2;
- }
- atMarker = void 0;
- }
- break;
- }
- case types.linePrefix:
- case types.listItemValue:
- case types.listItemMarker:
- case types.listItemPrefix:
- case types.listItemPrefixWhitespace: {
- break;
- }
- default: {
- atMarker = void 0;
- }
- }
- if (!containerBalance && event[0] === "enter" && event[1].type === types.listItemPrefix || containerBalance === -1 && event[0] === "exit" && (event[1].type === types.listUnordered || event[1].type === types.listOrdered)) {
- if (listItem3) {
- let tailIndex = index2;
- lineIndex = void 0;
- while (tailIndex--) {
- const tailEvent = events[tailIndex];
- if (tailEvent[1].type === types.lineEnding || tailEvent[1].type === types.lineEndingBlank) {
- if (tailEvent[0] === "exit") continue;
- if (lineIndex) {
- events[lineIndex][1].type = types.lineEndingBlank;
- listSpread = true;
- }
- tailEvent[1].type = types.lineEnding;
- lineIndex = tailIndex;
- } else if (tailEvent[1].type === types.linePrefix || tailEvent[1].type === types.blockQuotePrefix || tailEvent[1].type === types.blockQuotePrefixWhitespace || tailEvent[1].type === types.blockQuoteMarker || tailEvent[1].type === types.listItemIndent) {
- } else {
- break;
- }
- }
- if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
- listItem3._spread = true;
- }
- listItem3.end = Object.assign(
- {},
- lineIndex ? events[lineIndex][1].start : event[1].end
- );
- events.splice(lineIndex || index2, 0, ["exit", listItem3, event[2]]);
- index2++;
- length++;
- }
- if (event[1].type === types.listItemPrefix) {
- const item = {
- type: "listItem",
- _spread: false,
- start: Object.assign({}, event[1].start),
- // @ts-expect-error: we’ll add `end` in a second.
- end: void 0
- };
- listItem3 = item;
- events.splice(index2, 0, ["enter", item, event[2]]);
- index2++;
- length++;
- firstBlankLineIndex = void 0;
- atMarker = true;
- }
- }
- }
- events[start2][1]._spread = listSpread;
- return length;
- }
- function opener(create, and) {
- return open;
- function open(token) {
- enter.call(this, create(token), token);
- if (and) and.call(this, token);
- }
- }
- function buffer() {
- this.stack.push({ type: "fragment", children: [] });
- }
- function enter(node2, token, errorHandler) {
- const parent = this.stack[this.stack.length - 1];
- ok(parent, "expected `parent`");
- ok("children" in parent, "expected `parent`");
- const siblings = parent.children;
- siblings.push(node2);
- this.stack.push(node2);
- this.tokenStack.push([token, errorHandler || void 0]);
- node2.position = {
- start: point3(token.start),
- // @ts-expect-error: `end` will be patched later.
- end: void 0
- };
- }
- function closer(and) {
- return close;
- function close(token) {
- if (and) and.call(this, token);
- exit2.call(this, token);
- }
- }
- function exit2(token, onExitError) {
- const node2 = this.stack.pop();
- ok(node2, "expected `node`");
- const open = this.tokenStack.pop();
- if (!open) {
- throw new Error(
- "Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open"
- );
- } else if (open[0].type !== token.type) {
- if (onExitError) {
- onExitError.call(this, token, open[0]);
- } else {
- const handler = open[1] || defaultOnError;
- handler.call(this, token, open[0]);
- }
- }
- ok(node2.type !== "fragment", "unexpected fragment `exit`ed");
- ok(node2.position, "expected `position` to be defined");
- node2.position.end = point3(token.end);
- }
- function resume() {
- return toString(this.stack.pop());
- }
- function onenterlistordered() {
- this.data.expectingFirstListItemValue = true;
- }
- function onenterlistitemvalue(token) {
- if (this.data.expectingFirstListItemValue) {
- const ancestor = this.stack[this.stack.length - 2];
- ok(ancestor, "expected nodes on stack");
- ok(ancestor.type === "list", "expected list on stack");
- ancestor.start = Number.parseInt(
- this.sliceSerialize(token),
- constants.numericBaseDecimal
- );
- this.data.expectingFirstListItemValue = void 0;
- }
- }
- function onexitcodefencedfenceinfo() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "code", "expected code on stack");
- node2.lang = data2;
- }
- function onexitcodefencedfencemeta() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "code", "expected code on stack");
- node2.meta = data2;
- }
- function onexitcodefencedfence() {
- if (this.data.flowCodeInside) return;
- this.buffer();
- this.data.flowCodeInside = true;
- }
- function onexitcodefenced() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "code", "expected code on stack");
- node2.value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
- this.data.flowCodeInside = void 0;
- }
- function onexitcodeindented() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "code", "expected code on stack");
- node2.value = data2.replace(/(\r?\n|\r)$/g, "");
- }
- function onexitdefinitionlabelstring(token) {
- const label = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "definition", "expected definition on stack");
- node2.label = label;
- node2.identifier = normalizeIdentifier(
- this.sliceSerialize(token)
- ).toLowerCase();
- }
- function onexitdefinitiontitlestring() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "definition", "expected definition on stack");
- node2.title = data2;
- }
- function onexitdefinitiondestinationstring() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "definition", "expected definition on stack");
- node2.url = data2;
- }
- function onexitatxheadingsequence(token) {
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "heading", "expected heading on stack");
- if (!node2.depth) {
- const depth = this.sliceSerialize(token).length;
- ok(
- depth === 1 || depth === 2 || depth === 3 || depth === 4 || depth === 5 || depth === 6,
- "expected `depth` between `1` and `6`"
- );
- node2.depth = depth;
- }
- }
- function onexitsetextheadingtext() {
- this.data.setextHeadingSlurpLineEnding = true;
- }
- function onexitsetextheadinglinesequence(token) {
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "heading", "expected heading on stack");
- node2.depth = this.sliceSerialize(token).codePointAt(0) === codes.equalsTo ? 1 : 2;
- }
- function onexitsetextheading() {
- this.data.setextHeadingSlurpLineEnding = void 0;
- }
- function onenterdata(token) {
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok("children" in node2, "expected parent on stack");
- const siblings = node2.children;
- let tail = siblings[siblings.length - 1];
- if (!tail || tail.type !== "text") {
- tail = text5();
- tail.position = {
- start: point3(token.start),
- // @ts-expect-error: we’ll add `end` later.
- end: void 0
- };
- siblings.push(tail);
- }
- this.stack.push(tail);
- }
- function onexitdata(token) {
- const tail = this.stack.pop();
- ok(tail, "expected a `node` to be on the stack");
- ok("value" in tail, "expected a `literal` to be on the stack");
- ok(tail.position, "expected `node` to have an open position");
- tail.value += this.sliceSerialize(token);
- tail.position.end = point3(token.end);
- }
- function onexitlineending(token) {
- const context = this.stack[this.stack.length - 1];
- ok(context, "expected `node`");
- if (this.data.atHardBreak) {
- ok("children" in context, "expected `parent`");
- const tail = context.children[context.children.length - 1];
- ok(tail.position, "expected tail to have a starting position");
- tail.position.end = point3(token.end);
- this.data.atHardBreak = void 0;
- return;
- }
- if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {
- onenterdata.call(this, token);
- onexitdata.call(this, token);
- }
- }
- function onexithardbreak() {
- this.data.atHardBreak = true;
- }
- function onexithtmlflow() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "html", "expected html on stack");
- node2.value = data2;
- }
- function onexithtmltext() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "html", "expected html on stack");
- node2.value = data2;
- }
- function onexitcodetext() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "inlineCode", "expected inline code on stack");
- node2.value = data2;
- }
- function onexitlink() {
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "link", "expected link on stack");
- if (this.data.inReference) {
- const referenceType = this.data.referenceType || "shortcut";
- node2.type += "Reference";
- node2.referenceType = referenceType;
- delete node2.url;
- delete node2.title;
- } else {
- delete node2.identifier;
- delete node2.label;
- }
- this.data.referenceType = void 0;
- }
- function onexitimage() {
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "image", "expected image on stack");
- if (this.data.inReference) {
- const referenceType = this.data.referenceType || "shortcut";
- node2.type += "Reference";
- node2.referenceType = referenceType;
- delete node2.url;
- delete node2.title;
- } else {
- delete node2.identifier;
- delete node2.label;
- }
- this.data.referenceType = void 0;
- }
- function onexitlabeltext(token) {
- const string3 = this.sliceSerialize(token);
- const ancestor = this.stack[this.stack.length - 2];
- ok(ancestor, "expected ancestor on stack");
- ok(
- ancestor.type === "image" || ancestor.type === "link",
- "expected image or link on stack"
- );
- ancestor.label = decodeString(string3);
- ancestor.identifier = normalizeIdentifier(string3).toLowerCase();
- }
- function onexitlabel() {
- const fragment = this.stack[this.stack.length - 1];
- ok(fragment, "expected node on stack");
- ok(fragment.type === "fragment", "expected fragment on stack");
- const value = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(
- node2.type === "image" || node2.type === "link",
- "expected image or link on stack"
- );
- this.data.inReference = true;
- if (node2.type === "link") {
- const children = fragment.children;
- node2.children = children;
- } else {
- node2.alt = value;
- }
- }
- function onexitresourcedestinationstring() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(
- node2.type === "image" || node2.type === "link",
- "expected image or link on stack"
- );
- node2.url = data2;
- }
- function onexitresourcetitlestring() {
- const data2 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(
- node2.type === "image" || node2.type === "link",
- "expected image or link on stack"
- );
- node2.title = data2;
- }
- function onexitresource() {
- this.data.inReference = void 0;
- }
- function onenterreference() {
- this.data.referenceType = "collapsed";
- }
- function onexitreferencestring(token) {
- const label = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(
- node2.type === "image" || node2.type === "link",
- "expected image reference or link reference on stack"
- );
- node2.label = label;
- node2.identifier = normalizeIdentifier(
- this.sliceSerialize(token)
- ).toLowerCase();
- this.data.referenceType = "full";
- }
- function onexitcharacterreferencemarker(token) {
- ok(
- token.type === "characterReferenceMarkerNumeric" || token.type === "characterReferenceMarkerHexadecimal"
- );
- this.data.characterReferenceType = token.type;
- }
- function onexitcharacterreferencevalue(token) {
- const data2 = this.sliceSerialize(token);
- const type = this.data.characterReferenceType;
- let value;
- if (type) {
- value = decodeNumericCharacterReference(
- data2,
- type === types.characterReferenceMarkerNumeric ? constants.numericBaseDecimal : constants.numericBaseHexadecimal
- );
- this.data.characterReferenceType = void 0;
- } else {
- const result = decodeNamedCharacterReference(data2);
- ok(result !== false, "expected reference to decode");
- value = result;
- }
- const tail = this.stack[this.stack.length - 1];
- ok(tail, "expected `node`");
- ok("value" in tail, "expected `node.value`");
- tail.value += value;
- }
- function onexitcharacterreference(token) {
- const tail = this.stack.pop();
- ok(tail, "expected `node`");
- ok(tail.position, "expected `node.position`");
- tail.position.end = point3(token.end);
- }
- function onexitautolinkprotocol(token) {
- onexitdata.call(this, token);
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "link", "expected link on stack");
- node2.url = this.sliceSerialize(token);
- }
- function onexitautolinkemail(token) {
- onexitdata.call(this, token);
- const node2 = this.stack[this.stack.length - 1];
- ok(node2, "expected node on stack");
- ok(node2.type === "link", "expected link on stack");
- node2.url = "mailto:" + this.sliceSerialize(token);
- }
- function blockQuote2() {
- return { type: "blockquote", children: [] };
- }
- function codeFlow() {
- return { type: "code", lang: null, meta: null, value: "" };
- }
- function codeText2() {
- return { type: "inlineCode", value: "" };
- }
- function definition2() {
- return {
- type: "definition",
- identifier: "",
- label: null,
- title: null,
- url: ""
- };
- }
- function emphasis2() {
- return { type: "emphasis", children: [] };
- }
- function heading2() {
- return {
- type: "heading",
- // @ts-expect-error `depth` will be set later.
- depth: 0,
- children: []
- };
- }
- function hardBreak2() {
- return { type: "break" };
- }
- function html3() {
- return { type: "html", value: "" };
- }
- function image2() {
- return { type: "image", title: null, url: "", alt: null };
- }
- function link2() {
- return { type: "link", title: null, url: "", children: [] };
- }
- function list3(token) {
- return {
- type: "list",
- ordered: token.type === "listOrdered",
- start: null,
- spread: token._spread,
- children: []
- };
- }
- function listItem2(token) {
- return {
- type: "listItem",
- spread: token._spread,
- checked: null,
- children: []
- };
- }
- function paragraph2() {
- return { type: "paragraph", children: [] };
- }
- function strong2() {
- return { type: "strong", children: [] };
- }
- function text5() {
- return { type: "text", value: "" };
- }
- function thematicBreak3() {
- return { type: "thematicBreak" };
- }
- }
- function point3(d) {
- return { line: d.line, column: d.column, offset: d.offset };
- }
- function configure(combined, extensions) {
- let index2 = -1;
- while (++index2 < extensions.length) {
- const value = extensions[index2];
- if (Array.isArray(value)) {
- configure(combined, value);
- } else {
- extension(combined, value);
- }
- }
- }
- function extension(combined, extension2) {
- let key;
- for (key in extension2) {
- if (own2.call(extension2, key)) {
- switch (key) {
- case "canContainEols": {
- const right = extension2[key];
- if (right) {
- combined[key].push(...right);
- }
- break;
- }
- case "transforms": {
- const right = extension2[key];
- if (right) {
- combined[key].push(...right);
- }
- break;
- }
- case "enter":
- case "exit": {
- const right = extension2[key];
- if (right) {
- Object.assign(combined[key], right);
- }
- break;
- }
- }
- }
- }
- }
- function defaultOnError(left, right) {
- if (left) {
- throw new Error(
- "Cannot close `" + left.type + "` (" + stringifyPosition({ start: left.start, end: left.end }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is open"
- );
- } else {
- throw new Error(
- "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open"
- );
- }
- }
- // node_modules/remark-parse/lib/index.js
- function remarkParse(options) {
- const self2 = this;
- self2.parser = parser;
- function parser(doc) {
- return fromMarkdown(doc, {
- ...self2.data("settings"),
- ...options,
- // Note: these options are not in the readme.
- // The goal is for them to be set by plugins on `data` instead of being
- // passed by users.
- extensions: self2.data("micromarkExtensions") || [],
- mdastExtensions: self2.data("fromMarkdownExtensions") || []
- });
- }
- }
- // node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
- function blockquote(state, node2) {
- const result = {
- type: "element",
- tagName: "blockquote",
- properties: {},
- children: state.wrap(state.all(node2), true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/break.js
- function hardBreak(state, node2) {
- const result = { type: "element", tagName: "br", properties: {}, children: [] };
- state.patch(node2, result);
- return [state.applyData(node2, result), { type: "text", value: "\n" }];
- }
- // node_modules/mdast-util-to-hast/lib/handlers/code.js
- function code(state, node2) {
- const value = node2.value ? node2.value + "\n" : "";
- const properties = {};
- const language = node2.lang ? node2.lang.split(/\s+/) : [];
- if (language.length > 0) {
- properties.className = ["language-" + language[0]];
- }
- let result = {
- type: "element",
- tagName: "code",
- properties,
- children: [{ type: "text", value }]
- };
- if (node2.meta) {
- result.data = { meta: node2.meta };
- }
- state.patch(node2, result);
- result = state.applyData(node2, result);
- result = { type: "element", tagName: "pre", properties: {}, children: [result] };
- state.patch(node2, result);
- return result;
- }
- // node_modules/mdast-util-to-hast/lib/handlers/delete.js
- function strikethrough(state, node2) {
- const result = {
- type: "element",
- tagName: "del",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
- function emphasis(state, node2) {
- const result = {
- type: "element",
- tagName: "em",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
- function footnoteReference(state, node2) {
- const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
- const id = String(node2.identifier).toUpperCase();
- const safeId = normalizeUri(id.toLowerCase());
- const index2 = state.footnoteOrder.indexOf(id);
- let counter;
- let reuseCounter = state.footnoteCounts.get(id);
- if (reuseCounter === void 0) {
- reuseCounter = 0;
- state.footnoteOrder.push(id);
- counter = state.footnoteOrder.length;
- } else {
- counter = index2 + 1;
- }
- reuseCounter += 1;
- state.footnoteCounts.set(id, reuseCounter);
- const link2 = {
- type: "element",
- tagName: "a",
- properties: {
- href: "#" + clobberPrefix + "fn-" + safeId,
- id: clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""),
- dataFootnoteRef: true,
- ariaDescribedBy: ["footnote-label"]
- },
- children: [{ type: "text", value: String(counter) }]
- };
- state.patch(node2, link2);
- const sup = {
- type: "element",
- tagName: "sup",
- properties: {},
- children: [link2]
- };
- state.patch(node2, sup);
- return state.applyData(node2, sup);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/heading.js
- function heading(state, node2) {
- const result = {
- type: "element",
- tagName: "h" + node2.depth,
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/html.js
- function html2(state, node2) {
- if (state.options.allowDangerousHtml) {
- const result = { type: "raw", value: node2.value };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- return void 0;
- }
- // node_modules/mdast-util-to-hast/lib/revert.js
- function revert(state, node2) {
- const subtype = node2.referenceType;
- let suffix = "]";
- if (subtype === "collapsed") {
- suffix += "[]";
- } else if (subtype === "full") {
- suffix += "[" + (node2.label || node2.identifier) + "]";
- }
- if (node2.type === "imageReference") {
- return [{ type: "text", value: "![" + node2.alt + suffix }];
- }
- const contents = state.all(node2);
- const head = contents[0];
- if (head && head.type === "text") {
- head.value = "[" + head.value;
- } else {
- contents.unshift({ type: "text", value: "[" });
- }
- const tail = contents[contents.length - 1];
- if (tail && tail.type === "text") {
- tail.value += suffix;
- } else {
- contents.push({ type: "text", value: suffix });
- }
- return contents;
- }
- // node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
- function imageReference(state, node2) {
- const id = String(node2.identifier).toUpperCase();
- const definition2 = state.definitionById.get(id);
- if (!definition2) {
- return revert(state, node2);
- }
- const properties = { src: normalizeUri(definition2.url || ""), alt: node2.alt };
- if (definition2.title !== null && definition2.title !== void 0) {
- properties.title = definition2.title;
- }
- const result = { type: "element", tagName: "img", properties, children: [] };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/image.js
- function image(state, node2) {
- const properties = { src: normalizeUri(node2.url) };
- if (node2.alt !== null && node2.alt !== void 0) {
- properties.alt = node2.alt;
- }
- if (node2.title !== null && node2.title !== void 0) {
- properties.title = node2.title;
- }
- const result = { type: "element", tagName: "img", properties, children: [] };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
- function inlineCode(state, node2) {
- const text5 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
- state.patch(node2, text5);
- const result = {
- type: "element",
- tagName: "code",
- properties: {},
- children: [text5]
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
- function linkReference(state, node2) {
- const id = String(node2.identifier).toUpperCase();
- const definition2 = state.definitionById.get(id);
- if (!definition2) {
- return revert(state, node2);
- }
- const properties = { href: normalizeUri(definition2.url || "") };
- if (definition2.title !== null && definition2.title !== void 0) {
- properties.title = definition2.title;
- }
- const result = {
- type: "element",
- tagName: "a",
- properties,
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/link.js
- function link(state, node2) {
- const properties = { href: normalizeUri(node2.url) };
- if (node2.title !== null && node2.title !== void 0) {
- properties.title = node2.title;
- }
- const result = {
- type: "element",
- tagName: "a",
- properties,
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/list-item.js
- function listItem(state, node2, parent) {
- const results = state.all(node2);
- const loose = parent ? listLoose(parent) : listItemLoose(node2);
- const properties = {};
- const children = [];
- if (typeof node2.checked === "boolean") {
- const head = results[0];
- let paragraph2;
- if (head && head.type === "element" && head.tagName === "p") {
- paragraph2 = head;
- } else {
- paragraph2 = { type: "element", tagName: "p", properties: {}, children: [] };
- results.unshift(paragraph2);
- }
- if (paragraph2.children.length > 0) {
- paragraph2.children.unshift({ type: "text", value: " " });
- }
- paragraph2.children.unshift({
- type: "element",
- tagName: "input",
- properties: { type: "checkbox", checked: node2.checked, disabled: true },
- children: []
- });
- properties.className = ["task-list-item"];
- }
- let index2 = -1;
- while (++index2 < results.length) {
- const child = results[index2];
- if (loose || index2 !== 0 || child.type !== "element" || child.tagName !== "p") {
- children.push({ type: "text", value: "\n" });
- }
- if (child.type === "element" && child.tagName === "p" && !loose) {
- children.push(...child.children);
- } else {
- children.push(child);
- }
- }
- const tail = results[results.length - 1];
- if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) {
- children.push({ type: "text", value: "\n" });
- }
- const result = { type: "element", tagName: "li", properties, children };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- function listLoose(node2) {
- let loose = false;
- if (node2.type === "list") {
- loose = node2.spread || false;
- const children = node2.children;
- let index2 = -1;
- while (!loose && ++index2 < children.length) {
- loose = listItemLoose(children[index2]);
- }
- }
- return loose;
- }
- function listItemLoose(node2) {
- const spread = node2.spread;
- return spread === null || spread === void 0 ? node2.children.length > 1 : spread;
- }
- // node_modules/mdast-util-to-hast/lib/handlers/list.js
- function list2(state, node2) {
- const properties = {};
- const results = state.all(node2);
- let index2 = -1;
- if (typeof node2.start === "number" && node2.start !== 1) {
- properties.start = node2.start;
- }
- while (++index2 < results.length) {
- const child = results[index2];
- if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) {
- properties.className = ["contains-task-list"];
- break;
- }
- }
- const result = {
- type: "element",
- tagName: node2.ordered ? "ol" : "ul",
- properties,
- children: state.wrap(results, true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
- function paragraph(state, node2) {
- const result = {
- type: "element",
- tagName: "p",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/root.js
- function root2(state, node2) {
- const result = { type: "root", children: state.wrap(state.all(node2)) };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/strong.js
- function strong(state, node2) {
- const result = {
- type: "element",
- tagName: "strong",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/table.js
- function table(state, node2) {
- const rows = state.all(node2);
- const firstRow = rows.shift();
- const tableContent = [];
- if (firstRow) {
- const head = {
- type: "element",
- tagName: "thead",
- properties: {},
- children: state.wrap([firstRow], true)
- };
- state.patch(node2.children[0], head);
- tableContent.push(head);
- }
- if (rows.length > 0) {
- const body = {
- type: "element",
- tagName: "tbody",
- properties: {},
- children: state.wrap(rows, true)
- };
- const start2 = pointStart(node2.children[1]);
- const end = pointEnd(node2.children[node2.children.length - 1]);
- if (start2 && end) body.position = { start: start2, end };
- tableContent.push(body);
- }
- const result = {
- type: "element",
- tagName: "table",
- properties: {},
- children: state.wrap(tableContent, true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/table-row.js
- function tableRow(state, node2, parent) {
- const siblings = parent ? parent.children : void 0;
- const rowIndex = siblings ? siblings.indexOf(node2) : 1;
- const tagName = rowIndex === 0 ? "th" : "td";
- const align = parent && parent.type === "table" ? parent.align : void 0;
- const length = align ? align.length : node2.children.length;
- let cellIndex = -1;
- const cells = [];
- while (++cellIndex < length) {
- const cell = node2.children[cellIndex];
- const properties = {};
- const alignValue = align ? align[cellIndex] : void 0;
- if (alignValue) {
- properties.align = alignValue;
- }
- let result2 = { type: "element", tagName, properties, children: [] };
- if (cell) {
- result2.children = state.all(cell);
- state.patch(cell, result2);
- result2 = state.applyData(cell, result2);
- }
- cells.push(result2);
- }
- const result = {
- type: "element",
- tagName: "tr",
- properties: {},
- children: state.wrap(cells, true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/table-cell.js
- function tableCell(state, node2) {
- const result = {
- type: "element",
- tagName: "td",
- // Assume body cell.
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/trim-lines/index.js
- var tab = 9;
- var space = 32;
- function trimLines(value) {
- const source = String(value);
- const search2 = /\r?\n|\r/g;
- let match = search2.exec(source);
- let last = 0;
- const lines = [];
- while (match) {
- lines.push(
- trimLine(source.slice(last, match.index), last > 0, true),
- match[0]
- );
- last = match.index + match[0].length;
- match = search2.exec(source);
- }
- lines.push(trimLine(source.slice(last), last > 0, false));
- return lines.join("");
- }
- function trimLine(value, start2, end) {
- let startIndex = 0;
- let endIndex = value.length;
- if (start2) {
- let code2 = value.codePointAt(startIndex);
- while (code2 === tab || code2 === space) {
- startIndex++;
- code2 = value.codePointAt(startIndex);
- }
- }
- if (end) {
- let code2 = value.codePointAt(endIndex - 1);
- while (code2 === tab || code2 === space) {
- endIndex--;
- code2 = value.codePointAt(endIndex - 1);
- }
- }
- return endIndex > startIndex ? value.slice(startIndex, endIndex) : "";
- }
- // node_modules/mdast-util-to-hast/lib/handlers/text.js
- function text4(state, node2) {
- const result = { type: "text", value: trimLines(String(node2.value)) };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
- function thematicBreak2(state, node2) {
- const result = {
- type: "element",
- tagName: "hr",
- properties: {},
- children: []
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- // node_modules/mdast-util-to-hast/lib/handlers/index.js
- var handlers = {
- blockquote,
- break: hardBreak,
- code,
- delete: strikethrough,
- emphasis,
- footnoteReference,
- heading,
- html: html2,
- imageReference,
- image,
- inlineCode,
- linkReference,
- link,
- listItem,
- list: list2,
- paragraph,
- // @ts-expect-error: root is different, but hard to type.
- root: root2,
- strong,
- table,
- tableCell,
- tableRow,
- text: text4,
- thematicBreak: thematicBreak2,
- toml: ignore,
- yaml: ignore,
- definition: ignore,
- footnoteDefinition: ignore
- };
- function ignore() {
- return void 0;
- }
- // node_modules/@ungap/structured-clone/esm/types.js
- var VOID = -1;
- var PRIMITIVE = 0;
- var ARRAY = 1;
- var OBJECT = 2;
- var DATE = 3;
- var REGEXP = 4;
- var MAP = 5;
- var SET = 6;
- var ERROR = 7;
- var BIGINT = 8;
- // node_modules/@ungap/structured-clone/esm/deserialize.js
- var env = typeof self === "object" ? self : globalThis;
- var deserializer = ($, _) => {
- const as = (out, index2) => {
- $.set(index2, out);
- return out;
- };
- const unpair = (index2) => {
- if ($.has(index2))
- return $.get(index2);
- const [type, value] = _[index2];
- switch (type) {
- case PRIMITIVE:
- case VOID:
- return as(value, index2);
- case ARRAY: {
- const arr = as([], index2);
- for (const index3 of value)
- arr.push(unpair(index3));
- return arr;
- }
- case OBJECT: {
- const object = as({}, index2);
- for (const [key, index3] of value)
- object[unpair(key)] = unpair(index3);
- return object;
- }
- case DATE:
- return as(new Date(value), index2);
- case REGEXP: {
- const { source, flags } = value;
- return as(new RegExp(source, flags), index2);
- }
- case MAP: {
- const map = as(/* @__PURE__ */ new Map(), index2);
- for (const [key, index3] of value)
- map.set(unpair(key), unpair(index3));
- return map;
- }
- case SET: {
- const set = as(/* @__PURE__ */ new Set(), index2);
- for (const index3 of value)
- set.add(unpair(index3));
- return set;
- }
- case ERROR: {
- const { name: name2, message } = value;
- return as(new env[name2](message), index2);
- }
- case BIGINT:
- return as(BigInt(value), index2);
- case "BigInt":
- return as(Object(BigInt(value)), index2);
- case "ArrayBuffer":
- return as(new Uint8Array(value).buffer, value);
- case "DataView": {
- const { buffer } = new Uint8Array(value);
- return as(new DataView(buffer), value);
- }
- }
- return as(new env[type](value), index2);
- };
- return unpair;
- };
- var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
- // node_modules/@ungap/structured-clone/esm/serialize.js
- var EMPTY = "";
- var { toString: toString2 } = {};
- var { keys } = Object;
- var typeOf = (value) => {
- const type = typeof value;
- if (type !== "object" || !value)
- return [PRIMITIVE, type];
- const asString = toString2.call(value).slice(8, -1);
- switch (asString) {
- case "Array":
- return [ARRAY, EMPTY];
- case "Object":
- return [OBJECT, EMPTY];
- case "Date":
- return [DATE, EMPTY];
- case "RegExp":
- return [REGEXP, EMPTY];
- case "Map":
- return [MAP, EMPTY];
- case "Set":
- return [SET, EMPTY];
- case "DataView":
- return [ARRAY, asString];
- }
- if (asString.includes("Array"))
- return [ARRAY, asString];
- if (asString.includes("Error"))
- return [ERROR, asString];
- return [OBJECT, asString];
- };
- var shouldSkip = ([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol");
- var serializer = (strict, json, $, _) => {
- const as = (out, value) => {
- const index2 = _.push(out) - 1;
- $.set(value, index2);
- return index2;
- };
- const pair = (value) => {
- if ($.has(value))
- return $.get(value);
- let [TYPE, type] = typeOf(value);
- switch (TYPE) {
- case PRIMITIVE: {
- let entry = value;
- switch (type) {
- case "bigint":
- TYPE = BIGINT;
- entry = value.toString();
- break;
- case "function":
- case "symbol":
- if (strict)
- throw new TypeError("unable to serialize " + type);
- entry = null;
- break;
- case "undefined":
- return as([VOID], value);
- }
- return as([TYPE, entry], value);
- }
- case ARRAY: {
- if (type) {
- let spread = value;
- if (type === "DataView") {
- spread = new Uint8Array(value.buffer);
- } else if (type === "ArrayBuffer") {
- spread = new Uint8Array(value);
- }
- return as([type, [...spread]], value);
- }
- const arr = [];
- const index2 = as([TYPE, arr], value);
- for (const entry of value)
- arr.push(pair(entry));
- return index2;
- }
- case OBJECT: {
- if (type) {
- switch (type) {
- case "BigInt":
- return as([type, value.toString()], value);
- case "Boolean":
- case "Number":
- case "String":
- return as([type, value.valueOf()], value);
- }
- }
- if (json && "toJSON" in value)
- return pair(value.toJSON());
- const entries = [];
- const index2 = as([TYPE, entries], value);
- for (const key of keys(value)) {
- if (strict || !shouldSkip(typeOf(value[key])))
- entries.push([pair(key), pair(value[key])]);
- }
- return index2;
- }
- case DATE:
- return as([TYPE, value.toISOString()], value);
- case REGEXP: {
- const { source, flags } = value;
- return as([TYPE, { source, flags }], value);
- }
- case MAP: {
- const entries = [];
- const index2 = as([TYPE, entries], value);
- for (const [key, entry] of value) {
- if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
- entries.push([pair(key), pair(entry)]);
- }
- return index2;
- }
- case SET: {
- const entries = [];
- const index2 = as([TYPE, entries], value);
- for (const entry of value) {
- if (strict || !shouldSkip(typeOf(entry)))
- entries.push(pair(entry));
- }
- return index2;
- }
- }
- const { message } = value;
- return as([TYPE, { name: type, message }], value);
- };
- return pair;
- };
- var serialize = (value, { json, lossy } = {}) => {
- const _ = [];
- return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
- };
- // node_modules/@ungap/structured-clone/esm/index.js
- var esm_default = typeof structuredClone === "function" ? (
- /* c8 ignore start */
- (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any)
- ) : (any, options) => deserialize(serialize(any, options));
- // node_modules/mdast-util-to-hast/lib/footer.js
- function defaultFootnoteBackContent(_, rereferenceIndex) {
- const result = [{ type: "text", value: "↩" }];
- if (rereferenceIndex > 1) {
- result.push({
- type: "element",
- tagName: "sup",
- properties: {},
- children: [{ type: "text", value: String(rereferenceIndex) }]
- });
- }
- return result;
- }
- function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
- return "Back to reference " + (referenceIndex + 1) + (rereferenceIndex > 1 ? "-" + rereferenceIndex : "");
- }
- function footer(state) {
- const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
- const footnoteBackContent = state.options.footnoteBackContent || defaultFootnoteBackContent;
- const footnoteBackLabel = state.options.footnoteBackLabel || defaultFootnoteBackLabel;
- const footnoteLabel = state.options.footnoteLabel || "Footnotes";
- const footnoteLabelTagName = state.options.footnoteLabelTagName || "h2";
- const footnoteLabelProperties = state.options.footnoteLabelProperties || {
- className: ["sr-only"]
- };
- const listItems = [];
- let referenceIndex = -1;
- while (++referenceIndex < state.footnoteOrder.length) {
- const definition2 = state.footnoteById.get(
- state.footnoteOrder[referenceIndex]
- );
- if (!definition2) {
- continue;
- }
- const content3 = state.all(definition2);
- const id = String(definition2.identifier).toUpperCase();
- const safeId = normalizeUri(id.toLowerCase());
- let rereferenceIndex = 0;
- const backReferences = [];
- const counts = state.footnoteCounts.get(id);
- while (counts !== void 0 && ++rereferenceIndex <= counts) {
- if (backReferences.length > 0) {
- backReferences.push({ type: "text", value: " " });
- }
- let children = typeof footnoteBackContent === "string" ? footnoteBackContent : footnoteBackContent(referenceIndex, rereferenceIndex);
- if (typeof children === "string") {
- children = { type: "text", value: children };
- }
- backReferences.push({
- type: "element",
- tagName: "a",
- properties: {
- href: "#" + clobberPrefix + "fnref-" + safeId + (rereferenceIndex > 1 ? "-" + rereferenceIndex : ""),
- dataFootnoteBackref: "",
- ariaLabel: typeof footnoteBackLabel === "string" ? footnoteBackLabel : footnoteBackLabel(referenceIndex, rereferenceIndex),
- className: ["data-footnote-backref"]
- },
- children: Array.isArray(children) ? children : [children]
- });
- }
- const tail = content3[content3.length - 1];
- if (tail && tail.type === "element" && tail.tagName === "p") {
- const tailTail = tail.children[tail.children.length - 1];
- if (tailTail && tailTail.type === "text") {
- tailTail.value += " ";
- } else {
- tail.children.push({ type: "text", value: " " });
- }
- tail.children.push(...backReferences);
- } else {
- content3.push(...backReferences);
- }
- const listItem2 = {
- type: "element",
- tagName: "li",
- properties: { id: clobberPrefix + "fn-" + safeId },
- children: state.wrap(content3, true)
- };
- state.patch(definition2, listItem2);
- listItems.push(listItem2);
- }
- if (listItems.length === 0) {
- return;
- }
- return {
- type: "element",
- tagName: "section",
- properties: { dataFootnotes: true, className: ["footnotes"] },
- children: [
- {
- type: "element",
- tagName: footnoteLabelTagName,
- properties: {
- ...esm_default(footnoteLabelProperties),
- id: "footnote-label"
- },
- children: [{ type: "text", value: footnoteLabel }]
- },
- { type: "text", value: "\n" },
- {
- type: "element",
- tagName: "ol",
- properties: {},
- children: state.wrap(listItems, true)
- },
- { type: "text", value: "\n" }
- ]
- };
- }
- // node_modules/unist-util-visit/lib/index.js
- function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
- let reverse;
- let test;
- let visitor;
- if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
- test = void 0;
- visitor = testOrVisitor;
- reverse = visitorOrReverse;
- } else {
- test = testOrVisitor;
- visitor = visitorOrReverse;
- reverse = maybeReverse;
- }
- visitParents(tree, test, overload, reverse);
- function overload(node2, parents) {
- const parent = parents[parents.length - 1];
- const index2 = parent ? parent.children.indexOf(node2) : void 0;
- return visitor(node2, index2, parent);
- }
- }
- // node_modules/mdast-util-to-hast/lib/state.js
- var own3 = {}.hasOwnProperty;
- var emptyOptions3 = {};
- function createState(tree, options) {
- const settings = options || emptyOptions3;
- const definitionById = /* @__PURE__ */ new Map();
- const footnoteById = /* @__PURE__ */ new Map();
- const footnoteCounts = /* @__PURE__ */ new Map();
- const handlers2 = { ...handlers, ...settings.handlers };
- const state = {
- all: all2,
- applyData,
- definitionById,
- footnoteById,
- footnoteCounts,
- footnoteOrder: [],
- handlers: handlers2,
- one: one3,
- options: settings,
- patch,
- wrap
- };
- visit(tree, function(node2) {
- if (node2.type === "definition" || node2.type === "footnoteDefinition") {
- const map = node2.type === "definition" ? definitionById : footnoteById;
- const id = String(node2.identifier).toUpperCase();
- if (!map.has(id)) {
- map.set(id, node2);
- }
- }
- });
- return state;
- function one3(node2, parent) {
- const type = node2.type;
- const handle = state.handlers[type];
- if (own3.call(state.handlers, type) && handle) {
- return handle(state, node2, parent);
- }
- if (state.options.passThrough && state.options.passThrough.includes(type)) {
- if ("children" in node2) {
- const { children, ...shallow } = node2;
- const result = esm_default(shallow);
- result.children = state.all(node2);
- return result;
- }
- return esm_default(node2);
- }
- const unknown = state.options.unknownHandler || defaultUnknownHandler;
- return unknown(state, node2, parent);
- }
- function all2(parent) {
- const values2 = [];
- if ("children" in parent) {
- const nodes = parent.children;
- let index2 = -1;
- while (++index2 < nodes.length) {
- const result = state.one(nodes[index2], parent);
- if (result) {
- if (index2 && nodes[index2 - 1].type === "break") {
- if (!Array.isArray(result) && result.type === "text") {
- result.value = trimMarkdownSpaceStart(result.value);
- }
- if (!Array.isArray(result) && result.type === "element") {
- const head = result.children[0];
- if (head && head.type === "text") {
- head.value = trimMarkdownSpaceStart(head.value);
- }
- }
- }
- if (Array.isArray(result)) {
- values2.push(...result);
- } else {
- values2.push(result);
- }
- }
- }
- }
- return values2;
- }
- }
- function patch(from, to) {
- if (from.position) to.position = position(from);
- }
- function applyData(from, to) {
- let result = to;
- if (from && from.data) {
- const hName = from.data.hName;
- const hChildren = from.data.hChildren;
- const hProperties = from.data.hProperties;
- if (typeof hName === "string") {
- if (result.type === "element") {
- result.tagName = hName;
- } else {
- const children = "children" in result ? result.children : [result];
- result = { type: "element", tagName: hName, properties: {}, children };
- }
- }
- if (result.type === "element" && hProperties) {
- Object.assign(result.properties, esm_default(hProperties));
- }
- if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) {
- result.children = hChildren;
- }
- }
- return result;
- }
- function defaultUnknownHandler(state, node2) {
- const data = node2.data || {};
- const result = "value" in node2 && !(own3.call(data, "hProperties") || own3.call(data, "hChildren")) ? { type: "text", value: node2.value } : {
- type: "element",
- tagName: "div",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- function wrap(nodes, loose) {
- const result = [];
- let index2 = -1;
- if (loose) {
- result.push({ type: "text", value: "\n" });
- }
- while (++index2 < nodes.length) {
- if (index2) result.push({ type: "text", value: "\n" });
- result.push(nodes[index2]);
- }
- if (loose && nodes.length > 0) {
- result.push({ type: "text", value: "\n" });
- }
- return result;
- }
- function trimMarkdownSpaceStart(value) {
- let index2 = 0;
- let code2 = value.charCodeAt(index2);
- while (code2 === 9 || code2 === 32) {
- index2++;
- code2 = value.charCodeAt(index2);
- }
- return value.slice(index2);
- }
- // node_modules/mdast-util-to-hast/lib/index.js
- function toHast(tree, options) {
- const state = createState(tree, options);
- const node2 = state.one(tree, void 0);
- const foot = footer(state);
- const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] };
- if (foot) {
- ok("children" in result);
- result.children.push({ type: "text", value: "\n" }, foot);
- }
- return result;
- }
- // node_modules/remark-rehype/lib/index.js
- function remarkRehype(destination, options) {
- if (destination && "run" in destination) {
- return async function(tree, file) {
- const hastTree = (
- /** @type {HastRoot} */
- toHast(tree, { file, ...options })
- );
- await destination.run(hastTree, file);
- };
- }
- return function(tree, file) {
- return (
- /** @type {HastRoot} */
- toHast(tree, { file, ...destination || options })
- );
- };
- }
- // node_modules/bail/index.js
- function bail(error) {
- if (error) {
- throw error;
- }
- }
- // node_modules/unified/lib/index.js
- var import_extend = __toESM(require_extend(), 1);
- // node_modules/is-plain-obj/index.js
- function isPlainObject(value) {
- if (typeof value !== "object" || value === null) {
- return false;
- }
- const prototype = Object.getPrototypeOf(value);
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
- }
- // node_modules/trough/lib/index.js
- function trough() {
- const fns = [];
- const pipeline = { run, use };
- return pipeline;
- function run(...values2) {
- let middlewareIndex = -1;
- const callback = values2.pop();
- if (typeof callback !== "function") {
- throw new TypeError("Expected function as last argument, not " + callback);
- }
- next(null, ...values2);
- function next(error, ...output) {
- const fn = fns[++middlewareIndex];
- let index2 = -1;
- if (error) {
- callback(error);
- return;
- }
- while (++index2 < values2.length) {
- if (output[index2] === null || output[index2] === void 0) {
- output[index2] = values2[index2];
- }
- }
- values2 = output;
- if (fn) {
- wrap2(fn, next)(...output);
- } else {
- callback(null, ...output);
- }
- }
- }
- function use(middelware) {
- if (typeof middelware !== "function") {
- throw new TypeError(
- "Expected `middelware` to be a function, not " + middelware
- );
- }
- fns.push(middelware);
- return pipeline;
- }
- }
- function wrap2(middleware, callback) {
- let called;
- return wrapped;
- function wrapped(...parameters) {
- const fnExpectsCallback = middleware.length > parameters.length;
- let result;
- if (fnExpectsCallback) {
- parameters.push(done);
- }
- try {
- result = middleware.apply(this, parameters);
- } catch (error) {
- const exception = (
- /** @type {Error} */
- error
- );
- if (fnExpectsCallback && called) {
- throw exception;
- }
- return done(exception);
- }
- if (!fnExpectsCallback) {
- if (result && result.then && typeof result.then === "function") {
- result.then(then, done);
- } else if (result instanceof Error) {
- done(result);
- } else {
- then(result);
- }
- }
- }
- function done(error, ...output) {
- if (!called) {
- called = true;
- callback(error, ...output);
- }
- }
- function then(value) {
- done(null, value);
- }
- }
- // node_modules/vfile/lib/minpath.browser.js
- var minpath = { basename, dirname, extname, join, sep: "/" };
- function basename(path, extname2) {
- if (extname2 !== void 0 && typeof extname2 !== "string") {
- throw new TypeError('"ext" argument must be a string');
- }
- assertPath(path);
- let start2 = 0;
- let end = -1;
- let index2 = path.length;
- let seenNonSlash;
- if (extname2 === void 0 || extname2.length === 0 || extname2.length > path.length) {
- while (index2--) {
- if (path.codePointAt(index2) === 47) {
- if (seenNonSlash) {
- start2 = index2 + 1;
- break;
- }
- } else if (end < 0) {
- seenNonSlash = true;
- end = index2 + 1;
- }
- }
- return end < 0 ? "" : path.slice(start2, end);
- }
- if (extname2 === path) {
- return "";
- }
- let firstNonSlashEnd = -1;
- let extnameIndex = extname2.length - 1;
- while (index2--) {
- if (path.codePointAt(index2) === 47) {
- if (seenNonSlash) {
- start2 = index2 + 1;
- break;
- }
- } else {
- if (firstNonSlashEnd < 0) {
- seenNonSlash = true;
- firstNonSlashEnd = index2 + 1;
- }
- if (extnameIndex > -1) {
- if (path.codePointAt(index2) === extname2.codePointAt(extnameIndex--)) {
- if (extnameIndex < 0) {
- end = index2;
- }
- } else {
- extnameIndex = -1;
- end = firstNonSlashEnd;
- }
- }
- }
- }
- if (start2 === end) {
- end = firstNonSlashEnd;
- } else if (end < 0) {
- end = path.length;
- }
- return path.slice(start2, end);
- }
- function dirname(path) {
- assertPath(path);
- if (path.length === 0) {
- return ".";
- }
- let end = -1;
- let index2 = path.length;
- let unmatchedSlash;
- while (--index2) {
- if (path.codePointAt(index2) === 47) {
- if (unmatchedSlash) {
- end = index2;
- break;
- }
- } else if (!unmatchedSlash) {
- unmatchedSlash = true;
- }
- }
- return end < 0 ? path.codePointAt(0) === 47 ? "/" : "." : end === 1 && path.codePointAt(0) === 47 ? "//" : path.slice(0, end);
- }
- function extname(path) {
- assertPath(path);
- let index2 = path.length;
- let end = -1;
- let startPart = 0;
- let startDot = -1;
- let preDotState = 0;
- let unmatchedSlash;
- while (index2--) {
- const code2 = path.codePointAt(index2);
- if (code2 === 47) {
- if (unmatchedSlash) {
- startPart = index2 + 1;
- break;
- }
- continue;
- }
- if (end < 0) {
- unmatchedSlash = true;
- end = index2 + 1;
- }
- if (code2 === 46) {
- if (startDot < 0) {
- startDot = index2;
- } else if (preDotState !== 1) {
- preDotState = 1;
- }
- } else if (startDot > -1) {
- preDotState = -1;
- }
- }
- if (startDot < 0 || end < 0 || // We saw a non-dot character immediately before the dot.
- preDotState === 0 || // The (right-most) trimmed path component is exactly `..`.
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return "";
- }
- return path.slice(startDot, end);
- }
- function join(...segments) {
- let index2 = -1;
- let joined;
- while (++index2 < segments.length) {
- assertPath(segments[index2]);
- if (segments[index2]) {
- joined = joined === void 0 ? segments[index2] : joined + "/" + segments[index2];
- }
- }
- return joined === void 0 ? "." : normalize(joined);
- }
- function normalize(path) {
- assertPath(path);
- const absolute = path.codePointAt(0) === 47;
- let value = normalizeString(path, !absolute);
- if (value.length === 0 && !absolute) {
- value = ".";
- }
- if (value.length > 0 && path.codePointAt(path.length - 1) === 47) {
- value += "/";
- }
- return absolute ? "/" + value : value;
- }
- function normalizeString(path, allowAboveRoot) {
- let result = "";
- let lastSegmentLength = 0;
- let lastSlash = -1;
- let dots = 0;
- let index2 = -1;
- let code2;
- let lastSlashIndex;
- while (++index2 <= path.length) {
- if (index2 < path.length) {
- code2 = path.codePointAt(index2);
- } else if (code2 === 47) {
- break;
- } else {
- code2 = 47;
- }
- if (code2 === 47) {
- if (lastSlash === index2 - 1 || dots === 1) {
- } else if (lastSlash !== index2 - 1 && dots === 2) {
- if (result.length < 2 || lastSegmentLength !== 2 || result.codePointAt(result.length - 1) !== 46 || result.codePointAt(result.length - 2) !== 46) {
- if (result.length > 2) {
- lastSlashIndex = result.lastIndexOf("/");
- if (lastSlashIndex !== result.length - 1) {
- if (lastSlashIndex < 0) {
- result = "";
- lastSegmentLength = 0;
- } else {
- result = result.slice(0, lastSlashIndex);
- lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
- }
- lastSlash = index2;
- dots = 0;
- continue;
- }
- } else if (result.length > 0) {
- result = "";
- lastSegmentLength = 0;
- lastSlash = index2;
- dots = 0;
- continue;
- }
- }
- if (allowAboveRoot) {
- result = result.length > 0 ? result + "/.." : "..";
- lastSegmentLength = 2;
- }
- } else {
- if (result.length > 0) {
- result += "/" + path.slice(lastSlash + 1, index2);
- } else {
- result = path.slice(lastSlash + 1, index2);
- }
- lastSegmentLength = index2 - lastSlash - 1;
- }
- lastSlash = index2;
- dots = 0;
- } else if (code2 === 46 && dots > -1) {
- dots++;
- } else {
- dots = -1;
- }
- }
- return result;
- }
- function assertPath(path) {
- if (typeof path !== "string") {
- throw new TypeError(
- "Path must be a string. Received " + JSON.stringify(path)
- );
- }
- }
- // node_modules/vfile/lib/minproc.browser.js
- var minproc = { cwd };
- function cwd() {
- return "/";
- }
- // node_modules/vfile/lib/minurl.shared.js
- function isUrl(fileUrlOrPath) {
- return Boolean(
- fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine.
- fileUrlOrPath.auth === void 0
- );
- }
- // node_modules/vfile/lib/minurl.browser.js
- function urlToPath(path) {
- if (typeof path === "string") {
- path = new URL(path);
- } else if (!isUrl(path)) {
- const error = new TypeError(
- 'The "path" argument must be of type string or an instance of URL. Received `' + path + "`"
- );
- error.code = "ERR_INVALID_ARG_TYPE";
- throw error;
- }
- if (path.protocol !== "file:") {
- const error = new TypeError("The URL must be of scheme file");
- error.code = "ERR_INVALID_URL_SCHEME";
- throw error;
- }
- return getPathFromURLPosix(path);
- }
- function getPathFromURLPosix(url) {
- if (url.hostname !== "") {
- const error = new TypeError(
- 'File URL host must be "localhost" or empty on darwin'
- );
- error.code = "ERR_INVALID_FILE_URL_HOST";
- throw error;
- }
- const pathname = url.pathname;
- let index2 = -1;
- while (++index2 < pathname.length) {
- if (pathname.codePointAt(index2) === 37 && pathname.codePointAt(index2 + 1) === 50) {
- const third = pathname.codePointAt(index2 + 2);
- if (third === 70 || third === 102) {
- const error = new TypeError(
- "File URL path must not include encoded / characters"
- );
- error.code = "ERR_INVALID_FILE_URL_PATH";
- throw error;
- }
- }
- }
- return decodeURIComponent(pathname);
- }
- // node_modules/vfile/lib/index.js
- var order = (
- /** @type {const} */
- [
- "history",
- "path",
- "basename",
- "stem",
- "extname",
- "dirname"
- ]
- );
- var VFile = class {
- /**
- * Create a new virtual file.
- *
- * `options` is treated as:
- *
- * * `string` or `Uint8Array` — `{value: options}`
- * * `URL` — `{path: options}`
- * * `VFile` — shallow copies its data over to the new file
- * * `object` — all fields are shallow copied over to the new file
- *
- * Path related fields are set in the following order (least specific to
- * most specific): `history`, `path`, `basename`, `stem`, `extname`,
- * `dirname`.
- *
- * You cannot set `dirname` or `extname` without setting either `history`,
- * `path`, `basename`, or `stem` too.
- *
- * @param {Compatible | null | undefined} [value]
- * File value.
- * @returns
- * New instance.
- */
- constructor(value) {
- let options;
- if (!value) {
- options = {};
- } else if (isUrl(value)) {
- options = { path: value };
- } else if (typeof value === "string" || isUint8Array(value)) {
- options = { value };
- } else {
- options = value;
- }
- this.cwd = "cwd" in options ? "" : minproc.cwd();
- this.data = {};
- this.history = [];
- this.messages = [];
- this.value;
- this.map;
- this.result;
- this.stored;
- let index2 = -1;
- while (++index2 < order.length) {
- const field2 = order[index2];
- if (field2 in options && options[field2] !== void 0 && options[field2] !== null) {
- this[field2] = field2 === "history" ? [...options[field2]] : options[field2];
- }
- }
- let field;
- for (field in options) {
- if (!order.includes(field)) {
- this[field] = options[field];
- }
- }
- }
- /**
- * Get the basename (including extname) (example: `'index.min.js'`).
- *
- * @returns {string | undefined}
- * Basename.
- */
- get basename() {
- return typeof this.path === "string" ? minpath.basename(this.path) : void 0;
- }
- /**
- * Set basename (including extname) (`'index.min.js'`).
- *
- * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
- * on windows).
- * Cannot be nullified (use `file.path = file.dirname` instead).
- *
- * @param {string} basename
- * Basename.
- * @returns {undefined}
- * Nothing.
- */
- set basename(basename2) {
- assertNonEmpty(basename2, "basename");
- assertPart(basename2, "basename");
- this.path = minpath.join(this.dirname || "", basename2);
- }
- /**
- * Get the parent path (example: `'~'`).
- *
- * @returns {string | undefined}
- * Dirname.
- */
- get dirname() {
- return typeof this.path === "string" ? minpath.dirname(this.path) : void 0;
- }
- /**
- * Set the parent path (example: `'~'`).
- *
- * Cannot be set if there’s no `path` yet.
- *
- * @param {string | undefined} dirname
- * Dirname.
- * @returns {undefined}
- * Nothing.
- */
- set dirname(dirname2) {
- assertPath2(this.basename, "dirname");
- this.path = minpath.join(dirname2 || "", this.basename);
- }
- /**
- * Get the extname (including dot) (example: `'.js'`).
- *
- * @returns {string | undefined}
- * Extname.
- */
- get extname() {
- return typeof this.path === "string" ? minpath.extname(this.path) : void 0;
- }
- /**
- * Set the extname (including dot) (example: `'.js'`).
- *
- * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
- * on windows).
- * Cannot be set if there’s no `path` yet.
- *
- * @param {string | undefined} extname
- * Extname.
- * @returns {undefined}
- * Nothing.
- */
- set extname(extname2) {
- assertPart(extname2, "extname");
- assertPath2(this.dirname, "extname");
- if (extname2) {
- if (extname2.codePointAt(0) !== 46) {
- throw new Error("`extname` must start with `.`");
- }
- if (extname2.includes(".", 1)) {
- throw new Error("`extname` cannot contain multiple dots");
- }
- }
- this.path = minpath.join(this.dirname, this.stem + (extname2 || ""));
- }
- /**
- * Get the full path (example: `'~/index.min.js'`).
- *
- * @returns {string}
- * Path.
- */
- get path() {
- return this.history[this.history.length - 1];
- }
- /**
- * Set the full path (example: `'~/index.min.js'`).
- *
- * Cannot be nullified.
- * You can set a file URL (a `URL` object with a `file:` protocol) which will
- * be turned into a path with `url.fileURLToPath`.
- *
- * @param {URL | string} path
- * Path.
- * @returns {undefined}
- * Nothing.
- */
- set path(path) {
- if (isUrl(path)) {
- path = urlToPath(path);
- }
- assertNonEmpty(path, "path");
- if (this.path !== path) {
- this.history.push(path);
- }
- }
- /**
- * Get the stem (basename w/o extname) (example: `'index.min'`).
- *
- * @returns {string | undefined}
- * Stem.
- */
- get stem() {
- return typeof this.path === "string" ? minpath.basename(this.path, this.extname) : void 0;
- }
- /**
- * Set the stem (basename w/o extname) (example: `'index.min'`).
- *
- * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
- * on windows).
- * Cannot be nullified (use `file.path = file.dirname` instead).
- *
- * @param {string} stem
- * Stem.
- * @returns {undefined}
- * Nothing.
- */
- set stem(stem) {
- assertNonEmpty(stem, "stem");
- assertPart(stem, "stem");
- this.path = minpath.join(this.dirname || "", stem + (this.extname || ""));
- }
- // Normal prototypal methods.
- /**
- * Create a fatal message for `reason` associated with the file.
- *
- * The `fatal` field of the message is set to `true` (error; file not usable)
- * and the `file` field is set to the current file path.
- * The message is added to the `messages` field on `file`.
- *
- * > 🪦 **Note**: also has obsolete signatures.
- *
- * @overload
- * @param {string} reason
- * @param {MessageOptions | null | undefined} [options]
- * @returns {never}
- *
- * @overload
- * @param {string} reason
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns {never}
- *
- * @overload
- * @param {string} reason
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns {never}
- *
- * @overload
- * @param {string} reason
- * @param {string | null | undefined} [origin]
- * @returns {never}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns {never}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns {never}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {string | null | undefined} [origin]
- * @returns {never}
- *
- * @param {Error | VFileMessage | string} causeOrReason
- * Reason for message, should use markdown.
- * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
- * Configuration (optional).
- * @param {string | null | undefined} [origin]
- * Place in code where the message originates (example:
- * `'my-package:my-rule'` or `'my-rule'`).
- * @returns {never}
- * Never.
- * @throws {VFileMessage}
- * Message.
- */
- fail(causeOrReason, optionsOrParentOrPlace, origin) {
- const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
- message.fatal = true;
- throw message;
- }
- /**
- * Create an info message for `reason` associated with the file.
- *
- * The `fatal` field of the message is set to `undefined` (info; change
- * likely not needed) and the `file` field is set to the current file path.
- * The message is added to the `messages` field on `file`.
- *
- * > 🪦 **Note**: also has obsolete signatures.
- *
- * @overload
- * @param {string} reason
- * @param {MessageOptions | null | undefined} [options]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {string} reason
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {string} reason
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {string} reason
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @param {Error | VFileMessage | string} causeOrReason
- * Reason for message, should use markdown.
- * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
- * Configuration (optional).
- * @param {string | null | undefined} [origin]
- * Place in code where the message originates (example:
- * `'my-package:my-rule'` or `'my-rule'`).
- * @returns {VFileMessage}
- * Message.
- */
- info(causeOrReason, optionsOrParentOrPlace, origin) {
- const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
- message.fatal = void 0;
- return message;
- }
- /**
- * Create a message for `reason` associated with the file.
- *
- * The `fatal` field of the message is set to `false` (warning; change may be
- * needed) and the `file` field is set to the current file path.
- * The message is added to the `messages` field on `file`.
- *
- * > 🪦 **Note**: also has obsolete signatures.
- *
- * @overload
- * @param {string} reason
- * @param {MessageOptions | null | undefined} [options]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {string} reason
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {string} reason
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {string} reason
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Node | NodeLike | null | undefined} parent
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {Point | Position | null | undefined} place
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @overload
- * @param {Error | VFileMessage} cause
- * @param {string | null | undefined} [origin]
- * @returns {VFileMessage}
- *
- * @param {Error | VFileMessage | string} causeOrReason
- * Reason for message, should use markdown.
- * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
- * Configuration (optional).
- * @param {string | null | undefined} [origin]
- * Place in code where the message originates (example:
- * `'my-package:my-rule'` or `'my-rule'`).
- * @returns {VFileMessage}
- * Message.
- */
- message(causeOrReason, optionsOrParentOrPlace, origin) {
- const message = new VFileMessage(
- // @ts-expect-error: the overloads are fine.
- causeOrReason,
- optionsOrParentOrPlace,
- origin
- );
- if (this.path) {
- message.name = this.path + ":" + message.name;
- message.file = this.path;
- }
- message.fatal = false;
- this.messages.push(message);
- return message;
- }
- /**
- * Serialize the file.
- *
- * > **Note**: which encodings are supported depends on the engine.
- * > For info on Node.js, see:
- * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
- *
- * @param {string | null | undefined} [encoding='utf8']
- * Character encoding to understand `value` as when it’s a `Uint8Array`
- * (default: `'utf-8'`).
- * @returns {string}
- * Serialized file.
- */
- toString(encoding) {
- if (this.value === void 0) {
- return "";
- }
- if (typeof this.value === "string") {
- return this.value;
- }
- const decoder = new TextDecoder(encoding || void 0);
- return decoder.decode(this.value);
- }
- };
- function assertPart(part, name2) {
- if (part && part.includes(minpath.sep)) {
- throw new Error(
- "`" + name2 + "` cannot be a path: did not expect `" + minpath.sep + "`"
- );
- }
- }
- function assertNonEmpty(part, name2) {
- if (!part) {
- throw new Error("`" + name2 + "` cannot be empty");
- }
- }
- function assertPath2(path, name2) {
- if (!path) {
- throw new Error("Setting `" + name2 + "` requires `path` to be set too");
- }
- }
- function isUint8Array(value) {
- return Boolean(
- value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
- );
- }
- // node_modules/unified/lib/callable-instance.js
- var CallableInstance = (
- /**
- * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
- */
- /** @type {unknown} */
- /**
- * @this {Function}
- * @param {string | symbol} property
- * @returns {(...parameters: Array<unknown>) => unknown}
- */
- (function(property) {
- const self2 = this;
- const constr = self2.constructor;
- const proto = (
- /** @type {Record<string | symbol, Function>} */
- // Prototypes do exist.
- // type-coverage:ignore-next-line
- constr.prototype
- );
- const value = proto[property];
- const apply = function() {
- return value.apply(apply, arguments);
- };
- Object.setPrototypeOf(apply, proto);
- return apply;
- })
- );
- // node_modules/unified/lib/index.js
- var own4 = {}.hasOwnProperty;
- var Processor = class _Processor extends CallableInstance {
- /**
- * Create a processor.
- */
- constructor() {
- super("copy");
- this.Compiler = void 0;
- this.Parser = void 0;
- this.attachers = [];
- this.compiler = void 0;
- this.freezeIndex = -1;
- this.frozen = void 0;
- this.namespace = {};
- this.parser = void 0;
- this.transformers = trough();
- }
- /**
- * Copy a processor.
- *
- * @deprecated
- * This is a private internal method and should not be used.
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- * New *unfrozen* processor ({@linkcode Processor}) that is
- * configured to work the same as its ancestor.
- * When the descendant processor is configured in the future it does not
- * affect the ancestral processor.
- */
- copy() {
- const destination = (
- /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */
- new _Processor()
- );
- let index2 = -1;
- while (++index2 < this.attachers.length) {
- const attacher = this.attachers[index2];
- destination.use(...attacher);
- }
- destination.data((0, import_extend.default)(true, {}, this.namespace));
- return destination;
- }
- /**
- * Configure the processor with info available to all plugins.
- * Information is stored in an object.
- *
- * Typically, options can be given to a specific plugin, but sometimes it
- * makes sense to have information shared with several plugins.
- * For example, a list of HTML elements that are self-closing, which is
- * needed during all phases.
- *
- * > **Note**: setting information cannot occur on *frozen* processors.
- * > Call the processor first to create a new unfrozen processor.
- *
- * > **Note**: to register custom data in TypeScript, augment the
- * > {@linkcode Data} interface.
- *
- * @example
- * This example show how to get and set info:
- *
- * ```js
- * import {unified} from 'unified'
- *
- * const processor = unified().data('alpha', 'bravo')
- *
- * processor.data('alpha') // => 'bravo'
- *
- * processor.data() // => {alpha: 'bravo'}
- *
- * processor.data({charlie: 'delta'})
- *
- * processor.data() // => {charlie: 'delta'}
- * ```
- *
- * @template {keyof Data} Key
- *
- * @overload
- * @returns {Data}
- *
- * @overload
- * @param {Data} dataset
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- *
- * @overload
- * @param {Key} key
- * @returns {Data[Key]}
- *
- * @overload
- * @param {Key} key
- * @param {Data[Key]} value
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- *
- * @param {Data | Key} [key]
- * Key to get or set, or entire dataset to set, or nothing to get the
- * entire dataset (optional).
- * @param {Data[Key]} [value]
- * Value to set (optional).
- * @returns {unknown}
- * The current processor when setting, the value at `key` when getting, or
- * the entire dataset when getting without key.
- */
- data(key, value) {
- if (typeof key === "string") {
- if (arguments.length === 2) {
- assertUnfrozen("data", this.frozen);
- this.namespace[key] = value;
- return this;
- }
- return own4.call(this.namespace, key) && this.namespace[key] || void 0;
- }
- if (key) {
- assertUnfrozen("data", this.frozen);
- this.namespace = key;
- return this;
- }
- return this.namespace;
- }
- /**
- * Freeze a processor.
- *
- * Frozen processors are meant to be extended and not to be configured
- * directly.
- *
- * When a processor is frozen it cannot be unfrozen.
- * New processors working the same way can be created by calling the
- * processor.
- *
- * It’s possible to freeze processors explicitly by calling `.freeze()`.
- * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
- * `.stringify()`, `.process()`, or `.processSync()` are called.
- *
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- * The current processor.
- */
- freeze() {
- if (this.frozen) {
- return this;
- }
- const self2 = (
- /** @type {Processor} */
- /** @type {unknown} */
- this
- );
- while (++this.freezeIndex < this.attachers.length) {
- const [attacher, ...options] = this.attachers[this.freezeIndex];
- if (options[0] === false) {
- continue;
- }
- if (options[0] === true) {
- options[0] = void 0;
- }
- const transformer = attacher.call(self2, ...options);
- if (typeof transformer === "function") {
- this.transformers.use(transformer);
- }
- }
- this.frozen = true;
- this.freezeIndex = Number.POSITIVE_INFINITY;
- return this;
- }
- /**
- * Parse text to a syntax tree.
- *
- * > **Note**: `parse` freezes the processor if not already *frozen*.
- *
- * > **Note**: `parse` performs the parse phase, not the run phase or other
- * > phases.
- *
- * @param {Compatible | undefined} [file]
- * file to parse (optional); typically `string` or `VFile`; any value
- * accepted as `x` in `new VFile(x)`.
- * @returns {ParseTree extends undefined ? Node : ParseTree}
- * Syntax tree representing `file`.
- */
- parse(file) {
- this.freeze();
- const realFile = vfile(file);
- const parser = this.parser || this.Parser;
- assertParser("parse", parser);
- return parser(String(realFile), realFile);
- }
- /**
- * Process the given file as configured on the processor.
- *
- * > **Note**: `process` freezes the processor if not already *frozen*.
- *
- * > **Note**: `process` performs the parse, run, and stringify phases.
- *
- * @overload
- * @param {Compatible | undefined} file
- * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
- * @returns {undefined}
- *
- * @overload
- * @param {Compatible | undefined} [file]
- * @returns {Promise<VFileWithOutput<CompileResult>>}
- *
- * @param {Compatible | undefined} [file]
- * File (optional); typically `string` or `VFile`]; any value accepted as
- * `x` in `new VFile(x)`.
- * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
- * Callback (optional).
- * @returns {Promise<VFile> | undefined}
- * Nothing if `done` is given.
- * Otherwise a promise, rejected with a fatal error or resolved with the
- * processed file.
- *
- * The parsed, transformed, and compiled value is available at
- * `file.value` (see note).
- *
- * > **Note**: unified typically compiles by serializing: most
- * > compilers return `string` (or `Uint8Array`).
- * > Some compilers, such as the one configured with
- * > [`rehype-react`][rehype-react], return other values (in this case, a
- * > React tree).
- * > If you’re using a compiler that doesn’t serialize, expect different
- * > result values.
- * >
- * > To register custom results in TypeScript, add them to
- * > {@linkcode CompileResultMap}.
- *
- * [rehype-react]: https://github.com/rehypejs/rehype-react
- */
- process(file, done) {
- const self2 = this;
- this.freeze();
- assertParser("process", this.parser || this.Parser);
- assertCompiler("process", this.compiler || this.Compiler);
- return done ? executor(void 0, done) : new Promise(executor);
- function executor(resolve, reject) {
- const realFile = vfile(file);
- const parseTree = (
- /** @type {HeadTree extends undefined ? Node : HeadTree} */
- /** @type {unknown} */
- self2.parse(realFile)
- );
- self2.run(parseTree, realFile, function(error, tree, file2) {
- if (error || !tree || !file2) {
- return realDone(error);
- }
- const compileTree = (
- /** @type {CompileTree extends undefined ? Node : CompileTree} */
- /** @type {unknown} */
- tree
- );
- const compileResult = self2.stringify(compileTree, file2);
- if (looksLikeAValue(compileResult)) {
- file2.value = compileResult;
- } else {
- file2.result = compileResult;
- }
- realDone(
- error,
- /** @type {VFileWithOutput<CompileResult>} */
- file2
- );
- });
- function realDone(error, file2) {
- if (error || !file2) {
- reject(error);
- } else if (resolve) {
- resolve(file2);
- } else {
- ok(done, "`done` is defined if `resolve` is not");
- done(void 0, file2);
- }
- }
- }
- }
- /**
- * Process the given file as configured on the processor.
- *
- * An error is thrown if asynchronous transforms are configured.
- *
- * > **Note**: `processSync` freezes the processor if not already *frozen*.
- *
- * > **Note**: `processSync` performs the parse, run, and stringify phases.
- *
- * @param {Compatible | undefined} [file]
- * File (optional); typically `string` or `VFile`; any value accepted as
- * `x` in `new VFile(x)`.
- * @returns {VFileWithOutput<CompileResult>}
- * The processed file.
- *
- * The parsed, transformed, and compiled value is available at
- * `file.value` (see note).
- *
- * > **Note**: unified typically compiles by serializing: most
- * > compilers return `string` (or `Uint8Array`).
- * > Some compilers, such as the one configured with
- * > [`rehype-react`][rehype-react], return other values (in this case, a
- * > React tree).
- * > If you’re using a compiler that doesn’t serialize, expect different
- * > result values.
- * >
- * > To register custom results in TypeScript, add them to
- * > {@linkcode CompileResultMap}.
- *
- * [rehype-react]: https://github.com/rehypejs/rehype-react
- */
- processSync(file) {
- let complete = false;
- let result;
- this.freeze();
- assertParser("processSync", this.parser || this.Parser);
- assertCompiler("processSync", this.compiler || this.Compiler);
- this.process(file, realDone);
- assertDone("processSync", "process", complete);
- ok(result, "we either bailed on an error or have a tree");
- return result;
- function realDone(error, file2) {
- complete = true;
- bail(error);
- result = file2;
- }
- }
- /**
- * Run *transformers* on a syntax tree.
- *
- * > **Note**: `run` freezes the processor if not already *frozen*.
- *
- * > **Note**: `run` performs the run phase, not other phases.
- *
- * @overload
- * @param {HeadTree extends undefined ? Node : HeadTree} tree
- * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
- * @returns {undefined}
- *
- * @overload
- * @param {HeadTree extends undefined ? Node : HeadTree} tree
- * @param {Compatible | undefined} file
- * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
- * @returns {undefined}
- *
- * @overload
- * @param {HeadTree extends undefined ? Node : HeadTree} tree
- * @param {Compatible | undefined} [file]
- * @returns {Promise<TailTree extends undefined ? Node : TailTree>}
- *
- * @param {HeadTree extends undefined ? Node : HeadTree} tree
- * Tree to transform and inspect.
- * @param {(
- * RunCallback<TailTree extends undefined ? Node : TailTree> |
- * Compatible
- * )} [file]
- * File associated with `node` (optional); any value accepted as `x` in
- * `new VFile(x)`.
- * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
- * Callback (optional).
- * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
- * Nothing if `done` is given.
- * Otherwise, a promise rejected with a fatal error or resolved with the
- * transformed tree.
- */
- run(tree, file, done) {
- assertNode(tree);
- this.freeze();
- const transformers = this.transformers;
- if (!done && typeof file === "function") {
- done = file;
- file = void 0;
- }
- return done ? executor(void 0, done) : new Promise(executor);
- function executor(resolve, reject) {
- ok(
- typeof file !== "function",
- "`file` can’t be a `done` anymore, we checked"
- );
- const realFile = vfile(file);
- transformers.run(tree, realFile, realDone);
- function realDone(error, outputTree, file2) {
- const resultingTree = (
- /** @type {TailTree extends undefined ? Node : TailTree} */
- outputTree || tree
- );
- if (error) {
- reject(error);
- } else if (resolve) {
- resolve(resultingTree);
- } else {
- ok(done, "`done` is defined if `resolve` is not");
- done(void 0, resultingTree, file2);
- }
- }
- }
- }
- /**
- * Run *transformers* on a syntax tree.
- *
- * An error is thrown if asynchronous transforms are configured.
- *
- * > **Note**: `runSync` freezes the processor if not already *frozen*.
- *
- * > **Note**: `runSync` performs the run phase, not other phases.
- *
- * @param {HeadTree extends undefined ? Node : HeadTree} tree
- * Tree to transform and inspect.
- * @param {Compatible | undefined} [file]
- * File associated with `node` (optional); any value accepted as `x` in
- * `new VFile(x)`.
- * @returns {TailTree extends undefined ? Node : TailTree}
- * Transformed tree.
- */
- runSync(tree, file) {
- let complete = false;
- let result;
- this.run(tree, file, realDone);
- assertDone("runSync", "run", complete);
- ok(result, "we either bailed on an error or have a tree");
- return result;
- function realDone(error, tree2) {
- bail(error);
- result = tree2;
- complete = true;
- }
- }
- /**
- * Compile a syntax tree.
- *
- * > **Note**: `stringify` freezes the processor if not already *frozen*.
- *
- * > **Note**: `stringify` performs the stringify phase, not the run phase
- * > or other phases.
- *
- * @param {CompileTree extends undefined ? Node : CompileTree} tree
- * Tree to compile.
- * @param {Compatible | undefined} [file]
- * File associated with `node` (optional); any value accepted as `x` in
- * `new VFile(x)`.
- * @returns {CompileResult extends undefined ? Value : CompileResult}
- * Textual representation of the tree (see note).
- *
- * > **Note**: unified typically compiles by serializing: most compilers
- * > return `string` (or `Uint8Array`).
- * > Some compilers, such as the one configured with
- * > [`rehype-react`][rehype-react], return other values (in this case, a
- * > React tree).
- * > If you’re using a compiler that doesn’t serialize, expect different
- * > result values.
- * >
- * > To register custom results in TypeScript, add them to
- * > {@linkcode CompileResultMap}.
- *
- * [rehype-react]: https://github.com/rehypejs/rehype-react
- */
- stringify(tree, file) {
- this.freeze();
- const realFile = vfile(file);
- const compiler2 = this.compiler || this.Compiler;
- assertCompiler("stringify", compiler2);
- assertNode(tree);
- return compiler2(tree, realFile);
- }
- /**
- * Configure the processor to use a plugin, a list of usable values, or a
- * preset.
- *
- * If the processor is already using a plugin, the previous plugin
- * configuration is changed based on the options that are passed in.
- * In other words, the plugin is not added a second time.
- *
- * > **Note**: `use` cannot be called on *frozen* processors.
- * > Call the processor first to create a new unfrozen processor.
- *
- * @example
- * There are many ways to pass plugins to `.use()`.
- * This example gives an overview:
- *
- * ```js
- * import {unified} from 'unified'
- *
- * unified()
- * // Plugin with options:
- * .use(pluginA, {x: true, y: true})
- * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
- * .use(pluginA, {y: false, z: true})
- * // Plugins:
- * .use([pluginB, pluginC])
- * // Two plugins, the second with options:
- * .use([pluginD, [pluginE, {}]])
- * // Preset with plugins and settings:
- * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
- * // Settings only:
- * .use({settings: {position: false}})
- * ```
- *
- * @template {Array<unknown>} [Parameters=[]]
- * @template {Node | string | undefined} [Input=undefined]
- * @template [Output=Input]
- *
- * @overload
- * @param {Preset | null | undefined} [preset]
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- *
- * @overload
- * @param {PluggableList} list
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- *
- * @overload
- * @param {Plugin<Parameters, Input, Output>} plugin
- * @param {...(Parameters | [boolean])} parameters
- * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
- *
- * @param {PluggableList | Plugin | Preset | null | undefined} value
- * Usable value.
- * @param {...unknown} parameters
- * Parameters, when a plugin is given as a usable value.
- * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
- * Current processor.
- */
- use(value, ...parameters) {
- const attachers = this.attachers;
- const namespace = this.namespace;
- assertUnfrozen("use", this.frozen);
- if (value === null || value === void 0) {
- } else if (typeof value === "function") {
- addPlugin(value, parameters);
- } else if (typeof value === "object") {
- if (Array.isArray(value)) {
- addList(value);
- } else {
- addPreset(value);
- }
- } else {
- throw new TypeError("Expected usable value, not `" + value + "`");
- }
- return this;
- function add(value2) {
- if (typeof value2 === "function") {
- addPlugin(value2, []);
- } else if (typeof value2 === "object") {
- if (Array.isArray(value2)) {
- const [plugin, ...parameters2] = (
- /** @type {PluginTuple<Array<unknown>>} */
- value2
- );
- addPlugin(plugin, parameters2);
- } else {
- addPreset(value2);
- }
- } else {
- throw new TypeError("Expected usable value, not `" + value2 + "`");
- }
- }
- function addPreset(result) {
- if (!("plugins" in result) && !("settings" in result)) {
- throw new Error(
- "Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither"
- );
- }
- addList(result.plugins);
- if (result.settings) {
- namespace.settings = (0, import_extend.default)(true, namespace.settings, result.settings);
- }
- }
- function addList(plugins) {
- let index2 = -1;
- if (plugins === null || plugins === void 0) {
- } else if (Array.isArray(plugins)) {
- while (++index2 < plugins.length) {
- const thing = plugins[index2];
- add(thing);
- }
- } else {
- throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
- }
- }
- function addPlugin(plugin, parameters2) {
- let index2 = -1;
- let entryIndex = -1;
- while (++index2 < attachers.length) {
- if (attachers[index2][0] === plugin) {
- entryIndex = index2;
- break;
- }
- }
- if (entryIndex === -1) {
- attachers.push([plugin, ...parameters2]);
- } else if (parameters2.length > 0) {
- let [primary, ...rest] = parameters2;
- const currentPrimary = attachers[entryIndex][1];
- if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
- primary = (0, import_extend.default)(true, currentPrimary, primary);
- }
- attachers[entryIndex] = [plugin, primary, ...rest];
- }
- }
- }
- };
- var unified = new Processor().freeze();
- function assertParser(name2, value) {
- if (typeof value !== "function") {
- throw new TypeError("Cannot `" + name2 + "` without `parser`");
- }
- }
- function assertCompiler(name2, value) {
- if (typeof value !== "function") {
- throw new TypeError("Cannot `" + name2 + "` without `compiler`");
- }
- }
- function assertUnfrozen(name2, frozen) {
- if (frozen) {
- throw new Error(
- "Cannot call `" + name2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
- );
- }
- }
- function assertNode(node2) {
- if (!isPlainObject(node2) || typeof node2.type !== "string") {
- throw new TypeError("Expected node, got `" + node2 + "`");
- }
- }
- function assertDone(name2, asyncName, complete) {
- if (!complete) {
- throw new Error(
- "`" + name2 + "` finished async. Use `" + asyncName + "` instead"
- );
- }
- }
- function vfile(value) {
- return looksLikeAVFile(value) ? value : new VFile(value);
- }
- function looksLikeAVFile(value) {
- return Boolean(
- value && typeof value === "object" && "message" in value && "messages" in value
- );
- }
- function looksLikeAValue(value) {
- return typeof value === "string" || isUint8Array2(value);
- }
- function isUint8Array2(value) {
- return Boolean(
- value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
- );
- }
- // node_modules/react-markdown/lib/index.js
- var changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
- var emptyPlugins = [];
- var emptyRemarkRehypeOptions = { allowDangerousHtml: true };
- var safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
- var deprecations = [
- { from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
- { from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
- {
- from: "allowNode",
- id: "replace-allownode-allowedtypes-and-disallowedtypes",
- to: "allowElement"
- },
- {
- from: "allowedTypes",
- id: "replace-allownode-allowedtypes-and-disallowedtypes",
- to: "allowedElements"
- },
- { from: "className", id: "remove-classname" },
- {
- from: "disallowedTypes",
- id: "replace-allownode-allowedtypes-and-disallowedtypes",
- to: "disallowedElements"
- },
- { from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
- { from: "includeElementIndex", id: "#remove-includeelementindex" },
- {
- from: "includeNodeIndex",
- id: "change-includenodeindex-to-includeelementindex"
- },
- { from: "linkTarget", id: "remove-linktarget" },
- { from: "plugins", id: "change-plugins-to-remarkplugins", to: "remarkPlugins" },
- { from: "rawSourcePos", id: "#remove-rawsourcepos" },
- { from: "renderers", id: "change-renderers-to-components", to: "components" },
- { from: "source", id: "change-source-to-children", to: "children" },
- { from: "sourcePos", id: "#remove-sourcepos" },
- { from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
- { from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" }
- ];
- function Markdown(options) {
- const processor = createProcessor(options);
- const file = createFile(options);
- return post(processor.runSync(processor.parse(file), file), options);
- }
- async function MarkdownAsync(options) {
- const processor = createProcessor(options);
- const file = createFile(options);
- const tree = await processor.run(processor.parse(file), file);
- return post(tree, options);
- }
- function MarkdownHooks(options) {
- const processor = createProcessor(options);
- const [error, setError] = (0, import_react.useState)(
- /** @type {Error | undefined} */
- void 0
- );
- const [tree, setTree] = (0, import_react.useState)(
- /** @type {Root | undefined} */
- void 0
- );
- (0, import_react.useEffect)(
- function() {
- let cancelled = false;
- const file = createFile(options);
- processor.run(processor.parse(file), file, function(error2, tree2) {
- if (!cancelled) {
- setError(error2);
- setTree(tree2);
- }
- });
- return function() {
- cancelled = true;
- };
- },
- [
- options.children,
- options.rehypePlugins,
- options.remarkPlugins,
- options.remarkRehypeOptions
- ]
- );
- if (error) throw error;
- return tree ? post(tree, options) : options.fallback;
- }
- function createProcessor(options) {
- const rehypePlugins = options.rehypePlugins || emptyPlugins;
- const remarkPlugins = options.remarkPlugins || emptyPlugins;
- const remarkRehypeOptions = options.remarkRehypeOptions ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions } : emptyRemarkRehypeOptions;
- const processor = unified().use(remarkParse).use(remarkPlugins).use(remarkRehype, remarkRehypeOptions).use(rehypePlugins);
- return processor;
- }
- function createFile(options) {
- const children = options.children || "";
- const file = new VFile();
- if (typeof children === "string") {
- file.value = children;
- } else {
- unreachable(
- "Unexpected value `" + children + "` for `children` prop, expected `string`"
- );
- }
- return file;
- }
- function post(tree, options) {
- const allowedElements = options.allowedElements;
- const allowElement = options.allowElement;
- const components = options.components;
- const disallowedElements = options.disallowedElements;
- const skipHtml = options.skipHtml;
- const unwrapDisallowed = options.unwrapDisallowed;
- const urlTransform = options.urlTransform || defaultUrlTransform;
- for (const deprecation of deprecations) {
- if (Object.hasOwn(options, deprecation.from)) {
- unreachable(
- "Unexpected `" + deprecation.from + "` prop, " + (deprecation.to ? "use `" + deprecation.to + "` instead" : "remove it") + " (see <" + changelog + "#" + deprecation.id + "> for more info)"
- );
- }
- }
- if (allowedElements && disallowedElements) {
- unreachable(
- "Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"
- );
- }
- visit(tree, transform);
- return toJsxRuntime(tree, {
- Fragment: import_jsx_runtime.Fragment,
- components,
- ignoreInvalidStyle: true,
- jsx: import_jsx_runtime.jsx,
- jsxs: import_jsx_runtime.jsxs,
- passKeys: true,
- passNode: true
- });
- function transform(node2, index2, parent) {
- if (node2.type === "raw" && parent && typeof index2 === "number") {
- if (skipHtml) {
- parent.children.splice(index2, 1);
- } else {
- parent.children[index2] = { type: "text", value: node2.value };
- }
- return index2;
- }
- if (node2.type === "element") {
- let key;
- for (key in urlAttributes) {
- if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
- const value = node2.properties[key];
- const test = urlAttributes[key];
- if (test === null || test.includes(node2.tagName)) {
- node2.properties[key] = urlTransform(String(value || ""), key, node2);
- }
- }
- }
- }
- if (node2.type === "element") {
- let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
- if (!remove && allowElement && typeof index2 === "number") {
- remove = !allowElement(node2, index2, parent);
- }
- if (remove && parent && typeof index2 === "number") {
- if (unwrapDisallowed && node2.children) {
- parent.children.splice(index2, 1, ...node2.children);
- } else {
- parent.children.splice(index2, 1);
- }
- return index2;
- }
- }
- }
- }
- function defaultUrlTransform(value) {
- const colon = value.indexOf(":");
- const questionMark = value.indexOf("?");
- const numberSign = value.indexOf("#");
- const slash = value.indexOf("/");
- if (
- // If there is no protocol, it’s relative.
- colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
- slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
- safeProtocol.test(value.slice(0, colon))
- ) {
- return value;
- }
- return "";
- }
- export {
- MarkdownAsync,
- MarkdownHooks,
- Markdown as default,
- defaultUrlTransform
- };
- //# sourceMappingURL=react-markdown.js.map
|