// loaders.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import { parseWMSError } from "./lib/parsers/wms/parse-wms-error.js"; // __VERSION__ is injected by babel-plugin-version-inline // @ts-ignore TS2304: Cannot find name '__VERSION__'. const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest'; /** * Loader for the response to the WMS GetCapability request */ export const WMSErrorLoader = { dataType: null, batchType: null, id: 'wms-error', name: 'WMS Error', module: 'wms', version: VERSION, worker: false, extensions: ['xml'], mimeTypes: ['application/vnd.ogc.se_xml', 'application/xml', 'text/xml'], testText: testXMLFile, options: { wms: { throwOnError: false } }, parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options), parseSync: (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options), parseTextSync: (text, options) => parseTextSync(text, options) }; function testXMLFile(text) { // TODO - There could be space first. return text.startsWith('