react-markdown.js 282 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355
  1. import {
  2. asciiAlpha,
  3. asciiAlphanumeric,
  4. asciiAtext,
  5. asciiControl,
  6. asciiDigit,
  7. asciiHexDigit,
  8. asciiPunctuation,
  9. codes,
  10. constants,
  11. factorySpace,
  12. markdownLineEnding,
  13. markdownLineEndingOrSpace,
  14. markdownSpace,
  15. ok,
  16. types,
  17. unicodePunctuation,
  18. unicodeWhitespace,
  19. unreachable,
  20. values
  21. } from "./chunk-EIBGEDEJ.js";
  22. import {
  23. find,
  24. hastToReact,
  25. html,
  26. stringify,
  27. stringify2,
  28. svg,
  29. visitParents
  30. } from "./chunk-BDV6QPQQ.js";
  31. import {
  32. require_jsx_runtime
  33. } from "./chunk-VTS4FBCU.js";
  34. import {
  35. require_react
  36. } from "./chunk-6KCF6AHO.js";
  37. import {
  38. __commonJS,
  39. __export,
  40. __toESM
  41. } from "./chunk-DC5AMYBS.js";
  42. // node_modules/inline-style-parser/cjs/index.js
  43. var require_cjs = __commonJS({
  44. "node_modules/inline-style-parser/cjs/index.js"(exports, module) {
  45. "use strict";
  46. var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
  47. var NEWLINE_REGEX = /\n/g;
  48. var WHITESPACE_REGEX = /^\s*/;
  49. var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
  50. var COLON_REGEX = /^:\s*/;
  51. var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
  52. var SEMICOLON_REGEX = /^[;\s]*/;
  53. var TRIM_REGEX = /^\s+|\s+$/g;
  54. var NEWLINE = "\n";
  55. var FORWARD_SLASH = "/";
  56. var ASTERISK = "*";
  57. var EMPTY_STRING = "";
  58. var TYPE_COMMENT = "comment";
  59. var TYPE_DECLARATION = "declaration";
  60. function index2(style, options) {
  61. if (typeof style !== "string") {
  62. throw new TypeError("First argument must be a string");
  63. }
  64. if (!style) return [];
  65. options = options || {};
  66. var lineno = 1;
  67. var column = 1;
  68. function updatePosition(str) {
  69. var lines = str.match(NEWLINE_REGEX);
  70. if (lines) lineno += lines.length;
  71. var i = str.lastIndexOf(NEWLINE);
  72. column = ~i ? str.length - i : column + str.length;
  73. }
  74. function position3() {
  75. var start2 = { line: lineno, column };
  76. return function(node2) {
  77. node2.position = new Position(start2);
  78. whitespace2();
  79. return node2;
  80. };
  81. }
  82. function Position(start2) {
  83. this.start = start2;
  84. this.end = { line: lineno, column };
  85. this.source = options.source;
  86. }
  87. Position.prototype.content = style;
  88. function error(msg) {
  89. var err = new Error(
  90. options.source + ":" + lineno + ":" + column + ": " + msg
  91. );
  92. err.reason = msg;
  93. err.filename = options.source;
  94. err.line = lineno;
  95. err.column = column;
  96. err.source = style;
  97. if (options.silent) ;
  98. else {
  99. throw err;
  100. }
  101. }
  102. function match(re2) {
  103. var m = re2.exec(style);
  104. if (!m) return;
  105. var str = m[0];
  106. updatePosition(str);
  107. style = style.slice(str.length);
  108. return m;
  109. }
  110. function whitespace2() {
  111. match(WHITESPACE_REGEX);
  112. }
  113. function comments(rules) {
  114. var c;
  115. rules = rules || [];
  116. while (c = comment()) {
  117. if (c !== false) {
  118. rules.push(c);
  119. }
  120. }
  121. return rules;
  122. }
  123. function comment() {
  124. var pos = position3();
  125. if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
  126. var i = 2;
  127. while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) {
  128. ++i;
  129. }
  130. i += 2;
  131. if (EMPTY_STRING === style.charAt(i - 1)) {
  132. return error("End of comment missing");
  133. }
  134. var str = style.slice(2, i - 2);
  135. column += 2;
  136. updatePosition(str);
  137. style = style.slice(i);
  138. column += 2;
  139. return pos({
  140. type: TYPE_COMMENT,
  141. comment: str
  142. });
  143. }
  144. function declaration() {
  145. var pos = position3();
  146. var prop = match(PROPERTY_REGEX);
  147. if (!prop) return;
  148. comment();
  149. if (!match(COLON_REGEX)) return error("property missing ':'");
  150. var val = match(VALUE_REGEX);
  151. var ret = pos({
  152. type: TYPE_DECLARATION,
  153. property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
  154. value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
  155. });
  156. match(SEMICOLON_REGEX);
  157. return ret;
  158. }
  159. function declarations() {
  160. var decls = [];
  161. comments(decls);
  162. var decl;
  163. while (decl = declaration()) {
  164. if (decl !== false) {
  165. decls.push(decl);
  166. comments(decls);
  167. }
  168. }
  169. return decls;
  170. }
  171. whitespace2();
  172. return declarations();
  173. }
  174. function trim(str) {
  175. return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
  176. }
  177. module.exports = index2;
  178. }
  179. });
  180. // node_modules/style-to-object/cjs/index.js
  181. var require_cjs2 = __commonJS({
  182. "node_modules/style-to-object/cjs/index.js"(exports) {
  183. "use strict";
  184. var __importDefault = exports && exports.__importDefault || function(mod) {
  185. return mod && mod.__esModule ? mod : { "default": mod };
  186. };
  187. Object.defineProperty(exports, "__esModule", { value: true });
  188. exports.default = StyleToObject;
  189. var inline_style_parser_1 = __importDefault(require_cjs());
  190. function StyleToObject(style, iterator) {
  191. let styleObject = null;
  192. if (!style || typeof style !== "string") {
  193. return styleObject;
  194. }
  195. const declarations = (0, inline_style_parser_1.default)(style);
  196. const hasIterator = typeof iterator === "function";
  197. declarations.forEach((declaration) => {
  198. if (declaration.type !== "declaration") {
  199. return;
  200. }
  201. const { property, value } = declaration;
  202. if (hasIterator) {
  203. iterator(property, value, declaration);
  204. } else if (value) {
  205. styleObject = styleObject || {};
  206. styleObject[property] = value;
  207. }
  208. });
  209. return styleObject;
  210. }
  211. }
  212. });
  213. // node_modules/style-to-js/cjs/utilities.js
  214. var require_utilities = __commonJS({
  215. "node_modules/style-to-js/cjs/utilities.js"(exports) {
  216. "use strict";
  217. Object.defineProperty(exports, "__esModule", { value: true });
  218. exports.camelCase = void 0;
  219. var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
  220. var HYPHEN_REGEX = /-([a-z])/g;
  221. var NO_HYPHEN_REGEX = /^[^-]+$/;
  222. var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
  223. var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
  224. var skipCamelCase = function(property) {
  225. return !property || NO_HYPHEN_REGEX.test(property) || CUSTOM_PROPERTY_REGEX.test(property);
  226. };
  227. var capitalize = function(match, character) {
  228. return character.toUpperCase();
  229. };
  230. var trimHyphen = function(match, prefix) {
  231. return "".concat(prefix, "-");
  232. };
  233. var camelCase = function(property, options) {
  234. if (options === void 0) {
  235. options = {};
  236. }
  237. if (skipCamelCase(property)) {
  238. return property;
  239. }
  240. property = property.toLowerCase();
  241. if (options.reactCompat) {
  242. property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
  243. } else {
  244. property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
  245. }
  246. return property.replace(HYPHEN_REGEX, capitalize);
  247. };
  248. exports.camelCase = camelCase;
  249. }
  250. });
  251. // node_modules/style-to-js/cjs/index.js
  252. var require_cjs3 = __commonJS({
  253. "node_modules/style-to-js/cjs/index.js"(exports, module) {
  254. "use strict";
  255. var __importDefault = exports && exports.__importDefault || function(mod) {
  256. return mod && mod.__esModule ? mod : { "default": mod };
  257. };
  258. var style_to_object_1 = __importDefault(require_cjs2());
  259. var utilities_1 = require_utilities();
  260. function StyleToJS(style, options) {
  261. var output = {};
  262. if (!style || typeof style !== "string") {
  263. return output;
  264. }
  265. (0, style_to_object_1.default)(style, function(property, value) {
  266. if (property && value) {
  267. output[(0, utilities_1.camelCase)(property, options)] = value;
  268. }
  269. });
  270. return output;
  271. }
  272. StyleToJS.default = StyleToJS;
  273. module.exports = StyleToJS;
  274. }
  275. });
  276. // node_modules/ms/index.js
  277. var require_ms = __commonJS({
  278. "node_modules/ms/index.js"(exports, module) {
  279. var s = 1e3;
  280. var m = s * 60;
  281. var h = m * 60;
  282. var d = h * 24;
  283. var w = d * 7;
  284. var y = d * 365.25;
  285. module.exports = function(val, options) {
  286. options = options || {};
  287. var type = typeof val;
  288. if (type === "string" && val.length > 0) {
  289. return parse2(val);
  290. } else if (type === "number" && isFinite(val)) {
  291. return options.long ? fmtLong(val) : fmtShort(val);
  292. }
  293. throw new Error(
  294. "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
  295. );
  296. };
  297. function parse2(str) {
  298. str = String(str);
  299. if (str.length > 100) {
  300. return;
  301. }
  302. 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(
  303. str
  304. );
  305. if (!match) {
  306. return;
  307. }
  308. var n = parseFloat(match[1]);
  309. var type = (match[2] || "ms").toLowerCase();
  310. switch (type) {
  311. case "years":
  312. case "year":
  313. case "yrs":
  314. case "yr":
  315. case "y":
  316. return n * y;
  317. case "weeks":
  318. case "week":
  319. case "w":
  320. return n * w;
  321. case "days":
  322. case "day":
  323. case "d":
  324. return n * d;
  325. case "hours":
  326. case "hour":
  327. case "hrs":
  328. case "hr":
  329. case "h":
  330. return n * h;
  331. case "minutes":
  332. case "minute":
  333. case "mins":
  334. case "min":
  335. case "m":
  336. return n * m;
  337. case "seconds":
  338. case "second":
  339. case "secs":
  340. case "sec":
  341. case "s":
  342. return n * s;
  343. case "milliseconds":
  344. case "millisecond":
  345. case "msecs":
  346. case "msec":
  347. case "ms":
  348. return n;
  349. default:
  350. return void 0;
  351. }
  352. }
  353. function fmtShort(ms) {
  354. var msAbs = Math.abs(ms);
  355. if (msAbs >= d) {
  356. return Math.round(ms / d) + "d";
  357. }
  358. if (msAbs >= h) {
  359. return Math.round(ms / h) + "h";
  360. }
  361. if (msAbs >= m) {
  362. return Math.round(ms / m) + "m";
  363. }
  364. if (msAbs >= s) {
  365. return Math.round(ms / s) + "s";
  366. }
  367. return ms + "ms";
  368. }
  369. function fmtLong(ms) {
  370. var msAbs = Math.abs(ms);
  371. if (msAbs >= d) {
  372. return plural(ms, msAbs, d, "day");
  373. }
  374. if (msAbs >= h) {
  375. return plural(ms, msAbs, h, "hour");
  376. }
  377. if (msAbs >= m) {
  378. return plural(ms, msAbs, m, "minute");
  379. }
  380. if (msAbs >= s) {
  381. return plural(ms, msAbs, s, "second");
  382. }
  383. return ms + " ms";
  384. }
  385. function plural(ms, msAbs, n, name2) {
  386. var isPlural = msAbs >= n * 1.5;
  387. return Math.round(ms / n) + " " + name2 + (isPlural ? "s" : "");
  388. }
  389. }
  390. });
  391. // node_modules/debug/src/common.js
  392. var require_common = __commonJS({
  393. "node_modules/debug/src/common.js"(exports, module) {
  394. function setup(env2) {
  395. createDebug2.debug = createDebug2;
  396. createDebug2.default = createDebug2;
  397. createDebug2.coerce = coerce;
  398. createDebug2.disable = disable2;
  399. createDebug2.enable = enable;
  400. createDebug2.enabled = enabled;
  401. createDebug2.humanize = require_ms();
  402. createDebug2.destroy = destroy;
  403. Object.keys(env2).forEach((key) => {
  404. createDebug2[key] = env2[key];
  405. });
  406. createDebug2.names = [];
  407. createDebug2.skips = [];
  408. createDebug2.formatters = {};
  409. function selectColor(namespace) {
  410. let hash = 0;
  411. for (let i = 0; i < namespace.length; i++) {
  412. hash = (hash << 5) - hash + namespace.charCodeAt(i);
  413. hash |= 0;
  414. }
  415. return createDebug2.colors[Math.abs(hash) % createDebug2.colors.length];
  416. }
  417. createDebug2.selectColor = selectColor;
  418. function createDebug2(namespace) {
  419. let prevTime;
  420. let enableOverride = null;
  421. let namespacesCache;
  422. let enabledCache;
  423. function debug2(...args) {
  424. if (!debug2.enabled) {
  425. return;
  426. }
  427. const self2 = debug2;
  428. const curr = Number(/* @__PURE__ */ new Date());
  429. const ms = curr - (prevTime || curr);
  430. self2.diff = ms;
  431. self2.prev = prevTime;
  432. self2.curr = curr;
  433. prevTime = curr;
  434. args[0] = createDebug2.coerce(args[0]);
  435. if (typeof args[0] !== "string") {
  436. args.unshift("%O");
  437. }
  438. let index2 = 0;
  439. args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
  440. if (match === "%%") {
  441. return "%";
  442. }
  443. index2++;
  444. const formatter = createDebug2.formatters[format];
  445. if (typeof formatter === "function") {
  446. const val = args[index2];
  447. match = formatter.call(self2, val);
  448. args.splice(index2, 1);
  449. index2--;
  450. }
  451. return match;
  452. });
  453. createDebug2.formatArgs.call(self2, args);
  454. const logFn = self2.log || createDebug2.log;
  455. logFn.apply(self2, args);
  456. }
  457. debug2.namespace = namespace;
  458. debug2.useColors = createDebug2.useColors();
  459. debug2.color = createDebug2.selectColor(namespace);
  460. debug2.extend = extend2;
  461. debug2.destroy = createDebug2.destroy;
  462. Object.defineProperty(debug2, "enabled", {
  463. enumerable: true,
  464. configurable: false,
  465. get: () => {
  466. if (enableOverride !== null) {
  467. return enableOverride;
  468. }
  469. if (namespacesCache !== createDebug2.namespaces) {
  470. namespacesCache = createDebug2.namespaces;
  471. enabledCache = createDebug2.enabled(namespace);
  472. }
  473. return enabledCache;
  474. },
  475. set: (v) => {
  476. enableOverride = v;
  477. }
  478. });
  479. if (typeof createDebug2.init === "function") {
  480. createDebug2.init(debug2);
  481. }
  482. return debug2;
  483. }
  484. function extend2(namespace, delimiter) {
  485. const newDebug = createDebug2(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
  486. newDebug.log = this.log;
  487. return newDebug;
  488. }
  489. function enable(namespaces) {
  490. createDebug2.save(namespaces);
  491. createDebug2.namespaces = namespaces;
  492. createDebug2.names = [];
  493. createDebug2.skips = [];
  494. const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
  495. for (const ns of split) {
  496. if (ns[0] === "-") {
  497. createDebug2.skips.push(ns.slice(1));
  498. } else {
  499. createDebug2.names.push(ns);
  500. }
  501. }
  502. }
  503. function matchesTemplate(search2, template) {
  504. let searchIndex = 0;
  505. let templateIndex = 0;
  506. let starIndex = -1;
  507. let matchIndex = 0;
  508. while (searchIndex < search2.length) {
  509. if (templateIndex < template.length && (template[templateIndex] === search2[searchIndex] || template[templateIndex] === "*")) {
  510. if (template[templateIndex] === "*") {
  511. starIndex = templateIndex;
  512. matchIndex = searchIndex;
  513. templateIndex++;
  514. } else {
  515. searchIndex++;
  516. templateIndex++;
  517. }
  518. } else if (starIndex !== -1) {
  519. templateIndex = starIndex + 1;
  520. matchIndex++;
  521. searchIndex = matchIndex;
  522. } else {
  523. return false;
  524. }
  525. }
  526. while (templateIndex < template.length && template[templateIndex] === "*") {
  527. templateIndex++;
  528. }
  529. return templateIndex === template.length;
  530. }
  531. function disable2() {
  532. const namespaces = [
  533. ...createDebug2.names,
  534. ...createDebug2.skips.map((namespace) => "-" + namespace)
  535. ].join(",");
  536. createDebug2.enable("");
  537. return namespaces;
  538. }
  539. function enabled(name2) {
  540. for (const skip of createDebug2.skips) {
  541. if (matchesTemplate(name2, skip)) {
  542. return false;
  543. }
  544. }
  545. for (const ns of createDebug2.names) {
  546. if (matchesTemplate(name2, ns)) {
  547. return true;
  548. }
  549. }
  550. return false;
  551. }
  552. function coerce(val) {
  553. if (val instanceof Error) {
  554. return val.stack || val.message;
  555. }
  556. return val;
  557. }
  558. function destroy() {
  559. console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
  560. }
  561. createDebug2.enable(createDebug2.load());
  562. return createDebug2;
  563. }
  564. module.exports = setup;
  565. }
  566. });
  567. // node_modules/debug/src/browser.js
  568. var require_browser = __commonJS({
  569. "node_modules/debug/src/browser.js"(exports, module) {
  570. exports.formatArgs = formatArgs;
  571. exports.save = save;
  572. exports.load = load;
  573. exports.useColors = useColors;
  574. exports.storage = localstorage();
  575. exports.destroy = /* @__PURE__ */ (() => {
  576. let warned = false;
  577. return () => {
  578. if (!warned) {
  579. warned = true;
  580. console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
  581. }
  582. };
  583. })();
  584. exports.colors = [
  585. "#0000CC",
  586. "#0000FF",
  587. "#0033CC",
  588. "#0033FF",
  589. "#0066CC",
  590. "#0066FF",
  591. "#0099CC",
  592. "#0099FF",
  593. "#00CC00",
  594. "#00CC33",
  595. "#00CC66",
  596. "#00CC99",
  597. "#00CCCC",
  598. "#00CCFF",
  599. "#3300CC",
  600. "#3300FF",
  601. "#3333CC",
  602. "#3333FF",
  603. "#3366CC",
  604. "#3366FF",
  605. "#3399CC",
  606. "#3399FF",
  607. "#33CC00",
  608. "#33CC33",
  609. "#33CC66",
  610. "#33CC99",
  611. "#33CCCC",
  612. "#33CCFF",
  613. "#6600CC",
  614. "#6600FF",
  615. "#6633CC",
  616. "#6633FF",
  617. "#66CC00",
  618. "#66CC33",
  619. "#9900CC",
  620. "#9900FF",
  621. "#9933CC",
  622. "#9933FF",
  623. "#99CC00",
  624. "#99CC33",
  625. "#CC0000",
  626. "#CC0033",
  627. "#CC0066",
  628. "#CC0099",
  629. "#CC00CC",
  630. "#CC00FF",
  631. "#CC3300",
  632. "#CC3333",
  633. "#CC3366",
  634. "#CC3399",
  635. "#CC33CC",
  636. "#CC33FF",
  637. "#CC6600",
  638. "#CC6633",
  639. "#CC9900",
  640. "#CC9933",
  641. "#CCCC00",
  642. "#CCCC33",
  643. "#FF0000",
  644. "#FF0033",
  645. "#FF0066",
  646. "#FF0099",
  647. "#FF00CC",
  648. "#FF00FF",
  649. "#FF3300",
  650. "#FF3333",
  651. "#FF3366",
  652. "#FF3399",
  653. "#FF33CC",
  654. "#FF33FF",
  655. "#FF6600",
  656. "#FF6633",
  657. "#FF9900",
  658. "#FF9933",
  659. "#FFCC00",
  660. "#FFCC33"
  661. ];
  662. function useColors() {
  663. if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
  664. return true;
  665. }
  666. if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  667. return false;
  668. }
  669. let m;
  670. return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
  671. typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
  672. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  673. 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
  674. typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
  675. }
  676. function formatArgs(args) {
  677. args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
  678. if (!this.useColors) {
  679. return;
  680. }
  681. const c = "color: " + this.color;
  682. args.splice(1, 0, c, "color: inherit");
  683. let index2 = 0;
  684. let lastC = 0;
  685. args[0].replace(/%[a-zA-Z%]/g, (match) => {
  686. if (match === "%%") {
  687. return;
  688. }
  689. index2++;
  690. if (match === "%c") {
  691. lastC = index2;
  692. }
  693. });
  694. args.splice(lastC, 0, c);
  695. }
  696. exports.log = console.debug || console.log || (() => {
  697. });
  698. function save(namespaces) {
  699. try {
  700. if (namespaces) {
  701. exports.storage.setItem("debug", namespaces);
  702. } else {
  703. exports.storage.removeItem("debug");
  704. }
  705. } catch (error) {
  706. }
  707. }
  708. function load() {
  709. let r;
  710. try {
  711. r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
  712. } catch (error) {
  713. }
  714. if (!r && typeof process !== "undefined" && "env" in process) {
  715. r = process.env.DEBUG;
  716. }
  717. return r;
  718. }
  719. function localstorage() {
  720. try {
  721. return localStorage;
  722. } catch (error) {
  723. }
  724. }
  725. module.exports = require_common()(exports);
  726. var { formatters } = module.exports;
  727. formatters.j = function(v) {
  728. try {
  729. return JSON.stringify(v);
  730. } catch (error) {
  731. return "[UnexpectedJSONParseError]: " + error.message;
  732. }
  733. };
  734. }
  735. });
  736. // node_modules/extend/index.js
  737. var require_extend = __commonJS({
  738. "node_modules/extend/index.js"(exports, module) {
  739. "use strict";
  740. var hasOwn = Object.prototype.hasOwnProperty;
  741. var toStr = Object.prototype.toString;
  742. var defineProperty = Object.defineProperty;
  743. var gOPD = Object.getOwnPropertyDescriptor;
  744. var isArray = function isArray2(arr) {
  745. if (typeof Array.isArray === "function") {
  746. return Array.isArray(arr);
  747. }
  748. return toStr.call(arr) === "[object Array]";
  749. };
  750. var isPlainObject2 = function isPlainObject3(obj) {
  751. if (!obj || toStr.call(obj) !== "[object Object]") {
  752. return false;
  753. }
  754. var hasOwnConstructor = hasOwn.call(obj, "constructor");
  755. var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
  756. if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
  757. return false;
  758. }
  759. var key;
  760. for (key in obj) {
  761. }
  762. return typeof key === "undefined" || hasOwn.call(obj, key);
  763. };
  764. var setProperty = function setProperty2(target, options) {
  765. if (defineProperty && options.name === "__proto__") {
  766. defineProperty(target, options.name, {
  767. enumerable: true,
  768. configurable: true,
  769. value: options.newValue,
  770. writable: true
  771. });
  772. } else {
  773. target[options.name] = options.newValue;
  774. }
  775. };
  776. var getProperty = function getProperty2(obj, name2) {
  777. if (name2 === "__proto__") {
  778. if (!hasOwn.call(obj, name2)) {
  779. return void 0;
  780. } else if (gOPD) {
  781. return gOPD(obj, name2).value;
  782. }
  783. }
  784. return obj[name2];
  785. };
  786. module.exports = function extend2() {
  787. var options, name2, src, copy, copyIsArray, clone;
  788. var target = arguments[0];
  789. var i = 1;
  790. var length = arguments.length;
  791. var deep = false;
  792. if (typeof target === "boolean") {
  793. deep = target;
  794. target = arguments[1] || {};
  795. i = 2;
  796. }
  797. if (target == null || typeof target !== "object" && typeof target !== "function") {
  798. target = {};
  799. }
  800. for (; i < length; ++i) {
  801. options = arguments[i];
  802. if (options != null) {
  803. for (name2 in options) {
  804. src = getProperty(target, name2);
  805. copy = getProperty(options, name2);
  806. if (target !== copy) {
  807. if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray(copy)))) {
  808. if (copyIsArray) {
  809. copyIsArray = false;
  810. clone = src && isArray(src) ? src : [];
  811. } else {
  812. clone = src && isPlainObject2(src) ? src : {};
  813. }
  814. setProperty(target, { name: name2, newValue: extend2(deep, clone, copy) });
  815. } else if (typeof copy !== "undefined") {
  816. setProperty(target, { name: name2, newValue: copy });
  817. }
  818. }
  819. }
  820. }
  821. }
  822. return target;
  823. };
  824. }
  825. });
  826. // node_modules/estree-util-is-identifier-name/lib/index.js
  827. var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
  828. var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
  829. var emptyOptions = {};
  830. function name(name2, options) {
  831. const settings = options || emptyOptions;
  832. const re2 = settings.jsx ? nameReJsx : nameRe;
  833. return re2.test(name2);
  834. }
  835. // node_modules/hast-util-whitespace/lib/index.js
  836. var re = /[ \t\n\f\r]/g;
  837. function whitespace(thing) {
  838. return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
  839. }
  840. function empty(value) {
  841. return value.replace(re, "") === "";
  842. }
  843. // node_modules/hast-util-to-jsx-runtime/lib/index.js
  844. var import_style_to_js = __toESM(require_cjs3(), 1);
  845. // node_modules/unist-util-position/lib/index.js
  846. var pointEnd = point("end");
  847. var pointStart = point("start");
  848. function point(type) {
  849. return point4;
  850. function point4(node2) {
  851. const point5 = node2 && node2.position && node2.position[type] || {};
  852. if (typeof point5.line === "number" && point5.line > 0 && typeof point5.column === "number" && point5.column > 0) {
  853. return {
  854. line: point5.line,
  855. column: point5.column,
  856. offset: typeof point5.offset === "number" && point5.offset > -1 ? point5.offset : void 0
  857. };
  858. }
  859. }
  860. }
  861. function position(node2) {
  862. const start2 = pointStart(node2);
  863. const end = pointEnd(node2);
  864. if (start2 && end) {
  865. return { start: start2, end };
  866. }
  867. }
  868. // node_modules/unist-util-stringify-position/lib/index.js
  869. function stringifyPosition(value) {
  870. if (!value || typeof value !== "object") {
  871. return "";
  872. }
  873. if ("position" in value || "type" in value) {
  874. return position2(value.position);
  875. }
  876. if ("start" in value || "end" in value) {
  877. return position2(value);
  878. }
  879. if ("line" in value || "column" in value) {
  880. return point2(value);
  881. }
  882. return "";
  883. }
  884. function point2(point4) {
  885. return index(point4 && point4.line) + ":" + index(point4 && point4.column);
  886. }
  887. function position2(pos) {
  888. return point2(pos && pos.start) + "-" + point2(pos && pos.end);
  889. }
  890. function index(value) {
  891. return value && typeof value === "number" ? value : 1;
  892. }
  893. // node_modules/vfile-message/lib/index.js
  894. var VFileMessage = class extends Error {
  895. /**
  896. * Create a message for `reason`.
  897. *
  898. * > 🪦 **Note**: also has obsolete signatures.
  899. *
  900. * @overload
  901. * @param {string} reason
  902. * @param {Options | null | undefined} [options]
  903. * @returns
  904. *
  905. * @overload
  906. * @param {string} reason
  907. * @param {Node | NodeLike | null | undefined} parent
  908. * @param {string | null | undefined} [origin]
  909. * @returns
  910. *
  911. * @overload
  912. * @param {string} reason
  913. * @param {Point | Position | null | undefined} place
  914. * @param {string | null | undefined} [origin]
  915. * @returns
  916. *
  917. * @overload
  918. * @param {string} reason
  919. * @param {string | null | undefined} [origin]
  920. * @returns
  921. *
  922. * @overload
  923. * @param {Error | VFileMessage} cause
  924. * @param {Node | NodeLike | null | undefined} parent
  925. * @param {string | null | undefined} [origin]
  926. * @returns
  927. *
  928. * @overload
  929. * @param {Error | VFileMessage} cause
  930. * @param {Point | Position | null | undefined} place
  931. * @param {string | null | undefined} [origin]
  932. * @returns
  933. *
  934. * @overload
  935. * @param {Error | VFileMessage} cause
  936. * @param {string | null | undefined} [origin]
  937. * @returns
  938. *
  939. * @param {Error | VFileMessage | string} causeOrReason
  940. * Reason for message, should use markdown.
  941. * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  942. * Configuration (optional).
  943. * @param {string | null | undefined} [origin]
  944. * Place in code where the message originates (example:
  945. * `'my-package:my-rule'` or `'my-rule'`).
  946. * @returns
  947. * Instance of `VFileMessage`.
  948. */
  949. // eslint-disable-next-line complexity
  950. constructor(causeOrReason, optionsOrParentOrPlace, origin) {
  951. super();
  952. if (typeof optionsOrParentOrPlace === "string") {
  953. origin = optionsOrParentOrPlace;
  954. optionsOrParentOrPlace = void 0;
  955. }
  956. let reason = "";
  957. let options = {};
  958. let legacyCause = false;
  959. if (optionsOrParentOrPlace) {
  960. if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) {
  961. options = { place: optionsOrParentOrPlace };
  962. } else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) {
  963. options = { place: optionsOrParentOrPlace };
  964. } else if ("type" in optionsOrParentOrPlace) {
  965. options = {
  966. ancestors: [optionsOrParentOrPlace],
  967. place: optionsOrParentOrPlace.position
  968. };
  969. } else {
  970. options = { ...optionsOrParentOrPlace };
  971. }
  972. }
  973. if (typeof causeOrReason === "string") {
  974. reason = causeOrReason;
  975. } else if (!options.cause && causeOrReason) {
  976. legacyCause = true;
  977. reason = causeOrReason.message;
  978. options.cause = causeOrReason;
  979. }
  980. if (!options.ruleId && !options.source && typeof origin === "string") {
  981. const index2 = origin.indexOf(":");
  982. if (index2 === -1) {
  983. options.ruleId = origin;
  984. } else {
  985. options.source = origin.slice(0, index2);
  986. options.ruleId = origin.slice(index2 + 1);
  987. }
  988. }
  989. if (!options.place && options.ancestors && options.ancestors) {
  990. const parent = options.ancestors[options.ancestors.length - 1];
  991. if (parent) {
  992. options.place = parent.position;
  993. }
  994. }
  995. const start2 = options.place && "start" in options.place ? options.place.start : options.place;
  996. this.ancestors = options.ancestors || void 0;
  997. this.cause = options.cause || void 0;
  998. this.column = start2 ? start2.column : void 0;
  999. this.fatal = void 0;
  1000. this.file = "";
  1001. this.message = reason;
  1002. this.line = start2 ? start2.line : void 0;
  1003. this.name = stringifyPosition(options.place) || "1:1";
  1004. this.place = options.place || void 0;
  1005. this.reason = this.message;
  1006. this.ruleId = options.ruleId || void 0;
  1007. this.source = options.source || void 0;
  1008. this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : "";
  1009. this.actual = void 0;
  1010. this.expected = void 0;
  1011. this.note = void 0;
  1012. this.url = void 0;
  1013. }
  1014. };
  1015. VFileMessage.prototype.file = "";
  1016. VFileMessage.prototype.name = "";
  1017. VFileMessage.prototype.reason = "";
  1018. VFileMessage.prototype.message = "";
  1019. VFileMessage.prototype.stack = "";
  1020. VFileMessage.prototype.column = void 0;
  1021. VFileMessage.prototype.line = void 0;
  1022. VFileMessage.prototype.ancestors = void 0;
  1023. VFileMessage.prototype.cause = void 0;
  1024. VFileMessage.prototype.fatal = void 0;
  1025. VFileMessage.prototype.place = void 0;
  1026. VFileMessage.prototype.ruleId = void 0;
  1027. VFileMessage.prototype.source = void 0;
  1028. // node_modules/hast-util-to-jsx-runtime/lib/index.js
  1029. var own = {}.hasOwnProperty;
  1030. var emptyMap = /* @__PURE__ */ new Map();
  1031. var cap = /[A-Z]/g;
  1032. var tableElements = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]);
  1033. var tableCellElement = /* @__PURE__ */ new Set(["td", "th"]);
  1034. var docs = "https://github.com/syntax-tree/hast-util-to-jsx-runtime";
  1035. function toJsxRuntime(tree, options) {
  1036. if (!options || options.Fragment === void 0) {
  1037. throw new TypeError("Expected `Fragment` in options");
  1038. }
  1039. const filePath = options.filePath || void 0;
  1040. let create;
  1041. if (options.development) {
  1042. if (typeof options.jsxDEV !== "function") {
  1043. throw new TypeError(
  1044. "Expected `jsxDEV` in options when `development: true`"
  1045. );
  1046. }
  1047. create = developmentCreate(filePath, options.jsxDEV);
  1048. } else {
  1049. if (typeof options.jsx !== "function") {
  1050. throw new TypeError("Expected `jsx` in production options");
  1051. }
  1052. if (typeof options.jsxs !== "function") {
  1053. throw new TypeError("Expected `jsxs` in production options");
  1054. }
  1055. create = productionCreate(filePath, options.jsx, options.jsxs);
  1056. }
  1057. const state = {
  1058. Fragment: options.Fragment,
  1059. ancestors: [],
  1060. components: options.components || {},
  1061. create,
  1062. elementAttributeNameCase: options.elementAttributeNameCase || "react",
  1063. evaluater: options.createEvaluater ? options.createEvaluater() : void 0,
  1064. filePath,
  1065. ignoreInvalidStyle: options.ignoreInvalidStyle || false,
  1066. passKeys: options.passKeys !== false,
  1067. passNode: options.passNode || false,
  1068. schema: options.space === "svg" ? svg : html,
  1069. stylePropertyNameCase: options.stylePropertyNameCase || "dom",
  1070. tableCellAlignToStyle: options.tableCellAlignToStyle !== false
  1071. };
  1072. const result = one(state, tree, void 0);
  1073. if (result && typeof result !== "string") {
  1074. return result;
  1075. }
  1076. return state.create(
  1077. tree,
  1078. state.Fragment,
  1079. { children: result || void 0 },
  1080. void 0
  1081. );
  1082. }
  1083. function one(state, node2, key) {
  1084. if (node2.type === "element") {
  1085. return element(state, node2, key);
  1086. }
  1087. if (node2.type === "mdxFlowExpression" || node2.type === "mdxTextExpression") {
  1088. return mdxExpression(state, node2);
  1089. }
  1090. if (node2.type === "mdxJsxFlowElement" || node2.type === "mdxJsxTextElement") {
  1091. return mdxJsxElement(state, node2, key);
  1092. }
  1093. if (node2.type === "mdxjsEsm") {
  1094. return mdxEsm(state, node2);
  1095. }
  1096. if (node2.type === "root") {
  1097. return root(state, node2, key);
  1098. }
  1099. if (node2.type === "text") {
  1100. return text(state, node2);
  1101. }
  1102. }
  1103. function element(state, node2, key) {
  1104. const parentSchema = state.schema;
  1105. let schema = parentSchema;
  1106. if (node2.tagName.toLowerCase() === "svg" && parentSchema.space === "html") {
  1107. schema = svg;
  1108. state.schema = schema;
  1109. }
  1110. state.ancestors.push(node2);
  1111. const type = findComponentFromName(state, node2.tagName, false);
  1112. const props = createElementProps(state, node2);
  1113. let children = createChildren(state, node2);
  1114. if (tableElements.has(node2.tagName)) {
  1115. children = children.filter(function(child) {
  1116. return typeof child === "string" ? !whitespace(child) : true;
  1117. });
  1118. }
  1119. addNode(state, props, type, node2);
  1120. addChildren(props, children);
  1121. state.ancestors.pop();
  1122. state.schema = parentSchema;
  1123. return state.create(node2, type, props, key);
  1124. }
  1125. function mdxExpression(state, node2) {
  1126. if (node2.data && node2.data.estree && state.evaluater) {
  1127. const program = node2.data.estree;
  1128. const expression = program.body[0];
  1129. ok(expression.type === "ExpressionStatement");
  1130. return (
  1131. /** @type {Child | undefined} */
  1132. state.evaluater.evaluateExpression(expression.expression)
  1133. );
  1134. }
  1135. crashEstree(state, node2.position);
  1136. }
  1137. function mdxEsm(state, node2) {
  1138. if (node2.data && node2.data.estree && state.evaluater) {
  1139. return (
  1140. /** @type {Child | undefined} */
  1141. state.evaluater.evaluateProgram(node2.data.estree)
  1142. );
  1143. }
  1144. crashEstree(state, node2.position);
  1145. }
  1146. function mdxJsxElement(state, node2, key) {
  1147. const parentSchema = state.schema;
  1148. let schema = parentSchema;
  1149. if (node2.name === "svg" && parentSchema.space === "html") {
  1150. schema = svg;
  1151. state.schema = schema;
  1152. }
  1153. state.ancestors.push(node2);
  1154. const type = node2.name === null ? state.Fragment : findComponentFromName(state, node2.name, true);
  1155. const props = createJsxElementProps(state, node2);
  1156. const children = createChildren(state, node2);
  1157. addNode(state, props, type, node2);
  1158. addChildren(props, children);
  1159. state.ancestors.pop();
  1160. state.schema = parentSchema;
  1161. return state.create(node2, type, props, key);
  1162. }
  1163. function root(state, node2, key) {
  1164. const props = {};
  1165. addChildren(props, createChildren(state, node2));
  1166. return state.create(node2, state.Fragment, props, key);
  1167. }
  1168. function text(_, node2) {
  1169. return node2.value;
  1170. }
  1171. function addNode(state, props, type, node2) {
  1172. if (typeof type !== "string" && type !== state.Fragment && state.passNode) {
  1173. props.node = node2;
  1174. }
  1175. }
  1176. function addChildren(props, children) {
  1177. if (children.length > 0) {
  1178. const value = children.length > 1 ? children : children[0];
  1179. if (value) {
  1180. props.children = value;
  1181. }
  1182. }
  1183. }
  1184. function productionCreate(_, jsx2, jsxs2) {
  1185. return create;
  1186. function create(_2, type, props, key) {
  1187. const isStaticChildren = Array.isArray(props.children);
  1188. const fn = isStaticChildren ? jsxs2 : jsx2;
  1189. return key ? fn(type, props, key) : fn(type, props);
  1190. }
  1191. }
  1192. function developmentCreate(filePath, jsxDEV) {
  1193. return create;
  1194. function create(node2, type, props, key) {
  1195. const isStaticChildren = Array.isArray(props.children);
  1196. const point4 = pointStart(node2);
  1197. return jsxDEV(
  1198. type,
  1199. props,
  1200. key,
  1201. isStaticChildren,
  1202. {
  1203. columnNumber: point4 ? point4.column - 1 : void 0,
  1204. fileName: filePath,
  1205. lineNumber: point4 ? point4.line : void 0
  1206. },
  1207. void 0
  1208. );
  1209. }
  1210. }
  1211. function createElementProps(state, node2) {
  1212. const props = {};
  1213. let alignValue;
  1214. let prop;
  1215. for (prop in node2.properties) {
  1216. if (prop !== "children" && own.call(node2.properties, prop)) {
  1217. const result = createProperty(state, prop, node2.properties[prop]);
  1218. if (result) {
  1219. const [key, value] = result;
  1220. if (state.tableCellAlignToStyle && key === "align" && typeof value === "string" && tableCellElement.has(node2.tagName)) {
  1221. alignValue = value;
  1222. } else {
  1223. props[key] = value;
  1224. }
  1225. }
  1226. }
  1227. }
  1228. if (alignValue) {
  1229. const style = (
  1230. /** @type {Style} */
  1231. props.style || (props.style = {})
  1232. );
  1233. style[state.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = alignValue;
  1234. }
  1235. return props;
  1236. }
  1237. function createJsxElementProps(state, node2) {
  1238. const props = {};
  1239. for (const attribute of node2.attributes) {
  1240. if (attribute.type === "mdxJsxExpressionAttribute") {
  1241. if (attribute.data && attribute.data.estree && state.evaluater) {
  1242. const program = attribute.data.estree;
  1243. const expression = program.body[0];
  1244. ok(expression.type === "ExpressionStatement");
  1245. const objectExpression = expression.expression;
  1246. ok(objectExpression.type === "ObjectExpression");
  1247. const property = objectExpression.properties[0];
  1248. ok(property.type === "SpreadElement");
  1249. Object.assign(
  1250. props,
  1251. state.evaluater.evaluateExpression(property.argument)
  1252. );
  1253. } else {
  1254. crashEstree(state, node2.position);
  1255. }
  1256. } else {
  1257. const name2 = attribute.name;
  1258. let value;
  1259. if (attribute.value && typeof attribute.value === "object") {
  1260. if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
  1261. const program = attribute.value.data.estree;
  1262. const expression = program.body[0];
  1263. ok(expression.type === "ExpressionStatement");
  1264. value = state.evaluater.evaluateExpression(expression.expression);
  1265. } else {
  1266. crashEstree(state, node2.position);
  1267. }
  1268. } else {
  1269. value = attribute.value === null ? true : attribute.value;
  1270. }
  1271. props[name2] = /** @type {Props[keyof Props]} */
  1272. value;
  1273. }
  1274. }
  1275. return props;
  1276. }
  1277. function createChildren(state, node2) {
  1278. const children = [];
  1279. let index2 = -1;
  1280. const countsByName = state.passKeys ? /* @__PURE__ */ new Map() : emptyMap;
  1281. while (++index2 < node2.children.length) {
  1282. const child = node2.children[index2];
  1283. let key;
  1284. if (state.passKeys) {
  1285. const name2 = child.type === "element" ? child.tagName : child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement" ? child.name : void 0;
  1286. if (name2) {
  1287. const count = countsByName.get(name2) || 0;
  1288. key = name2 + "-" + count;
  1289. countsByName.set(name2, count + 1);
  1290. }
  1291. }
  1292. const result = one(state, child, key);
  1293. if (result !== void 0) children.push(result);
  1294. }
  1295. return children;
  1296. }
  1297. function createProperty(state, prop, value) {
  1298. const info = find(state.schema, prop);
  1299. if (value === null || value === void 0 || typeof value === "number" && Number.isNaN(value)) {
  1300. return;
  1301. }
  1302. if (Array.isArray(value)) {
  1303. value = info.commaSeparated ? stringify(value) : stringify2(value);
  1304. }
  1305. if (info.property === "style") {
  1306. let styleObject = typeof value === "object" ? value : parseStyle(state, String(value));
  1307. if (state.stylePropertyNameCase === "css") {
  1308. styleObject = transformStylesToCssCasing(styleObject);
  1309. }
  1310. return ["style", styleObject];
  1311. }
  1312. return [
  1313. state.elementAttributeNameCase === "react" && info.space ? hastToReact[info.property] || info.property : info.attribute,
  1314. value
  1315. ];
  1316. }
  1317. function parseStyle(state, value) {
  1318. try {
  1319. return (0, import_style_to_js.default)(value, { reactCompat: true });
  1320. } catch (error) {
  1321. if (state.ignoreInvalidStyle) {
  1322. return {};
  1323. }
  1324. const cause = (
  1325. /** @type {Error} */
  1326. error
  1327. );
  1328. const message = new VFileMessage("Cannot parse `style` attribute", {
  1329. ancestors: state.ancestors,
  1330. cause,
  1331. ruleId: "style",
  1332. source: "hast-util-to-jsx-runtime"
  1333. });
  1334. message.file = state.filePath || void 0;
  1335. message.url = docs + "#cannot-parse-style-attribute";
  1336. throw message;
  1337. }
  1338. }
  1339. function findComponentFromName(state, name2, allowExpression) {
  1340. let result;
  1341. if (!allowExpression) {
  1342. result = { type: "Literal", value: name2 };
  1343. } else if (name2.includes(".")) {
  1344. const identifiers = name2.split(".");
  1345. let index2 = -1;
  1346. let node2;
  1347. while (++index2 < identifiers.length) {
  1348. const prop = name(identifiers[index2]) ? { type: "Identifier", name: identifiers[index2] } : { type: "Literal", value: identifiers[index2] };
  1349. node2 = node2 ? {
  1350. type: "MemberExpression",
  1351. object: node2,
  1352. property: prop,
  1353. computed: Boolean(index2 && prop.type === "Literal"),
  1354. optional: false
  1355. } : prop;
  1356. }
  1357. ok(node2, "always a result");
  1358. result = node2;
  1359. } else {
  1360. result = name(name2) && !/^[a-z]/.test(name2) ? { type: "Identifier", name: name2 } : { type: "Literal", value: name2 };
  1361. }
  1362. if (result.type === "Literal") {
  1363. const name3 = (
  1364. /** @type {string | number} */
  1365. result.value
  1366. );
  1367. return own.call(state.components, name3) ? state.components[name3] : name3;
  1368. }
  1369. if (state.evaluater) {
  1370. return state.evaluater.evaluateExpression(result);
  1371. }
  1372. crashEstree(state);
  1373. }
  1374. function crashEstree(state, place) {
  1375. const message = new VFileMessage(
  1376. "Cannot handle MDX estrees without `createEvaluater`",
  1377. {
  1378. ancestors: state.ancestors,
  1379. place,
  1380. ruleId: "mdx-estree",
  1381. source: "hast-util-to-jsx-runtime"
  1382. }
  1383. );
  1384. message.file = state.filePath || void 0;
  1385. message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
  1386. throw message;
  1387. }
  1388. function transformStylesToCssCasing(domCasing) {
  1389. const cssCasing = {};
  1390. let from;
  1391. for (from in domCasing) {
  1392. if (own.call(domCasing, from)) {
  1393. cssCasing[transformStyleToCssCasing(from)] = domCasing[from];
  1394. }
  1395. }
  1396. return cssCasing;
  1397. }
  1398. function transformStyleToCssCasing(from) {
  1399. let to = from.replace(cap, toDash);
  1400. if (to.slice(0, 3) === "ms-") to = "-" + to;
  1401. return to;
  1402. }
  1403. function toDash($0) {
  1404. return "-" + $0.toLowerCase();
  1405. }
  1406. // node_modules/html-url-attributes/lib/index.js
  1407. var urlAttributes = {
  1408. action: ["form"],
  1409. cite: ["blockquote", "del", "ins", "q"],
  1410. data: ["object"],
  1411. formAction: ["button", "input"],
  1412. href: ["a", "area", "base", "link"],
  1413. icon: ["menuitem"],
  1414. itemId: null,
  1415. manifest: ["html"],
  1416. ping: ["a", "area"],
  1417. poster: ["video"],
  1418. src: [
  1419. "audio",
  1420. "embed",
  1421. "iframe",
  1422. "img",
  1423. "input",
  1424. "script",
  1425. "source",
  1426. "track",
  1427. "video"
  1428. ]
  1429. };
  1430. // node_modules/react-markdown/lib/index.js
  1431. var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
  1432. var import_react = __toESM(require_react(), 1);
  1433. // node_modules/mdast-util-to-string/lib/index.js
  1434. var emptyOptions2 = {};
  1435. function toString(value, options) {
  1436. const settings = options || emptyOptions2;
  1437. const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
  1438. const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
  1439. return one2(value, includeImageAlt, includeHtml);
  1440. }
  1441. function one2(value, includeImageAlt, includeHtml) {
  1442. if (node(value)) {
  1443. if ("value" in value) {
  1444. return value.type === "html" && !includeHtml ? "" : value.value;
  1445. }
  1446. if (includeImageAlt && "alt" in value && value.alt) {
  1447. return value.alt;
  1448. }
  1449. if ("children" in value) {
  1450. return all(value.children, includeImageAlt, includeHtml);
  1451. }
  1452. }
  1453. if (Array.isArray(value)) {
  1454. return all(value, includeImageAlt, includeHtml);
  1455. }
  1456. return "";
  1457. }
  1458. function all(values2, includeImageAlt, includeHtml) {
  1459. const result = [];
  1460. let index2 = -1;
  1461. while (++index2 < values2.length) {
  1462. result[index2] = one2(values2[index2], includeImageAlt, includeHtml);
  1463. }
  1464. return result.join("");
  1465. }
  1466. function node(value) {
  1467. return Boolean(value && typeof value === "object");
  1468. }
  1469. // node_modules/decode-named-character-reference/index.dom.js
  1470. var element2 = document.createElement("i");
  1471. function decodeNamedCharacterReference(value) {
  1472. const characterReference2 = "&" + value + ";";
  1473. element2.innerHTML = characterReference2;
  1474. const character = element2.textContent;
  1475. if (character.charCodeAt(character.length - 1) === 59 && value !== "semi") {
  1476. return false;
  1477. }
  1478. return character === characterReference2 ? false : character;
  1479. }
  1480. // node_modules/micromark-util-chunked/dev/index.js
  1481. function splice(list3, start2, remove, items) {
  1482. const end = list3.length;
  1483. let chunkStart = 0;
  1484. let parameters;
  1485. if (start2 < 0) {
  1486. start2 = -start2 > end ? 0 : end + start2;
  1487. } else {
  1488. start2 = start2 > end ? end : start2;
  1489. }
  1490. remove = remove > 0 ? remove : 0;
  1491. if (items.length < constants.v8MaxSafeChunkSize) {
  1492. parameters = Array.from(items);
  1493. parameters.unshift(start2, remove);
  1494. list3.splice(...parameters);
  1495. } else {
  1496. if (remove) list3.splice(start2, remove);
  1497. while (chunkStart < items.length) {
  1498. parameters = items.slice(
  1499. chunkStart,
  1500. chunkStart + constants.v8MaxSafeChunkSize
  1501. );
  1502. parameters.unshift(start2, 0);
  1503. list3.splice(...parameters);
  1504. chunkStart += constants.v8MaxSafeChunkSize;
  1505. start2 += constants.v8MaxSafeChunkSize;
  1506. }
  1507. }
  1508. }
  1509. function push(list3, items) {
  1510. if (list3.length > 0) {
  1511. splice(list3, list3.length, 0, items);
  1512. return list3;
  1513. }
  1514. return items;
  1515. }
  1516. // node_modules/micromark-util-combine-extensions/index.js
  1517. var hasOwnProperty = {}.hasOwnProperty;
  1518. function combineExtensions(extensions) {
  1519. const all2 = {};
  1520. let index2 = -1;
  1521. while (++index2 < extensions.length) {
  1522. syntaxExtension(all2, extensions[index2]);
  1523. }
  1524. return all2;
  1525. }
  1526. function syntaxExtension(all2, extension2) {
  1527. let hook;
  1528. for (hook in extension2) {
  1529. const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;
  1530. const left = maybe || (all2[hook] = {});
  1531. const right = extension2[hook];
  1532. let code2;
  1533. if (right) {
  1534. for (code2 in right) {
  1535. if (!hasOwnProperty.call(left, code2)) left[code2] = [];
  1536. const value = right[code2];
  1537. constructs(
  1538. // @ts-expect-error Looks like a list.
  1539. left[code2],
  1540. Array.isArray(value) ? value : value ? [value] : []
  1541. );
  1542. }
  1543. }
  1544. }
  1545. }
  1546. function constructs(existing, list3) {
  1547. let index2 = -1;
  1548. const before = [];
  1549. while (++index2 < list3.length) {
  1550. ;
  1551. (list3[index2].add === "after" ? existing : before).push(list3[index2]);
  1552. }
  1553. splice(existing, 0, 0, before);
  1554. }
  1555. // node_modules/micromark-util-decode-numeric-character-reference/dev/index.js
  1556. function decodeNumericCharacterReference(value, base) {
  1557. const code2 = Number.parseInt(value, base);
  1558. if (
  1559. // C0 except for HT, LF, FF, CR, space.
  1560. code2 < codes.ht || code2 === codes.vt || code2 > codes.cr && code2 < codes.space || // Control character (DEL) of C0, and C1 controls.
  1561. code2 > codes.tilde && code2 < 160 || // Lone high surrogates and low surrogates.
  1562. code2 > 55295 && code2 < 57344 || // Noncharacters.
  1563. code2 > 64975 && code2 < 65008 || /* eslint-disable no-bitwise */
  1564. (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || /* eslint-enable no-bitwise */
  1565. // Out of range
  1566. code2 > 1114111
  1567. ) {
  1568. return values.replacementCharacter;
  1569. }
  1570. return String.fromCodePoint(code2);
  1571. }
  1572. // node_modules/micromark-util-normalize-identifier/dev/index.js
  1573. function normalizeIdentifier(value) {
  1574. return value.replace(/[\t\n\r ]+/g, values.space).replace(/^ | $/g, "").toLowerCase().toUpperCase();
  1575. }
  1576. // node_modules/micromark-util-sanitize-uri/dev/index.js
  1577. function normalizeUri(value) {
  1578. const result = [];
  1579. let index2 = -1;
  1580. let start2 = 0;
  1581. let skip = 0;
  1582. while (++index2 < value.length) {
  1583. const code2 = value.charCodeAt(index2);
  1584. let replace = "";
  1585. if (code2 === codes.percentSign && asciiAlphanumeric(value.charCodeAt(index2 + 1)) && asciiAlphanumeric(value.charCodeAt(index2 + 2))) {
  1586. skip = 2;
  1587. } else if (code2 < 128) {
  1588. if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))) {
  1589. replace = String.fromCharCode(code2);
  1590. }
  1591. } else if (code2 > 55295 && code2 < 57344) {
  1592. const next = value.charCodeAt(index2 + 1);
  1593. if (code2 < 56320 && next > 56319 && next < 57344) {
  1594. replace = String.fromCharCode(code2, next);
  1595. skip = 1;
  1596. } else {
  1597. replace = values.replacementCharacter;
  1598. }
  1599. } else {
  1600. replace = String.fromCharCode(code2);
  1601. }
  1602. if (replace) {
  1603. result.push(value.slice(start2, index2), encodeURIComponent(replace));
  1604. start2 = index2 + skip + 1;
  1605. replace = "";
  1606. }
  1607. if (skip) {
  1608. index2 += skip;
  1609. skip = 0;
  1610. }
  1611. }
  1612. return result.join("") + value.slice(start2);
  1613. }
  1614. // node_modules/micromark/dev/lib/compile.js
  1615. var hasOwnProperty2 = {}.hasOwnProperty;
  1616. // node_modules/micromark/dev/lib/initialize/content.js
  1617. var content = { tokenize: initializeContent };
  1618. function initializeContent(effects) {
  1619. const contentStart = effects.attempt(
  1620. this.parser.constructs.contentInitial,
  1621. afterContentStartConstruct,
  1622. paragraphInitial
  1623. );
  1624. let previous2;
  1625. return contentStart;
  1626. function afterContentStartConstruct(code2) {
  1627. ok(
  1628. code2 === codes.eof || markdownLineEnding(code2),
  1629. "expected eol or eof"
  1630. );
  1631. if (code2 === codes.eof) {
  1632. effects.consume(code2);
  1633. return;
  1634. }
  1635. effects.enter(types.lineEnding);
  1636. effects.consume(code2);
  1637. effects.exit(types.lineEnding);
  1638. return factorySpace(effects, contentStart, types.linePrefix);
  1639. }
  1640. function paragraphInitial(code2) {
  1641. ok(
  1642. code2 !== codes.eof && !markdownLineEnding(code2),
  1643. "expected anything other than a line ending or EOF"
  1644. );
  1645. effects.enter(types.paragraph);
  1646. return lineStart(code2);
  1647. }
  1648. function lineStart(code2) {
  1649. const token = effects.enter(types.chunkText, {
  1650. contentType: constants.contentTypeText,
  1651. previous: previous2
  1652. });
  1653. if (previous2) {
  1654. previous2.next = token;
  1655. }
  1656. previous2 = token;
  1657. return data(code2);
  1658. }
  1659. function data(code2) {
  1660. if (code2 === codes.eof) {
  1661. effects.exit(types.chunkText);
  1662. effects.exit(types.paragraph);
  1663. effects.consume(code2);
  1664. return;
  1665. }
  1666. if (markdownLineEnding(code2)) {
  1667. effects.consume(code2);
  1668. effects.exit(types.chunkText);
  1669. return lineStart;
  1670. }
  1671. effects.consume(code2);
  1672. return data;
  1673. }
  1674. }
  1675. // node_modules/micromark/dev/lib/initialize/document.js
  1676. var document2 = { tokenize: initializeDocument };
  1677. var containerConstruct = { tokenize: tokenizeContainer };
  1678. function initializeDocument(effects) {
  1679. const self2 = this;
  1680. const stack = [];
  1681. let continued = 0;
  1682. let childFlow;
  1683. let childToken;
  1684. let lineStartOffset;
  1685. return start2;
  1686. function start2(code2) {
  1687. if (continued < stack.length) {
  1688. const item = stack[continued];
  1689. self2.containerState = item[1];
  1690. ok(
  1691. item[0].continuation,
  1692. "expected `continuation` to be defined on container construct"
  1693. );
  1694. return effects.attempt(
  1695. item[0].continuation,
  1696. documentContinue,
  1697. checkNewContainers
  1698. )(code2);
  1699. }
  1700. return checkNewContainers(code2);
  1701. }
  1702. function documentContinue(code2) {
  1703. ok(
  1704. self2.containerState,
  1705. "expected `containerState` to be defined after continuation"
  1706. );
  1707. continued++;
  1708. if (self2.containerState._closeFlow) {
  1709. self2.containerState._closeFlow = void 0;
  1710. if (childFlow) {
  1711. closeFlow();
  1712. }
  1713. const indexBeforeExits = self2.events.length;
  1714. let indexBeforeFlow = indexBeforeExits;
  1715. let point4;
  1716. while (indexBeforeFlow--) {
  1717. if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === types.chunkFlow) {
  1718. point4 = self2.events[indexBeforeFlow][1].end;
  1719. break;
  1720. }
  1721. }
  1722. ok(point4, "could not find previous flow chunk");
  1723. exitContainers(continued);
  1724. let index2 = indexBeforeExits;
  1725. while (index2 < self2.events.length) {
  1726. self2.events[index2][1].end = { ...point4 };
  1727. index2++;
  1728. }
  1729. splice(
  1730. self2.events,
  1731. indexBeforeFlow + 1,
  1732. 0,
  1733. self2.events.slice(indexBeforeExits)
  1734. );
  1735. self2.events.length = index2;
  1736. return checkNewContainers(code2);
  1737. }
  1738. return start2(code2);
  1739. }
  1740. function checkNewContainers(code2) {
  1741. if (continued === stack.length) {
  1742. if (!childFlow) {
  1743. return documentContinued(code2);
  1744. }
  1745. if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
  1746. return flowStart(code2);
  1747. }
  1748. self2.interrupt = Boolean(
  1749. childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack
  1750. );
  1751. }
  1752. self2.containerState = {};
  1753. return effects.check(
  1754. containerConstruct,
  1755. thereIsANewContainer,
  1756. thereIsNoNewContainer
  1757. )(code2);
  1758. }
  1759. function thereIsANewContainer(code2) {
  1760. if (childFlow) closeFlow();
  1761. exitContainers(continued);
  1762. return documentContinued(code2);
  1763. }
  1764. function thereIsNoNewContainer(code2) {
  1765. self2.parser.lazy[self2.now().line] = continued !== stack.length;
  1766. lineStartOffset = self2.now().offset;
  1767. return flowStart(code2);
  1768. }
  1769. function documentContinued(code2) {
  1770. self2.containerState = {};
  1771. return effects.attempt(
  1772. containerConstruct,
  1773. containerContinue,
  1774. flowStart
  1775. )(code2);
  1776. }
  1777. function containerContinue(code2) {
  1778. ok(
  1779. self2.currentConstruct,
  1780. "expected `currentConstruct` to be defined on tokenizer"
  1781. );
  1782. ok(
  1783. self2.containerState,
  1784. "expected `containerState` to be defined on tokenizer"
  1785. );
  1786. continued++;
  1787. stack.push([self2.currentConstruct, self2.containerState]);
  1788. return documentContinued(code2);
  1789. }
  1790. function flowStart(code2) {
  1791. if (code2 === codes.eof) {
  1792. if (childFlow) closeFlow();
  1793. exitContainers(0);
  1794. effects.consume(code2);
  1795. return;
  1796. }
  1797. childFlow = childFlow || self2.parser.flow(self2.now());
  1798. effects.enter(types.chunkFlow, {
  1799. _tokenizer: childFlow,
  1800. contentType: constants.contentTypeFlow,
  1801. previous: childToken
  1802. });
  1803. return flowContinue(code2);
  1804. }
  1805. function flowContinue(code2) {
  1806. if (code2 === codes.eof) {
  1807. writeToChild(effects.exit(types.chunkFlow), true);
  1808. exitContainers(0);
  1809. effects.consume(code2);
  1810. return;
  1811. }
  1812. if (markdownLineEnding(code2)) {
  1813. effects.consume(code2);
  1814. writeToChild(effects.exit(types.chunkFlow));
  1815. continued = 0;
  1816. self2.interrupt = void 0;
  1817. return start2;
  1818. }
  1819. effects.consume(code2);
  1820. return flowContinue;
  1821. }
  1822. function writeToChild(token, endOfFile) {
  1823. ok(childFlow, "expected `childFlow` to be defined when continuing");
  1824. const stream = self2.sliceStream(token);
  1825. if (endOfFile) stream.push(null);
  1826. token.previous = childToken;
  1827. if (childToken) childToken.next = token;
  1828. childToken = token;
  1829. childFlow.defineSkip(token.start);
  1830. childFlow.write(stream);
  1831. if (self2.parser.lazy[token.start.line]) {
  1832. let index2 = childFlow.events.length;
  1833. while (index2--) {
  1834. if (
  1835. // The token starts before the line ending…
  1836. childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet…
  1837. (!childFlow.events[index2][1].end || // …or ends after it.
  1838. childFlow.events[index2][1].end.offset > lineStartOffset)
  1839. ) {
  1840. return;
  1841. }
  1842. }
  1843. const indexBeforeExits = self2.events.length;
  1844. let indexBeforeFlow = indexBeforeExits;
  1845. let seen;
  1846. let point4;
  1847. while (indexBeforeFlow--) {
  1848. if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === types.chunkFlow) {
  1849. if (seen) {
  1850. point4 = self2.events[indexBeforeFlow][1].end;
  1851. break;
  1852. }
  1853. seen = true;
  1854. }
  1855. }
  1856. ok(point4, "could not find previous flow chunk");
  1857. exitContainers(continued);
  1858. index2 = indexBeforeExits;
  1859. while (index2 < self2.events.length) {
  1860. self2.events[index2][1].end = { ...point4 };
  1861. index2++;
  1862. }
  1863. splice(
  1864. self2.events,
  1865. indexBeforeFlow + 1,
  1866. 0,
  1867. self2.events.slice(indexBeforeExits)
  1868. );
  1869. self2.events.length = index2;
  1870. }
  1871. }
  1872. function exitContainers(size) {
  1873. let index2 = stack.length;
  1874. while (index2-- > size) {
  1875. const entry = stack[index2];
  1876. self2.containerState = entry[1];
  1877. ok(
  1878. entry[0].exit,
  1879. "expected `exit` to be defined on container construct"
  1880. );
  1881. entry[0].exit.call(self2, effects);
  1882. }
  1883. stack.length = size;
  1884. }
  1885. function closeFlow() {
  1886. ok(
  1887. self2.containerState,
  1888. "expected `containerState` to be defined when closing flow"
  1889. );
  1890. ok(childFlow, "expected `childFlow` to be defined when closing it");
  1891. childFlow.write([codes.eof]);
  1892. childToken = void 0;
  1893. childFlow = void 0;
  1894. self2.containerState._closeFlow = void 0;
  1895. }
  1896. }
  1897. function tokenizeContainer(effects, ok2, nok) {
  1898. ok(
  1899. this.parser.constructs.disable.null,
  1900. "expected `disable.null` to be populated"
  1901. );
  1902. return factorySpace(
  1903. effects,
  1904. effects.attempt(this.parser.constructs.document, ok2, nok),
  1905. types.linePrefix,
  1906. this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
  1907. );
  1908. }
  1909. // node_modules/micromark-util-classify-character/dev/index.js
  1910. function classifyCharacter(code2) {
  1911. if (code2 === codes.eof || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
  1912. return constants.characterGroupWhitespace;
  1913. }
  1914. if (unicodePunctuation(code2)) {
  1915. return constants.characterGroupPunctuation;
  1916. }
  1917. }
  1918. // node_modules/micromark-util-resolve-all/index.js
  1919. function resolveAll(constructs2, events, context) {
  1920. const called = [];
  1921. let index2 = -1;
  1922. while (++index2 < constructs2.length) {
  1923. const resolve = constructs2[index2].resolveAll;
  1924. if (resolve && !called.includes(resolve)) {
  1925. events = resolve(events, context);
  1926. called.push(resolve);
  1927. }
  1928. }
  1929. return events;
  1930. }
  1931. // node_modules/micromark-core-commonmark/dev/lib/attention.js
  1932. var attention = {
  1933. name: "attention",
  1934. resolveAll: resolveAllAttention,
  1935. tokenize: tokenizeAttention
  1936. };
  1937. function resolveAllAttention(events, context) {
  1938. let index2 = -1;
  1939. let open;
  1940. let group;
  1941. let text5;
  1942. let openingSequence;
  1943. let closingSequence;
  1944. let use;
  1945. let nextEvents;
  1946. let offset;
  1947. while (++index2 < events.length) {
  1948. if (events[index2][0] === "enter" && events[index2][1].type === "attentionSequence" && events[index2][1]._close) {
  1949. open = index2;
  1950. while (open--) {
  1951. if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && // If the markers are the same:
  1952. context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) {
  1953. 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)) {
  1954. continue;
  1955. }
  1956. 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;
  1957. const start2 = { ...events[open][1].end };
  1958. const end = { ...events[index2][1].start };
  1959. movePoint(start2, -use);
  1960. movePoint(end, use);
  1961. openingSequence = {
  1962. type: use > 1 ? types.strongSequence : types.emphasisSequence,
  1963. start: start2,
  1964. end: { ...events[open][1].end }
  1965. };
  1966. closingSequence = {
  1967. type: use > 1 ? types.strongSequence : types.emphasisSequence,
  1968. start: { ...events[index2][1].start },
  1969. end
  1970. };
  1971. text5 = {
  1972. type: use > 1 ? types.strongText : types.emphasisText,
  1973. start: { ...events[open][1].end },
  1974. end: { ...events[index2][1].start }
  1975. };
  1976. group = {
  1977. type: use > 1 ? types.strong : types.emphasis,
  1978. start: { ...openingSequence.start },
  1979. end: { ...closingSequence.end }
  1980. };
  1981. events[open][1].end = { ...openingSequence.start };
  1982. events[index2][1].start = { ...closingSequence.end };
  1983. nextEvents = [];
  1984. if (events[open][1].end.offset - events[open][1].start.offset) {
  1985. nextEvents = push(nextEvents, [
  1986. ["enter", events[open][1], context],
  1987. ["exit", events[open][1], context]
  1988. ]);
  1989. }
  1990. nextEvents = push(nextEvents, [
  1991. ["enter", group, context],
  1992. ["enter", openingSequence, context],
  1993. ["exit", openingSequence, context],
  1994. ["enter", text5, context]
  1995. ]);
  1996. ok(
  1997. context.parser.constructs.insideSpan.null,
  1998. "expected `insideSpan` to be populated"
  1999. );
  2000. nextEvents = push(
  2001. nextEvents,
  2002. resolveAll(
  2003. context.parser.constructs.insideSpan.null,
  2004. events.slice(open + 1, index2),
  2005. context
  2006. )
  2007. );
  2008. nextEvents = push(nextEvents, [
  2009. ["exit", text5, context],
  2010. ["enter", closingSequence, context],
  2011. ["exit", closingSequence, context],
  2012. ["exit", group, context]
  2013. ]);
  2014. if (events[index2][1].end.offset - events[index2][1].start.offset) {
  2015. offset = 2;
  2016. nextEvents = push(nextEvents, [
  2017. ["enter", events[index2][1], context],
  2018. ["exit", events[index2][1], context]
  2019. ]);
  2020. } else {
  2021. offset = 0;
  2022. }
  2023. splice(events, open - 1, index2 - open + 3, nextEvents);
  2024. index2 = open + nextEvents.length - offset - 2;
  2025. break;
  2026. }
  2027. }
  2028. }
  2029. }
  2030. index2 = -1;
  2031. while (++index2 < events.length) {
  2032. if (events[index2][1].type === "attentionSequence") {
  2033. events[index2][1].type = "data";
  2034. }
  2035. }
  2036. return events;
  2037. }
  2038. function tokenizeAttention(effects, ok2) {
  2039. const attentionMarkers2 = this.parser.constructs.attentionMarkers.null;
  2040. const previous2 = this.previous;
  2041. const before = classifyCharacter(previous2);
  2042. let marker;
  2043. return start2;
  2044. function start2(code2) {
  2045. ok(
  2046. code2 === codes.asterisk || code2 === codes.underscore,
  2047. "expected asterisk or underscore"
  2048. );
  2049. marker = code2;
  2050. effects.enter("attentionSequence");
  2051. return inside(code2);
  2052. }
  2053. function inside(code2) {
  2054. if (code2 === marker) {
  2055. effects.consume(code2);
  2056. return inside;
  2057. }
  2058. const token = effects.exit("attentionSequence");
  2059. const after = classifyCharacter(code2);
  2060. ok(attentionMarkers2, "expected `attentionMarkers` to be populated");
  2061. const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers2.includes(code2);
  2062. const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers2.includes(previous2);
  2063. token._open = Boolean(
  2064. marker === codes.asterisk ? open : open && (before || !close)
  2065. );
  2066. token._close = Boolean(
  2067. marker === codes.asterisk ? close : close && (after || !open)
  2068. );
  2069. return ok2(code2);
  2070. }
  2071. }
  2072. function movePoint(point4, offset) {
  2073. point4.column += offset;
  2074. point4.offset += offset;
  2075. point4._bufferIndex += offset;
  2076. }
  2077. // node_modules/micromark-core-commonmark/dev/lib/autolink.js
  2078. var autolink = { name: "autolink", tokenize: tokenizeAutolink };
  2079. function tokenizeAutolink(effects, ok2, nok) {
  2080. let size = 0;
  2081. return start2;
  2082. function start2(code2) {
  2083. ok(code2 === codes.lessThan, "expected `<`");
  2084. effects.enter(types.autolink);
  2085. effects.enter(types.autolinkMarker);
  2086. effects.consume(code2);
  2087. effects.exit(types.autolinkMarker);
  2088. effects.enter(types.autolinkProtocol);
  2089. return open;
  2090. }
  2091. function open(code2) {
  2092. if (asciiAlpha(code2)) {
  2093. effects.consume(code2);
  2094. return schemeOrEmailAtext;
  2095. }
  2096. if (code2 === codes.atSign) {
  2097. return nok(code2);
  2098. }
  2099. return emailAtext(code2);
  2100. }
  2101. function schemeOrEmailAtext(code2) {
  2102. if (code2 === codes.plusSign || code2 === codes.dash || code2 === codes.dot || asciiAlphanumeric(code2)) {
  2103. size = 1;
  2104. return schemeInsideOrEmailAtext(code2);
  2105. }
  2106. return emailAtext(code2);
  2107. }
  2108. function schemeInsideOrEmailAtext(code2) {
  2109. if (code2 === codes.colon) {
  2110. effects.consume(code2);
  2111. size = 0;
  2112. return urlInside;
  2113. }
  2114. if ((code2 === codes.plusSign || code2 === codes.dash || code2 === codes.dot || asciiAlphanumeric(code2)) && size++ < constants.autolinkSchemeSizeMax) {
  2115. effects.consume(code2);
  2116. return schemeInsideOrEmailAtext;
  2117. }
  2118. size = 0;
  2119. return emailAtext(code2);
  2120. }
  2121. function urlInside(code2) {
  2122. if (code2 === codes.greaterThan) {
  2123. effects.exit(types.autolinkProtocol);
  2124. effects.enter(types.autolinkMarker);
  2125. effects.consume(code2);
  2126. effects.exit(types.autolinkMarker);
  2127. effects.exit(types.autolink);
  2128. return ok2;
  2129. }
  2130. if (code2 === codes.eof || code2 === codes.space || code2 === codes.lessThan || asciiControl(code2)) {
  2131. return nok(code2);
  2132. }
  2133. effects.consume(code2);
  2134. return urlInside;
  2135. }
  2136. function emailAtext(code2) {
  2137. if (code2 === codes.atSign) {
  2138. effects.consume(code2);
  2139. return emailAtSignOrDot;
  2140. }
  2141. if (asciiAtext(code2)) {
  2142. effects.consume(code2);
  2143. return emailAtext;
  2144. }
  2145. return nok(code2);
  2146. }
  2147. function emailAtSignOrDot(code2) {
  2148. return asciiAlphanumeric(code2) ? emailLabel(code2) : nok(code2);
  2149. }
  2150. function emailLabel(code2) {
  2151. if (code2 === codes.dot) {
  2152. effects.consume(code2);
  2153. size = 0;
  2154. return emailAtSignOrDot;
  2155. }
  2156. if (code2 === codes.greaterThan) {
  2157. effects.exit(types.autolinkProtocol).type = types.autolinkEmail;
  2158. effects.enter(types.autolinkMarker);
  2159. effects.consume(code2);
  2160. effects.exit(types.autolinkMarker);
  2161. effects.exit(types.autolink);
  2162. return ok2;
  2163. }
  2164. return emailValue(code2);
  2165. }
  2166. function emailValue(code2) {
  2167. if ((code2 === codes.dash || asciiAlphanumeric(code2)) && size++ < constants.autolinkDomainSizeMax) {
  2168. const next = code2 === codes.dash ? emailValue : emailLabel;
  2169. effects.consume(code2);
  2170. return next;
  2171. }
  2172. return nok(code2);
  2173. }
  2174. }
  2175. // node_modules/micromark-core-commonmark/dev/lib/blank-line.js
  2176. var blankLine = { partial: true, tokenize: tokenizeBlankLine };
  2177. function tokenizeBlankLine(effects, ok2, nok) {
  2178. return start2;
  2179. function start2(code2) {
  2180. return markdownSpace(code2) ? factorySpace(effects, after, types.linePrefix)(code2) : after(code2);
  2181. }
  2182. function after(code2) {
  2183. return code2 === codes.eof || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
  2184. }
  2185. }
  2186. // node_modules/micromark-core-commonmark/dev/lib/block-quote.js
  2187. var blockQuote = {
  2188. continuation: { tokenize: tokenizeBlockQuoteContinuation },
  2189. exit,
  2190. name: "blockQuote",
  2191. tokenize: tokenizeBlockQuoteStart
  2192. };
  2193. function tokenizeBlockQuoteStart(effects, ok2, nok) {
  2194. const self2 = this;
  2195. return start2;
  2196. function start2(code2) {
  2197. if (code2 === codes.greaterThan) {
  2198. const state = self2.containerState;
  2199. ok(state, "expected `containerState` to be defined in container");
  2200. if (!state.open) {
  2201. effects.enter(types.blockQuote, { _container: true });
  2202. state.open = true;
  2203. }
  2204. effects.enter(types.blockQuotePrefix);
  2205. effects.enter(types.blockQuoteMarker);
  2206. effects.consume(code2);
  2207. effects.exit(types.blockQuoteMarker);
  2208. return after;
  2209. }
  2210. return nok(code2);
  2211. }
  2212. function after(code2) {
  2213. if (markdownSpace(code2)) {
  2214. effects.enter(types.blockQuotePrefixWhitespace);
  2215. effects.consume(code2);
  2216. effects.exit(types.blockQuotePrefixWhitespace);
  2217. effects.exit(types.blockQuotePrefix);
  2218. return ok2;
  2219. }
  2220. effects.exit(types.blockQuotePrefix);
  2221. return ok2(code2);
  2222. }
  2223. }
  2224. function tokenizeBlockQuoteContinuation(effects, ok2, nok) {
  2225. const self2 = this;
  2226. return contStart;
  2227. function contStart(code2) {
  2228. if (markdownSpace(code2)) {
  2229. ok(
  2230. self2.parser.constructs.disable.null,
  2231. "expected `disable.null` to be populated"
  2232. );
  2233. return factorySpace(
  2234. effects,
  2235. contBefore,
  2236. types.linePrefix,
  2237. self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
  2238. )(code2);
  2239. }
  2240. return contBefore(code2);
  2241. }
  2242. function contBefore(code2) {
  2243. return effects.attempt(blockQuote, ok2, nok)(code2);
  2244. }
  2245. }
  2246. function exit(effects) {
  2247. effects.exit(types.blockQuote);
  2248. }
  2249. // node_modules/micromark-core-commonmark/dev/lib/character-escape.js
  2250. var characterEscape = {
  2251. name: "characterEscape",
  2252. tokenize: tokenizeCharacterEscape
  2253. };
  2254. function tokenizeCharacterEscape(effects, ok2, nok) {
  2255. return start2;
  2256. function start2(code2) {
  2257. ok(code2 === codes.backslash, "expected `\\`");
  2258. effects.enter(types.characterEscape);
  2259. effects.enter(types.escapeMarker);
  2260. effects.consume(code2);
  2261. effects.exit(types.escapeMarker);
  2262. return inside;
  2263. }
  2264. function inside(code2) {
  2265. if (asciiPunctuation(code2)) {
  2266. effects.enter(types.characterEscapeValue);
  2267. effects.consume(code2);
  2268. effects.exit(types.characterEscapeValue);
  2269. effects.exit(types.characterEscape);
  2270. return ok2;
  2271. }
  2272. return nok(code2);
  2273. }
  2274. }
  2275. // node_modules/micromark-core-commonmark/dev/lib/character-reference.js
  2276. var characterReference = {
  2277. name: "characterReference",
  2278. tokenize: tokenizeCharacterReference
  2279. };
  2280. function tokenizeCharacterReference(effects, ok2, nok) {
  2281. const self2 = this;
  2282. let size = 0;
  2283. let max;
  2284. let test;
  2285. return start2;
  2286. function start2(code2) {
  2287. ok(code2 === codes.ampersand, "expected `&`");
  2288. effects.enter(types.characterReference);
  2289. effects.enter(types.characterReferenceMarker);
  2290. effects.consume(code2);
  2291. effects.exit(types.characterReferenceMarker);
  2292. return open;
  2293. }
  2294. function open(code2) {
  2295. if (code2 === codes.numberSign) {
  2296. effects.enter(types.characterReferenceMarkerNumeric);
  2297. effects.consume(code2);
  2298. effects.exit(types.characterReferenceMarkerNumeric);
  2299. return numeric;
  2300. }
  2301. effects.enter(types.characterReferenceValue);
  2302. max = constants.characterReferenceNamedSizeMax;
  2303. test = asciiAlphanumeric;
  2304. return value(code2);
  2305. }
  2306. function numeric(code2) {
  2307. if (code2 === codes.uppercaseX || code2 === codes.lowercaseX) {
  2308. effects.enter(types.characterReferenceMarkerHexadecimal);
  2309. effects.consume(code2);
  2310. effects.exit(types.characterReferenceMarkerHexadecimal);
  2311. effects.enter(types.characterReferenceValue);
  2312. max = constants.characterReferenceHexadecimalSizeMax;
  2313. test = asciiHexDigit;
  2314. return value;
  2315. }
  2316. effects.enter(types.characterReferenceValue);
  2317. max = constants.characterReferenceDecimalSizeMax;
  2318. test = asciiDigit;
  2319. return value(code2);
  2320. }
  2321. function value(code2) {
  2322. if (code2 === codes.semicolon && size) {
  2323. const token = effects.exit(types.characterReferenceValue);
  2324. if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) {
  2325. return nok(code2);
  2326. }
  2327. effects.enter(types.characterReferenceMarker);
  2328. effects.consume(code2);
  2329. effects.exit(types.characterReferenceMarker);
  2330. effects.exit(types.characterReference);
  2331. return ok2;
  2332. }
  2333. if (test(code2) && size++ < max) {
  2334. effects.consume(code2);
  2335. return value;
  2336. }
  2337. return nok(code2);
  2338. }
  2339. }
  2340. // node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
  2341. var nonLazyContinuation = {
  2342. partial: true,
  2343. tokenize: tokenizeNonLazyContinuation
  2344. };
  2345. var codeFenced = {
  2346. concrete: true,
  2347. name: "codeFenced",
  2348. tokenize: tokenizeCodeFenced
  2349. };
  2350. function tokenizeCodeFenced(effects, ok2, nok) {
  2351. const self2 = this;
  2352. const closeStart = { partial: true, tokenize: tokenizeCloseStart };
  2353. let initialPrefix = 0;
  2354. let sizeOpen = 0;
  2355. let marker;
  2356. return start2;
  2357. function start2(code2) {
  2358. return beforeSequenceOpen(code2);
  2359. }
  2360. function beforeSequenceOpen(code2) {
  2361. ok(
  2362. code2 === codes.graveAccent || code2 === codes.tilde,
  2363. "expected `` ` `` or `~`"
  2364. );
  2365. const tail = self2.events[self2.events.length - 1];
  2366. initialPrefix = tail && tail[1].type === types.linePrefix ? tail[2].sliceSerialize(tail[1], true).length : 0;
  2367. marker = code2;
  2368. effects.enter(types.codeFenced);
  2369. effects.enter(types.codeFencedFence);
  2370. effects.enter(types.codeFencedFenceSequence);
  2371. return sequenceOpen(code2);
  2372. }
  2373. function sequenceOpen(code2) {
  2374. if (code2 === marker) {
  2375. sizeOpen++;
  2376. effects.consume(code2);
  2377. return sequenceOpen;
  2378. }
  2379. if (sizeOpen < constants.codeFencedSequenceSizeMin) {
  2380. return nok(code2);
  2381. }
  2382. effects.exit(types.codeFencedFenceSequence);
  2383. return markdownSpace(code2) ? factorySpace(effects, infoBefore, types.whitespace)(code2) : infoBefore(code2);
  2384. }
  2385. function infoBefore(code2) {
  2386. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2387. effects.exit(types.codeFencedFence);
  2388. return self2.interrupt ? ok2(code2) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
  2389. }
  2390. effects.enter(types.codeFencedFenceInfo);
  2391. effects.enter(types.chunkString, { contentType: constants.contentTypeString });
  2392. return info(code2);
  2393. }
  2394. function info(code2) {
  2395. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2396. effects.exit(types.chunkString);
  2397. effects.exit(types.codeFencedFenceInfo);
  2398. return infoBefore(code2);
  2399. }
  2400. if (markdownSpace(code2)) {
  2401. effects.exit(types.chunkString);
  2402. effects.exit(types.codeFencedFenceInfo);
  2403. return factorySpace(effects, metaBefore, types.whitespace)(code2);
  2404. }
  2405. if (code2 === codes.graveAccent && code2 === marker) {
  2406. return nok(code2);
  2407. }
  2408. effects.consume(code2);
  2409. return info;
  2410. }
  2411. function metaBefore(code2) {
  2412. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2413. return infoBefore(code2);
  2414. }
  2415. effects.enter(types.codeFencedFenceMeta);
  2416. effects.enter(types.chunkString, { contentType: constants.contentTypeString });
  2417. return meta(code2);
  2418. }
  2419. function meta(code2) {
  2420. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2421. effects.exit(types.chunkString);
  2422. effects.exit(types.codeFencedFenceMeta);
  2423. return infoBefore(code2);
  2424. }
  2425. if (code2 === codes.graveAccent && code2 === marker) {
  2426. return nok(code2);
  2427. }
  2428. effects.consume(code2);
  2429. return meta;
  2430. }
  2431. function atNonLazyBreak(code2) {
  2432. ok(markdownLineEnding(code2), "expected eol");
  2433. return effects.attempt(closeStart, after, contentBefore)(code2);
  2434. }
  2435. function contentBefore(code2) {
  2436. ok(markdownLineEnding(code2), "expected eol");
  2437. effects.enter(types.lineEnding);
  2438. effects.consume(code2);
  2439. effects.exit(types.lineEnding);
  2440. return contentStart;
  2441. }
  2442. function contentStart(code2) {
  2443. return initialPrefix > 0 && markdownSpace(code2) ? factorySpace(
  2444. effects,
  2445. beforeContentChunk,
  2446. types.linePrefix,
  2447. initialPrefix + 1
  2448. )(code2) : beforeContentChunk(code2);
  2449. }
  2450. function beforeContentChunk(code2) {
  2451. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2452. return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
  2453. }
  2454. effects.enter(types.codeFlowValue);
  2455. return contentChunk(code2);
  2456. }
  2457. function contentChunk(code2) {
  2458. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2459. effects.exit(types.codeFlowValue);
  2460. return beforeContentChunk(code2);
  2461. }
  2462. effects.consume(code2);
  2463. return contentChunk;
  2464. }
  2465. function after(code2) {
  2466. effects.exit(types.codeFenced);
  2467. return ok2(code2);
  2468. }
  2469. function tokenizeCloseStart(effects2, ok3, nok2) {
  2470. let size = 0;
  2471. return startBefore;
  2472. function startBefore(code2) {
  2473. ok(markdownLineEnding(code2), "expected eol");
  2474. effects2.enter(types.lineEnding);
  2475. effects2.consume(code2);
  2476. effects2.exit(types.lineEnding);
  2477. return start3;
  2478. }
  2479. function start3(code2) {
  2480. ok(
  2481. self2.parser.constructs.disable.null,
  2482. "expected `disable.null` to be populated"
  2483. );
  2484. effects2.enter(types.codeFencedFence);
  2485. return markdownSpace(code2) ? factorySpace(
  2486. effects2,
  2487. beforeSequenceClose,
  2488. types.linePrefix,
  2489. self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
  2490. )(code2) : beforeSequenceClose(code2);
  2491. }
  2492. function beforeSequenceClose(code2) {
  2493. if (code2 === marker) {
  2494. effects2.enter(types.codeFencedFenceSequence);
  2495. return sequenceClose(code2);
  2496. }
  2497. return nok2(code2);
  2498. }
  2499. function sequenceClose(code2) {
  2500. if (code2 === marker) {
  2501. size++;
  2502. effects2.consume(code2);
  2503. return sequenceClose;
  2504. }
  2505. if (size >= sizeOpen) {
  2506. effects2.exit(types.codeFencedFenceSequence);
  2507. return markdownSpace(code2) ? factorySpace(effects2, sequenceCloseAfter, types.whitespace)(code2) : sequenceCloseAfter(code2);
  2508. }
  2509. return nok2(code2);
  2510. }
  2511. function sequenceCloseAfter(code2) {
  2512. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2513. effects2.exit(types.codeFencedFence);
  2514. return ok3(code2);
  2515. }
  2516. return nok2(code2);
  2517. }
  2518. }
  2519. }
  2520. function tokenizeNonLazyContinuation(effects, ok2, nok) {
  2521. const self2 = this;
  2522. return start2;
  2523. function start2(code2) {
  2524. if (code2 === codes.eof) {
  2525. return nok(code2);
  2526. }
  2527. ok(markdownLineEnding(code2), "expected eol");
  2528. effects.enter(types.lineEnding);
  2529. effects.consume(code2);
  2530. effects.exit(types.lineEnding);
  2531. return lineStart;
  2532. }
  2533. function lineStart(code2) {
  2534. return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
  2535. }
  2536. }
  2537. // node_modules/micromark-core-commonmark/dev/lib/code-indented.js
  2538. var codeIndented = {
  2539. name: "codeIndented",
  2540. tokenize: tokenizeCodeIndented
  2541. };
  2542. var furtherStart = { partial: true, tokenize: tokenizeFurtherStart };
  2543. function tokenizeCodeIndented(effects, ok2, nok) {
  2544. const self2 = this;
  2545. return start2;
  2546. function start2(code2) {
  2547. ok(markdownSpace(code2));
  2548. effects.enter(types.codeIndented);
  2549. return factorySpace(
  2550. effects,
  2551. afterPrefix,
  2552. types.linePrefix,
  2553. constants.tabSize + 1
  2554. )(code2);
  2555. }
  2556. function afterPrefix(code2) {
  2557. const tail = self2.events[self2.events.length - 1];
  2558. return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code2) : nok(code2);
  2559. }
  2560. function atBreak(code2) {
  2561. if (code2 === codes.eof) {
  2562. return after(code2);
  2563. }
  2564. if (markdownLineEnding(code2)) {
  2565. return effects.attempt(furtherStart, atBreak, after)(code2);
  2566. }
  2567. effects.enter(types.codeFlowValue);
  2568. return inside(code2);
  2569. }
  2570. function inside(code2) {
  2571. if (code2 === codes.eof || markdownLineEnding(code2)) {
  2572. effects.exit(types.codeFlowValue);
  2573. return atBreak(code2);
  2574. }
  2575. effects.consume(code2);
  2576. return inside;
  2577. }
  2578. function after(code2) {
  2579. effects.exit(types.codeIndented);
  2580. return ok2(code2);
  2581. }
  2582. }
  2583. function tokenizeFurtherStart(effects, ok2, nok) {
  2584. const self2 = this;
  2585. return furtherStart2;
  2586. function furtherStart2(code2) {
  2587. if (self2.parser.lazy[self2.now().line]) {
  2588. return nok(code2);
  2589. }
  2590. if (markdownLineEnding(code2)) {
  2591. effects.enter(types.lineEnding);
  2592. effects.consume(code2);
  2593. effects.exit(types.lineEnding);
  2594. return furtherStart2;
  2595. }
  2596. return factorySpace(
  2597. effects,
  2598. afterPrefix,
  2599. types.linePrefix,
  2600. constants.tabSize + 1
  2601. )(code2);
  2602. }
  2603. function afterPrefix(code2) {
  2604. const tail = self2.events[self2.events.length - 1];
  2605. return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok2(code2) : markdownLineEnding(code2) ? furtherStart2(code2) : nok(code2);
  2606. }
  2607. }
  2608. // node_modules/micromark-core-commonmark/dev/lib/code-text.js
  2609. var codeText = {
  2610. name: "codeText",
  2611. previous,
  2612. resolve: resolveCodeText,
  2613. tokenize: tokenizeCodeText
  2614. };
  2615. function resolveCodeText(events) {
  2616. let tailExitIndex = events.length - 4;
  2617. let headEnterIndex = 3;
  2618. let index2;
  2619. let enter;
  2620. if ((events[headEnterIndex][1].type === types.lineEnding || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === types.lineEnding || events[tailExitIndex][1].type === "space")) {
  2621. index2 = headEnterIndex;
  2622. while (++index2 < tailExitIndex) {
  2623. if (events[index2][1].type === types.codeTextData) {
  2624. events[headEnterIndex][1].type = types.codeTextPadding;
  2625. events[tailExitIndex][1].type = types.codeTextPadding;
  2626. headEnterIndex += 2;
  2627. tailExitIndex -= 2;
  2628. break;
  2629. }
  2630. }
  2631. }
  2632. index2 = headEnterIndex - 1;
  2633. tailExitIndex++;
  2634. while (++index2 <= tailExitIndex) {
  2635. if (enter === void 0) {
  2636. if (index2 !== tailExitIndex && events[index2][1].type !== types.lineEnding) {
  2637. enter = index2;
  2638. }
  2639. } else if (index2 === tailExitIndex || events[index2][1].type === types.lineEnding) {
  2640. events[enter][1].type = types.codeTextData;
  2641. if (index2 !== enter + 2) {
  2642. events[enter][1].end = events[index2 - 1][1].end;
  2643. events.splice(enter + 2, index2 - enter - 2);
  2644. tailExitIndex -= index2 - enter - 2;
  2645. index2 = enter + 2;
  2646. }
  2647. enter = void 0;
  2648. }
  2649. }
  2650. return events;
  2651. }
  2652. function previous(code2) {
  2653. return code2 !== codes.graveAccent || this.events[this.events.length - 1][1].type === types.characterEscape;
  2654. }
  2655. function tokenizeCodeText(effects, ok2, nok) {
  2656. const self2 = this;
  2657. let sizeOpen = 0;
  2658. let size;
  2659. let token;
  2660. return start2;
  2661. function start2(code2) {
  2662. ok(code2 === codes.graveAccent, "expected `` ` ``");
  2663. ok(previous.call(self2, self2.previous), "expected correct previous");
  2664. effects.enter(types.codeText);
  2665. effects.enter(types.codeTextSequence);
  2666. return sequenceOpen(code2);
  2667. }
  2668. function sequenceOpen(code2) {
  2669. if (code2 === codes.graveAccent) {
  2670. effects.consume(code2);
  2671. sizeOpen++;
  2672. return sequenceOpen;
  2673. }
  2674. effects.exit(types.codeTextSequence);
  2675. return between(code2);
  2676. }
  2677. function between(code2) {
  2678. if (code2 === codes.eof) {
  2679. return nok(code2);
  2680. }
  2681. if (code2 === codes.space) {
  2682. effects.enter("space");
  2683. effects.consume(code2);
  2684. effects.exit("space");
  2685. return between;
  2686. }
  2687. if (code2 === codes.graveAccent) {
  2688. token = effects.enter(types.codeTextSequence);
  2689. size = 0;
  2690. return sequenceClose(code2);
  2691. }
  2692. if (markdownLineEnding(code2)) {
  2693. effects.enter(types.lineEnding);
  2694. effects.consume(code2);
  2695. effects.exit(types.lineEnding);
  2696. return between;
  2697. }
  2698. effects.enter(types.codeTextData);
  2699. return data(code2);
  2700. }
  2701. function data(code2) {
  2702. if (code2 === codes.eof || code2 === codes.space || code2 === codes.graveAccent || markdownLineEnding(code2)) {
  2703. effects.exit(types.codeTextData);
  2704. return between(code2);
  2705. }
  2706. effects.consume(code2);
  2707. return data;
  2708. }
  2709. function sequenceClose(code2) {
  2710. if (code2 === codes.graveAccent) {
  2711. effects.consume(code2);
  2712. size++;
  2713. return sequenceClose;
  2714. }
  2715. if (size === sizeOpen) {
  2716. effects.exit(types.codeTextSequence);
  2717. effects.exit(types.codeText);
  2718. return ok2(code2);
  2719. }
  2720. token.type = types.codeTextData;
  2721. return data(code2);
  2722. }
  2723. }
  2724. // node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js
  2725. var SpliceBuffer = class {
  2726. /**
  2727. * @param {ReadonlyArray<T> | null | undefined} [initial]
  2728. * Initial items (optional).
  2729. * @returns
  2730. * Splice buffer.
  2731. */
  2732. constructor(initial) {
  2733. this.left = initial ? [...initial] : [];
  2734. this.right = [];
  2735. }
  2736. /**
  2737. * Array access;
  2738. * does not move the cursor.
  2739. *
  2740. * @param {number} index
  2741. * Index.
  2742. * @return {T}
  2743. * Item.
  2744. */
  2745. get(index2) {
  2746. if (index2 < 0 || index2 >= this.left.length + this.right.length) {
  2747. throw new RangeError(
  2748. "Cannot access index `" + index2 + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`"
  2749. );
  2750. }
  2751. if (index2 < this.left.length) return this.left[index2];
  2752. return this.right[this.right.length - index2 + this.left.length - 1];
  2753. }
  2754. /**
  2755. * The length of the splice buffer, one greater than the largest index in the
  2756. * array.
  2757. */
  2758. get length() {
  2759. return this.left.length + this.right.length;
  2760. }
  2761. /**
  2762. * Remove and return `list[0]`;
  2763. * moves the cursor to `0`.
  2764. *
  2765. * @returns {T | undefined}
  2766. * Item, optional.
  2767. */
  2768. shift() {
  2769. this.setCursor(0);
  2770. return this.right.pop();
  2771. }
  2772. /**
  2773. * Slice the buffer to get an array;
  2774. * does not move the cursor.
  2775. *
  2776. * @param {number} start
  2777. * Start.
  2778. * @param {number | null | undefined} [end]
  2779. * End (optional).
  2780. * @returns {Array<T>}
  2781. * Array of items.
  2782. */
  2783. slice(start2, end) {
  2784. const stop = end === null || end === void 0 ? Number.POSITIVE_INFINITY : end;
  2785. if (stop < this.left.length) {
  2786. return this.left.slice(start2, stop);
  2787. }
  2788. if (start2 > this.left.length) {
  2789. return this.right.slice(
  2790. this.right.length - stop + this.left.length,
  2791. this.right.length - start2 + this.left.length
  2792. ).reverse();
  2793. }
  2794. return this.left.slice(start2).concat(
  2795. this.right.slice(this.right.length - stop + this.left.length).reverse()
  2796. );
  2797. }
  2798. /**
  2799. * Mimics the behavior of Array.prototype.splice() except for the change of
  2800. * interface necessary to avoid segfaults when patching in very large arrays.
  2801. *
  2802. * This operation moves cursor is moved to `start` and results in the cursor
  2803. * placed after any inserted items.
  2804. *
  2805. * @param {number} start
  2806. * Start;
  2807. * zero-based index at which to start changing the array;
  2808. * negative numbers count backwards from the end of the array and values
  2809. * that are out-of bounds are clamped to the appropriate end of the array.
  2810. * @param {number | null | undefined} [deleteCount=0]
  2811. * Delete count (default: `0`);
  2812. * maximum number of elements to delete, starting from start.
  2813. * @param {Array<T> | null | undefined} [items=[]]
  2814. * Items to include in place of the deleted items (default: `[]`).
  2815. * @return {Array<T>}
  2816. * Any removed items.
  2817. */
  2818. splice(start2, deleteCount, items) {
  2819. const count = deleteCount || 0;
  2820. this.setCursor(Math.trunc(start2));
  2821. const removed = this.right.splice(
  2822. this.right.length - count,
  2823. Number.POSITIVE_INFINITY
  2824. );
  2825. if (items) chunkedPush(this.left, items);
  2826. return removed.reverse();
  2827. }
  2828. /**
  2829. * Remove and return the highest-numbered item in the array, so
  2830. * `list[list.length - 1]`;
  2831. * Moves the cursor to `length`.
  2832. *
  2833. * @returns {T | undefined}
  2834. * Item, optional.
  2835. */
  2836. pop() {
  2837. this.setCursor(Number.POSITIVE_INFINITY);
  2838. return this.left.pop();
  2839. }
  2840. /**
  2841. * Inserts a single item to the high-numbered side of the array;
  2842. * moves the cursor to `length`.
  2843. *
  2844. * @param {T} item
  2845. * Item.
  2846. * @returns {undefined}
  2847. * Nothing.
  2848. */
  2849. push(item) {
  2850. this.setCursor(Number.POSITIVE_INFINITY);
  2851. this.left.push(item);
  2852. }
  2853. /**
  2854. * Inserts many items to the high-numbered side of the array.
  2855. * Moves the cursor to `length`.
  2856. *
  2857. * @param {Array<T>} items
  2858. * Items.
  2859. * @returns {undefined}
  2860. * Nothing.
  2861. */
  2862. pushMany(items) {
  2863. this.setCursor(Number.POSITIVE_INFINITY);
  2864. chunkedPush(this.left, items);
  2865. }
  2866. /**
  2867. * Inserts a single item to the low-numbered side of the array;
  2868. * Moves the cursor to `0`.
  2869. *
  2870. * @param {T} item
  2871. * Item.
  2872. * @returns {undefined}
  2873. * Nothing.
  2874. */
  2875. unshift(item) {
  2876. this.setCursor(0);
  2877. this.right.push(item);
  2878. }
  2879. /**
  2880. * Inserts many items to the low-numbered side of the array;
  2881. * moves the cursor to `0`.
  2882. *
  2883. * @param {Array<T>} items
  2884. * Items.
  2885. * @returns {undefined}
  2886. * Nothing.
  2887. */
  2888. unshiftMany(items) {
  2889. this.setCursor(0);
  2890. chunkedPush(this.right, items.reverse());
  2891. }
  2892. /**
  2893. * Move the cursor to a specific position in the array. Requires
  2894. * time proportional to the distance moved.
  2895. *
  2896. * If `n < 0`, the cursor will end up at the beginning.
  2897. * If `n > length`, the cursor will end up at the end.
  2898. *
  2899. * @param {number} n
  2900. * Position.
  2901. * @return {undefined}
  2902. * Nothing.
  2903. */
  2904. setCursor(n) {
  2905. if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0)
  2906. return;
  2907. if (n < this.left.length) {
  2908. const removed = this.left.splice(n, Number.POSITIVE_INFINITY);
  2909. chunkedPush(this.right, removed.reverse());
  2910. } else {
  2911. const removed = this.right.splice(
  2912. this.left.length + this.right.length - n,
  2913. Number.POSITIVE_INFINITY
  2914. );
  2915. chunkedPush(this.left, removed.reverse());
  2916. }
  2917. }
  2918. };
  2919. function chunkedPush(list3, right) {
  2920. let chunkStart = 0;
  2921. if (right.length < constants.v8MaxSafeChunkSize) {
  2922. list3.push(...right);
  2923. } else {
  2924. while (chunkStart < right.length) {
  2925. list3.push(
  2926. ...right.slice(chunkStart, chunkStart + constants.v8MaxSafeChunkSize)
  2927. );
  2928. chunkStart += constants.v8MaxSafeChunkSize;
  2929. }
  2930. }
  2931. }
  2932. // node_modules/micromark-util-subtokenize/dev/index.js
  2933. function subtokenize(eventsArray) {
  2934. const jumps = {};
  2935. let index2 = -1;
  2936. let event;
  2937. let lineIndex;
  2938. let otherIndex;
  2939. let otherEvent;
  2940. let parameters;
  2941. let subevents;
  2942. let more;
  2943. const events = new SpliceBuffer(eventsArray);
  2944. while (++index2 < events.length) {
  2945. while (index2 in jumps) {
  2946. index2 = jumps[index2];
  2947. }
  2948. event = events.get(index2);
  2949. if (index2 && event[1].type === types.chunkFlow && events.get(index2 - 1)[1].type === types.listItemPrefix) {
  2950. ok(event[1]._tokenizer, "expected `_tokenizer` on subtokens");
  2951. subevents = event[1]._tokenizer.events;
  2952. otherIndex = 0;
  2953. if (otherIndex < subevents.length && subevents[otherIndex][1].type === types.lineEndingBlank) {
  2954. otherIndex += 2;
  2955. }
  2956. if (otherIndex < subevents.length && subevents[otherIndex][1].type === types.content) {
  2957. while (++otherIndex < subevents.length) {
  2958. if (subevents[otherIndex][1].type === types.content) {
  2959. break;
  2960. }
  2961. if (subevents[otherIndex][1].type === types.chunkText) {
  2962. subevents[otherIndex][1]._isInFirstContentOfListItem = true;
  2963. otherIndex++;
  2964. }
  2965. }
  2966. }
  2967. }
  2968. if (event[0] === "enter") {
  2969. if (event[1].contentType) {
  2970. Object.assign(jumps, subcontent(events, index2));
  2971. index2 = jumps[index2];
  2972. more = true;
  2973. }
  2974. } else if (event[1]._container) {
  2975. otherIndex = index2;
  2976. lineIndex = void 0;
  2977. while (otherIndex--) {
  2978. otherEvent = events.get(otherIndex);
  2979. if (otherEvent[1].type === types.lineEnding || otherEvent[1].type === types.lineEndingBlank) {
  2980. if (otherEvent[0] === "enter") {
  2981. if (lineIndex) {
  2982. events.get(lineIndex)[1].type = types.lineEndingBlank;
  2983. }
  2984. otherEvent[1].type = types.lineEnding;
  2985. lineIndex = otherIndex;
  2986. }
  2987. } else if (otherEvent[1].type === types.linePrefix || otherEvent[1].type === types.listItemIndent) {
  2988. } else {
  2989. break;
  2990. }
  2991. }
  2992. if (lineIndex) {
  2993. event[1].end = { ...events.get(lineIndex)[1].start };
  2994. parameters = events.slice(lineIndex, index2);
  2995. parameters.unshift(event);
  2996. events.splice(lineIndex, index2 - lineIndex + 1, parameters);
  2997. }
  2998. }
  2999. }
  3000. splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));
  3001. return !more;
  3002. }
  3003. function subcontent(events, eventIndex) {
  3004. const token = events.get(eventIndex)[1];
  3005. const context = events.get(eventIndex)[2];
  3006. let startPosition = eventIndex - 1;
  3007. const startPositions = [];
  3008. ok(token.contentType, "expected `contentType` on subtokens");
  3009. let tokenizer = token._tokenizer;
  3010. if (!tokenizer) {
  3011. tokenizer = context.parser[token.contentType](token.start);
  3012. if (token._contentTypeTextTrailing) {
  3013. tokenizer._contentTypeTextTrailing = true;
  3014. }
  3015. }
  3016. const childEvents = tokenizer.events;
  3017. const jumps = [];
  3018. const gaps = {};
  3019. let stream;
  3020. let previous2;
  3021. let index2 = -1;
  3022. let current = token;
  3023. let adjust = 0;
  3024. let start2 = 0;
  3025. const breaks = [start2];
  3026. while (current) {
  3027. while (events.get(++startPosition)[1] !== current) {
  3028. }
  3029. ok(
  3030. !previous2 || current.previous === previous2,
  3031. "expected previous to match"
  3032. );
  3033. ok(!previous2 || previous2.next === current, "expected next to match");
  3034. startPositions.push(startPosition);
  3035. if (!current._tokenizer) {
  3036. stream = context.sliceStream(current);
  3037. if (!current.next) {
  3038. stream.push(codes.eof);
  3039. }
  3040. if (previous2) {
  3041. tokenizer.defineSkip(current.start);
  3042. }
  3043. if (current._isInFirstContentOfListItem) {
  3044. tokenizer._gfmTasklistFirstContentOfListItem = true;
  3045. }
  3046. tokenizer.write(stream);
  3047. if (current._isInFirstContentOfListItem) {
  3048. tokenizer._gfmTasklistFirstContentOfListItem = void 0;
  3049. }
  3050. }
  3051. previous2 = current;
  3052. current = current.next;
  3053. }
  3054. current = token;
  3055. while (++index2 < childEvents.length) {
  3056. if (
  3057. // Find a void token that includes a break.
  3058. 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
  3059. ) {
  3060. ok(current, "expected a current token");
  3061. start2 = index2 + 1;
  3062. breaks.push(start2);
  3063. current._tokenizer = void 0;
  3064. current.previous = void 0;
  3065. current = current.next;
  3066. }
  3067. }
  3068. tokenizer.events = [];
  3069. if (current) {
  3070. current._tokenizer = void 0;
  3071. current.previous = void 0;
  3072. ok(!current.next, "expected no next token");
  3073. } else {
  3074. breaks.pop();
  3075. }
  3076. index2 = breaks.length;
  3077. while (index2--) {
  3078. const slice = childEvents.slice(breaks[index2], breaks[index2 + 1]);
  3079. const start3 = startPositions.pop();
  3080. ok(start3 !== void 0, "expected a start position when splicing");
  3081. jumps.push([start3, start3 + slice.length - 1]);
  3082. events.splice(start3, 2, slice);
  3083. }
  3084. jumps.reverse();
  3085. index2 = -1;
  3086. while (++index2 < jumps.length) {
  3087. gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1];
  3088. adjust += jumps[index2][1] - jumps[index2][0] - 1;
  3089. }
  3090. return gaps;
  3091. }
  3092. // node_modules/micromark-core-commonmark/dev/lib/content.js
  3093. var content2 = { resolve: resolveContent, tokenize: tokenizeContent };
  3094. var continuationConstruct = { partial: true, tokenize: tokenizeContinuation };
  3095. function resolveContent(events) {
  3096. subtokenize(events);
  3097. return events;
  3098. }
  3099. function tokenizeContent(effects, ok2) {
  3100. let previous2;
  3101. return chunkStart;
  3102. function chunkStart(code2) {
  3103. ok(
  3104. code2 !== codes.eof && !markdownLineEnding(code2),
  3105. "expected no eof or eol"
  3106. );
  3107. effects.enter(types.content);
  3108. previous2 = effects.enter(types.chunkContent, {
  3109. contentType: constants.contentTypeContent
  3110. });
  3111. return chunkInside(code2);
  3112. }
  3113. function chunkInside(code2) {
  3114. if (code2 === codes.eof) {
  3115. return contentEnd(code2);
  3116. }
  3117. if (markdownLineEnding(code2)) {
  3118. return effects.check(
  3119. continuationConstruct,
  3120. contentContinue,
  3121. contentEnd
  3122. )(code2);
  3123. }
  3124. effects.consume(code2);
  3125. return chunkInside;
  3126. }
  3127. function contentEnd(code2) {
  3128. effects.exit(types.chunkContent);
  3129. effects.exit(types.content);
  3130. return ok2(code2);
  3131. }
  3132. function contentContinue(code2) {
  3133. ok(markdownLineEnding(code2), "expected eol");
  3134. effects.consume(code2);
  3135. effects.exit(types.chunkContent);
  3136. ok(previous2, "expected previous token");
  3137. previous2.next = effects.enter(types.chunkContent, {
  3138. contentType: constants.contentTypeContent,
  3139. previous: previous2
  3140. });
  3141. previous2 = previous2.next;
  3142. return chunkInside;
  3143. }
  3144. }
  3145. function tokenizeContinuation(effects, ok2, nok) {
  3146. const self2 = this;
  3147. return startLookahead;
  3148. function startLookahead(code2) {
  3149. ok(markdownLineEnding(code2), "expected a line ending");
  3150. effects.exit(types.chunkContent);
  3151. effects.enter(types.lineEnding);
  3152. effects.consume(code2);
  3153. effects.exit(types.lineEnding);
  3154. return factorySpace(effects, prefixed, types.linePrefix);
  3155. }
  3156. function prefixed(code2) {
  3157. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3158. return nok(code2);
  3159. }
  3160. ok(
  3161. self2.parser.constructs.disable.null,
  3162. "expected `disable.null` to be populated"
  3163. );
  3164. const tail = self2.events[self2.events.length - 1];
  3165. if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize) {
  3166. return ok2(code2);
  3167. }
  3168. return effects.interrupt(self2.parser.constructs.flow, nok, ok2)(code2);
  3169. }
  3170. }
  3171. // node_modules/micromark-factory-destination/dev/index.js
  3172. function factoryDestination(effects, ok2, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
  3173. const limit = max || Number.POSITIVE_INFINITY;
  3174. let balance = 0;
  3175. return start2;
  3176. function start2(code2) {
  3177. if (code2 === codes.lessThan) {
  3178. effects.enter(type);
  3179. effects.enter(literalType);
  3180. effects.enter(literalMarkerType);
  3181. effects.consume(code2);
  3182. effects.exit(literalMarkerType);
  3183. return enclosedBefore;
  3184. }
  3185. if (code2 === codes.eof || code2 === codes.space || code2 === codes.rightParenthesis || asciiControl(code2)) {
  3186. return nok(code2);
  3187. }
  3188. effects.enter(type);
  3189. effects.enter(rawType);
  3190. effects.enter(stringType);
  3191. effects.enter(types.chunkString, { contentType: constants.contentTypeString });
  3192. return raw(code2);
  3193. }
  3194. function enclosedBefore(code2) {
  3195. if (code2 === codes.greaterThan) {
  3196. effects.enter(literalMarkerType);
  3197. effects.consume(code2);
  3198. effects.exit(literalMarkerType);
  3199. effects.exit(literalType);
  3200. effects.exit(type);
  3201. return ok2;
  3202. }
  3203. effects.enter(stringType);
  3204. effects.enter(types.chunkString, { contentType: constants.contentTypeString });
  3205. return enclosed(code2);
  3206. }
  3207. function enclosed(code2) {
  3208. if (code2 === codes.greaterThan) {
  3209. effects.exit(types.chunkString);
  3210. effects.exit(stringType);
  3211. return enclosedBefore(code2);
  3212. }
  3213. if (code2 === codes.eof || code2 === codes.lessThan || markdownLineEnding(code2)) {
  3214. return nok(code2);
  3215. }
  3216. effects.consume(code2);
  3217. return code2 === codes.backslash ? enclosedEscape : enclosed;
  3218. }
  3219. function enclosedEscape(code2) {
  3220. if (code2 === codes.lessThan || code2 === codes.greaterThan || code2 === codes.backslash) {
  3221. effects.consume(code2);
  3222. return enclosed;
  3223. }
  3224. return enclosed(code2);
  3225. }
  3226. function raw(code2) {
  3227. if (!balance && (code2 === codes.eof || code2 === codes.rightParenthesis || markdownLineEndingOrSpace(code2))) {
  3228. effects.exit(types.chunkString);
  3229. effects.exit(stringType);
  3230. effects.exit(rawType);
  3231. effects.exit(type);
  3232. return ok2(code2);
  3233. }
  3234. if (balance < limit && code2 === codes.leftParenthesis) {
  3235. effects.consume(code2);
  3236. balance++;
  3237. return raw;
  3238. }
  3239. if (code2 === codes.rightParenthesis) {
  3240. effects.consume(code2);
  3241. balance--;
  3242. return raw;
  3243. }
  3244. if (code2 === codes.eof || code2 === codes.space || code2 === codes.leftParenthesis || asciiControl(code2)) {
  3245. return nok(code2);
  3246. }
  3247. effects.consume(code2);
  3248. return code2 === codes.backslash ? rawEscape : raw;
  3249. }
  3250. function rawEscape(code2) {
  3251. if (code2 === codes.leftParenthesis || code2 === codes.rightParenthesis || code2 === codes.backslash) {
  3252. effects.consume(code2);
  3253. return raw;
  3254. }
  3255. return raw(code2);
  3256. }
  3257. }
  3258. // node_modules/micromark-factory-label/dev/index.js
  3259. function factoryLabel(effects, ok2, nok, type, markerType, stringType) {
  3260. const self2 = this;
  3261. let size = 0;
  3262. let seen;
  3263. return start2;
  3264. function start2(code2) {
  3265. ok(code2 === codes.leftSquareBracket, "expected `[`");
  3266. effects.enter(type);
  3267. effects.enter(markerType);
  3268. effects.consume(code2);
  3269. effects.exit(markerType);
  3270. effects.enter(stringType);
  3271. return atBreak;
  3272. }
  3273. function atBreak(code2) {
  3274. 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
  3275. // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
  3276. // which doesn’t need this.
  3277. // Hidden footnotes hook.
  3278. /* c8 ignore next 3 */
  3279. code2 === codes.caret && !size && "_hiddenFootnoteSupport" in self2.parser.constructs) {
  3280. return nok(code2);
  3281. }
  3282. if (code2 === codes.rightSquareBracket) {
  3283. effects.exit(stringType);
  3284. effects.enter(markerType);
  3285. effects.consume(code2);
  3286. effects.exit(markerType);
  3287. effects.exit(type);
  3288. return ok2;
  3289. }
  3290. if (markdownLineEnding(code2)) {
  3291. effects.enter(types.lineEnding);
  3292. effects.consume(code2);
  3293. effects.exit(types.lineEnding);
  3294. return atBreak;
  3295. }
  3296. effects.enter(types.chunkString, { contentType: constants.contentTypeString });
  3297. return labelInside(code2);
  3298. }
  3299. function labelInside(code2) {
  3300. if (code2 === codes.eof || code2 === codes.leftSquareBracket || code2 === codes.rightSquareBracket || markdownLineEnding(code2) || size++ > constants.linkReferenceSizeMax) {
  3301. effects.exit(types.chunkString);
  3302. return atBreak(code2);
  3303. }
  3304. effects.consume(code2);
  3305. if (!seen) seen = !markdownSpace(code2);
  3306. return code2 === codes.backslash ? labelEscape : labelInside;
  3307. }
  3308. function labelEscape(code2) {
  3309. if (code2 === codes.leftSquareBracket || code2 === codes.backslash || code2 === codes.rightSquareBracket) {
  3310. effects.consume(code2);
  3311. size++;
  3312. return labelInside;
  3313. }
  3314. return labelInside(code2);
  3315. }
  3316. }
  3317. // node_modules/micromark-factory-title/dev/index.js
  3318. function factoryTitle(effects, ok2, nok, type, markerType, stringType) {
  3319. let marker;
  3320. return start2;
  3321. function start2(code2) {
  3322. if (code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.leftParenthesis) {
  3323. effects.enter(type);
  3324. effects.enter(markerType);
  3325. effects.consume(code2);
  3326. effects.exit(markerType);
  3327. marker = code2 === codes.leftParenthesis ? codes.rightParenthesis : code2;
  3328. return begin;
  3329. }
  3330. return nok(code2);
  3331. }
  3332. function begin(code2) {
  3333. if (code2 === marker) {
  3334. effects.enter(markerType);
  3335. effects.consume(code2);
  3336. effects.exit(markerType);
  3337. effects.exit(type);
  3338. return ok2;
  3339. }
  3340. effects.enter(stringType);
  3341. return atBreak(code2);
  3342. }
  3343. function atBreak(code2) {
  3344. if (code2 === marker) {
  3345. effects.exit(stringType);
  3346. return begin(marker);
  3347. }
  3348. if (code2 === codes.eof) {
  3349. return nok(code2);
  3350. }
  3351. if (markdownLineEnding(code2)) {
  3352. effects.enter(types.lineEnding);
  3353. effects.consume(code2);
  3354. effects.exit(types.lineEnding);
  3355. return factorySpace(effects, atBreak, types.linePrefix);
  3356. }
  3357. effects.enter(types.chunkString, { contentType: constants.contentTypeString });
  3358. return inside(code2);
  3359. }
  3360. function inside(code2) {
  3361. if (code2 === marker || code2 === codes.eof || markdownLineEnding(code2)) {
  3362. effects.exit(types.chunkString);
  3363. return atBreak(code2);
  3364. }
  3365. effects.consume(code2);
  3366. return code2 === codes.backslash ? escape : inside;
  3367. }
  3368. function escape(code2) {
  3369. if (code2 === marker || code2 === codes.backslash) {
  3370. effects.consume(code2);
  3371. return inside;
  3372. }
  3373. return inside(code2);
  3374. }
  3375. }
  3376. // node_modules/micromark-factory-whitespace/dev/index.js
  3377. function factoryWhitespace(effects, ok2) {
  3378. let seen;
  3379. return start2;
  3380. function start2(code2) {
  3381. if (markdownLineEnding(code2)) {
  3382. effects.enter(types.lineEnding);
  3383. effects.consume(code2);
  3384. effects.exit(types.lineEnding);
  3385. seen = true;
  3386. return start2;
  3387. }
  3388. if (markdownSpace(code2)) {
  3389. return factorySpace(
  3390. effects,
  3391. start2,
  3392. seen ? types.linePrefix : types.lineSuffix
  3393. )(code2);
  3394. }
  3395. return ok2(code2);
  3396. }
  3397. }
  3398. // node_modules/micromark-core-commonmark/dev/lib/definition.js
  3399. var definition = { name: "definition", tokenize: tokenizeDefinition };
  3400. var titleBefore = { partial: true, tokenize: tokenizeTitleBefore };
  3401. function tokenizeDefinition(effects, ok2, nok) {
  3402. const self2 = this;
  3403. let identifier;
  3404. return start2;
  3405. function start2(code2) {
  3406. effects.enter(types.definition);
  3407. return before(code2);
  3408. }
  3409. function before(code2) {
  3410. ok(code2 === codes.leftSquareBracket, "expected `[`");
  3411. return factoryLabel.call(
  3412. self2,
  3413. effects,
  3414. labelAfter,
  3415. // Note: we don’t need to reset the way `markdown-rs` does.
  3416. nok,
  3417. types.definitionLabel,
  3418. types.definitionLabelMarker,
  3419. types.definitionLabelString
  3420. )(code2);
  3421. }
  3422. function labelAfter(code2) {
  3423. identifier = normalizeIdentifier(
  3424. self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)
  3425. );
  3426. if (code2 === codes.colon) {
  3427. effects.enter(types.definitionMarker);
  3428. effects.consume(code2);
  3429. effects.exit(types.definitionMarker);
  3430. return markerAfter;
  3431. }
  3432. return nok(code2);
  3433. }
  3434. function markerAfter(code2) {
  3435. return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, destinationBefore)(code2) : destinationBefore(code2);
  3436. }
  3437. function destinationBefore(code2) {
  3438. return factoryDestination(
  3439. effects,
  3440. destinationAfter,
  3441. // Note: we don’t need to reset the way `markdown-rs` does.
  3442. nok,
  3443. types.definitionDestination,
  3444. types.definitionDestinationLiteral,
  3445. types.definitionDestinationLiteralMarker,
  3446. types.definitionDestinationRaw,
  3447. types.definitionDestinationString
  3448. )(code2);
  3449. }
  3450. function destinationAfter(code2) {
  3451. return effects.attempt(titleBefore, after, after)(code2);
  3452. }
  3453. function after(code2) {
  3454. return markdownSpace(code2) ? factorySpace(effects, afterWhitespace, types.whitespace)(code2) : afterWhitespace(code2);
  3455. }
  3456. function afterWhitespace(code2) {
  3457. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3458. effects.exit(types.definition);
  3459. self2.parser.defined.push(identifier);
  3460. return ok2(code2);
  3461. }
  3462. return nok(code2);
  3463. }
  3464. }
  3465. function tokenizeTitleBefore(effects, ok2, nok) {
  3466. return titleBefore2;
  3467. function titleBefore2(code2) {
  3468. return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, beforeMarker)(code2) : nok(code2);
  3469. }
  3470. function beforeMarker(code2) {
  3471. return factoryTitle(
  3472. effects,
  3473. titleAfter,
  3474. nok,
  3475. types.definitionTitle,
  3476. types.definitionTitleMarker,
  3477. types.definitionTitleString
  3478. )(code2);
  3479. }
  3480. function titleAfter(code2) {
  3481. return markdownSpace(code2) ? factorySpace(
  3482. effects,
  3483. titleAfterOptionalWhitespace,
  3484. types.whitespace
  3485. )(code2) : titleAfterOptionalWhitespace(code2);
  3486. }
  3487. function titleAfterOptionalWhitespace(code2) {
  3488. return code2 === codes.eof || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
  3489. }
  3490. }
  3491. // node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js
  3492. var hardBreakEscape = {
  3493. name: "hardBreakEscape",
  3494. tokenize: tokenizeHardBreakEscape
  3495. };
  3496. function tokenizeHardBreakEscape(effects, ok2, nok) {
  3497. return start2;
  3498. function start2(code2) {
  3499. ok(code2 === codes.backslash, "expected `\\`");
  3500. effects.enter(types.hardBreakEscape);
  3501. effects.consume(code2);
  3502. return after;
  3503. }
  3504. function after(code2) {
  3505. if (markdownLineEnding(code2)) {
  3506. effects.exit(types.hardBreakEscape);
  3507. return ok2(code2);
  3508. }
  3509. return nok(code2);
  3510. }
  3511. }
  3512. // node_modules/micromark-core-commonmark/dev/lib/heading-atx.js
  3513. var headingAtx = {
  3514. name: "headingAtx",
  3515. resolve: resolveHeadingAtx,
  3516. tokenize: tokenizeHeadingAtx
  3517. };
  3518. function resolveHeadingAtx(events, context) {
  3519. let contentEnd = events.length - 2;
  3520. let contentStart = 3;
  3521. let content3;
  3522. let text5;
  3523. if (events[contentStart][1].type === types.whitespace) {
  3524. contentStart += 2;
  3525. }
  3526. if (contentEnd - 2 > contentStart && events[contentEnd][1].type === types.whitespace) {
  3527. contentEnd -= 2;
  3528. }
  3529. if (events[contentEnd][1].type === types.atxHeadingSequence && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === types.whitespace)) {
  3530. contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
  3531. }
  3532. if (contentEnd > contentStart) {
  3533. content3 = {
  3534. type: types.atxHeadingText,
  3535. start: events[contentStart][1].start,
  3536. end: events[contentEnd][1].end
  3537. };
  3538. text5 = {
  3539. type: types.chunkText,
  3540. start: events[contentStart][1].start,
  3541. end: events[contentEnd][1].end,
  3542. contentType: constants.contentTypeText
  3543. };
  3544. splice(events, contentStart, contentEnd - contentStart + 1, [
  3545. ["enter", content3, context],
  3546. ["enter", text5, context],
  3547. ["exit", text5, context],
  3548. ["exit", content3, context]
  3549. ]);
  3550. }
  3551. return events;
  3552. }
  3553. function tokenizeHeadingAtx(effects, ok2, nok) {
  3554. let size = 0;
  3555. return start2;
  3556. function start2(code2) {
  3557. effects.enter(types.atxHeading);
  3558. return before(code2);
  3559. }
  3560. function before(code2) {
  3561. ok(code2 === codes.numberSign, "expected `#`");
  3562. effects.enter(types.atxHeadingSequence);
  3563. return sequenceOpen(code2);
  3564. }
  3565. function sequenceOpen(code2) {
  3566. if (code2 === codes.numberSign && size++ < constants.atxHeadingOpeningFenceSizeMax) {
  3567. effects.consume(code2);
  3568. return sequenceOpen;
  3569. }
  3570. if (code2 === codes.eof || markdownLineEndingOrSpace(code2)) {
  3571. effects.exit(types.atxHeadingSequence);
  3572. return atBreak(code2);
  3573. }
  3574. return nok(code2);
  3575. }
  3576. function atBreak(code2) {
  3577. if (code2 === codes.numberSign) {
  3578. effects.enter(types.atxHeadingSequence);
  3579. return sequenceFurther(code2);
  3580. }
  3581. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3582. effects.exit(types.atxHeading);
  3583. return ok2(code2);
  3584. }
  3585. if (markdownSpace(code2)) {
  3586. return factorySpace(effects, atBreak, types.whitespace)(code2);
  3587. }
  3588. effects.enter(types.atxHeadingText);
  3589. return data(code2);
  3590. }
  3591. function sequenceFurther(code2) {
  3592. if (code2 === codes.numberSign) {
  3593. effects.consume(code2);
  3594. return sequenceFurther;
  3595. }
  3596. effects.exit(types.atxHeadingSequence);
  3597. return atBreak(code2);
  3598. }
  3599. function data(code2) {
  3600. if (code2 === codes.eof || code2 === codes.numberSign || markdownLineEndingOrSpace(code2)) {
  3601. effects.exit(types.atxHeadingText);
  3602. return atBreak(code2);
  3603. }
  3604. effects.consume(code2);
  3605. return data;
  3606. }
  3607. }
  3608. // node_modules/micromark-util-html-tag-name/index.js
  3609. var htmlBlockNames = [
  3610. "address",
  3611. "article",
  3612. "aside",
  3613. "base",
  3614. "basefont",
  3615. "blockquote",
  3616. "body",
  3617. "caption",
  3618. "center",
  3619. "col",
  3620. "colgroup",
  3621. "dd",
  3622. "details",
  3623. "dialog",
  3624. "dir",
  3625. "div",
  3626. "dl",
  3627. "dt",
  3628. "fieldset",
  3629. "figcaption",
  3630. "figure",
  3631. "footer",
  3632. "form",
  3633. "frame",
  3634. "frameset",
  3635. "h1",
  3636. "h2",
  3637. "h3",
  3638. "h4",
  3639. "h5",
  3640. "h6",
  3641. "head",
  3642. "header",
  3643. "hr",
  3644. "html",
  3645. "iframe",
  3646. "legend",
  3647. "li",
  3648. "link",
  3649. "main",
  3650. "menu",
  3651. "menuitem",
  3652. "nav",
  3653. "noframes",
  3654. "ol",
  3655. "optgroup",
  3656. "option",
  3657. "p",
  3658. "param",
  3659. "search",
  3660. "section",
  3661. "summary",
  3662. "table",
  3663. "tbody",
  3664. "td",
  3665. "tfoot",
  3666. "th",
  3667. "thead",
  3668. "title",
  3669. "tr",
  3670. "track",
  3671. "ul"
  3672. ];
  3673. var htmlRawNames = ["pre", "script", "style", "textarea"];
  3674. // node_modules/micromark-core-commonmark/dev/lib/html-flow.js
  3675. var htmlFlow = {
  3676. concrete: true,
  3677. name: "htmlFlow",
  3678. resolveTo: resolveToHtmlFlow,
  3679. tokenize: tokenizeHtmlFlow
  3680. };
  3681. var blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore };
  3682. var nonLazyContinuationStart = {
  3683. partial: true,
  3684. tokenize: tokenizeNonLazyContinuationStart
  3685. };
  3686. function resolveToHtmlFlow(events) {
  3687. let index2 = events.length;
  3688. while (index2--) {
  3689. if (events[index2][0] === "enter" && events[index2][1].type === types.htmlFlow) {
  3690. break;
  3691. }
  3692. }
  3693. if (index2 > 1 && events[index2 - 2][1].type === types.linePrefix) {
  3694. events[index2][1].start = events[index2 - 2][1].start;
  3695. events[index2 + 1][1].start = events[index2 - 2][1].start;
  3696. events.splice(index2 - 2, 2);
  3697. }
  3698. return events;
  3699. }
  3700. function tokenizeHtmlFlow(effects, ok2, nok) {
  3701. const self2 = this;
  3702. let marker;
  3703. let closingTag;
  3704. let buffer;
  3705. let index2;
  3706. let markerB;
  3707. return start2;
  3708. function start2(code2) {
  3709. return before(code2);
  3710. }
  3711. function before(code2) {
  3712. ok(code2 === codes.lessThan, "expected `<`");
  3713. effects.enter(types.htmlFlow);
  3714. effects.enter(types.htmlFlowData);
  3715. effects.consume(code2);
  3716. return open;
  3717. }
  3718. function open(code2) {
  3719. if (code2 === codes.exclamationMark) {
  3720. effects.consume(code2);
  3721. return declarationOpen;
  3722. }
  3723. if (code2 === codes.slash) {
  3724. effects.consume(code2);
  3725. closingTag = true;
  3726. return tagCloseStart;
  3727. }
  3728. if (code2 === codes.questionMark) {
  3729. effects.consume(code2);
  3730. marker = constants.htmlInstruction;
  3731. return self2.interrupt ? ok2 : continuationDeclarationInside;
  3732. }
  3733. if (asciiAlpha(code2)) {
  3734. ok(code2 !== null);
  3735. effects.consume(code2);
  3736. buffer = String.fromCharCode(code2);
  3737. return tagName;
  3738. }
  3739. return nok(code2);
  3740. }
  3741. function declarationOpen(code2) {
  3742. if (code2 === codes.dash) {
  3743. effects.consume(code2);
  3744. marker = constants.htmlComment;
  3745. return commentOpenInside;
  3746. }
  3747. if (code2 === codes.leftSquareBracket) {
  3748. effects.consume(code2);
  3749. marker = constants.htmlCdata;
  3750. index2 = 0;
  3751. return cdataOpenInside;
  3752. }
  3753. if (asciiAlpha(code2)) {
  3754. effects.consume(code2);
  3755. marker = constants.htmlDeclaration;
  3756. return self2.interrupt ? ok2 : continuationDeclarationInside;
  3757. }
  3758. return nok(code2);
  3759. }
  3760. function commentOpenInside(code2) {
  3761. if (code2 === codes.dash) {
  3762. effects.consume(code2);
  3763. return self2.interrupt ? ok2 : continuationDeclarationInside;
  3764. }
  3765. return nok(code2);
  3766. }
  3767. function cdataOpenInside(code2) {
  3768. const value = constants.cdataOpeningString;
  3769. if (code2 === value.charCodeAt(index2++)) {
  3770. effects.consume(code2);
  3771. if (index2 === value.length) {
  3772. return self2.interrupt ? ok2 : continuation;
  3773. }
  3774. return cdataOpenInside;
  3775. }
  3776. return nok(code2);
  3777. }
  3778. function tagCloseStart(code2) {
  3779. if (asciiAlpha(code2)) {
  3780. ok(code2 !== null);
  3781. effects.consume(code2);
  3782. buffer = String.fromCharCode(code2);
  3783. return tagName;
  3784. }
  3785. return nok(code2);
  3786. }
  3787. function tagName(code2) {
  3788. if (code2 === codes.eof || code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
  3789. const slash = code2 === codes.slash;
  3790. const name2 = buffer.toLowerCase();
  3791. if (!slash && !closingTag && htmlRawNames.includes(name2)) {
  3792. marker = constants.htmlRaw;
  3793. return self2.interrupt ? ok2(code2) : continuation(code2);
  3794. }
  3795. if (htmlBlockNames.includes(buffer.toLowerCase())) {
  3796. marker = constants.htmlBasic;
  3797. if (slash) {
  3798. effects.consume(code2);
  3799. return basicSelfClosing;
  3800. }
  3801. return self2.interrupt ? ok2(code2) : continuation(code2);
  3802. }
  3803. marker = constants.htmlComplete;
  3804. return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code2) : closingTag ? completeClosingTagAfter(code2) : completeAttributeNameBefore(code2);
  3805. }
  3806. if (code2 === codes.dash || asciiAlphanumeric(code2)) {
  3807. effects.consume(code2);
  3808. buffer += String.fromCharCode(code2);
  3809. return tagName;
  3810. }
  3811. return nok(code2);
  3812. }
  3813. function basicSelfClosing(code2) {
  3814. if (code2 === codes.greaterThan) {
  3815. effects.consume(code2);
  3816. return self2.interrupt ? ok2 : continuation;
  3817. }
  3818. return nok(code2);
  3819. }
  3820. function completeClosingTagAfter(code2) {
  3821. if (markdownSpace(code2)) {
  3822. effects.consume(code2);
  3823. return completeClosingTagAfter;
  3824. }
  3825. return completeEnd(code2);
  3826. }
  3827. function completeAttributeNameBefore(code2) {
  3828. if (code2 === codes.slash) {
  3829. effects.consume(code2);
  3830. return completeEnd;
  3831. }
  3832. if (code2 === codes.colon || code2 === codes.underscore || asciiAlpha(code2)) {
  3833. effects.consume(code2);
  3834. return completeAttributeName;
  3835. }
  3836. if (markdownSpace(code2)) {
  3837. effects.consume(code2);
  3838. return completeAttributeNameBefore;
  3839. }
  3840. return completeEnd(code2);
  3841. }
  3842. function completeAttributeName(code2) {
  3843. if (code2 === codes.dash || code2 === codes.dot || code2 === codes.colon || code2 === codes.underscore || asciiAlphanumeric(code2)) {
  3844. effects.consume(code2);
  3845. return completeAttributeName;
  3846. }
  3847. return completeAttributeNameAfter(code2);
  3848. }
  3849. function completeAttributeNameAfter(code2) {
  3850. if (code2 === codes.equalsTo) {
  3851. effects.consume(code2);
  3852. return completeAttributeValueBefore;
  3853. }
  3854. if (markdownSpace(code2)) {
  3855. effects.consume(code2);
  3856. return completeAttributeNameAfter;
  3857. }
  3858. return completeAttributeNameBefore(code2);
  3859. }
  3860. function completeAttributeValueBefore(code2) {
  3861. if (code2 === codes.eof || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.greaterThan || code2 === codes.graveAccent) {
  3862. return nok(code2);
  3863. }
  3864. if (code2 === codes.quotationMark || code2 === codes.apostrophe) {
  3865. effects.consume(code2);
  3866. markerB = code2;
  3867. return completeAttributeValueQuoted;
  3868. }
  3869. if (markdownSpace(code2)) {
  3870. effects.consume(code2);
  3871. return completeAttributeValueBefore;
  3872. }
  3873. return completeAttributeValueUnquoted(code2);
  3874. }
  3875. function completeAttributeValueQuoted(code2) {
  3876. if (code2 === markerB) {
  3877. effects.consume(code2);
  3878. markerB = null;
  3879. return completeAttributeValueQuotedAfter;
  3880. }
  3881. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3882. return nok(code2);
  3883. }
  3884. effects.consume(code2);
  3885. return completeAttributeValueQuoted;
  3886. }
  3887. function completeAttributeValueUnquoted(code2) {
  3888. 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)) {
  3889. return completeAttributeNameAfter(code2);
  3890. }
  3891. effects.consume(code2);
  3892. return completeAttributeValueUnquoted;
  3893. }
  3894. function completeAttributeValueQuotedAfter(code2) {
  3895. if (code2 === codes.slash || code2 === codes.greaterThan || markdownSpace(code2)) {
  3896. return completeAttributeNameBefore(code2);
  3897. }
  3898. return nok(code2);
  3899. }
  3900. function completeEnd(code2) {
  3901. if (code2 === codes.greaterThan) {
  3902. effects.consume(code2);
  3903. return completeAfter;
  3904. }
  3905. return nok(code2);
  3906. }
  3907. function completeAfter(code2) {
  3908. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3909. return continuation(code2);
  3910. }
  3911. if (markdownSpace(code2)) {
  3912. effects.consume(code2);
  3913. return completeAfter;
  3914. }
  3915. return nok(code2);
  3916. }
  3917. function continuation(code2) {
  3918. if (code2 === codes.dash && marker === constants.htmlComment) {
  3919. effects.consume(code2);
  3920. return continuationCommentInside;
  3921. }
  3922. if (code2 === codes.lessThan && marker === constants.htmlRaw) {
  3923. effects.consume(code2);
  3924. return continuationRawTagOpen;
  3925. }
  3926. if (code2 === codes.greaterThan && marker === constants.htmlDeclaration) {
  3927. effects.consume(code2);
  3928. return continuationClose;
  3929. }
  3930. if (code2 === codes.questionMark && marker === constants.htmlInstruction) {
  3931. effects.consume(code2);
  3932. return continuationDeclarationInside;
  3933. }
  3934. if (code2 === codes.rightSquareBracket && marker === constants.htmlCdata) {
  3935. effects.consume(code2);
  3936. return continuationCdataInside;
  3937. }
  3938. if (markdownLineEnding(code2) && (marker === constants.htmlBasic || marker === constants.htmlComplete)) {
  3939. effects.exit(types.htmlFlowData);
  3940. return effects.check(
  3941. blankLineBefore,
  3942. continuationAfter,
  3943. continuationStart
  3944. )(code2);
  3945. }
  3946. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3947. effects.exit(types.htmlFlowData);
  3948. return continuationStart(code2);
  3949. }
  3950. effects.consume(code2);
  3951. return continuation;
  3952. }
  3953. function continuationStart(code2) {
  3954. return effects.check(
  3955. nonLazyContinuationStart,
  3956. continuationStartNonLazy,
  3957. continuationAfter
  3958. )(code2);
  3959. }
  3960. function continuationStartNonLazy(code2) {
  3961. ok(markdownLineEnding(code2));
  3962. effects.enter(types.lineEnding);
  3963. effects.consume(code2);
  3964. effects.exit(types.lineEnding);
  3965. return continuationBefore;
  3966. }
  3967. function continuationBefore(code2) {
  3968. if (code2 === codes.eof || markdownLineEnding(code2)) {
  3969. return continuationStart(code2);
  3970. }
  3971. effects.enter(types.htmlFlowData);
  3972. return continuation(code2);
  3973. }
  3974. function continuationCommentInside(code2) {
  3975. if (code2 === codes.dash) {
  3976. effects.consume(code2);
  3977. return continuationDeclarationInside;
  3978. }
  3979. return continuation(code2);
  3980. }
  3981. function continuationRawTagOpen(code2) {
  3982. if (code2 === codes.slash) {
  3983. effects.consume(code2);
  3984. buffer = "";
  3985. return continuationRawEndTag;
  3986. }
  3987. return continuation(code2);
  3988. }
  3989. function continuationRawEndTag(code2) {
  3990. if (code2 === codes.greaterThan) {
  3991. const name2 = buffer.toLowerCase();
  3992. if (htmlRawNames.includes(name2)) {
  3993. effects.consume(code2);
  3994. return continuationClose;
  3995. }
  3996. return continuation(code2);
  3997. }
  3998. if (asciiAlpha(code2) && buffer.length < constants.htmlRawSizeMax) {
  3999. ok(code2 !== null);
  4000. effects.consume(code2);
  4001. buffer += String.fromCharCode(code2);
  4002. return continuationRawEndTag;
  4003. }
  4004. return continuation(code2);
  4005. }
  4006. function continuationCdataInside(code2) {
  4007. if (code2 === codes.rightSquareBracket) {
  4008. effects.consume(code2);
  4009. return continuationDeclarationInside;
  4010. }
  4011. return continuation(code2);
  4012. }
  4013. function continuationDeclarationInside(code2) {
  4014. if (code2 === codes.greaterThan) {
  4015. effects.consume(code2);
  4016. return continuationClose;
  4017. }
  4018. if (code2 === codes.dash && marker === constants.htmlComment) {
  4019. effects.consume(code2);
  4020. return continuationDeclarationInside;
  4021. }
  4022. return continuation(code2);
  4023. }
  4024. function continuationClose(code2) {
  4025. if (code2 === codes.eof || markdownLineEnding(code2)) {
  4026. effects.exit(types.htmlFlowData);
  4027. return continuationAfter(code2);
  4028. }
  4029. effects.consume(code2);
  4030. return continuationClose;
  4031. }
  4032. function continuationAfter(code2) {
  4033. effects.exit(types.htmlFlow);
  4034. return ok2(code2);
  4035. }
  4036. }
  4037. function tokenizeNonLazyContinuationStart(effects, ok2, nok) {
  4038. const self2 = this;
  4039. return start2;
  4040. function start2(code2) {
  4041. if (markdownLineEnding(code2)) {
  4042. effects.enter(types.lineEnding);
  4043. effects.consume(code2);
  4044. effects.exit(types.lineEnding);
  4045. return after;
  4046. }
  4047. return nok(code2);
  4048. }
  4049. function after(code2) {
  4050. return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
  4051. }
  4052. }
  4053. function tokenizeBlankLineBefore(effects, ok2, nok) {
  4054. return start2;
  4055. function start2(code2) {
  4056. ok(markdownLineEnding(code2), "expected a line ending");
  4057. effects.enter(types.lineEnding);
  4058. effects.consume(code2);
  4059. effects.exit(types.lineEnding);
  4060. return effects.attempt(blankLine, ok2, nok);
  4061. }
  4062. }
  4063. // node_modules/micromark-core-commonmark/dev/lib/html-text.js
  4064. var htmlText = { name: "htmlText", tokenize: tokenizeHtmlText };
  4065. function tokenizeHtmlText(effects, ok2, nok) {
  4066. const self2 = this;
  4067. let marker;
  4068. let index2;
  4069. let returnState;
  4070. return start2;
  4071. function start2(code2) {
  4072. ok(code2 === codes.lessThan, "expected `<`");
  4073. effects.enter(types.htmlText);
  4074. effects.enter(types.htmlTextData);
  4075. effects.consume(code2);
  4076. return open;
  4077. }
  4078. function open(code2) {
  4079. if (code2 === codes.exclamationMark) {
  4080. effects.consume(code2);
  4081. return declarationOpen;
  4082. }
  4083. if (code2 === codes.slash) {
  4084. effects.consume(code2);
  4085. return tagCloseStart;
  4086. }
  4087. if (code2 === codes.questionMark) {
  4088. effects.consume(code2);
  4089. return instruction;
  4090. }
  4091. if (asciiAlpha(code2)) {
  4092. effects.consume(code2);
  4093. return tagOpen;
  4094. }
  4095. return nok(code2);
  4096. }
  4097. function declarationOpen(code2) {
  4098. if (code2 === codes.dash) {
  4099. effects.consume(code2);
  4100. return commentOpenInside;
  4101. }
  4102. if (code2 === codes.leftSquareBracket) {
  4103. effects.consume(code2);
  4104. index2 = 0;
  4105. return cdataOpenInside;
  4106. }
  4107. if (asciiAlpha(code2)) {
  4108. effects.consume(code2);
  4109. return declaration;
  4110. }
  4111. return nok(code2);
  4112. }
  4113. function commentOpenInside(code2) {
  4114. if (code2 === codes.dash) {
  4115. effects.consume(code2);
  4116. return commentEnd;
  4117. }
  4118. return nok(code2);
  4119. }
  4120. function comment(code2) {
  4121. if (code2 === codes.eof) {
  4122. return nok(code2);
  4123. }
  4124. if (code2 === codes.dash) {
  4125. effects.consume(code2);
  4126. return commentClose;
  4127. }
  4128. if (markdownLineEnding(code2)) {
  4129. returnState = comment;
  4130. return lineEndingBefore(code2);
  4131. }
  4132. effects.consume(code2);
  4133. return comment;
  4134. }
  4135. function commentClose(code2) {
  4136. if (code2 === codes.dash) {
  4137. effects.consume(code2);
  4138. return commentEnd;
  4139. }
  4140. return comment(code2);
  4141. }
  4142. function commentEnd(code2) {
  4143. return code2 === codes.greaterThan ? end(code2) : code2 === codes.dash ? commentClose(code2) : comment(code2);
  4144. }
  4145. function cdataOpenInside(code2) {
  4146. const value = constants.cdataOpeningString;
  4147. if (code2 === value.charCodeAt(index2++)) {
  4148. effects.consume(code2);
  4149. return index2 === value.length ? cdata : cdataOpenInside;
  4150. }
  4151. return nok(code2);
  4152. }
  4153. function cdata(code2) {
  4154. if (code2 === codes.eof) {
  4155. return nok(code2);
  4156. }
  4157. if (code2 === codes.rightSquareBracket) {
  4158. effects.consume(code2);
  4159. return cdataClose;
  4160. }
  4161. if (markdownLineEnding(code2)) {
  4162. returnState = cdata;
  4163. return lineEndingBefore(code2);
  4164. }
  4165. effects.consume(code2);
  4166. return cdata;
  4167. }
  4168. function cdataClose(code2) {
  4169. if (code2 === codes.rightSquareBracket) {
  4170. effects.consume(code2);
  4171. return cdataEnd;
  4172. }
  4173. return cdata(code2);
  4174. }
  4175. function cdataEnd(code2) {
  4176. if (code2 === codes.greaterThan) {
  4177. return end(code2);
  4178. }
  4179. if (code2 === codes.rightSquareBracket) {
  4180. effects.consume(code2);
  4181. return cdataEnd;
  4182. }
  4183. return cdata(code2);
  4184. }
  4185. function declaration(code2) {
  4186. if (code2 === codes.eof || code2 === codes.greaterThan) {
  4187. return end(code2);
  4188. }
  4189. if (markdownLineEnding(code2)) {
  4190. returnState = declaration;
  4191. return lineEndingBefore(code2);
  4192. }
  4193. effects.consume(code2);
  4194. return declaration;
  4195. }
  4196. function instruction(code2) {
  4197. if (code2 === codes.eof) {
  4198. return nok(code2);
  4199. }
  4200. if (code2 === codes.questionMark) {
  4201. effects.consume(code2);
  4202. return instructionClose;
  4203. }
  4204. if (markdownLineEnding(code2)) {
  4205. returnState = instruction;
  4206. return lineEndingBefore(code2);
  4207. }
  4208. effects.consume(code2);
  4209. return instruction;
  4210. }
  4211. function instructionClose(code2) {
  4212. return code2 === codes.greaterThan ? end(code2) : instruction(code2);
  4213. }
  4214. function tagCloseStart(code2) {
  4215. if (asciiAlpha(code2)) {
  4216. effects.consume(code2);
  4217. return tagClose;
  4218. }
  4219. return nok(code2);
  4220. }
  4221. function tagClose(code2) {
  4222. if (code2 === codes.dash || asciiAlphanumeric(code2)) {
  4223. effects.consume(code2);
  4224. return tagClose;
  4225. }
  4226. return tagCloseBetween(code2);
  4227. }
  4228. function tagCloseBetween(code2) {
  4229. if (markdownLineEnding(code2)) {
  4230. returnState = tagCloseBetween;
  4231. return lineEndingBefore(code2);
  4232. }
  4233. if (markdownSpace(code2)) {
  4234. effects.consume(code2);
  4235. return tagCloseBetween;
  4236. }
  4237. return end(code2);
  4238. }
  4239. function tagOpen(code2) {
  4240. if (code2 === codes.dash || asciiAlphanumeric(code2)) {
  4241. effects.consume(code2);
  4242. return tagOpen;
  4243. }
  4244. if (code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
  4245. return tagOpenBetween(code2);
  4246. }
  4247. return nok(code2);
  4248. }
  4249. function tagOpenBetween(code2) {
  4250. if (code2 === codes.slash) {
  4251. effects.consume(code2);
  4252. return end;
  4253. }
  4254. if (code2 === codes.colon || code2 === codes.underscore || asciiAlpha(code2)) {
  4255. effects.consume(code2);
  4256. return tagOpenAttributeName;
  4257. }
  4258. if (markdownLineEnding(code2)) {
  4259. returnState = tagOpenBetween;
  4260. return lineEndingBefore(code2);
  4261. }
  4262. if (markdownSpace(code2)) {
  4263. effects.consume(code2);
  4264. return tagOpenBetween;
  4265. }
  4266. return end(code2);
  4267. }
  4268. function tagOpenAttributeName(code2) {
  4269. if (code2 === codes.dash || code2 === codes.dot || code2 === codes.colon || code2 === codes.underscore || asciiAlphanumeric(code2)) {
  4270. effects.consume(code2);
  4271. return tagOpenAttributeName;
  4272. }
  4273. return tagOpenAttributeNameAfter(code2);
  4274. }
  4275. function tagOpenAttributeNameAfter(code2) {
  4276. if (code2 === codes.equalsTo) {
  4277. effects.consume(code2);
  4278. return tagOpenAttributeValueBefore;
  4279. }
  4280. if (markdownLineEnding(code2)) {
  4281. returnState = tagOpenAttributeNameAfter;
  4282. return lineEndingBefore(code2);
  4283. }
  4284. if (markdownSpace(code2)) {
  4285. effects.consume(code2);
  4286. return tagOpenAttributeNameAfter;
  4287. }
  4288. return tagOpenBetween(code2);
  4289. }
  4290. function tagOpenAttributeValueBefore(code2) {
  4291. if (code2 === codes.eof || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.greaterThan || code2 === codes.graveAccent) {
  4292. return nok(code2);
  4293. }
  4294. if (code2 === codes.quotationMark || code2 === codes.apostrophe) {
  4295. effects.consume(code2);
  4296. marker = code2;
  4297. return tagOpenAttributeValueQuoted;
  4298. }
  4299. if (markdownLineEnding(code2)) {
  4300. returnState = tagOpenAttributeValueBefore;
  4301. return lineEndingBefore(code2);
  4302. }
  4303. if (markdownSpace(code2)) {
  4304. effects.consume(code2);
  4305. return tagOpenAttributeValueBefore;
  4306. }
  4307. effects.consume(code2);
  4308. return tagOpenAttributeValueUnquoted;
  4309. }
  4310. function tagOpenAttributeValueQuoted(code2) {
  4311. if (code2 === marker) {
  4312. effects.consume(code2);
  4313. marker = void 0;
  4314. return tagOpenAttributeValueQuotedAfter;
  4315. }
  4316. if (code2 === codes.eof) {
  4317. return nok(code2);
  4318. }
  4319. if (markdownLineEnding(code2)) {
  4320. returnState = tagOpenAttributeValueQuoted;
  4321. return lineEndingBefore(code2);
  4322. }
  4323. effects.consume(code2);
  4324. return tagOpenAttributeValueQuoted;
  4325. }
  4326. function tagOpenAttributeValueUnquoted(code2) {
  4327. if (code2 === codes.eof || code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.lessThan || code2 === codes.equalsTo || code2 === codes.graveAccent) {
  4328. return nok(code2);
  4329. }
  4330. if (code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
  4331. return tagOpenBetween(code2);
  4332. }
  4333. effects.consume(code2);
  4334. return tagOpenAttributeValueUnquoted;
  4335. }
  4336. function tagOpenAttributeValueQuotedAfter(code2) {
  4337. if (code2 === codes.slash || code2 === codes.greaterThan || markdownLineEndingOrSpace(code2)) {
  4338. return tagOpenBetween(code2);
  4339. }
  4340. return nok(code2);
  4341. }
  4342. function end(code2) {
  4343. if (code2 === codes.greaterThan) {
  4344. effects.consume(code2);
  4345. effects.exit(types.htmlTextData);
  4346. effects.exit(types.htmlText);
  4347. return ok2;
  4348. }
  4349. return nok(code2);
  4350. }
  4351. function lineEndingBefore(code2) {
  4352. ok(returnState, "expected return state");
  4353. ok(markdownLineEnding(code2), "expected eol");
  4354. effects.exit(types.htmlTextData);
  4355. effects.enter(types.lineEnding);
  4356. effects.consume(code2);
  4357. effects.exit(types.lineEnding);
  4358. return lineEndingAfter;
  4359. }
  4360. function lineEndingAfter(code2) {
  4361. ok(
  4362. self2.parser.constructs.disable.null,
  4363. "expected `disable.null` to be populated"
  4364. );
  4365. return markdownSpace(code2) ? factorySpace(
  4366. effects,
  4367. lineEndingAfterPrefix,
  4368. types.linePrefix,
  4369. self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
  4370. )(code2) : lineEndingAfterPrefix(code2);
  4371. }
  4372. function lineEndingAfterPrefix(code2) {
  4373. effects.enter(types.htmlTextData);
  4374. return returnState(code2);
  4375. }
  4376. }
  4377. // node_modules/micromark-core-commonmark/dev/lib/label-end.js
  4378. var labelEnd = {
  4379. name: "labelEnd",
  4380. resolveAll: resolveAllLabelEnd,
  4381. resolveTo: resolveToLabelEnd,
  4382. tokenize: tokenizeLabelEnd
  4383. };
  4384. var resourceConstruct = { tokenize: tokenizeResource };
  4385. var referenceFullConstruct = { tokenize: tokenizeReferenceFull };
  4386. var referenceCollapsedConstruct = { tokenize: tokenizeReferenceCollapsed };
  4387. function resolveAllLabelEnd(events) {
  4388. let index2 = -1;
  4389. const newEvents = [];
  4390. while (++index2 < events.length) {
  4391. const token = events[index2][1];
  4392. newEvents.push(events[index2]);
  4393. if (token.type === types.labelImage || token.type === types.labelLink || token.type === types.labelEnd) {
  4394. const offset = token.type === types.labelImage ? 4 : 2;
  4395. token.type = types.data;
  4396. index2 += offset;
  4397. }
  4398. }
  4399. if (events.length !== newEvents.length) {
  4400. splice(events, 0, events.length, newEvents);
  4401. }
  4402. return events;
  4403. }
  4404. function resolveToLabelEnd(events, context) {
  4405. let index2 = events.length;
  4406. let offset = 0;
  4407. let token;
  4408. let open;
  4409. let close;
  4410. let media;
  4411. while (index2--) {
  4412. token = events[index2][1];
  4413. if (open) {
  4414. if (token.type === types.link || token.type === types.labelLink && token._inactive) {
  4415. break;
  4416. }
  4417. if (events[index2][0] === "enter" && token.type === types.labelLink) {
  4418. token._inactive = true;
  4419. }
  4420. } else if (close) {
  4421. if (events[index2][0] === "enter" && (token.type === types.labelImage || token.type === types.labelLink) && !token._balanced) {
  4422. open = index2;
  4423. if (token.type !== types.labelLink) {
  4424. offset = 2;
  4425. break;
  4426. }
  4427. }
  4428. } else if (token.type === types.labelEnd) {
  4429. close = index2;
  4430. }
  4431. }
  4432. ok(open !== void 0, "`open` is supposed to be found");
  4433. ok(close !== void 0, "`close` is supposed to be found");
  4434. const group = {
  4435. type: events[open][1].type === types.labelLink ? types.link : types.image,
  4436. start: { ...events[open][1].start },
  4437. end: { ...events[events.length - 1][1].end }
  4438. };
  4439. const label = {
  4440. type: types.label,
  4441. start: { ...events[open][1].start },
  4442. end: { ...events[close][1].end }
  4443. };
  4444. const text5 = {
  4445. type: types.labelText,
  4446. start: { ...events[open + offset + 2][1].end },
  4447. end: { ...events[close - 2][1].start }
  4448. };
  4449. media = [
  4450. ["enter", group, context],
  4451. ["enter", label, context]
  4452. ];
  4453. media = push(media, events.slice(open + 1, open + offset + 3));
  4454. media = push(media, [["enter", text5, context]]);
  4455. ok(
  4456. context.parser.constructs.insideSpan.null,
  4457. "expected `insideSpan.null` to be populated"
  4458. );
  4459. media = push(
  4460. media,
  4461. resolveAll(
  4462. context.parser.constructs.insideSpan.null,
  4463. events.slice(open + offset + 4, close - 3),
  4464. context
  4465. )
  4466. );
  4467. media = push(media, [
  4468. ["exit", text5, context],
  4469. events[close - 2],
  4470. events[close - 1],
  4471. ["exit", label, context]
  4472. ]);
  4473. media = push(media, events.slice(close + 1));
  4474. media = push(media, [["exit", group, context]]);
  4475. splice(events, open, events.length, media);
  4476. return events;
  4477. }
  4478. function tokenizeLabelEnd(effects, ok2, nok) {
  4479. const self2 = this;
  4480. let index2 = self2.events.length;
  4481. let labelStart;
  4482. let defined;
  4483. while (index2--) {
  4484. if ((self2.events[index2][1].type === types.labelImage || self2.events[index2][1].type === types.labelLink) && !self2.events[index2][1]._balanced) {
  4485. labelStart = self2.events[index2][1];
  4486. break;
  4487. }
  4488. }
  4489. return start2;
  4490. function start2(code2) {
  4491. ok(code2 === codes.rightSquareBracket, "expected `]`");
  4492. if (!labelStart) {
  4493. return nok(code2);
  4494. }
  4495. if (labelStart._inactive) {
  4496. return labelEndNok(code2);
  4497. }
  4498. defined = self2.parser.defined.includes(
  4499. normalizeIdentifier(
  4500. self2.sliceSerialize({ start: labelStart.end, end: self2.now() })
  4501. )
  4502. );
  4503. effects.enter(types.labelEnd);
  4504. effects.enter(types.labelMarker);
  4505. effects.consume(code2);
  4506. effects.exit(types.labelMarker);
  4507. effects.exit(types.labelEnd);
  4508. return after;
  4509. }
  4510. function after(code2) {
  4511. if (code2 === codes.leftParenthesis) {
  4512. return effects.attempt(
  4513. resourceConstruct,
  4514. labelEndOk,
  4515. defined ? labelEndOk : labelEndNok
  4516. )(code2);
  4517. }
  4518. if (code2 === codes.leftSquareBracket) {
  4519. return effects.attempt(
  4520. referenceFullConstruct,
  4521. labelEndOk,
  4522. defined ? referenceNotFull : labelEndNok
  4523. )(code2);
  4524. }
  4525. return defined ? labelEndOk(code2) : labelEndNok(code2);
  4526. }
  4527. function referenceNotFull(code2) {
  4528. return effects.attempt(
  4529. referenceCollapsedConstruct,
  4530. labelEndOk,
  4531. labelEndNok
  4532. )(code2);
  4533. }
  4534. function labelEndOk(code2) {
  4535. return ok2(code2);
  4536. }
  4537. function labelEndNok(code2) {
  4538. labelStart._balanced = true;
  4539. return nok(code2);
  4540. }
  4541. }
  4542. function tokenizeResource(effects, ok2, nok) {
  4543. return resourceStart;
  4544. function resourceStart(code2) {
  4545. ok(code2 === codes.leftParenthesis, "expected left paren");
  4546. effects.enter(types.resource);
  4547. effects.enter(types.resourceMarker);
  4548. effects.consume(code2);
  4549. effects.exit(types.resourceMarker);
  4550. return resourceBefore;
  4551. }
  4552. function resourceBefore(code2) {
  4553. return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceOpen)(code2) : resourceOpen(code2);
  4554. }
  4555. function resourceOpen(code2) {
  4556. if (code2 === codes.rightParenthesis) {
  4557. return resourceEnd(code2);
  4558. }
  4559. return factoryDestination(
  4560. effects,
  4561. resourceDestinationAfter,
  4562. resourceDestinationMissing,
  4563. types.resourceDestination,
  4564. types.resourceDestinationLiteral,
  4565. types.resourceDestinationLiteralMarker,
  4566. types.resourceDestinationRaw,
  4567. types.resourceDestinationString,
  4568. constants.linkResourceDestinationBalanceMax
  4569. )(code2);
  4570. }
  4571. function resourceDestinationAfter(code2) {
  4572. return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceBetween)(code2) : resourceEnd(code2);
  4573. }
  4574. function resourceDestinationMissing(code2) {
  4575. return nok(code2);
  4576. }
  4577. function resourceBetween(code2) {
  4578. if (code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.leftParenthesis) {
  4579. return factoryTitle(
  4580. effects,
  4581. resourceTitleAfter,
  4582. nok,
  4583. types.resourceTitle,
  4584. types.resourceTitleMarker,
  4585. types.resourceTitleString
  4586. )(code2);
  4587. }
  4588. return resourceEnd(code2);
  4589. }
  4590. function resourceTitleAfter(code2) {
  4591. return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceEnd)(code2) : resourceEnd(code2);
  4592. }
  4593. function resourceEnd(code2) {
  4594. if (code2 === codes.rightParenthesis) {
  4595. effects.enter(types.resourceMarker);
  4596. effects.consume(code2);
  4597. effects.exit(types.resourceMarker);
  4598. effects.exit(types.resource);
  4599. return ok2;
  4600. }
  4601. return nok(code2);
  4602. }
  4603. }
  4604. function tokenizeReferenceFull(effects, ok2, nok) {
  4605. const self2 = this;
  4606. return referenceFull;
  4607. function referenceFull(code2) {
  4608. ok(code2 === codes.leftSquareBracket, "expected left bracket");
  4609. return factoryLabel.call(
  4610. self2,
  4611. effects,
  4612. referenceFullAfter,
  4613. referenceFullMissing,
  4614. types.reference,
  4615. types.referenceMarker,
  4616. types.referenceString
  4617. )(code2);
  4618. }
  4619. function referenceFullAfter(code2) {
  4620. return self2.parser.defined.includes(
  4621. normalizeIdentifier(
  4622. self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)
  4623. )
  4624. ) ? ok2(code2) : nok(code2);
  4625. }
  4626. function referenceFullMissing(code2) {
  4627. return nok(code2);
  4628. }
  4629. }
  4630. function tokenizeReferenceCollapsed(effects, ok2, nok) {
  4631. return referenceCollapsedStart;
  4632. function referenceCollapsedStart(code2) {
  4633. ok(code2 === codes.leftSquareBracket, "expected left bracket");
  4634. effects.enter(types.reference);
  4635. effects.enter(types.referenceMarker);
  4636. effects.consume(code2);
  4637. effects.exit(types.referenceMarker);
  4638. return referenceCollapsedOpen;
  4639. }
  4640. function referenceCollapsedOpen(code2) {
  4641. if (code2 === codes.rightSquareBracket) {
  4642. effects.enter(types.referenceMarker);
  4643. effects.consume(code2);
  4644. effects.exit(types.referenceMarker);
  4645. effects.exit(types.reference);
  4646. return ok2;
  4647. }
  4648. return nok(code2);
  4649. }
  4650. }
  4651. // node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
  4652. var labelStartImage = {
  4653. name: "labelStartImage",
  4654. resolveAll: labelEnd.resolveAll,
  4655. tokenize: tokenizeLabelStartImage
  4656. };
  4657. function tokenizeLabelStartImage(effects, ok2, nok) {
  4658. const self2 = this;
  4659. return start2;
  4660. function start2(code2) {
  4661. ok(code2 === codes.exclamationMark, "expected `!`");
  4662. effects.enter(types.labelImage);
  4663. effects.enter(types.labelImageMarker);
  4664. effects.consume(code2);
  4665. effects.exit(types.labelImageMarker);
  4666. return open;
  4667. }
  4668. function open(code2) {
  4669. if (code2 === codes.leftSquareBracket) {
  4670. effects.enter(types.labelMarker);
  4671. effects.consume(code2);
  4672. effects.exit(types.labelMarker);
  4673. effects.exit(types.labelImage);
  4674. return after;
  4675. }
  4676. return nok(code2);
  4677. }
  4678. function after(code2) {
  4679. return code2 === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
  4680. }
  4681. }
  4682. // node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
  4683. var labelStartLink = {
  4684. name: "labelStartLink",
  4685. resolveAll: labelEnd.resolveAll,
  4686. tokenize: tokenizeLabelStartLink
  4687. };
  4688. function tokenizeLabelStartLink(effects, ok2, nok) {
  4689. const self2 = this;
  4690. return start2;
  4691. function start2(code2) {
  4692. ok(code2 === codes.leftSquareBracket, "expected `[`");
  4693. effects.enter(types.labelLink);
  4694. effects.enter(types.labelMarker);
  4695. effects.consume(code2);
  4696. effects.exit(types.labelMarker);
  4697. effects.exit(types.labelLink);
  4698. return after;
  4699. }
  4700. function after(code2) {
  4701. return code2 === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
  4702. }
  4703. }
  4704. // node_modules/micromark-core-commonmark/dev/lib/line-ending.js
  4705. var lineEnding = { name: "lineEnding", tokenize: tokenizeLineEnding };
  4706. function tokenizeLineEnding(effects, ok2) {
  4707. return start2;
  4708. function start2(code2) {
  4709. ok(markdownLineEnding(code2), "expected eol");
  4710. effects.enter(types.lineEnding);
  4711. effects.consume(code2);
  4712. effects.exit(types.lineEnding);
  4713. return factorySpace(effects, ok2, types.linePrefix);
  4714. }
  4715. }
  4716. // node_modules/micromark-core-commonmark/dev/lib/thematic-break.js
  4717. var thematicBreak = {
  4718. name: "thematicBreak",
  4719. tokenize: tokenizeThematicBreak
  4720. };
  4721. function tokenizeThematicBreak(effects, ok2, nok) {
  4722. let size = 0;
  4723. let marker;
  4724. return start2;
  4725. function start2(code2) {
  4726. effects.enter(types.thematicBreak);
  4727. return before(code2);
  4728. }
  4729. function before(code2) {
  4730. ok(
  4731. code2 === codes.asterisk || code2 === codes.dash || code2 === codes.underscore,
  4732. "expected `*`, `-`, or `_`"
  4733. );
  4734. marker = code2;
  4735. return atBreak(code2);
  4736. }
  4737. function atBreak(code2) {
  4738. if (code2 === marker) {
  4739. effects.enter(types.thematicBreakSequence);
  4740. return sequence(code2);
  4741. }
  4742. if (size >= constants.thematicBreakMarkerCountMin && (code2 === codes.eof || markdownLineEnding(code2))) {
  4743. effects.exit(types.thematicBreak);
  4744. return ok2(code2);
  4745. }
  4746. return nok(code2);
  4747. }
  4748. function sequence(code2) {
  4749. if (code2 === marker) {
  4750. effects.consume(code2);
  4751. size++;
  4752. return sequence;
  4753. }
  4754. effects.exit(types.thematicBreakSequence);
  4755. return markdownSpace(code2) ? factorySpace(effects, atBreak, types.whitespace)(code2) : atBreak(code2);
  4756. }
  4757. }
  4758. // node_modules/micromark-core-commonmark/dev/lib/list.js
  4759. var list = {
  4760. continuation: { tokenize: tokenizeListContinuation },
  4761. exit: tokenizeListEnd,
  4762. name: "list",
  4763. tokenize: tokenizeListStart
  4764. };
  4765. var listItemPrefixWhitespaceConstruct = {
  4766. partial: true,
  4767. tokenize: tokenizeListItemPrefixWhitespace
  4768. };
  4769. var indentConstruct = { partial: true, tokenize: tokenizeIndent };
  4770. function tokenizeListStart(effects, ok2, nok) {
  4771. const self2 = this;
  4772. const tail = self2.events[self2.events.length - 1];
  4773. let initialSize = tail && tail[1].type === types.linePrefix ? tail[2].sliceSerialize(tail[1], true).length : 0;
  4774. let size = 0;
  4775. return start2;
  4776. function start2(code2) {
  4777. ok(self2.containerState, "expected state");
  4778. const kind = self2.containerState.type || (code2 === codes.asterisk || code2 === codes.plusSign || code2 === codes.dash ? types.listUnordered : types.listOrdered);
  4779. if (kind === types.listUnordered ? !self2.containerState.marker || code2 === self2.containerState.marker : asciiDigit(code2)) {
  4780. if (!self2.containerState.type) {
  4781. self2.containerState.type = kind;
  4782. effects.enter(kind, { _container: true });
  4783. }
  4784. if (kind === types.listUnordered) {
  4785. effects.enter(types.listItemPrefix);
  4786. return code2 === codes.asterisk || code2 === codes.dash ? effects.check(thematicBreak, nok, atMarker)(code2) : atMarker(code2);
  4787. }
  4788. if (!self2.interrupt || code2 === codes.digit1) {
  4789. effects.enter(types.listItemPrefix);
  4790. effects.enter(types.listItemValue);
  4791. return inside(code2);
  4792. }
  4793. }
  4794. return nok(code2);
  4795. }
  4796. function inside(code2) {
  4797. ok(self2.containerState, "expected state");
  4798. if (asciiDigit(code2) && ++size < constants.listItemValueSizeMax) {
  4799. effects.consume(code2);
  4800. return inside;
  4801. }
  4802. if ((!self2.interrupt || size < 2) && (self2.containerState.marker ? code2 === self2.containerState.marker : code2 === codes.rightParenthesis || code2 === codes.dot)) {
  4803. effects.exit(types.listItemValue);
  4804. return atMarker(code2);
  4805. }
  4806. return nok(code2);
  4807. }
  4808. function atMarker(code2) {
  4809. ok(self2.containerState, "expected state");
  4810. ok(code2 !== codes.eof, "eof (`null`) is not a marker");
  4811. effects.enter(types.listItemMarker);
  4812. effects.consume(code2);
  4813. effects.exit(types.listItemMarker);
  4814. self2.containerState.marker = self2.containerState.marker || code2;
  4815. return effects.check(
  4816. blankLine,
  4817. // Can’t be empty when interrupting.
  4818. self2.interrupt ? nok : onBlank,
  4819. effects.attempt(
  4820. listItemPrefixWhitespaceConstruct,
  4821. endOfPrefix,
  4822. otherPrefix
  4823. )
  4824. );
  4825. }
  4826. function onBlank(code2) {
  4827. ok(self2.containerState, "expected state");
  4828. self2.containerState.initialBlankLine = true;
  4829. initialSize++;
  4830. return endOfPrefix(code2);
  4831. }
  4832. function otherPrefix(code2) {
  4833. if (markdownSpace(code2)) {
  4834. effects.enter(types.listItemPrefixWhitespace);
  4835. effects.consume(code2);
  4836. effects.exit(types.listItemPrefixWhitespace);
  4837. return endOfPrefix;
  4838. }
  4839. return nok(code2);
  4840. }
  4841. function endOfPrefix(code2) {
  4842. ok(self2.containerState, "expected state");
  4843. self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit(types.listItemPrefix), true).length;
  4844. return ok2(code2);
  4845. }
  4846. }
  4847. function tokenizeListContinuation(effects, ok2, nok) {
  4848. const self2 = this;
  4849. ok(self2.containerState, "expected state");
  4850. self2.containerState._closeFlow = void 0;
  4851. return effects.check(blankLine, onBlank, notBlank);
  4852. function onBlank(code2) {
  4853. ok(self2.containerState, "expected state");
  4854. ok(typeof self2.containerState.size === "number", "expected size");
  4855. self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine;
  4856. return factorySpace(
  4857. effects,
  4858. ok2,
  4859. types.listItemIndent,
  4860. self2.containerState.size + 1
  4861. )(code2);
  4862. }
  4863. function notBlank(code2) {
  4864. ok(self2.containerState, "expected state");
  4865. if (self2.containerState.furtherBlankLines || !markdownSpace(code2)) {
  4866. self2.containerState.furtherBlankLines = void 0;
  4867. self2.containerState.initialBlankLine = void 0;
  4868. return notInCurrentItem(code2);
  4869. }
  4870. self2.containerState.furtherBlankLines = void 0;
  4871. self2.containerState.initialBlankLine = void 0;
  4872. return effects.attempt(indentConstruct, ok2, notInCurrentItem)(code2);
  4873. }
  4874. function notInCurrentItem(code2) {
  4875. ok(self2.containerState, "expected state");
  4876. self2.containerState._closeFlow = true;
  4877. self2.interrupt = void 0;
  4878. ok(
  4879. self2.parser.constructs.disable.null,
  4880. "expected `disable.null` to be populated"
  4881. );
  4882. return factorySpace(
  4883. effects,
  4884. effects.attempt(list, ok2, nok),
  4885. types.linePrefix,
  4886. self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
  4887. )(code2);
  4888. }
  4889. }
  4890. function tokenizeIndent(effects, ok2, nok) {
  4891. const self2 = this;
  4892. ok(self2.containerState, "expected state");
  4893. ok(typeof self2.containerState.size === "number", "expected size");
  4894. return factorySpace(
  4895. effects,
  4896. afterPrefix,
  4897. types.listItemIndent,
  4898. self2.containerState.size + 1
  4899. );
  4900. function afterPrefix(code2) {
  4901. ok(self2.containerState, "expected state");
  4902. const tail = self2.events[self2.events.length - 1];
  4903. return tail && tail[1].type === types.listItemIndent && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code2) : nok(code2);
  4904. }
  4905. }
  4906. function tokenizeListEnd(effects) {
  4907. ok(this.containerState, "expected state");
  4908. ok(typeof this.containerState.type === "string", "expected type");
  4909. effects.exit(this.containerState.type);
  4910. }
  4911. function tokenizeListItemPrefixWhitespace(effects, ok2, nok) {
  4912. const self2 = this;
  4913. ok(
  4914. self2.parser.constructs.disable.null,
  4915. "expected `disable.null` to be populated"
  4916. );
  4917. return factorySpace(
  4918. effects,
  4919. afterPrefix,
  4920. types.listItemPrefixWhitespace,
  4921. self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize + 1
  4922. );
  4923. function afterPrefix(code2) {
  4924. const tail = self2.events[self2.events.length - 1];
  4925. return !markdownSpace(code2) && tail && tail[1].type === types.listItemPrefixWhitespace ? ok2(code2) : nok(code2);
  4926. }
  4927. }
  4928. // node_modules/micromark-core-commonmark/dev/lib/setext-underline.js
  4929. var setextUnderline = {
  4930. name: "setextUnderline",
  4931. resolveTo: resolveToSetextUnderline,
  4932. tokenize: tokenizeSetextUnderline
  4933. };
  4934. function resolveToSetextUnderline(events, context) {
  4935. let index2 = events.length;
  4936. let content3;
  4937. let text5;
  4938. let definition2;
  4939. while (index2--) {
  4940. if (events[index2][0] === "enter") {
  4941. if (events[index2][1].type === types.content) {
  4942. content3 = index2;
  4943. break;
  4944. }
  4945. if (events[index2][1].type === types.paragraph) {
  4946. text5 = index2;
  4947. }
  4948. } else {
  4949. if (events[index2][1].type === types.content) {
  4950. events.splice(index2, 1);
  4951. }
  4952. if (!definition2 && events[index2][1].type === types.definition) {
  4953. definition2 = index2;
  4954. }
  4955. }
  4956. }
  4957. ok(text5 !== void 0, "expected a `text` index to be found");
  4958. ok(content3 !== void 0, "expected a `text` index to be found");
  4959. ok(events[content3][2] === context, "enter context should be same");
  4960. ok(
  4961. events[events.length - 1][2] === context,
  4962. "enter context should be same"
  4963. );
  4964. const heading2 = {
  4965. type: types.setextHeading,
  4966. start: { ...events[content3][1].start },
  4967. end: { ...events[events.length - 1][1].end }
  4968. };
  4969. events[text5][1].type = types.setextHeadingText;
  4970. if (definition2) {
  4971. events.splice(text5, 0, ["enter", heading2, context]);
  4972. events.splice(definition2 + 1, 0, ["exit", events[content3][1], context]);
  4973. events[content3][1].end = { ...events[definition2][1].end };
  4974. } else {
  4975. events[content3][1] = heading2;
  4976. }
  4977. events.push(["exit", heading2, context]);
  4978. return events;
  4979. }
  4980. function tokenizeSetextUnderline(effects, ok2, nok) {
  4981. const self2 = this;
  4982. let marker;
  4983. return start2;
  4984. function start2(code2) {
  4985. let index2 = self2.events.length;
  4986. let paragraph2;
  4987. ok(
  4988. code2 === codes.dash || code2 === codes.equalsTo,
  4989. "expected `=` or `-`"
  4990. );
  4991. while (index2--) {
  4992. if (self2.events[index2][1].type !== types.lineEnding && self2.events[index2][1].type !== types.linePrefix && self2.events[index2][1].type !== types.content) {
  4993. paragraph2 = self2.events[index2][1].type === types.paragraph;
  4994. break;
  4995. }
  4996. }
  4997. if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) {
  4998. effects.enter(types.setextHeadingLine);
  4999. marker = code2;
  5000. return before(code2);
  5001. }
  5002. return nok(code2);
  5003. }
  5004. function before(code2) {
  5005. effects.enter(types.setextHeadingLineSequence);
  5006. return inside(code2);
  5007. }
  5008. function inside(code2) {
  5009. if (code2 === marker) {
  5010. effects.consume(code2);
  5011. return inside;
  5012. }
  5013. effects.exit(types.setextHeadingLineSequence);
  5014. return markdownSpace(code2) ? factorySpace(effects, after, types.lineSuffix)(code2) : after(code2);
  5015. }
  5016. function after(code2) {
  5017. if (code2 === codes.eof || markdownLineEnding(code2)) {
  5018. effects.exit(types.setextHeadingLine);
  5019. return ok2(code2);
  5020. }
  5021. return nok(code2);
  5022. }
  5023. }
  5024. // node_modules/micromark/dev/lib/initialize/flow.js
  5025. var flow = { tokenize: initializeFlow };
  5026. function initializeFlow(effects) {
  5027. const self2 = this;
  5028. const initial = effects.attempt(
  5029. // Try to parse a blank line.
  5030. blankLine,
  5031. atBlankEnding,
  5032. // Try to parse initial flow (essentially, only code).
  5033. effects.attempt(
  5034. this.parser.constructs.flowInitial,
  5035. afterConstruct,
  5036. factorySpace(
  5037. effects,
  5038. effects.attempt(
  5039. this.parser.constructs.flow,
  5040. afterConstruct,
  5041. effects.attempt(content2, afterConstruct)
  5042. ),
  5043. types.linePrefix
  5044. )
  5045. )
  5046. );
  5047. return initial;
  5048. function atBlankEnding(code2) {
  5049. ok(
  5050. code2 === codes.eof || markdownLineEnding(code2),
  5051. "expected eol or eof"
  5052. );
  5053. if (code2 === codes.eof) {
  5054. effects.consume(code2);
  5055. return;
  5056. }
  5057. effects.enter(types.lineEndingBlank);
  5058. effects.consume(code2);
  5059. effects.exit(types.lineEndingBlank);
  5060. self2.currentConstruct = void 0;
  5061. return initial;
  5062. }
  5063. function afterConstruct(code2) {
  5064. ok(
  5065. code2 === codes.eof || markdownLineEnding(code2),
  5066. "expected eol or eof"
  5067. );
  5068. if (code2 === codes.eof) {
  5069. effects.consume(code2);
  5070. return;
  5071. }
  5072. effects.enter(types.lineEnding);
  5073. effects.consume(code2);
  5074. effects.exit(types.lineEnding);
  5075. self2.currentConstruct = void 0;
  5076. return initial;
  5077. }
  5078. }
  5079. // node_modules/micromark/dev/lib/initialize/text.js
  5080. var resolver = { resolveAll: createResolver() };
  5081. var string = initializeFactory("string");
  5082. var text2 = initializeFactory("text");
  5083. function initializeFactory(field) {
  5084. return {
  5085. resolveAll: createResolver(
  5086. field === "text" ? resolveAllLineSuffixes : void 0
  5087. ),
  5088. tokenize: initializeText
  5089. };
  5090. function initializeText(effects) {
  5091. const self2 = this;
  5092. const constructs2 = this.parser.constructs[field];
  5093. const text5 = effects.attempt(constructs2, start2, notText);
  5094. return start2;
  5095. function start2(code2) {
  5096. return atBreak(code2) ? text5(code2) : notText(code2);
  5097. }
  5098. function notText(code2) {
  5099. if (code2 === codes.eof) {
  5100. effects.consume(code2);
  5101. return;
  5102. }
  5103. effects.enter(types.data);
  5104. effects.consume(code2);
  5105. return data;
  5106. }
  5107. function data(code2) {
  5108. if (atBreak(code2)) {
  5109. effects.exit(types.data);
  5110. return text5(code2);
  5111. }
  5112. effects.consume(code2);
  5113. return data;
  5114. }
  5115. function atBreak(code2) {
  5116. if (code2 === codes.eof) {
  5117. return true;
  5118. }
  5119. const list3 = constructs2[code2];
  5120. let index2 = -1;
  5121. if (list3) {
  5122. ok(Array.isArray(list3), "expected `disable.null` to be populated");
  5123. while (++index2 < list3.length) {
  5124. const item = list3[index2];
  5125. if (!item.previous || item.previous.call(self2, self2.previous)) {
  5126. return true;
  5127. }
  5128. }
  5129. }
  5130. return false;
  5131. }
  5132. }
  5133. }
  5134. function createResolver(extraResolver) {
  5135. return resolveAllText;
  5136. function resolveAllText(events, context) {
  5137. let index2 = -1;
  5138. let enter;
  5139. while (++index2 <= events.length) {
  5140. if (enter === void 0) {
  5141. if (events[index2] && events[index2][1].type === types.data) {
  5142. enter = index2;
  5143. index2++;
  5144. }
  5145. } else if (!events[index2] || events[index2][1].type !== types.data) {
  5146. if (index2 !== enter + 2) {
  5147. events[enter][1].end = events[index2 - 1][1].end;
  5148. events.splice(enter + 2, index2 - enter - 2);
  5149. index2 = enter + 2;
  5150. }
  5151. enter = void 0;
  5152. }
  5153. }
  5154. return extraResolver ? extraResolver(events, context) : events;
  5155. }
  5156. }
  5157. function resolveAllLineSuffixes(events, context) {
  5158. let eventIndex = 0;
  5159. while (++eventIndex <= events.length) {
  5160. if ((eventIndex === events.length || events[eventIndex][1].type === types.lineEnding) && events[eventIndex - 1][1].type === types.data) {
  5161. const data = events[eventIndex - 1][1];
  5162. const chunks = context.sliceStream(data);
  5163. let index2 = chunks.length;
  5164. let bufferIndex = -1;
  5165. let size = 0;
  5166. let tabs;
  5167. while (index2--) {
  5168. const chunk = chunks[index2];
  5169. if (typeof chunk === "string") {
  5170. bufferIndex = chunk.length;
  5171. while (chunk.charCodeAt(bufferIndex - 1) === codes.space) {
  5172. size++;
  5173. bufferIndex--;
  5174. }
  5175. if (bufferIndex) break;
  5176. bufferIndex = -1;
  5177. } else if (chunk === codes.horizontalTab) {
  5178. tabs = true;
  5179. size++;
  5180. } else if (chunk === codes.virtualSpace) {
  5181. } else {
  5182. index2++;
  5183. break;
  5184. }
  5185. }
  5186. if (context._contentTypeTextTrailing && eventIndex === events.length) {
  5187. size = 0;
  5188. }
  5189. if (size) {
  5190. const token = {
  5191. type: eventIndex === events.length || tabs || size < constants.hardBreakPrefixSizeMin ? types.lineSuffix : types.hardBreakTrailing,
  5192. start: {
  5193. _bufferIndex: index2 ? bufferIndex : data.start._bufferIndex + bufferIndex,
  5194. _index: data.start._index + index2,
  5195. line: data.end.line,
  5196. column: data.end.column - size,
  5197. offset: data.end.offset - size
  5198. },
  5199. end: { ...data.end }
  5200. };
  5201. data.end = { ...token.start };
  5202. if (data.start.offset === data.end.offset) {
  5203. Object.assign(data, token);
  5204. } else {
  5205. events.splice(
  5206. eventIndex,
  5207. 0,
  5208. ["enter", token, context],
  5209. ["exit", token, context]
  5210. );
  5211. eventIndex += 2;
  5212. }
  5213. }
  5214. eventIndex++;
  5215. }
  5216. }
  5217. return events;
  5218. }
  5219. // node_modules/micromark/dev/lib/constructs.js
  5220. var constructs_exports = {};
  5221. __export(constructs_exports, {
  5222. attentionMarkers: () => attentionMarkers,
  5223. contentInitial: () => contentInitial,
  5224. disable: () => disable,
  5225. document: () => document3,
  5226. flow: () => flow2,
  5227. flowInitial: () => flowInitial,
  5228. insideSpan: () => insideSpan,
  5229. string: () => string2,
  5230. text: () => text3
  5231. });
  5232. var document3 = {
  5233. [codes.asterisk]: list,
  5234. [codes.plusSign]: list,
  5235. [codes.dash]: list,
  5236. [codes.digit0]: list,
  5237. [codes.digit1]: list,
  5238. [codes.digit2]: list,
  5239. [codes.digit3]: list,
  5240. [codes.digit4]: list,
  5241. [codes.digit5]: list,
  5242. [codes.digit6]: list,
  5243. [codes.digit7]: list,
  5244. [codes.digit8]: list,
  5245. [codes.digit9]: list,
  5246. [codes.greaterThan]: blockQuote
  5247. };
  5248. var contentInitial = {
  5249. [codes.leftSquareBracket]: definition
  5250. };
  5251. var flowInitial = {
  5252. [codes.horizontalTab]: codeIndented,
  5253. [codes.virtualSpace]: codeIndented,
  5254. [codes.space]: codeIndented
  5255. };
  5256. var flow2 = {
  5257. [codes.numberSign]: headingAtx,
  5258. [codes.asterisk]: thematicBreak,
  5259. [codes.dash]: [setextUnderline, thematicBreak],
  5260. [codes.lessThan]: htmlFlow,
  5261. [codes.equalsTo]: setextUnderline,
  5262. [codes.underscore]: thematicBreak,
  5263. [codes.graveAccent]: codeFenced,
  5264. [codes.tilde]: codeFenced
  5265. };
  5266. var string2 = {
  5267. [codes.ampersand]: characterReference,
  5268. [codes.backslash]: characterEscape
  5269. };
  5270. var text3 = {
  5271. [codes.carriageReturn]: lineEnding,
  5272. [codes.lineFeed]: lineEnding,
  5273. [codes.carriageReturnLineFeed]: lineEnding,
  5274. [codes.exclamationMark]: labelStartImage,
  5275. [codes.ampersand]: characterReference,
  5276. [codes.asterisk]: attention,
  5277. [codes.lessThan]: [autolink, htmlText],
  5278. [codes.leftSquareBracket]: labelStartLink,
  5279. [codes.backslash]: [hardBreakEscape, characterEscape],
  5280. [codes.rightSquareBracket]: labelEnd,
  5281. [codes.underscore]: attention,
  5282. [codes.graveAccent]: codeText
  5283. };
  5284. var insideSpan = { null: [attention, resolver] };
  5285. var attentionMarkers = { null: [codes.asterisk, codes.underscore] };
  5286. var disable = { null: [] };
  5287. // node_modules/micromark/dev/lib/create-tokenizer.js
  5288. var import_debug = __toESM(require_browser(), 1);
  5289. var debug = (0, import_debug.default)("micromark");
  5290. function createTokenizer(parser, initialize, from) {
  5291. let point4 = {
  5292. _bufferIndex: -1,
  5293. _index: 0,
  5294. line: from && from.line || 1,
  5295. column: from && from.column || 1,
  5296. offset: from && from.offset || 0
  5297. };
  5298. const columnStart = {};
  5299. const resolveAllConstructs = [];
  5300. let chunks = [];
  5301. let stack = [];
  5302. let consumed = true;
  5303. const effects = {
  5304. attempt: constructFactory(onsuccessfulconstruct),
  5305. check: constructFactory(onsuccessfulcheck),
  5306. consume,
  5307. enter,
  5308. exit: exit2,
  5309. interrupt: constructFactory(onsuccessfulcheck, { interrupt: true })
  5310. };
  5311. const context = {
  5312. code: codes.eof,
  5313. containerState: {},
  5314. defineSkip,
  5315. events: [],
  5316. now,
  5317. parser,
  5318. previous: codes.eof,
  5319. sliceSerialize,
  5320. sliceStream,
  5321. write
  5322. };
  5323. let state = initialize.tokenize.call(context, effects);
  5324. let expectedCode;
  5325. if (initialize.resolveAll) {
  5326. resolveAllConstructs.push(initialize);
  5327. }
  5328. return context;
  5329. function write(slice) {
  5330. chunks = push(chunks, slice);
  5331. main();
  5332. if (chunks[chunks.length - 1] !== codes.eof) {
  5333. return [];
  5334. }
  5335. addResult(initialize, 0);
  5336. context.events = resolveAll(resolveAllConstructs, context.events, context);
  5337. return context.events;
  5338. }
  5339. function sliceSerialize(token, expandTabs) {
  5340. return serializeChunks(sliceStream(token), expandTabs);
  5341. }
  5342. function sliceStream(token) {
  5343. return sliceChunks(chunks, token);
  5344. }
  5345. function now() {
  5346. const { _bufferIndex, _index, line, column, offset } = point4;
  5347. return { _bufferIndex, _index, line, column, offset };
  5348. }
  5349. function defineSkip(value) {
  5350. columnStart[value.line] = value.column;
  5351. accountForPotentialSkip();
  5352. debug("position: define skip: `%j`", point4);
  5353. }
  5354. function main() {
  5355. let chunkIndex;
  5356. while (point4._index < chunks.length) {
  5357. const chunk = chunks[point4._index];
  5358. if (typeof chunk === "string") {
  5359. chunkIndex = point4._index;
  5360. if (point4._bufferIndex < 0) {
  5361. point4._bufferIndex = 0;
  5362. }
  5363. while (point4._index === chunkIndex && point4._bufferIndex < chunk.length) {
  5364. go(chunk.charCodeAt(point4._bufferIndex));
  5365. }
  5366. } else {
  5367. go(chunk);
  5368. }
  5369. }
  5370. }
  5371. function go(code2) {
  5372. ok(consumed === true, "expected character to be consumed");
  5373. consumed = void 0;
  5374. debug("main: passing `%s` to %s", code2, state && state.name);
  5375. expectedCode = code2;
  5376. ok(typeof state === "function", "expected state");
  5377. state = state(code2);
  5378. }
  5379. function consume(code2) {
  5380. ok(code2 === expectedCode, "expected given code to equal expected code");
  5381. debug("consume: `%s`", code2);
  5382. ok(
  5383. consumed === void 0,
  5384. "expected code to not have been consumed: this might be because `return x(code)` instead of `return x` was used"
  5385. );
  5386. ok(
  5387. code2 === null ? context.events.length === 0 || context.events[context.events.length - 1][0] === "exit" : context.events[context.events.length - 1][0] === "enter",
  5388. "expected last token to be open"
  5389. );
  5390. if (markdownLineEnding(code2)) {
  5391. point4.line++;
  5392. point4.column = 1;
  5393. point4.offset += code2 === codes.carriageReturnLineFeed ? 2 : 1;
  5394. accountForPotentialSkip();
  5395. debug("position: after eol: `%j`", point4);
  5396. } else if (code2 !== codes.virtualSpace) {
  5397. point4.column++;
  5398. point4.offset++;
  5399. }
  5400. if (point4._bufferIndex < 0) {
  5401. point4._index++;
  5402. } else {
  5403. point4._bufferIndex++;
  5404. if (point4._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
  5405. // strings.
  5406. /** @type {string} */
  5407. chunks[point4._index].length) {
  5408. point4._bufferIndex = -1;
  5409. point4._index++;
  5410. }
  5411. }
  5412. context.previous = code2;
  5413. consumed = true;
  5414. }
  5415. function enter(type, fields) {
  5416. const token = fields || {};
  5417. token.type = type;
  5418. token.start = now();
  5419. ok(typeof type === "string", "expected string type");
  5420. ok(type.length > 0, "expected non-empty string");
  5421. debug("enter: `%s`", type);
  5422. context.events.push(["enter", token, context]);
  5423. stack.push(token);
  5424. return token;
  5425. }
  5426. function exit2(type) {
  5427. ok(typeof type === "string", "expected string type");
  5428. ok(type.length > 0, "expected non-empty string");
  5429. const token = stack.pop();
  5430. ok(token, "cannot close w/o open tokens");
  5431. token.end = now();
  5432. ok(type === token.type, "expected exit token to match current token");
  5433. ok(
  5434. !(token.start._index === token.end._index && token.start._bufferIndex === token.end._bufferIndex),
  5435. "expected non-empty token (`" + type + "`)"
  5436. );
  5437. debug("exit: `%s`", token.type);
  5438. context.events.push(["exit", token, context]);
  5439. return token;
  5440. }
  5441. function onsuccessfulconstruct(construct, info) {
  5442. addResult(construct, info.from);
  5443. }
  5444. function onsuccessfulcheck(_, info) {
  5445. info.restore();
  5446. }
  5447. function constructFactory(onreturn, fields) {
  5448. return hook;
  5449. function hook(constructs2, returnState, bogusState) {
  5450. let listOfConstructs;
  5451. let constructIndex;
  5452. let currentConstruct;
  5453. let info;
  5454. return Array.isArray(constructs2) ? (
  5455. /* c8 ignore next 1 */
  5456. handleListOfConstructs(constructs2)
  5457. ) : "tokenize" in constructs2 ? (
  5458. // Looks like a construct.
  5459. handleListOfConstructs([
  5460. /** @type {Construct} */
  5461. constructs2
  5462. ])
  5463. ) : handleMapOfConstructs(constructs2);
  5464. function handleMapOfConstructs(map) {
  5465. return start2;
  5466. function start2(code2) {
  5467. const left = code2 !== null && map[code2];
  5468. const all2 = code2 !== null && map.null;
  5469. const list3 = [
  5470. // To do: add more extension tests.
  5471. /* c8 ignore next 2 */
  5472. ...Array.isArray(left) ? left : left ? [left] : [],
  5473. ...Array.isArray(all2) ? all2 : all2 ? [all2] : []
  5474. ];
  5475. return handleListOfConstructs(list3)(code2);
  5476. }
  5477. }
  5478. function handleListOfConstructs(list3) {
  5479. listOfConstructs = list3;
  5480. constructIndex = 0;
  5481. if (list3.length === 0) {
  5482. ok(bogusState, "expected `bogusState` to be given");
  5483. return bogusState;
  5484. }
  5485. return handleConstruct(list3[constructIndex]);
  5486. }
  5487. function handleConstruct(construct) {
  5488. return start2;
  5489. function start2(code2) {
  5490. info = store();
  5491. currentConstruct = construct;
  5492. if (!construct.partial) {
  5493. context.currentConstruct = construct;
  5494. }
  5495. ok(
  5496. context.parser.constructs.disable.null,
  5497. "expected `disable.null` to be populated"
  5498. );
  5499. if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
  5500. return nok(code2);
  5501. }
  5502. return construct.tokenize.call(
  5503. // If we do have fields, create an object w/ `context` as its
  5504. // prototype.
  5505. // This allows a “live binding”, which is needed for `interrupt`.
  5506. fields ? Object.assign(Object.create(context), fields) : context,
  5507. effects,
  5508. ok2,
  5509. nok
  5510. )(code2);
  5511. }
  5512. }
  5513. function ok2(code2) {
  5514. ok(code2 === expectedCode, "expected code");
  5515. consumed = true;
  5516. onreturn(currentConstruct, info);
  5517. return returnState;
  5518. }
  5519. function nok(code2) {
  5520. ok(code2 === expectedCode, "expected code");
  5521. consumed = true;
  5522. info.restore();
  5523. if (++constructIndex < listOfConstructs.length) {
  5524. return handleConstruct(listOfConstructs[constructIndex]);
  5525. }
  5526. return bogusState;
  5527. }
  5528. }
  5529. }
  5530. function addResult(construct, from2) {
  5531. if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
  5532. resolveAllConstructs.push(construct);
  5533. }
  5534. if (construct.resolve) {
  5535. splice(
  5536. context.events,
  5537. from2,
  5538. context.events.length - from2,
  5539. construct.resolve(context.events.slice(from2), context)
  5540. );
  5541. }
  5542. if (construct.resolveTo) {
  5543. context.events = construct.resolveTo(context.events, context);
  5544. }
  5545. ok(
  5546. construct.partial || context.events.length === 0 || context.events[context.events.length - 1][0] === "exit",
  5547. "expected last token to end"
  5548. );
  5549. }
  5550. function store() {
  5551. const startPoint = now();
  5552. const startPrevious = context.previous;
  5553. const startCurrentConstruct = context.currentConstruct;
  5554. const startEventsIndex = context.events.length;
  5555. const startStack = Array.from(stack);
  5556. return { from: startEventsIndex, restore };
  5557. function restore() {
  5558. point4 = startPoint;
  5559. context.previous = startPrevious;
  5560. context.currentConstruct = startCurrentConstruct;
  5561. context.events.length = startEventsIndex;
  5562. stack = startStack;
  5563. accountForPotentialSkip();
  5564. debug("position: restore: `%j`", point4);
  5565. }
  5566. }
  5567. function accountForPotentialSkip() {
  5568. if (point4.line in columnStart && point4.column < 2) {
  5569. point4.column = columnStart[point4.line];
  5570. point4.offset += columnStart[point4.line] - 1;
  5571. }
  5572. }
  5573. }
  5574. function sliceChunks(chunks, token) {
  5575. const startIndex = token.start._index;
  5576. const startBufferIndex = token.start._bufferIndex;
  5577. const endIndex = token.end._index;
  5578. const endBufferIndex = token.end._bufferIndex;
  5579. let view;
  5580. if (startIndex === endIndex) {
  5581. ok(endBufferIndex > -1, "expected non-negative end buffer index");
  5582. ok(startBufferIndex > -1, "expected non-negative start buffer index");
  5583. view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
  5584. } else {
  5585. view = chunks.slice(startIndex, endIndex);
  5586. if (startBufferIndex > -1) {
  5587. const head = view[0];
  5588. if (typeof head === "string") {
  5589. view[0] = head.slice(startBufferIndex);
  5590. } else {
  5591. ok(startBufferIndex === 0, "expected `startBufferIndex` to be `0`");
  5592. view.shift();
  5593. }
  5594. }
  5595. if (endBufferIndex > 0) {
  5596. view.push(chunks[endIndex].slice(0, endBufferIndex));
  5597. }
  5598. }
  5599. return view;
  5600. }
  5601. function serializeChunks(chunks, expandTabs) {
  5602. let index2 = -1;
  5603. const result = [];
  5604. let atTab;
  5605. while (++index2 < chunks.length) {
  5606. const chunk = chunks[index2];
  5607. let value;
  5608. if (typeof chunk === "string") {
  5609. value = chunk;
  5610. } else
  5611. switch (chunk) {
  5612. case codes.carriageReturn: {
  5613. value = values.cr;
  5614. break;
  5615. }
  5616. case codes.lineFeed: {
  5617. value = values.lf;
  5618. break;
  5619. }
  5620. case codes.carriageReturnLineFeed: {
  5621. value = values.cr + values.lf;
  5622. break;
  5623. }
  5624. case codes.horizontalTab: {
  5625. value = expandTabs ? values.space : values.ht;
  5626. break;
  5627. }
  5628. case codes.virtualSpace: {
  5629. if (!expandTabs && atTab) continue;
  5630. value = values.space;
  5631. break;
  5632. }
  5633. default: {
  5634. ok(typeof chunk === "number", "expected number");
  5635. value = String.fromCharCode(chunk);
  5636. }
  5637. }
  5638. atTab = chunk === codes.horizontalTab;
  5639. result.push(value);
  5640. }
  5641. return result.join("");
  5642. }
  5643. // node_modules/micromark/dev/lib/parse.js
  5644. function parse(options) {
  5645. const settings = options || {};
  5646. const constructs2 = (
  5647. /** @type {FullNormalizedExtension} */
  5648. combineExtensions([constructs_exports, ...settings.extensions || []])
  5649. );
  5650. const parser = {
  5651. constructs: constructs2,
  5652. content: create(content),
  5653. defined: [],
  5654. document: create(document2),
  5655. flow: create(flow),
  5656. lazy: {},
  5657. string: create(string),
  5658. text: create(text2)
  5659. };
  5660. return parser;
  5661. function create(initial) {
  5662. return creator;
  5663. function creator(from) {
  5664. return createTokenizer(parser, initial, from);
  5665. }
  5666. }
  5667. }
  5668. // node_modules/micromark/dev/lib/postprocess.js
  5669. function postprocess(events) {
  5670. while (!subtokenize(events)) {
  5671. }
  5672. return events;
  5673. }
  5674. // node_modules/micromark/dev/lib/preprocess.js
  5675. var search = /[\0\t\n\r]/g;
  5676. function preprocess() {
  5677. let column = 1;
  5678. let buffer = "";
  5679. let start2 = true;
  5680. let atCarriageReturn;
  5681. return preprocessor;
  5682. function preprocessor(value, encoding, end) {
  5683. const chunks = [];
  5684. let match;
  5685. let next;
  5686. let startPosition;
  5687. let endPosition;
  5688. let code2;
  5689. value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
  5690. startPosition = 0;
  5691. buffer = "";
  5692. if (start2) {
  5693. if (value.charCodeAt(0) === codes.byteOrderMarker) {
  5694. startPosition++;
  5695. }
  5696. start2 = void 0;
  5697. }
  5698. while (startPosition < value.length) {
  5699. search.lastIndex = startPosition;
  5700. match = search.exec(value);
  5701. endPosition = match && match.index !== void 0 ? match.index : value.length;
  5702. code2 = value.charCodeAt(endPosition);
  5703. if (!match) {
  5704. buffer = value.slice(startPosition);
  5705. break;
  5706. }
  5707. if (code2 === codes.lf && startPosition === endPosition && atCarriageReturn) {
  5708. chunks.push(codes.carriageReturnLineFeed);
  5709. atCarriageReturn = void 0;
  5710. } else {
  5711. if (atCarriageReturn) {
  5712. chunks.push(codes.carriageReturn);
  5713. atCarriageReturn = void 0;
  5714. }
  5715. if (startPosition < endPosition) {
  5716. chunks.push(value.slice(startPosition, endPosition));
  5717. column += endPosition - startPosition;
  5718. }
  5719. switch (code2) {
  5720. case codes.nul: {
  5721. chunks.push(codes.replacementCharacter);
  5722. column++;
  5723. break;
  5724. }
  5725. case codes.ht: {
  5726. next = Math.ceil(column / constants.tabSize) * constants.tabSize;
  5727. chunks.push(codes.horizontalTab);
  5728. while (column++ < next) chunks.push(codes.virtualSpace);
  5729. break;
  5730. }
  5731. case codes.lf: {
  5732. chunks.push(codes.lineFeed);
  5733. column = 1;
  5734. break;
  5735. }
  5736. default: {
  5737. atCarriageReturn = true;
  5738. column = 1;
  5739. }
  5740. }
  5741. }
  5742. startPosition = endPosition + 1;
  5743. }
  5744. if (end) {
  5745. if (atCarriageReturn) chunks.push(codes.carriageReturn);
  5746. if (buffer) chunks.push(buffer);
  5747. chunks.push(codes.eof);
  5748. }
  5749. return chunks;
  5750. }
  5751. }
  5752. // node_modules/micromark-util-decode-string/dev/index.js
  5753. var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
  5754. function decodeString(value) {
  5755. return value.replace(characterEscapeOrReference, decode);
  5756. }
  5757. function decode($0, $1, $2) {
  5758. if ($1) {
  5759. return $1;
  5760. }
  5761. const head = $2.charCodeAt(0);
  5762. if (head === codes.numberSign) {
  5763. const head2 = $2.charCodeAt(1);
  5764. const hex = head2 === codes.lowercaseX || head2 === codes.uppercaseX;
  5765. return decodeNumericCharacterReference(
  5766. $2.slice(hex ? 2 : 1),
  5767. hex ? constants.numericBaseHexadecimal : constants.numericBaseDecimal
  5768. );
  5769. }
  5770. return decodeNamedCharacterReference($2) || $0;
  5771. }
  5772. // node_modules/mdast-util-from-markdown/dev/lib/index.js
  5773. var own2 = {}.hasOwnProperty;
  5774. function fromMarkdown(value, encoding, options) {
  5775. if (encoding && typeof encoding === "object") {
  5776. options = encoding;
  5777. encoding = void 0;
  5778. }
  5779. return compiler(options)(
  5780. postprocess(
  5781. parse(options).document().write(preprocess()(value, encoding, true))
  5782. )
  5783. );
  5784. }
  5785. function compiler(options) {
  5786. const config = {
  5787. transforms: [],
  5788. canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
  5789. enter: {
  5790. autolink: opener(link2),
  5791. autolinkProtocol: onenterdata,
  5792. autolinkEmail: onenterdata,
  5793. atxHeading: opener(heading2),
  5794. blockQuote: opener(blockQuote2),
  5795. characterEscape: onenterdata,
  5796. characterReference: onenterdata,
  5797. codeFenced: opener(codeFlow),
  5798. codeFencedFenceInfo: buffer,
  5799. codeFencedFenceMeta: buffer,
  5800. codeIndented: opener(codeFlow, buffer),
  5801. codeText: opener(codeText2, buffer),
  5802. codeTextData: onenterdata,
  5803. data: onenterdata,
  5804. codeFlowValue: onenterdata,
  5805. definition: opener(definition2),
  5806. definitionDestinationString: buffer,
  5807. definitionLabelString: buffer,
  5808. definitionTitleString: buffer,
  5809. emphasis: opener(emphasis2),
  5810. hardBreakEscape: opener(hardBreak2),
  5811. hardBreakTrailing: opener(hardBreak2),
  5812. htmlFlow: opener(html3, buffer),
  5813. htmlFlowData: onenterdata,
  5814. htmlText: opener(html3, buffer),
  5815. htmlTextData: onenterdata,
  5816. image: opener(image2),
  5817. label: buffer,
  5818. link: opener(link2),
  5819. listItem: opener(listItem2),
  5820. listItemValue: onenterlistitemvalue,
  5821. listOrdered: opener(list3, onenterlistordered),
  5822. listUnordered: opener(list3),
  5823. paragraph: opener(paragraph2),
  5824. reference: onenterreference,
  5825. referenceString: buffer,
  5826. resourceDestinationString: buffer,
  5827. resourceTitleString: buffer,
  5828. setextHeading: opener(heading2),
  5829. strong: opener(strong2),
  5830. thematicBreak: opener(thematicBreak3)
  5831. },
  5832. exit: {
  5833. atxHeading: closer(),
  5834. atxHeadingSequence: onexitatxheadingsequence,
  5835. autolink: closer(),
  5836. autolinkEmail: onexitautolinkemail,
  5837. autolinkProtocol: onexitautolinkprotocol,
  5838. blockQuote: closer(),
  5839. characterEscapeValue: onexitdata,
  5840. characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
  5841. characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
  5842. characterReferenceValue: onexitcharacterreferencevalue,
  5843. characterReference: onexitcharacterreference,
  5844. codeFenced: closer(onexitcodefenced),
  5845. codeFencedFence: onexitcodefencedfence,
  5846. codeFencedFenceInfo: onexitcodefencedfenceinfo,
  5847. codeFencedFenceMeta: onexitcodefencedfencemeta,
  5848. codeFlowValue: onexitdata,
  5849. codeIndented: closer(onexitcodeindented),
  5850. codeText: closer(onexitcodetext),
  5851. codeTextData: onexitdata,
  5852. data: onexitdata,
  5853. definition: closer(),
  5854. definitionDestinationString: onexitdefinitiondestinationstring,
  5855. definitionLabelString: onexitdefinitionlabelstring,
  5856. definitionTitleString: onexitdefinitiontitlestring,
  5857. emphasis: closer(),
  5858. hardBreakEscape: closer(onexithardbreak),
  5859. hardBreakTrailing: closer(onexithardbreak),
  5860. htmlFlow: closer(onexithtmlflow),
  5861. htmlFlowData: onexitdata,
  5862. htmlText: closer(onexithtmltext),
  5863. htmlTextData: onexitdata,
  5864. image: closer(onexitimage),
  5865. label: onexitlabel,
  5866. labelText: onexitlabeltext,
  5867. lineEnding: onexitlineending,
  5868. link: closer(onexitlink),
  5869. listItem: closer(),
  5870. listOrdered: closer(),
  5871. listUnordered: closer(),
  5872. paragraph: closer(),
  5873. referenceString: onexitreferencestring,
  5874. resourceDestinationString: onexitresourcedestinationstring,
  5875. resourceTitleString: onexitresourcetitlestring,
  5876. resource: onexitresource,
  5877. setextHeading: closer(onexitsetextheading),
  5878. setextHeadingLineSequence: onexitsetextheadinglinesequence,
  5879. setextHeadingText: onexitsetextheadingtext,
  5880. strong: closer(),
  5881. thematicBreak: closer()
  5882. }
  5883. };
  5884. configure(config, (options || {}).mdastExtensions || []);
  5885. const data = {};
  5886. return compile2;
  5887. function compile2(events) {
  5888. let tree = { type: "root", children: [] };
  5889. const context = {
  5890. stack: [tree],
  5891. tokenStack: [],
  5892. config,
  5893. enter,
  5894. exit: exit2,
  5895. buffer,
  5896. resume,
  5897. data
  5898. };
  5899. const listStack = [];
  5900. let index2 = -1;
  5901. while (++index2 < events.length) {
  5902. if (events[index2][1].type === types.listOrdered || events[index2][1].type === types.listUnordered) {
  5903. if (events[index2][0] === "enter") {
  5904. listStack.push(index2);
  5905. } else {
  5906. const tail = listStack.pop();
  5907. ok(typeof tail === "number", "expected list to be open");
  5908. index2 = prepareList(events, tail, index2);
  5909. }
  5910. }
  5911. }
  5912. index2 = -1;
  5913. while (++index2 < events.length) {
  5914. const handler = config[events[index2][0]];
  5915. if (own2.call(handler, events[index2][1].type)) {
  5916. handler[events[index2][1].type].call(
  5917. Object.assign(
  5918. { sliceSerialize: events[index2][2].sliceSerialize },
  5919. context
  5920. ),
  5921. events[index2][1]
  5922. );
  5923. }
  5924. }
  5925. if (context.tokenStack.length > 0) {
  5926. const tail = context.tokenStack[context.tokenStack.length - 1];
  5927. const handler = tail[1] || defaultOnError;
  5928. handler.call(context, void 0, tail[0]);
  5929. }
  5930. tree.position = {
  5931. start: point3(
  5932. events.length > 0 ? events[0][1].start : { line: 1, column: 1, offset: 0 }
  5933. ),
  5934. end: point3(
  5935. events.length > 0 ? events[events.length - 2][1].end : { line: 1, column: 1, offset: 0 }
  5936. )
  5937. };
  5938. index2 = -1;
  5939. while (++index2 < config.transforms.length) {
  5940. tree = config.transforms[index2](tree) || tree;
  5941. }
  5942. return tree;
  5943. }
  5944. function prepareList(events, start2, length) {
  5945. let index2 = start2 - 1;
  5946. let containerBalance = -1;
  5947. let listSpread = false;
  5948. let listItem3;
  5949. let lineIndex;
  5950. let firstBlankLineIndex;
  5951. let atMarker;
  5952. while (++index2 <= length) {
  5953. const event = events[index2];
  5954. switch (event[1].type) {
  5955. case types.listUnordered:
  5956. case types.listOrdered:
  5957. case types.blockQuote: {
  5958. if (event[0] === "enter") {
  5959. containerBalance++;
  5960. } else {
  5961. containerBalance--;
  5962. }
  5963. atMarker = void 0;
  5964. break;
  5965. }
  5966. case types.lineEndingBlank: {
  5967. if (event[0] === "enter") {
  5968. if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) {
  5969. firstBlankLineIndex = index2;
  5970. }
  5971. atMarker = void 0;
  5972. }
  5973. break;
  5974. }
  5975. case types.linePrefix:
  5976. case types.listItemValue:
  5977. case types.listItemMarker:
  5978. case types.listItemPrefix:
  5979. case types.listItemPrefixWhitespace: {
  5980. break;
  5981. }
  5982. default: {
  5983. atMarker = void 0;
  5984. }
  5985. }
  5986. 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)) {
  5987. if (listItem3) {
  5988. let tailIndex = index2;
  5989. lineIndex = void 0;
  5990. while (tailIndex--) {
  5991. const tailEvent = events[tailIndex];
  5992. if (tailEvent[1].type === types.lineEnding || tailEvent[1].type === types.lineEndingBlank) {
  5993. if (tailEvent[0] === "exit") continue;
  5994. if (lineIndex) {
  5995. events[lineIndex][1].type = types.lineEndingBlank;
  5996. listSpread = true;
  5997. }
  5998. tailEvent[1].type = types.lineEnding;
  5999. lineIndex = tailIndex;
  6000. } 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) {
  6001. } else {
  6002. break;
  6003. }
  6004. }
  6005. if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
  6006. listItem3._spread = true;
  6007. }
  6008. listItem3.end = Object.assign(
  6009. {},
  6010. lineIndex ? events[lineIndex][1].start : event[1].end
  6011. );
  6012. events.splice(lineIndex || index2, 0, ["exit", listItem3, event[2]]);
  6013. index2++;
  6014. length++;
  6015. }
  6016. if (event[1].type === types.listItemPrefix) {
  6017. const item = {
  6018. type: "listItem",
  6019. _spread: false,
  6020. start: Object.assign({}, event[1].start),
  6021. // @ts-expect-error: we’ll add `end` in a second.
  6022. end: void 0
  6023. };
  6024. listItem3 = item;
  6025. events.splice(index2, 0, ["enter", item, event[2]]);
  6026. index2++;
  6027. length++;
  6028. firstBlankLineIndex = void 0;
  6029. atMarker = true;
  6030. }
  6031. }
  6032. }
  6033. events[start2][1]._spread = listSpread;
  6034. return length;
  6035. }
  6036. function opener(create, and) {
  6037. return open;
  6038. function open(token) {
  6039. enter.call(this, create(token), token);
  6040. if (and) and.call(this, token);
  6041. }
  6042. }
  6043. function buffer() {
  6044. this.stack.push({ type: "fragment", children: [] });
  6045. }
  6046. function enter(node2, token, errorHandler) {
  6047. const parent = this.stack[this.stack.length - 1];
  6048. ok(parent, "expected `parent`");
  6049. ok("children" in parent, "expected `parent`");
  6050. const siblings = parent.children;
  6051. siblings.push(node2);
  6052. this.stack.push(node2);
  6053. this.tokenStack.push([token, errorHandler || void 0]);
  6054. node2.position = {
  6055. start: point3(token.start),
  6056. // @ts-expect-error: `end` will be patched later.
  6057. end: void 0
  6058. };
  6059. }
  6060. function closer(and) {
  6061. return close;
  6062. function close(token) {
  6063. if (and) and.call(this, token);
  6064. exit2.call(this, token);
  6065. }
  6066. }
  6067. function exit2(token, onExitError) {
  6068. const node2 = this.stack.pop();
  6069. ok(node2, "expected `node`");
  6070. const open = this.tokenStack.pop();
  6071. if (!open) {
  6072. throw new Error(
  6073. "Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open"
  6074. );
  6075. } else if (open[0].type !== token.type) {
  6076. if (onExitError) {
  6077. onExitError.call(this, token, open[0]);
  6078. } else {
  6079. const handler = open[1] || defaultOnError;
  6080. handler.call(this, token, open[0]);
  6081. }
  6082. }
  6083. ok(node2.type !== "fragment", "unexpected fragment `exit`ed");
  6084. ok(node2.position, "expected `position` to be defined");
  6085. node2.position.end = point3(token.end);
  6086. }
  6087. function resume() {
  6088. return toString(this.stack.pop());
  6089. }
  6090. function onenterlistordered() {
  6091. this.data.expectingFirstListItemValue = true;
  6092. }
  6093. function onenterlistitemvalue(token) {
  6094. if (this.data.expectingFirstListItemValue) {
  6095. const ancestor = this.stack[this.stack.length - 2];
  6096. ok(ancestor, "expected nodes on stack");
  6097. ok(ancestor.type === "list", "expected list on stack");
  6098. ancestor.start = Number.parseInt(
  6099. this.sliceSerialize(token),
  6100. constants.numericBaseDecimal
  6101. );
  6102. this.data.expectingFirstListItemValue = void 0;
  6103. }
  6104. }
  6105. function onexitcodefencedfenceinfo() {
  6106. const data2 = this.resume();
  6107. const node2 = this.stack[this.stack.length - 1];
  6108. ok(node2, "expected node on stack");
  6109. ok(node2.type === "code", "expected code on stack");
  6110. node2.lang = data2;
  6111. }
  6112. function onexitcodefencedfencemeta() {
  6113. const data2 = this.resume();
  6114. const node2 = this.stack[this.stack.length - 1];
  6115. ok(node2, "expected node on stack");
  6116. ok(node2.type === "code", "expected code on stack");
  6117. node2.meta = data2;
  6118. }
  6119. function onexitcodefencedfence() {
  6120. if (this.data.flowCodeInside) return;
  6121. this.buffer();
  6122. this.data.flowCodeInside = true;
  6123. }
  6124. function onexitcodefenced() {
  6125. const data2 = this.resume();
  6126. const node2 = this.stack[this.stack.length - 1];
  6127. ok(node2, "expected node on stack");
  6128. ok(node2.type === "code", "expected code on stack");
  6129. node2.value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
  6130. this.data.flowCodeInside = void 0;
  6131. }
  6132. function onexitcodeindented() {
  6133. const data2 = this.resume();
  6134. const node2 = this.stack[this.stack.length - 1];
  6135. ok(node2, "expected node on stack");
  6136. ok(node2.type === "code", "expected code on stack");
  6137. node2.value = data2.replace(/(\r?\n|\r)$/g, "");
  6138. }
  6139. function onexitdefinitionlabelstring(token) {
  6140. const label = this.resume();
  6141. const node2 = this.stack[this.stack.length - 1];
  6142. ok(node2, "expected node on stack");
  6143. ok(node2.type === "definition", "expected definition on stack");
  6144. node2.label = label;
  6145. node2.identifier = normalizeIdentifier(
  6146. this.sliceSerialize(token)
  6147. ).toLowerCase();
  6148. }
  6149. function onexitdefinitiontitlestring() {
  6150. const data2 = this.resume();
  6151. const node2 = this.stack[this.stack.length - 1];
  6152. ok(node2, "expected node on stack");
  6153. ok(node2.type === "definition", "expected definition on stack");
  6154. node2.title = data2;
  6155. }
  6156. function onexitdefinitiondestinationstring() {
  6157. const data2 = this.resume();
  6158. const node2 = this.stack[this.stack.length - 1];
  6159. ok(node2, "expected node on stack");
  6160. ok(node2.type === "definition", "expected definition on stack");
  6161. node2.url = data2;
  6162. }
  6163. function onexitatxheadingsequence(token) {
  6164. const node2 = this.stack[this.stack.length - 1];
  6165. ok(node2, "expected node on stack");
  6166. ok(node2.type === "heading", "expected heading on stack");
  6167. if (!node2.depth) {
  6168. const depth = this.sliceSerialize(token).length;
  6169. ok(
  6170. depth === 1 || depth === 2 || depth === 3 || depth === 4 || depth === 5 || depth === 6,
  6171. "expected `depth` between `1` and `6`"
  6172. );
  6173. node2.depth = depth;
  6174. }
  6175. }
  6176. function onexitsetextheadingtext() {
  6177. this.data.setextHeadingSlurpLineEnding = true;
  6178. }
  6179. function onexitsetextheadinglinesequence(token) {
  6180. const node2 = this.stack[this.stack.length - 1];
  6181. ok(node2, "expected node on stack");
  6182. ok(node2.type === "heading", "expected heading on stack");
  6183. node2.depth = this.sliceSerialize(token).codePointAt(0) === codes.equalsTo ? 1 : 2;
  6184. }
  6185. function onexitsetextheading() {
  6186. this.data.setextHeadingSlurpLineEnding = void 0;
  6187. }
  6188. function onenterdata(token) {
  6189. const node2 = this.stack[this.stack.length - 1];
  6190. ok(node2, "expected node on stack");
  6191. ok("children" in node2, "expected parent on stack");
  6192. const siblings = node2.children;
  6193. let tail = siblings[siblings.length - 1];
  6194. if (!tail || tail.type !== "text") {
  6195. tail = text5();
  6196. tail.position = {
  6197. start: point3(token.start),
  6198. // @ts-expect-error: we’ll add `end` later.
  6199. end: void 0
  6200. };
  6201. siblings.push(tail);
  6202. }
  6203. this.stack.push(tail);
  6204. }
  6205. function onexitdata(token) {
  6206. const tail = this.stack.pop();
  6207. ok(tail, "expected a `node` to be on the stack");
  6208. ok("value" in tail, "expected a `literal` to be on the stack");
  6209. ok(tail.position, "expected `node` to have an open position");
  6210. tail.value += this.sliceSerialize(token);
  6211. tail.position.end = point3(token.end);
  6212. }
  6213. function onexitlineending(token) {
  6214. const context = this.stack[this.stack.length - 1];
  6215. ok(context, "expected `node`");
  6216. if (this.data.atHardBreak) {
  6217. ok("children" in context, "expected `parent`");
  6218. const tail = context.children[context.children.length - 1];
  6219. ok(tail.position, "expected tail to have a starting position");
  6220. tail.position.end = point3(token.end);
  6221. this.data.atHardBreak = void 0;
  6222. return;
  6223. }
  6224. if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {
  6225. onenterdata.call(this, token);
  6226. onexitdata.call(this, token);
  6227. }
  6228. }
  6229. function onexithardbreak() {
  6230. this.data.atHardBreak = true;
  6231. }
  6232. function onexithtmlflow() {
  6233. const data2 = this.resume();
  6234. const node2 = this.stack[this.stack.length - 1];
  6235. ok(node2, "expected node on stack");
  6236. ok(node2.type === "html", "expected html on stack");
  6237. node2.value = data2;
  6238. }
  6239. function onexithtmltext() {
  6240. const data2 = this.resume();
  6241. const node2 = this.stack[this.stack.length - 1];
  6242. ok(node2, "expected node on stack");
  6243. ok(node2.type === "html", "expected html on stack");
  6244. node2.value = data2;
  6245. }
  6246. function onexitcodetext() {
  6247. const data2 = this.resume();
  6248. const node2 = this.stack[this.stack.length - 1];
  6249. ok(node2, "expected node on stack");
  6250. ok(node2.type === "inlineCode", "expected inline code on stack");
  6251. node2.value = data2;
  6252. }
  6253. function onexitlink() {
  6254. const node2 = this.stack[this.stack.length - 1];
  6255. ok(node2, "expected node on stack");
  6256. ok(node2.type === "link", "expected link on stack");
  6257. if (this.data.inReference) {
  6258. const referenceType = this.data.referenceType || "shortcut";
  6259. node2.type += "Reference";
  6260. node2.referenceType = referenceType;
  6261. delete node2.url;
  6262. delete node2.title;
  6263. } else {
  6264. delete node2.identifier;
  6265. delete node2.label;
  6266. }
  6267. this.data.referenceType = void 0;
  6268. }
  6269. function onexitimage() {
  6270. const node2 = this.stack[this.stack.length - 1];
  6271. ok(node2, "expected node on stack");
  6272. ok(node2.type === "image", "expected image on stack");
  6273. if (this.data.inReference) {
  6274. const referenceType = this.data.referenceType || "shortcut";
  6275. node2.type += "Reference";
  6276. node2.referenceType = referenceType;
  6277. delete node2.url;
  6278. delete node2.title;
  6279. } else {
  6280. delete node2.identifier;
  6281. delete node2.label;
  6282. }
  6283. this.data.referenceType = void 0;
  6284. }
  6285. function onexitlabeltext(token) {
  6286. const string3 = this.sliceSerialize(token);
  6287. const ancestor = this.stack[this.stack.length - 2];
  6288. ok(ancestor, "expected ancestor on stack");
  6289. ok(
  6290. ancestor.type === "image" || ancestor.type === "link",
  6291. "expected image or link on stack"
  6292. );
  6293. ancestor.label = decodeString(string3);
  6294. ancestor.identifier = normalizeIdentifier(string3).toLowerCase();
  6295. }
  6296. function onexitlabel() {
  6297. const fragment = this.stack[this.stack.length - 1];
  6298. ok(fragment, "expected node on stack");
  6299. ok(fragment.type === "fragment", "expected fragment on stack");
  6300. const value = this.resume();
  6301. const node2 = this.stack[this.stack.length - 1];
  6302. ok(node2, "expected node on stack");
  6303. ok(
  6304. node2.type === "image" || node2.type === "link",
  6305. "expected image or link on stack"
  6306. );
  6307. this.data.inReference = true;
  6308. if (node2.type === "link") {
  6309. const children = fragment.children;
  6310. node2.children = children;
  6311. } else {
  6312. node2.alt = value;
  6313. }
  6314. }
  6315. function onexitresourcedestinationstring() {
  6316. const data2 = this.resume();
  6317. const node2 = this.stack[this.stack.length - 1];
  6318. ok(node2, "expected node on stack");
  6319. ok(
  6320. node2.type === "image" || node2.type === "link",
  6321. "expected image or link on stack"
  6322. );
  6323. node2.url = data2;
  6324. }
  6325. function onexitresourcetitlestring() {
  6326. const data2 = this.resume();
  6327. const node2 = this.stack[this.stack.length - 1];
  6328. ok(node2, "expected node on stack");
  6329. ok(
  6330. node2.type === "image" || node2.type === "link",
  6331. "expected image or link on stack"
  6332. );
  6333. node2.title = data2;
  6334. }
  6335. function onexitresource() {
  6336. this.data.inReference = void 0;
  6337. }
  6338. function onenterreference() {
  6339. this.data.referenceType = "collapsed";
  6340. }
  6341. function onexitreferencestring(token) {
  6342. const label = this.resume();
  6343. const node2 = this.stack[this.stack.length - 1];
  6344. ok(node2, "expected node on stack");
  6345. ok(
  6346. node2.type === "image" || node2.type === "link",
  6347. "expected image reference or link reference on stack"
  6348. );
  6349. node2.label = label;
  6350. node2.identifier = normalizeIdentifier(
  6351. this.sliceSerialize(token)
  6352. ).toLowerCase();
  6353. this.data.referenceType = "full";
  6354. }
  6355. function onexitcharacterreferencemarker(token) {
  6356. ok(
  6357. token.type === "characterReferenceMarkerNumeric" || token.type === "characterReferenceMarkerHexadecimal"
  6358. );
  6359. this.data.characterReferenceType = token.type;
  6360. }
  6361. function onexitcharacterreferencevalue(token) {
  6362. const data2 = this.sliceSerialize(token);
  6363. const type = this.data.characterReferenceType;
  6364. let value;
  6365. if (type) {
  6366. value = decodeNumericCharacterReference(
  6367. data2,
  6368. type === types.characterReferenceMarkerNumeric ? constants.numericBaseDecimal : constants.numericBaseHexadecimal
  6369. );
  6370. this.data.characterReferenceType = void 0;
  6371. } else {
  6372. const result = decodeNamedCharacterReference(data2);
  6373. ok(result !== false, "expected reference to decode");
  6374. value = result;
  6375. }
  6376. const tail = this.stack[this.stack.length - 1];
  6377. ok(tail, "expected `node`");
  6378. ok("value" in tail, "expected `node.value`");
  6379. tail.value += value;
  6380. }
  6381. function onexitcharacterreference(token) {
  6382. const tail = this.stack.pop();
  6383. ok(tail, "expected `node`");
  6384. ok(tail.position, "expected `node.position`");
  6385. tail.position.end = point3(token.end);
  6386. }
  6387. function onexitautolinkprotocol(token) {
  6388. onexitdata.call(this, token);
  6389. const node2 = this.stack[this.stack.length - 1];
  6390. ok(node2, "expected node on stack");
  6391. ok(node2.type === "link", "expected link on stack");
  6392. node2.url = this.sliceSerialize(token);
  6393. }
  6394. function onexitautolinkemail(token) {
  6395. onexitdata.call(this, token);
  6396. const node2 = this.stack[this.stack.length - 1];
  6397. ok(node2, "expected node on stack");
  6398. ok(node2.type === "link", "expected link on stack");
  6399. node2.url = "mailto:" + this.sliceSerialize(token);
  6400. }
  6401. function blockQuote2() {
  6402. return { type: "blockquote", children: [] };
  6403. }
  6404. function codeFlow() {
  6405. return { type: "code", lang: null, meta: null, value: "" };
  6406. }
  6407. function codeText2() {
  6408. return { type: "inlineCode", value: "" };
  6409. }
  6410. function definition2() {
  6411. return {
  6412. type: "definition",
  6413. identifier: "",
  6414. label: null,
  6415. title: null,
  6416. url: ""
  6417. };
  6418. }
  6419. function emphasis2() {
  6420. return { type: "emphasis", children: [] };
  6421. }
  6422. function heading2() {
  6423. return {
  6424. type: "heading",
  6425. // @ts-expect-error `depth` will be set later.
  6426. depth: 0,
  6427. children: []
  6428. };
  6429. }
  6430. function hardBreak2() {
  6431. return { type: "break" };
  6432. }
  6433. function html3() {
  6434. return { type: "html", value: "" };
  6435. }
  6436. function image2() {
  6437. return { type: "image", title: null, url: "", alt: null };
  6438. }
  6439. function link2() {
  6440. return { type: "link", title: null, url: "", children: [] };
  6441. }
  6442. function list3(token) {
  6443. return {
  6444. type: "list",
  6445. ordered: token.type === "listOrdered",
  6446. start: null,
  6447. spread: token._spread,
  6448. children: []
  6449. };
  6450. }
  6451. function listItem2(token) {
  6452. return {
  6453. type: "listItem",
  6454. spread: token._spread,
  6455. checked: null,
  6456. children: []
  6457. };
  6458. }
  6459. function paragraph2() {
  6460. return { type: "paragraph", children: [] };
  6461. }
  6462. function strong2() {
  6463. return { type: "strong", children: [] };
  6464. }
  6465. function text5() {
  6466. return { type: "text", value: "" };
  6467. }
  6468. function thematicBreak3() {
  6469. return { type: "thematicBreak" };
  6470. }
  6471. }
  6472. function point3(d) {
  6473. return { line: d.line, column: d.column, offset: d.offset };
  6474. }
  6475. function configure(combined, extensions) {
  6476. let index2 = -1;
  6477. while (++index2 < extensions.length) {
  6478. const value = extensions[index2];
  6479. if (Array.isArray(value)) {
  6480. configure(combined, value);
  6481. } else {
  6482. extension(combined, value);
  6483. }
  6484. }
  6485. }
  6486. function extension(combined, extension2) {
  6487. let key;
  6488. for (key in extension2) {
  6489. if (own2.call(extension2, key)) {
  6490. switch (key) {
  6491. case "canContainEols": {
  6492. const right = extension2[key];
  6493. if (right) {
  6494. combined[key].push(...right);
  6495. }
  6496. break;
  6497. }
  6498. case "transforms": {
  6499. const right = extension2[key];
  6500. if (right) {
  6501. combined[key].push(...right);
  6502. }
  6503. break;
  6504. }
  6505. case "enter":
  6506. case "exit": {
  6507. const right = extension2[key];
  6508. if (right) {
  6509. Object.assign(combined[key], right);
  6510. }
  6511. break;
  6512. }
  6513. }
  6514. }
  6515. }
  6516. }
  6517. function defaultOnError(left, right) {
  6518. if (left) {
  6519. throw new Error(
  6520. "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"
  6521. );
  6522. } else {
  6523. throw new Error(
  6524. "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open"
  6525. );
  6526. }
  6527. }
  6528. // node_modules/remark-parse/lib/index.js
  6529. function remarkParse(options) {
  6530. const self2 = this;
  6531. self2.parser = parser;
  6532. function parser(doc) {
  6533. return fromMarkdown(doc, {
  6534. ...self2.data("settings"),
  6535. ...options,
  6536. // Note: these options are not in the readme.
  6537. // The goal is for them to be set by plugins on `data` instead of being
  6538. // passed by users.
  6539. extensions: self2.data("micromarkExtensions") || [],
  6540. mdastExtensions: self2.data("fromMarkdownExtensions") || []
  6541. });
  6542. }
  6543. }
  6544. // node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
  6545. function blockquote(state, node2) {
  6546. const result = {
  6547. type: "element",
  6548. tagName: "blockquote",
  6549. properties: {},
  6550. children: state.wrap(state.all(node2), true)
  6551. };
  6552. state.patch(node2, result);
  6553. return state.applyData(node2, result);
  6554. }
  6555. // node_modules/mdast-util-to-hast/lib/handlers/break.js
  6556. function hardBreak(state, node2) {
  6557. const result = { type: "element", tagName: "br", properties: {}, children: [] };
  6558. state.patch(node2, result);
  6559. return [state.applyData(node2, result), { type: "text", value: "\n" }];
  6560. }
  6561. // node_modules/mdast-util-to-hast/lib/handlers/code.js
  6562. function code(state, node2) {
  6563. const value = node2.value ? node2.value + "\n" : "";
  6564. const properties = {};
  6565. const language = node2.lang ? node2.lang.split(/\s+/) : [];
  6566. if (language.length > 0) {
  6567. properties.className = ["language-" + language[0]];
  6568. }
  6569. let result = {
  6570. type: "element",
  6571. tagName: "code",
  6572. properties,
  6573. children: [{ type: "text", value }]
  6574. };
  6575. if (node2.meta) {
  6576. result.data = { meta: node2.meta };
  6577. }
  6578. state.patch(node2, result);
  6579. result = state.applyData(node2, result);
  6580. result = { type: "element", tagName: "pre", properties: {}, children: [result] };
  6581. state.patch(node2, result);
  6582. return result;
  6583. }
  6584. // node_modules/mdast-util-to-hast/lib/handlers/delete.js
  6585. function strikethrough(state, node2) {
  6586. const result = {
  6587. type: "element",
  6588. tagName: "del",
  6589. properties: {},
  6590. children: state.all(node2)
  6591. };
  6592. state.patch(node2, result);
  6593. return state.applyData(node2, result);
  6594. }
  6595. // node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
  6596. function emphasis(state, node2) {
  6597. const result = {
  6598. type: "element",
  6599. tagName: "em",
  6600. properties: {},
  6601. children: state.all(node2)
  6602. };
  6603. state.patch(node2, result);
  6604. return state.applyData(node2, result);
  6605. }
  6606. // node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
  6607. function footnoteReference(state, node2) {
  6608. const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
  6609. const id = String(node2.identifier).toUpperCase();
  6610. const safeId = normalizeUri(id.toLowerCase());
  6611. const index2 = state.footnoteOrder.indexOf(id);
  6612. let counter;
  6613. let reuseCounter = state.footnoteCounts.get(id);
  6614. if (reuseCounter === void 0) {
  6615. reuseCounter = 0;
  6616. state.footnoteOrder.push(id);
  6617. counter = state.footnoteOrder.length;
  6618. } else {
  6619. counter = index2 + 1;
  6620. }
  6621. reuseCounter += 1;
  6622. state.footnoteCounts.set(id, reuseCounter);
  6623. const link2 = {
  6624. type: "element",
  6625. tagName: "a",
  6626. properties: {
  6627. href: "#" + clobberPrefix + "fn-" + safeId,
  6628. id: clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""),
  6629. dataFootnoteRef: true,
  6630. ariaDescribedBy: ["footnote-label"]
  6631. },
  6632. children: [{ type: "text", value: String(counter) }]
  6633. };
  6634. state.patch(node2, link2);
  6635. const sup = {
  6636. type: "element",
  6637. tagName: "sup",
  6638. properties: {},
  6639. children: [link2]
  6640. };
  6641. state.patch(node2, sup);
  6642. return state.applyData(node2, sup);
  6643. }
  6644. // node_modules/mdast-util-to-hast/lib/handlers/heading.js
  6645. function heading(state, node2) {
  6646. const result = {
  6647. type: "element",
  6648. tagName: "h" + node2.depth,
  6649. properties: {},
  6650. children: state.all(node2)
  6651. };
  6652. state.patch(node2, result);
  6653. return state.applyData(node2, result);
  6654. }
  6655. // node_modules/mdast-util-to-hast/lib/handlers/html.js
  6656. function html2(state, node2) {
  6657. if (state.options.allowDangerousHtml) {
  6658. const result = { type: "raw", value: node2.value };
  6659. state.patch(node2, result);
  6660. return state.applyData(node2, result);
  6661. }
  6662. return void 0;
  6663. }
  6664. // node_modules/mdast-util-to-hast/lib/revert.js
  6665. function revert(state, node2) {
  6666. const subtype = node2.referenceType;
  6667. let suffix = "]";
  6668. if (subtype === "collapsed") {
  6669. suffix += "[]";
  6670. } else if (subtype === "full") {
  6671. suffix += "[" + (node2.label || node2.identifier) + "]";
  6672. }
  6673. if (node2.type === "imageReference") {
  6674. return [{ type: "text", value: "![" + node2.alt + suffix }];
  6675. }
  6676. const contents = state.all(node2);
  6677. const head = contents[0];
  6678. if (head && head.type === "text") {
  6679. head.value = "[" + head.value;
  6680. } else {
  6681. contents.unshift({ type: "text", value: "[" });
  6682. }
  6683. const tail = contents[contents.length - 1];
  6684. if (tail && tail.type === "text") {
  6685. tail.value += suffix;
  6686. } else {
  6687. contents.push({ type: "text", value: suffix });
  6688. }
  6689. return contents;
  6690. }
  6691. // node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
  6692. function imageReference(state, node2) {
  6693. const id = String(node2.identifier).toUpperCase();
  6694. const definition2 = state.definitionById.get(id);
  6695. if (!definition2) {
  6696. return revert(state, node2);
  6697. }
  6698. const properties = { src: normalizeUri(definition2.url || ""), alt: node2.alt };
  6699. if (definition2.title !== null && definition2.title !== void 0) {
  6700. properties.title = definition2.title;
  6701. }
  6702. const result = { type: "element", tagName: "img", properties, children: [] };
  6703. state.patch(node2, result);
  6704. return state.applyData(node2, result);
  6705. }
  6706. // node_modules/mdast-util-to-hast/lib/handlers/image.js
  6707. function image(state, node2) {
  6708. const properties = { src: normalizeUri(node2.url) };
  6709. if (node2.alt !== null && node2.alt !== void 0) {
  6710. properties.alt = node2.alt;
  6711. }
  6712. if (node2.title !== null && node2.title !== void 0) {
  6713. properties.title = node2.title;
  6714. }
  6715. const result = { type: "element", tagName: "img", properties, children: [] };
  6716. state.patch(node2, result);
  6717. return state.applyData(node2, result);
  6718. }
  6719. // node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
  6720. function inlineCode(state, node2) {
  6721. const text5 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
  6722. state.patch(node2, text5);
  6723. const result = {
  6724. type: "element",
  6725. tagName: "code",
  6726. properties: {},
  6727. children: [text5]
  6728. };
  6729. state.patch(node2, result);
  6730. return state.applyData(node2, result);
  6731. }
  6732. // node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
  6733. function linkReference(state, node2) {
  6734. const id = String(node2.identifier).toUpperCase();
  6735. const definition2 = state.definitionById.get(id);
  6736. if (!definition2) {
  6737. return revert(state, node2);
  6738. }
  6739. const properties = { href: normalizeUri(definition2.url || "") };
  6740. if (definition2.title !== null && definition2.title !== void 0) {
  6741. properties.title = definition2.title;
  6742. }
  6743. const result = {
  6744. type: "element",
  6745. tagName: "a",
  6746. properties,
  6747. children: state.all(node2)
  6748. };
  6749. state.patch(node2, result);
  6750. return state.applyData(node2, result);
  6751. }
  6752. // node_modules/mdast-util-to-hast/lib/handlers/link.js
  6753. function link(state, node2) {
  6754. const properties = { href: normalizeUri(node2.url) };
  6755. if (node2.title !== null && node2.title !== void 0) {
  6756. properties.title = node2.title;
  6757. }
  6758. const result = {
  6759. type: "element",
  6760. tagName: "a",
  6761. properties,
  6762. children: state.all(node2)
  6763. };
  6764. state.patch(node2, result);
  6765. return state.applyData(node2, result);
  6766. }
  6767. // node_modules/mdast-util-to-hast/lib/handlers/list-item.js
  6768. function listItem(state, node2, parent) {
  6769. const results = state.all(node2);
  6770. const loose = parent ? listLoose(parent) : listItemLoose(node2);
  6771. const properties = {};
  6772. const children = [];
  6773. if (typeof node2.checked === "boolean") {
  6774. const head = results[0];
  6775. let paragraph2;
  6776. if (head && head.type === "element" && head.tagName === "p") {
  6777. paragraph2 = head;
  6778. } else {
  6779. paragraph2 = { type: "element", tagName: "p", properties: {}, children: [] };
  6780. results.unshift(paragraph2);
  6781. }
  6782. if (paragraph2.children.length > 0) {
  6783. paragraph2.children.unshift({ type: "text", value: " " });
  6784. }
  6785. paragraph2.children.unshift({
  6786. type: "element",
  6787. tagName: "input",
  6788. properties: { type: "checkbox", checked: node2.checked, disabled: true },
  6789. children: []
  6790. });
  6791. properties.className = ["task-list-item"];
  6792. }
  6793. let index2 = -1;
  6794. while (++index2 < results.length) {
  6795. const child = results[index2];
  6796. if (loose || index2 !== 0 || child.type !== "element" || child.tagName !== "p") {
  6797. children.push({ type: "text", value: "\n" });
  6798. }
  6799. if (child.type === "element" && child.tagName === "p" && !loose) {
  6800. children.push(...child.children);
  6801. } else {
  6802. children.push(child);
  6803. }
  6804. }
  6805. const tail = results[results.length - 1];
  6806. if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) {
  6807. children.push({ type: "text", value: "\n" });
  6808. }
  6809. const result = { type: "element", tagName: "li", properties, children };
  6810. state.patch(node2, result);
  6811. return state.applyData(node2, result);
  6812. }
  6813. function listLoose(node2) {
  6814. let loose = false;
  6815. if (node2.type === "list") {
  6816. loose = node2.spread || false;
  6817. const children = node2.children;
  6818. let index2 = -1;
  6819. while (!loose && ++index2 < children.length) {
  6820. loose = listItemLoose(children[index2]);
  6821. }
  6822. }
  6823. return loose;
  6824. }
  6825. function listItemLoose(node2) {
  6826. const spread = node2.spread;
  6827. return spread === null || spread === void 0 ? node2.children.length > 1 : spread;
  6828. }
  6829. // node_modules/mdast-util-to-hast/lib/handlers/list.js
  6830. function list2(state, node2) {
  6831. const properties = {};
  6832. const results = state.all(node2);
  6833. let index2 = -1;
  6834. if (typeof node2.start === "number" && node2.start !== 1) {
  6835. properties.start = node2.start;
  6836. }
  6837. while (++index2 < results.length) {
  6838. const child = results[index2];
  6839. if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) {
  6840. properties.className = ["contains-task-list"];
  6841. break;
  6842. }
  6843. }
  6844. const result = {
  6845. type: "element",
  6846. tagName: node2.ordered ? "ol" : "ul",
  6847. properties,
  6848. children: state.wrap(results, true)
  6849. };
  6850. state.patch(node2, result);
  6851. return state.applyData(node2, result);
  6852. }
  6853. // node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
  6854. function paragraph(state, node2) {
  6855. const result = {
  6856. type: "element",
  6857. tagName: "p",
  6858. properties: {},
  6859. children: state.all(node2)
  6860. };
  6861. state.patch(node2, result);
  6862. return state.applyData(node2, result);
  6863. }
  6864. // node_modules/mdast-util-to-hast/lib/handlers/root.js
  6865. function root2(state, node2) {
  6866. const result = { type: "root", children: state.wrap(state.all(node2)) };
  6867. state.patch(node2, result);
  6868. return state.applyData(node2, result);
  6869. }
  6870. // node_modules/mdast-util-to-hast/lib/handlers/strong.js
  6871. function strong(state, node2) {
  6872. const result = {
  6873. type: "element",
  6874. tagName: "strong",
  6875. properties: {},
  6876. children: state.all(node2)
  6877. };
  6878. state.patch(node2, result);
  6879. return state.applyData(node2, result);
  6880. }
  6881. // node_modules/mdast-util-to-hast/lib/handlers/table.js
  6882. function table(state, node2) {
  6883. const rows = state.all(node2);
  6884. const firstRow = rows.shift();
  6885. const tableContent = [];
  6886. if (firstRow) {
  6887. const head = {
  6888. type: "element",
  6889. tagName: "thead",
  6890. properties: {},
  6891. children: state.wrap([firstRow], true)
  6892. };
  6893. state.patch(node2.children[0], head);
  6894. tableContent.push(head);
  6895. }
  6896. if (rows.length > 0) {
  6897. const body = {
  6898. type: "element",
  6899. tagName: "tbody",
  6900. properties: {},
  6901. children: state.wrap(rows, true)
  6902. };
  6903. const start2 = pointStart(node2.children[1]);
  6904. const end = pointEnd(node2.children[node2.children.length - 1]);
  6905. if (start2 && end) body.position = { start: start2, end };
  6906. tableContent.push(body);
  6907. }
  6908. const result = {
  6909. type: "element",
  6910. tagName: "table",
  6911. properties: {},
  6912. children: state.wrap(tableContent, true)
  6913. };
  6914. state.patch(node2, result);
  6915. return state.applyData(node2, result);
  6916. }
  6917. // node_modules/mdast-util-to-hast/lib/handlers/table-row.js
  6918. function tableRow(state, node2, parent) {
  6919. const siblings = parent ? parent.children : void 0;
  6920. const rowIndex = siblings ? siblings.indexOf(node2) : 1;
  6921. const tagName = rowIndex === 0 ? "th" : "td";
  6922. const align = parent && parent.type === "table" ? parent.align : void 0;
  6923. const length = align ? align.length : node2.children.length;
  6924. let cellIndex = -1;
  6925. const cells = [];
  6926. while (++cellIndex < length) {
  6927. const cell = node2.children[cellIndex];
  6928. const properties = {};
  6929. const alignValue = align ? align[cellIndex] : void 0;
  6930. if (alignValue) {
  6931. properties.align = alignValue;
  6932. }
  6933. let result2 = { type: "element", tagName, properties, children: [] };
  6934. if (cell) {
  6935. result2.children = state.all(cell);
  6936. state.patch(cell, result2);
  6937. result2 = state.applyData(cell, result2);
  6938. }
  6939. cells.push(result2);
  6940. }
  6941. const result = {
  6942. type: "element",
  6943. tagName: "tr",
  6944. properties: {},
  6945. children: state.wrap(cells, true)
  6946. };
  6947. state.patch(node2, result);
  6948. return state.applyData(node2, result);
  6949. }
  6950. // node_modules/mdast-util-to-hast/lib/handlers/table-cell.js
  6951. function tableCell(state, node2) {
  6952. const result = {
  6953. type: "element",
  6954. tagName: "td",
  6955. // Assume body cell.
  6956. properties: {},
  6957. children: state.all(node2)
  6958. };
  6959. state.patch(node2, result);
  6960. return state.applyData(node2, result);
  6961. }
  6962. // node_modules/trim-lines/index.js
  6963. var tab = 9;
  6964. var space = 32;
  6965. function trimLines(value) {
  6966. const source = String(value);
  6967. const search2 = /\r?\n|\r/g;
  6968. let match = search2.exec(source);
  6969. let last = 0;
  6970. const lines = [];
  6971. while (match) {
  6972. lines.push(
  6973. trimLine(source.slice(last, match.index), last > 0, true),
  6974. match[0]
  6975. );
  6976. last = match.index + match[0].length;
  6977. match = search2.exec(source);
  6978. }
  6979. lines.push(trimLine(source.slice(last), last > 0, false));
  6980. return lines.join("");
  6981. }
  6982. function trimLine(value, start2, end) {
  6983. let startIndex = 0;
  6984. let endIndex = value.length;
  6985. if (start2) {
  6986. let code2 = value.codePointAt(startIndex);
  6987. while (code2 === tab || code2 === space) {
  6988. startIndex++;
  6989. code2 = value.codePointAt(startIndex);
  6990. }
  6991. }
  6992. if (end) {
  6993. let code2 = value.codePointAt(endIndex - 1);
  6994. while (code2 === tab || code2 === space) {
  6995. endIndex--;
  6996. code2 = value.codePointAt(endIndex - 1);
  6997. }
  6998. }
  6999. return endIndex > startIndex ? value.slice(startIndex, endIndex) : "";
  7000. }
  7001. // node_modules/mdast-util-to-hast/lib/handlers/text.js
  7002. function text4(state, node2) {
  7003. const result = { type: "text", value: trimLines(String(node2.value)) };
  7004. state.patch(node2, result);
  7005. return state.applyData(node2, result);
  7006. }
  7007. // node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
  7008. function thematicBreak2(state, node2) {
  7009. const result = {
  7010. type: "element",
  7011. tagName: "hr",
  7012. properties: {},
  7013. children: []
  7014. };
  7015. state.patch(node2, result);
  7016. return state.applyData(node2, result);
  7017. }
  7018. // node_modules/mdast-util-to-hast/lib/handlers/index.js
  7019. var handlers = {
  7020. blockquote,
  7021. break: hardBreak,
  7022. code,
  7023. delete: strikethrough,
  7024. emphasis,
  7025. footnoteReference,
  7026. heading,
  7027. html: html2,
  7028. imageReference,
  7029. image,
  7030. inlineCode,
  7031. linkReference,
  7032. link,
  7033. listItem,
  7034. list: list2,
  7035. paragraph,
  7036. // @ts-expect-error: root is different, but hard to type.
  7037. root: root2,
  7038. strong,
  7039. table,
  7040. tableCell,
  7041. tableRow,
  7042. text: text4,
  7043. thematicBreak: thematicBreak2,
  7044. toml: ignore,
  7045. yaml: ignore,
  7046. definition: ignore,
  7047. footnoteDefinition: ignore
  7048. };
  7049. function ignore() {
  7050. return void 0;
  7051. }
  7052. // node_modules/@ungap/structured-clone/esm/types.js
  7053. var VOID = -1;
  7054. var PRIMITIVE = 0;
  7055. var ARRAY = 1;
  7056. var OBJECT = 2;
  7057. var DATE = 3;
  7058. var REGEXP = 4;
  7059. var MAP = 5;
  7060. var SET = 6;
  7061. var ERROR = 7;
  7062. var BIGINT = 8;
  7063. // node_modules/@ungap/structured-clone/esm/deserialize.js
  7064. var env = typeof self === "object" ? self : globalThis;
  7065. var deserializer = ($, _) => {
  7066. const as = (out, index2) => {
  7067. $.set(index2, out);
  7068. return out;
  7069. };
  7070. const unpair = (index2) => {
  7071. if ($.has(index2))
  7072. return $.get(index2);
  7073. const [type, value] = _[index2];
  7074. switch (type) {
  7075. case PRIMITIVE:
  7076. case VOID:
  7077. return as(value, index2);
  7078. case ARRAY: {
  7079. const arr = as([], index2);
  7080. for (const index3 of value)
  7081. arr.push(unpair(index3));
  7082. return arr;
  7083. }
  7084. case OBJECT: {
  7085. const object = as({}, index2);
  7086. for (const [key, index3] of value)
  7087. object[unpair(key)] = unpair(index3);
  7088. return object;
  7089. }
  7090. case DATE:
  7091. return as(new Date(value), index2);
  7092. case REGEXP: {
  7093. const { source, flags } = value;
  7094. return as(new RegExp(source, flags), index2);
  7095. }
  7096. case MAP: {
  7097. const map = as(/* @__PURE__ */ new Map(), index2);
  7098. for (const [key, index3] of value)
  7099. map.set(unpair(key), unpair(index3));
  7100. return map;
  7101. }
  7102. case SET: {
  7103. const set = as(/* @__PURE__ */ new Set(), index2);
  7104. for (const index3 of value)
  7105. set.add(unpair(index3));
  7106. return set;
  7107. }
  7108. case ERROR: {
  7109. const { name: name2, message } = value;
  7110. return as(new env[name2](message), index2);
  7111. }
  7112. case BIGINT:
  7113. return as(BigInt(value), index2);
  7114. case "BigInt":
  7115. return as(Object(BigInt(value)), index2);
  7116. case "ArrayBuffer":
  7117. return as(new Uint8Array(value).buffer, value);
  7118. case "DataView": {
  7119. const { buffer } = new Uint8Array(value);
  7120. return as(new DataView(buffer), value);
  7121. }
  7122. }
  7123. return as(new env[type](value), index2);
  7124. };
  7125. return unpair;
  7126. };
  7127. var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
  7128. // node_modules/@ungap/structured-clone/esm/serialize.js
  7129. var EMPTY = "";
  7130. var { toString: toString2 } = {};
  7131. var { keys } = Object;
  7132. var typeOf = (value) => {
  7133. const type = typeof value;
  7134. if (type !== "object" || !value)
  7135. return [PRIMITIVE, type];
  7136. const asString = toString2.call(value).slice(8, -1);
  7137. switch (asString) {
  7138. case "Array":
  7139. return [ARRAY, EMPTY];
  7140. case "Object":
  7141. return [OBJECT, EMPTY];
  7142. case "Date":
  7143. return [DATE, EMPTY];
  7144. case "RegExp":
  7145. return [REGEXP, EMPTY];
  7146. case "Map":
  7147. return [MAP, EMPTY];
  7148. case "Set":
  7149. return [SET, EMPTY];
  7150. case "DataView":
  7151. return [ARRAY, asString];
  7152. }
  7153. if (asString.includes("Array"))
  7154. return [ARRAY, asString];
  7155. if (asString.includes("Error"))
  7156. return [ERROR, asString];
  7157. return [OBJECT, asString];
  7158. };
  7159. var shouldSkip = ([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol");
  7160. var serializer = (strict, json, $, _) => {
  7161. const as = (out, value) => {
  7162. const index2 = _.push(out) - 1;
  7163. $.set(value, index2);
  7164. return index2;
  7165. };
  7166. const pair = (value) => {
  7167. if ($.has(value))
  7168. return $.get(value);
  7169. let [TYPE, type] = typeOf(value);
  7170. switch (TYPE) {
  7171. case PRIMITIVE: {
  7172. let entry = value;
  7173. switch (type) {
  7174. case "bigint":
  7175. TYPE = BIGINT;
  7176. entry = value.toString();
  7177. break;
  7178. case "function":
  7179. case "symbol":
  7180. if (strict)
  7181. throw new TypeError("unable to serialize " + type);
  7182. entry = null;
  7183. break;
  7184. case "undefined":
  7185. return as([VOID], value);
  7186. }
  7187. return as([TYPE, entry], value);
  7188. }
  7189. case ARRAY: {
  7190. if (type) {
  7191. let spread = value;
  7192. if (type === "DataView") {
  7193. spread = new Uint8Array(value.buffer);
  7194. } else if (type === "ArrayBuffer") {
  7195. spread = new Uint8Array(value);
  7196. }
  7197. return as([type, [...spread]], value);
  7198. }
  7199. const arr = [];
  7200. const index2 = as([TYPE, arr], value);
  7201. for (const entry of value)
  7202. arr.push(pair(entry));
  7203. return index2;
  7204. }
  7205. case OBJECT: {
  7206. if (type) {
  7207. switch (type) {
  7208. case "BigInt":
  7209. return as([type, value.toString()], value);
  7210. case "Boolean":
  7211. case "Number":
  7212. case "String":
  7213. return as([type, value.valueOf()], value);
  7214. }
  7215. }
  7216. if (json && "toJSON" in value)
  7217. return pair(value.toJSON());
  7218. const entries = [];
  7219. const index2 = as([TYPE, entries], value);
  7220. for (const key of keys(value)) {
  7221. if (strict || !shouldSkip(typeOf(value[key])))
  7222. entries.push([pair(key), pair(value[key])]);
  7223. }
  7224. return index2;
  7225. }
  7226. case DATE:
  7227. return as([TYPE, value.toISOString()], value);
  7228. case REGEXP: {
  7229. const { source, flags } = value;
  7230. return as([TYPE, { source, flags }], value);
  7231. }
  7232. case MAP: {
  7233. const entries = [];
  7234. const index2 = as([TYPE, entries], value);
  7235. for (const [key, entry] of value) {
  7236. if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
  7237. entries.push([pair(key), pair(entry)]);
  7238. }
  7239. return index2;
  7240. }
  7241. case SET: {
  7242. const entries = [];
  7243. const index2 = as([TYPE, entries], value);
  7244. for (const entry of value) {
  7245. if (strict || !shouldSkip(typeOf(entry)))
  7246. entries.push(pair(entry));
  7247. }
  7248. return index2;
  7249. }
  7250. }
  7251. const { message } = value;
  7252. return as([TYPE, { name: type, message }], value);
  7253. };
  7254. return pair;
  7255. };
  7256. var serialize = (value, { json, lossy } = {}) => {
  7257. const _ = [];
  7258. return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
  7259. };
  7260. // node_modules/@ungap/structured-clone/esm/index.js
  7261. var esm_default = typeof structuredClone === "function" ? (
  7262. /* c8 ignore start */
  7263. (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any)
  7264. ) : (any, options) => deserialize(serialize(any, options));
  7265. // node_modules/mdast-util-to-hast/lib/footer.js
  7266. function defaultFootnoteBackContent(_, rereferenceIndex) {
  7267. const result = [{ type: "text", value: "↩" }];
  7268. if (rereferenceIndex > 1) {
  7269. result.push({
  7270. type: "element",
  7271. tagName: "sup",
  7272. properties: {},
  7273. children: [{ type: "text", value: String(rereferenceIndex) }]
  7274. });
  7275. }
  7276. return result;
  7277. }
  7278. function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
  7279. return "Back to reference " + (referenceIndex + 1) + (rereferenceIndex > 1 ? "-" + rereferenceIndex : "");
  7280. }
  7281. function footer(state) {
  7282. const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
  7283. const footnoteBackContent = state.options.footnoteBackContent || defaultFootnoteBackContent;
  7284. const footnoteBackLabel = state.options.footnoteBackLabel || defaultFootnoteBackLabel;
  7285. const footnoteLabel = state.options.footnoteLabel || "Footnotes";
  7286. const footnoteLabelTagName = state.options.footnoteLabelTagName || "h2";
  7287. const footnoteLabelProperties = state.options.footnoteLabelProperties || {
  7288. className: ["sr-only"]
  7289. };
  7290. const listItems = [];
  7291. let referenceIndex = -1;
  7292. while (++referenceIndex < state.footnoteOrder.length) {
  7293. const definition2 = state.footnoteById.get(
  7294. state.footnoteOrder[referenceIndex]
  7295. );
  7296. if (!definition2) {
  7297. continue;
  7298. }
  7299. const content3 = state.all(definition2);
  7300. const id = String(definition2.identifier).toUpperCase();
  7301. const safeId = normalizeUri(id.toLowerCase());
  7302. let rereferenceIndex = 0;
  7303. const backReferences = [];
  7304. const counts = state.footnoteCounts.get(id);
  7305. while (counts !== void 0 && ++rereferenceIndex <= counts) {
  7306. if (backReferences.length > 0) {
  7307. backReferences.push({ type: "text", value: " " });
  7308. }
  7309. let children = typeof footnoteBackContent === "string" ? footnoteBackContent : footnoteBackContent(referenceIndex, rereferenceIndex);
  7310. if (typeof children === "string") {
  7311. children = { type: "text", value: children };
  7312. }
  7313. backReferences.push({
  7314. type: "element",
  7315. tagName: "a",
  7316. properties: {
  7317. href: "#" + clobberPrefix + "fnref-" + safeId + (rereferenceIndex > 1 ? "-" + rereferenceIndex : ""),
  7318. dataFootnoteBackref: "",
  7319. ariaLabel: typeof footnoteBackLabel === "string" ? footnoteBackLabel : footnoteBackLabel(referenceIndex, rereferenceIndex),
  7320. className: ["data-footnote-backref"]
  7321. },
  7322. children: Array.isArray(children) ? children : [children]
  7323. });
  7324. }
  7325. const tail = content3[content3.length - 1];
  7326. if (tail && tail.type === "element" && tail.tagName === "p") {
  7327. const tailTail = tail.children[tail.children.length - 1];
  7328. if (tailTail && tailTail.type === "text") {
  7329. tailTail.value += " ";
  7330. } else {
  7331. tail.children.push({ type: "text", value: " " });
  7332. }
  7333. tail.children.push(...backReferences);
  7334. } else {
  7335. content3.push(...backReferences);
  7336. }
  7337. const listItem2 = {
  7338. type: "element",
  7339. tagName: "li",
  7340. properties: { id: clobberPrefix + "fn-" + safeId },
  7341. children: state.wrap(content3, true)
  7342. };
  7343. state.patch(definition2, listItem2);
  7344. listItems.push(listItem2);
  7345. }
  7346. if (listItems.length === 0) {
  7347. return;
  7348. }
  7349. return {
  7350. type: "element",
  7351. tagName: "section",
  7352. properties: { dataFootnotes: true, className: ["footnotes"] },
  7353. children: [
  7354. {
  7355. type: "element",
  7356. tagName: footnoteLabelTagName,
  7357. properties: {
  7358. ...esm_default(footnoteLabelProperties),
  7359. id: "footnote-label"
  7360. },
  7361. children: [{ type: "text", value: footnoteLabel }]
  7362. },
  7363. { type: "text", value: "\n" },
  7364. {
  7365. type: "element",
  7366. tagName: "ol",
  7367. properties: {},
  7368. children: state.wrap(listItems, true)
  7369. },
  7370. { type: "text", value: "\n" }
  7371. ]
  7372. };
  7373. }
  7374. // node_modules/unist-util-visit/lib/index.js
  7375. function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
  7376. let reverse;
  7377. let test;
  7378. let visitor;
  7379. if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
  7380. test = void 0;
  7381. visitor = testOrVisitor;
  7382. reverse = visitorOrReverse;
  7383. } else {
  7384. test = testOrVisitor;
  7385. visitor = visitorOrReverse;
  7386. reverse = maybeReverse;
  7387. }
  7388. visitParents(tree, test, overload, reverse);
  7389. function overload(node2, parents) {
  7390. const parent = parents[parents.length - 1];
  7391. const index2 = parent ? parent.children.indexOf(node2) : void 0;
  7392. return visitor(node2, index2, parent);
  7393. }
  7394. }
  7395. // node_modules/mdast-util-to-hast/lib/state.js
  7396. var own3 = {}.hasOwnProperty;
  7397. var emptyOptions3 = {};
  7398. function createState(tree, options) {
  7399. const settings = options || emptyOptions3;
  7400. const definitionById = /* @__PURE__ */ new Map();
  7401. const footnoteById = /* @__PURE__ */ new Map();
  7402. const footnoteCounts = /* @__PURE__ */ new Map();
  7403. const handlers2 = { ...handlers, ...settings.handlers };
  7404. const state = {
  7405. all: all2,
  7406. applyData,
  7407. definitionById,
  7408. footnoteById,
  7409. footnoteCounts,
  7410. footnoteOrder: [],
  7411. handlers: handlers2,
  7412. one: one3,
  7413. options: settings,
  7414. patch,
  7415. wrap
  7416. };
  7417. visit(tree, function(node2) {
  7418. if (node2.type === "definition" || node2.type === "footnoteDefinition") {
  7419. const map = node2.type === "definition" ? definitionById : footnoteById;
  7420. const id = String(node2.identifier).toUpperCase();
  7421. if (!map.has(id)) {
  7422. map.set(id, node2);
  7423. }
  7424. }
  7425. });
  7426. return state;
  7427. function one3(node2, parent) {
  7428. const type = node2.type;
  7429. const handle = state.handlers[type];
  7430. if (own3.call(state.handlers, type) && handle) {
  7431. return handle(state, node2, parent);
  7432. }
  7433. if (state.options.passThrough && state.options.passThrough.includes(type)) {
  7434. if ("children" in node2) {
  7435. const { children, ...shallow } = node2;
  7436. const result = esm_default(shallow);
  7437. result.children = state.all(node2);
  7438. return result;
  7439. }
  7440. return esm_default(node2);
  7441. }
  7442. const unknown = state.options.unknownHandler || defaultUnknownHandler;
  7443. return unknown(state, node2, parent);
  7444. }
  7445. function all2(parent) {
  7446. const values2 = [];
  7447. if ("children" in parent) {
  7448. const nodes = parent.children;
  7449. let index2 = -1;
  7450. while (++index2 < nodes.length) {
  7451. const result = state.one(nodes[index2], parent);
  7452. if (result) {
  7453. if (index2 && nodes[index2 - 1].type === "break") {
  7454. if (!Array.isArray(result) && result.type === "text") {
  7455. result.value = trimMarkdownSpaceStart(result.value);
  7456. }
  7457. if (!Array.isArray(result) && result.type === "element") {
  7458. const head = result.children[0];
  7459. if (head && head.type === "text") {
  7460. head.value = trimMarkdownSpaceStart(head.value);
  7461. }
  7462. }
  7463. }
  7464. if (Array.isArray(result)) {
  7465. values2.push(...result);
  7466. } else {
  7467. values2.push(result);
  7468. }
  7469. }
  7470. }
  7471. }
  7472. return values2;
  7473. }
  7474. }
  7475. function patch(from, to) {
  7476. if (from.position) to.position = position(from);
  7477. }
  7478. function applyData(from, to) {
  7479. let result = to;
  7480. if (from && from.data) {
  7481. const hName = from.data.hName;
  7482. const hChildren = from.data.hChildren;
  7483. const hProperties = from.data.hProperties;
  7484. if (typeof hName === "string") {
  7485. if (result.type === "element") {
  7486. result.tagName = hName;
  7487. } else {
  7488. const children = "children" in result ? result.children : [result];
  7489. result = { type: "element", tagName: hName, properties: {}, children };
  7490. }
  7491. }
  7492. if (result.type === "element" && hProperties) {
  7493. Object.assign(result.properties, esm_default(hProperties));
  7494. }
  7495. if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) {
  7496. result.children = hChildren;
  7497. }
  7498. }
  7499. return result;
  7500. }
  7501. function defaultUnknownHandler(state, node2) {
  7502. const data = node2.data || {};
  7503. const result = "value" in node2 && !(own3.call(data, "hProperties") || own3.call(data, "hChildren")) ? { type: "text", value: node2.value } : {
  7504. type: "element",
  7505. tagName: "div",
  7506. properties: {},
  7507. children: state.all(node2)
  7508. };
  7509. state.patch(node2, result);
  7510. return state.applyData(node2, result);
  7511. }
  7512. function wrap(nodes, loose) {
  7513. const result = [];
  7514. let index2 = -1;
  7515. if (loose) {
  7516. result.push({ type: "text", value: "\n" });
  7517. }
  7518. while (++index2 < nodes.length) {
  7519. if (index2) result.push({ type: "text", value: "\n" });
  7520. result.push(nodes[index2]);
  7521. }
  7522. if (loose && nodes.length > 0) {
  7523. result.push({ type: "text", value: "\n" });
  7524. }
  7525. return result;
  7526. }
  7527. function trimMarkdownSpaceStart(value) {
  7528. let index2 = 0;
  7529. let code2 = value.charCodeAt(index2);
  7530. while (code2 === 9 || code2 === 32) {
  7531. index2++;
  7532. code2 = value.charCodeAt(index2);
  7533. }
  7534. return value.slice(index2);
  7535. }
  7536. // node_modules/mdast-util-to-hast/lib/index.js
  7537. function toHast(tree, options) {
  7538. const state = createState(tree, options);
  7539. const node2 = state.one(tree, void 0);
  7540. const foot = footer(state);
  7541. const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] };
  7542. if (foot) {
  7543. ok("children" in result);
  7544. result.children.push({ type: "text", value: "\n" }, foot);
  7545. }
  7546. return result;
  7547. }
  7548. // node_modules/remark-rehype/lib/index.js
  7549. function remarkRehype(destination, options) {
  7550. if (destination && "run" in destination) {
  7551. return async function(tree, file) {
  7552. const hastTree = (
  7553. /** @type {HastRoot} */
  7554. toHast(tree, { file, ...options })
  7555. );
  7556. await destination.run(hastTree, file);
  7557. };
  7558. }
  7559. return function(tree, file) {
  7560. return (
  7561. /** @type {HastRoot} */
  7562. toHast(tree, { file, ...destination || options })
  7563. );
  7564. };
  7565. }
  7566. // node_modules/bail/index.js
  7567. function bail(error) {
  7568. if (error) {
  7569. throw error;
  7570. }
  7571. }
  7572. // node_modules/unified/lib/index.js
  7573. var import_extend = __toESM(require_extend(), 1);
  7574. // node_modules/is-plain-obj/index.js
  7575. function isPlainObject(value) {
  7576. if (typeof value !== "object" || value === null) {
  7577. return false;
  7578. }
  7579. const prototype = Object.getPrototypeOf(value);
  7580. return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
  7581. }
  7582. // node_modules/trough/lib/index.js
  7583. function trough() {
  7584. const fns = [];
  7585. const pipeline = { run, use };
  7586. return pipeline;
  7587. function run(...values2) {
  7588. let middlewareIndex = -1;
  7589. const callback = values2.pop();
  7590. if (typeof callback !== "function") {
  7591. throw new TypeError("Expected function as last argument, not " + callback);
  7592. }
  7593. next(null, ...values2);
  7594. function next(error, ...output) {
  7595. const fn = fns[++middlewareIndex];
  7596. let index2 = -1;
  7597. if (error) {
  7598. callback(error);
  7599. return;
  7600. }
  7601. while (++index2 < values2.length) {
  7602. if (output[index2] === null || output[index2] === void 0) {
  7603. output[index2] = values2[index2];
  7604. }
  7605. }
  7606. values2 = output;
  7607. if (fn) {
  7608. wrap2(fn, next)(...output);
  7609. } else {
  7610. callback(null, ...output);
  7611. }
  7612. }
  7613. }
  7614. function use(middelware) {
  7615. if (typeof middelware !== "function") {
  7616. throw new TypeError(
  7617. "Expected `middelware` to be a function, not " + middelware
  7618. );
  7619. }
  7620. fns.push(middelware);
  7621. return pipeline;
  7622. }
  7623. }
  7624. function wrap2(middleware, callback) {
  7625. let called;
  7626. return wrapped;
  7627. function wrapped(...parameters) {
  7628. const fnExpectsCallback = middleware.length > parameters.length;
  7629. let result;
  7630. if (fnExpectsCallback) {
  7631. parameters.push(done);
  7632. }
  7633. try {
  7634. result = middleware.apply(this, parameters);
  7635. } catch (error) {
  7636. const exception = (
  7637. /** @type {Error} */
  7638. error
  7639. );
  7640. if (fnExpectsCallback && called) {
  7641. throw exception;
  7642. }
  7643. return done(exception);
  7644. }
  7645. if (!fnExpectsCallback) {
  7646. if (result && result.then && typeof result.then === "function") {
  7647. result.then(then, done);
  7648. } else if (result instanceof Error) {
  7649. done(result);
  7650. } else {
  7651. then(result);
  7652. }
  7653. }
  7654. }
  7655. function done(error, ...output) {
  7656. if (!called) {
  7657. called = true;
  7658. callback(error, ...output);
  7659. }
  7660. }
  7661. function then(value) {
  7662. done(null, value);
  7663. }
  7664. }
  7665. // node_modules/vfile/lib/minpath.browser.js
  7666. var minpath = { basename, dirname, extname, join, sep: "/" };
  7667. function basename(path, extname2) {
  7668. if (extname2 !== void 0 && typeof extname2 !== "string") {
  7669. throw new TypeError('"ext" argument must be a string');
  7670. }
  7671. assertPath(path);
  7672. let start2 = 0;
  7673. let end = -1;
  7674. let index2 = path.length;
  7675. let seenNonSlash;
  7676. if (extname2 === void 0 || extname2.length === 0 || extname2.length > path.length) {
  7677. while (index2--) {
  7678. if (path.codePointAt(index2) === 47) {
  7679. if (seenNonSlash) {
  7680. start2 = index2 + 1;
  7681. break;
  7682. }
  7683. } else if (end < 0) {
  7684. seenNonSlash = true;
  7685. end = index2 + 1;
  7686. }
  7687. }
  7688. return end < 0 ? "" : path.slice(start2, end);
  7689. }
  7690. if (extname2 === path) {
  7691. return "";
  7692. }
  7693. let firstNonSlashEnd = -1;
  7694. let extnameIndex = extname2.length - 1;
  7695. while (index2--) {
  7696. if (path.codePointAt(index2) === 47) {
  7697. if (seenNonSlash) {
  7698. start2 = index2 + 1;
  7699. break;
  7700. }
  7701. } else {
  7702. if (firstNonSlashEnd < 0) {
  7703. seenNonSlash = true;
  7704. firstNonSlashEnd = index2 + 1;
  7705. }
  7706. if (extnameIndex > -1) {
  7707. if (path.codePointAt(index2) === extname2.codePointAt(extnameIndex--)) {
  7708. if (extnameIndex < 0) {
  7709. end = index2;
  7710. }
  7711. } else {
  7712. extnameIndex = -1;
  7713. end = firstNonSlashEnd;
  7714. }
  7715. }
  7716. }
  7717. }
  7718. if (start2 === end) {
  7719. end = firstNonSlashEnd;
  7720. } else if (end < 0) {
  7721. end = path.length;
  7722. }
  7723. return path.slice(start2, end);
  7724. }
  7725. function dirname(path) {
  7726. assertPath(path);
  7727. if (path.length === 0) {
  7728. return ".";
  7729. }
  7730. let end = -1;
  7731. let index2 = path.length;
  7732. let unmatchedSlash;
  7733. while (--index2) {
  7734. if (path.codePointAt(index2) === 47) {
  7735. if (unmatchedSlash) {
  7736. end = index2;
  7737. break;
  7738. }
  7739. } else if (!unmatchedSlash) {
  7740. unmatchedSlash = true;
  7741. }
  7742. }
  7743. return end < 0 ? path.codePointAt(0) === 47 ? "/" : "." : end === 1 && path.codePointAt(0) === 47 ? "//" : path.slice(0, end);
  7744. }
  7745. function extname(path) {
  7746. assertPath(path);
  7747. let index2 = path.length;
  7748. let end = -1;
  7749. let startPart = 0;
  7750. let startDot = -1;
  7751. let preDotState = 0;
  7752. let unmatchedSlash;
  7753. while (index2--) {
  7754. const code2 = path.codePointAt(index2);
  7755. if (code2 === 47) {
  7756. if (unmatchedSlash) {
  7757. startPart = index2 + 1;
  7758. break;
  7759. }
  7760. continue;
  7761. }
  7762. if (end < 0) {
  7763. unmatchedSlash = true;
  7764. end = index2 + 1;
  7765. }
  7766. if (code2 === 46) {
  7767. if (startDot < 0) {
  7768. startDot = index2;
  7769. } else if (preDotState !== 1) {
  7770. preDotState = 1;
  7771. }
  7772. } else if (startDot > -1) {
  7773. preDotState = -1;
  7774. }
  7775. }
  7776. if (startDot < 0 || end < 0 || // We saw a non-dot character immediately before the dot.
  7777. preDotState === 0 || // The (right-most) trimmed path component is exactly `..`.
  7778. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  7779. return "";
  7780. }
  7781. return path.slice(startDot, end);
  7782. }
  7783. function join(...segments) {
  7784. let index2 = -1;
  7785. let joined;
  7786. while (++index2 < segments.length) {
  7787. assertPath(segments[index2]);
  7788. if (segments[index2]) {
  7789. joined = joined === void 0 ? segments[index2] : joined + "/" + segments[index2];
  7790. }
  7791. }
  7792. return joined === void 0 ? "." : normalize(joined);
  7793. }
  7794. function normalize(path) {
  7795. assertPath(path);
  7796. const absolute = path.codePointAt(0) === 47;
  7797. let value = normalizeString(path, !absolute);
  7798. if (value.length === 0 && !absolute) {
  7799. value = ".";
  7800. }
  7801. if (value.length > 0 && path.codePointAt(path.length - 1) === 47) {
  7802. value += "/";
  7803. }
  7804. return absolute ? "/" + value : value;
  7805. }
  7806. function normalizeString(path, allowAboveRoot) {
  7807. let result = "";
  7808. let lastSegmentLength = 0;
  7809. let lastSlash = -1;
  7810. let dots = 0;
  7811. let index2 = -1;
  7812. let code2;
  7813. let lastSlashIndex;
  7814. while (++index2 <= path.length) {
  7815. if (index2 < path.length) {
  7816. code2 = path.codePointAt(index2);
  7817. } else if (code2 === 47) {
  7818. break;
  7819. } else {
  7820. code2 = 47;
  7821. }
  7822. if (code2 === 47) {
  7823. if (lastSlash === index2 - 1 || dots === 1) {
  7824. } else if (lastSlash !== index2 - 1 && dots === 2) {
  7825. if (result.length < 2 || lastSegmentLength !== 2 || result.codePointAt(result.length - 1) !== 46 || result.codePointAt(result.length - 2) !== 46) {
  7826. if (result.length > 2) {
  7827. lastSlashIndex = result.lastIndexOf("/");
  7828. if (lastSlashIndex !== result.length - 1) {
  7829. if (lastSlashIndex < 0) {
  7830. result = "";
  7831. lastSegmentLength = 0;
  7832. } else {
  7833. result = result.slice(0, lastSlashIndex);
  7834. lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
  7835. }
  7836. lastSlash = index2;
  7837. dots = 0;
  7838. continue;
  7839. }
  7840. } else if (result.length > 0) {
  7841. result = "";
  7842. lastSegmentLength = 0;
  7843. lastSlash = index2;
  7844. dots = 0;
  7845. continue;
  7846. }
  7847. }
  7848. if (allowAboveRoot) {
  7849. result = result.length > 0 ? result + "/.." : "..";
  7850. lastSegmentLength = 2;
  7851. }
  7852. } else {
  7853. if (result.length > 0) {
  7854. result += "/" + path.slice(lastSlash + 1, index2);
  7855. } else {
  7856. result = path.slice(lastSlash + 1, index2);
  7857. }
  7858. lastSegmentLength = index2 - lastSlash - 1;
  7859. }
  7860. lastSlash = index2;
  7861. dots = 0;
  7862. } else if (code2 === 46 && dots > -1) {
  7863. dots++;
  7864. } else {
  7865. dots = -1;
  7866. }
  7867. }
  7868. return result;
  7869. }
  7870. function assertPath(path) {
  7871. if (typeof path !== "string") {
  7872. throw new TypeError(
  7873. "Path must be a string. Received " + JSON.stringify(path)
  7874. );
  7875. }
  7876. }
  7877. // node_modules/vfile/lib/minproc.browser.js
  7878. var minproc = { cwd };
  7879. function cwd() {
  7880. return "/";
  7881. }
  7882. // node_modules/vfile/lib/minurl.shared.js
  7883. function isUrl(fileUrlOrPath) {
  7884. return Boolean(
  7885. fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine.
  7886. fileUrlOrPath.auth === void 0
  7887. );
  7888. }
  7889. // node_modules/vfile/lib/minurl.browser.js
  7890. function urlToPath(path) {
  7891. if (typeof path === "string") {
  7892. path = new URL(path);
  7893. } else if (!isUrl(path)) {
  7894. const error = new TypeError(
  7895. 'The "path" argument must be of type string or an instance of URL. Received `' + path + "`"
  7896. );
  7897. error.code = "ERR_INVALID_ARG_TYPE";
  7898. throw error;
  7899. }
  7900. if (path.protocol !== "file:") {
  7901. const error = new TypeError("The URL must be of scheme file");
  7902. error.code = "ERR_INVALID_URL_SCHEME";
  7903. throw error;
  7904. }
  7905. return getPathFromURLPosix(path);
  7906. }
  7907. function getPathFromURLPosix(url) {
  7908. if (url.hostname !== "") {
  7909. const error = new TypeError(
  7910. 'File URL host must be "localhost" or empty on darwin'
  7911. );
  7912. error.code = "ERR_INVALID_FILE_URL_HOST";
  7913. throw error;
  7914. }
  7915. const pathname = url.pathname;
  7916. let index2 = -1;
  7917. while (++index2 < pathname.length) {
  7918. if (pathname.codePointAt(index2) === 37 && pathname.codePointAt(index2 + 1) === 50) {
  7919. const third = pathname.codePointAt(index2 + 2);
  7920. if (third === 70 || third === 102) {
  7921. const error = new TypeError(
  7922. "File URL path must not include encoded / characters"
  7923. );
  7924. error.code = "ERR_INVALID_FILE_URL_PATH";
  7925. throw error;
  7926. }
  7927. }
  7928. }
  7929. return decodeURIComponent(pathname);
  7930. }
  7931. // node_modules/vfile/lib/index.js
  7932. var order = (
  7933. /** @type {const} */
  7934. [
  7935. "history",
  7936. "path",
  7937. "basename",
  7938. "stem",
  7939. "extname",
  7940. "dirname"
  7941. ]
  7942. );
  7943. var VFile = class {
  7944. /**
  7945. * Create a new virtual file.
  7946. *
  7947. * `options` is treated as:
  7948. *
  7949. * * `string` or `Uint8Array` — `{value: options}`
  7950. * * `URL` — `{path: options}`
  7951. * * `VFile` — shallow copies its data over to the new file
  7952. * * `object` — all fields are shallow copied over to the new file
  7953. *
  7954. * Path related fields are set in the following order (least specific to
  7955. * most specific): `history`, `path`, `basename`, `stem`, `extname`,
  7956. * `dirname`.
  7957. *
  7958. * You cannot set `dirname` or `extname` without setting either `history`,
  7959. * `path`, `basename`, or `stem` too.
  7960. *
  7961. * @param {Compatible | null | undefined} [value]
  7962. * File value.
  7963. * @returns
  7964. * New instance.
  7965. */
  7966. constructor(value) {
  7967. let options;
  7968. if (!value) {
  7969. options = {};
  7970. } else if (isUrl(value)) {
  7971. options = { path: value };
  7972. } else if (typeof value === "string" || isUint8Array(value)) {
  7973. options = { value };
  7974. } else {
  7975. options = value;
  7976. }
  7977. this.cwd = "cwd" in options ? "" : minproc.cwd();
  7978. this.data = {};
  7979. this.history = [];
  7980. this.messages = [];
  7981. this.value;
  7982. this.map;
  7983. this.result;
  7984. this.stored;
  7985. let index2 = -1;
  7986. while (++index2 < order.length) {
  7987. const field2 = order[index2];
  7988. if (field2 in options && options[field2] !== void 0 && options[field2] !== null) {
  7989. this[field2] = field2 === "history" ? [...options[field2]] : options[field2];
  7990. }
  7991. }
  7992. let field;
  7993. for (field in options) {
  7994. if (!order.includes(field)) {
  7995. this[field] = options[field];
  7996. }
  7997. }
  7998. }
  7999. /**
  8000. * Get the basename (including extname) (example: `'index.min.js'`).
  8001. *
  8002. * @returns {string | undefined}
  8003. * Basename.
  8004. */
  8005. get basename() {
  8006. return typeof this.path === "string" ? minpath.basename(this.path) : void 0;
  8007. }
  8008. /**
  8009. * Set basename (including extname) (`'index.min.js'`).
  8010. *
  8011. * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
  8012. * on windows).
  8013. * Cannot be nullified (use `file.path = file.dirname` instead).
  8014. *
  8015. * @param {string} basename
  8016. * Basename.
  8017. * @returns {undefined}
  8018. * Nothing.
  8019. */
  8020. set basename(basename2) {
  8021. assertNonEmpty(basename2, "basename");
  8022. assertPart(basename2, "basename");
  8023. this.path = minpath.join(this.dirname || "", basename2);
  8024. }
  8025. /**
  8026. * Get the parent path (example: `'~'`).
  8027. *
  8028. * @returns {string | undefined}
  8029. * Dirname.
  8030. */
  8031. get dirname() {
  8032. return typeof this.path === "string" ? minpath.dirname(this.path) : void 0;
  8033. }
  8034. /**
  8035. * Set the parent path (example: `'~'`).
  8036. *
  8037. * Cannot be set if there’s no `path` yet.
  8038. *
  8039. * @param {string | undefined} dirname
  8040. * Dirname.
  8041. * @returns {undefined}
  8042. * Nothing.
  8043. */
  8044. set dirname(dirname2) {
  8045. assertPath2(this.basename, "dirname");
  8046. this.path = minpath.join(dirname2 || "", this.basename);
  8047. }
  8048. /**
  8049. * Get the extname (including dot) (example: `'.js'`).
  8050. *
  8051. * @returns {string | undefined}
  8052. * Extname.
  8053. */
  8054. get extname() {
  8055. return typeof this.path === "string" ? minpath.extname(this.path) : void 0;
  8056. }
  8057. /**
  8058. * Set the extname (including dot) (example: `'.js'`).
  8059. *
  8060. * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
  8061. * on windows).
  8062. * Cannot be set if there’s no `path` yet.
  8063. *
  8064. * @param {string | undefined} extname
  8065. * Extname.
  8066. * @returns {undefined}
  8067. * Nothing.
  8068. */
  8069. set extname(extname2) {
  8070. assertPart(extname2, "extname");
  8071. assertPath2(this.dirname, "extname");
  8072. if (extname2) {
  8073. if (extname2.codePointAt(0) !== 46) {
  8074. throw new Error("`extname` must start with `.`");
  8075. }
  8076. if (extname2.includes(".", 1)) {
  8077. throw new Error("`extname` cannot contain multiple dots");
  8078. }
  8079. }
  8080. this.path = minpath.join(this.dirname, this.stem + (extname2 || ""));
  8081. }
  8082. /**
  8083. * Get the full path (example: `'~/index.min.js'`).
  8084. *
  8085. * @returns {string}
  8086. * Path.
  8087. */
  8088. get path() {
  8089. return this.history[this.history.length - 1];
  8090. }
  8091. /**
  8092. * Set the full path (example: `'~/index.min.js'`).
  8093. *
  8094. * Cannot be nullified.
  8095. * You can set a file URL (a `URL` object with a `file:` protocol) which will
  8096. * be turned into a path with `url.fileURLToPath`.
  8097. *
  8098. * @param {URL | string} path
  8099. * Path.
  8100. * @returns {undefined}
  8101. * Nothing.
  8102. */
  8103. set path(path) {
  8104. if (isUrl(path)) {
  8105. path = urlToPath(path);
  8106. }
  8107. assertNonEmpty(path, "path");
  8108. if (this.path !== path) {
  8109. this.history.push(path);
  8110. }
  8111. }
  8112. /**
  8113. * Get the stem (basename w/o extname) (example: `'index.min'`).
  8114. *
  8115. * @returns {string | undefined}
  8116. * Stem.
  8117. */
  8118. get stem() {
  8119. return typeof this.path === "string" ? minpath.basename(this.path, this.extname) : void 0;
  8120. }
  8121. /**
  8122. * Set the stem (basename w/o extname) (example: `'index.min'`).
  8123. *
  8124. * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
  8125. * on windows).
  8126. * Cannot be nullified (use `file.path = file.dirname` instead).
  8127. *
  8128. * @param {string} stem
  8129. * Stem.
  8130. * @returns {undefined}
  8131. * Nothing.
  8132. */
  8133. set stem(stem) {
  8134. assertNonEmpty(stem, "stem");
  8135. assertPart(stem, "stem");
  8136. this.path = minpath.join(this.dirname || "", stem + (this.extname || ""));
  8137. }
  8138. // Normal prototypal methods.
  8139. /**
  8140. * Create a fatal message for `reason` associated with the file.
  8141. *
  8142. * The `fatal` field of the message is set to `true` (error; file not usable)
  8143. * and the `file` field is set to the current file path.
  8144. * The message is added to the `messages` field on `file`.
  8145. *
  8146. * > 🪦 **Note**: also has obsolete signatures.
  8147. *
  8148. * @overload
  8149. * @param {string} reason
  8150. * @param {MessageOptions | null | undefined} [options]
  8151. * @returns {never}
  8152. *
  8153. * @overload
  8154. * @param {string} reason
  8155. * @param {Node | NodeLike | null | undefined} parent
  8156. * @param {string | null | undefined} [origin]
  8157. * @returns {never}
  8158. *
  8159. * @overload
  8160. * @param {string} reason
  8161. * @param {Point | Position | null | undefined} place
  8162. * @param {string | null | undefined} [origin]
  8163. * @returns {never}
  8164. *
  8165. * @overload
  8166. * @param {string} reason
  8167. * @param {string | null | undefined} [origin]
  8168. * @returns {never}
  8169. *
  8170. * @overload
  8171. * @param {Error | VFileMessage} cause
  8172. * @param {Node | NodeLike | null | undefined} parent
  8173. * @param {string | null | undefined} [origin]
  8174. * @returns {never}
  8175. *
  8176. * @overload
  8177. * @param {Error | VFileMessage} cause
  8178. * @param {Point | Position | null | undefined} place
  8179. * @param {string | null | undefined} [origin]
  8180. * @returns {never}
  8181. *
  8182. * @overload
  8183. * @param {Error | VFileMessage} cause
  8184. * @param {string | null | undefined} [origin]
  8185. * @returns {never}
  8186. *
  8187. * @param {Error | VFileMessage | string} causeOrReason
  8188. * Reason for message, should use markdown.
  8189. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  8190. * Configuration (optional).
  8191. * @param {string | null | undefined} [origin]
  8192. * Place in code where the message originates (example:
  8193. * `'my-package:my-rule'` or `'my-rule'`).
  8194. * @returns {never}
  8195. * Never.
  8196. * @throws {VFileMessage}
  8197. * Message.
  8198. */
  8199. fail(causeOrReason, optionsOrParentOrPlace, origin) {
  8200. const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
  8201. message.fatal = true;
  8202. throw message;
  8203. }
  8204. /**
  8205. * Create an info message for `reason` associated with the file.
  8206. *
  8207. * The `fatal` field of the message is set to `undefined` (info; change
  8208. * likely not needed) and the `file` field is set to the current file path.
  8209. * The message is added to the `messages` field on `file`.
  8210. *
  8211. * > 🪦 **Note**: also has obsolete signatures.
  8212. *
  8213. * @overload
  8214. * @param {string} reason
  8215. * @param {MessageOptions | null | undefined} [options]
  8216. * @returns {VFileMessage}
  8217. *
  8218. * @overload
  8219. * @param {string} reason
  8220. * @param {Node | NodeLike | null | undefined} parent
  8221. * @param {string | null | undefined} [origin]
  8222. * @returns {VFileMessage}
  8223. *
  8224. * @overload
  8225. * @param {string} reason
  8226. * @param {Point | Position | null | undefined} place
  8227. * @param {string | null | undefined} [origin]
  8228. * @returns {VFileMessage}
  8229. *
  8230. * @overload
  8231. * @param {string} reason
  8232. * @param {string | null | undefined} [origin]
  8233. * @returns {VFileMessage}
  8234. *
  8235. * @overload
  8236. * @param {Error | VFileMessage} cause
  8237. * @param {Node | NodeLike | null | undefined} parent
  8238. * @param {string | null | undefined} [origin]
  8239. * @returns {VFileMessage}
  8240. *
  8241. * @overload
  8242. * @param {Error | VFileMessage} cause
  8243. * @param {Point | Position | null | undefined} place
  8244. * @param {string | null | undefined} [origin]
  8245. * @returns {VFileMessage}
  8246. *
  8247. * @overload
  8248. * @param {Error | VFileMessage} cause
  8249. * @param {string | null | undefined} [origin]
  8250. * @returns {VFileMessage}
  8251. *
  8252. * @param {Error | VFileMessage | string} causeOrReason
  8253. * Reason for message, should use markdown.
  8254. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  8255. * Configuration (optional).
  8256. * @param {string | null | undefined} [origin]
  8257. * Place in code where the message originates (example:
  8258. * `'my-package:my-rule'` or `'my-rule'`).
  8259. * @returns {VFileMessage}
  8260. * Message.
  8261. */
  8262. info(causeOrReason, optionsOrParentOrPlace, origin) {
  8263. const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
  8264. message.fatal = void 0;
  8265. return message;
  8266. }
  8267. /**
  8268. * Create a message for `reason` associated with the file.
  8269. *
  8270. * The `fatal` field of the message is set to `false` (warning; change may be
  8271. * needed) and the `file` field is set to the current file path.
  8272. * The message is added to the `messages` field on `file`.
  8273. *
  8274. * > 🪦 **Note**: also has obsolete signatures.
  8275. *
  8276. * @overload
  8277. * @param {string} reason
  8278. * @param {MessageOptions | null | undefined} [options]
  8279. * @returns {VFileMessage}
  8280. *
  8281. * @overload
  8282. * @param {string} reason
  8283. * @param {Node | NodeLike | null | undefined} parent
  8284. * @param {string | null | undefined} [origin]
  8285. * @returns {VFileMessage}
  8286. *
  8287. * @overload
  8288. * @param {string} reason
  8289. * @param {Point | Position | null | undefined} place
  8290. * @param {string | null | undefined} [origin]
  8291. * @returns {VFileMessage}
  8292. *
  8293. * @overload
  8294. * @param {string} reason
  8295. * @param {string | null | undefined} [origin]
  8296. * @returns {VFileMessage}
  8297. *
  8298. * @overload
  8299. * @param {Error | VFileMessage} cause
  8300. * @param {Node | NodeLike | null | undefined} parent
  8301. * @param {string | null | undefined} [origin]
  8302. * @returns {VFileMessage}
  8303. *
  8304. * @overload
  8305. * @param {Error | VFileMessage} cause
  8306. * @param {Point | Position | null | undefined} place
  8307. * @param {string | null | undefined} [origin]
  8308. * @returns {VFileMessage}
  8309. *
  8310. * @overload
  8311. * @param {Error | VFileMessage} cause
  8312. * @param {string | null | undefined} [origin]
  8313. * @returns {VFileMessage}
  8314. *
  8315. * @param {Error | VFileMessage | string} causeOrReason
  8316. * Reason for message, should use markdown.
  8317. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  8318. * Configuration (optional).
  8319. * @param {string | null | undefined} [origin]
  8320. * Place in code where the message originates (example:
  8321. * `'my-package:my-rule'` or `'my-rule'`).
  8322. * @returns {VFileMessage}
  8323. * Message.
  8324. */
  8325. message(causeOrReason, optionsOrParentOrPlace, origin) {
  8326. const message = new VFileMessage(
  8327. // @ts-expect-error: the overloads are fine.
  8328. causeOrReason,
  8329. optionsOrParentOrPlace,
  8330. origin
  8331. );
  8332. if (this.path) {
  8333. message.name = this.path + ":" + message.name;
  8334. message.file = this.path;
  8335. }
  8336. message.fatal = false;
  8337. this.messages.push(message);
  8338. return message;
  8339. }
  8340. /**
  8341. * Serialize the file.
  8342. *
  8343. * > **Note**: which encodings are supported depends on the engine.
  8344. * > For info on Node.js, see:
  8345. * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
  8346. *
  8347. * @param {string | null | undefined} [encoding='utf8']
  8348. * Character encoding to understand `value` as when it’s a `Uint8Array`
  8349. * (default: `'utf-8'`).
  8350. * @returns {string}
  8351. * Serialized file.
  8352. */
  8353. toString(encoding) {
  8354. if (this.value === void 0) {
  8355. return "";
  8356. }
  8357. if (typeof this.value === "string") {
  8358. return this.value;
  8359. }
  8360. const decoder = new TextDecoder(encoding || void 0);
  8361. return decoder.decode(this.value);
  8362. }
  8363. };
  8364. function assertPart(part, name2) {
  8365. if (part && part.includes(minpath.sep)) {
  8366. throw new Error(
  8367. "`" + name2 + "` cannot be a path: did not expect `" + minpath.sep + "`"
  8368. );
  8369. }
  8370. }
  8371. function assertNonEmpty(part, name2) {
  8372. if (!part) {
  8373. throw new Error("`" + name2 + "` cannot be empty");
  8374. }
  8375. }
  8376. function assertPath2(path, name2) {
  8377. if (!path) {
  8378. throw new Error("Setting `" + name2 + "` requires `path` to be set too");
  8379. }
  8380. }
  8381. function isUint8Array(value) {
  8382. return Boolean(
  8383. value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
  8384. );
  8385. }
  8386. // node_modules/unified/lib/callable-instance.js
  8387. var CallableInstance = (
  8388. /**
  8389. * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
  8390. */
  8391. /** @type {unknown} */
  8392. /**
  8393. * @this {Function}
  8394. * @param {string | symbol} property
  8395. * @returns {(...parameters: Array<unknown>) => unknown}
  8396. */
  8397. (function(property) {
  8398. const self2 = this;
  8399. const constr = self2.constructor;
  8400. const proto = (
  8401. /** @type {Record<string | symbol, Function>} */
  8402. // Prototypes do exist.
  8403. // type-coverage:ignore-next-line
  8404. constr.prototype
  8405. );
  8406. const value = proto[property];
  8407. const apply = function() {
  8408. return value.apply(apply, arguments);
  8409. };
  8410. Object.setPrototypeOf(apply, proto);
  8411. return apply;
  8412. })
  8413. );
  8414. // node_modules/unified/lib/index.js
  8415. var own4 = {}.hasOwnProperty;
  8416. var Processor = class _Processor extends CallableInstance {
  8417. /**
  8418. * Create a processor.
  8419. */
  8420. constructor() {
  8421. super("copy");
  8422. this.Compiler = void 0;
  8423. this.Parser = void 0;
  8424. this.attachers = [];
  8425. this.compiler = void 0;
  8426. this.freezeIndex = -1;
  8427. this.frozen = void 0;
  8428. this.namespace = {};
  8429. this.parser = void 0;
  8430. this.transformers = trough();
  8431. }
  8432. /**
  8433. * Copy a processor.
  8434. *
  8435. * @deprecated
  8436. * This is a private internal method and should not be used.
  8437. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8438. * New *unfrozen* processor ({@linkcode Processor}) that is
  8439. * configured to work the same as its ancestor.
  8440. * When the descendant processor is configured in the future it does not
  8441. * affect the ancestral processor.
  8442. */
  8443. copy() {
  8444. const destination = (
  8445. /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */
  8446. new _Processor()
  8447. );
  8448. let index2 = -1;
  8449. while (++index2 < this.attachers.length) {
  8450. const attacher = this.attachers[index2];
  8451. destination.use(...attacher);
  8452. }
  8453. destination.data((0, import_extend.default)(true, {}, this.namespace));
  8454. return destination;
  8455. }
  8456. /**
  8457. * Configure the processor with info available to all plugins.
  8458. * Information is stored in an object.
  8459. *
  8460. * Typically, options can be given to a specific plugin, but sometimes it
  8461. * makes sense to have information shared with several plugins.
  8462. * For example, a list of HTML elements that are self-closing, which is
  8463. * needed during all phases.
  8464. *
  8465. * > **Note**: setting information cannot occur on *frozen* processors.
  8466. * > Call the processor first to create a new unfrozen processor.
  8467. *
  8468. * > **Note**: to register custom data in TypeScript, augment the
  8469. * > {@linkcode Data} interface.
  8470. *
  8471. * @example
  8472. * This example show how to get and set info:
  8473. *
  8474. * ```js
  8475. * import {unified} from 'unified'
  8476. *
  8477. * const processor = unified().data('alpha', 'bravo')
  8478. *
  8479. * processor.data('alpha') // => 'bravo'
  8480. *
  8481. * processor.data() // => {alpha: 'bravo'}
  8482. *
  8483. * processor.data({charlie: 'delta'})
  8484. *
  8485. * processor.data() // => {charlie: 'delta'}
  8486. * ```
  8487. *
  8488. * @template {keyof Data} Key
  8489. *
  8490. * @overload
  8491. * @returns {Data}
  8492. *
  8493. * @overload
  8494. * @param {Data} dataset
  8495. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8496. *
  8497. * @overload
  8498. * @param {Key} key
  8499. * @returns {Data[Key]}
  8500. *
  8501. * @overload
  8502. * @param {Key} key
  8503. * @param {Data[Key]} value
  8504. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8505. *
  8506. * @param {Data | Key} [key]
  8507. * Key to get or set, or entire dataset to set, or nothing to get the
  8508. * entire dataset (optional).
  8509. * @param {Data[Key]} [value]
  8510. * Value to set (optional).
  8511. * @returns {unknown}
  8512. * The current processor when setting, the value at `key` when getting, or
  8513. * the entire dataset when getting without key.
  8514. */
  8515. data(key, value) {
  8516. if (typeof key === "string") {
  8517. if (arguments.length === 2) {
  8518. assertUnfrozen("data", this.frozen);
  8519. this.namespace[key] = value;
  8520. return this;
  8521. }
  8522. return own4.call(this.namespace, key) && this.namespace[key] || void 0;
  8523. }
  8524. if (key) {
  8525. assertUnfrozen("data", this.frozen);
  8526. this.namespace = key;
  8527. return this;
  8528. }
  8529. return this.namespace;
  8530. }
  8531. /**
  8532. * Freeze a processor.
  8533. *
  8534. * Frozen processors are meant to be extended and not to be configured
  8535. * directly.
  8536. *
  8537. * When a processor is frozen it cannot be unfrozen.
  8538. * New processors working the same way can be created by calling the
  8539. * processor.
  8540. *
  8541. * It’s possible to freeze processors explicitly by calling `.freeze()`.
  8542. * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
  8543. * `.stringify()`, `.process()`, or `.processSync()` are called.
  8544. *
  8545. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8546. * The current processor.
  8547. */
  8548. freeze() {
  8549. if (this.frozen) {
  8550. return this;
  8551. }
  8552. const self2 = (
  8553. /** @type {Processor} */
  8554. /** @type {unknown} */
  8555. this
  8556. );
  8557. while (++this.freezeIndex < this.attachers.length) {
  8558. const [attacher, ...options] = this.attachers[this.freezeIndex];
  8559. if (options[0] === false) {
  8560. continue;
  8561. }
  8562. if (options[0] === true) {
  8563. options[0] = void 0;
  8564. }
  8565. const transformer = attacher.call(self2, ...options);
  8566. if (typeof transformer === "function") {
  8567. this.transformers.use(transformer);
  8568. }
  8569. }
  8570. this.frozen = true;
  8571. this.freezeIndex = Number.POSITIVE_INFINITY;
  8572. return this;
  8573. }
  8574. /**
  8575. * Parse text to a syntax tree.
  8576. *
  8577. * > **Note**: `parse` freezes the processor if not already *frozen*.
  8578. *
  8579. * > **Note**: `parse` performs the parse phase, not the run phase or other
  8580. * > phases.
  8581. *
  8582. * @param {Compatible | undefined} [file]
  8583. * file to parse (optional); typically `string` or `VFile`; any value
  8584. * accepted as `x` in `new VFile(x)`.
  8585. * @returns {ParseTree extends undefined ? Node : ParseTree}
  8586. * Syntax tree representing `file`.
  8587. */
  8588. parse(file) {
  8589. this.freeze();
  8590. const realFile = vfile(file);
  8591. const parser = this.parser || this.Parser;
  8592. assertParser("parse", parser);
  8593. return parser(String(realFile), realFile);
  8594. }
  8595. /**
  8596. * Process the given file as configured on the processor.
  8597. *
  8598. * > **Note**: `process` freezes the processor if not already *frozen*.
  8599. *
  8600. * > **Note**: `process` performs the parse, run, and stringify phases.
  8601. *
  8602. * @overload
  8603. * @param {Compatible | undefined} file
  8604. * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
  8605. * @returns {undefined}
  8606. *
  8607. * @overload
  8608. * @param {Compatible | undefined} [file]
  8609. * @returns {Promise<VFileWithOutput<CompileResult>>}
  8610. *
  8611. * @param {Compatible | undefined} [file]
  8612. * File (optional); typically `string` or `VFile`]; any value accepted as
  8613. * `x` in `new VFile(x)`.
  8614. * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
  8615. * Callback (optional).
  8616. * @returns {Promise<VFile> | undefined}
  8617. * Nothing if `done` is given.
  8618. * Otherwise a promise, rejected with a fatal error or resolved with the
  8619. * processed file.
  8620. *
  8621. * The parsed, transformed, and compiled value is available at
  8622. * `file.value` (see note).
  8623. *
  8624. * > **Note**: unified typically compiles by serializing: most
  8625. * > compilers return `string` (or `Uint8Array`).
  8626. * > Some compilers, such as the one configured with
  8627. * > [`rehype-react`][rehype-react], return other values (in this case, a
  8628. * > React tree).
  8629. * > If you’re using a compiler that doesn’t serialize, expect different
  8630. * > result values.
  8631. * >
  8632. * > To register custom results in TypeScript, add them to
  8633. * > {@linkcode CompileResultMap}.
  8634. *
  8635. * [rehype-react]: https://github.com/rehypejs/rehype-react
  8636. */
  8637. process(file, done) {
  8638. const self2 = this;
  8639. this.freeze();
  8640. assertParser("process", this.parser || this.Parser);
  8641. assertCompiler("process", this.compiler || this.Compiler);
  8642. return done ? executor(void 0, done) : new Promise(executor);
  8643. function executor(resolve, reject) {
  8644. const realFile = vfile(file);
  8645. const parseTree = (
  8646. /** @type {HeadTree extends undefined ? Node : HeadTree} */
  8647. /** @type {unknown} */
  8648. self2.parse(realFile)
  8649. );
  8650. self2.run(parseTree, realFile, function(error, tree, file2) {
  8651. if (error || !tree || !file2) {
  8652. return realDone(error);
  8653. }
  8654. const compileTree = (
  8655. /** @type {CompileTree extends undefined ? Node : CompileTree} */
  8656. /** @type {unknown} */
  8657. tree
  8658. );
  8659. const compileResult = self2.stringify(compileTree, file2);
  8660. if (looksLikeAValue(compileResult)) {
  8661. file2.value = compileResult;
  8662. } else {
  8663. file2.result = compileResult;
  8664. }
  8665. realDone(
  8666. error,
  8667. /** @type {VFileWithOutput<CompileResult>} */
  8668. file2
  8669. );
  8670. });
  8671. function realDone(error, file2) {
  8672. if (error || !file2) {
  8673. reject(error);
  8674. } else if (resolve) {
  8675. resolve(file2);
  8676. } else {
  8677. ok(done, "`done` is defined if `resolve` is not");
  8678. done(void 0, file2);
  8679. }
  8680. }
  8681. }
  8682. }
  8683. /**
  8684. * Process the given file as configured on the processor.
  8685. *
  8686. * An error is thrown if asynchronous transforms are configured.
  8687. *
  8688. * > **Note**: `processSync` freezes the processor if not already *frozen*.
  8689. *
  8690. * > **Note**: `processSync` performs the parse, run, and stringify phases.
  8691. *
  8692. * @param {Compatible | undefined} [file]
  8693. * File (optional); typically `string` or `VFile`; any value accepted as
  8694. * `x` in `new VFile(x)`.
  8695. * @returns {VFileWithOutput<CompileResult>}
  8696. * The processed file.
  8697. *
  8698. * The parsed, transformed, and compiled value is available at
  8699. * `file.value` (see note).
  8700. *
  8701. * > **Note**: unified typically compiles by serializing: most
  8702. * > compilers return `string` (or `Uint8Array`).
  8703. * > Some compilers, such as the one configured with
  8704. * > [`rehype-react`][rehype-react], return other values (in this case, a
  8705. * > React tree).
  8706. * > If you’re using a compiler that doesn’t serialize, expect different
  8707. * > result values.
  8708. * >
  8709. * > To register custom results in TypeScript, add them to
  8710. * > {@linkcode CompileResultMap}.
  8711. *
  8712. * [rehype-react]: https://github.com/rehypejs/rehype-react
  8713. */
  8714. processSync(file) {
  8715. let complete = false;
  8716. let result;
  8717. this.freeze();
  8718. assertParser("processSync", this.parser || this.Parser);
  8719. assertCompiler("processSync", this.compiler || this.Compiler);
  8720. this.process(file, realDone);
  8721. assertDone("processSync", "process", complete);
  8722. ok(result, "we either bailed on an error or have a tree");
  8723. return result;
  8724. function realDone(error, file2) {
  8725. complete = true;
  8726. bail(error);
  8727. result = file2;
  8728. }
  8729. }
  8730. /**
  8731. * Run *transformers* on a syntax tree.
  8732. *
  8733. * > **Note**: `run` freezes the processor if not already *frozen*.
  8734. *
  8735. * > **Note**: `run` performs the run phase, not other phases.
  8736. *
  8737. * @overload
  8738. * @param {HeadTree extends undefined ? Node : HeadTree} tree
  8739. * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
  8740. * @returns {undefined}
  8741. *
  8742. * @overload
  8743. * @param {HeadTree extends undefined ? Node : HeadTree} tree
  8744. * @param {Compatible | undefined} file
  8745. * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
  8746. * @returns {undefined}
  8747. *
  8748. * @overload
  8749. * @param {HeadTree extends undefined ? Node : HeadTree} tree
  8750. * @param {Compatible | undefined} [file]
  8751. * @returns {Promise<TailTree extends undefined ? Node : TailTree>}
  8752. *
  8753. * @param {HeadTree extends undefined ? Node : HeadTree} tree
  8754. * Tree to transform and inspect.
  8755. * @param {(
  8756. * RunCallback<TailTree extends undefined ? Node : TailTree> |
  8757. * Compatible
  8758. * )} [file]
  8759. * File associated with `node` (optional); any value accepted as `x` in
  8760. * `new VFile(x)`.
  8761. * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
  8762. * Callback (optional).
  8763. * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
  8764. * Nothing if `done` is given.
  8765. * Otherwise, a promise rejected with a fatal error or resolved with the
  8766. * transformed tree.
  8767. */
  8768. run(tree, file, done) {
  8769. assertNode(tree);
  8770. this.freeze();
  8771. const transformers = this.transformers;
  8772. if (!done && typeof file === "function") {
  8773. done = file;
  8774. file = void 0;
  8775. }
  8776. return done ? executor(void 0, done) : new Promise(executor);
  8777. function executor(resolve, reject) {
  8778. ok(
  8779. typeof file !== "function",
  8780. "`file` can’t be a `done` anymore, we checked"
  8781. );
  8782. const realFile = vfile(file);
  8783. transformers.run(tree, realFile, realDone);
  8784. function realDone(error, outputTree, file2) {
  8785. const resultingTree = (
  8786. /** @type {TailTree extends undefined ? Node : TailTree} */
  8787. outputTree || tree
  8788. );
  8789. if (error) {
  8790. reject(error);
  8791. } else if (resolve) {
  8792. resolve(resultingTree);
  8793. } else {
  8794. ok(done, "`done` is defined if `resolve` is not");
  8795. done(void 0, resultingTree, file2);
  8796. }
  8797. }
  8798. }
  8799. }
  8800. /**
  8801. * Run *transformers* on a syntax tree.
  8802. *
  8803. * An error is thrown if asynchronous transforms are configured.
  8804. *
  8805. * > **Note**: `runSync` freezes the processor if not already *frozen*.
  8806. *
  8807. * > **Note**: `runSync` performs the run phase, not other phases.
  8808. *
  8809. * @param {HeadTree extends undefined ? Node : HeadTree} tree
  8810. * Tree to transform and inspect.
  8811. * @param {Compatible | undefined} [file]
  8812. * File associated with `node` (optional); any value accepted as `x` in
  8813. * `new VFile(x)`.
  8814. * @returns {TailTree extends undefined ? Node : TailTree}
  8815. * Transformed tree.
  8816. */
  8817. runSync(tree, file) {
  8818. let complete = false;
  8819. let result;
  8820. this.run(tree, file, realDone);
  8821. assertDone("runSync", "run", complete);
  8822. ok(result, "we either bailed on an error or have a tree");
  8823. return result;
  8824. function realDone(error, tree2) {
  8825. bail(error);
  8826. result = tree2;
  8827. complete = true;
  8828. }
  8829. }
  8830. /**
  8831. * Compile a syntax tree.
  8832. *
  8833. * > **Note**: `stringify` freezes the processor if not already *frozen*.
  8834. *
  8835. * > **Note**: `stringify` performs the stringify phase, not the run phase
  8836. * > or other phases.
  8837. *
  8838. * @param {CompileTree extends undefined ? Node : CompileTree} tree
  8839. * Tree to compile.
  8840. * @param {Compatible | undefined} [file]
  8841. * File associated with `node` (optional); any value accepted as `x` in
  8842. * `new VFile(x)`.
  8843. * @returns {CompileResult extends undefined ? Value : CompileResult}
  8844. * Textual representation of the tree (see note).
  8845. *
  8846. * > **Note**: unified typically compiles by serializing: most compilers
  8847. * > return `string` (or `Uint8Array`).
  8848. * > Some compilers, such as the one configured with
  8849. * > [`rehype-react`][rehype-react], return other values (in this case, a
  8850. * > React tree).
  8851. * > If you’re using a compiler that doesn’t serialize, expect different
  8852. * > result values.
  8853. * >
  8854. * > To register custom results in TypeScript, add them to
  8855. * > {@linkcode CompileResultMap}.
  8856. *
  8857. * [rehype-react]: https://github.com/rehypejs/rehype-react
  8858. */
  8859. stringify(tree, file) {
  8860. this.freeze();
  8861. const realFile = vfile(file);
  8862. const compiler2 = this.compiler || this.Compiler;
  8863. assertCompiler("stringify", compiler2);
  8864. assertNode(tree);
  8865. return compiler2(tree, realFile);
  8866. }
  8867. /**
  8868. * Configure the processor to use a plugin, a list of usable values, or a
  8869. * preset.
  8870. *
  8871. * If the processor is already using a plugin, the previous plugin
  8872. * configuration is changed based on the options that are passed in.
  8873. * In other words, the plugin is not added a second time.
  8874. *
  8875. * > **Note**: `use` cannot be called on *frozen* processors.
  8876. * > Call the processor first to create a new unfrozen processor.
  8877. *
  8878. * @example
  8879. * There are many ways to pass plugins to `.use()`.
  8880. * This example gives an overview:
  8881. *
  8882. * ```js
  8883. * import {unified} from 'unified'
  8884. *
  8885. * unified()
  8886. * // Plugin with options:
  8887. * .use(pluginA, {x: true, y: true})
  8888. * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  8889. * .use(pluginA, {y: false, z: true})
  8890. * // Plugins:
  8891. * .use([pluginB, pluginC])
  8892. * // Two plugins, the second with options:
  8893. * .use([pluginD, [pluginE, {}]])
  8894. * // Preset with plugins and settings:
  8895. * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  8896. * // Settings only:
  8897. * .use({settings: {position: false}})
  8898. * ```
  8899. *
  8900. * @template {Array<unknown>} [Parameters=[]]
  8901. * @template {Node | string | undefined} [Input=undefined]
  8902. * @template [Output=Input]
  8903. *
  8904. * @overload
  8905. * @param {Preset | null | undefined} [preset]
  8906. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8907. *
  8908. * @overload
  8909. * @param {PluggableList} list
  8910. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8911. *
  8912. * @overload
  8913. * @param {Plugin<Parameters, Input, Output>} plugin
  8914. * @param {...(Parameters | [boolean])} parameters
  8915. * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
  8916. *
  8917. * @param {PluggableList | Plugin | Preset | null | undefined} value
  8918. * Usable value.
  8919. * @param {...unknown} parameters
  8920. * Parameters, when a plugin is given as a usable value.
  8921. * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
  8922. * Current processor.
  8923. */
  8924. use(value, ...parameters) {
  8925. const attachers = this.attachers;
  8926. const namespace = this.namespace;
  8927. assertUnfrozen("use", this.frozen);
  8928. if (value === null || value === void 0) {
  8929. } else if (typeof value === "function") {
  8930. addPlugin(value, parameters);
  8931. } else if (typeof value === "object") {
  8932. if (Array.isArray(value)) {
  8933. addList(value);
  8934. } else {
  8935. addPreset(value);
  8936. }
  8937. } else {
  8938. throw new TypeError("Expected usable value, not `" + value + "`");
  8939. }
  8940. return this;
  8941. function add(value2) {
  8942. if (typeof value2 === "function") {
  8943. addPlugin(value2, []);
  8944. } else if (typeof value2 === "object") {
  8945. if (Array.isArray(value2)) {
  8946. const [plugin, ...parameters2] = (
  8947. /** @type {PluginTuple<Array<unknown>>} */
  8948. value2
  8949. );
  8950. addPlugin(plugin, parameters2);
  8951. } else {
  8952. addPreset(value2);
  8953. }
  8954. } else {
  8955. throw new TypeError("Expected usable value, not `" + value2 + "`");
  8956. }
  8957. }
  8958. function addPreset(result) {
  8959. if (!("plugins" in result) && !("settings" in result)) {
  8960. throw new Error(
  8961. "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"
  8962. );
  8963. }
  8964. addList(result.plugins);
  8965. if (result.settings) {
  8966. namespace.settings = (0, import_extend.default)(true, namespace.settings, result.settings);
  8967. }
  8968. }
  8969. function addList(plugins) {
  8970. let index2 = -1;
  8971. if (plugins === null || plugins === void 0) {
  8972. } else if (Array.isArray(plugins)) {
  8973. while (++index2 < plugins.length) {
  8974. const thing = plugins[index2];
  8975. add(thing);
  8976. }
  8977. } else {
  8978. throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
  8979. }
  8980. }
  8981. function addPlugin(plugin, parameters2) {
  8982. let index2 = -1;
  8983. let entryIndex = -1;
  8984. while (++index2 < attachers.length) {
  8985. if (attachers[index2][0] === plugin) {
  8986. entryIndex = index2;
  8987. break;
  8988. }
  8989. }
  8990. if (entryIndex === -1) {
  8991. attachers.push([plugin, ...parameters2]);
  8992. } else if (parameters2.length > 0) {
  8993. let [primary, ...rest] = parameters2;
  8994. const currentPrimary = attachers[entryIndex][1];
  8995. if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
  8996. primary = (0, import_extend.default)(true, currentPrimary, primary);
  8997. }
  8998. attachers[entryIndex] = [plugin, primary, ...rest];
  8999. }
  9000. }
  9001. }
  9002. };
  9003. var unified = new Processor().freeze();
  9004. function assertParser(name2, value) {
  9005. if (typeof value !== "function") {
  9006. throw new TypeError("Cannot `" + name2 + "` without `parser`");
  9007. }
  9008. }
  9009. function assertCompiler(name2, value) {
  9010. if (typeof value !== "function") {
  9011. throw new TypeError("Cannot `" + name2 + "` without `compiler`");
  9012. }
  9013. }
  9014. function assertUnfrozen(name2, frozen) {
  9015. if (frozen) {
  9016. throw new Error(
  9017. "Cannot call `" + name2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
  9018. );
  9019. }
  9020. }
  9021. function assertNode(node2) {
  9022. if (!isPlainObject(node2) || typeof node2.type !== "string") {
  9023. throw new TypeError("Expected node, got `" + node2 + "`");
  9024. }
  9025. }
  9026. function assertDone(name2, asyncName, complete) {
  9027. if (!complete) {
  9028. throw new Error(
  9029. "`" + name2 + "` finished async. Use `" + asyncName + "` instead"
  9030. );
  9031. }
  9032. }
  9033. function vfile(value) {
  9034. return looksLikeAVFile(value) ? value : new VFile(value);
  9035. }
  9036. function looksLikeAVFile(value) {
  9037. return Boolean(
  9038. value && typeof value === "object" && "message" in value && "messages" in value
  9039. );
  9040. }
  9041. function looksLikeAValue(value) {
  9042. return typeof value === "string" || isUint8Array2(value);
  9043. }
  9044. function isUint8Array2(value) {
  9045. return Boolean(
  9046. value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
  9047. );
  9048. }
  9049. // node_modules/react-markdown/lib/index.js
  9050. var changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
  9051. var emptyPlugins = [];
  9052. var emptyRemarkRehypeOptions = { allowDangerousHtml: true };
  9053. var safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
  9054. var deprecations = [
  9055. { from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
  9056. { from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
  9057. {
  9058. from: "allowNode",
  9059. id: "replace-allownode-allowedtypes-and-disallowedtypes",
  9060. to: "allowElement"
  9061. },
  9062. {
  9063. from: "allowedTypes",
  9064. id: "replace-allownode-allowedtypes-and-disallowedtypes",
  9065. to: "allowedElements"
  9066. },
  9067. { from: "className", id: "remove-classname" },
  9068. {
  9069. from: "disallowedTypes",
  9070. id: "replace-allownode-allowedtypes-and-disallowedtypes",
  9071. to: "disallowedElements"
  9072. },
  9073. { from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
  9074. { from: "includeElementIndex", id: "#remove-includeelementindex" },
  9075. {
  9076. from: "includeNodeIndex",
  9077. id: "change-includenodeindex-to-includeelementindex"
  9078. },
  9079. { from: "linkTarget", id: "remove-linktarget" },
  9080. { from: "plugins", id: "change-plugins-to-remarkplugins", to: "remarkPlugins" },
  9081. { from: "rawSourcePos", id: "#remove-rawsourcepos" },
  9082. { from: "renderers", id: "change-renderers-to-components", to: "components" },
  9083. { from: "source", id: "change-source-to-children", to: "children" },
  9084. { from: "sourcePos", id: "#remove-sourcepos" },
  9085. { from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
  9086. { from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" }
  9087. ];
  9088. function Markdown(options) {
  9089. const processor = createProcessor(options);
  9090. const file = createFile(options);
  9091. return post(processor.runSync(processor.parse(file), file), options);
  9092. }
  9093. async function MarkdownAsync(options) {
  9094. const processor = createProcessor(options);
  9095. const file = createFile(options);
  9096. const tree = await processor.run(processor.parse(file), file);
  9097. return post(tree, options);
  9098. }
  9099. function MarkdownHooks(options) {
  9100. const processor = createProcessor(options);
  9101. const [error, setError] = (0, import_react.useState)(
  9102. /** @type {Error | undefined} */
  9103. void 0
  9104. );
  9105. const [tree, setTree] = (0, import_react.useState)(
  9106. /** @type {Root | undefined} */
  9107. void 0
  9108. );
  9109. (0, import_react.useEffect)(
  9110. function() {
  9111. let cancelled = false;
  9112. const file = createFile(options);
  9113. processor.run(processor.parse(file), file, function(error2, tree2) {
  9114. if (!cancelled) {
  9115. setError(error2);
  9116. setTree(tree2);
  9117. }
  9118. });
  9119. return function() {
  9120. cancelled = true;
  9121. };
  9122. },
  9123. [
  9124. options.children,
  9125. options.rehypePlugins,
  9126. options.remarkPlugins,
  9127. options.remarkRehypeOptions
  9128. ]
  9129. );
  9130. if (error) throw error;
  9131. return tree ? post(tree, options) : options.fallback;
  9132. }
  9133. function createProcessor(options) {
  9134. const rehypePlugins = options.rehypePlugins || emptyPlugins;
  9135. const remarkPlugins = options.remarkPlugins || emptyPlugins;
  9136. const remarkRehypeOptions = options.remarkRehypeOptions ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions } : emptyRemarkRehypeOptions;
  9137. const processor = unified().use(remarkParse).use(remarkPlugins).use(remarkRehype, remarkRehypeOptions).use(rehypePlugins);
  9138. return processor;
  9139. }
  9140. function createFile(options) {
  9141. const children = options.children || "";
  9142. const file = new VFile();
  9143. if (typeof children === "string") {
  9144. file.value = children;
  9145. } else {
  9146. unreachable(
  9147. "Unexpected value `" + children + "` for `children` prop, expected `string`"
  9148. );
  9149. }
  9150. return file;
  9151. }
  9152. function post(tree, options) {
  9153. const allowedElements = options.allowedElements;
  9154. const allowElement = options.allowElement;
  9155. const components = options.components;
  9156. const disallowedElements = options.disallowedElements;
  9157. const skipHtml = options.skipHtml;
  9158. const unwrapDisallowed = options.unwrapDisallowed;
  9159. const urlTransform = options.urlTransform || defaultUrlTransform;
  9160. for (const deprecation of deprecations) {
  9161. if (Object.hasOwn(options, deprecation.from)) {
  9162. unreachable(
  9163. "Unexpected `" + deprecation.from + "` prop, " + (deprecation.to ? "use `" + deprecation.to + "` instead" : "remove it") + " (see <" + changelog + "#" + deprecation.id + "> for more info)"
  9164. );
  9165. }
  9166. }
  9167. if (allowedElements && disallowedElements) {
  9168. unreachable(
  9169. "Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"
  9170. );
  9171. }
  9172. visit(tree, transform);
  9173. return toJsxRuntime(tree, {
  9174. Fragment: import_jsx_runtime.Fragment,
  9175. components,
  9176. ignoreInvalidStyle: true,
  9177. jsx: import_jsx_runtime.jsx,
  9178. jsxs: import_jsx_runtime.jsxs,
  9179. passKeys: true,
  9180. passNode: true
  9181. });
  9182. function transform(node2, index2, parent) {
  9183. if (node2.type === "raw" && parent && typeof index2 === "number") {
  9184. if (skipHtml) {
  9185. parent.children.splice(index2, 1);
  9186. } else {
  9187. parent.children[index2] = { type: "text", value: node2.value };
  9188. }
  9189. return index2;
  9190. }
  9191. if (node2.type === "element") {
  9192. let key;
  9193. for (key in urlAttributes) {
  9194. if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
  9195. const value = node2.properties[key];
  9196. const test = urlAttributes[key];
  9197. if (test === null || test.includes(node2.tagName)) {
  9198. node2.properties[key] = urlTransform(String(value || ""), key, node2);
  9199. }
  9200. }
  9201. }
  9202. }
  9203. if (node2.type === "element") {
  9204. let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
  9205. if (!remove && allowElement && typeof index2 === "number") {
  9206. remove = !allowElement(node2, index2, parent);
  9207. }
  9208. if (remove && parent && typeof index2 === "number") {
  9209. if (unwrapDisallowed && node2.children) {
  9210. parent.children.splice(index2, 1, ...node2.children);
  9211. } else {
  9212. parent.children.splice(index2, 1);
  9213. }
  9214. return index2;
  9215. }
  9216. }
  9217. }
  9218. }
  9219. function defaultUrlTransform(value) {
  9220. const colon = value.indexOf(":");
  9221. const questionMark = value.indexOf("?");
  9222. const numberSign = value.indexOf("#");
  9223. const slash = value.indexOf("/");
  9224. if (
  9225. // If there is no protocol, it’s relative.
  9226. colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
  9227. slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
  9228. safeProtocol.test(value.slice(0, colon))
  9229. ) {
  9230. return value;
  9231. }
  9232. return "";
  9233. }
  9234. export {
  9235. MarkdownAsync,
  9236. MarkdownHooks,
  9237. Markdown as default,
  9238. defaultUrlTransform
  9239. };
  9240. //# sourceMappingURL=react-markdown.js.map