'use strict';

var chunkMVQKV5BJ_cjs = require('./chunk-MVQKV5BJ.cjs');
var classnames = require('classnames');
var React2 = require('react');
var icons = require('@blueprintjs/icons');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var classnames__default = /*#__PURE__*/_interopDefault(classnames);
var React2__default = /*#__PURE__*/_interopDefault(React2);

// src/xml-viewer/BaseXmlViewer.module.css
var BaseXmlViewer_default = {};

// src/xml-viewer/BaseXmlViewer.tsx
function BaseXmlViewer({
  content,
  className
}) {
  const rootClassName = classnames__default.default(BaseXmlViewer_default.container, className);
  return /* @__PURE__ */ React2__default.default.createElement("div", {
    className: rootClassName
  }, /* @__PURE__ */ React2__default.default.createElement("div", {
    className: BaseXmlViewer_default.scrollWrapper
  }, /* @__PURE__ */ React2__default.default.createElement("pre", {
    className: BaseXmlViewer_default.code
  }, /* @__PURE__ */ React2__default.default.createElement("code", null, content))));
}
function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}
var transformToText = async (response) => {
  return response.text();
};
function XmlViewer({
  media,
  className,
  ...xmlViewerProps
}) {
  const {
    data: content,
    loading,
    error
  } = chunkMVQKV5BJ_cjs.useMediaContents(media, transformToText);
  const rootClassName = classnames__default.default(BaseXmlViewer_default.container, className);
  return /* @__PURE__ */ React2__default.default.createElement("div", {
    className: rootClassName
  }, loading && /* @__PURE__ */ React2__default.default.createElement("div", {
    className: BaseXmlViewer_default.loadingContainer
  }, /* @__PURE__ */ React2__default.default.createElement(icons.Spin, {
    className: BaseXmlViewer_default.spinnerIcon
  }), "Loading\u2026"), error != null && /* @__PURE__ */ React2__default.default.createElement("div", {
    className: BaseXmlViewer_default.errorContainer
  }, /* @__PURE__ */ React2__default.default.createElement(icons.Error, {
    className: BaseXmlViewer_default.errorIcon
  }), "Failed to load XML: ", error.message), content != null && /* @__PURE__ */ React2__default.default.createElement(BaseXmlViewer, _extends({
    content
  }, xmlViewerProps)));
}

exports.BaseXmlViewer = BaseXmlViewer;
exports.XmlViewer = XmlViewer;
//# sourceMappingURL=chunk-RVZE7LPI.cjs.map
//# sourceMappingURL=chunk-RVZE7LPI.cjs.map