(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/xml/libxml#parser-e
    (lambda (_source560_ _parse-string561_ _parse-u8vector562_ _parse-port563_)
      (if (string? _source560_)
          _parse-string561_
          (if (u8vector? _source560_)
              (lambda (_src565_ _url566_ _enc567_ _opt568_)
                (_parse-u8vector562_
                 _src565_
                 '0
                 (u8vector-length _src565_)
                 _url566_
                 _enc567_
                 _opt568_))
              (if (input-port? _source560_)
                  _parse-port563_
                  (error '"Illegal source; Expected string, u8vector, or input-port"
                         _source560_))))))
  (define std/xml/libxml#parse-xml__%
    (lambda (_g4168_
             _url515521_
             _encoding516523_
             _options517525_
             _ns518527_
             _source529_)
      (let* ((_url531_
              (if (eq? _url515521_ absent-value) '"none.xml" _url515521_))
             (_encoding533_
              (if (eq? _encoding516523_ absent-value)
                  '"UTF-8"
                  _encoding516523_))
             (_options535_
              (if (eq? _options517525_ absent-value)
                  std/xml/libxml#parse-xml-default-options
                  _options517525_))
             (_ns537_ (if (eq? _ns518527_ absent-value) '() _ns518527_))
             (_parse539_
              (std/xml/libxml#parser-e
               _source529_
               std/xml/libxml#xmlRead-string
               std/xml/libxml#xmlRead-u8vector
               std/xml/libxml#xmlRead-port))
             (_xtree541_
              (_parse539_ _source529_ _url531_ _encoding533_ _options535_)))
        (if _xtree541_
            (with-unwind-protect
             (lambda () (std/xml/libxml#xml-doc->sxml _xtree541_ _ns537_))
             (lambda () (std/xml/libxml#xmlFreeDoc _xtree541_)))
            (error '"Error parsing xml; no parse tree" _source529_)))))
  (define std/xml/libxml#parse-xml__@
    (lambda (_keys514549_ . _args551_)
      (apply std/xml/libxml#parse-xml__%
             _keys514549_
             (table-ref _keys514549_ 'url: absent-value)
             (table-ref _keys514549_ 'encoding: absent-value)
             (table-ref _keys514549_ 'options: absent-value)
             (table-ref _keys514549_ 'namespaces: absent-value)
             _args551_)))
  (define std/xml/libxml#parse-xml
    (lambda _args519557_
      (apply keyword-dispatch
             '#(url: options: #f #f encoding: namespaces:)
             std/xml/libxml#parse-xml__@
             _args519557_)))
  (define std/xml/libxml#parse-html__%
    (lambda (_g4169_
             _url468474_
             _encoding469476_
             _options470478_
             _filter-els471480_
             _source482_)
      (let* ((_url484_
              (if (eq? _url468474_ absent-value) '"none.html" _url468474_))
             (_encoding486_
              (if (eq? _encoding469476_ absent-value)
                  '"UTF-8"
                  _encoding469476_))
             (_options488_
              (if (eq? _options470478_ absent-value)
                  std/xml/libxml#parse-html-default-options
                  _options470478_))
             (_filter-els490_
              (if (eq? _filter-els471480_ absent-value)
                  '()
                  _filter-els471480_))
             (_parse492_
              (std/xml/libxml#parser-e
               _source482_
               std/xml/libxml#htmlRead-string
               std/xml/libxml#htmlRead-u8vector
               std/xml/libxml#htmlRead-port))
             (_xtree494_
              (_parse492_ _source482_ _url484_ _encoding486_ _options488_)))
        (if _xtree494_
            (with-unwind-protect
             (lambda ()
               (std/xml/libxml#html-doc->sxml
                _xtree494_
                (std/xml/libxml#node-filter-e _filter-els490_)))
             (lambda () (std/xml/libxml#xmlFreeDoc _xtree494_)))
            (error '"Error parsing html; no parse tree" _source482_)))))
  (define std/xml/libxml#parse-html__@
    (lambda (_keys467502_ . _args504_)
      (apply std/xml/libxml#parse-html__%
             _keys467502_
             (table-ref _keys467502_ 'url: absent-value)
             (table-ref _keys467502_ 'encoding: absent-value)
             (table-ref _keys467502_ 'options: absent-value)
             (table-ref _keys467502_ 'filter: absent-value)
             _args504_)))
  (define std/xml/libxml#parse-html
    (lambda _args472510_
      (apply keyword-dispatch
             '#(encoding: options: url: filter:)
             std/xml/libxml#parse-html__@
             _args472510_)))
  (define std/xml/libxml#xml-doc->sxml
    (lambda (_xtree433_ _ns434_)
      (letrec* ((_nsmap436_
                 (if (table? _ns434_)
                     _ns434_
                     (if (pair? _ns434_) (list->table _ns434_) '#f)))
                (_ns-name-e437_
                 (lambda (_node451_ _node-name452_ _node-ns453_)
                   (let ((_name455_ (_node-name452_ _node451_))
                         (_ns456_ (_node-ns453_ _node451_)))
                     (if _ns456_
                         (let* ((_href458_ (std/xml/libxml#xmlNs-href _ns456_))
                                (_pre463_
                                 (let ((_$e460_ (if _nsmap436_
                                                    (table-ref
                                                     _nsmap436_
                                                     _href458_
                                                     '#f)
                                                    '#f)))
                                   (if _$e460_ _$e460_ _href458_))))
                           (string->symbol
                            (string-append _pre463_ '":" _name455_)))
                         (string->symbol _name455_)))))
                (_element-e438_
                 (lambda (_node449_)
                   (_ns-name-e437_
                    _node449_
                    std/xml/libxml#xmlNode-name
                    std/xml/libxml#xmlNode-ns)))
                (_attribute-e439_
                 (lambda (_node447_)
                   (_ns-name-e437_
                    _node447_
                    std/xml/libxml#xmlAttr-name
                    std/xml/libxml#xmlAttr-ns))))
        (let ((_body444_
               (std/xml/libxml#xmlNode->sxml
                (std/xml/libxml#xmlDocGetRootElement _xtree433_)
                false
                _element-e438_
                _attribute-e439_))
              (_nsassoc445_
               (if _nsmap436_
                   (hash-map
                    (lambda (_href441_ _pre442_)
                      (cons (string->symbol _pre442_) (cons _href441_ '())))
                    _nsmap436_)
                   '#f)))
          (if _nsassoc445_
              (cons '*TOP*
                    (cons (cons '@
                                (cons (cons '*NAMESPACES* _nsassoc445_) '()))
                          _body444_))
              (cons '*TOP* _body444_))))))
  (define std/xml/libxml#html-doc->sxml
    (lambda (_xtree430_ _filter-e431_)
      (cons '*TOP*
            (std/xml/libxml#xmlNode->sxml
             (std/xml/libxml#xmlDocGetRootElement _xtree430_)
             _filter-e431_
             std/xml/libxml#xmlNode-name-e
             std/xml/libxml#xmlAttr-name-e))))
  (define std/xml/libxml#xmlNode->sxml
    (lambda (_node414_ _filter-e415_ _element-e416_ _attribute-e417_)
      (let _recur419_ ((_node421_ _node414_))
        (if _node421_
            (if (_filter-e415_ _node421_)
                (_recur419_ (std/xml/libxml#xmlNode-next _node421_))
                (let ((_type423_ (std/xml/libxml#xmlNode-type _node421_))
                      (_rest424_
                       (_recur419_ (std/xml/libxml#xmlNode-next _node421_))))
                  (if (eq? _type423_ std/xml/libxml#XML_ELEMENT_NODE)
                      (let ((_el426_ (_element-e416_ _node421_))
                            (_attr427_
                             (std/xml/libxml#xmlNode-properties _node421_))
                            (_children428_
                             (_recur419_
                              (std/xml/libxml#xmlNode-children _node421_))))
                        (if _attr427_
                            (cons (cons _el426_
                                        (cons (cons '@
                                                    (std/xml/libxml#xmlAttr->list
                                                     _attr427_
                                                     _attribute-e417_))
                                              _children428_))
                                  _rest424_)
                            (cons (cons _el426_ _children428_) _rest424_)))
                      (if (eq? _type423_ std/xml/libxml#XML_TEXT_NODE)
                          (cons (std/xml/libxml#xmlNode-content _node421_)
                                _rest424_)
                          (if (eq? _type423_
                                   std/xml/libxml#XML_CDATA_SECTION_NODE)
                              (cons (cons '*CDATA*
                                          (cons (std/xml/libxml#xmlNode-content
                                                 _node421_)
                                                '()))
                                    _rest424_)
                              (if (eq? _type423_
                                       std/xml/libxml#XML_COMMENT_NODE)
                                  _rest424_
                                  (error '"Unexpected node"
                                         (std/xml/libxml#xmlNode-name
                                          _node421_)
                                         _type423_)))))))
            '()))))
  (define std/xml/libxml#xmlAttr->list
    (lambda (_attr402_ _attribute-e403_)
      (let _recur405_ ((_attr407_ _attr402_))
        (if _attr407_
            (let* ((_value409_ (std/xml/libxml#xmlAttr-children _attr407_))
                   (_value411_
                    (if _value409_
                        (cons (std/xml/libxml#xmlNode-content _value409_) '())
                        '())))
              (cons (cons (_attribute-e403_ _attr407_) _value411_)
                    (_recur405_ (std/xml/libxml#xmlAttr-next _attr407_))))
            '()))))
  (define std/xml/libxml#xmlNode-name-e
    (lambda (_node400_)
      (string->symbol (std/xml/libxml#xmlNode-name _node400_))))
  (define std/xml/libxml#xmlAttr-name-e
    (lambda (_node398_)
      (string->symbol (std/xml/libxml#xmlAttr-name _node398_))))
  (define std/xml/libxml#parse-xml-default-options
    (fxior std/xml/libxml#XML_PARSE_NOENT
           std/xml/libxml#XML_PARSE_NONET
           std/xml/libxml#XML_PARSE_NOBLANKS))
  (define std/xml/libxml#parse-html-default-options
    (fxior std/xml/libxml#HTML_PARSE_RECOVER
           std/xml/libxml#HTML_PARSE_NOERROR
           std/xml/libxml#HTML_PARSE_NOWARNING
           std/xml/libxml#HTML_PARSE_NONET
           std/xml/libxml#HTML_PARSE_NOBLANKS))
  (define std/xml/libxml#node-filter-e
    (lambda (_elems388_)
      (if (null? _elems388_)
          false
          (lambda (_node390_)
            (let ((_name391393_ (std/xml/libxml#xmlNode-name _node390_)))
              (if _name391393_
                  (let ((_name396_ _name391393_))
                    (member _name396_ _elems388_))
                  '#f)))))))
