Svg.resource.search: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 2053-2065 of gralha-svg-render@0.1.0.1/svg.bend: https://jend.leeeet.dev/read.txt?path=gralha-svg-render@0.1.0.1/svg.bend&start_line=2053&end_line=2065 import Base import gralha-text-scan@0.1.0.1/scan.bend as U import gralha-xml-doc@0.1.0.1/xml.bend as XML import gralha-css-style@0.1.0.1/css.bend as CSS # A lookup runs rarely, so it branches through lambdas over copies. def resource.search(xs: List<&2, XML.Element>, +id: String, +chain: List<&2, List<&2, XML.Attr>>) -> Maybe<&2, XML.Element>: match xs: case Nil{}: None{} case Con{XML.Element{n, as, kids, txt}, rest}: +nn = n +attrs = as +kk = kids +tt = txt U.branch(Maybe<&2, XML.Element>, U.string.equal(XML.attr.get(attrs, "id", ""), id), _ => resource.found(nn, resource.resolve(chain, CSS.properties(attrs)), kk, tt), _ => XML.element.prefer(U.branch(Maybe<&2, XML.Element>, U.string.equal(nn, "#svg-image"), _ => None{}, _ => resource.search(kk, id, Con{attrs, chain})), resource.search(rest, id, chain))) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=properties https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=resource.found https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=resource.resolve https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=string.equal https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Attr https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Element https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=attr.get https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=element.prefer