{
  "namespace": "tabContentExtractor",
  "types": [
    {
      "id": "tabContentExtractor.ContentSource",
      "type": "string",
      "enum": [
        "local_file",
        "remote_url",
        "data_url",
        "blob_url",
        "unknown"
      ]
    },
    {
      "id": "tabContentExtractor.ErrorCode",
      "type": "string",
      "enum": [
        "INVALID_TAB",
        "INVALID_URL",
        "FILE_NOT_FOUND",
        "ACCESS_DENIED",
        "NETWORK_ERROR",
        "UNKNOWN_ERROR"
      ]
    },
    {
      "id": "tabContentExtractor.ContentResult",
      "type": "object",
      "properties": {
        "content": {
          "type": "binary"
        },
        "mimeType": {
          "type": "string"
        },
        "size": {
          "type": "number"
        },
        "source": {
          "$ref": "tabContentExtractor.ContentSource"
        },
        "url": {
          "type": "string"
        },
        "fileName": {
          "type": "string",
          "optional": true
        },
        "lastModified": {
          "type": "number",
          "optional": true
        },
        "isTextContent": {
          "type": "boolean"
        }
      }
    },
    {
      "id": "tabContentExtractor.ErrorInfo",
      "type": "object",
      "properties": {
        "code": {
          "$ref": "tabContentExtractor.ErrorCode"
        },
        "message": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabContentExtractor.LocalFileInfo",
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "fileName": {
          "type": "string"
        },
        "mimeType": {
          "type": "string"
        },
        "size": {
          "type": "number"
        },
        "lastModified": {
          "type": "number"
        },
        "isTextContent": {
          "type": "boolean"
        },
        "maxReadChunkSize": {
          "type": "integer"
        }
      }
    },
    {
      "id": "tabContentExtractor.ReadFileChunkOptions",
      "type": "object",
      "properties": {
        "expectedSize": {
          "type": "number",
          "optional": true
        },
        "expectedLastModified": {
          "type": "number",
          "optional": true
        }
      }
    },
    {
      "id": "tabContentExtractor.FileChunkResult",
      "type": "object",
      "properties": {
        "content": {
          "type": "binary"
        },
        "offset": {
          "type": "number"
        },
        "bytesRead": {
          "type": "integer"
        },
        "fileSize": {
          "type": "number"
        },
        "lastModified": {
          "type": "number"
        },
        "eof": {
          "type": "boolean"
        }
      }
    },
    {
      "id": "tabContentExtractor.PdfTextSource",
      "type": "string",
      "enum": [
        "embedded",
        "ocr",
        "empty"
      ]
    },
    {
      "id": "tabContentExtractor.PdfTextPage",
      "type": "object",
      "properties": {
        "pageIndex": {
          "type": "integer"
        },
        "text": {
          "type": "string"
        },
        "source": {
          "$ref": "tabContentExtractor.PdfTextSource"
        }
      }
    },
    {
      "id": "tabContentExtractor.PdfTextOptions",
      "type": "object",
      "properties": {
        "startPage": {
          "type": "integer",
          "minimum": 0,
          "optional": true
        },
        "maxPages": {
          "type": "integer",
          "minimum": 1,
          "optional": true
        },
        "maxTextBytes": {
          "type": "integer",
          "minimum": 1,
          "optional": true
        }
      }
    },
    {
      "id": "tabContentExtractor.PdfOcrTextOptions",
      "type": "object",
      "properties": {
        "startPage": {
          "type": "integer",
          "minimum": 0,
          "optional": true
        },
        "maxPages": {
          "type": "integer",
          "minimum": 1,
          "optional": true
        },
        "maxTextBytes": {
          "type": "integer",
          "minimum": 1,
          "optional": true
        },
        "ocrTimeoutMs": {
          "type": "integer",
          "minimum": 1000,
          "optional": true
        }
      }
    },
    {
      "id": "tabContentExtractor.PdfTextResult",
      "type": "object",
      "properties": {
        "pages": {
          "type": "array",
          "items": {
            "$ref": "tabContentExtractor.PdfTextPage"
          }
        },
        "pageCount": {
          "type": "integer"
        },
        "nextPage": {
          "type": "integer",
          "optional": true
        },
        "textBytes": {
          "type": "integer"
        },
        "truncated": {
          "type": "boolean"
        },
        "searchifyUsed": {
          "type": "boolean"
        },
        "ocrTimedOut": {
          "type": "boolean"
        }
      }
    },
    {
      "id": "tabContentExtractor.CurrentPdfSnapshotInfo",
      "type": "object",
      "properties": {
        "byteLength": {
          "type": "number",
          "minimum": 1
        },
        "pageCount": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    {
      "id": "tabContentExtractor.CurrentPdfSnapshot",
      "type": "object",
      "properties": {
        "data": {
          "type": "binary"
        },
        "pageCount": {
          "type": "integer"
        },
        "currentPage": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  ],
  "functions": [
    {
      "name": "extractContent",
      "type": "function",
      "parameters": [
        {
          "name": "url",
          "type": "string"
        },
        {
          "name": "tabId",
          "type": "integer",
          "minimum": 0,
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabContentExtractor.ContentResult"
          }
        ]
      }
    },
    {
      "name": "getFileInfo",
      "type": "function",
      "parameters": [
        {
          "name": "url",
          "type": "string"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "info",
            "$ref": "tabContentExtractor.LocalFileInfo"
          }
        ]
      }
    },
    {
      "name": "readFileChunk",
      "type": "function",
      "parameters": [
        {
          "name": "url",
          "type": "string"
        },
        {
          "name": "offset",
          "type": "number",
          "minimum": 0
        },
        {
          "name": "size",
          "type": "integer",
          "minimum": 1
        },
        {
          "name": "options",
          "$ref": "tabContentExtractor.ReadFileChunkOptions",
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabContentExtractor.FileChunkResult"
          }
        ]
      }
    },
    {
      "name": "extractPdfText",
      "type": "function",
      "parameters": [
        {
          "name": "tabId",
          "type": "integer",
          "minimum": 0
        },
        {
          "name": "options",
          "$ref": "tabContentExtractor.PdfTextOptions",
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabContentExtractor.PdfTextResult"
          }
        ]
      }
    },
    {
      "name": "extractPdfTextWithOcr",
      "type": "function",
      "parameters": [
        {
          "name": "tabId",
          "type": "integer",
          "minimum": 0
        },
        {
          "name": "options",
          "$ref": "tabContentExtractor.PdfOcrTextOptions",
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabContentExtractor.PdfTextResult"
          }
        ]
      }
    },
    {
      "name": "getCurrentPdfSnapshotInfo",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabContentExtractor.CurrentPdfSnapshotInfo"
          }
        ]
      }
    },
    {
      "name": "getCurrentPdfSnapshot",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabContentExtractor.CurrentPdfSnapshot"
          }
        ]
      }
    },
    {
      "name": "executeCurrentPdfViewerScript",
      "type": "function",
      "parameters": [
        {
          "name": "tabId",
          "type": "integer",
          "minimum": 0
        },
        {
          "name": "code",
          "type": "string",
          "minLength": 1
        },
        {
          "name": "previewer",
          "type": "boolean",
          "optional": true
        },
        {
          "name": "htmlPreview",
          "type": "boolean",
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "handled",
            "type": "boolean"
          }
        ]
      }
    }
  ]
}