{"ast":null,"code":"\"use strict\";\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n  if (k2 === undefined) k2 = k;\n  var desc = Object.getOwnPropertyDescriptor(m, k);\n  if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n    desc = {\n      enumerable: true,\n      get: function get() {\n        return m[k];\n      }\n    };\n  }\n  Object.defineProperty(o, k2, desc);\n} : function (o, m, k, k2) {\n  if (k2 === undefined) k2 = k;\n  o[k2] = m[k];\n});\nvar __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {\n  Object.defineProperty(o, \"default\", {\n    enumerable: true,\n    value: v\n  });\n} : function (o, v) {\n  o[\"default\"] = v;\n});\nvar __importStar = this && this.__importStar || function (mod) {\n  if (mod && mod.__esModule) return mod;\n  var result = {};\n  if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n  __setModuleDefault(result, mod);\n  return result;\n};\nvar __importDefault = this && this.__importDefault || function (mod) {\n  return mod && mod.__esModule ? mod : {\n    \"default\": mod\n  };\n};\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.LogBoxInspectorCodeFrame = void 0;\nvar react_1 = __importDefault(require(\"react\"));\nvar react_native_1 = require(\"react-native-web/dist/index\");\nvar AnsiHighlight_1 = require(\"../UI/AnsiHighlight\");\nvar LogBoxButton_1 = require(\"../UI/LogBoxButton\");\nvar LogBoxStyle = __importStar(require(\"../UI/LogBoxStyle\"));\nvar constants_1 = require(\"../UI/constants\");\nvar formatProjectFilePath_1 = require(\"../formatProjectFilePath\");\nvar openFileInEditor_1 = __importDefault(require(\"../modules/openFileInEditor\"));\nvar LogBoxInspectorSection_1 = require(\"./LogBoxInspectorSection\");\nfunction LogBoxInspectorCodeFrame(_ref) {\n  var codeFrame = _ref.codeFrame;\n  if (codeFrame == null) {\n    return null;\n  }\n  function getFileName() {\n    return (0, formatProjectFilePath_1.formatProjectFilePath)(\"/Users/Daniel.Antelo/Workspaces/expo-template-reactrouter-nativebase/apps/myapp\", codeFrame === null || codeFrame === void 0 ? void 0 : codeFrame.fileName);\n  }\n  function getLocation() {\n    var location = codeFrame === null || codeFrame === void 0 ? void 0 : codeFrame.location;\n    if (location != null) {\n      return ` (${location.row}:${location.column + 1})`;\n    }\n    return null;\n  }\n  return react_1.default.createElement(LogBoxInspectorSection_1.LogBoxInspectorSection, {\n    heading: \"Source\"\n  }, react_1.default.createElement(react_native_1.View, {\n    style: styles.box\n  }, react_1.default.createElement(react_native_1.View, {\n    style: styles.frame\n  }, react_1.default.createElement(react_native_1.ScrollView, {\n    horizontal: true\n  }, react_1.default.createElement(AnsiHighlight_1.Ansi, {\n    style: styles.content,\n    text: codeFrame.content\n  }))), react_1.default.createElement(LogBoxButton_1.LogBoxButton, {\n    backgroundColor: {\n      default: \"transparent\",\n      pressed: LogBoxStyle.getBackgroundDarkColor(1)\n    },\n    style: styles.button,\n    onPress: function onPress() {\n      var _a, _b;\n      (0, openFileInEditor_1.default)(codeFrame.fileName, (_b = (_a = codeFrame.location) === null || _a === void 0 ? void 0 : _a.row) !== null && _b !== void 0 ? _b : 0);\n    }\n  }, react_1.default.createElement(react_native_1.Text, {\n    style: styles.fileText\n  }, getFileName(), getLocation()))));\n}\nexports.LogBoxInspectorCodeFrame = LogBoxInspectorCodeFrame;\nvar styles = react_native_1.StyleSheet.create({\n  box: {\n    backgroundColor: LogBoxStyle.getBackgroundColor(),\n    borderWidth: 1,\n    borderColor: \"#323232\",\n    marginLeft: 10,\n    marginRight: 10,\n    marginTop: 5,\n    borderRadius: 3\n  },\n  frame: {\n    padding: 10,\n    borderBottomColor: LogBoxStyle.getTextColor(0.1),\n    borderBottomWidth: 1\n  },\n  button: {\n    paddingTop: 10,\n    paddingBottom: 10\n  },\n  content: {\n    color: LogBoxStyle.getTextColor(1),\n    fontSize: 12,\n    includeFontPadding: false,\n    lineHeight: 20,\n    fontFamily: constants_1.CODE_FONT\n  },\n  fileText: {\n    userSelect: \"none\",\n    color: LogBoxStyle.getTextColor(0.5),\n    textAlign: \"center\",\n    flex: 1,\n    fontSize: 16,\n    includeFontPadding: false,\n    fontFamily: constants_1.CODE_FONT\n  }\n});","map":{"version":3,"sources":["../../../src/error-overlay/overlay/LogBoxInspectorCodeFrame.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAA,OAAA,GAAA,eAAA,CAAA,OAAA,CAAA,OAAA,CAAA,CAAA;AAA0B,IAAA,cAAA,GAAA,OAAA;AAI1B,IAAA,eAAA,GAAA,OAAA,sBAAA,CAAA;AACA,IAAA,cAAA,GAAA,OAAA,qBAAA,CAAA;AACA,IAAA,WAAA,GAAA,YAAA,CAAA,OAAA,oBAAA,CAAA,CAAA;AACA,IAAA,WAAA,GAAA,OAAA,kBAAA,CAAA;AACA,IAAA,uBAAA,GAAA,OAAA,2BAAA,CAAA;AACA,IAAA,kBAAA,GAAA,eAAA,CAAA,OAAA,8BAAA,CAAA,CAAA;AACA,IAAA,wBAAA,GAAA,OAAA,2BAAA,CAAA;AAIA,SAAgB,wBAAwB,CAAA,IAAA,EAIvC;EAAA,IAHC,SAAS,GAAA,IAAA,CAAT,SAAS;EAIT,IAAI,SAAS,IAAI,IAAI,EAAE;IACrB,OAAO,IAAI;EACZ;EAED,SAAS,WAAW,CAAA,EAAA;IAClB,OAAO,CAAA,CAAA,EAAA,uBAAA,CAAA,qBAAqB,qFAE1B,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,QAAQ,CACpB;EACH;EAEA,SAAS,WAAW,CAAA,EAAA;IAClB,IAAM,QAAQ,GAAG,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,QAAQ;IACpC,IAAI,QAAQ,IAAI,IAAI,EAAE;MACpB,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A,CAAA,OAAA,CAAA,aAAA,CAAC,cAAA,CAAA,IAAI,EAAA;IAAC,KAAK,EAAE,MAAM,CAAC;EAAQ,CAAA,EACzB,WAAW,CAAA,CAAE,EACb,WAAW,CAAA,CAAE,CACT,CACM,CACV,CACgB;AAE7B;AArDA,OAAA,CAAA,wBAAA,GAAA,wBAAA;AAuDA,IAAM,MAAM,GAAG,cAAA,CAAA,UAAU,CAAC,MAAM,CAAC;EAC/B,GAAG,EAAE;IACH,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAA,CAAE;IACjD,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE;GACf;EACD,KAAK,EAAE;IACL,OAAO,EAAE,EAAE;IACX,iBAAiB,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;IAChD,iBAAiB,EAAE;GACpB;EACD,MAAM,EAAE;IACN,UAAU,EAAE,EAAE;IACd,aAAa,EAAE;GAChB;EACD,OAAO,EAAE;IACP,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;IAClC,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,KAAK;IACzB,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,WAAA,CAAA;GACb;EACD,QAAQ,EAAE;IACR,UAAU,EAAE,MAAM;IAClB,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;IACpC,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,KAAK;IACzB,UAAU,EAAE,WAAA,CAAA;EACb;CACF,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React from \"react\";\nimport { ScrollView, StyleSheet, Text, View } from \"react-native\";\n\nimport type { CodeFrame } from \"../Data/parseLogBoxLog\";\nimport { Ansi } from \"../UI/AnsiHighlight\";\nimport { LogBoxButton } from \"../UI/LogBoxButton\";\nimport * as LogBoxStyle from \"../UI/LogBoxStyle\";\nimport { CODE_FONT } from \"../UI/constants\";\nimport { formatProjectFilePath } from \"../formatProjectFilePath\";\nimport openFileInEditor from \"../modules/openFileInEditor\";\nimport { LogBoxInspectorSection } from \"./LogBoxInspectorSection\";\n\ndeclare const process: any;\n\nexport function LogBoxInspectorCodeFrame({\n  codeFrame,\n}: {\n  codeFrame?: CodeFrame;\n}) {\n  if (codeFrame == null) {\n    return null;\n  }\n\n  function getFileName() {\n    return formatProjectFilePath(\n      process.env.EXPO_PROJECT_ROOT,\n      codeFrame?.fileName\n    );\n  }\n\n  function getLocation() {\n    const location = codeFrame?.location;\n    if (location != null) {\n      return ` (${location.row}:${\n        location.column + 1 /* Code frame columns are zero indexed */\n      })`;\n    }\n\n    return null;\n  }\n\n  return (\n    <LogBoxInspectorSection heading=\"Source\">\n      <View style={styles.box}>\n        <View style={styles.frame}>\n          <ScrollView horizontal>\n            <Ansi style={styles.content} text={codeFrame.content} />\n          </ScrollView>\n        </View>\n        <LogBoxButton\n          backgroundColor={{\n            default: \"transparent\",\n            pressed: LogBoxStyle.getBackgroundDarkColor(1),\n          }}\n          style={styles.button}\n          onPress={() => {\n            openFileInEditor(codeFrame.fileName, codeFrame.location?.row ?? 0);\n          }}\n        >\n          <Text style={styles.fileText}>\n            {getFileName()}\n            {getLocation()}\n          </Text>\n        </LogBoxButton>\n      </View>\n    </LogBoxInspectorSection>\n  );\n}\n\nconst styles = StyleSheet.create({\n  box: {\n    backgroundColor: LogBoxStyle.getBackgroundColor(),\n    borderWidth: 1,\n    borderColor: \"#323232\",\n    marginLeft: 10,\n    marginRight: 10,\n    marginTop: 5,\n    borderRadius: 3,\n  },\n  frame: {\n    padding: 10,\n    borderBottomColor: LogBoxStyle.getTextColor(0.1),\n    borderBottomWidth: 1,\n  },\n  button: {\n    paddingTop: 10,\n    paddingBottom: 10,\n  },\n  content: {\n    color: LogBoxStyle.getTextColor(1),\n    fontSize: 12,\n    includeFontPadding: false,\n    lineHeight: 20,\n    fontFamily: CODE_FONT,\n  },\n  fileText: {\n    userSelect: \"none\",\n    color: LogBoxStyle.getTextColor(0.5),\n    textAlign: \"center\",\n    flex: 1,\n    fontSize: 16,\n    includeFontPadding: false,\n    fontFamily: CODE_FONT,\n  },\n});\n"],"sourceRoot":""},"metadata":{},"sourceType":"script"}