12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182(** Used internally, no need to use *)(* https://github.com/facebook/react/blob/97d75c9c8bcddb0daed1ed062101c7f5e9b825f4/packages/react-dom-bindings/src/shared/omittedCloseTags.js *)letis_self_closing_tag=function|"area"|"base"|"br"|"col"|"embed"|"hr"|"img"|"input"|"link"|"meta"|"param"|"source"|"track"|"wbr"|"menuitem"->true|_->false(* This function is borrowed from https://github.com/dbuenzli/htmlit/blob/62d8f21a9233791a5440311beac02a4627c3a7eb/src/htmlit.ml#L10-L28 *)letescape_and_addbs=letadds=Buffer.add_stringinletlen=String.lengthsinletmax_idx=len-1inletflushbstarti=ifstart<lenthenBuffer.add_substringbsstart(i-start)inletrecloopstarti=ifi>max_idxthenflushbstartielseletnext=i+1inmatchString.getsiwith|'&'->flushbstarti;addsb"&";loopnextnext|'<'->flushbstarti;addsb"<";loopnextnext|'>'->flushbstarti;addsb">";loopnextnext|'\''->flushbstarti;addsb"'";loopnextnext|'\"'->flushbstarti;addsb""";loopnextnext|_->loopstartnextinloop00letis_html_elementtag=matchtagwith|"a"|"abbr"|"address"|"area"|"article"|"aside"|"audio"|"b"|"base"|"bdi"|"bdo"|"blockquote"|"body"|"br"|"button"|"canvas"|"caption"|"cite"|"code"|"col"|"colgroup"|"data"|"datalist"|"dd"|"del"|"details"|"dfn"|"dialog"|"div"|"dl"|"dt"|"em"|"embed"|"fieldset"|"figcaption"|"figure"|"footer"|"form"|"h1"|"h2"|"h3"|"h4"|"h5"|"h6"|"head"|"header"|"hgroup"|"hr"|"html"|"i"|"iframe"|"img"|"input"|"ins"|"kbd"|"label"|"legend"|"li"|"link"|"main"|"map"|"mark"|"math"|"menu"|"menuitem"|"meta"|"meter"|"nav"|"noscript"|"object"|"ol"|"optgroup"|"option"|"output"|"p"|"param"|"picture"|"pre"|"progress"|"q"|"rb"|"rp"|"rt"|"rtc"|"ruby"|"s"|"samp"|"script"|"search"|"section"|"select"|"slot"|"small"|"source"|"span"|"strong"|"style"|"sub"|"summary"|"sup"|"svg"|"table"|"tbody"|"td"|"template"|"textarea"|"tfoot"|"th"|"thead"|"time"|"title"|"tr"|"track"|"u"|"ul"|"var"|"video"|"wbr"->true|_->falseletis_svg_elementtag=matchtagwith|"animate"|"animateMotion"|"animateTransform"|"circle"|"clipPath"|"defs"|"desc"|"ellipse"|"feBlend"|"feColorMatrix"|"feComponentTransfer"|"feComposite"|"feConvolveMatrix"|"feDiffuseLighting"|"feDisplacementMap"|"feDistantLight"|"feDropShadow"|"feFlood"|"feFuncA"|"feFuncB"|"feFuncG"|"feFuncR"|"feGaussianBlur"|"feImage"|"feMerge"|"feMergeNode"|"feMorphology"|"feOffset"|"fePointLight"|"feSpecularLighting"|"feSpotLight"|"feTile"|"feTurbulence"|"filter"|"foreignObject"|"g"|"image"|"line"|"linearGradient"|"marker"|"mask"|"metadata"|"mpath"|"path"|"pattern"|"polygon"|"polyline"|"radialGradient"|"rect"|"stop"|"switch"|"symbol"|"text"|"textPath"|"tspan"|"use"|"view"->true|_->false