{"ast":null,"code":"import _JSON$stringify from \"@babel/runtime-corejs2/core-js/json/stringify\";\nimport _Array$isArray from \"@babel/runtime-corejs2/core-js/array/is-array\";\nimport _Reflect$construct from \"@babel/runtime-corejs2/core-js/reflect/construct\";\nimport _classCallCheck from \"@babel/runtime-corejs2/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime-corejs2/helpers/createClass\";\nimport _inherits from \"@babel/runtime-corejs2/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime-corejs2/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime-corejs2/helpers/getPrototypeOf\";\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(_Reflect$construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nimport * as React from \"react\";\nimport NotebookPreview from \"@nteract/notebook-preview\";\nimport Markdown from \"@nteract/markdown\";\nimport { Source } from \"@nteract/presentational-components\";\nimport { standardTransforms, standardDisplayOrder, registerTransform } from \"@nteract/transforms\";\nimport { VegaLite1, VegaLite2, Vega2, Vega3 } from \"@nteract/transform-vega\"; // import DataResourceTransform from \"@nteract/transform-dataresource\";\n\nimport { PlotlyNullTransform, PlotlyTransform } from \"../../transforms\";\nimport DirectoryListing from \"./directory-listing\";\nimport HTMLView from \"./html\";\nimport JSONView from \"./json\";\nimport CSVView from \"./csv\";\n\nvar jquery = require(\"jquery\"); // HACK: Temporarily provide jquery for others to use...\n\n\nglobal.jquery = jquery;\nglobal.$ = jquery; // Order is important here. The last transform in the array will have order `0`.\n\nvar _reduce = [// DataResourceTransform,\nPlotlyNullTransform, PlotlyTransform, VegaLite1, VegaLite2, Vega2, Vega3].reduce(registerTransform, {\n  transforms: standardTransforms,\n  displayOrder: standardDisplayOrder\n}),\n    transforms = _reduce.transforms,\n    displayOrder = _reduce.displayOrder;\n\nvar suffixRegex = /(?:\\.([^.]+))?$/;\n\nvar File = /*#__PURE__*/function (_React$Component) {\n  _inherits(File, _React$Component);\n\n  var _super = _createSuper(File);\n\n  function File() {\n    _classCallCheck(this, File);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(File, [{\n    key: \"shouldComponentUpdate\",\n    value: function shouldComponentUpdate() {\n      return false;\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var name = this.props.entry.name;\n      var presuffix = suffixRegex.exec(name);\n\n      if (!presuffix) {\n        return null;\n      }\n\n      var suffix = (presuffix[1] || \"\").toLowerCase();\n\n      switch (suffix) {\n        case \"html\":\n          return /*#__PURE__*/React.createElement(HTMLView, {\n            entry: this.props.entry\n          });\n\n        case \"json\":\n          return /*#__PURE__*/React.createElement(JSONView, {\n            entry: this.props.entry\n          });\n\n        case \"csv\":\n          return /*#__PURE__*/React.createElement(CSVView, {\n            entry: this.props.entry\n          });\n\n        case \"md\":\n        case \"markdown\":\n        case \"rmd\":\n          return /*#__PURE__*/React.createElement(Markdown, {\n            source: this.props.entry.content\n          });\n\n        case \"js\":\n          return /*#__PURE__*/React.createElement(Source, {\n            language: \"javascript\"\n          }, this.props.entry.content);\n\n        case \"py\":\n        case \"pyx\":\n          return /*#__PURE__*/React.createElement(Source, {\n            language: \"python\"\n          }, this.props.entry.content);\n\n        case \"gif\":\n        case \"jpeg\":\n        case \"jpg\":\n        case \"png\":\n          return /*#__PURE__*/React.createElement(\"img\", {\n            src: \"/files/\".concat(this.props.pathname),\n            alt: this.props.pathname\n          });\n\n        default:\n          if (this.props.entry.format === \"text\") {\n            return /*#__PURE__*/React.createElement(Source, {\n              language: \"text/plain\"\n            }, this.props.entry.content);\n          }\n\n          return /*#__PURE__*/React.createElement(\"a\", {\n            href: \"/files/\".concat(this.props.pathname)\n          }, \"Download raw file\");\n      }\n    }\n  }]);\n\n  return File;\n}(React.Component);\n\nexport var Entry = function Entry(props) {\n  if (props.entry.content === null) {\n    return null;\n  }\n\n  switch (props.entry.type) {\n    case \"directory\":\n      // Dynamic type check on content being an Array\n      if (_Array$isArray(props.entry.content)) {\n        return /*#__PURE__*/React.createElement(DirectoryListing, {\n          contents: props.entry.content,\n          basepath: \"/view\"\n        });\n      }\n\n      return null;\n\n    case \"file\":\n      // TODO: Case off various file types (by extension, mimetype)\n      return /*#__PURE__*/React.createElement(File, {\n        entry: props.entry,\n        pathname: props.pathname\n      });\n\n    case \"notebook\":\n      return /*#__PURE__*/React.createElement(NotebookPreview, {\n        notebook: props.entry.content,\n        displayOrder: displayOrder,\n        transforms: transforms\n      });\n\n    default:\n      return /*#__PURE__*/React.createElement(\"pre\", null, _JSON$stringify(props.entry.content));\n  }\n};","map":null,"metadata":{},"sourceType":"module"}