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); }
/*
 * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { Error as ErrorIcon, Spin } from "@blueprintjs/icons";
import classnames from "classnames";
import React, { useCallback } from "react";
import { useMediaContents } from "../shared/hooks/useMediaContents.js";
import { BaseExcelViewer } from "./BaseExcelViewer.js";
import { parseSpreadsheetFromResponse } from "./parseSpreadsheet.js";
import styles from "./BaseExcelViewer.module.css";
export function ExcelViewer({
  media,
  className,
  ...excelViewerProps
}) {
  const {
    data: spreadsheet,
    loading,
    error
  } = useMediaContents(media, useCallback(parseSpreadsheetFromResponse, []));
  const rootClassName = classnames(styles.container, className);
  return /*#__PURE__*/React.createElement("div", {
    className: rootClassName
  }, loading && /*#__PURE__*/React.createElement("div", {
    className: styles.loadingContainer
  }, /*#__PURE__*/React.createElement(Spin, {
    className: styles.spinnerIcon
  }), "Loading\u2026"), error != null && /*#__PURE__*/React.createElement("div", {
    className: styles.errorContainer
  }, /*#__PURE__*/React.createElement(ErrorIcon, {
    className: styles.errorIcon
  }), "Failed to load spreadsheet: ", error.message), spreadsheet != null && /*#__PURE__*/React.createElement(BaseExcelViewer, _extends({
    spreadsheet: spreadsheet
  }, excelViewerProps)));
}
//# sourceMappingURL=ExcelViewer.js.map